mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-08 19:34:56 +02:00
46 lines
748 B
TypeScript
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;
|