UNPKG

755 BTypeScriptView Raw
1/**
2 * Parses inline style to object.
3 *
4 * @example
5 * import StyleToObject from 'style-to-object';
6 * StyleToObject('line-height: 42;');
7 */
8declare function StyleToObject(
9 style: string,
10 iterator?: StyleToObject.Iterator
11): { [name: string]: string } | null;
12
13export = StyleToObject;
14
15declare namespace StyleToObject {
16 interface DeclarationPos {
17 line: number;
18 column: number;
19 }
20
21 // declaration is an object from module `inline-style-parser`
22 interface Declaration {
23 type: string;
24 property: string;
25 value: string;
26 position: {
27 start: DeclarationPos;
28 end: DeclarationPos;
29 source: any;
30 };
31 }
32
33 type Iterator = (
34 property: string,
35 value: string,
36 declaration: Declaration
37 ) => void;
38}