Very simple parsing and stringifying of style attributes.
Convert a style attribute string to an object.
-
inputs:
- string (eg. anything you might see in a style attribute)
- options (optional)
-
return: object
Convert an object into an attribute string
- input: object
- return: string
Normalize an attribute string (eg. collapse duplicates)
-
inputs:
- string
- options (optional)
-
return: string
Options for parse()
and normalize
follow the same format:
{
preserveNumbers: boolean // (default: false)
}
Setting preserveNumbers
to true
recognises number values and converts them to a Number.
MIT