mathjs 13.0.2 → 13.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +9 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/core/function/import.js +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/unit/Unit.js +57 -114
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/function/import.js +1 -1
- package/lib/esm/type/unit/Unit.js +57 -114
- package/lib/esm/version.js +1 -1
- package/package.json +11 -11
- package/types/index.d.ts +51 -7
@@ -225,7 +225,7 @@ function importFactory(typed, load, math, importedFactories) {
|
|
225
225
|
throw new Error('Factory name should not contain a nested path. ' + 'Name: ' + JSON.stringify(name));
|
226
226
|
}
|
227
227
|
const namespace = isTransformFunctionFactory(factory) ? math.expression.transform : math;
|
228
|
-
const existingTransform =
|
228
|
+
const existingTransform = name in math.expression.transform;
|
229
229
|
const existing = (0, _object.hasOwnProperty)(namespace, name) ? namespace[name] : undefined;
|
230
230
|
const resolver = function () {
|
231
231
|
// collect all dependencies, handle finding both functions and classes and other special cases
|
package/lib/cjs/header.js
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
* It features real and complex numbers, units, matrices, a large set of
|
7
7
|
* mathematical functions, and a flexible expression parser.
|
8
8
|
*
|
9
|
-
* @version 13.0.
|
10
|
-
* @date 2024-07-
|
9
|
+
* @version 13.0.3
|
10
|
+
* @date 2024-07-19
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
|
@@ -430,7 +430,7 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
430
430
|
* Return the type of the value of this unit
|
431
431
|
*
|
432
432
|
* @memberof Unit
|
433
|
-
* @
|
433
|
+
* @return {string} type of the value of the unit
|
434
434
|
*/
|
435
435
|
Unit.prototype.valueType = function () {
|
436
436
|
return (0, _is.typeOf)(this.value);
|
@@ -440,6 +440,7 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
440
440
|
* Return whether the unit is derived (such as m/s, or cm^2, but not N)
|
441
441
|
* @memberof Unit
|
442
442
|
* @return {boolean} True if the unit is derived
|
443
|
+
* @private
|
443
444
|
*/
|
444
445
|
Unit.prototype._isDerived = function () {
|
445
446
|
if (this.units.length === 0) {
|
@@ -552,7 +553,7 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
552
553
|
* check if this unit has given base unit
|
553
554
|
* If this unit is a derived unit, this will ALWAYS return false, since by definition base units are not derived.
|
554
555
|
* @memberof Unit
|
555
|
-
* @param {
|
556
|
+
* @param {BASE_UNIT | string | undefined} base
|
556
557
|
*/
|
557
558
|
Unit.prototype.hasBase = function (base) {
|
558
559
|
if (typeof base === 'string') {
|
@@ -2323,34 +2324,34 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
2323
2324
|
name: 'minim',
|
2324
2325
|
base: BASE_UNITS.VOLUME,
|
2325
2326
|
prefixes: PREFIXES.NONE,
|
2326
|
-
value: 0.
|
2327
|
+
value: 0.000000061611519921875,
|
2327
2328
|
offset: 0
|
2328
2329
|
},
|
2329
|
-
//
|
2330
|
+
// 1/61440 gallons
|
2330
2331
|
fluiddram: {
|
2331
2332
|
name: 'fluiddram',
|
2332
2333
|
base: BASE_UNITS.VOLUME,
|
2333
2334
|
prefixes: PREFIXES.NONE,
|
2334
|
-
value: 0.
|
2335
|
+
value: 0.0000036966911953125,
|
2335
2336
|
offset: 0
|
2336
2337
|
},
|
2337
|
-
//
|
2338
|
+
// 1/1024 gallons
|
2338
2339
|
fluidounce: {
|
2339
2340
|
name: 'fluidounce',
|
2340
2341
|
base: BASE_UNITS.VOLUME,
|
2341
2342
|
prefixes: PREFIXES.NONE,
|
2342
|
-
value: 0.
|
2343
|
+
value: 0.0000295735295625,
|
2343
2344
|
offset: 0
|
2344
2345
|
},
|
2345
|
-
//
|
2346
|
+
// 1/128 gallons
|
2346
2347
|
gill: {
|
2347
2348
|
name: 'gill',
|
2348
2349
|
base: BASE_UNITS.VOLUME,
|
2349
2350
|
prefixes: PREFIXES.NONE,
|
2350
|
-
value: 0.
|
2351
|
+
value: 0.00011829411825,
|
2351
2352
|
offset: 0
|
2352
2353
|
},
|
2353
|
-
//
|
2354
|
+
// 1/32 gallons
|
2354
2355
|
cc: {
|
2355
2356
|
name: 'cc',
|
2356
2357
|
base: BASE_UNITS.VOLUME,
|
@@ -2363,133 +2364,58 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
2363
2364
|
name: 'cup',
|
2364
2365
|
base: BASE_UNITS.VOLUME,
|
2365
2366
|
prefixes: PREFIXES.NONE,
|
2366
|
-
value: 0.
|
2367
|
+
value: 0.0002365882365,
|
2367
2368
|
offset: 0
|
2368
2369
|
},
|
2369
|
-
//
|
2370
|
+
// 1/16 gallons
|
2370
2371
|
pint: {
|
2371
2372
|
name: 'pint',
|
2372
2373
|
base: BASE_UNITS.VOLUME,
|
2373
2374
|
prefixes: PREFIXES.NONE,
|
2374
|
-
value: 0.
|
2375
|
+
value: 0.000473176473,
|
2375
2376
|
offset: 0
|
2376
2377
|
},
|
2377
|
-
//
|
2378
|
+
// 1/8 gallons
|
2378
2379
|
quart: {
|
2379
2380
|
name: 'quart',
|
2380
2381
|
base: BASE_UNITS.VOLUME,
|
2381
2382
|
prefixes: PREFIXES.NONE,
|
2382
|
-
value: 0.
|
2383
|
+
value: 0.000946352946,
|
2383
2384
|
offset: 0
|
2384
2385
|
},
|
2385
|
-
//
|
2386
|
+
// 1/4 gallons
|
2386
2387
|
gallon: {
|
2387
2388
|
name: 'gallon',
|
2388
2389
|
base: BASE_UNITS.VOLUME,
|
2389
2390
|
prefixes: PREFIXES.NONE,
|
2390
|
-
value: 0.
|
2391
|
+
value: 0.003785411784,
|
2391
2392
|
offset: 0
|
2392
2393
|
},
|
2393
|
-
// 3.
|
2394
|
+
// 3.785411784 L
|
2394
2395
|
beerbarrel: {
|
2395
2396
|
name: 'beerbarrel',
|
2396
2397
|
base: BASE_UNITS.VOLUME,
|
2397
2398
|
prefixes: PREFIXES.NONE,
|
2398
|
-
value: 0.
|
2399
|
+
value: 0.117347765304,
|
2399
2400
|
offset: 0
|
2400
2401
|
},
|
2401
|
-
//
|
2402
|
+
// 31 gallons
|
2402
2403
|
oilbarrel: {
|
2403
2404
|
name: 'oilbarrel',
|
2404
2405
|
base: BASE_UNITS.VOLUME,
|
2405
2406
|
prefixes: PREFIXES.NONE,
|
2406
|
-
value: 0.
|
2407
|
+
value: 0.158987294928,
|
2407
2408
|
offset: 0
|
2408
2409
|
},
|
2409
|
-
//
|
2410
|
+
// 42 gallons
|
2410
2411
|
hogshead: {
|
2411
2412
|
name: 'hogshead',
|
2412
2413
|
base: BASE_UNITS.VOLUME,
|
2413
2414
|
prefixes: PREFIXES.NONE,
|
2414
|
-
value: 0.
|
2415
|
+
value: 0.238480942392,
|
2415
2416
|
offset: 0
|
2416
2417
|
},
|
2417
|
-
//
|
2418
|
-
|
2419
|
-
// {name: 'min', base: BASE_UNITS.VOLUME, prefixes: PREFIXES.NONE, value: 0.00000006161152, offset: 0}, // 0.06161152 mL // min is already in use as minute
|
2420
|
-
fldr: {
|
2421
|
-
name: 'fldr',
|
2422
|
-
base: BASE_UNITS.VOLUME,
|
2423
|
-
prefixes: PREFIXES.NONE,
|
2424
|
-
value: 0.0000036966911,
|
2425
|
-
offset: 0
|
2426
|
-
},
|
2427
|
-
// 3.696691 mL
|
2428
|
-
floz: {
|
2429
|
-
name: 'floz',
|
2430
|
-
base: BASE_UNITS.VOLUME,
|
2431
|
-
prefixes: PREFIXES.NONE,
|
2432
|
-
value: 0.00002957353,
|
2433
|
-
offset: 0
|
2434
|
-
},
|
2435
|
-
// 29.57353 mL
|
2436
|
-
gi: {
|
2437
|
-
name: 'gi',
|
2438
|
-
base: BASE_UNITS.VOLUME,
|
2439
|
-
prefixes: PREFIXES.NONE,
|
2440
|
-
value: 0.0001182941,
|
2441
|
-
offset: 0
|
2442
|
-
},
|
2443
|
-
// 118.2941 mL
|
2444
|
-
cp: {
|
2445
|
-
name: 'cp',
|
2446
|
-
base: BASE_UNITS.VOLUME,
|
2447
|
-
prefixes: PREFIXES.NONE,
|
2448
|
-
value: 0.0002365882,
|
2449
|
-
offset: 0
|
2450
|
-
},
|
2451
|
-
// 236.5882 mL
|
2452
|
-
pt: {
|
2453
|
-
name: 'pt',
|
2454
|
-
base: BASE_UNITS.VOLUME,
|
2455
|
-
prefixes: PREFIXES.NONE,
|
2456
|
-
value: 0.0004731765,
|
2457
|
-
offset: 0
|
2458
|
-
},
|
2459
|
-
// 473.1765 mL
|
2460
|
-
qt: {
|
2461
|
-
name: 'qt',
|
2462
|
-
base: BASE_UNITS.VOLUME,
|
2463
|
-
prefixes: PREFIXES.NONE,
|
2464
|
-
value: 0.0009463529,
|
2465
|
-
offset: 0
|
2466
|
-
},
|
2467
|
-
// 946.3529 mL
|
2468
|
-
gal: {
|
2469
|
-
name: 'gal',
|
2470
|
-
base: BASE_UNITS.VOLUME,
|
2471
|
-
prefixes: PREFIXES.NONE,
|
2472
|
-
value: 0.003785412,
|
2473
|
-
offset: 0
|
2474
|
-
},
|
2475
|
-
// 3.785412 L
|
2476
|
-
bbl: {
|
2477
|
-
name: 'bbl',
|
2478
|
-
base: BASE_UNITS.VOLUME,
|
2479
|
-
prefixes: PREFIXES.NONE,
|
2480
|
-
value: 0.1173478,
|
2481
|
-
offset: 0
|
2482
|
-
},
|
2483
|
-
// 117.3478 L
|
2484
|
-
obl: {
|
2485
|
-
name: 'obl',
|
2486
|
-
base: BASE_UNITS.VOLUME,
|
2487
|
-
prefixes: PREFIXES.NONE,
|
2488
|
-
value: 0.1589873,
|
2489
|
-
offset: 0
|
2490
|
-
},
|
2491
|
-
// 158.9873 L
|
2492
|
-
// {name: 'hogshead', base: BASE_UNITS.VOLUME, prefixes: PREFIXES.NONE, value: 0.2384810, offset: 0}, // 238.4810 L // TODO: hh?
|
2418
|
+
// 63 gallons
|
2493
2419
|
|
2494
2420
|
// Mass
|
2495
2421
|
g: {
|
@@ -3293,14 +3219,23 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
3293
3219
|
teaspoons: 'teaspoon',
|
3294
3220
|
tablespoons: 'tablespoon',
|
3295
3221
|
minims: 'minim',
|
3222
|
+
fldr: 'fluiddram',
|
3296
3223
|
fluiddrams: 'fluiddram',
|
3224
|
+
floz: 'fluidounce',
|
3297
3225
|
fluidounces: 'fluidounce',
|
3226
|
+
gi: 'gill',
|
3298
3227
|
gills: 'gill',
|
3228
|
+
cp: 'cup',
|
3299
3229
|
cups: 'cup',
|
3230
|
+
pt: 'pint',
|
3300
3231
|
pints: 'pint',
|
3232
|
+
qt: 'quart',
|
3301
3233
|
quarts: 'quart',
|
3234
|
+
gal: 'gallon',
|
3302
3235
|
gallons: 'gallon',
|
3236
|
+
bbl: 'beerbarrel',
|
3303
3237
|
beerbarrels: 'beerbarrel',
|
3238
|
+
obl: 'oilbarrel',
|
3304
3239
|
oilbarrels: 'oilbarrel',
|
3305
3240
|
hogsheads: 'hogshead',
|
3306
3241
|
gtts: 'gtt',
|
@@ -3573,6 +3508,7 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
3573
3508
|
|
3574
3509
|
/**
|
3575
3510
|
* Set a unit system for formatting derived units.
|
3511
|
+
* @memberof Unit
|
3576
3512
|
* @param {string} [name] The name of the unit system.
|
3577
3513
|
*/
|
3578
3514
|
Unit.setUnitSystem = function (name) {
|
@@ -3585,6 +3521,7 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
3585
3521
|
|
3586
3522
|
/**
|
3587
3523
|
* Return the current unit system.
|
3524
|
+
* @memberof Unit
|
3588
3525
|
* @return {string} The current unit system.
|
3589
3526
|
*/
|
3590
3527
|
Unit.getUnitSystem = function () {
|
@@ -3674,7 +3611,9 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
3674
3611
|
/**
|
3675
3612
|
* Checks if a character is a valid latin letter (upper or lower case).
|
3676
3613
|
* Note that this function can be overridden, for example to allow support of other alphabets.
|
3614
|
+
* @memberof Unit
|
3677
3615
|
* @param {string} c Tested character
|
3616
|
+
* @return {boolean} true if the character is a latin letter
|
3678
3617
|
*/
|
3679
3618
|
Unit.isValidAlpha = function isValidAlpha(c) {
|
3680
3619
|
return /^[a-zA-Z]$/.test(c);
|
@@ -3694,20 +3633,24 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
3694
3633
|
/**
|
3695
3634
|
* Wrapper around createUnitSingle.
|
3696
3635
|
* Example:
|
3697
|
-
* createUnit({
|
3698
|
-
*
|
3699
|
-
*
|
3700
|
-
*
|
3701
|
-
*
|
3702
|
-
*
|
3703
|
-
*
|
3704
|
-
*
|
3705
|
-
*
|
3706
|
-
*
|
3707
|
-
*
|
3708
|
-
*
|
3636
|
+
* createUnit( {
|
3637
|
+
* foo: {
|
3638
|
+
* prefixes: 'long',
|
3639
|
+
* baseName: 'essence-of-foo'
|
3640
|
+
* },
|
3641
|
+
* bar: '40 foo',
|
3642
|
+
* baz: {
|
3643
|
+
* definition: '1 bar/hour',
|
3644
|
+
* prefixes: 'long'
|
3645
|
+
* }
|
3646
|
+
* },
|
3647
|
+
* {
|
3648
|
+
* override: true
|
3649
|
+
* })
|
3650
|
+
* @memberof Unit
|
3709
3651
|
* @param {object} obj Object map. Each key becomes a unit which is defined by its value.
|
3710
3652
|
* @param {object} options
|
3653
|
+
* @return {Unit} the last created unit
|
3711
3654
|
*/
|
3712
3655
|
Unit.createUnit = function (obj, options) {
|
3713
3656
|
if (typeof obj !== 'object') {
|
@@ -3742,13 +3685,13 @@ const createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fa
|
|
3742
3685
|
* Create a user-defined unit and register it with the Unit type.
|
3743
3686
|
* Example:
|
3744
3687
|
* createUnitSingle('knot', '0.514444444 m/s')
|
3745
|
-
* createUnitSingle('acre', new Unit(43560, 'ft^2'))
|
3746
3688
|
*
|
3689
|
+
* @memberof Unit
|
3747
3690
|
* @param {string} name The name of the new unit. Must be unique. Example: 'knot'
|
3748
|
-
* @param {string
|
3691
|
+
* @param {string | Unit | object} definition Definition of the unit in terms
|
3749
3692
|
* of existing units. For example, '0.514444444 m / s'. Can be a Unit, a string,
|
3750
3693
|
* or an Object. If an Object, may have the following properties:
|
3751
|
-
* - definition {string|Unit} The definition of this unit.
|
3694
|
+
* - definition {string | Unit} The definition of this unit.
|
3752
3695
|
* - prefixes {string} "none", "short", "long", "binary_short", or "binary_long".
|
3753
3696
|
* The default is "none".
|
3754
3697
|
* - aliases {Array} Array of strings. Example: ['knots', 'kt', 'kts']
|
package/lib/cjs/version.js
CHANGED
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
const version = exports.version = '13.0.
|
7
|
+
const version = exports.version = '13.0.3';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
@@ -219,7 +219,7 @@ export function importFactory(typed, load, math, importedFactories) {
|
|
219
219
|
throw new Error('Factory name should not contain a nested path. ' + 'Name: ' + JSON.stringify(name));
|
220
220
|
}
|
221
221
|
var namespace = isTransformFunctionFactory(factory) ? math.expression.transform : math;
|
222
|
-
var existingTransform =
|
222
|
+
var existingTransform = name in math.expression.transform;
|
223
223
|
var existing = hasOwnProperty(namespace, name) ? namespace[name] : undefined;
|
224
224
|
var resolver = function resolver() {
|
225
225
|
// collect all dependencies, handle finding both functions and classes and other special cases
|
@@ -426,7 +426,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
426
426
|
* Return the type of the value of this unit
|
427
427
|
*
|
428
428
|
* @memberof Unit
|
429
|
-
* @
|
429
|
+
* @return {string} type of the value of the unit
|
430
430
|
*/
|
431
431
|
Unit.prototype.valueType = function () {
|
432
432
|
return typeOf(this.value);
|
@@ -436,6 +436,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
436
436
|
* Return whether the unit is derived (such as m/s, or cm^2, but not N)
|
437
437
|
* @memberof Unit
|
438
438
|
* @return {boolean} True if the unit is derived
|
439
|
+
* @private
|
439
440
|
*/
|
440
441
|
Unit.prototype._isDerived = function () {
|
441
442
|
if (this.units.length === 0) {
|
@@ -548,7 +549,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
548
549
|
* check if this unit has given base unit
|
549
550
|
* If this unit is a derived unit, this will ALWAYS return false, since by definition base units are not derived.
|
550
551
|
* @memberof Unit
|
551
|
-
* @param {
|
552
|
+
* @param {BASE_UNIT | string | undefined} base
|
552
553
|
*/
|
553
554
|
Unit.prototype.hasBase = function (base) {
|
554
555
|
if (typeof base === 'string') {
|
@@ -2316,34 +2317,34 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
2316
2317
|
name: 'minim',
|
2317
2318
|
base: BASE_UNITS.VOLUME,
|
2318
2319
|
prefixes: PREFIXES.NONE,
|
2319
|
-
value: 0.
|
2320
|
+
value: 0.000000061611519921875,
|
2320
2321
|
offset: 0
|
2321
2322
|
},
|
2322
|
-
//
|
2323
|
+
// 1/61440 gallons
|
2323
2324
|
fluiddram: {
|
2324
2325
|
name: 'fluiddram',
|
2325
2326
|
base: BASE_UNITS.VOLUME,
|
2326
2327
|
prefixes: PREFIXES.NONE,
|
2327
|
-
value: 0.
|
2328
|
+
value: 0.0000036966911953125,
|
2328
2329
|
offset: 0
|
2329
2330
|
},
|
2330
|
-
//
|
2331
|
+
// 1/1024 gallons
|
2331
2332
|
fluidounce: {
|
2332
2333
|
name: 'fluidounce',
|
2333
2334
|
base: BASE_UNITS.VOLUME,
|
2334
2335
|
prefixes: PREFIXES.NONE,
|
2335
|
-
value: 0.
|
2336
|
+
value: 0.0000295735295625,
|
2336
2337
|
offset: 0
|
2337
2338
|
},
|
2338
|
-
//
|
2339
|
+
// 1/128 gallons
|
2339
2340
|
gill: {
|
2340
2341
|
name: 'gill',
|
2341
2342
|
base: BASE_UNITS.VOLUME,
|
2342
2343
|
prefixes: PREFIXES.NONE,
|
2343
|
-
value: 0.
|
2344
|
+
value: 0.00011829411825,
|
2344
2345
|
offset: 0
|
2345
2346
|
},
|
2346
|
-
//
|
2347
|
+
// 1/32 gallons
|
2347
2348
|
cc: {
|
2348
2349
|
name: 'cc',
|
2349
2350
|
base: BASE_UNITS.VOLUME,
|
@@ -2356,133 +2357,58 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
2356
2357
|
name: 'cup',
|
2357
2358
|
base: BASE_UNITS.VOLUME,
|
2358
2359
|
prefixes: PREFIXES.NONE,
|
2359
|
-
value: 0.
|
2360
|
+
value: 0.0002365882365,
|
2360
2361
|
offset: 0
|
2361
2362
|
},
|
2362
|
-
//
|
2363
|
+
// 1/16 gallons
|
2363
2364
|
pint: {
|
2364
2365
|
name: 'pint',
|
2365
2366
|
base: BASE_UNITS.VOLUME,
|
2366
2367
|
prefixes: PREFIXES.NONE,
|
2367
|
-
value: 0.
|
2368
|
+
value: 0.000473176473,
|
2368
2369
|
offset: 0
|
2369
2370
|
},
|
2370
|
-
//
|
2371
|
+
// 1/8 gallons
|
2371
2372
|
quart: {
|
2372
2373
|
name: 'quart',
|
2373
2374
|
base: BASE_UNITS.VOLUME,
|
2374
2375
|
prefixes: PREFIXES.NONE,
|
2375
|
-
value: 0.
|
2376
|
+
value: 0.000946352946,
|
2376
2377
|
offset: 0
|
2377
2378
|
},
|
2378
|
-
//
|
2379
|
+
// 1/4 gallons
|
2379
2380
|
gallon: {
|
2380
2381
|
name: 'gallon',
|
2381
2382
|
base: BASE_UNITS.VOLUME,
|
2382
2383
|
prefixes: PREFIXES.NONE,
|
2383
|
-
value: 0.
|
2384
|
+
value: 0.003785411784,
|
2384
2385
|
offset: 0
|
2385
2386
|
},
|
2386
|
-
// 3.
|
2387
|
+
// 3.785411784 L
|
2387
2388
|
beerbarrel: {
|
2388
2389
|
name: 'beerbarrel',
|
2389
2390
|
base: BASE_UNITS.VOLUME,
|
2390
2391
|
prefixes: PREFIXES.NONE,
|
2391
|
-
value: 0.
|
2392
|
+
value: 0.117347765304,
|
2392
2393
|
offset: 0
|
2393
2394
|
},
|
2394
|
-
//
|
2395
|
+
// 31 gallons
|
2395
2396
|
oilbarrel: {
|
2396
2397
|
name: 'oilbarrel',
|
2397
2398
|
base: BASE_UNITS.VOLUME,
|
2398
2399
|
prefixes: PREFIXES.NONE,
|
2399
|
-
value: 0.
|
2400
|
+
value: 0.158987294928,
|
2400
2401
|
offset: 0
|
2401
2402
|
},
|
2402
|
-
//
|
2403
|
+
// 42 gallons
|
2403
2404
|
hogshead: {
|
2404
2405
|
name: 'hogshead',
|
2405
2406
|
base: BASE_UNITS.VOLUME,
|
2406
2407
|
prefixes: PREFIXES.NONE,
|
2407
|
-
value: 0.
|
2408
|
+
value: 0.238480942392,
|
2408
2409
|
offset: 0
|
2409
2410
|
},
|
2410
|
-
//
|
2411
|
-
|
2412
|
-
// {name: 'min', base: BASE_UNITS.VOLUME, prefixes: PREFIXES.NONE, value: 0.00000006161152, offset: 0}, // 0.06161152 mL // min is already in use as minute
|
2413
|
-
fldr: {
|
2414
|
-
name: 'fldr',
|
2415
|
-
base: BASE_UNITS.VOLUME,
|
2416
|
-
prefixes: PREFIXES.NONE,
|
2417
|
-
value: 0.0000036966911,
|
2418
|
-
offset: 0
|
2419
|
-
},
|
2420
|
-
// 3.696691 mL
|
2421
|
-
floz: {
|
2422
|
-
name: 'floz',
|
2423
|
-
base: BASE_UNITS.VOLUME,
|
2424
|
-
prefixes: PREFIXES.NONE,
|
2425
|
-
value: 0.00002957353,
|
2426
|
-
offset: 0
|
2427
|
-
},
|
2428
|
-
// 29.57353 mL
|
2429
|
-
gi: {
|
2430
|
-
name: 'gi',
|
2431
|
-
base: BASE_UNITS.VOLUME,
|
2432
|
-
prefixes: PREFIXES.NONE,
|
2433
|
-
value: 0.0001182941,
|
2434
|
-
offset: 0
|
2435
|
-
},
|
2436
|
-
// 118.2941 mL
|
2437
|
-
cp: {
|
2438
|
-
name: 'cp',
|
2439
|
-
base: BASE_UNITS.VOLUME,
|
2440
|
-
prefixes: PREFIXES.NONE,
|
2441
|
-
value: 0.0002365882,
|
2442
|
-
offset: 0
|
2443
|
-
},
|
2444
|
-
// 236.5882 mL
|
2445
|
-
pt: {
|
2446
|
-
name: 'pt',
|
2447
|
-
base: BASE_UNITS.VOLUME,
|
2448
|
-
prefixes: PREFIXES.NONE,
|
2449
|
-
value: 0.0004731765,
|
2450
|
-
offset: 0
|
2451
|
-
},
|
2452
|
-
// 473.1765 mL
|
2453
|
-
qt: {
|
2454
|
-
name: 'qt',
|
2455
|
-
base: BASE_UNITS.VOLUME,
|
2456
|
-
prefixes: PREFIXES.NONE,
|
2457
|
-
value: 0.0009463529,
|
2458
|
-
offset: 0
|
2459
|
-
},
|
2460
|
-
// 946.3529 mL
|
2461
|
-
gal: {
|
2462
|
-
name: 'gal',
|
2463
|
-
base: BASE_UNITS.VOLUME,
|
2464
|
-
prefixes: PREFIXES.NONE,
|
2465
|
-
value: 0.003785412,
|
2466
|
-
offset: 0
|
2467
|
-
},
|
2468
|
-
// 3.785412 L
|
2469
|
-
bbl: {
|
2470
|
-
name: 'bbl',
|
2471
|
-
base: BASE_UNITS.VOLUME,
|
2472
|
-
prefixes: PREFIXES.NONE,
|
2473
|
-
value: 0.1173478,
|
2474
|
-
offset: 0
|
2475
|
-
},
|
2476
|
-
// 117.3478 L
|
2477
|
-
obl: {
|
2478
|
-
name: 'obl',
|
2479
|
-
base: BASE_UNITS.VOLUME,
|
2480
|
-
prefixes: PREFIXES.NONE,
|
2481
|
-
value: 0.1589873,
|
2482
|
-
offset: 0
|
2483
|
-
},
|
2484
|
-
// 158.9873 L
|
2485
|
-
// {name: 'hogshead', base: BASE_UNITS.VOLUME, prefixes: PREFIXES.NONE, value: 0.2384810, offset: 0}, // 238.4810 L // TODO: hh?
|
2411
|
+
// 63 gallons
|
2486
2412
|
|
2487
2413
|
// Mass
|
2488
2414
|
g: {
|
@@ -3286,14 +3212,23 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
3286
3212
|
teaspoons: 'teaspoon',
|
3287
3213
|
tablespoons: 'tablespoon',
|
3288
3214
|
minims: 'minim',
|
3215
|
+
fldr: 'fluiddram',
|
3289
3216
|
fluiddrams: 'fluiddram',
|
3217
|
+
floz: 'fluidounce',
|
3290
3218
|
fluidounces: 'fluidounce',
|
3219
|
+
gi: 'gill',
|
3291
3220
|
gills: 'gill',
|
3221
|
+
cp: 'cup',
|
3292
3222
|
cups: 'cup',
|
3223
|
+
pt: 'pint',
|
3293
3224
|
pints: 'pint',
|
3225
|
+
qt: 'quart',
|
3294
3226
|
quarts: 'quart',
|
3227
|
+
gal: 'gallon',
|
3295
3228
|
gallons: 'gallon',
|
3229
|
+
bbl: 'beerbarrel',
|
3296
3230
|
beerbarrels: 'beerbarrel',
|
3231
|
+
obl: 'oilbarrel',
|
3297
3232
|
oilbarrels: 'oilbarrel',
|
3298
3233
|
hogsheads: 'hogshead',
|
3299
3234
|
gtts: 'gtt',
|
@@ -3566,6 +3501,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
3566
3501
|
|
3567
3502
|
/**
|
3568
3503
|
* Set a unit system for formatting derived units.
|
3504
|
+
* @memberof Unit
|
3569
3505
|
* @param {string} [name] The name of the unit system.
|
3570
3506
|
*/
|
3571
3507
|
Unit.setUnitSystem = function (name) {
|
@@ -3578,6 +3514,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
3578
3514
|
|
3579
3515
|
/**
|
3580
3516
|
* Return the current unit system.
|
3517
|
+
* @memberof Unit
|
3581
3518
|
* @return {string} The current unit system.
|
3582
3519
|
*/
|
3583
3520
|
Unit.getUnitSystem = function () {
|
@@ -3667,7 +3604,9 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
3667
3604
|
/**
|
3668
3605
|
* Checks if a character is a valid latin letter (upper or lower case).
|
3669
3606
|
* Note that this function can be overridden, for example to allow support of other alphabets.
|
3607
|
+
* @memberof Unit
|
3670
3608
|
* @param {string} c Tested character
|
3609
|
+
* @return {boolean} true if the character is a latin letter
|
3671
3610
|
*/
|
3672
3611
|
Unit.isValidAlpha = function isValidAlpha(c) {
|
3673
3612
|
return /^[a-zA-Z]$/.test(c);
|
@@ -3687,20 +3626,24 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
3687
3626
|
/**
|
3688
3627
|
* Wrapper around createUnitSingle.
|
3689
3628
|
* Example:
|
3690
|
-
* createUnit({
|
3691
|
-
*
|
3692
|
-
*
|
3693
|
-
*
|
3694
|
-
*
|
3695
|
-
*
|
3696
|
-
*
|
3697
|
-
*
|
3698
|
-
*
|
3699
|
-
*
|
3700
|
-
*
|
3701
|
-
*
|
3629
|
+
* createUnit( {
|
3630
|
+
* foo: {
|
3631
|
+
* prefixes: 'long',
|
3632
|
+
* baseName: 'essence-of-foo'
|
3633
|
+
* },
|
3634
|
+
* bar: '40 foo',
|
3635
|
+
* baz: {
|
3636
|
+
* definition: '1 bar/hour',
|
3637
|
+
* prefixes: 'long'
|
3638
|
+
* }
|
3639
|
+
* },
|
3640
|
+
* {
|
3641
|
+
* override: true
|
3642
|
+
* })
|
3643
|
+
* @memberof Unit
|
3702
3644
|
* @param {object} obj Object map. Each key becomes a unit which is defined by its value.
|
3703
3645
|
* @param {object} options
|
3646
|
+
* @return {Unit} the last created unit
|
3704
3647
|
*/
|
3705
3648
|
Unit.createUnit = function (obj, options) {
|
3706
3649
|
if (typeof obj !== 'object') {
|
@@ -3735,13 +3678,13 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
3735
3678
|
* Create a user-defined unit and register it with the Unit type.
|
3736
3679
|
* Example:
|
3737
3680
|
* createUnitSingle('knot', '0.514444444 m/s')
|
3738
|
-
* createUnitSingle('acre', new Unit(43560, 'ft^2'))
|
3739
3681
|
*
|
3682
|
+
* @memberof Unit
|
3740
3683
|
* @param {string} name The name of the new unit. Must be unique. Example: 'knot'
|
3741
|
-
* @param {string
|
3684
|
+
* @param {string | Unit | object} definition Definition of the unit in terms
|
3742
3685
|
* of existing units. For example, '0.514444444 m / s'. Can be a Unit, a string,
|
3743
3686
|
* or an Object. If an Object, may have the following properties:
|
3744
|
-
* - definition {string|Unit} The definition of this unit.
|
3687
|
+
* - definition {string | Unit} The definition of this unit.
|
3745
3688
|
* - prefixes {string} "none", "short", "long", "binary_short", or "binary_long".
|
3746
3689
|
* The default is "none".
|
3747
3690
|
* - aliases {Array} Array of strings. Example: ['knots', 'kt', 'kts']
|
package/lib/esm/version.js
CHANGED