# @f/apply-styles

> Apply a style object to a DOM node

Latest version **1.0.6** (published 2016-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/apply-styles
pnpm add @f/apply-styles
yarn add @f/apply-styles
bun add @f/apply-styles
```

## 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.0.6 |
| Published | 2016-06-08 |
| First published | 2016-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/apply-styles
- Repository: https://github.com/micro-js/apply-styles
- Homepage: https://github.com/micro-js/apply-styles#readme
- Issues: https://github.com/micro-js/apply-styles/issues
- npm.io page: https://npm.io/package/@f/apply-styles

## Dependencies (2)

- [@f/has](https://npm.io/package/@f/has.md) ^1.0.0
- [@f/css-default-units](https://npm.io/package/@f/css-default-units.md) ^1.0.0

## Recent versions

- 1.0.6 (latest) — 2016-06-08
- 1.0.5 — 2016-06-08
- 1.0.4 — 2016-04-04
- 1.0.3 — 2016-03-30
- 1.0.2 — 2016-03-18
- 1.0.1 — 2016-01-30
- 1.0.0 — 2016-01-29

## README

# apply-styles

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Apply a style object to a DOM node, optionally diffing against a previous set of styles.

## Installation

    $ npm install @f/apply-styles

## Usage

```js
var applyStyles = require('@f/apply-styles')

function setAttribute (node, name, value, prevValue) {
  if (name === 'style') {
    applyStyles(node, value, prevValue)
  }

  // ...set other kinds of attributes...
}
```

## API

### applyStyles(node, styles, prevStyles)

- `node` - The DOM node to apply the styles to
- `styles` - The styles you want to set
- `prevStyles` - Optional, a previous style object to diff against (i.e. remove props that are not set in the current `style`)

**Returns:** *void*

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/apply-styles.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/apply-styles
[git-image]: https://img.shields.io/github/tag/micro-js/apply-styles.svg
[git-url]: https://github.com/micro-js/apply-styles
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/apply-styles.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/apply-styles

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