-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlist-item-style.ts
37 lines (34 loc) · 1022 Bytes
/
list-item-style.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Expression for a `ListItemStyle` type field value. Only allows select
* values outlined in the documentation.
*/
export type ListItemStyleType
= "bullet"
| "decimal"
| "lower_alphabetical"
| "upper_alphabetical"
| "lower_roman"
| "upper_roman"
| "character"
| "none";
/**
* Expression for a `ListItemStyle` character field.
*/
export type ListItemStyleCharacter = string;
/**
* Lambda for verifying `ListItemStyleCharacter` type at runtime.
* @param {ListItemStyleCharacter} s
* @returns {ListItemStyleCharacter} Validated field value or undefined
*/
export const ListItemStyleCharacter = (s: ListItemStyleCharacter): ListItemStyleCharacter | undefined =>
!!(String(s)!.match(/^.|\s$/)![0] === s)
? s
: void 0;
/**
* Signature/expression for a `ListItemStyle` object.
* @see https://developer.apple.com/documentation/apple_news/listitemstyle
*/
export interface ListItemStyle {
type: ListItemStyleType;
character?: ListItemStyleCharacter;
}