@lacspace/nepali-utils 1.0.0 → 1.0.1

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 +40 -17
  2. package/package.json +14 -3
package/README.md CHANGED
@@ -1,13 +1,30 @@
1
+ <div align="center">
2
+
1
3
  # @lacspace/nepali-utils
2
4
 
3
- [![npm](https://img.shields.io/npm/v/@lacspace/nepali-utils.svg)](https://www.npmjs.com/package/@lacspace/nepali-utils) [![license](https://img.shields.io/npm/l/@lacspace/nepali-utils.svg)](https://github.com/lacspace/npm-packages/blob/main/LICENSE)
5
+ **Everyday helpers for Nepal-facing apps — rupees, numerals, amount-in-words, validators, provinces.**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@lacspace/nepali-utils?color=%23f59e0b&label=npm)](https://www.npmjs.com/package/@lacspace/nepali-utils)
8
+ [![install size](https://packagephobia.com/badge?p=@lacspace/nepali-utils)](https://packagephobia.com/result?p=@lacspace/nepali-utils)
9
+ [![minzipped](https://img.shields.io/bundlephobia/minzip/@lacspace/nepali-utils?label=minzip)](https://bundlephobia.com/package/@lacspace/nepali-utils)
10
+ [![types](https://img.shields.io/badge/types-included-blue)](https://www.npmjs.com/package/@lacspace/nepali-utils)
11
+ [![license](https://img.shields.io/npm/l/@lacspace/nepali-utils?color=green)](https://github.com/lacspace/npm-packages/blob/main/LICENSE)
12
+
13
+ </div>
14
+
15
+ > The little things every Nepali app re-implements — done once, done right.
4
16
 
5
- Everyday helpers for building Nepal-facing apps: NPR currency formatting with the South-Asian (lakh/crore) grouping, Devanagari numerals, amount-in-words for invoices, common validators, and province data. Zero dependencies, isomorphic, fully typed.
17
+ - 💰 NPR formatting with **lakh/crore** grouping
18
+ - 🔢 Devanagari ↔ Arabic numerals
19
+ - 🧾 Amount-in-words for invoices
20
+ - ✅ Phone / PAN validators
21
+ - 🗺️ The 7 federal provinces
22
+ - ⚡ Zero dependencies · 🌍 isomorphic · 📦 ESM + CJS · fully typed
6
23
 
7
24
  ## Install
8
25
 
9
26
  ```bash
10
- npm install @lacspace/nepali-utils
27
+ npm install @lacspace/nepali-utils # or pnpm add / yarn add / bun add
11
28
  ```
12
29
 
13
30
  ## Currency & numbers
@@ -15,13 +32,13 @@ npm install @lacspace/nepali-utils
15
32
  ```ts
16
33
  import { formatNPR, groupNepali, toDevanagari, fromDevanagari } from "@lacspace/nepali-utils";
17
34
 
18
- formatNPR(1234567.5); // "Rs. 12,34,567.50"
19
- formatNPR(1234567.5, { symbol: "रू " , devanagari: true }); // "रू १२,३४,५६७.५०"
20
- formatNPR(50000, { decimals: 0, symbol: "" }); // "50,000"
35
+ formatNPR(1234567.5); // "Rs. 12,34,567.50"
36
+ formatNPR(1234567.5, { symbol: "रू ", devanagari: true }); // "रू १२,३४,५६७.५०"
37
+ formatNPR(50000, { decimals: 0, symbol: "" }); // "50,000"
21
38
 
22
- groupNepali(1234567); // "12,34,567" (South-Asian grouping)
23
- toDevanagari("2081"); // "२०८१"
24
- fromDevanagari("२०८१"); // "2081"
39
+ groupNepali(1234567); // "12,34,567" (South-Asian grouping)
40
+ toDevanagari("2081"); // "२०८१"
41
+ fromDevanagari("२०८१"); // "2081"
25
42
  ```
26
43
 
27
44
  ## Amount in words (for invoices)
@@ -44,7 +61,6 @@ import { isValidNepaliMobile, isValidPAN } from "@lacspace/nepali-utils";
44
61
  isValidNepaliMobile("9812345678"); // true
45
62
  isValidNepaliMobile("+9779812345678"); // true
46
63
  isValidNepaliMobile("1234567890"); // false
47
-
48
64
  isValidPAN("123456789"); // true (9 digits)
49
65
  ```
50
66
 
@@ -61,14 +77,21 @@ PROVINCES[2];
61
77
 
62
78
  | Function | Description |
63
79
  | --- | --- |
64
- | `formatNPR(amount, opts?)` | NPR currency string; opts: `symbol`, `decimals`, `devanagari` |
80
+ | `formatNPR(amount, opts?)` | NPR string · opts: `symbol`, `decimals`, `devanagari` |
65
81
  | `groupNepali(value)` | South-Asian digit grouping |
66
- | `toDevanagari(x)` / `fromDevanagari(x)` | numeral conversion |
67
- | `numberToWords(n)` | South-Asian words (Lakh/Crore/Arab) |
68
- | `amountInWords(n)` | "Rupees … only" wrapper |
69
- | `isValidNepaliMobile(s)` / `isValidPAN(s)` | validators |
82
+ | `toDevanagari` / `fromDevanagari` | numeral conversion |
83
+ | `numberToWords(n)` | words with Lakh / Crore / Arab |
84
+ | `amountInWords(n)` | "Rupees … Only" wrapper |
85
+ | `isValidNepaliMobile` / `isValidPAN` | validators |
70
86
  | `PROVINCES` | the 7 federal provinces |
71
87
 
72
- ## License
88
+ ## The Lacspace family
89
+
90
+ | Package | For |
91
+ | --- | --- |
92
+ | [`@lacspace/nepali-date`](https://www.npmjs.com/package/@lacspace/nepali-date) | Bikram Sambat dates |
93
+ | **`@lacspace/nepali-utils`** | Nepal helpers (this package) |
94
+ | [`@lacspace/sdk`](https://www.npmjs.com/package/@lacspace/sdk) | Full Lacspace platform SDK |
95
+ | [`@lacspace/react`](https://www.npmjs.com/package/@lacspace/react) | React hooks |
73
96
 
74
- MIT © [Lacspace](https://lacspace.com)
97
+ <div align="center"><sub>Built with care by <a href="https://lacspace.com">Lacspace</a> · MIT licensed · <a href="https://github.com/lacspace/npm-packages">source</a></sub></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacspace/nepali-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Everyday Nepal helpers — NPR currency formatting, Devanagari numerals, amount-in-words, validators, provinces. Zero-dependency.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,13 +18,24 @@
18
18
  }
19
19
  }
20
20
  },
21
- "files": ["dist"],
21
+ "files": [
22
+ "dist"
23
+ ],
22
24
  "sideEffects": false,
23
25
  "scripts": {
24
26
  "build": "tsup",
25
27
  "prepublishOnly": "npm run build"
26
28
  },
27
- "keywords": ["nepal", "nepali", "npr", "currency", "devanagari", "amount-in-words", "validator", "typescript"],
29
+ "keywords": [
30
+ "nepal",
31
+ "nepali",
32
+ "npr",
33
+ "currency",
34
+ "devanagari",
35
+ "amount-in-words",
36
+ "validator",
37
+ "typescript"
38
+ ],
28
39
  "author": "Lacspace <contact@lacspace.com>",
29
40
  "license": "MIT",
30
41
  "homepage": "https://lacspace.com",