Merge pull request #507 from devdevdata222/patch-1

PLURALS -> ALIASES, add arcmin, arcsec
This commit is contained in:
Jos de Jong 2015-11-18 16:20:52 +01:00
commit d4036149eb

View File

@ -1901,7 +1901,23 @@ function factory (type, config, load, typed) {
value: 6.2831853071795864769252867665793,
offset: 0
},
// arcsec = rad / (3600 * (360 / 2 * pi)) = rad / 0.0000048481368110953599358991410235795
arcsec: {
name: 'arcsec',
base: BASE_UNITS.ANGLE,
prefixes: PREFIXES.NONE,
value: 0.0000048481368110953599358991410235795,
offset: 0
},
// arcmin = rad / (60 * (360 / 2 * pi)) = rad / 0.00029088820866572159615394846141477
arcmin: {
name: 'arcmin',
base: BASE_UNITS.ANGLE,
prefixes: PREFIXES.NONE,
value: 0.00029088820866572159615394846141477,
offset: 0
},
// Electric current
A: {
name: 'A',
@ -2310,8 +2326,8 @@ function factory (type, config, load, typed) {
}
};
// plurals
var PLURALS = {
// aliases (formerly plurals)
var ALIASES = {
meters: 'meter',
inches: 'inch',
feet: 'foot',
@ -2353,10 +2369,17 @@ function factory (type, config, load, typed) {
hours: 'hour',
days: 'day',
radian: 'rad',
radians: 'rad',
degree: 'deg',
degrees: 'deg',
gradients: 'grad',
gradian: 'grad',
gradians: 'grad',
cycles: 'cycle',
arcsecond: 'arcsec',
arcseconds: 'arcsec',
arcminute: 'arcmin',
arcminutes: 'arcmin',
BTUs: 'BTU',
watts: 'watt',
@ -2481,23 +2504,23 @@ function factory (type, config, load, typed) {
unit.dimensions = unit.base.dimensions;
}
for (var name in PLURALS) {
for (var name in ALIASES) {
/* istanbul ignore next (we cannot really test next statement) */
if (PLURALS.hasOwnProperty(name)) {
var unit = UNITS[PLURALS[name]];
var plural = Object.create(unit);
plural.name = name;
UNITS[name] = plural;
if (ALIASES.hasOwnProperty(name)) {
var unit = UNITS[ALIASES[name]];
var alias = Object.create(unit);
alias.name = name;
UNITS[name] = alias;
}
}
// aliases
UNITS.lt = UNITS.l;
UNITS.liter = UNITS.litre;
UNITS.liters = UNITS.litres;
UNITS.lb = UNITS.lbm;
UNITS.lbs = UNITS.lbm;
Unit.PREFIXES = PREFIXES;
Unit.BASE_UNITS = BASE_UNITS;
Unit.UNITS = UNITS;