JSPM

parse-css-dimension

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2413
  • Score
    100M100P100Q120047F
  • License MIT

Parse a CSS dimension (i.e., number, length, percentage) into a JavaScript object.

Package Exports

  • parse-css-dimension

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-css-dimension) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parse-css-dimension

NPM version npm license Travis Build Status

npm

Parse a CSS dimension (i.e., number, length, percentage) into a JavaScript object.

Installation

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

Usage

var parseCssDimension = require('parse-css-dimension');
parseCssDimension('-3.4e-2');  // { type: 'number', value: -0.034 }
parseCssDimension('42em');     // { type: 'length', value: 42, unit: 'em' }
parseCssDimension('42%');      // { type: 'percentage', value: 42 }

Testing

$ npm test

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