engineering-unit-converter 0.0.16 → 0.0.17
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/README.md +2 -0
- package/dist/engineering-unit-converter.js +128 -53
- package/dist/engineering-unit-converter.umd.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/types.d.ts +26 -1
- package/dist/units/delta-temperature.d.ts +9 -0
- package/dist/units/standard-volume-per-volume.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ Available units
|
|
|
29
29
|
|
|
30
30
|
- acceleration
|
|
31
31
|
- area
|
|
32
|
+
- deltaTemperature
|
|
32
33
|
- density
|
|
33
34
|
- electricCharge
|
|
34
35
|
- electricCurrent
|
|
@@ -42,6 +43,7 @@ Available units
|
|
|
42
43
|
- pressureManometric
|
|
43
44
|
- pressure
|
|
44
45
|
- speed
|
|
46
|
+
- standardVolumePerVolume
|
|
45
47
|
- standardVolumetricFlow
|
|
46
48
|
- surfaceTension
|
|
47
49
|
- time
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (r, e, n) => (
|
|
4
|
-
class
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var u = (r, e, n) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var c = (r, e, n) => (u(r, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
class m {
|
|
5
5
|
constructor(e, n) {
|
|
6
6
|
c(this, "_definitions");
|
|
7
7
|
c(this, "_val");
|
|
@@ -32,7 +32,7 @@ class u {
|
|
|
32
32
|
class s {
|
|
33
33
|
constructor(e, n) {
|
|
34
34
|
c(this, "_internalConverter");
|
|
35
|
-
this._internalConverter = new
|
|
35
|
+
this._internalConverter = new m(e, n);
|
|
36
36
|
}
|
|
37
37
|
from(e) {
|
|
38
38
|
return this._internalConverter.from(e), new i(this._internalConverter);
|
|
@@ -66,7 +66,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
66
66
|
convertValue: 1 / 3.28084
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
},
|
|
69
|
+
}, N = a(v), V = {
|
|
70
70
|
baseUnit: "m2",
|
|
71
71
|
units: {
|
|
72
72
|
m2: {
|
|
@@ -114,7 +114,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
114
114
|
// Conversion factor from m2 to hectare
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
},
|
|
117
|
+
}, W = a(V), p = {
|
|
118
118
|
baseUnit: "kg/m3",
|
|
119
119
|
units: {
|
|
120
120
|
"kg/m3": {
|
|
@@ -138,7 +138,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
138
138
|
convertValue: 1 / 2.20462
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
},
|
|
141
|
+
}, L = a(p), d = {
|
|
142
142
|
baseUnit: "C",
|
|
143
143
|
units: {
|
|
144
144
|
C: {
|
|
@@ -166,7 +166,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
166
166
|
// Conversion factor from C to pC
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
},
|
|
169
|
+
}, H = a(d), g = {
|
|
170
170
|
baseUnit: "A",
|
|
171
171
|
units: {
|
|
172
172
|
A: {
|
|
@@ -194,7 +194,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
194
194
|
// Conversion factor from A to pA
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
},
|
|
197
|
+
}, J = a(g), h = {
|
|
198
198
|
baseUnit: "J",
|
|
199
199
|
units: {
|
|
200
200
|
J: {
|
|
@@ -232,7 +232,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
232
232
|
// Conversion factor from J to BTU
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
},
|
|
235
|
+
}, O = a(h), b = {
|
|
236
236
|
baseUnit: "N",
|
|
237
237
|
units: {
|
|
238
238
|
N: {
|
|
@@ -255,7 +255,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
255
255
|
// Conversion factor from N to kgf
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
},
|
|
258
|
+
}, j = a(b), C = {
|
|
259
259
|
baseUnit: "m",
|
|
260
260
|
units: {
|
|
261
261
|
m: {
|
|
@@ -295,7 +295,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
295
295
|
convertValue: 1e-9
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
},
|
|
298
|
+
}, z = a(C), f = {
|
|
299
299
|
baseUnit: "kg/s",
|
|
300
300
|
units: {
|
|
301
301
|
"kg/s": {
|
|
@@ -340,7 +340,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
340
340
|
// 1 day = 86400 seconds
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
},
|
|
343
|
+
}, E = a(f), M = {
|
|
344
344
|
baseUnit: "kg",
|
|
345
345
|
units: {
|
|
346
346
|
kg: {
|
|
@@ -372,7 +372,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
372
372
|
convertValue: 1e-6
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
},
|
|
375
|
+
}, R = a(M), S = {
|
|
376
376
|
baseUnit: "W",
|
|
377
377
|
units: {
|
|
378
378
|
W: {
|
|
@@ -384,6 +384,11 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
384
384
|
convertValue: 1e3
|
|
385
385
|
// Conversion factor from W to kW
|
|
386
386
|
},
|
|
387
|
+
MW: {
|
|
388
|
+
name: "Megawatt",
|
|
389
|
+
convertValue: 1e6
|
|
390
|
+
// Conversion factor from W to MW
|
|
391
|
+
},
|
|
387
392
|
hp: {
|
|
388
393
|
name: "Horsepower",
|
|
389
394
|
convertValue: 745.7
|
|
@@ -394,13 +399,25 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
394
399
|
convertValue: 1 / 3.41214
|
|
395
400
|
// Conversion factor from W to BTU/h
|
|
396
401
|
},
|
|
402
|
+
// Multiples of BTU/h, written against the factor above so that
|
|
403
|
+
// 1 MMBTU/h is exactly 1e6 BTU/h. M = thousand, MM = million.
|
|
404
|
+
"kBTU/h": {
|
|
405
|
+
name: "Thousand British Thermal Units per hour",
|
|
406
|
+
convertValue: 1e3 / 3.41214
|
|
407
|
+
// 1 kBTU/h = 1000 BTU/h
|
|
408
|
+
},
|
|
409
|
+
"MMBTU/h": {
|
|
410
|
+
name: "Million British Thermal Units per hour",
|
|
411
|
+
convertValue: 1e6 / 3.41214
|
|
412
|
+
// 1 MMBTU/h = 1e6 BTU/h
|
|
413
|
+
},
|
|
397
414
|
"cal/s": {
|
|
398
415
|
name: "Calorie per second",
|
|
399
416
|
convertValue: 1 / 0.23884589662749595
|
|
400
417
|
// Conversion factor from W to cal/s
|
|
401
418
|
}
|
|
402
419
|
}
|
|
403
|
-
},
|
|
420
|
+
}, Y = a(S), P = {
|
|
404
421
|
baseUnit: "Pag",
|
|
405
422
|
units: {
|
|
406
423
|
Pag: {
|
|
@@ -438,7 +455,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
438
455
|
// Conversion factor from Pa to kg/cm²
|
|
439
456
|
}
|
|
440
457
|
}
|
|
441
|
-
},
|
|
458
|
+
}, x = a(P), k = {
|
|
442
459
|
baseUnit: "Pa",
|
|
443
460
|
units: {
|
|
444
461
|
Pa: {
|
|
@@ -526,7 +543,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
526
543
|
// Conversion factor from Pa to psi
|
|
527
544
|
}
|
|
528
545
|
}
|
|
529
|
-
},
|
|
546
|
+
}, Q = a(k), F = {
|
|
530
547
|
baseUnit: "m/s",
|
|
531
548
|
units: {
|
|
532
549
|
"m/s": {
|
|
@@ -562,7 +579,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
562
579
|
convertValue: 0.44704
|
|
563
580
|
}
|
|
564
581
|
}
|
|
565
|
-
},
|
|
582
|
+
}, X = a(F), K = {
|
|
566
583
|
baseUnit: "SCMD",
|
|
567
584
|
units: {
|
|
568
585
|
SCMD: {
|
|
@@ -605,7 +622,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
605
622
|
// Conversion factor from SCMD to MMSCFD
|
|
606
623
|
}
|
|
607
624
|
}
|
|
608
|
-
},
|
|
625
|
+
}, Z = a(K), U = {
|
|
609
626
|
baseUnit: "N/m",
|
|
610
627
|
units: {
|
|
611
628
|
"N/m": {
|
|
@@ -633,7 +650,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
633
650
|
convertValue: 10.945427
|
|
634
651
|
}
|
|
635
652
|
}
|
|
636
|
-
},
|
|
653
|
+
}, ee = a(U), y = {
|
|
637
654
|
baseUnit: "sec",
|
|
638
655
|
units: {
|
|
639
656
|
sec: {
|
|
@@ -666,7 +683,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
666
683
|
// Conversion factor from seconds to days
|
|
667
684
|
}
|
|
668
685
|
}
|
|
669
|
-
},
|
|
686
|
+
}, ae = a(y), q = {
|
|
670
687
|
baseUnit: "cP",
|
|
671
688
|
units: {
|
|
672
689
|
cP: {
|
|
@@ -694,7 +711,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
694
711
|
convertValue: 1 / 3.6
|
|
695
712
|
}
|
|
696
713
|
}
|
|
697
|
-
},
|
|
714
|
+
}, ne = a(q), $ = {
|
|
698
715
|
baseUnit: "V",
|
|
699
716
|
// transform: (val) => val * baseValue,
|
|
700
717
|
units: {
|
|
@@ -711,7 +728,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
711
728
|
convertValue: 1e3
|
|
712
729
|
}
|
|
713
730
|
}
|
|
714
|
-
},
|
|
731
|
+
}, re = a($), w = {
|
|
715
732
|
baseUnit: "m3",
|
|
716
733
|
units: {
|
|
717
734
|
m3: {
|
|
@@ -747,7 +764,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
747
764
|
convertValue: 16387e-9
|
|
748
765
|
}
|
|
749
766
|
}
|
|
750
|
-
},
|
|
767
|
+
}, te = a(w), _ = {
|
|
751
768
|
baseUnit: "m3/h",
|
|
752
769
|
units: {
|
|
753
770
|
"m3/h": {
|
|
@@ -787,7 +804,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
787
804
|
convertValue: 378541e-8 * 3600
|
|
788
805
|
}
|
|
789
806
|
}
|
|
790
|
-
},
|
|
807
|
+
}, oe = a(_), G = {
|
|
791
808
|
baseUnit: "C",
|
|
792
809
|
units: {
|
|
793
810
|
C: {
|
|
@@ -808,7 +825,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
808
825
|
// Subtract 273.15 to convert from K to C
|
|
809
826
|
}
|
|
810
827
|
}
|
|
811
|
-
},
|
|
828
|
+
}, ce = a(G), D = {
|
|
812
829
|
baseUnit: "Pa/m",
|
|
813
830
|
units: {
|
|
814
831
|
"Pa/m": {
|
|
@@ -898,7 +915,7 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
898
915
|
// 1 kg/cm² = 98066.5 Pa / 1000 m
|
|
899
916
|
}
|
|
900
917
|
}
|
|
901
|
-
},
|
|
918
|
+
}, le = a(D), T = {
|
|
902
919
|
baseUnit: "kg/Sm3",
|
|
903
920
|
units: {
|
|
904
921
|
"kg/Sm3": {
|
|
@@ -951,30 +968,88 @@ const a = (r) => (e) => new s(e, r), v = {
|
|
|
951
968
|
// Conversion factor from kg/Sm3 to kg/MMSCF
|
|
952
969
|
}
|
|
953
970
|
}
|
|
954
|
-
},
|
|
971
|
+
}, ue = a(T), B = {
|
|
972
|
+
baseUnit: "Sm3/m3",
|
|
973
|
+
units: {
|
|
974
|
+
"Sm3/m3": {
|
|
975
|
+
name: "Standard Cubic Meter per Cubic Meter",
|
|
976
|
+
convertValue: 1
|
|
977
|
+
},
|
|
978
|
+
"Sm3/L": {
|
|
979
|
+
name: "Standard Cubic Meter per Liter",
|
|
980
|
+
convertValue: 1e3
|
|
981
|
+
// 1 m3 = 1000 L
|
|
982
|
+
},
|
|
983
|
+
"SCF/m3": {
|
|
984
|
+
name: "Standard Cubic Foot per Cubic Meter",
|
|
985
|
+
convertValue: 0.3048 ** 3
|
|
986
|
+
// 1 SCF = 0.028316846592 Sm3
|
|
987
|
+
},
|
|
988
|
+
"SCF/gal": {
|
|
989
|
+
name: "Standard Cubic Foot per US Gallon",
|
|
990
|
+
convertValue: 0.3048 ** 3 / 0.003785411784
|
|
991
|
+
// 1 ft3 = 7.4805 US gal
|
|
992
|
+
},
|
|
993
|
+
"SCF/bbl": {
|
|
994
|
+
name: "Standard Cubic Foot per Barrel",
|
|
995
|
+
convertValue: 0.3048 ** 3 / (42 * 0.003785411784)
|
|
996
|
+
// 1 bbl = 42 US gal
|
|
997
|
+
},
|
|
998
|
+
"MSCF/bbl": {
|
|
999
|
+
name: "Thousand Standard Cubic Feet per Barrel",
|
|
1000
|
+
convertValue: 0.3048 ** 3 / (42 * 0.003785411784) * 1e3
|
|
1001
|
+
// M = thousand SCF
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}, me = a(B), I = {
|
|
1005
|
+
baseUnit: "C",
|
|
1006
|
+
units: {
|
|
1007
|
+
C: {
|
|
1008
|
+
name: "Delta Celsius",
|
|
1009
|
+
convertValue: 1
|
|
1010
|
+
},
|
|
1011
|
+
K: {
|
|
1012
|
+
name: "Delta Kelvin",
|
|
1013
|
+
convertValue: 1
|
|
1014
|
+
// a kelvin interval is exactly a celsius interval
|
|
1015
|
+
},
|
|
1016
|
+
F: {
|
|
1017
|
+
name: "Delta Fahrenheit",
|
|
1018
|
+
convertValue: 5 / 9
|
|
1019
|
+
// 1 F interval = 5/9 C interval
|
|
1020
|
+
},
|
|
1021
|
+
R: {
|
|
1022
|
+
name: "Delta Rankine",
|
|
1023
|
+
convertValue: 5 / 9
|
|
1024
|
+
// a rankine interval is exactly a fahrenheit interval
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}, se = a(I);
|
|
955
1028
|
export {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
H as
|
|
961
|
-
J as
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
z as
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
Z as
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
ne as
|
|
979
|
-
re as
|
|
1029
|
+
N as acceleration,
|
|
1030
|
+
W as area,
|
|
1031
|
+
se as deltaTemperature,
|
|
1032
|
+
L as density,
|
|
1033
|
+
H as electricCharge,
|
|
1034
|
+
J as electricCurrent,
|
|
1035
|
+
O as energy,
|
|
1036
|
+
j as force,
|
|
1037
|
+
z as length,
|
|
1038
|
+
R as mass,
|
|
1039
|
+
E as massFlow,
|
|
1040
|
+
ue as massPerStandardVolume,
|
|
1041
|
+
Y as power,
|
|
1042
|
+
Q as pressure,
|
|
1043
|
+
x as pressureManometric,
|
|
1044
|
+
le as pressurePerLength,
|
|
1045
|
+
X as speed,
|
|
1046
|
+
me as standardVolumePerVolume,
|
|
1047
|
+
Z as standardVolumetricFlow,
|
|
1048
|
+
ce as temperature,
|
|
1049
|
+
ae as time,
|
|
1050
|
+
ee as torque,
|
|
1051
|
+
ne as viscosity,
|
|
1052
|
+
re as voltage,
|
|
1053
|
+
te as volume,
|
|
1054
|
+
oe as volumetricFlow
|
|
980
1055
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e["engineering-unit-converter"]={}))})(this,function(e){"use strict";var Z=Object.defineProperty;var x=(e,r,o)=>r in e?Z(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o;var l=(e,r,o)=>(x(e,typeof r!="symbol"?r+"":r,o),o);class r{constructor(a,t){l(this,"_definitions");l(this,"_val");l(this,"_fromUnit",null);this._definitions=t,this._val=a}from(a){return this._checkUnit(a),this._fromUnit=a,this}to(a){if(!this._fromUnit)throw new Error('Please specify the "from" unit using the from() method before calling to().');this._checkUnit(a);const t=this._getUnit(this._fromUnit),c=this._getUnit(a);let u=this._val;return t.offset!==0&&(u-=t.offset),u=u*t.convertValue/c.convertValue,c.offset!==0&&(u+=c.offset),u}_getUnit(a){const t=this._definitions.units[a],c=t.offset??0;return{convertValue:t.convertValue,offset:c}}_checkUnit(a){const t=Object.keys(this._definitions.units);if(!t.includes(a))throw new Error(`Invalid unit "${a}". Available units: ${t.join(", ")}`)}}class o{constructor(a,t){l(this,"_internalConverter");this._internalConverter=new r(a,t)}from(a){return this._internalConverter.from(a),new i(this._internalConverter)}}class i{constructor(a){this._internalConverter=a}to(a){return this._internalConverter.to(a)}}const n=m=>a=>new o(a,m),s={baseUnit:"m/s2",units:{"m/s2":{name:"Meter per Second Squared",convertValue:1},"km/s2":{name:"Kilometer per Second Squared",convertValue:1e3},"cm/s2":{name:"Centimeter per Second Squared",convertValue:1/100},"ft/s2":{name:"Foot per Second Squared",convertValue:1/3.28084}}},v=n(s),V={baseUnit:"m2",units:{m2:{name:"Square Meter",convertValue:1},km2:{name:"Square Kilometer",convertValue:1/1e-6},cm2:{name:"Square Centimeter",convertValue:1/1e4},mm2:{name:"Square Millimeter",convertValue:1/1e6},sqin:{name:"Square Inch",convertValue:1/1550.0031},sqft:{name:"Square Foot",convertValue:1/10.763888889},sqyd:{name:"Square Yard",convertValue:1/1.1959876543333339},acre:{name:"Acre",convertValue:1/247105e-9},hectare:{name:"Hectare",convertValue:1/1e-4}}},d=n(V),p={baseUnit:"kg/m3",units:{"kg/m3":{name:"Kilogram per cubic meter",convertValue:1},"lb/ft3":{name:"Pound per cubic foot",convertValue:1/.062427962},"g/cm3":{name:"Gram per cubic centimeter",convertValue:1e3},"kg/ft3":{name:"Kilogram per cubic foot",convertValue:1/.0283168},"lb/m3":{name:"Pound per cubic meter",convertValue:1/2.20462}}},g=n(p),h=n({baseUnit:"C",units:{C:{name:"Coulomb",convertValue:1},mC:{name:"MilliCoulomb",convertValue:.001},μC:{name:"MicroCoulomb",convertValue:1e-6},nC:{name:"NanoCoulomb",convertValue:1e-9},pC:{name:"PicoCoulomb",convertValue:1e-12}}}),f=n({baseUnit:"A",units:{A:{name:"Ampere",convertValue:1},mA:{name:"Milliampere",convertValue:.001},μA:{name:"Microampere",convertValue:1e-6},nA:{name:"Nanoampere",convertValue:1e-9},pA:{name:"Picoampere",convertValue:1e-12}}}),b={baseUnit:"J",units:{J:{name:"Joule",convertValue:1},kJ:{name:"Kilojoule",convertValue:1/.001},cal:{name:"Calorie",convertValue:1/.239006},kcal:{name:"Kilocalorie",convertValue:1/239006e-9},Wh:{name:"Watt-hour",convertValue:1/277778e-9},kWh:{name:"Kilowatt-hour",convertValue:1/277778e-12},BTU:{name:"British Thermal Unit",convertValue:1/947817e-9}}},C=n(b),M={baseUnit:"N",units:{N:{name:"Newton",convertValue:1},dyn:{name:"Dyne",convertValue:1e-5},lbf:{name:"Pound-force",convertValue:1/.224809},kgf:{name:"Kilogram-force",convertValue:9.80665}}},S=n(M),P=n({baseUnit:"m",units:{m:{name:"Meter",convertValue:1},km:{name:"Kilometer",convertValue:1e3},mm:{name:"Millimeter",convertValue:.001},cm:{name:"Centimeter",convertValue:.01},in:{name:"Inch",convertValue:.0254},ft:{name:"Foot",convertValue:.3048},um:{name:"Micrometer",convertValue:1e-6},nm:{name:"Nanometer",convertValue:1e-9}}}),k={baseUnit:"kg/s",units:{"kg/s":{name:"Kilogram per second",convertValue:1},"kg/h":{name:"Kilogram per hour",convertValue:1/3600},"lb/day":{name:"Pound per day",convertValue:1/190479},"g/s":{name:"Gram per second",convertValue:.001},"lb/h":{name:"Pound per hour",convertValue:1/(190479/24)},"ton/day":{name:"Ton per day",convertValue:.011574074074074073},"oz/min":{name:"Ounce per minute",convertValue:1/2116.4394433764},"ton/year":{name:"Ton per year",convertValue:31709791983764585e-21},"lb/s":{name:"Pound per second",convertValue:1/(190479/86400)},"kg/day":{name:"Kilogram per day",convertValue:1/86400}}},y=n(k),K=n({baseUnit:"kg",units:{kg:{name:"Kilogram",convertValue:1},g:{name:"Gram",convertValue:.001},lb:{name:"Pound",convertValue:.453592},oz:{name:"Ounce",convertValue:.0283495},ton:{name:"Ton",convertValue:1e3},mg:{name:"Miligram",convertValue:1e-6}}}),F={baseUnit:"W",units:{W:{name:"Watt",convertValue:1},kW:{name:"Kilowatt",convertValue:1e3},hp:{name:"Horsepower",convertValue:745.7},"BTU/h":{name:"British Thermal Unit per hour",convertValue:1/3.41214},"cal/s":{name:"Calorie per second",convertValue:1/.23884589662749595}}},U=n(F),q=n({baseUnit:"Pag",units:{Pag:{name:"Pascal",convertValue:1},kPag:{name:"Kilopascal",convertValue:1e3},MPag:{name:"Megapascal",convertValue:1e6},barg:{name:"Bar",convertValue:1e5},atmg:{name:"Atmosphere",convertValue:101325},psig:{name:"Pound per Square Inch",convertValue:6894.76},"kg/cm2g":{name:"Kilogram per Square Centimeter",convertValue:98066.5}}}),$={baseUnit:"Pa",units:{Pa:{name:"Pascal",convertValue:1},kPa:{name:"Kilopascal",convertValue:1e3},MPa:{name:"Megapascal",convertValue:1e6},bar:{name:"Bar",convertValue:1e5},atm:{name:"Atmosphere",convertValue:101325},psi:{name:"Pound per Square Inch",convertValue:6894.76},"kg/cm2":{name:"Kilogram per Square Centimeter",convertValue:98066.5},Pag:{name:"Pascal Gauge",convertValue:1,offset:-101325},kPag:{name:"Kilopascal Gauge",convertValue:1e3,offset:-101.325},MPag:{name:"Megapascal Gauge",convertValue:1e6,offset:-.101325},barg:{name:"Bar Gauge",convertValue:1e5,offset:-1.01325},atmg:{name:"Atmosphere Gauge",convertValue:101325,offset:-1},psig:{name:"Pound per Square Inch Gauge",convertValue:6894.76,offset:-101325/6894.76},"kg/cm2g":{name:"Kilogram per Square Centimeter Gauge",convertValue:98066.5,offset:-101325/98066.5},ksi:{name:"1000 Pound per Square Inch",convertValue:6894.76*1e3}}},w=n($),_={baseUnit:"m/s",units:{"m/s":{name:"Meter per second",convertValue:1},"km/h":{name:"Kilometer per hour",convertValue:.277778},"ft/s":{name:"Foot per second",convertValue:.3048},"mi/h":{name:"Mile per hour",convertValue:.44704},knot:{name:"Knot",convertValue:.514444},"m/h":{name:"Meter per hour",convertValue:1/3600},"ft/h":{name:"Foot per hour",convertValue:1/11811},mph:{name:"Miles per hour",convertValue:.44704}}},G=n(_),D={baseUnit:"SCMD",units:{SCMD:{name:"Standard Cubic Meters per Day",convertValue:1},SCFD:{name:"Standard Cubic Feet per Day",convertValue:1/35.3147},MSCMD:{name:"Million Standard Cubic Meters per Day",convertValue:1e3},MMSCMD:{name:"Million Million Standard Cubic Meters per Day",convertValue:1e6},MSCFD:{name:"Million Standard Cubic Feet per Day",convertValue:1/35.3147*1e3},MMSCFD:{name:"Million Million Standard Cubic Feet per Day",convertValue:1/35.3147*1e6},"Sm3/h":{name:"Standard Cubic Meter per Hour",convertValue:24},"Sft3/h":{name:"Standard Cubic Feet per Hour",convertValue:1/35.3147*24}}},I=n(D),A=n({baseUnit:"N/m",units:{"N/m":{name:"Newton per Meter",convertValue:1},"dyn/cm":{name:"Dyne per Centimeter",convertValue:.001},"lbf/ft":{name:"Pound-force per Foot",convertValue:14.5939},"mN/m":{name:"Millinewton per Meter",convertValue:.001},"lbf/in":{name:"Pound-force per Inch",convertValue:175.126836},"ozf/in":{name:"Ounce-force per Inch",convertValue:10.945427}}}),T={baseUnit:"sec",units:{sec:{name:"Second",convertValue:1},min:{name:"Minute",convertValue:60},hr:{name:"Hour",convertValue:3600},day:{name:"Day",convertValue:86400},month:{name:"Month",convertValue:86400*30},year:{name:"Year",convertValue:86400*365}}},B=n(T),N={baseUnit:"cP",units:{cP:{name:"Centipoise",convertValue:1},Pas:{name:"Pascal second",convertValue:1/.001},"lb/fts":{name:"Pound per second-foot",convertValue:1/.000671968994813},"kg/ms":{name:"Kilogram per meter-second-hour",convertValue:1/.001},"lb/fth":{name:"Pound per hour-foot",convertValue:1/2.4190883105},"kg/mh":{name:"Kilogram per meter-second-meter",convertValue:1/3.6}}},W=n(N),j=n({baseUnit:"V",units:{V:{name:"Volt",convertValue:1},mV:{name:"Millivolt",convertValue:.001},kV:{name:"Kilovolt",convertValue:1e3}}}),H={baseUnit:"m3",units:{m3:{name:"Cubic Meter",convertValue:1},liter:{name:"Liter",convertValue:.001},cm3:{name:"Cubic Centimeter",convertValue:1e-6},mm3:{name:"Cubic Millimeter",convertValue:1e-9},gallon:{name:"Gallon",convertValue:.00454609},quart:{name:"Quart",convertValue:1/879.877},ft3:{name:"Cubic Feet",convertValue:.0283168},in3:{name:"Cubic inch",convertValue:16387e-9}}},O=n(H),J={baseUnit:"m3/h",units:{"m3/h":{name:"Cubic meter per hour",convertValue:1},"m3/day":{name:"Cubic meter per day",convertValue:1/24},"ft3/h":{name:"Cubic foot per hour",convertValue:.0283168},"ft3/day":{name:"Cubic foot per day",convertValue:.0283168/24},"gal/h":{name:"Gallon per hour",convertValue:.00378541},"gal/day":{name:"Gallon per day",convertValue:.00378541/24},"m3/s":{name:"Cubic meter per second",convertValue:3600},"ft3/s":{name:"Cubic foot per second",convertValue:1/.00980963},"gal/s":{name:"Gallon per second",convertValue:.00378541*3600}}},L=n(J),z={baseUnit:"C",units:{C:{name:"Celsius",convertValue:1,offset:0},F:{name:"Fahrenheit",convertValue:5/9,offset:32},K:{name:"Kelvin",convertValue:1,offset:273.15}}},E=n(z),Y={baseUnit:"Pa/m",units:{"Pa/m":{name:"Pascal per Meter",convertValue:1},"Pa/km":{name:"Pascal per Kilometer",convertValue:1/1e3},"kPa/m":{name:"Kilopascal per Meter",convertValue:1e3},"kPa/km":{name:"Kilopascal per Kilometer",convertValue:1},"bar/m":{name:"Bar per Meter",convertValue:1e5},"bar/km":{name:"Bar per Kilometer",convertValue:100},"psi/ft":{name:"Pound per Square Inch per Foot",convertValue:22620.594793858265},"psi/m":{name:"Pound per Square Inch per Meter",convertValue:6894.76},"atm/m":{name:"Atmosphere per Meter",convertValue:101325},"atm/km":{name:"Atmosphere per Kilometer",convertValue:101.325},"kg/cm2/m":{name:"Kilogram per Square Centimeter per Meter",convertValue:98066.5},"kg/cm2/km":{name:"Kilogram per Square Centimeter per Kilometer",convertValue:98.0665},"barg/m":{name:"Bar Gauge per Meter",convertValue:1e5},"psig/ft":{name:"Pound per Square Inch Gauge per Foot",convertValue:22620.594793858265},"psig/m":{name:"Pound per Square Inch Gauge per Meter",convertValue:6894.76},"kg/cm2g/m":{name:"Kilogram per Square Centimeter Gauge per Meter",convertValue:98066.5},"kg/cm2g/km":{name:"Kilogram per Square Centimeter Gauge per Kilometer",convertValue:98.0665}}},Q=n(Y),R={baseUnit:"kg/Sm3",units:{"kg/Sm3":{name:"Kilogram per Standard Cubic Meter",convertValue:1},"g/Sm3":{name:"Gram per Standard Cubic Meter",convertValue:.001},"mg/Sm3":{name:"Milligram per Standard Cubic Meter",convertValue:1e-6},"kg/MSm3":{name:"Kilogram per Thousand Standard Cubic Meters",convertValue:1/1e3},"kg/MMSm3":{name:"Kilogram per Million Standard Cubic Meters",convertValue:1/1e6},"g/SCF":{name:"Gram per Standard Cubic Foot",convertValue:.001*35.3147},"lb/SCF":{name:"Pound per Standard Cubic Foot",convertValue:.453592*35.3147},"lb/MSCF":{name:"Pound per Thousand Standard Cubic Feet",convertValue:.453592*35.3147/1e3},"lb/MMSCF":{name:"Pound per Million Standard Cubic Feet",convertValue:.453592*35.3147/1e6},"kg/MMSCF":{name:"Kilogram per Million Standard Cubic Feet",convertValue:35.3147/1e6}}},X=n(R);e.acceleration=v,e.area=d,e.density=g,e.electricCharge=h,e.electricCurrent=f,e.energy=C,e.force=S,e.length=P,e.mass=K,e.massFlow=y,e.massPerStandardVolume=X,e.power=U,e.pressure=w,e.pressureManometric=q,e.pressurePerLength=Q,e.speed=G,e.standardVolumetricFlow=I,e.temperature=E,e.time=B,e.torque=A,e.viscosity=W,e.voltage=j,e.volume=O,e.volumetricFlow=L,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(e,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(e=typeof globalThis<"u"?globalThis:e||self,r(e["engineering-unit-converter"]={}))})(this,function(e){"use strict";var ae=Object.defineProperty;var re=(e,r,o)=>r in e?ae(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o;var l=(e,r,o)=>(re(e,typeof r!="symbol"?r+"":r,o),o);class r{constructor(a,t){l(this,"_definitions");l(this,"_val");l(this,"_fromUnit",null);this._definitions=t,this._val=a}from(a){return this._checkUnit(a),this._fromUnit=a,this}to(a){if(!this._fromUnit)throw new Error('Please specify the "from" unit using the from() method before calling to().');this._checkUnit(a);const t=this._getUnit(this._fromUnit),c=this._getUnit(a);let u=this._val;return t.offset!==0&&(u-=t.offset),u=u*t.convertValue/c.convertValue,c.offset!==0&&(u+=c.offset),u}_getUnit(a){const t=this._definitions.units[a],c=t.offset??0;return{convertValue:t.convertValue,offset:c}}_checkUnit(a){const t=Object.keys(this._definitions.units);if(!t.includes(a))throw new Error(`Invalid unit "${a}". Available units: ${t.join(", ")}`)}}class o{constructor(a,t){l(this,"_internalConverter");this._internalConverter=new r(a,t)}from(a){return this._internalConverter.from(a),new i(this._internalConverter)}}class i{constructor(a){this._internalConverter=a}to(a){return this._internalConverter.to(a)}}const n=m=>a=>new o(a,m),s={baseUnit:"m/s2",units:{"m/s2":{name:"Meter per Second Squared",convertValue:1},"km/s2":{name:"Kilometer per Second Squared",convertValue:1e3},"cm/s2":{name:"Centimeter per Second Squared",convertValue:1/100},"ft/s2":{name:"Foot per Second Squared",convertValue:1/3.28084}}},v=n(s),V={baseUnit:"m2",units:{m2:{name:"Square Meter",convertValue:1},km2:{name:"Square Kilometer",convertValue:1/1e-6},cm2:{name:"Square Centimeter",convertValue:1/1e4},mm2:{name:"Square Millimeter",convertValue:1/1e6},sqin:{name:"Square Inch",convertValue:1/1550.0031},sqft:{name:"Square Foot",convertValue:1/10.763888889},sqyd:{name:"Square Yard",convertValue:1/1.1959876543333339},acre:{name:"Acre",convertValue:1/247105e-9},hectare:{name:"Hectare",convertValue:1/1e-4}}},d=n(V),p={baseUnit:"kg/m3",units:{"kg/m3":{name:"Kilogram per cubic meter",convertValue:1},"lb/ft3":{name:"Pound per cubic foot",convertValue:1/.062427962},"g/cm3":{name:"Gram per cubic centimeter",convertValue:1e3},"kg/ft3":{name:"Kilogram per cubic foot",convertValue:1/.0283168},"lb/m3":{name:"Pound per cubic meter",convertValue:1/2.20462}}},g=n(p),h=n({baseUnit:"C",units:{C:{name:"Coulomb",convertValue:1},mC:{name:"MilliCoulomb",convertValue:.001},μC:{name:"MicroCoulomb",convertValue:1e-6},nC:{name:"NanoCoulomb",convertValue:1e-9},pC:{name:"PicoCoulomb",convertValue:1e-12}}}),b=n({baseUnit:"A",units:{A:{name:"Ampere",convertValue:1},mA:{name:"Milliampere",convertValue:.001},μA:{name:"Microampere",convertValue:1e-6},nA:{name:"Nanoampere",convertValue:1e-9},pA:{name:"Picoampere",convertValue:1e-12}}}),C={baseUnit:"J",units:{J:{name:"Joule",convertValue:1},kJ:{name:"Kilojoule",convertValue:1/.001},cal:{name:"Calorie",convertValue:1/.239006},kcal:{name:"Kilocalorie",convertValue:1/239006e-9},Wh:{name:"Watt-hour",convertValue:1/277778e-9},kWh:{name:"Kilowatt-hour",convertValue:1/277778e-12},BTU:{name:"British Thermal Unit",convertValue:1/947817e-9}}},f=n(C),M={baseUnit:"N",units:{N:{name:"Newton",convertValue:1},dyn:{name:"Dyne",convertValue:1e-5},lbf:{name:"Pound-force",convertValue:1/.224809},kgf:{name:"Kilogram-force",convertValue:9.80665}}},S=n(M),P=n({baseUnit:"m",units:{m:{name:"Meter",convertValue:1},km:{name:"Kilometer",convertValue:1e3},mm:{name:"Millimeter",convertValue:.001},cm:{name:"Centimeter",convertValue:.01},in:{name:"Inch",convertValue:.0254},ft:{name:"Foot",convertValue:.3048},um:{name:"Micrometer",convertValue:1e-6},nm:{name:"Nanometer",convertValue:1e-9}}}),k={baseUnit:"kg/s",units:{"kg/s":{name:"Kilogram per second",convertValue:1},"kg/h":{name:"Kilogram per hour",convertValue:1/3600},"lb/day":{name:"Pound per day",convertValue:1/190479},"g/s":{name:"Gram per second",convertValue:.001},"lb/h":{name:"Pound per hour",convertValue:1/(190479/24)},"ton/day":{name:"Ton per day",convertValue:.011574074074074073},"oz/min":{name:"Ounce per minute",convertValue:1/2116.4394433764},"ton/year":{name:"Ton per year",convertValue:31709791983764585e-21},"lb/s":{name:"Pound per second",convertValue:1/(190479/86400)},"kg/day":{name:"Kilogram per day",convertValue:1/86400}}},F=n(k),K=n({baseUnit:"kg",units:{kg:{name:"Kilogram",convertValue:1},g:{name:"Gram",convertValue:.001},lb:{name:"Pound",convertValue:.453592},oz:{name:"Ounce",convertValue:.0283495},ton:{name:"Ton",convertValue:1e3},mg:{name:"Miligram",convertValue:1e-6}}}),U={baseUnit:"W",units:{W:{name:"Watt",convertValue:1},kW:{name:"Kilowatt",convertValue:1e3},MW:{name:"Megawatt",convertValue:1e6},hp:{name:"Horsepower",convertValue:745.7},"BTU/h":{name:"British Thermal Unit per hour",convertValue:1/3.41214},"kBTU/h":{name:"Thousand British Thermal Units per hour",convertValue:1e3/3.41214},"MMBTU/h":{name:"Million British Thermal Units per hour",convertValue:1e6/3.41214},"cal/s":{name:"Calorie per second",convertValue:1/.23884589662749595}}},y=n(U),q=n({baseUnit:"Pag",units:{Pag:{name:"Pascal",convertValue:1},kPag:{name:"Kilopascal",convertValue:1e3},MPag:{name:"Megapascal",convertValue:1e6},barg:{name:"Bar",convertValue:1e5},atmg:{name:"Atmosphere",convertValue:101325},psig:{name:"Pound per Square Inch",convertValue:6894.76},"kg/cm2g":{name:"Kilogram per Square Centimeter",convertValue:98066.5}}}),$={baseUnit:"Pa",units:{Pa:{name:"Pascal",convertValue:1},kPa:{name:"Kilopascal",convertValue:1e3},MPa:{name:"Megapascal",convertValue:1e6},bar:{name:"Bar",convertValue:1e5},atm:{name:"Atmosphere",convertValue:101325},psi:{name:"Pound per Square Inch",convertValue:6894.76},"kg/cm2":{name:"Kilogram per Square Centimeter",convertValue:98066.5},Pag:{name:"Pascal Gauge",convertValue:1,offset:-101325},kPag:{name:"Kilopascal Gauge",convertValue:1e3,offset:-101.325},MPag:{name:"Megapascal Gauge",convertValue:1e6,offset:-.101325},barg:{name:"Bar Gauge",convertValue:1e5,offset:-1.01325},atmg:{name:"Atmosphere Gauge",convertValue:101325,offset:-1},psig:{name:"Pound per Square Inch Gauge",convertValue:6894.76,offset:-101325/6894.76},"kg/cm2g":{name:"Kilogram per Square Centimeter Gauge",convertValue:98066.5,offset:-101325/98066.5},ksi:{name:"1000 Pound per Square Inch",convertValue:6894.76*1e3}}},w=n($),_={baseUnit:"m/s",units:{"m/s":{name:"Meter per second",convertValue:1},"km/h":{name:"Kilometer per hour",convertValue:.277778},"ft/s":{name:"Foot per second",convertValue:.3048},"mi/h":{name:"Mile per hour",convertValue:.44704},knot:{name:"Knot",convertValue:.514444},"m/h":{name:"Meter per hour",convertValue:1/3600},"ft/h":{name:"Foot per hour",convertValue:1/11811},mph:{name:"Miles per hour",convertValue:.44704}}},G=n(_),T={baseUnit:"SCMD",units:{SCMD:{name:"Standard Cubic Meters per Day",convertValue:1},SCFD:{name:"Standard Cubic Feet per Day",convertValue:1/35.3147},MSCMD:{name:"Million Standard Cubic Meters per Day",convertValue:1e3},MMSCMD:{name:"Million Million Standard Cubic Meters per Day",convertValue:1e6},MSCFD:{name:"Million Standard Cubic Feet per Day",convertValue:1/35.3147*1e3},MMSCFD:{name:"Million Million Standard Cubic Feet per Day",convertValue:1/35.3147*1e6},"Sm3/h":{name:"Standard Cubic Meter per Hour",convertValue:24},"Sft3/h":{name:"Standard Cubic Feet per Hour",convertValue:1/35.3147*24}}},D=n(T),B=n({baseUnit:"N/m",units:{"N/m":{name:"Newton per Meter",convertValue:1},"dyn/cm":{name:"Dyne per Centimeter",convertValue:.001},"lbf/ft":{name:"Pound-force per Foot",convertValue:14.5939},"mN/m":{name:"Millinewton per Meter",convertValue:.001},"lbf/in":{name:"Pound-force per Inch",convertValue:175.126836},"ozf/in":{name:"Ounce-force per Inch",convertValue:10.945427}}}),I={baseUnit:"sec",units:{sec:{name:"Second",convertValue:1},min:{name:"Minute",convertValue:60},hr:{name:"Hour",convertValue:3600},day:{name:"Day",convertValue:86400},month:{name:"Month",convertValue:86400*30},year:{name:"Year",convertValue:86400*365}}},A=n(I),N={baseUnit:"cP",units:{cP:{name:"Centipoise",convertValue:1},Pas:{name:"Pascal second",convertValue:1/.001},"lb/fts":{name:"Pound per second-foot",convertValue:1/.000671968994813},"kg/ms":{name:"Kilogram per meter-second-hour",convertValue:1/.001},"lb/fth":{name:"Pound per hour-foot",convertValue:1/2.4190883105},"kg/mh":{name:"Kilogram per meter-second-meter",convertValue:1/3.6}}},W=n(N),L=n({baseUnit:"V",units:{V:{name:"Volt",convertValue:1},mV:{name:"Millivolt",convertValue:.001},kV:{name:"Kilovolt",convertValue:1e3}}}),j={baseUnit:"m3",units:{m3:{name:"Cubic Meter",convertValue:1},liter:{name:"Liter",convertValue:.001},cm3:{name:"Cubic Centimeter",convertValue:1e-6},mm3:{name:"Cubic Millimeter",convertValue:1e-9},gallon:{name:"Gallon",convertValue:.00454609},quart:{name:"Quart",convertValue:1/879.877},ft3:{name:"Cubic Feet",convertValue:.0283168},in3:{name:"Cubic inch",convertValue:16387e-9}}},H=n(j),O={baseUnit:"m3/h",units:{"m3/h":{name:"Cubic meter per hour",convertValue:1},"m3/day":{name:"Cubic meter per day",convertValue:1/24},"ft3/h":{name:"Cubic foot per hour",convertValue:.0283168},"ft3/day":{name:"Cubic foot per day",convertValue:.0283168/24},"gal/h":{name:"Gallon per hour",convertValue:.00378541},"gal/day":{name:"Gallon per day",convertValue:.00378541/24},"m3/s":{name:"Cubic meter per second",convertValue:3600},"ft3/s":{name:"Cubic foot per second",convertValue:1/.00980963},"gal/s":{name:"Gallon per second",convertValue:.00378541*3600}}},J=n(O),z={baseUnit:"C",units:{C:{name:"Celsius",convertValue:1,offset:0},F:{name:"Fahrenheit",convertValue:5/9,offset:32},K:{name:"Kelvin",convertValue:1,offset:273.15}}},E=n(z),R={baseUnit:"Pa/m",units:{"Pa/m":{name:"Pascal per Meter",convertValue:1},"Pa/km":{name:"Pascal per Kilometer",convertValue:1/1e3},"kPa/m":{name:"Kilopascal per Meter",convertValue:1e3},"kPa/km":{name:"Kilopascal per Kilometer",convertValue:1},"bar/m":{name:"Bar per Meter",convertValue:1e5},"bar/km":{name:"Bar per Kilometer",convertValue:100},"psi/ft":{name:"Pound per Square Inch per Foot",convertValue:22620.594793858265},"psi/m":{name:"Pound per Square Inch per Meter",convertValue:6894.76},"atm/m":{name:"Atmosphere per Meter",convertValue:101325},"atm/km":{name:"Atmosphere per Kilometer",convertValue:101.325},"kg/cm2/m":{name:"Kilogram per Square Centimeter per Meter",convertValue:98066.5},"kg/cm2/km":{name:"Kilogram per Square Centimeter per Kilometer",convertValue:98.0665},"barg/m":{name:"Bar Gauge per Meter",convertValue:1e5},"psig/ft":{name:"Pound per Square Inch Gauge per Foot",convertValue:22620.594793858265},"psig/m":{name:"Pound per Square Inch Gauge per Meter",convertValue:6894.76},"kg/cm2g/m":{name:"Kilogram per Square Centimeter Gauge per Meter",convertValue:98066.5},"kg/cm2g/km":{name:"Kilogram per Square Centimeter Gauge per Kilometer",convertValue:98.0665}}},Y=n(R),Q={baseUnit:"kg/Sm3",units:{"kg/Sm3":{name:"Kilogram per Standard Cubic Meter",convertValue:1},"g/Sm3":{name:"Gram per Standard Cubic Meter",convertValue:.001},"mg/Sm3":{name:"Milligram per Standard Cubic Meter",convertValue:1e-6},"kg/MSm3":{name:"Kilogram per Thousand Standard Cubic Meters",convertValue:1/1e3},"kg/MMSm3":{name:"Kilogram per Million Standard Cubic Meters",convertValue:1/1e6},"g/SCF":{name:"Gram per Standard Cubic Foot",convertValue:.001*35.3147},"lb/SCF":{name:"Pound per Standard Cubic Foot",convertValue:.453592*35.3147},"lb/MSCF":{name:"Pound per Thousand Standard Cubic Feet",convertValue:.453592*35.3147/1e3},"lb/MMSCF":{name:"Pound per Million Standard Cubic Feet",convertValue:.453592*35.3147/1e6},"kg/MMSCF":{name:"Kilogram per Million Standard Cubic Feet",convertValue:35.3147/1e6}}},X=n(Q),Z={baseUnit:"Sm3/m3",units:{"Sm3/m3":{name:"Standard Cubic Meter per Cubic Meter",convertValue:1},"Sm3/L":{name:"Standard Cubic Meter per Liter",convertValue:1e3},"SCF/m3":{name:"Standard Cubic Foot per Cubic Meter",convertValue:.3048**3},"SCF/gal":{name:"Standard Cubic Foot per US Gallon",convertValue:.3048**3/.003785411784},"SCF/bbl":{name:"Standard Cubic Foot per Barrel",convertValue:.3048**3/(42*.003785411784)},"MSCF/bbl":{name:"Thousand Standard Cubic Feet per Barrel",convertValue:.3048**3/(42*.003785411784)*1e3}}},x=n(Z),ee={baseUnit:"C",units:{C:{name:"Delta Celsius",convertValue:1},K:{name:"Delta Kelvin",convertValue:1},F:{name:"Delta Fahrenheit",convertValue:5/9},R:{name:"Delta Rankine",convertValue:5/9}}},ne=n(ee);e.acceleration=v,e.area=d,e.deltaTemperature=ne,e.density=g,e.electricCharge=h,e.electricCurrent=b,e.energy=f,e.force=S,e.length=P,e.mass=K,e.massFlow=F,e.massPerStandardVolume=X,e.power=y,e.pressure=w,e.pressureManometric=q,e.pressurePerLength=Y,e.speed=G,e.standardVolumePerVolume=x,e.standardVolumetricFlow=D,e.temperature=E,e.time=A,e.torque=B,e.viscosity=W,e.voltage=L,e.volume=H,e.volumetricFlow=J,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.d.ts
CHANGED
|
@@ -22,3 +22,5 @@ export { default as volumetricFlow } from './units/volumetric-flow';
|
|
|
22
22
|
export { default as temperature } from './units/temperature';
|
|
23
23
|
export { default as pressurePerLength } from './units/pressure-per-length';
|
|
24
24
|
export { default as massPerStandardVolume } from './units/mass-per-standard-volume';
|
|
25
|
+
export { default as standardVolumePerVolume } from './units/standard-volume-per-volume';
|
|
26
|
+
export { default as deltaTemperature } from './units/delta-temperature';
|
package/dist/types.d.ts
CHANGED
|
@@ -109,8 +109,11 @@ export type Speed = {
|
|
|
109
109
|
export type PowerUnits = {
|
|
110
110
|
'W': UnitsValues;
|
|
111
111
|
'kW': UnitsValues;
|
|
112
|
+
'MW': UnitsValues;
|
|
112
113
|
'hp': UnitsValues;
|
|
113
114
|
'BTU/h': UnitsValues;
|
|
115
|
+
'kBTU/h': UnitsValues;
|
|
116
|
+
'MMBTU/h': UnitsValues;
|
|
114
117
|
'cal/s': UnitsValues;
|
|
115
118
|
};
|
|
116
119
|
export type Power = {
|
|
@@ -312,6 +315,18 @@ export type MassPerStandardVolume = {
|
|
|
312
315
|
baseUnit: 'kg/Sm3';
|
|
313
316
|
units: MassPerStandardVolumeUnits;
|
|
314
317
|
};
|
|
318
|
+
export type StandardVolumePerVolumeUnits = {
|
|
319
|
+
'Sm3/m3': UnitsValues;
|
|
320
|
+
'Sm3/L': UnitsValues;
|
|
321
|
+
'SCF/m3': UnitsValues;
|
|
322
|
+
'SCF/gal': UnitsValues;
|
|
323
|
+
'SCF/bbl': UnitsValues;
|
|
324
|
+
'MSCF/bbl': UnitsValues;
|
|
325
|
+
};
|
|
326
|
+
export type StandardVolumePerVolume = {
|
|
327
|
+
baseUnit: 'Sm3/m3';
|
|
328
|
+
units: StandardVolumePerVolumeUnits;
|
|
329
|
+
};
|
|
315
330
|
export type TemperatureUnits = {
|
|
316
331
|
'C': UnitsValues;
|
|
317
332
|
'F': UnitsValues;
|
|
@@ -321,7 +336,17 @@ export type Temperature = {
|
|
|
321
336
|
baseUnit: 'C';
|
|
322
337
|
units: TemperatureUnits;
|
|
323
338
|
};
|
|
324
|
-
export type
|
|
339
|
+
export type DeltaTemperatureUnits = {
|
|
340
|
+
'C': UnitsValues;
|
|
341
|
+
'F': UnitsValues;
|
|
342
|
+
'K': UnitsValues;
|
|
343
|
+
'R': UnitsValues;
|
|
344
|
+
};
|
|
345
|
+
export type DeltaTemperature = {
|
|
346
|
+
baseUnit: 'C';
|
|
347
|
+
units: DeltaTemperatureUnits;
|
|
348
|
+
};
|
|
349
|
+
export type Measurement = Voltage | MassFlow | VolumetricFlow | Density | Viscosity | Length | Mass | Speed | Power | Energy | Area | Volume | Force | Torque | Time | ElectricCharge | ElectricCurrent | Acceleration | Pressure | PressureManometric | StandardVolumetricFlow | Temperature | PressurePerLength | MassPerStandardVolume | StandardVolumePerVolume | DeltaTemperature;
|
|
325
350
|
export type MeasurementUnits<T extends Measurement> = T extends {
|
|
326
351
|
units: infer U;
|
|
327
352
|
} ? keyof U : never;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DeltaTemperature } from '../types';
|
|
2
|
+
declare const _default: (val: number) => {
|
|
3
|
+
readonly _internalConverter: import("../internalConverter").default<DeltaTemperature>;
|
|
4
|
+
from<U extends keyof import("../types").DeltaTemperatureUnits>(fromUnit: U): {
|
|
5
|
+
readonly _internalConverter: import("../internalConverter").default<DeltaTemperature>;
|
|
6
|
+
to<U_1 extends keyof import("../types").DeltaTemperatureUnits>(toUnit: U_1): number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type StandardVolumePerVolume } from '../types';
|
|
2
|
+
declare const _default: (val: number) => {
|
|
3
|
+
readonly _internalConverter: import("../internalConverter").default<StandardVolumePerVolume>;
|
|
4
|
+
from<U extends keyof import("../types").StandardVolumePerVolumeUnits>(fromUnit: U): {
|
|
5
|
+
readonly _internalConverter: import("../internalConverter").default<StandardVolumePerVolume>;
|
|
6
|
+
to<U_1 extends keyof import("../types").StandardVolumePerVolumeUnits>(toUnit: U_1): number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|