Skip to content

joshwnj/style-attr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

style-attr

Very simple parsing and stringifying of style attributes.

Build Status

parse

Convert a style attribute string to an object.

  • inputs:

    • string (eg. anything you might see in a style attribute)
    • options (optional)
  • return: object

stringify

Convert an object into an attribute string

  • input: object
  • return: string

normalize

Normalize an attribute string (eg. collapse duplicates)

  • inputs:

  • return: string

Args

options

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.

License

MIT

About

Parse and stringify style attributes

Resources

License

Stars

Watchers

Forks

Packages

No packages published