Files
documentation/node_modules/style-to-object/index.d.ts
2024-03-22 03:47:51 +05:30

46 lines
748 B
TypeScript

/**
* Parses inline style to object.
*
* @example
*
* ```ts
* import parse from 'style-to-object';
* parse('line-height: 42;'); // { 'line-height': '42' }
* ```
*/
export default function StyleToObject(
style: string,
iterator?: Iterator
): { [name: string]: string } | null;
interface Position {
start: {
line: number;
column: number;
};
end: {
line: number;
column: number;
};
source?: string;
}
export interface Declaration {
type: 'declaration';
property: string;
value: string;
position: Position;
}
export interface Comment {
type: 'comment';
comment: string;
position: Position;
}
type Iterator = (
property: string,
value: string,
declaration: Declaration | Comment
) => void;