meticulous-ui 3.1.3 β 3.2.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.
- package/README.md +42 -8
- package/package.json +1 -1
- package/utils/camelCase.js +4 -0
- package/utils/{capFirstLetter.js β capitalize.js} +1 -1
- package/utils/chunk.js +9 -0
- package/utils/deepClone.js +4 -0
- package/utils/flattenObject.js +7 -0
- package/utils/generateInitials.js +4 -0
- package/utils/groupBy.js +7 -0
- package/utils/index.js +59 -10
- package/utils/isEmpty.js +4 -0
- package/utils/isEqual.js +10 -0
- package/utils/kebabCase.js +4 -0
- package/utils/keyBy.js +4 -0
- package/utils/maskEmail.js +8 -0
- package/utils/maskPhone.js +9 -0
- package/utils/mergeDeep.js +9 -0
- package/utils/omit.js +7 -0
- package/utils/pick.js +4 -0
- package/utils/randomInt.js +5 -0
- package/utils/randomValue.js +4 -0
- package/utils/removeExtraSpaces.js +4 -0
- package/utils/slugify.js +4 -0
- package/utils/snakeCase.js +4 -0
- package/utils/sortBy.js +7 -0
- package/utils/titleCase.js +4 -0
- package/utils/truncate.js +4 -0
- package/utils/uniqueBy.js +10 -0
package/README.md
CHANGED
|
@@ -362,14 +362,48 @@ import blue from 'meticulous-ui/colors/blue';
|
|
|
362
362
|
|
|
363
363
|
## π¦ Utils
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
|
368
|
-
|
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `
|
|
372
|
-
|
|
365
|
+
### General
|
|
366
|
+
|
|
367
|
+
| Function | Signature | Description |
|
|
368
|
+
| ------------- | -------------------------- | ----------------------------------------- |
|
|
369
|
+
| `compose` | `(...funcs) β (val) β any` | Right-to-left function composition |
|
|
370
|
+
| `randomInt` | `(min, max) β number` | Random integer in `[min, floor(max + 1))` |
|
|
371
|
+
| `randomValue` | `(min, max) β number` | Random float in `[min, max + 1)` |
|
|
372
|
+
|
|
373
|
+
### Data Utilities
|
|
374
|
+
|
|
375
|
+
| Function | Signature | Description |
|
|
376
|
+
| ----------------- | -------------------------------- | ------------------------------------------------------------------------ |
|
|
377
|
+
| `deepClone` | `(obj) β any` | Recursively clones objects, arrays, and Dates with no shared references |
|
|
378
|
+
| `mergeDeep` | `(target, source) β object` | Deep-merges source into target; source wins on conflicts |
|
|
379
|
+
| `pick` | `(obj, keys) β object` | Returns a new object with only the specified keys |
|
|
380
|
+
| `omit` | `(obj, keys) β object` | Returns a new object without the specified keys |
|
|
381
|
+
| `isEmpty` | `(value) β boolean` | `true` for `null`, `undefined`, `""`, `[]`, `{}` |
|
|
382
|
+
| `isEqual` | `(a, b) β boolean` | Deep structural equality β handles objects, arrays, and Dates |
|
|
383
|
+
| `hasEqualProps` | `(oldProps, newProps) β boolean` | Deep equality ignoring function-valued keys; ideal for `React.memo` |
|
|
384
|
+
| `isNonEmptyArray` | `(arr) β boolean` | `true` only when the value is an array with at least one element |
|
|
385
|
+
| `flattenObject` | `(obj, prefix?) β object` | Collapses nested object to dot-notation keys |
|
|
386
|
+
| `groupBy` | `(array, key) β object` | Groups array items into an object of arrays keyed by a field or function |
|
|
387
|
+
| `keyBy` | `(array, key) β object` | Converts an array into a lookup object keyed by a field or function |
|
|
388
|
+
| `uniqueBy` | `(array, key) β array` | Removes duplicates by a field or function; first occurrence wins |
|
|
389
|
+
| `sortBy` | `(array, key) β array` | Ascending sort by a field or function; non-mutating |
|
|
390
|
+
| `chunk` | `(array, size) β array[]` | Splits array into consecutive chunks of the given size |
|
|
391
|
+
|
|
392
|
+
### String Utilities
|
|
393
|
+
|
|
394
|
+
| Function | Signature | Description |
|
|
395
|
+
| ------------------- | ----------------------- | ------------------------------------------------------------------- |
|
|
396
|
+
| `capitalize` | `(str) β string` | Uppercases first character, lowercases the rest |
|
|
397
|
+
| `titleCase` | `(str) β string` | Capitalizes the first letter of every word |
|
|
398
|
+
| `camelCase` | `(str) β string` | Converts to `camelCase` from spaces, hyphens, or underscores |
|
|
399
|
+
| `snakeCase` | `(str) β string` | Converts to `snake_case` from camelCase, spaces, or hyphens |
|
|
400
|
+
| `kebabCase` | `(str) β string` | Converts to `kebab-case` from camelCase, spaces, or underscores |
|
|
401
|
+
| `truncate` | `(str, limit) β string` | Trims to `limit` characters and appends `β¦` |
|
|
402
|
+
| `slugify` | `(str) β string` | URL-safe slug β strips diacritics, removes special chars |
|
|
403
|
+
| `removeExtraSpaces` | `(str) β string` | Trims and collapses internal whitespace runs to a single space |
|
|
404
|
+
| `maskEmail` | `(str) β string` | Shows only the first character of the local part, e.g. `j***@x.com` |
|
|
405
|
+
| `maskPhone` | `(str) β string` | Masks all digits except the last four; preserves formatting chars |
|
|
406
|
+
| `generateInitials` | `(name) β string` | Extracts uppercased first letter of each word, e.g. `"JD"` |
|
|
373
407
|
|
|
374
408
|
## π± Features
|
|
375
409
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
|
|
6
6
|
"main": "./index.js",
|
package/utils/chunk.js
ADDED
package/utils/groupBy.js
ADDED
package/utils/index.js
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import r from "./capitalize.js";
|
|
2
|
+
import o from "./camelCase.js";
|
|
3
|
+
import m from "./chunk.js";
|
|
4
|
+
import t from "./compose.js";
|
|
5
|
+
import i from "./deepClone.js";
|
|
6
|
+
import p from "./flattenObject.js";
|
|
7
|
+
import e from "./generateInitials.js";
|
|
8
|
+
import f from "./groupBy.js";
|
|
9
|
+
import a from "./hasEqualProps.js";
|
|
10
|
+
import s from "./isEmpty.js";
|
|
11
|
+
import n from "./isEqual.js";
|
|
12
|
+
import l from "./isNonEmptyArray.js";
|
|
13
|
+
import c from "./kebabCase.js";
|
|
14
|
+
import u from "./keyBy.js";
|
|
15
|
+
import y from "./maskEmail.js";
|
|
16
|
+
import k from "./maskPhone.js";
|
|
17
|
+
import E from "./mergeDeep.js";
|
|
18
|
+
import d from "./omit.js";
|
|
19
|
+
import C from "./pick.js";
|
|
20
|
+
import g from "./randomInt.js";
|
|
21
|
+
import B from "./randomValue.js";
|
|
22
|
+
import b from "./removeExtraSpaces.js";
|
|
23
|
+
import h from "./slugify.js";
|
|
24
|
+
import q from "./snakeCase.js";
|
|
25
|
+
import x from "./sortBy.js";
|
|
26
|
+
import I from "./titleCase.js";
|
|
27
|
+
import P from "./truncate.js";
|
|
28
|
+
import j from "./uniqueBy.js";
|
|
29
|
+
const mr = {
|
|
30
|
+
capFirstLetter: r,
|
|
31
|
+
capitalize: r,
|
|
32
|
+
camelCase: o,
|
|
33
|
+
chunk: m,
|
|
34
|
+
compose: t,
|
|
35
|
+
deepClone: i,
|
|
36
|
+
flattenObject: p,
|
|
37
|
+
generateInitials: e,
|
|
38
|
+
groupBy: f,
|
|
39
|
+
hasEqualProps: a,
|
|
40
|
+
isEmpty: s,
|
|
41
|
+
isEqual: n,
|
|
42
|
+
isNonEmptyArray: l,
|
|
43
|
+
kebabCase: c,
|
|
44
|
+
keyBy: u,
|
|
45
|
+
maskEmail: y,
|
|
46
|
+
maskPhone: k,
|
|
47
|
+
mergeDeep: E,
|
|
48
|
+
omit: d,
|
|
49
|
+
pick: C,
|
|
50
|
+
randomInt: g,
|
|
51
|
+
randomValue: B,
|
|
52
|
+
removeExtraSpaces: b,
|
|
53
|
+
slugify: h,
|
|
54
|
+
snakeCase: q,
|
|
55
|
+
sortBy: x,
|
|
56
|
+
titleCase: I,
|
|
57
|
+
truncate: P,
|
|
58
|
+
uniqueBy: j
|
|
10
59
|
};
|
|
11
60
|
export {
|
|
12
|
-
|
|
61
|
+
mr as default
|
|
13
62
|
};
|
package/utils/isEmpty.js
ADDED
package/utils/isEqual.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const f = (e, t) => {
|
|
2
|
+
if (e === t) return !0;
|
|
3
|
+
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
4
|
+
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
5
|
+
const r = Object.keys(e), s = Object.keys(t);
|
|
6
|
+
return r.length !== s.length ? !1 : r.every((n) => f(e[n], t[n]));
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
f as default
|
|
10
|
+
};
|
package/utils/keyBy.js
ADDED
package/utils/omit.js
ADDED
package/utils/pick.js
ADDED
package/utils/slugify.js
ADDED
package/utils/sortBy.js
ADDED