convert-units
Advanced tools
Comparing version 3.0.0-beta.5 to 3.0.0-beta.6
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const SI = { | ||
Ws: { | ||
name: { | ||
singular: 'Watt-second', | ||
plural: 'Watt-seconds', | ||
}, | ||
to_anchor: 1, | ||
}, | ||
Wm: { | ||
name: { | ||
singular: 'Watt-minute', | ||
plural: 'Watt-minutes', | ||
}, | ||
to_anchor: 60, | ||
}, | ||
Wh: { | ||
@@ -68,7 +82,36 @@ name: { | ||
}; | ||
const nutrition = { | ||
cal: { | ||
name: { | ||
singular: 'calorie', | ||
plural: 'calories', | ||
}, | ||
to_anchor: 1, | ||
}, | ||
kcal: { | ||
name: { | ||
singular: 'Kilocalorie', | ||
plural: 'Kilocalories', | ||
}, | ||
to_anchor: 1000, | ||
}, | ||
}; | ||
const measure = { | ||
systems: { | ||
SI, | ||
nutrition, | ||
}, | ||
anchors: { | ||
SI: { | ||
nutrition: { | ||
ratio: 1 / 4.184, | ||
}, | ||
}, | ||
nutrition: { | ||
SI: { | ||
ratio: 4.184, | ||
}, | ||
}, | ||
}, | ||
}; | ||
exports.default = measure; |
@@ -25,2 +25,9 @@ "use strict"; | ||
}, | ||
kgf: { | ||
name: { | ||
singular: 'Kilogram-force', | ||
plural: 'Kilogram-forces', | ||
}, | ||
to_anchor: 9.807, | ||
}, | ||
}; | ||
@@ -27,0 +34,0 @@ const measure = { |
@@ -48,2 +48,9 @@ "use strict"; | ||
const imperial = { | ||
mil: { | ||
name: { | ||
singular: 'Mil', | ||
plural: 'Mils', | ||
}, | ||
to_anchor: 1 / 12000, | ||
}, | ||
in: { | ||
@@ -50,0 +57,0 @@ name: { |
@@ -55,2 +55,9 @@ "use strict"; | ||
}, | ||
st: { | ||
name: { | ||
singular: 'Stone', | ||
plural: 'Stones', | ||
}, | ||
to_anchor: 14, | ||
}, | ||
t: { | ||
@@ -57,0 +64,0 @@ name: { |
@@ -46,2 +46,16 @@ "use strict"; | ||
}, | ||
mH2O: { | ||
name: { | ||
singular: 'meter of water @ 4°C', | ||
plural: 'meters of water @ 4°C', | ||
}, | ||
to_anchor: 9.80665, | ||
}, | ||
mmHg: { | ||
name: { | ||
singular: 'millimeter of mercury', | ||
plural: 'millimeters of mercury', | ||
}, | ||
to_anchor: 0.133322, | ||
}, | ||
}; | ||
@@ -48,0 +62,0 @@ const imperial = { |
@@ -14,4 +14,4 @@ "use strict"; | ||
name: { | ||
singular: 'degree Kelvin', | ||
plural: 'degrees Kelvin', | ||
singular: 'Kelvin', | ||
plural: 'Kelvins', | ||
}, | ||
@@ -18,0 +18,0 @@ to_anchor: 1, |
@@ -25,15 +25,6 @@ "use strict"; | ||
}; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Converter = exports.allMeasures = void 0; | ||
const convert_1 = __importStar(require("./convert")); | ||
Object.defineProperty(exports, "Converter", { enumerable: true, get: function () { return convert_1.Converter; } }); | ||
const definitions_1 = __importDefault(require("./definitions")); | ||
exports.allMeasures = definitions_1.default; | ||
exports.default = convert_1.default; | ||
__exportStar(require("./definitions"), exports); | ||
exports.Converter = void 0; | ||
const convert_js_1 = __importStar(require("./convert.js")); | ||
Object.defineProperty(exports, "Converter", { enumerable: true, get: function () { return convert_js_1.Converter; } }); | ||
exports.default = convert_js_1.default; |
const SI = { | ||
Ws: { | ||
name: { | ||
singular: 'Watt-second', | ||
plural: 'Watt-seconds', | ||
}, | ||
to_anchor: 1, | ||
}, | ||
Wm: { | ||
name: { | ||
singular: 'Watt-minute', | ||
plural: 'Watt-minutes', | ||
}, | ||
to_anchor: 60, | ||
}, | ||
Wh: { | ||
@@ -66,7 +80,36 @@ name: { | ||
}; | ||
const nutrition = { | ||
cal: { | ||
name: { | ||
singular: 'calorie', | ||
plural: 'calories', | ||
}, | ||
to_anchor: 1, | ||
}, | ||
kcal: { | ||
name: { | ||
singular: 'Kilocalorie', | ||
plural: 'Kilocalories', | ||
}, | ||
to_anchor: 1000, | ||
}, | ||
}; | ||
const measure = { | ||
systems: { | ||
SI, | ||
nutrition, | ||
}, | ||
anchors: { | ||
SI: { | ||
nutrition: { | ||
ratio: 1 / 4.184, | ||
}, | ||
}, | ||
nutrition: { | ||
SI: { | ||
ratio: 4.184, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default measure; |
@@ -23,2 +23,9 @@ const SI = { | ||
}, | ||
kgf: { | ||
name: { | ||
singular: 'Kilogram-force', | ||
plural: 'Kilogram-forces', | ||
}, | ||
to_anchor: 9.807, | ||
}, | ||
}; | ||
@@ -25,0 +32,0 @@ const measure = { |
@@ -46,2 +46,9 @@ const metric = { | ||
const imperial = { | ||
mil: { | ||
name: { | ||
singular: 'Mil', | ||
plural: 'Mils', | ||
}, | ||
to_anchor: 1 / 12000, | ||
}, | ||
in: { | ||
@@ -48,0 +55,0 @@ name: { |
@@ -53,2 +53,9 @@ const metric = { | ||
}, | ||
st: { | ||
name: { | ||
singular: 'Stone', | ||
plural: 'Stones', | ||
}, | ||
to_anchor: 14, | ||
}, | ||
t: { | ||
@@ -55,0 +62,0 @@ name: { |
@@ -44,2 +44,16 @@ const metric = { | ||
}, | ||
mH2O: { | ||
name: { | ||
singular: 'meter of water @ 4°C', | ||
plural: 'meters of water @ 4°C', | ||
}, | ||
to_anchor: 9.80665, | ||
}, | ||
mmHg: { | ||
name: { | ||
singular: 'millimeter of mercury', | ||
plural: 'millimeters of mercury', | ||
}, | ||
to_anchor: 0.133322, | ||
}, | ||
}; | ||
@@ -46,0 +60,0 @@ const imperial = { |
@@ -12,4 +12,4 @@ const metric = { | ||
name: { | ||
singular: 'degree Kelvin', | ||
plural: 'degrees Kelvin', | ||
singular: 'Kelvin', | ||
plural: 'Kelvins', | ||
}, | ||
@@ -16,0 +16,0 @@ to_anchor: 1, |
@@ -1,5 +0,3 @@ | ||
import configMeasurements, { Converter } from './convert'; | ||
import allMeasures from './definitions'; | ||
import configMeasurements, { Converter } from './convert.js'; | ||
export default configMeasurements; | ||
export * from './definitions'; | ||
export { allMeasures, Converter }; | ||
export { Converter }; |
@@ -13,2 +13,16 @@ (function (factory) { | ||
const SI = { | ||
Ws: { | ||
name: { | ||
singular: 'Watt-second', | ||
plural: 'Watt-seconds', | ||
}, | ||
to_anchor: 1, | ||
}, | ||
Wm: { | ||
name: { | ||
singular: 'Watt-minute', | ||
plural: 'Watt-minutes', | ||
}, | ||
to_anchor: 60, | ||
}, | ||
Wh: { | ||
@@ -78,8 +92,37 @@ name: { | ||
}; | ||
const nutrition = { | ||
cal: { | ||
name: { | ||
singular: 'calorie', | ||
plural: 'calories', | ||
}, | ||
to_anchor: 1, | ||
}, | ||
kcal: { | ||
name: { | ||
singular: 'Kilocalorie', | ||
plural: 'Kilocalories', | ||
}, | ||
to_anchor: 1000, | ||
}, | ||
}; | ||
const measure = { | ||
systems: { | ||
SI, | ||
nutrition, | ||
}, | ||
anchors: { | ||
SI: { | ||
nutrition: { | ||
ratio: 1 / 4.184, | ||
}, | ||
}, | ||
nutrition: { | ||
SI: { | ||
ratio: 4.184, | ||
}, | ||
}, | ||
}, | ||
}; | ||
exports.default = measure; | ||
}); |
@@ -34,2 +34,9 @@ (function (factory) { | ||
}, | ||
kgf: { | ||
name: { | ||
singular: 'Kilogram-force', | ||
plural: 'Kilogram-forces', | ||
}, | ||
to_anchor: 9.807, | ||
}, | ||
}; | ||
@@ -36,0 +43,0 @@ const measure = { |
@@ -57,2 +57,9 @@ (function (factory) { | ||
const imperial = { | ||
mil: { | ||
name: { | ||
singular: 'Mil', | ||
plural: 'Mils', | ||
}, | ||
to_anchor: 1 / 12000, | ||
}, | ||
in: { | ||
@@ -59,0 +66,0 @@ name: { |
@@ -64,2 +64,9 @@ (function (factory) { | ||
}, | ||
st: { | ||
name: { | ||
singular: 'Stone', | ||
plural: 'Stones', | ||
}, | ||
to_anchor: 14, | ||
}, | ||
t: { | ||
@@ -66,0 +73,0 @@ name: { |
@@ -55,2 +55,16 @@ (function (factory) { | ||
}, | ||
mH2O: { | ||
name: { | ||
singular: 'meter of water @ 4°C', | ||
plural: 'meters of water @ 4°C', | ||
}, | ||
to_anchor: 9.80665, | ||
}, | ||
mmHg: { | ||
name: { | ||
singular: 'millimeter of mercury', | ||
plural: 'millimeters of mercury', | ||
}, | ||
to_anchor: 0.133322, | ||
}, | ||
}; | ||
@@ -57,0 +71,0 @@ const imperial = { |
@@ -23,4 +23,4 @@ (function (factory) { | ||
name: { | ||
singular: 'degree Kelvin', | ||
plural: 'degrees Kelvin', | ||
singular: 'Kelvin', | ||
plural: 'Kelvins', | ||
}, | ||
@@ -27,0 +27,0 @@ to_anchor: 1, |
@@ -24,8 +24,2 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
}; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
(function (factory) { | ||
@@ -37,3 +31,3 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./convert", "./definitions", "./definitions"], factory); | ||
define(["require", "exports", "./convert.js"], factory); | ||
} | ||
@@ -43,9 +37,6 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Converter = exports.allMeasures = void 0; | ||
const convert_1 = __importStar(require("./convert")); | ||
Object.defineProperty(exports, "Converter", { enumerable: true, get: function () { return convert_1.Converter; } }); | ||
const definitions_1 = __importDefault(require("./definitions")); | ||
exports.allMeasures = definitions_1.default; | ||
exports.default = convert_1.default; | ||
__exportStar(require("./definitions"), exports); | ||
exports.Converter = void 0; | ||
const convert_js_1 = __importStar(require("./convert.js")); | ||
Object.defineProperty(exports, "Converter", { enumerable: true, get: function () { return convert_js_1.Converter; } }); | ||
exports.default = convert_js_1.default; | ||
}); |
{ | ||
"name": "convert-units", | ||
"version": "3.0.0-beta.5", | ||
"version": "3.0.0-beta.6", | ||
"description": "Convert between quantities in different units", | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/esm/index.js", | ||
"files": [ | ||
"lib/" | ||
], | ||
"main": "./lib/cjs/index.js", | ||
"module": "./lib/esm/index.js", | ||
"types": "index.d.ts", | ||
"typesVersions": { | ||
">=4.2": { | ||
"*": [ | ||
"lib/types/*", | ||
"lib/types/definitions/*" | ||
] | ||
} | ||
}, | ||
"exports": { | ||
".": { | ||
"require": "./lib/cjs/index.js", | ||
"import": "./lib/esm/index.js", | ||
"types": "./lib/types/index.d.ts" | ||
}, | ||
"./definitions/*": { | ||
"require": "./lib/cjs/definitions/*.js", | ||
"import": "./lib/esm/definitions/*.js", | ||
"types": "./lib/types/definitions/*.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"devDependencies": { | ||
@@ -30,4 +49,13 @@ "@types/jest": "^28.1.6", | ||
"format": "prettier --write src", | ||
"compile": "tsc -p ./tsconfig.json && tsc -p ./tsconfig-cjs.json && tsc -p ./tsconfig-umd.json" | ||
"compile": "tsc -p ./tsconfig.json && tsc -p ./tsconfig.cjs.json && tsc -p ./tsconfig.umd.json && tsc -p ./tsconfig.types.json" | ||
}, | ||
"files": [ | ||
"lib/types/**/!(*.tsbuildinfo)", | ||
"lib/esm/**/!(*.tsbuildinfo)", | ||
"lib/cjs/**/!(*.tsbuildinfo)", | ||
"lib/umd/**/!(*.tsbuildinfo)", | ||
"LICENSE", | ||
"README.md", | ||
"package.json" | ||
], | ||
"repository": { | ||
@@ -34,0 +62,0 @@ "type": "git", |
@@ -29,3 +29,4 @@ convert-units | ||
// `allMeasures` includes all the measures packaged with this library | ||
import configureMeasurements, { allMeasures } from 'convert-units'; | ||
import configureMeasurements from 'convert-units'; | ||
import allMeasures from 'convert-units/definitions/all'; | ||
@@ -38,3 +39,4 @@ const convert = configureMeasurements(allMeasures); | ||
```js | ||
import configureMeasurements, { volume, mass, length } from 'convert-units'; | ||
import configureMeasurements from 'convert-units'; | ||
import volume from 'convert-units/definitions/volume'; | ||
@@ -730,8 +732,11 @@ /* | ||
import configureMeasurements, { | ||
length, | ||
LengthSystems, | ||
LengthUnits, | ||
Measure | ||
} from 'convert-units'; | ||
import | ||
length, { | ||
LengthSystems, | ||
LengthUnits, | ||
} from "convert-units/definitions/length" | ||
type NewLengthUnits = LengthUnits | 'px'; | ||
@@ -794,3 +799,4 @@ const DPI = 96; | ||
```js | ||
import configureMeasurements, { allMeasures } from 'convert-units'; | ||
import configureMeasurements from 'convert-units'; | ||
import allMeasures from 'convert-units/definitions/all'; | ||
@@ -806,11 +812,14 @@ export default configureMeasurements(allMeasures); | ||
```ts | ||
import configureMeasurements, { | ||
area, | ||
AreaSystems, | ||
AreaUnits, | ||
length, | ||
import configureMeasurements from 'convert-units'; | ||
import length, { | ||
LengthSystems, | ||
LengthUnits, | ||
} from 'convert-units'; | ||
} from "convert-units/definitions/length" | ||
import area, { | ||
AreaSystems, | ||
AreaUnits, | ||
} from "convert-units/definitions/area" | ||
// Measures: The names of the measures being used | ||
@@ -835,11 +844,14 @@ type Measures = 'length' | 'area'; | ||
```ts | ||
import configureMeasurements, { | ||
area, | ||
AreaSystems, | ||
AreaUnits, | ||
length, | ||
import configureMeasurements from 'convert-units'; | ||
import length, { | ||
LengthSystems, | ||
LengthUnits, | ||
} from 'convert-units'; | ||
} from "convert-units/definitions/length" | ||
import area, { | ||
AreaSystems, | ||
AreaUnits, | ||
} from "convert-units/definitions/area" | ||
// Measures: The names of the measures being used | ||
@@ -864,8 +876,9 @@ type Measures = 'length' | 'area'; | ||
```js | ||
import configureMeasurements, { | ||
import configureMeasurements from 'convert-units'; | ||
import allMeasures, { | ||
AllMeasures, | ||
allMeasures, | ||
AllMeasuresSystems, | ||
AllMeasuresUnits, | ||
} from 'convert-units'; | ||
} from 'convert-units/definitions/all'; | ||
@@ -928,2 +941,3 @@ const convertAll = configureMeasurements< | ||
* mt | ||
* st | ||
* t | ||
@@ -1043,2 +1057,10 @@ </details> | ||
<details> | ||
<summary>Torque</summary> | ||
* Nm | ||
* lbf-ft | ||
</details> | ||
<details> | ||
<summary>Pace</summary> | ||
@@ -1059,2 +1081,4 @@ * s/m | ||
* torr | ||
* mH2O | ||
* mmHg | ||
* psi | ||
@@ -1139,2 +1163,4 @@ * ksi | ||
<summary>Energy</summary> | ||
* Ws | ||
* Wm | ||
* Wh | ||
@@ -1183,2 +1209,3 @@ * mWh | ||
* lbf | ||
* kgf | ||
</details> | ||
@@ -1185,0 +1212,0 @@ |
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
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
1249
261197
163
8336