lite-math 1.0.1 → 1.0.2
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
CHANGED
|
@@ -13,15 +13,19 @@ A comprehensive, production-ready TypeScript NPM package providing 40+ mathemati
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
```bash
|
|
17
17
|
npm install lite-math
|
|
18
|
-
|
|
18
|
+
# or
|
|
19
|
+
yarn add lite-math
|
|
20
|
+
# or
|
|
21
|
+
pnpm add lite-math
|
|
22
|
+
```
|
|
19
23
|
|
|
20
24
|
## Usage
|
|
21
25
|
|
|
22
26
|
### ES Module
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
```typescript
|
|
25
29
|
import { add, subtract, factorial, primeCheck } from 'lite-math'
|
|
26
30
|
|
|
27
31
|
console.log(add(10, 20)) // 30
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lite-math",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A comprehensive TypeScript library of 40+ mathematical operations including arithmetic, advanced math, statistics, random numbers, algebra, and unit conversions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/src/convert/c-to-f.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts Celsius to Fahrenheit
|
|
3
|
-
* @param celsius - Temperature in Celsius
|
|
4
|
-
* @returns Temperature in Fahrenheit
|
|
5
|
-
*/
|
|
6
|
-
export function cToF(celsius: number): number {
|
|
7
|
-
return (celsius * 9) / 5 + 32
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Converts Celsius to Fahrenheit
|
|
3
|
+
* @param celsius - Temperature in Celsius
|
|
4
|
+
* @returns Temperature in Fahrenheit
|
|
5
|
+
*/
|
|
6
|
+
export function cToF(celsius: number): number {
|
|
7
|
+
return (celsius * 9) / 5 + 32
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts degrees to radians
|
|
3
|
-
* @param degrees - Angle in degrees
|
|
4
|
-
* @returns Angle in radians
|
|
5
|
-
*/
|
|
6
|
-
export function degToRad(degrees: number): number {
|
|
7
|
-
return degrees * (Math.PI / 180)
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Converts degrees to radians
|
|
3
|
+
* @param degrees - Angle in degrees
|
|
4
|
+
* @returns Angle in radians
|
|
5
|
+
*/
|
|
6
|
+
export function degToRad(degrees: number): number {
|
|
7
|
+
return degrees * (Math.PI / 180)
|
|
8
|
+
}
|
package/src/convert/f-to-c.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts Fahrenheit to Celsius
|
|
3
|
-
* @param fahrenheit - Temperature in Fahrenheit
|
|
4
|
-
* @returns Temperature in Celsius
|
|
5
|
-
*/
|
|
6
|
-
export function fToC(fahrenheit: number): number {
|
|
7
|
-
return ((fahrenheit - 32) * 5) / 9
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Converts Fahrenheit to Celsius
|
|
3
|
+
* @param fahrenheit - Temperature in Fahrenheit
|
|
4
|
+
* @returns Temperature in Celsius
|
|
5
|
+
*/
|
|
6
|
+
export function fToC(fahrenheit: number): number {
|
|
7
|
+
return ((fahrenheit - 32) * 5) / 9
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts kilometers to miles
|
|
3
|
-
* @param km - Distance in kilometers
|
|
4
|
-
* @returns Distance in miles
|
|
5
|
-
*/
|
|
6
|
-
export function kmToMiles(km: number): number {
|
|
7
|
-
return km * 0.621371
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Converts kilometers to miles
|
|
3
|
+
* @param km - Distance in kilometers
|
|
4
|
+
* @returns Distance in miles
|
|
5
|
+
*/
|
|
6
|
+
export function kmToMiles(km: number): number {
|
|
7
|
+
return km * 0.621371
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts miles to kilometers
|
|
3
|
-
* @param miles - Distance in miles
|
|
4
|
-
* @returns Distance in kilometers
|
|
5
|
-
*/
|
|
6
|
-
export function milesToKm(miles: number): number {
|
|
7
|
-
return miles * 1.60934
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Converts miles to kilometers
|
|
3
|
+
* @param miles - Distance in miles
|
|
4
|
+
* @returns Distance in kilometers
|
|
5
|
+
*/
|
|
6
|
+
export function milesToKm(miles: number): number {
|
|
7
|
+
return miles * 1.60934
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts radians to degrees
|
|
3
|
-
* @param radians - Angle in radians
|
|
4
|
-
* @returns Angle in degrees
|
|
5
|
-
*/
|
|
6
|
-
export function radToDeg(radians: number): number {
|
|
7
|
-
return radians * (180 / Math.PI)
|
|
8
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Converts radians to degrees
|
|
3
|
+
* @param radians - Angle in radians
|
|
4
|
+
* @returns Angle in degrees
|
|
5
|
+
*/
|
|
6
|
+
export function radToDeg(radians: number): number {
|
|
7
|
+
return radians * (180 / Math.PI)
|
|
8
|
+
}
|