New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

convert

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

dist/assert.d.ts

4339

dist/index.d.ts

@@ -1,4333 +0,6 @@

declare const enum BestIndex {
Value = 0,
Symbol = 1
}
declare type Conversion = [family: number, ratio: number, difference: number];
declare const enum ConversionIndex {
Family = 0,
Ratio = 1,
Difference = 2
}
declare const conversions = {__proto__:null,
"radian": [
0,
1,
0
],
"radians": [
0,
1,
0
],
"rad": [
0,
1,
0
],
"rads": [
0,
1,
0
],
"r": [
0,
1,
0
],
"turn": [
0,
6.283185307179586,
0
],
"turns": [
0,
6.283185307179586,
0
],
"degree": [
0,
0.017453292519943295,
0
],
"degrees": [
0,
0.017453292519943295,
0
],
"deg": [
0,
0.017453292519943295,
0
],
"degs": [
0,
0.017453292519943295,
0
],
"°": [
0,
0.017453292519943295,
0
],
"gradian": [
0,
0.015707963267948967,
0
],
"gradians": [
0,
0.015707963267948967,
0
],
"gon": [
0,
0.015707963267948967,
0
],
"gons": [
0,
0.015707963267948967,
0
],
"grad": [
0,
0.015707963267948967,
0
],
"grads": [
0,
0.015707963267948967,
0
],
"grade": [
0,
0.015707963267948967,
0
],
"grades": [
0,
0.015707963267948967,
0
],
"bit": [
1,
1,
0
],
"bits": [
1,
1,
0
],
"unibit": [
1,
1,
0
],
"unibits": [
1,
1,
0
],
"b": [
1,
1,
0
],
"crumb": [
1,
2,
0
],
"crumbs": [
1,
2,
0
],
"dibit": [
1,
2,
0
],
"dibits": [
1,
2,
0
],
"triad": [
1,
3,
0
],
"triads": [
1,
3,
0
],
"triade": [
1,
3,
0
],
"triades": [
1,
3,
0
],
"tribit": [
1,
3,
0
],
"tribits": [
1,
3,
0
],
"nibble": [
1,
4,
0
],
"nibbles": [
1,
4,
0
],
"tetrad": [
1,
4,
0
],
"tetrads": [
1,
4,
0
],
"tetrade": [
1,
4,
0
],
"tetrades": [
1,
4,
0
],
"quadbit": [
1,
4,
0
],
"quadbits": [
1,
4,
0
],
"semioctet": [
1,
4,
0
],
"semioctets": [
1,
4,
0
],
"halfbyte": [
1,
4,
0
],
"halfbytes": [
1,
4,
0
],
"quartet": [
1,
4,
0
],
"quartets": [
1,
4,
0
],
"pentad": [
1,
5,
0
],
"pentads": [
1,
5,
0
],
"hexad": [
1,
6,
0
],
"hexads": [
1,
6,
0
],
"hexade": [
1,
6,
0
],
"hexades": [
1,
6,
0
],
"sextet": [
1,
6,
0
],
"sextets": [
1,
6,
0
],
"heptad": [
1,
7,
0
],
"heptads": [
1,
7,
0
],
"heptade": [
1,
7,
0
],
"heptades": [
1,
7,
0
],
"byte": [
1,
8,
0
],
"bytes": [
1,
8,
0
],
"octect": [
1,
8,
0
],
"octects": [
1,
8,
0
],
"octad": [
1,
8,
0
],
"octads": [
1,
8,
0
],
"octade": [
1,
8,
0
],
"octades": [
1,
8,
0
],
"B": [
1,
8,
0
],
"slab": [
1,
12,
0
],
"slabs": [
1,
12,
0
],
"hextet": [
1,
16,
0
],
"hextets": [
1,
16,
0
],
"catena": [
1,
24,
0
],
"catenas": [
1,
24,
0
],
"newton": [
2,
1,
0
],
"newtons": [
2,
1,
0
],
"N": [
2,
1,
0
],
"dyne": [
2,
0.00001,
0
],
"dynes": [
2,
0.00001,
0
],
"dyn": [
2,
0.00001,
0
],
"kilogram-force": [
2,
9.80665,
0
],
"kgf": [
2,
9.80665,
0
],
"kilopond": [
2,
9.80665,
0
],
"kiloponds": [
2,
9.80665,
0
],
"kp": [
2,
9.80665,
0
],
"pound of force": [
2,
4.448222,
0
],
"pound-force": [
2,
4.448222,
0
],
"lbf": [
2,
4.448222,
0
],
"poundal": [
2,
0.138255,
0
],
"poundals": [
2,
0.138255,
0
],
"pdl": [
2,
0.138255,
0
],
"meter": [
3,
1,
0
],
"meters": [
3,
1,
0
],
"metre": [
3,
1,
0
],
"metres": [
3,
1,
0
],
"m": [
3,
1,
0
],
"foot": [
3,
0.3048,
0
],
"feet": [
3,
0.3048,
0
],
"ft": [
3,
0.3048,
0
],
"inch": [
3,
0.0254,
0
],
"inches": [
3,
0.0254,
0
],
"in": [
3,
0.0254,
0
],
"yard": [
3,
0.9144,
0
],
"yards": [
3,
0.9144,
0
],
"yd": [
3,
0.9144,
0
],
"mile": [
3,
1609.344,
0
],
"miles": [
3,
1609.344,
0
],
"mi": [
3,
1609.344,
0
],
"nautical mile": [
3,
1852,
0
],
"nautical miles": [
3,
1852,
0
],
"M": [
3,
1852,
0
],
"NM": [
3,
1852,
0
],
"nmi": [
3,
1852,
0
],
"gram": [
4,
1,
0
],
"grams": [
4,
1,
0
],
"g": [
4,
1,
0
],
"tonne": [
4,
1000000,
0
],
"tonnes": [
4,
1000000,
0
],
"metric ton": [
4,
1000000,
0
],
"metric tons": [
4,
1000000,
0
],
"t": [
4,
1000000,
0
],
"pound": [
4,
453.59237,
0
],
"pounds": [
4,
453.59237,
0
],
"lb": [
4,
453.59237,
0
],
"stone": [
4,
6350.293180000001,
0
],
"stones": [
4,
6350.293180000001,
0
],
"st": [
4,
6350.293180000001,
0
],
"ounce": [
4,
28.349523125,
0
],
"ounces": [
4,
28.349523125,
0
],
"oz": [
4,
28.349523125,
0
],
"℥": [
4,
28.349523125,
0
],
"short ton": [
4,
907184.74,
0
],
"short tons": [
4,
907184.74,
0
],
"us ton": [
4,
907184.74,
0
],
"us tons": [
4,
907184.74,
0
],
"long ton": [
4,
1016046.9088000001,
0
],
"long tons": [
4,
1016046.9088000001,
0
],
"imperial ton": [
4,
1016046.9088000001,
0
],
"imperial tons": [
4,
1016046.9088000001,
0
],
"displacement ton": [
4,
1016046.9088000001,
0
],
"displacement tons": [
4,
1016046.9088000001,
0
],
"pascal": [
5,
1,
0
],
"pascals": [
5,
1,
0
],
"Pa": [
5,
1,
0
],
"bar": [
5,
100000,
0
],
"bars": [
5,
100000,
0
],
"torr": [
5,
133.32236842105263,
0
],
"torrs": [
5,
133.32236842105263,
0
],
"Torr": [
5,
133.32236842105263,
0
],
"millitorr": [
5,
0.13332236842105263,
0
],
"mTorr": [
5,
0.13332236842105263,
0
],
"atmopshere": [
5,
101325,
0
],
"atmospheres": [
5,
101325,
0
],
"atm": [
5,
101325,
0
],
"kelvin": [
6,
1,
0
],
"kelvins": [
6,
1,
0
],
"K": [
6,
1,
0
],
"fahrenheit": [
6,
0.5555555555555556,
241.14999999999998
],
"F": [
6,
0.5555555555555556,
241.14999999999998
],
"celsius": [
6,
1,
273.15
],
"C": [
6,
1,
273.15
],
"rankine": [
6,
0.5555555555555556,
0
],
"R": [
6,
0.5555555555555556,
0
],
"delisle": [
6,
-0.6666666666666666,
373.15
],
"De": [
6,
-0.6666666666666666,
373.15
],
"second": [
7,
1,
0
],
"seconds": [
7,
1,
0
],
"s": [
7,
1,
0
],
"minute": [
7,
60,
0
],
"minutes": [
7,
60,
0
],
"min": [
7,
60,
0
],
"hour": [
7,
3600,
0
],
"hours": [
7,
3600,
0
],
"h": [
7,
3600,
0
],
"milliday": [
7,
86.4,
0
],
"millidays": [
7,
86.4,
0
],
"md": [
7,
86.4,
0
],
"day": [
7,
86400,
0
],
"days": [
7,
86400,
0
],
"d": [
7,
86400,
0
],
"week": [
7,
604800,
0
],
"weeks": [
7,
604800,
0
],
"wk": [
7,
604800,
0
],
"fortnight": [
7,
1209600,
0
],
"fortnights": [
7,
1209600,
0
],
"fn": [
7,
1209600,
0
],
"month": [
7,
2592000,
0
],
"months": [
7,
2592000,
0
],
"mo": [
7,
2592000,
0
],
"year": [
7,
31536000,
0
],
"years": [
7,
31536000,
0
],
"a": [
7,
31536000,
0
],
"y": [
7,
31536000,
0
],
"yr": [
7,
31536000,
0
],
"decade": [
7,
315569520,
0
],
"decades": [
7,
315569520,
0
],
"dec": [
7,
315569520,
0
],
"century": [
7,
3155695200,
0
],
"centuries": [
7,
3155695200,
0
],
"c": [
8,
0.00023658823649999998,
0
],
"millennium": [
7,
31556952000,
0
],
"millennia": [
7,
31556952000,
0
],
"helek": [
7,
3.3333333333333335,
0
],
"halakim": [
7,
3.3333333333333335,
0
],
"jiffy": [
7,
0.016666666666666666,
0
],
"jiffies": [
7,
0.016666666666666666,
0
],
"j": [
7,
0.016666666666666666,
0
],
"ja": [
7,
0.01,
0
],
"ke": [
7,
900,
0
],
"moment": [
7,
90,
0
],
"moments": [
7,
90,
0
],
"shake": [
7,
1e-8,
0
],
"shakes": [
7,
1e-8,
0
],
"time unit": [
7,
0.001024,
0
],
"TU": [
7,
0.001024,
0
],
"svedberg": [
7,
1e-13,
0
],
"svedbergs": [
7,
1e-13,
0
],
"S": [
7,
1e-13,
0
],
"cubic meter": [
8,
1,
0
],
"cubic meters": [
8,
1,
0
],
"cubic metre": [
8,
1,
0
],
"cubic metres": [
8,
1,
0
],
"stere": [
8,
1,
0
],
"steres": [
8,
1,
0
],
"m³": [
8,
1,
0
],
"m3": [
8,
1,
0
],
"liter": [
8,
0.001,
0
],
"liters": [
8,
0.001,
0
],
"litre": [
8,
0.001,
0
],
"litres": [
8,
0.001,
0
],
"l": [
8,
0.001,
0
],
"L": [
8,
0.001,
0
],
"cubic mile": [
8,
4200,
0
],
"cubic miles": [
8,
4200,
0
],
"cu mi": [
8,
4200,
0
],
"mi3": [
8,
4200,
0
],
"mi³": [
8,
4200,
0
],
"acre-foot": [
8,
1233.48183754752,
0
],
"acre-feet": [
8,
1233.48183754752,
0
],
"ac⋅ft": [
8,
1233.48183754752,
0
],
"ac ft": [
8,
1233.48183754752,
0
],
"cubic yard": [
8,
0.76,
0
],
"cubic yards": [
8,
0.76,
0
],
"cu yd": [
8,
0.76,
0
],
"yd3": [
8,
0.76,
0
],
"yd³": [
8,
0.76,
0
],
"cubic foot": [
8,
0.028,
0
],
"cubic feet": [
8,
0.028,
0
],
"cu ft": [
8,
0.028,
0
],
"ft3": [
8,
0.028,
0
],
"ft³": [
8,
0.028,
0
],
"board foot": [
8,
0.002359737,
0
],
"board feet": [
8,
0.002359737,
0
],
"cubic inch": [
8,
0.000016387064,
0
],
"cubic inches": [
8,
0.000016387064,
0
],
"cu in": [
8,
0.000016387064,
0
],
"in3": [
8,
0.000016387064,
0
],
"in³": [
8,
0.000016387064,
0
],
"measurement ton": [
8,
1.133,
0
],
"measurement tons": [
8,
1.133,
0
],
"MTON": [
8,
1.133,
0
],
"imperial barrel": [
8,
0.16,
0
],
"imperial barrels": [
8,
0.16,
0
],
"imp bbl": [
8,
0.16,
0
],
"kilderkin": [
8,
0.08318,
0
],
"kilderkins": [
8,
0.08318,
0
],
"firkin": [
8,
0.041,
0
],
"firkins": [
8,
0.041,
0
],
"imperial bushel": [
8,
0.03636872,
0
],
"imperial bushels": [
8,
0.03636872,
0
],
"imp bsh": [
8,
0.03636872,
0
],
"imp bu": [
8,
0.03636872,
0
],
"imperial peck": [
8,
0.00909218,
0
],
"imperial pecks": [
8,
0.00909218,
0
],
"pk": [
8,
0.00909218,
0
],
"imp pk": [
8,
0.00909218,
0
],
"imperial quart": [
8,
0.0011365225,
0
],
"imperial quarts": [
8,
0.0011365225,
0
],
"imp qt": [
8,
0.0011365225,
0
],
"imperial gallon": [
8,
0.00454609,
0
],
"imperial gallons": [
8,
0.00454609,
0
],
"imp gal": [
8,
0.00454609,
0
],
"imperial pint": [
8,
0.00056826125,
0
],
"imperial pints": [
8,
0.00056826125,
0
],
"imp pt": [
8,
0.00056826125,
0
],
"gill": [
8,
0.0001420653125,
0
],
"gills": [
8,
0.0001420653125,
0
],
"gi": [
8,
0.0001420653125,
0
],
"imp gi": [
8,
0.0001420653125,
0
],
"imperial fluid ounce": [
8,
0.0000284130625,
0
],
"imperial fluid ounces": [
8,
0.0000284130625,
0
],
"imp fl oz": [
8,
0.0000284130625,
0
],
"US barrel": [
8,
0.164,
0
],
"US barrels": [
8,
0.164,
0
],
"US bbl": [
8,
0.164,
0
],
"barrel": [
8,
0.15898756717224713,
0
],
"barrels": [
8,
0.15898756717224713,
0
],
"bbl": [
8,
0.15898756717224713,
0
],
"oilbbl": [
8,
0.15898756717224713,
0
],
"teaspoon": [
8,
0.0000049289215937500005,
0
],
"teaspoons": [
8,
0.0000049289215937500005,
0
],
"tsp": [
8,
0.0000049289215937500005,
0
],
"tablespoon": [
8,
0.000014786764781249999,
0
],
"tablespoons": [
8,
0.000014786764781249999,
0
],
"tbsp": [
8,
0.000014786764781249999,
0
],
"US fluid ounce": [
8,
0.0000295735295625,
0
],
"US fluid ounces": [
8,
0.0000295735295625,
0
],
"US fl oz": [
8,
0.0000295735295625,
0
],
"US fl. oz.": [
8,
0.0000295735295625,
0
],
"US oz. fl.": [
8,
0.0000295735295625,
0
],
"US gill": [
8,
0.00011829411824999999,
0
],
"US gills": [
8,
0.00011829411824999999,
0
],
"US gi": [
8,
0.00011829411824999999,
0
],
"US cup": [
8,
0.00023658823649999998,
0
],
"US cups": [
8,
0.00023658823649999998,
0
],
"US pint": [
8,
0.000473176473,
0
],
"US pints": [
8,
0.000473176473,
0
],
"US pt": [
8,
0.000473176473,
0
],
"US quart": [
8,
0.000946352946,
0
],
"US quarts": [
8,
0.000946352946,
0
],
"US qt": [
8,
0.000946352946,
0
],
"US gallon": [
8,
0.0037854111013237205,
0
],
"US gallons": [
8,
0.0037854111013237205,
0
],
"US gal": [
8,
0.0037854111013237205,
0
],
"US beer barrel": [
8,
0.117,
0
],
"US beer barrels": [
8,
0.117,
0
],
"US beer bbl": [
8,
0.117,
0
],
"US dry barrel": [
8,
0.12,
0
],
"US dry barrels": [
8,
0.12,
0
],
"US dry bbl": [
8,
0.12,
0
],
"US bushel": [
8,
0.0352391,
0
],
"US bushels": [
8,
0.0352391,
0
],
"US bsh": [
8,
0.0352391,
0
],
"US bu": [
8,
0.0352391,
0
],
"US peck": [
8,
0.00909218,
0
],
"US pk": [
8,
0.00909218,
0
],
"US dry gallon": [
8,
0.00440488377086,
0
],
"US dry gal": [
8,
0.00440488377086,
0
],
"US dry quart": [
8,
0.000946352946,
0
],
"US dry qt": [
8,
0.000946352946,
0
],
"US dry pint": [
8,
33.6003125,
0
],
"US dry pt": [
8,
33.6003125,
0
]
} as const;
declare const bestUnits = [
[
[
1,
"deg"
]
],
[
[
1,
"bits"
],
[
8,
"B"
],
[
8192,
"KiB"
],
[
8388608,
"MiB"
],
[
8589934592,
"GiB"
],
[
8796093022208,
"TiB"
],
[
9007199254740992,
"PiB"
]
],
[
[
1,
"N"
]
],
[
[
1,
"mm"
],
[
10,
"cm"
],
[
1000,
"m"
],
[
1000000,
"km"
]
],
[
[
1,
"mg"
],
[
1000,
"g"
],
[
1000000,
"kg"
]
],
[
[
1,
"Pa"
]
],
[
[
1,
"C"
]
],
[
[
1,
"ns"
],
[
1000,
"μs"
],
[
1000000,
"ms"
],
[
1000000000,
"s"
],
[
60000000000,
"min"
],
[
3600000000000,
"h"
],
[
86400000000000,
"d"
],
[
31536000000000000,
"y"
]
],
[
[
1,
"mL"
],
[
1000,
"L"
]
]
] as const;
declare const prefixed = {
"pebibit": [
1,
1125899906842624,
0
],
"pebibits": [
1,
1125899906842624,
0
],
"Pib": [
1,
1125899906842624,
0
],
"tebibit": [
1,
1099511627776,
0
],
"tebibits": [
1,
1099511627776,
0
],
"Tib": [
1,
1099511627776,
0
],
"gibibit": [
1,
1073741824,
0
],
"gibibits": [
1,
1073741824,
0
],
"Gib": [
1,
1073741824,
0
],
"mebibit": [
1,
1048576,
0
],
"mebibits": [
1,
1048576,
0
],
"Mib": [
1,
1048576,
0
],
"kibibit": [
1,
1024,
0
],
"kibibits": [
1,
1024,
0
],
"Kib": [
1,
1024,
0
],
"petabit": [
1,
1000000000000000,
0
],
"petabits": [
1,
1000000000000000,
0
],
"Pb": [
1,
1000000000000000,
0
],
"terabit": [
1,
1000000000000,
0
],
"terabits": [
1,
1000000000000,
0
],
"Tb": [
1,
1000000000000,
0
],
"gigabit": [
1,
1000000000,
0
],
"gigabits": [
1,
1000000000,
0
],
"Gb": [
1,
1000000000,
0
],
"megabit": [
1,
1000000,
0
],
"megabits": [
1,
1000000,
0
],
"Mb": [
1,
1000000,
0
],
"kilobit": [
1,
1000,
0
],
"kilobits": [
1,
1000,
0
],
"kb": [
1,
1000,
0
],
"hectobit": [
1,
100,
0
],
"hectobits": [
1,
100,
0
],
"hb": [
1,
100,
0
],
"decabit": [
1,
10,
0
],
"decabits": [
1,
10,
0
],
"dab": [
1,
10,
0
],
"pebibyte": [
1,
9007199254740992,
0
],
"pebibytes": [
1,
9007199254740992,
0
],
"PiB": [
1,
9007199254740992,
0
],
"tebibyte": [
1,
8796093022208,
0
],
"tebibytes": [
1,
8796093022208,
0
],
"TiB": [
1,
8796093022208,
0
],
"gibibyte": [
1,
8589934592,
0
],
"gibibytes": [
1,
8589934592,
0
],
"GiB": [
1,
8589934592,
0
],
"mebibyte": [
1,
8388608,
0
],
"mebibytes": [
1,
8388608,
0
],
"MiB": [
1,
8388608,
0
],
"kibibyte": [
1,
8192,
0
],
"kibibytes": [
1,
8192,
0
],
"KiB": [
1,
8192,
0
],
"petabyte": [
1,
8000000000000000,
0
],
"petabytes": [
1,
8000000000000000,
0
],
"PB": [
1,
8000000000000000,
0
],
"terabyte": [
1,
8000000000000,
0
],
"terabytes": [
1,
8000000000000,
0
],
"TB": [
1,
8000000000000,
0
],
"gigabyte": [
1,
8000000000,
0
],
"gigabytes": [
1,
8000000000,
0
],
"GB": [
1,
8000000000,
0
],
"megabyte": [
1,
8000000,
0
],
"megabytes": [
1,
8000000,
0
],
"MB": [
1,
8000000,
0
],
"kilobyte": [
1,
8000,
0
],
"kilobytes": [
1,
8000,
0
],
"kB": [
1,
8000,
0
],
"hectobyte": [
1,
800,
0
],
"hectobytes": [
1,
800,
0
],
"hB": [
1,
800,
0
],
"decabyte": [
1,
80,
0
],
"decabytes": [
1,
80,
0
],
"daB": [
1,
80,
0
],
"petameter": [
3,
1000000000000000,
0
],
"petametre": [
3,
1000000000000000,
0
],
"petameters": [
3,
1000000000000000,
0
],
"petametres": [
3,
1000000000000000,
0
],
"Pm": [
3,
1000000000000000,
0
],
"terameter": [
3,
1000000000000,
0
],
"terametre": [
3,
1000000000000,
0
],
"terameters": [
3,
1000000000000,
0
],
"terametres": [
3,
1000000000000,
0
],
"Tm": [
3,
1000000000000,
0
],
"gigameter": [
3,
1000000000,
0
],
"gigametre": [
3,
1000000000,
0
],
"gigameters": [
3,
1000000000,
0
],
"gigametres": [
3,
1000000000,
0
],
"Gm": [
3,
1000000000,
0
],
"megameter": [
3,
1000000,
0
],
"megametre": [
3,
1000000,
0
],
"megameters": [
3,
1000000,
0
],
"megametres": [
3,
1000000,
0
],
"Mm": [
3,
1000000,
0
],
"kilometer": [
3,
1000,
0
],
"kilometre": [
3,
1000,
0
],
"kilometers": [
3,
1000,
0
],
"kilometres": [
3,
1000,
0
],
"km": [
3,
1000,
0
],
"hectometer": [
3,
100,
0
],
"hectometre": [
3,
100,
0
],
"hectometers": [
3,
100,
0
],
"hectometres": [
3,
100,
0
],
"hm": [
3,
100,
0
],
"decameter": [
3,
10,
0
],
"decametre": [
3,
10,
0
],
"decameters": [
3,
10,
0
],
"decametres": [
3,
10,
0
],
"dam": [
3,
10,
0
],
"decimeter": [
3,
0.1,
0
],
"decimetre": [
3,
0.1,
0
],
"decimeters": [
3,
0.1,
0
],
"decimetres": [
3,
0.1,
0
],
"dm": [
3,
0.1,
0
],
"centimeter": [
3,
0.01,
0
],
"centimetre": [
3,
0.01,
0
],
"centimeters": [
3,
0.01,
0
],
"centimetres": [
3,
0.01,
0
],
"cm": [
3,
0.01,
0
],
"millimeter": [
3,
0.001,
0
],
"millimetre": [
3,
0.001,
0
],
"millimeters": [
3,
0.001,
0
],
"millimetres": [
3,
0.001,
0
],
"mm": [
3,
0.001,
0
],
"micrometer": [
3,
0.000001,
0
],
"micrometre": [
3,
0.000001,
0
],
"micrometers": [
3,
0.000001,
0
],
"micrometres": [
3,
0.000001,
0
],
"μm": [
3,
0.000001,
0
],
"nanometer": [
3,
1e-9,
0
],
"nanometre": [
3,
1e-9,
0
],
"nanometers": [
3,
1e-9,
0
],
"nanometres": [
3,
1e-9,
0
],
"nm": [
3,
1e-9,
0
],
"picometer": [
3,
1e-12,
0
],
"picometre": [
3,
1e-12,
0
],
"picometers": [
3,
1e-12,
0
],
"picometres": [
3,
1e-12,
0
],
"pm": [
3,
1e-12,
0
],
"femtometer": [
3,
1e-15,
0
],
"femtometre": [
3,
1e-15,
0
],
"femtometers": [
3,
1e-15,
0
],
"femtometres": [
3,
1e-15,
0
],
"fm": [
3,
1e-15,
0
],
"petagram": [
4,
1000000000000000,
0
],
"petagrams": [
4,
1000000000000000,
0
],
"Pg": [
4,
1000000000000000,
0
],
"teragram": [
4,
1000000000000,
0
],
"teragrams": [
4,
1000000000000,
0
],
"Tg": [
4,
1000000000000,
0
],
"gigagram": [
4,
1000000000,
0
],
"gigagrams": [
4,
1000000000,
0
],
"Gg": [
4,
1000000000,
0
],
"megagram": [
4,
1000000,
0
],
"megagrams": [
4,
1000000,
0
],
"Mg": [
4,
1000000,
0
],
"kilogram": [
4,
1000,
0
],
"kilograms": [
4,
1000,
0
],
"kg": [
4,
1000,
0
],
"hectogram": [
4,
100,
0
],
"hectograms": [
4,
100,
0
],
"hg": [
4,
100,
0
],
"decagram": [
4,
10,
0
],
"decagrams": [
4,
10,
0
],
"dag": [
4,
10,
0
],
"decigram": [
4,
0.1,
0
],
"decigrams": [
4,
0.1,
0
],
"dg": [
4,
0.1,
0
],
"centigram": [
4,
0.01,
0
],
"centigrams": [
4,
0.01,
0
],
"cg": [
4,
0.01,
0
],
"milligram": [
4,
0.001,
0
],
"milligrams": [
4,
0.001,
0
],
"mg": [
4,
0.001,
0
],
"microgram": [
4,
0.000001,
0
],
"micrograms": [
4,
0.000001,
0
],
"μg": [
4,
0.000001,
0
],
"nanogram": [
4,
1e-9,
0
],
"nanograms": [
4,
1e-9,
0
],
"ng": [
4,
1e-9,
0
],
"picogram": [
4,
1e-12,
0
],
"picograms": [
4,
1e-12,
0
],
"pg": [
4,
1e-12,
0
],
"femtogram": [
4,
1e-15,
0
],
"femtograms": [
4,
1e-15,
0
],
"fg": [
4,
1e-15,
0
],
"petapascal": [
5,
1000000000000000,
0
],
"petapascals": [
5,
1000000000000000,
0
],
"PPa": [
5,
1000000000000000,
0
],
"terapascal": [
5,
1000000000000,
0
],
"terapascals": [
5,
1000000000000,
0
],
"TPa": [
5,
1000000000000,
0
],
"gigapascal": [
5,
1000000000,
0
],
"gigapascals": [
5,
1000000000,
0
],
"GPa": [
5,
1000000000,
0
],
"megapascal": [
5,
1000000,
0
],
"megapascals": [
5,
1000000,
0
],
"MPa": [
5,
1000000,
0
],
"kilopascal": [
5,
1000,
0
],
"kilopascals": [
5,
1000,
0
],
"kPa": [
5,
1000,
0
],
"hectopascal": [
5,
100,
0
],
"hectopascals": [
5,
100,
0
],
"hPa": [
5,
100,
0
],
"decapascal": [
5,
10,
0
],
"decapascals": [
5,
10,
0
],
"daPa": [
5,
10,
0
],
"decipascal": [
5,
0.1,
0
],
"decipascals": [
5,
0.1,
0
],
"dPa": [
5,
0.1,
0
],
"centipascal": [
5,
0.01,
0
],
"centipascals": [
5,
0.01,
0
],
"cPa": [
5,
0.01,
0
],
"millipascal": [
5,
0.001,
0
],
"millipascals": [
5,
0.001,
0
],
"mPa": [
5,
0.001,
0
],
"micropascal": [
5,
0.000001,
0
],
"micropascals": [
5,
0.000001,
0
],
"μPa": [
5,
0.000001,
0
],
"nanopascal": [
5,
1e-9,
0
],
"nanopascals": [
5,
1e-9,
0
],
"nPa": [
5,
1e-9,
0
],
"picopascal": [
5,
1e-12,
0
],
"picopascals": [
5,
1e-12,
0
],
"pPa": [
5,
1e-12,
0
],
"femtopascal": [
5,
1e-15,
0
],
"femtopascals": [
5,
1e-15,
0
],
"fPa": [
5,
1e-15,
0
],
"petabar": [
5,
100000000000000000000,
0
],
"petabars": [
5,
100000000000000000000,
0
],
"Pbar": [
5,
100000000000000000000,
0
],
"terabar": [
5,
100000000000000000,
0
],
"terabars": [
5,
100000000000000000,
0
],
"Tbar": [
5,
100000000000000000,
0
],
"gigabar": [
5,
100000000000000,
0
],
"gigabars": [
5,
100000000000000,
0
],
"Gbar": [
5,
100000000000000,
0
],
"megabar": [
5,
100000000000,
0
],
"megabars": [
5,
100000000000,
0
],
"Mbar": [
5,
100000000000,
0
],
"kilobar": [
5,
100000000,
0
],
"kilobars": [
5,
100000000,
0
],
"kbar": [
5,
100000000,
0
],
"hectobar": [
5,
10000000,
0
],
"hectobars": [
5,
10000000,
0
],
"hbar": [
5,
10000000,
0
],
"decabar": [
5,
1000000,
0
],
"decabars": [
5,
1000000,
0
],
"dabar": [
5,
1000000,
0
],
"decibar": [
5,
10000,
0
],
"decibars": [
5,
10000,
0
],
"dbar": [
5,
10000,
0
],
"centibar": [
5,
1000,
0
],
"centibars": [
5,
1000,
0
],
"cbar": [
5,
1000,
0
],
"millibar": [
5,
100,
0
],
"millibars": [
5,
100,
0
],
"mbar": [
5,
100,
0
],
"microbar": [
5,
0.09999999999999999,
0
],
"microbars": [
5,
0.09999999999999999,
0
],
"μbar": [
5,
0.09999999999999999,
0
],
"nanobar": [
5,
0.0001,
0
],
"nanobars": [
5,
0.0001,
0
],
"nbar": [
5,
0.0001,
0
],
"picobar": [
5,
1e-7,
0
],
"picobars": [
5,
1e-7,
0
],
"pbar": [
5,
1e-7,
0
],
"femtobar": [
5,
1e-10,
0
],
"femtobars": [
5,
1e-10,
0
],
"fbar": [
5,
1e-10,
0
],
"petasecond": [
7,
1000000000000000,
0
],
"petaseconds": [
7,
1000000000000000,
0
],
"Ps": [
7,
1000000000000000,
0
],
"terasecond": [
7,
1000000000000,
0
],
"teraseconds": [
7,
1000000000000,
0
],
"Ts": [
7,
1000000000000,
0
],
"gigasecond": [
7,
1000000000,
0
],
"gigaseconds": [
7,
1000000000,
0
],
"Gs": [
7,
1000000000,
0
],
"megasecond": [
7,
1000000,
0
],
"megaseconds": [
7,
1000000,
0
],
"Ms": [
7,
1000000,
0
],
"kilosecond": [
7,
1000,
0
],
"kiloseconds": [
7,
1000,
0
],
"ks": [
7,
1000,
0
],
"hectosecond": [
7,
100,
0
],
"hectoseconds": [
7,
100,
0
],
"hs": [
7,
100,
0
],
"decasecond": [
7,
10,
0
],
"decaseconds": [
7,
10,
0
],
"das": [
7,
10,
0
],
"decisecond": [
7,
0.1,
0
],
"deciseconds": [
7,
0.1,
0
],
"ds": [
7,
0.1,
0
],
"centisecond": [
7,
0.01,
0
],
"centiseconds": [
7,
0.01,
0
],
"cs": [
7,
0.01,
0
],
"millisecond": [
7,
0.001,
0
],
"milliseconds": [
7,
0.001,
0
],
"ms": [
7,
0.001,
0
],
"microsecond": [
7,
0.000001,
0
],
"microseconds": [
7,
0.000001,
0
],
"μs": [
7,
0.000001,
0
],
"nanosecond": [
7,
1e-9,
0
],
"nanoseconds": [
7,
1e-9,
0
],
"ns": [
7,
1e-9,
0
],
"picosecond": [
7,
1e-12,
0
],
"picoseconds": [
7,
1e-12,
0
],
"ps": [
7,
1e-12,
0
],
"femtosecond": [
7,
1e-15,
0
],
"femtoseconds": [
7,
1e-15,
0
],
"fs": [
7,
1e-15,
0
],
"cubic petameter": [
8,
1000000000000000,
0
],
"cubic petameters": [
8,
1000000000000000,
0
],
"Pm3": [
8,
1000000000000000,
0
],
"Pm³": [
8,
1000000000000000,
0
],
"cubic terameter": [
8,
1000000000000,
0
],
"cubic terameters": [
8,
1000000000000,
0
],
"Tm3": [
8,
1000000000000,
0
],
"Tm³": [
8,
1000000000000,
0
],
"cubic gigameter": [
8,
1000000000,
0
],
"cubic gigameters": [
8,
1000000000,
0
],
"Gm3": [
8,
1000000000,
0
],
"Gm³": [
8,
1000000000,
0
],
"cubic megameter": [
8,
1000000,
0
],
"cubic megameters": [
8,
1000000,
0
],
"Mm3": [
8,
1000000,
0
],
"Mm³": [
8,
1000000,
0
],
"cubic kilometer": [
8,
1000,
0
],
"cubic kilometers": [
8,
1000,
0
],
"km3": [
8,
1000,
0
],
"km³": [
8,
1000,
0
],
"cubic hectometer": [
8,
100,
0
],
"cubic hectometers": [
8,
100,
0
],
"hm3": [
8,
100,
0
],
"hm³": [
8,
100,
0
],
"cubic decameter": [
8,
10,
0
],
"cubic decameters": [
8,
10,
0
],
"dam3": [
8,
10,
0
],
"dam³": [
8,
10,
0
],
"cubic decimeter": [
8,
0.1,
0
],
"cubic decimeters": [
8,
0.1,
0
],
"dm3": [
8,
0.1,
0
],
"dm³": [
8,
0.1,
0
],
"cubic centimeter": [
8,
0.01,
0
],
"cubic centimeters": [
8,
0.01,
0
],
"cm3": [
8,
0.01,
0
],
"cm³": [
8,
0.01,
0
],
"cubic millimeter": [
8,
0.001,
0
],
"cubic millimeters": [
8,
0.001,
0
],
"mm3": [
8,
0.001,
0
],
"mm³": [
8,
0.001,
0
],
"cubic micrometer": [
8,
0.000001,
0
],
"cubic micrometers": [
8,
0.000001,
0
],
"μm3": [
8,
0.000001,
0
],
"μm³": [
8,
0.000001,
0
],
"cubic nanometer": [
8,
1e-9,
0
],
"cubic nanometers": [
8,
1e-9,
0
],
"nm3": [
8,
1e-9,
0
],
"nm³": [
8,
1e-9,
0
],
"cubic picometer": [
8,
1e-12,
0
],
"cubic picometers": [
8,
1e-12,
0
],
"pm3": [
8,
1e-12,
0
],
"pm³": [
8,
1e-12,
0
],
"cubic femtometer": [
8,
1e-15,
0
],
"cubic femtometers": [
8,
1e-15,
0
],
"fm3": [
8,
1e-15,
0
],
"fm³": [
8,
1e-15,
0
],
"petaliter": [
8,
1000000000000,
0
],
"petaliters": [
8,
1000000000000,
0
],
"petalitre": [
8,
1000000000000,
0
],
"petalitres": [
8,
1000000000000,
0
],
"Pl": [
8,
1000000000000,
0
],
"PL": [
8,
1000000000000,
0
],
"teraliter": [
8,
1000000000,
0
],
"teraliters": [
8,
1000000000,
0
],
"teralitre": [
8,
1000000000,
0
],
"teralitres": [
8,
1000000000,
0
],
"Tl": [
8,
1000000000,
0
],
"TL": [
8,
1000000000,
0
],
"gigaliter": [
8,
1000000,
0
],
"gigaliters": [
8,
1000000,
0
],
"gigalitre": [
8,
1000000,
0
],
"gigalitres": [
8,
1000000,
0
],
"Gl": [
8,
1000000,
0
],
"GL": [
8,
1000000,
0
],
"megaliter": [
8,
1000,
0
],
"megaliters": [
8,
1000,
0
],
"megalitre": [
8,
1000,
0
],
"megalitres": [
8,
1000,
0
],
"Ml": [
8,
1000,
0
],
"ML": [
8,
1000,
0
],
"kiloliter": [
8,
1,
0
],
"kiloliters": [
8,
1,
0
],
"kilolitre": [
8,
1,
0
],
"kilolitres": [
8,
1,
0
],
"kl": [
8,
1,
0
],
"kL": [
8,
1,
0
],
"hectoliter": [
8,
0.1,
0
],
"hectoliters": [
8,
0.1,
0
],
"hectolitre": [
8,
0.1,
0
],
"hectolitres": [
8,
0.1,
0
],
"hl": [
8,
0.1,
0
],
"hL": [
8,
0.1,
0
],
"decaliter": [
8,
0.01,
0
],
"decaliters": [
8,
0.01,
0
],
"decalitre": [
8,
0.01,
0
],
"decalitres": [
8,
0.01,
0
],
"dal": [
8,
0.01,
0
],
"daL": [
8,
0.01,
0
],
"deciliter": [
8,
0.0001,
0
],
"deciliters": [
8,
0.0001,
0
],
"decilitre": [
8,
0.0001,
0
],
"decilitres": [
8,
0.0001,
0
],
"dl": [
8,
0.0001,
0
],
"dL": [
8,
0.0001,
0
],
"centiliter": [
8,
0.00001,
0
],
"centiliters": [
8,
0.00001,
0
],
"centilitre": [
8,
0.00001,
0
],
"centilitres": [
8,
0.00001,
0
],
"cl": [
8,
0.00001,
0
],
"cL": [
8,
0.00001,
0
],
"milliliter": [
8,
0.000001,
0
],
"milliliters": [
8,
0.000001,
0
],
"millilitre": [
8,
0.000001,
0
],
"millilitres": [
8,
0.000001,
0
],
"ml": [
8,
0.000001,
0
],
"mL": [
8,
0.000001,
0
],
"microliter": [
8,
1e-9,
0
],
"microliters": [
8,
1e-9,
0
],
"microlitre": [
8,
1e-9,
0
],
"microlitres": [
8,
1e-9,
0
],
"μl": [
8,
1e-9,
0
],
"μL": [
8,
1e-9,
0
],
"nanoliter": [
8,
1.0000000000000002e-12,
0
],
"nanoliters": [
8,
1.0000000000000002e-12,
0
],
"nanolitre": [
8,
1.0000000000000002e-12,
0
],
"nanolitres": [
8,
1.0000000000000002e-12,
0
],
"nl": [
8,
1.0000000000000002e-12,
0
],
"nL": [
8,
1.0000000000000002e-12,
0
],
"picoliter": [
8,
1e-15,
0
],
"picoliters": [
8,
1e-15,
0
],
"picolitre": [
8,
1e-15,
0
],
"picolitres": [
8,
1e-15,
0
],
"pl": [
8,
1e-15,
0
],
"pL": [
8,
1e-15,
0
],
"femtoliter": [
8,
1e-18,
0
],
"femtoliters": [
8,
1e-18,
0
],
"femtolitre": [
8,
1e-18,
0
],
"femtolitres": [
8,
1e-18,
0
],
"fl": [
8,
1e-18,
0
],
"fL": [
8,
1e-18,
0
]
} as const;
declare const enum ConversionFamilyIndex {
Angle = 0,
Data = 1,
Force = 2,
Length = 3,
Mass = 4,
Pressure = 5,
Temperature = 6,
Time = 7,
Volume = 8
}
declare type Conversions = Omit<typeof conversions, '__proto__'>;
declare type Units = Conversions & typeof prefixed;
declare type AllValues = {
[P in keyof Units]: {
key: P;
value: Units[P][ConversionIndex.Family];
};
}[keyof Units];
declare type IdToFamily = {
[P in AllValues['value']]: Extract<AllValues, {
value: P;
}>['key'];
};
declare type GetAliases<X extends ConversionFamilyIndex> = IdToFamily[X];
declare type Angle = GetAliases<ConversionFamilyIndex.Angle>;
declare type Data = GetAliases<ConversionFamilyIndex.Data>;
declare type Force = GetAliases<ConversionFamilyIndex.Force>;
declare type Length = GetAliases<ConversionFamilyIndex.Length>;
declare type Mass = GetAliases<ConversionFamilyIndex.Mass>;
declare type Pressure = GetAliases<ConversionFamilyIndex.Pressure>;
declare type Temperature = GetAliases<ConversionFamilyIndex.Temperature>;
declare type Time = GetAliases<ConversionFamilyIndex.Time>;
declare type Volume = GetAliases<ConversionFamilyIndex.Volume>;
declare type Unit = Angle | Data | Force | Length | Mass | Pressure | Temperature | Time | Volume;
declare type SimplifyQuantity<Q> = Q extends number ? number : Q extends bigint ? bigint : never;
declare type BestUnits = typeof bestUnits[number][number][BestIndex.Symbol];
/**
* The return value from converting a unit to `'best'`.
*/
interface BestConversion<Q extends number | bigint, U extends BestUnits> {
/**
* The quantity of the unit.
*/
quantity: SimplifyQuantity<Q>;
/** The unit. */
unit: U;
/**
* Join the quantity and the unit together in a string.
* This method is automatically called when casting this object to a string, meaning you can safely do things like concatenate the object with a string.
*/
toString(): `${SimplifyQuantity<Q>}${U}`;
}
interface Converter<Q extends number | bigint, U extends Unit> {
/**
* Convert a quantity of one unit into a new unit
*
* @param to - The unit you want to convert to
*
* @throws `RangeError` if the `to` parameter is not a valid type
* @throws `TypeError` if `quantity` was a `bigint` but the conversion can't be expressed as an integer
*
* @returns The converted value
*/
to(to: U): SimplifyQuantity<Q>;
/**
* Convert a measurement to the best unit for display.
*
* @param to - The string `best`
*
* @throws `RangeError` if the `to` parameter is not a valid type
* @throws `TypeError` if `quantity` was a `bigint` but the conversion can't be expressed as an integer
*
* @returns An object with a `quantity` property of the `unit` unit, which can be casted to a string using the `toString()` method
*/
to<B extends BestUnits>(to: 'best'): BestConversion<Q, B>;
}
/**
* Convert a given angle into another unit.
*
* @param angle - The angle you want to convert
* @param from - The angle type you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(angle: Q, from: Angle): Converter<Q, Angle>;
/**
* Convert a given quantity of data into another unit.
*
* @param quantity - The quantity of data you want to convert
* @param from - The unit of data you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(quantity: Q, from: Data): Converter<Q, Data>;
/**
* Convert a given quantity of force into another unit.
*
* @param quantity - The quantity of force you want to convert
* @param from - The unit of force you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(quantity: Q, from: Force): Converter<Q, Force>;
/**
* Convert a given length into another unit.
*
* @param length - The length you want to convert
* @param from - The unit of length you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(length: Q, from: Length): Converter<Q, Length>;
/**
* Convert a given quantity of mass into another unit.
*
* @param quantity - The quantity of mass you want to convert
* @param from - The unit of mass you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(quantity: Q, from: Mass): Converter<Q, Mass>;
/**
* Convert a given quantity of pressure into another unit.
*
* @param quantity - The quantity of pressure you want to convert
* @param from - The unit of pressure you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(quantity: Q, from: Pressure): Converter<Q, Pressure>;
/**
* Convert a given temperature into another unit.
*
* @param quantity - The quantity of temperature you want to convert
* @param from - The unit of temperature are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(quantity: Q, from: Temperature): Converter<Q, Temperature>;
/**
* Convert a given duration of time into another unit.
*
* @param duration - The duration of time you want to convert
* @param from - The unit of time you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(duration: Q, from: Time): Converter<Q, Time>;
/**
* Convert a given quantity of volume into another unit.
*
* @param quantity - The quantity of volume you want to convert
* @param from - The unit of volume you are converting from
*
* @throws `RangeError` If the `from` parameter is not a recognized unit
*
* @returns An object you can use to convert the provided quantity
*/
declare function convert<Q extends number | bigint>(quantity: Q, from: Volume): Converter<Q, Volume>;
/**
* Convert several values in a string into a single unit.
*
* @example
* ```ts
* convertMany('1d 12h').to('hours') === 36;
* ```
*
* @param value - The string to parse as values
*/
declare function convertMany(value: string): Converter<number, Unit>;
/**
* Convert a duration string to a duration in milliseconds.
*
* You can use this function as a replacement for the duration string to millisecond duration number that the popular `ms` package provides.
*
* If you really care about performance you should just use `convertMany` directly.
*
* @example
* ```ts
* ms('1d 2h 30min') === 95400000;
* ```
*
* @param value - Duration string to convert
*
* @returns A duration in milliseconds
*
* @throws If the provided value was invalid
*/
declare function ms(value: string): number;
export default convert;
export { Angle, Conversion, Data, Force, Length, Mass, Pressure, Temperature, Time, Unit, ConversionFamilyIndex as UnitFamily, Volume, conversions as allUnits, convert, convertMany, ms };
export { convert, convert as default } from './convert';
export { convertMany, ms } from './convert-many';
export { ConversionFamilyIndex as UnitFamily } from './dev/types/common';
export { Angle, Data, Force, Length, Mass, Pressure, Temperature, Time, Unit, Volume } from './types/units';
export { Conversion } from './dev/types/generated';
export { conversions as allUnits } from './generated/generated';
{
"name": "convert",
"version": "2.1.0",
"version": "2.1.1",
"description": "The smallest & fastest library for really easy, totally type-safe unit conversions in TypeScript & JavaScript",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc