# style-attr

> Parse and stringify style attributes

Latest version **1.3.0** (published 2017-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install style-attr
pnpm add style-attr
yarn add style-attr
bun add style-attr
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2017-06-02 |
| First published | 2014-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | joshwnj |
| Maintainers | joshwnj |
| Keywords | style, parse, stringify |

## Links

- npm: https://www.npmjs.com/package/style-attr
- Repository: https://github.com/joshwnj/style-attr
- Issues: https://github.com/joshwnj/style-attr/issues
- npm.io page: https://npm.io/package/style-attr

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2017-06-02
- 1.2.0 — 2016-06-30
- 1.1.0 — 2016-02-22
- 1.0.2 — 2016-02-16
- 1.0.1 — 2014-11-13
- 1.0.0 — 2014-11-10

## README

style-attr
====

Very simple parsing and stringifying of style attributes.

[![Build Status](https://secure.travis-ci.org/joshwnj/style-attr.png)](http://travis-ci.org/joshwnj/style-attr)


`parse`
----

Convert a style attribute string to an object.

- inputs:
  - string (eg. anything you might see in a style attribute)
  - [options](#opts-object) (optional)

- return: object


`stringify`
----

Convert an object into an attribute string

- input: object
- return: string


`normalize`
----

Normalize an attribute string (eg. collapse duplicates)

- inputs:
  - string
  - [options](#opts-object) (optional)

- return: string

Args
----

### `options`

<a name="opts-object"></a>

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

---
_Source: https://npm.io/package/style-attr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
