1.4.16 • Published 5 years ago
weight.js v1.4.16
Weight.js
JavaScript classes to convert imperial mass units as well as output and parse as text.
Install
npm install weight.js
Usage
ES6
import {Ounces, Pounds} from 'weight.js/src/weight';
//or
import Ounces from 'weight.js/src/ounces';
//or
import Pounds from 'weight.js/src/pounds';
CommonJS
var Weight = require('weight.js');
var Ounces = Weight.Ounces;
var Pounds = Weight.Pounds;
//or
var Ounces = require('weight.js').Ounces;
//or
var Pounds = require('weight.js').Pounds;
Example
let ounces = Ounces.parse('5lbs 4 oz');
console.log(ounces.value); // 84
ounces.add(new Ounces(6));
console.log(ounces.value); // 90
if (ounces.isSame(new Ounces(90))) {
console.log(ounces.toString()); // "5 lbs 10 oz"
}
1.4.16
5 years ago
1.4.15
5 years ago
1.4.14
5 years ago
1.4.13
5 years ago
1.4.11
5 years ago
1.4.10
5 years ago
1.4.9
5 years ago
1.4.8
5 years ago
1.4.7
5 years ago
1.4.6
5 years ago
1.4.5
5 years ago
1.4.4
5 years ago
1.4.3
5 years ago
1.4.2
5 years ago
1.4.1
5 years ago
1.4.0
5 years ago
1.3.6
5 years ago
1.3.5
5 years ago
1.3.4
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.0
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago