# parse-css-font

> Parse the CSS font property value.

Latest version **4.0.0** (published 2019-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install parse-css-font
pnpm add parse-css-font
yarn add parse-css-font
bun add parse-css-font
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2019-01-28 |
| First published | 2015-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 60.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Jed Mao |
| Maintainers | jedmao |
| Keywords | css, parse, font, shorthand |

## Links

- npm: https://www.npmjs.com/package/parse-css-font
- Repository: https://github.com/jedmao/parse-css-font
- Homepage: https://github.com/jedmao/parse-css-font#readme
- Issues: https://github.com/jedmao/parse-css-font/issues
- npm.io page: https://npm.io/package/parse-css-font

## Dependencies (7)

- [unquote](https://npm.io/package/unquote.md) ^1.1.1
- [css-list-helpers](https://npm.io/package/css-list-helpers.md) ^2.0.0
- [css-font-size-keywords](https://npm.io/package/css-font-size-keywords.md) ^1.0.0
- [css-font-style-keywords](https://npm.io/package/css-font-style-keywords.md) ^1.0.1
- [css-font-weight-keywords](https://npm.io/package/css-font-weight-keywords.md) ^1.0.0
- [css-system-font-keywords](https://npm.io/package/css-system-font-keywords.md) ^1.0.0
- [css-font-stretch-keywords](https://npm.io/package/css-font-stretch-keywords.md) ^1.0.1

## 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

- 4.0.0 (latest) — 2019-01-28
- 3.0.4 — 2019-01-28
- 3.0.3 — 2019-01-28
- 3.0.2 — 2018-05-21
- 3.0.1 — 2018-05-04
- 3.0.0 — 2018-05-04
- 2.0.2 — 2015-10-02
- 2.0.1 — 2015-10-02
- 2.0.0 — 2015-10-02
- 1.0.0 — 2015-09-27

## README

# parse-css-font

[![NPM version](http://img.shields.io/npm/v/parse-css-font.svg?style=flat)](https://www.npmjs.org/package/parse-css-font)
[![npm license](http://img.shields.io/npm/l/parse-css-font.svg?style=flat-square)](https://www.npmjs.org/package/parse-css-font)
[![Travis Build Status](https://img.shields.io/travis/jedmao/parse-css-font.svg)](https://travis-ci.org/jedmao/parse-css-font)
[![codecov](https://codecov.io/gh/jedmao/parse-css-font/branch/master/graph/badge.svg)](https://codecov.io/gh/jedmao/parse-css-font)
[![BundlePhobia Minified](https://badgen.net/bundlephobia/min/parse-css-font?label=min)](https://bundlephobia.com/result?p=parse-css-font)
[![BundlePhobia Minified + gzip](https://badgen.net/bundlephobia/minzip/parse-css-font?label=min%2Bgzip)](https://bundlephobia.com/result?p=parse-css-font)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Unicorn Approved](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://twitter.com/sindresorhus/status/457989012528316416?ref_src=twsrc%5Etfw&ref_url=https%3A%2F%2Fwww.quora.com%2FWhat-does-the-unicorn-approved-shield-mean-in-GitHub)

[![npm](https://nodei.co/npm/parse-css-font.svg?downloads=true)](https://nodei.co/npm/parse-css-font/)

Parses the CSS [font property](https://developer.mozilla.org/en-US/docs/Web/CSS/font#font-variant-css21).

## Installation

```
$ npm install parse-css-font [--save[-dev]]
```

## Usage

```js
const parseCSSFont = require('parse-css-font')
parseCSSFont('1rem "Roboto Condensed", sans-serif;')
/*
{
	size: '1rem',
	family: ['Roboto Condensed', 'sans-serif'],
	style: 'normal',
	variant: 'normal',
	weight: 'normal',
	stretch: 'normal',
	lineHeight: 'normal'
}
*/
```

See [the tests](https://github.com/jedmao/parse-css-font/blob/master/src/index.test.ts) for more scenarios.

### ES6/2015 import

```ts
import parseCSSFont from 'parse-css-font'
```

## Testing

```
$ npm test
```

This will run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.

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