ts-number-lite 2.0.1 → 2.0.3

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 (2) hide show
  1. package/README.md +45 -0
  2. package/package.json +6 -2
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # ts-number-lite
2
+
3
+ Lightweight, type-safe number utility library for web developers.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ts-number-lite
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Injectable } from '@angular/core';
15
+ import { NumberUtils } from 'ts-number-lite';
16
+
17
+ @Injectable({ providedIn: 'root' })
18
+ export class MyService {
19
+ constructor(private num: NumberUtils) { }
20
+
21
+ myMethod(): void {
22
+ this.num.formatCurrency(1234.56); // '$1,234.56'
23
+ this.num.formatBytes(1048576); // '1 MB'
24
+ this.num.formatPercent(0.756); // '75.6%'
25
+ this.num.clamp(150, 0, 100); // 100
26
+ this.num.round(3.14159, 2); // 3.14
27
+ this.num.randomInt(1, 10); // random int 1-10
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Methods
33
+
34
+ | Method | Description | Example |
35
+ |--------|-------------|---------|
36
+ | `formatCurrency` | Format as currency | `1234.56` → `'$1,234.56'` |
37
+ | `formatBytes` | Format as bytes | `1048576` → `'1 MB'` |
38
+ | `formatPercent` | Format as percent | `0.756` → `'75.6%'` |
39
+ | `clamp` | Clamp value to range | `150, 0, 100` → `100` |
40
+ | `round` | Round to decimals | `3.14159, 2` → `3.14` |
41
+ | `randomInt` | Random integer | `1, 10` → random 1-10 |
42
+
43
+ ## License
44
+
45
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-number-lite",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Lightweight, type-safe number utility library for web developers",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,5 +26,9 @@
26
26
  "lite"
27
27
  ],
28
28
  "author": "Gaurang Mody - G8X",
29
- "license": "MIT"
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/gbmrocks/ts-utils-lite.git"
33
+ }
30
34
  }