This package has been deprecated

Author message:

WARNING: This project has been renamed to mass.js. Install using mass.js instead.

weight.js

1.4.16 • Public • Published

Codacy Badge Build Status Coverage Status FOSSA Status

Weight.js

JavaScript classes to convert imperial mass units as well as output and parse as text.

Documentation

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"
}

/weight.js/

    Package Sidebar

    Install

    npm i weight.js

    Weekly Downloads

    5

    Version

    1.4.16

    License

    GPL-3.0-only

    Unpacked Size

    2.44 MB

    Total Files

    60

    Last publish

    Collaborators

    • meeklogic