px-em
v0.1.1
Published
A module to convert PX in EM.
Downloads
6
Maintainers
Readme
px-em
A module to convert PX in EM.
Installation
$ [sudo] npm install --save px-em
Usage
var pxEm = require('px-em');
pxEm(16, 24, true)
.then(function(em) {
console.log(em); // 0.667em
})
.catch(function(err) {
console.log(err.message);
});
Or
var pxEm = require('px-em');
pxEm('16px', '24px', true)
.then(function(em) {
console.log(em); // 0.667em
})
.catch(function(err) {
console.log(err.message);
});
API
pxEm(px, [base], [format])
Type: number
or string
Returns a promise that resolves to the value converted.
px
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 em-px for the inverse.
License
MIT © Cícero Pablo