engineering-unit-converter 0.0.6 → 0.0.8
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.
|
@@ -45,31 +45,23 @@ class s {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
const n = (t) => (e) => new m(e, t), i = {
|
|
48
|
-
baseUnit: "m/
|
|
48
|
+
baseUnit: "m/s2",
|
|
49
49
|
units: {
|
|
50
|
-
"m/
|
|
50
|
+
"m/s2": {
|
|
51
51
|
name: "Meter per Second Squared",
|
|
52
52
|
convertValue: 1
|
|
53
53
|
},
|
|
54
|
-
"km/
|
|
54
|
+
"km/s2": {
|
|
55
55
|
name: "Kilometer per Second Squared",
|
|
56
|
-
convertValue:
|
|
57
|
-
// Conversion factor from m/s² to km/s²
|
|
56
|
+
convertValue: 1e3
|
|
58
57
|
},
|
|
59
|
-
"cm/
|
|
58
|
+
"cm/s2": {
|
|
60
59
|
name: "Centimeter per Second Squared",
|
|
61
|
-
convertValue:
|
|
62
|
-
// Conversion factor from m/s² to cm/s²
|
|
63
|
-
},
|
|
64
|
-
g: {
|
|
65
|
-
name: "Gravity",
|
|
66
|
-
convertValue: 9.80665
|
|
67
|
-
// Standard gravity on Earth, in m/s²
|
|
60
|
+
convertValue: 1 / 100
|
|
68
61
|
},
|
|
69
|
-
"ft/
|
|
62
|
+
"ft/s2": {
|
|
70
63
|
name: "Foot per Second Squared",
|
|
71
|
-
convertValue:
|
|
72
|
-
// Conversion factor from m/s² to ft/s²
|
|
64
|
+
convertValue: 1 / 3.28084
|
|
73
65
|
}
|
|
74
66
|
}
|
|
75
67
|
}, A = n(i), v = {
|
|
@@ -101,12 +93,12 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
101
93
|
},
|
|
102
94
|
sqft: {
|
|
103
95
|
name: "Square Foot",
|
|
104
|
-
convertValue: 1 / 10.
|
|
96
|
+
convertValue: 1 / 10.763888889
|
|
105
97
|
// Conversion factor from m2 to sqft
|
|
106
98
|
},
|
|
107
99
|
sqyd: {
|
|
108
100
|
name: "Square Yard",
|
|
109
|
-
convertValue: 1 / 1.
|
|
101
|
+
convertValue: 1 / 1.1959876543333339
|
|
110
102
|
// Conversion factor from m2 to sqyd
|
|
111
103
|
},
|
|
112
104
|
acre: {
|
|
@@ -120,7 +112,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
120
112
|
// Conversion factor from m2 to hectare
|
|
121
113
|
}
|
|
122
114
|
}
|
|
123
|
-
},
|
|
115
|
+
}, N = n(v), V = {
|
|
124
116
|
baseUnit: "kg/m3",
|
|
125
117
|
units: {
|
|
126
118
|
"kg/m3": {
|
|
@@ -144,7 +136,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
144
136
|
convertValue: 1 / 2.20462
|
|
145
137
|
}
|
|
146
138
|
}
|
|
147
|
-
},
|
|
139
|
+
}, G = n(V), p = {
|
|
148
140
|
baseUnit: "C",
|
|
149
141
|
units: {
|
|
150
142
|
C: {
|
|
@@ -172,7 +164,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
172
164
|
// Conversion factor from C to pC
|
|
173
165
|
}
|
|
174
166
|
}
|
|
175
|
-
},
|
|
167
|
+
}, I = n(p), d = {
|
|
176
168
|
baseUnit: "A",
|
|
177
169
|
units: {
|
|
178
170
|
A: {
|
|
@@ -200,7 +192,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
200
192
|
// Conversion factor from A to pA
|
|
201
193
|
}
|
|
202
194
|
}
|
|
203
|
-
},
|
|
195
|
+
}, T = n(d), h = {
|
|
204
196
|
baseUnit: "J",
|
|
205
197
|
units: {
|
|
206
198
|
J: {
|
|
@@ -252,7 +244,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
252
244
|
},
|
|
253
245
|
lbf: {
|
|
254
246
|
name: "Pound-force",
|
|
255
|
-
convertValue:
|
|
247
|
+
convertValue: 1 / 0.224809
|
|
256
248
|
// Conversion factor from N to lbf
|
|
257
249
|
},
|
|
258
250
|
kgf: {
|
|
@@ -261,9 +253,13 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
261
253
|
// Conversion factor from N to kgf
|
|
262
254
|
}
|
|
263
255
|
}
|
|
264
|
-
}, B = n(b),
|
|
256
|
+
}, B = n(b), C = {
|
|
265
257
|
baseUnit: "m",
|
|
266
258
|
units: {
|
|
259
|
+
m: {
|
|
260
|
+
name: "Meter",
|
|
261
|
+
convertValue: 1
|
|
262
|
+
},
|
|
267
263
|
mm: {
|
|
268
264
|
name: "Millimeter",
|
|
269
265
|
convertValue: 1e-3
|
|
@@ -274,10 +270,6 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
274
270
|
convertValue: 0.01
|
|
275
271
|
// Conversion factor from m to cm
|
|
276
272
|
},
|
|
277
|
-
m: {
|
|
278
|
-
name: "Meter",
|
|
279
|
-
convertValue: 1
|
|
280
|
-
},
|
|
281
273
|
in: {
|
|
282
274
|
name: "Inch",
|
|
283
275
|
convertValue: 0.0254
|
|
@@ -289,7 +281,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
289
281
|
// Conversion factor from m to ft
|
|
290
282
|
}
|
|
291
283
|
}
|
|
292
|
-
}, J = n(
|
|
284
|
+
}, J = n(C), g = {
|
|
293
285
|
baseUnit: "kg/s",
|
|
294
286
|
units: {
|
|
295
287
|
"kg/s": {
|
|
@@ -334,7 +326,7 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
334
326
|
// 1 day = 86400 seconds
|
|
335
327
|
}
|
|
336
328
|
}
|
|
337
|
-
}, j = n(
|
|
329
|
+
}, j = n(g), f = {
|
|
338
330
|
baseUnit: "kg",
|
|
339
331
|
units: {
|
|
340
332
|
kg: {
|
|
@@ -381,12 +373,12 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
381
373
|
},
|
|
382
374
|
"BTU/h": {
|
|
383
375
|
name: "British Thermal Unit per hour",
|
|
384
|
-
convertValue: 3.41214
|
|
376
|
+
convertValue: 1 / 3.41214
|
|
385
377
|
// Conversion factor from W to BTU/h
|
|
386
378
|
},
|
|
387
379
|
"cal/s": {
|
|
388
380
|
name: "Calorie per second",
|
|
389
|
-
convertValue:
|
|
381
|
+
convertValue: 1 / 0.23884589662749595
|
|
390
382
|
// Conversion factor from W to cal/s
|
|
391
383
|
}
|
|
392
384
|
}
|
|
@@ -476,32 +468,26 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
476
468
|
"km/h": {
|
|
477
469
|
name: "Kilometer per hour",
|
|
478
470
|
convertValue: 0.277778
|
|
479
|
-
// Conversion factor from m/s to km/h
|
|
480
471
|
},
|
|
481
472
|
"ft/s": {
|
|
482
473
|
name: "Foot per second",
|
|
483
474
|
convertValue: 0.3048
|
|
484
|
-
// Conversion factor from m/s to ft/s
|
|
485
475
|
},
|
|
486
476
|
"mi/h": {
|
|
487
477
|
name: "Mile per hour",
|
|
488
478
|
convertValue: 0.44704
|
|
489
|
-
// Conversion factor from m/s to mi/h
|
|
490
479
|
},
|
|
491
480
|
knot: {
|
|
492
481
|
name: "Knot",
|
|
493
482
|
convertValue: 0.514444
|
|
494
|
-
// Conversion factor from m/s to knots
|
|
495
483
|
},
|
|
496
484
|
"m/h": {
|
|
497
485
|
name: "Meter per hour",
|
|
498
486
|
convertValue: 1 / 3600
|
|
499
|
-
// Conversion factor from m/s to m/h
|
|
500
487
|
},
|
|
501
488
|
"ft/h": {
|
|
502
489
|
name: "Foot per hour",
|
|
503
|
-
convertValue:
|
|
504
|
-
// Conversion factor from m/s to ft/h
|
|
490
|
+
convertValue: 1 / 11811
|
|
505
491
|
}
|
|
506
492
|
}
|
|
507
493
|
}, x = n(S), P = {
|
|
@@ -547,17 +533,14 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
547
533
|
"dyn/cm": {
|
|
548
534
|
name: "Dyne per Centimeter",
|
|
549
535
|
convertValue: 1e-3
|
|
550
|
-
// Conversion factor from N/m to dyn/cm
|
|
551
536
|
},
|
|
552
537
|
"lbf/ft": {
|
|
553
538
|
name: "Pound-force per Foot",
|
|
554
|
-
convertValue:
|
|
555
|
-
// Conversion factor from N/m to lbf/ft
|
|
539
|
+
convertValue: 1.35582
|
|
556
540
|
},
|
|
557
541
|
"mN/m": {
|
|
558
542
|
name: "Millinewton per Meter",
|
|
559
543
|
convertValue: 1e-3
|
|
560
|
-
// Conversion factor from N/m to mN/m
|
|
561
544
|
}
|
|
562
545
|
}
|
|
563
546
|
}, Q = n(k), w = {
|
|
@@ -590,23 +573,23 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
590
573
|
name: "Centipoise",
|
|
591
574
|
convertValue: 1
|
|
592
575
|
},
|
|
593
|
-
|
|
576
|
+
Pas: {
|
|
594
577
|
name: "Pascal second",
|
|
595
578
|
convertValue: 1 / 1e-3
|
|
596
579
|
},
|
|
597
|
-
"lb/
|
|
580
|
+
"lb/fts": {
|
|
598
581
|
name: "Pound per second-foot",
|
|
599
582
|
convertValue: 1 / 671968994813e-15
|
|
600
583
|
},
|
|
601
|
-
"kg/
|
|
584
|
+
"kg/ms": {
|
|
602
585
|
name: "Kilogram per meter-second-hour",
|
|
603
586
|
convertValue: 1 / 1e-3
|
|
604
587
|
},
|
|
605
|
-
"lb/
|
|
588
|
+
"lb/fth": {
|
|
606
589
|
name: "Pound per hour-foot",
|
|
607
590
|
convertValue: 1 / 2.4190883105
|
|
608
591
|
},
|
|
609
|
-
"kg/
|
|
592
|
+
"kg/mh": {
|
|
610
593
|
name: "Kilogram per meter-second-meter",
|
|
611
594
|
convertValue: 1 / 3.6
|
|
612
595
|
}
|
|
@@ -628,40 +611,35 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
628
611
|
convertValue: 1e3
|
|
629
612
|
}
|
|
630
613
|
}
|
|
631
|
-
}, X = n($),
|
|
632
|
-
baseUnit: "
|
|
614
|
+
}, X = n($), q = {
|
|
615
|
+
baseUnit: "m3",
|
|
633
616
|
units: {
|
|
634
|
-
|
|
617
|
+
m3: {
|
|
635
618
|
name: "Cubic Meter",
|
|
636
619
|
convertValue: 1
|
|
637
620
|
},
|
|
638
621
|
liter: {
|
|
639
622
|
name: "Liter",
|
|
640
623
|
convertValue: 1e-3
|
|
641
|
-
// Conversion factor from m³ to liters
|
|
642
624
|
},
|
|
643
|
-
|
|
625
|
+
cm3: {
|
|
644
626
|
name: "Cubic Centimeter",
|
|
645
627
|
convertValue: 1e-6
|
|
646
|
-
// Conversion factor from m³ to cm³
|
|
647
628
|
},
|
|
648
|
-
|
|
629
|
+
mm3: {
|
|
649
630
|
name: "Cubic Millimeter",
|
|
650
631
|
convertValue: 1e-9
|
|
651
|
-
// Conversion factor from m³ to mm³
|
|
652
632
|
},
|
|
653
633
|
gallon: {
|
|
654
634
|
name: "Gallon",
|
|
655
|
-
convertValue:
|
|
656
|
-
// Conversion factor from m³ to gallons
|
|
635
|
+
convertValue: 454609e-8
|
|
657
636
|
},
|
|
658
637
|
quart: {
|
|
659
638
|
name: "Quart",
|
|
660
|
-
convertValue:
|
|
661
|
-
// Conversion factor from m³ to quarts
|
|
639
|
+
convertValue: 1 / 879.877
|
|
662
640
|
}
|
|
663
641
|
}
|
|
664
|
-
}, Z = n(
|
|
642
|
+
}, Z = n(q), K = {
|
|
665
643
|
baseUnit: "m3/h",
|
|
666
644
|
units: {
|
|
667
645
|
"m3/h": {
|
|
@@ -701,13 +679,13 @@ const n = (t) => (e) => new m(e, t), i = {
|
|
|
701
679
|
convertValue: 378541e-8 * 3600
|
|
702
680
|
}
|
|
703
681
|
}
|
|
704
|
-
}, ee = n(
|
|
682
|
+
}, ee = n(K);
|
|
705
683
|
export {
|
|
706
684
|
A as acceleration,
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
685
|
+
N as area,
|
|
686
|
+
G as density,
|
|
687
|
+
I as electricCharge,
|
|
688
|
+
T as electricCurrent,
|
|
711
689
|
W as energy,
|
|
712
690
|
B as force,
|
|
713
691
|
J as length,
|
|
@@ -718,8 +696,8 @@ export {
|
|
|
718
696
|
z as pressureManometric,
|
|
719
697
|
x as speed,
|
|
720
698
|
L as standardVolumetricFlow,
|
|
721
|
-
Q as surfaceTension,
|
|
722
699
|
Y as time,
|
|
700
|
+
Q as torque,
|
|
723
701
|
R as viscosity,
|
|
724
702
|
X as voltage,
|
|
725
703
|
Z as volume,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["engineering-unit-converter"]={}))})(this,function(e){"use strict";var
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["engineering-unit-converter"]={}))})(this,function(e){"use strict";var O=Object.defineProperty;var H=(e,t,o)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var c=(e,t,o)=>(H(e,typeof t!="symbol"?t+"":t,o),o);class t{constructor(n,r){c(this,"_definitions");c(this,"_val");c(this,"_fromUnit",null);this._definitions=r,this._val=n}from(n){return this._checkUnit(n),this._fromUnit=n,this}to(n){if(!this._fromUnit)throw new Error('Please specify the "from" unit using the from() method before calling to().');this._checkUnit(n);const r=this._getUnit(n),J=this._getUnit(this._fromUnit);return this._val*J/r}_getUnit(n){return this._definitions.units[n].convertValue}_checkUnit(n){const r=Object.keys(this._definitions.units);if(!r.includes(n))throw new Error(`Invalid unit "${n}". Available units: ${r.join(", ")}`)}}class o{constructor(n,r){c(this,"_internalConverter");this._internalConverter=new t(n,r)}from(n){return this._internalConverter.from(n),new u(this._internalConverter)}}class u{constructor(n){this._internalConverter=n}to(n){return this._internalConverter.to(n)}}const a=l=>n=>new o(n,l),m={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}}},i=a(m),s={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}}},v=a(s),V={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:.001},"kg/ft3":{name:"Kilogram per cubic foot",convertValue:1/.0283168},"lb/m3":{name:"Pound per cubic meter",convertValue:1/2.20462}}},d=a(V),h=a({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}}}),p=a({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}}},g=a(b),C={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}}},f=a(C),M=a({baseUnit:"m",units:{m:{name:"Meter",convertValue:1},mm:{name:"Millimeter",convertValue:.001},cm:{name:"Centimeter",convertValue:.01},in:{name:"Inch",convertValue:.0254},ft:{name:"Foot",convertValue:.3048}}}),y={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:1/(34762.5/365)},"oz/min":{name:"Ounce per minute",convertValue:1/2116.4394433764},"ton/year":{name:"Ton per year",convertValue:1/34762.5},"lb/s":{name:"Pound per second",convertValue:1/(190479/86400)},"kg/day":{name:"Kilogram per day",convertValue:1/86400}}},S=a(y),U=a({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}}}),P={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}}},k=a(P),w=a({baseUnit:"Pa",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}}}),q=a({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}}}),_={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}}},$=a(_),K={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}}},F=a(K),D=a({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:1.35582},"mN/m":{name:"Millinewton per Meter",convertValue:.001}}}),A=a({baseUnit:"s",units:{s:{name:"Second",convertValue:1},min:{name:"Minute",convertValue:60},hr:{name:"Hour",convertValue:3600},day:{name:"Day",convertValue:86400}}}),T={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}}},N=a(T),G=a({baseUnit:"V",units:{V:{name:"Volt",convertValue:1},mV:{name:"Millivolt",convertValue:.001},kV:{name:"Kilovolt",convertValue:1e3}}}),I={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}}},W=a(I),B={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=a(B);e.acceleration=i,e.area=v,e.density=d,e.electricCharge=h,e.electricCurrent=p,e.energy=g,e.force=f,e.length=M,e.mass=U,e.massFlow=S,e.power=k,e.pressure=q,e.pressureManometric=w,e.speed=$,e.standardVolumetricFlow=F,e.time=A,e.torque=D,e.viscosity=N,e.voltage=G,e.volume=W,e.volumetricFlow=j,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { default as pressureManometric } from './units/pressure-manometric';
|
|
|
13
13
|
export { default as pressure } from './units/pressure';
|
|
14
14
|
export { default as speed } from './units/speed';
|
|
15
15
|
export { default as standardVolumetricFlow } from './units/standard-volumetric-flow';
|
|
16
|
-
export { default as
|
|
16
|
+
export { default as torque } from './units/torque';
|
|
17
17
|
export { default as time } from './units/time';
|
|
18
18
|
export { default as viscosity } from './units/viscosity';
|
|
19
19
|
export { default as voltage } from './units/voltage';
|
package/dist/types.d.ts
CHANGED
|
@@ -55,11 +55,11 @@ export type Density = {
|
|
|
55
55
|
};
|
|
56
56
|
export type ViscosityUnits = {
|
|
57
57
|
cP: UnitsValues;
|
|
58
|
-
'
|
|
59
|
-
'lb/
|
|
60
|
-
'kg/
|
|
61
|
-
'lb/
|
|
62
|
-
'kg/
|
|
58
|
+
'Pas': UnitsValues;
|
|
59
|
+
'lb/fts': UnitsValues;
|
|
60
|
+
'kg/mh': UnitsValues;
|
|
61
|
+
'lb/fth': UnitsValues;
|
|
62
|
+
'kg/ms': UnitsValues;
|
|
63
63
|
};
|
|
64
64
|
export type Viscosity = {
|
|
65
65
|
baseUnit: 'cP';
|
|
@@ -140,15 +140,15 @@ export type Area = {
|
|
|
140
140
|
units: AreaUnits;
|
|
141
141
|
};
|
|
142
142
|
export type VolumeUnits = {
|
|
143
|
-
'
|
|
143
|
+
'm3': UnitsValues;
|
|
144
144
|
'liter': UnitsValues;
|
|
145
|
-
'
|
|
146
|
-
'
|
|
145
|
+
'cm3': UnitsValues;
|
|
146
|
+
'mm3': UnitsValues;
|
|
147
147
|
'gallon': UnitsValues;
|
|
148
148
|
'quart': UnitsValues;
|
|
149
149
|
};
|
|
150
150
|
export type Volume = {
|
|
151
|
-
baseUnit: '
|
|
151
|
+
baseUnit: 'm3';
|
|
152
152
|
units: VolumeUnits;
|
|
153
153
|
};
|
|
154
154
|
export type ForceUnits = {
|
|
@@ -161,15 +161,15 @@ export type Force = {
|
|
|
161
161
|
baseUnit: 'N';
|
|
162
162
|
units: ForceUnits;
|
|
163
163
|
};
|
|
164
|
-
export type
|
|
164
|
+
export type TorqueUnits = {
|
|
165
165
|
'N/m': UnitsValues;
|
|
166
166
|
'dyn/cm': UnitsValues;
|
|
167
167
|
'lbf/ft': UnitsValues;
|
|
168
168
|
'mN/m': UnitsValues;
|
|
169
169
|
};
|
|
170
|
-
export type
|
|
170
|
+
export type Torque = {
|
|
171
171
|
baseUnit: 'N/m';
|
|
172
|
-
units:
|
|
172
|
+
units: TorqueUnits;
|
|
173
173
|
};
|
|
174
174
|
export type TimeUnits = {
|
|
175
175
|
's': UnitsValues;
|
|
@@ -204,14 +204,13 @@ export type ElectricCurrent = {
|
|
|
204
204
|
units: ElectricCurrentUnits;
|
|
205
205
|
};
|
|
206
206
|
export type AccelerationUnits = {
|
|
207
|
-
'm/
|
|
208
|
-
'km/
|
|
209
|
-
'cm/
|
|
210
|
-
'
|
|
211
|
-
'ft/s²': UnitsValues;
|
|
207
|
+
'm/s2': UnitsValues;
|
|
208
|
+
'km/s2': UnitsValues;
|
|
209
|
+
'cm/s2': UnitsValues;
|
|
210
|
+
'ft/s2': UnitsValues;
|
|
212
211
|
};
|
|
213
212
|
export type Acceleration = {
|
|
214
|
-
baseUnit: 'm/
|
|
213
|
+
baseUnit: 'm/s2';
|
|
215
214
|
units: AccelerationUnits;
|
|
216
215
|
};
|
|
217
216
|
export type PressureUnits = {
|
|
@@ -252,7 +251,7 @@ export type StandardVolumetricFlow = {
|
|
|
252
251
|
baseUnit: 'SCMD';
|
|
253
252
|
units: StandardVolumetricFlowUnits;
|
|
254
253
|
};
|
|
255
|
-
export type Measurement = Voltage | MassFlow | VolumetricFlow | Density | Viscosity | Length | Mass | Speed | Power | Energy | Area | Volume | Force |
|
|
254
|
+
export type Measurement = Voltage | MassFlow | VolumetricFlow | Density | Viscosity | Length | Mass | Speed | Power | Energy | Area | Volume | Force | Torque | Time | ElectricCharge | ElectricCurrent | Acceleration | Pressure | PressureManometric | StandardVolumetricFlow;
|
|
256
255
|
export type MeasurementUnits<T extends Measurement> = T extends {
|
|
257
256
|
units: infer U;
|
|
258
257
|
} ? keyof U : never;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Torque } from '../types';
|
|
2
|
+
declare const _default: (val: number) => {
|
|
3
|
+
readonly _internalConverter: import("../internalConverter").default<Torque>;
|
|
4
|
+
from<U extends keyof import("../types").TorqueUnits>(fromUnit: U): {
|
|
5
|
+
readonly _internalConverter: import("../internalConverter").default<Torque>;
|
|
6
|
+
to<U_1 extends keyof import("../types").TorqueUnits>(toUnit: U_1): number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "engineering-unit-converter",
|
|
3
|
-
"repository": {
|
|
4
|
-
"type": "git",
|
|
5
|
-
"url": "git+https://github.com/alanhaertel/engineering-unit-converter.git"
|
|
6
|
-
},
|
|
7
|
-
"version": "0.0.
|
|
8
|
-
"keywords": [
|
|
9
|
-
"units",
|
|
10
|
-
"engineering",
|
|
11
|
-
"unit manipulation",
|
|
12
|
-
"convert",
|
|
13
|
-
"metric",
|
|
14
|
-
"unit converter"
|
|
15
|
-
],
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"type": "module",
|
|
18
|
-
"files": [
|
|
19
|
-
"dist"
|
|
20
|
-
],
|
|
21
|
-
"main": "./dist/engineering-unit-converter.umd.cjs",
|
|
22
|
-
"module": "./dist/engineering-unit-converter.js",
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint
|
|
39
|
-
"eslint-
|
|
40
|
-
"eslint-plugin-
|
|
41
|
-
"eslint-plugin-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "engineering-unit-converter",
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "git+https://github.com/alanhaertel/engineering-unit-converter.git"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.0.8",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"units",
|
|
10
|
+
"engineering",
|
|
11
|
+
"unit manipulation",
|
|
12
|
+
"convert",
|
|
13
|
+
"metric",
|
|
14
|
+
"unit converter"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/engineering-unit-converter.umd.cjs",
|
|
22
|
+
"module": "./dist/engineering-unit-converter.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/engineering-unit-converter.js",
|
|
27
|
+
"require": "./dist/engineering-unit-converter.umd.cjs",
|
|
28
|
+
"types": "./dist/index.d.ts"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"build": "tsc && vite build",
|
|
34
|
+
"preview": "vite preview"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
38
|
+
"eslint": "^8.55.0",
|
|
39
|
+
"eslint-config-standard-with-typescript": "^40.0.0",
|
|
40
|
+
"eslint-plugin-import": "^2.29.0",
|
|
41
|
+
"eslint-plugin-n": "^16.3.1",
|
|
42
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
43
|
+
"typescript": "^5.3.2",
|
|
44
|
+
"vite": "^5.0.0",
|
|
45
|
+
"@changesets/cli": "^2.27.1",
|
|
46
|
+
"vite-plugin-dts": "^3.6.4"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
50
51
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type SurfaceTension } from '../types';
|
|
2
|
-
declare const _default: (val: number) => {
|
|
3
|
-
readonly _internalConverter: import("../internalConverter").default<SurfaceTension>;
|
|
4
|
-
from<U extends keyof import("../types").SurfaceTensionUnits>(fromUnit: U): {
|
|
5
|
-
readonly _internalConverter: import("../internalConverter").default<SurfaceTension>;
|
|
6
|
-
to<U_1 extends keyof import("../types").SurfaceTensionUnits>(toUnit: U_1): number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|