em-px
v0.1.1
Published
A module to convert EM in PX.
Downloads
3
Maintainers
Readme
em-px
A module to convert EM in PX.
Installation
$ [sudo] npm install --save em-px
Usage
var emPx = require('em-px');
emPx(0.667, 24, true)
.then(function(px) {
console.log(px); // 16px
})
.catch(function(err) {
console.log(err.message);
});
Or
var emPx = require('em-px');
emPx('0.667em', '24px', true)
.then(function(px) {
console.log(px); // 16px
})
.catch(function(err) {
console.log(err.message);
});
API
emPx(em, [base], [format])
Type: number
or string
Returns a promise that resolves to the value converted.
em
Required
Type: number
or string
Pixel value to converting.
base
Type: number
or string
Default: 16
Base value to converting.
format
Type: boolean
Default: false
Format value to formatting.
Related
See px-em for the inverse.
License
MIT © Cícero Pablo