1.0.0 • Published 7 years ago

bredon-plugin-precision v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

bredon-plugin-precision

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.

OptionsValueDefaultDescription
precisionnumber4The 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.