Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

convert-units

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert-units - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

lib/definitions/mass.js

18

lib/index.js

@@ -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 = [];

4

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc