convert-units
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -5,4 +5,4 @@ var convert | ||
, measures = { | ||
masses: require('./masses') | ||
, volumes: require('./volumes') | ||
mass: require('./definitions/mass') | ||
, volume: require('./definitions/volume') | ||
} | ||
@@ -106,2 +106,16 @@ , Converter; | ||
/** | ||
* An alias for getUnit | ||
*/ | ||
Converter.prototype.describe = function (abbr) { | ||
var resp = Converter.prototype.getUnit(abbr); | ||
return { | ||
measure: resp.measure | ||
, system: resp.system | ||
, singular: resp.unit.name.singular | ||
, plural: resp.unit.name.plural | ||
}; | ||
}; | ||
Converter.prototype.throwUnsupportedUnitError = function (what) { | ||
@@ -108,0 +122,0 @@ var validUnits = []; |
{ | ||
"name": "convert-units", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Convert between quantities in different units", | ||
@@ -29,2 +29,2 @@ "main": "lib", | ||
"license": "MIT" | ||
} | ||
} |
@@ -39,9 +39,23 @@ convert-units | ||
```js | ||
convert(1).from('ltr').possibilities(); | ||
convert().from('ltr').possibilities(); | ||
// [ 'ml', 'ltr', 'tsp', 'tbsp', 'fl-oz', 'cup', 'pnt', 'qt', 'gal' ] | ||
convert(1).from('kg').possibilities(); | ||
convert().from('kg').possibilities(); | ||
// [ 'mcg', 'mg', 'g', 'kg', 'oz', 'lb' ] | ||
``` | ||
To get a detailed description of a unit, use `describe` | ||
``` | ||
convert().describe('kg') | ||
/* | ||
{ | ||
measure: 'mass' | ||
, system: 'metric' | ||
, singular: 'Kilogram' | ||
, plural: 'Kilograms' | ||
} | ||
*/ | ||
``` | ||
Supported Units | ||
@@ -48,0 +62,0 @@ --------------- |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112
9008
7
274
1