Socket
Socket
Sign inDemoInstall

parse-css-font

Package Overview
Dependencies
7
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parse-css-font

Parse the CSS font property value.


Version published
Weekly downloads
19K
increased by2.57%
Maintainers
1
Install size
89.0 kB
Created
Weekly downloads
 

Changelog

Source

4.0.0

  • New: variant can have more than one value. Parsing the variant is too complex for this function, so any unknown tokens are assumed to be a variant and joined as one (e.g., foo bold bar italic qux parses a variant of foo bar qux).
  • Fix: Fixed normal overriding other declarations. The defaults are still normal and you can have any number of normals precede the size without overriding non-normal values.
  • Breaking: Removed parsing of CSS global keywords, as they don't seem to be supported. This is a fix, but it may break implementations that were relying on it.
  • Breaking: Error messaging has changed and new errors will throw when adding more than one style, weight or stretch.

Readme

Source

parse-css-font

NPM version npm license Travis Build Status codecov BundlePhobia Minified BundlePhobia Minified + gzip code style: prettier Unicorn Approved

npm

Parses the CSS font property.

Installation

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

Usage

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 for more scenarios.

ES6/2015 import

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.

Keywords

FAQs

Last updated on 28 Jan 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc