calcufly-convert 1.0.0

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -0
  3. package/index.js +119 -0
  4. package/package.json +12 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 CalcuFly (https://calcufly.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # calcufly-convert
2
+
3
+ Unit conversion functions for Node.js. Length, weight, temperature, volume, speed, data, energy, pressure, time, cooking and area.
4
+
5
+ Part of the [CalcuFly](https://calcufly.com) calculator suite — 600+ free online calculators.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install calcufly-convert
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```javascript
16
+ const convert = require('calcufly-convert');
17
+
18
+ console.log(convert.kmToMiles(100)); // 62.14
19
+ console.log(convert.celsiusToFahrenheit(37)); // 98.6
20
+ console.log(convert.kgToLbs(80)); // 176.37
21
+ console.log(convert.litersToGallons(5)); // 1.32
22
+ ```
23
+
24
+ ## 60+ Conversion Functions
25
+
26
+ **Length:** kmToMiles, milesToKm, mToFeet, feetToM, cmToInches, inchesToCm, mmToInches, yardsToM, mToYards
27
+
28
+ **Weight:** kgToLbs, lbsToKg, kgToOz, ozToKg, kgToStone, stoneToKg, gramsToOz, ozToGrams
29
+
30
+ **Temperature:** celsiusToFahrenheit, fahrenheitToCelsius, celsiusToKelvin, kelvinToCelsius
31
+
32
+ **Volume:** litersToGallons, gallonsToLiters, mlToFlOz, flOzToMl, cupsToMl, mlToCups
33
+
34
+ **Speed:** kphToMph, mphToKph, knotsToKph, mpsToKph
35
+
36
+ **Data:** bytesToKB, kbToMB, mbToGB, gbToTB, bitsToBytes, bytesToBits
37
+
38
+ **Energy:** joulesToCalories, caloriesToJoules, kwhToJoules, joulesToKwh
39
+
40
+ **Area:** sqmToSqft, sqftToSqm, acresToSqm, hectaresToAcres
41
+
42
+ Try these conversions online at **[CalcuFly.com](https://calcufly.com)** — free, no signup required.
43
+
44
+ ## License
45
+
46
+ MIT — [CalcuFly](https://calcufly.com)
package/index.js ADDED
@@ -0,0 +1,119 @@
1
+ /**
2
+ * calcufly-convert — Unit conversion functions
3
+ * https://calcufly.com
4
+ */
5
+
6
+ // LENGTH
7
+ const kmToMiles = (km) => km * 0.621371;
8
+ const milesToKm = (miles) => miles * 1.60934;
9
+ const mToFeet = (m) => m * 3.28084;
10
+ const feetToM = (ft) => ft * 0.3048;
11
+ const cmToInches = (cm) => cm * 0.393701;
12
+ const inchesToCm = (inches) => inches * 2.54;
13
+ const mmToInches = (mm) => mm * 0.0393701;
14
+ const inchesToMm = (inches) => inches * 25.4;
15
+ const yardsToM = (yd) => yd * 0.9144;
16
+ const mToYards = (m) => m * 1.09361;
17
+
18
+ // WEIGHT
19
+ const kgToLbs = (kg) => kg * 2.20462;
20
+ const lbsToKg = (lbs) => lbs * 0.453592;
21
+ const kgToOz = (kg) => kg * 35.274;
22
+ const ozToKg = (oz) => oz * 0.0283495;
23
+ const kgToStone = (kg) => kg * 0.157473;
24
+ const stoneToKg = (st) => st * 6.35029;
25
+ const gramsToOz = (g) => g * 0.035274;
26
+ const ozToGrams = (oz) => oz * 28.3495;
27
+
28
+ // TEMPERATURE
29
+ const celsiusToFahrenheit = (c) => (c * 9/5) + 32;
30
+ const fahrenheitToCelsius = (f) => (f - 32) * 5/9;
31
+ const celsiusToKelvin = (c) => c + 273.15;
32
+ const kelvinToCelsius = (k) => k - 273.15;
33
+
34
+ // VOLUME
35
+ const litersToGallons = (l) => l * 0.264172;
36
+ const gallonsToLiters = (gal) => gal * 3.78541;
37
+ const litersToQuarts = (l) => l * 1.05669;
38
+ const quartsToLiters = (qt) => qt * 0.946353;
39
+ const mlToFlOz = (ml) => ml * 0.033814;
40
+ const flOzToMl = (flOz) => flOz * 29.5735;
41
+ const cupsToMl = (cups) => cups * 236.588;
42
+ const mlToCups = (ml) => ml / 236.588;
43
+
44
+ // SPEED
45
+ const kphToMph = (kph) => kph * 0.621371;
46
+ const mphToKph = (mph) => mph * 1.60934;
47
+ const knotsToKph = (knots) => knots * 1.852;
48
+ const kphToKnots = (kph) => kph / 1.852;
49
+ const mpsToKph = (mps) => mps * 3.6;
50
+ const kphToMps = (kph) => kph / 3.6;
51
+
52
+ // DATA
53
+ const bytesToKB = (b) => b / 1024;
54
+ const kbToMB = (kb) => kb / 1024;
55
+ const mbToGB = (mb) => mb / 1024;
56
+ const gbToTB = (gb) => gb / 1024;
57
+ const bitsToBytes = (bits) => bits / 8;
58
+ const bytesToBits = (bytes) => bytes * 8;
59
+
60
+ // ENERGY
61
+ const joulesToCalories = (j) => j * 0.239006;
62
+ const caloriesToJoules = (cal) => cal * 4.184;
63
+ const kwhToJoules = (kwh) => kwh * 3600000;
64
+ const joulesToKwh = (j) => j / 3600000;
65
+
66
+ // PRESSURE
67
+ const psiToBar = (psi) => psi * 0.0689476;
68
+ const barToPsi = (bar) => bar * 14.5038;
69
+ const psiToAtm = (psi) => psi * 0.068046;
70
+ const atmToPsi = (atm) => atm * 14.696;
71
+
72
+ // TIME
73
+ const hoursToMinutes = (h) => h * 60;
74
+ const minutesToHours = (m) => m / 60;
75
+ const daysToHours = (d) => d * 24;
76
+ const hoursToDays = (h) => h / 24;
77
+ const weeksToDays = (w) => w * 7;
78
+ const daysToWeeks = (d) => d / 7;
79
+
80
+ // COOKING
81
+ const cupsToTablespoons = (cups) => cups * 16;
82
+ const tablespoonsToCups = (tbsp) => tbsp / 16;
83
+ const tablespoonsToTeaspoons = (tbsp) => tbsp * 3;
84
+ const teaspoonsToTablespoons = (tsp) => tsp / 3;
85
+
86
+ // AREA
87
+ const sqmToSqft = (sqm) => sqm * 10.7639;
88
+ const sqftToSqm = (sqft) => sqft * 0.092903;
89
+ const acresToSqm = (acres) => acres * 4046.86;
90
+ const sqmToAcres = (sqm) => sqm / 4046.86;
91
+ const hectaresToAcres = (ha) => ha * 2.47105;
92
+ const acresToHectares = (acres) => acres * 0.404686;
93
+
94
+ module.exports = {
95
+ // Length
96
+ kmToMiles, milesToKm, mToFeet, feetToM, cmToInches, inchesToCm,
97
+ mmToInches, inchesToMm, yardsToM, mToYards,
98
+ // Weight
99
+ kgToLbs, lbsToKg, kgToOz, ozToKg, kgToStone, stoneToKg, gramsToOz, ozToGrams,
100
+ // Temperature
101
+ celsiusToFahrenheit, fahrenheitToCelsius, celsiusToKelvin, kelvinToCelsius,
102
+ // Volume
103
+ litersToGallons, gallonsToLiters, litersToQuarts, quartsToLiters,
104
+ mlToFlOz, flOzToMl, cupsToMl, mlToCups,
105
+ // Speed
106
+ kphToMph, mphToKph, knotsToKph, kphToKnots, mpsToKph, kphToMps,
107
+ // Data
108
+ bytesToKB, kbToMB, mbToGB, gbToTB, bitsToBytes, bytesToBits,
109
+ // Energy
110
+ joulesToCalories, caloriesToJoules, kwhToJoules, joulesToKwh,
111
+ // Pressure
112
+ psiToBar, barToPsi, psiToAtm, atmToPsi,
113
+ // Time
114
+ hoursToMinutes, minutesToHours, daysToHours, hoursToDays, weeksToDays, daysToWeeks,
115
+ // Cooking
116
+ cupsToTablespoons, tablespoonsToCups, tablespoonsToTeaspoons, teaspoonsToTablespoons,
117
+ // Area
118
+ sqmToSqft, sqftToSqm, acresToSqm, sqmToAcres, hectaresToAcres, acresToHectares
119
+ };
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "calcufly-convert",
3
+ "version": "1.0.0",
4
+ "description": "Unit conversion functions - length, weight, temperature, volume, speed, data, energy, cooking. By CalcuFly.com",
5
+ "main": "index.js",
6
+ "keywords": ["converter","unit-conversion","length","weight","temperature","volume","speed","metric","imperial","celsius","fahrenheit","kilometers","miles","pounds","kilograms","cooking"],
7
+ "author": "CalcuFly <contact@calcufly.com>",
8
+ "license": "MIT",
9
+ "homepage": "https://calcufly.com",
10
+ "repository": {"type":"git","url":"https://github.com/mansouewalks-bit2/calcufly-convert"},
11
+ "bugs": {"url":"https://github.com/mansouewalks-bit2/calcufly-convert/issues"}
12
+ }