bredon-plugin-precision

1.0.0 • Public • Published

bredon-plugin-precision

npm version npm downloads

The precision plugin normalizes decimal number precision.
It will automatically round up values.

Installation

yarn add bredon-plugin-precision

You may alternatively use npm i --save bredon-plugin-precision.

Usage

import { compile } from 'bredon'
import precisionPlugin from 'bredon-plugin-precision'

const input = '33.3333333% solid rgba(10, 10, 10, 0.564)'

const output = compile(input, {
  plugins: [ 
    precisionPlugin()
  ]
})

console.log(output)
// => 33.3333% solid rgba(10, 10, 10, 0.564)

Configuration

By default, the precision is set to 4.

Options Value Default Description
precision number 4 The prefered precision
import { compile } from 'bredon'
import precisionPlugin from 'bredon-plugin-precision'

const input = '33.3333333% solid rgba(10, 10, 10, 0.564)'

const output = compile(input, {
  plugins: [ 
    precisionPlugin({
      precision: 2
    })
  ]
})

console.log(output)
// => 33.3% solid rgba(10, 10, 10, 0.56)

License

Bredon is licensed under the MIT License.
Documentation is licensed under Creative Common License.
Created with ♥ by @rofrischmann and all the great contributors.

Package Sidebar

Install

npm i bredon-plugin-precision

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • rofrischmann