File tree 1 file changed +32
-25
lines changed
1 file changed +32
-25
lines changed Original file line number Diff line number Diff line change 2
2
* Parses inline style to object.
3
3
*
4
4
* @example
5
- * import StyleToObject from 'style-to-object';
6
- * StyleToObject('line-height: 42;');
5
+ *
6
+ * ```ts
7
+ * import parse from 'style-to-object';
8
+ * parse('line-height: 42;'); // { 'line-height': '42' }
9
+ * ```
7
10
*/
8
- declare function StyleToObject (
11
+ export default function StyleToObject (
9
12
style : string ,
10
- iterator ?: StyleToObject . Iterator
13
+ iterator ?: Iterator
11
14
) : { [ name : string ] : string } | null ;
12
15
13
- export = StyleToObject ;
14
-
15
- declare namespace StyleToObject {
16
- interface DeclarationPos {
16
+ interface Position {
17
+ start : {
18
+ line : number ;
19
+ column : number ;
20
+ } ;
21
+ end : {
17
22
line : number ;
18
23
column : number ;
19
- }
24
+ } ;
25
+ source ?: string ;
26
+ }
20
27
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
- }
28
+ export interface Declaration {
29
+ type : 'declaration' ;
30
+ property : string ;
31
+ value : string ;
32
+ position : Position ;
33
+ }
32
34
33
- type Iterator = (
34
- property : string ,
35
- value : string ,
36
- declaration : Declaration
37
- ) => void ;
35
+ export interface Comment {
36
+ type : 'comment' ;
37
+ comment : string ;
38
+ position : Position ;
38
39
}
40
+
41
+ type Iterator = (
42
+ property : string ,
43
+ value : string ,
44
+ declaration : Declaration | Comment
45
+ ) => void ;
You can’t perform that action at this time.
0 commit comments