# @f/css-default-units

> Add default units to css values

Latest version **1.0.1** (published 2016-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/css-default-units
pnpm add @f/css-default-units
yarn add @f/css-default-units
bun add @f/css-default-units
```

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

## Links

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

## Dependencies (1)

- [@f/css-unitless](https://npm.io/package/@f/css-unitless.md) ^1.0.1

## Recent versions

- 1.0.1 (latest) — 2016-03-18
- 1.0.0 — 2016-01-30

## README

# css-default-units

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

Add default units to css values

## Installation

    $ npm install @f/css-default-units

## Usage

This is a very simple implementation of default units. It doesn't try to do default units for complex rules like media queries. It just handles the simplest cases, e.g. `height: 50` -> `height: 50px`. It skips [unitless properties](https://github.com/micro-js/css-unitless) when appropriate.

```js
var defaultUnits = require('@f/css-default-units')

function applyUnits (rule) {
  for (var key in rule) {
    rule[key] = defaultUnits(key, rule[key])
  }
}
```

## API

### cssDefaultUnits(key, value)

- `key` - The css property name (in camel case or hyphenated)
- `value` - The value you want to apply default units to, if appropriate

**Returns:** `value` with default units applied (if appropriate)

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/css-default-units.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/css-default-units
[git-image]: https://img.shields.io/github/tag/micro-js/css-default-units.svg
[git-url]: https://github.com/micro-js/css-default-units
[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/css-default-units.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/css-default-units

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