1.0.0 • Published 7 years ago
bredon-plugin-precision v1.0.0
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
.
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.
1.0.0
7 years ago