UNPKG

1.26 kBTypeScriptView Raw
1export type List = {
2 /**
3 * Safely splits values.
4 *
5 * ```js
6 * Once (root, { list }) {
7 * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
8 * }
9 * ```
10 *
11 * @param string separated values.
12 * @param separators array of separators.
13 * @param last boolean indicator.
14 * @return Split values.
15 */
16 split(string: string, separators: string[], last: boolean): string[]
17 /**
18 * Safely splits space-separated values (such as those for `background`,
19 * `border-radius`, and other shorthand properties).
20 *
21 * ```js
22 * Once (root, { list }) {
23 * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
24 * }
25 * ```
26 *
27 * @param str Space-separated values.
28 * @return Split values.
29 */
30 space(str: string): string[]
31
32 /**
33 * Safely splits comma-separated values (such as those for `transition-*`
34 * and `background` properties).
35 *
36 * ```js
37 * Once (root, { list }) {
38 * list.comma('black, linear-gradient(white, black)')
39 * //=> ['black', 'linear-gradient(white, black)']
40 * }
41 * ```
42 *
43 * @param str Comma-separated values.
44 * @return Split values.
45 */
46 comma(str: string): string[]
47}
48
49declare const list: List
50
51export default list