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 CHANGED
@@ -362,14 +362,48 @@ import blue from 'meticulous-ui/colors/blue';
362
362
 
363
363
  ## πŸ“¦ Utils
364
364
 
365
- | Functions | Description |
366
- | ----------------- | -------------------------------------------------------------------------------------------------------------- |
367
- | `capFirstLetter` | Takes a string and returns with first letter capitalised |
368
- | `compose` | Performs right-to-left function composition using transforming function |
369
- | `hasEqualProps` | Takes two args: Component’s previous props & its new props; returns true if all-non functional props are equal |
370
- | `isNonEmptyArray` | Takes an array & returns true if is not empty |
371
- | `randomInt` | Takes min, max integer & returns random integer between them |
372
- | `randomValue` | Takes min, max value & returns random value between them |
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.1.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",
@@ -0,0 +1,4 @@
1
+ const a = (e) => typeof e != "string" ? e : e.trim().toLowerCase().replace(/[-_\s]+(.)?/g, (r, t) => t ? t.toUpperCase() : "");
2
+ export {
3
+ a as default
4
+ };
@@ -1,4 +1,4 @@
1
- const t = (e) => typeof e != "string" || e.length === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1);
1
+ const t = (e) => typeof e != "string" || e.length === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
2
2
  export {
3
3
  t as default
4
4
  };
package/utils/chunk.js ADDED
@@ -0,0 +1,9 @@
1
+ const s = (e, l) => {
2
+ const n = [];
3
+ for (let t = 0; t < e.length; t += l)
4
+ n.push(e.slice(t, t + l));
5
+ return n;
6
+ };
7
+ export {
8
+ s as default
9
+ };
@@ -0,0 +1,4 @@
1
+ const t = (e) => e === null || typeof e != "object" ? e : e instanceof Date ? new Date(e.getTime()) : Array.isArray(e) ? e.map(t) : Object.fromEntries(Object.entries(e).map(([r, n]) => [r, t(n)]));
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,7 @@
1
+ const u = (o, r = "") => Object.entries(o).reduce((t, [s, e]) => {
2
+ const n = r ? `${r}.${s}` : s;
3
+ return e !== null && typeof e == "object" && !Array.isArray(e) ? Object.assign(t, u(e, n)) : t[n] = e, t;
4
+ }, {});
5
+ export {
6
+ u as default
7
+ };
@@ -0,0 +1,4 @@
1
+ const e = (t) => typeof t != "string" ? t : t.trim().split(/\s+/).filter(Boolean).map((r) => r.charAt(0).toUpperCase()).join("");
2
+ export {
3
+ e as default
4
+ };
@@ -0,0 +1,7 @@
1
+ const s = (r, o) => r.reduce((n, t) => {
2
+ const u = typeof o == "function" ? o(t) : t[o];
3
+ return (n[u] ?? (n[u] = [])).push(t), n;
4
+ }, {});
5
+ export {
6
+ s as default
7
+ };
package/utils/index.js CHANGED
@@ -1,13 +1,62 @@
1
- import o from "./capFirstLetter.js";
2
- import r from "./compose.js";
3
- import t from "./hasEqualProps.js";
4
- import m from "./isNonEmptyArray.js";
5
- const e = {
6
- capFirstLetter: o,
7
- compose: r,
8
- hasEqualProps: t,
9
- isNonEmptyArray: m
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
- e as default
61
+ mr as default
13
62
  };
@@ -0,0 +1,4 @@
1
+ const r = (t) => t == null ? !0 : typeof t == "string" || Array.isArray(t) ? t.length === 0 : typeof t == "object" ? Object.keys(t).length === 0 : !1;
2
+ export {
3
+ r as default
4
+ };
@@ -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
+ };
@@ -0,0 +1,4 @@
1
+ const a = (e) => typeof e != "string" ? e : e.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
2
+ export {
3
+ a as default
4
+ };
package/utils/keyBy.js ADDED
@@ -0,0 +1,4 @@
1
+ const u = (t, n) => t.reduce((r, o) => (r[typeof n == "function" ? n(o) : o[n]] = o, r), {});
2
+ export {
3
+ u as default
4
+ };
@@ -0,0 +1,8 @@
1
+ const e = (t) => {
2
+ if (typeof t != "string") return t;
3
+ const [n, a] = t.split("@");
4
+ return a ? n.charAt(0) + "***@" + a : t;
5
+ };
6
+ export {
7
+ e as default
8
+ };
@@ -0,0 +1,9 @@
1
+ const o = (e) => {
2
+ if (typeof e != "string") return e;
3
+ const t = e.replace(/\D/g, ""), a = Math.max(0, t.length - 4);
4
+ let n = 0;
5
+ return e.replace(/\d/g, () => n++ < a ? "*" : t[n - 1]);
6
+ };
7
+ export {
8
+ o as default
9
+ };
@@ -0,0 +1,9 @@
1
+ const s = (e) => e !== null && typeof e == "object" && !Array.isArray(e), l = (e, n) => {
2
+ const o = { ...e };
3
+ for (const t of Object.keys(n))
4
+ o[t] = s(e[t]) && s(n[t]) ? l(e[t], n[t]) : n[t];
5
+ return o;
6
+ };
7
+ export {
8
+ l as default
9
+ };
package/utils/omit.js ADDED
@@ -0,0 +1,7 @@
1
+ const n = (t, e) => {
2
+ const r = new Set(e);
3
+ return Object.fromEntries(Object.entries(t).filter(([s]) => !r.has(s)));
4
+ };
5
+ export {
6
+ n as default
7
+ };
package/utils/pick.js ADDED
@@ -0,0 +1,4 @@
1
+ const r = (e, i) => Object.fromEntries(i.filter((t) => t in e).map((t) => [t, e[t]]));
2
+ export {
3
+ r as default
4
+ };
@@ -0,0 +1,5 @@
1
+ import t from "./randomValue.js";
2
+ const n = (o, r) => Math.floor(t(o, r));
3
+ export {
4
+ n as default
5
+ };
@@ -0,0 +1,4 @@
1
+ const t = (a, r) => Math.random() * (r - a + 1) + a;
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,4 @@
1
+ const r = (e) => typeof e != "string" ? e : e.trim().replace(/\s+/g, " ");
2
+ export {
3
+ r as default
4
+ };
@@ -0,0 +1,4 @@
1
+ const r = (e) => typeof e != "string" ? e : e.trim().toLowerCase().normalize("NFD").replace(/[Μ€-Ν―]/g, "").replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
2
+ export {
3
+ r as default
4
+ };
@@ -0,0 +1,4 @@
1
+ const a = (e) => typeof e != "string" ? e : e.trim().replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
2
+ export {
3
+ a as default
4
+ };
@@ -0,0 +1,7 @@
1
+ const r = (f, t) => [...f].sort((o, n) => {
2
+ const s = typeof t == "function" ? t(o) : o[t], c = typeof t == "function" ? t(n) : n[t];
3
+ return s < c ? -1 : s > c ? 1 : 0;
4
+ });
5
+ export {
6
+ r as default
7
+ };
@@ -0,0 +1,4 @@
1
+ const a = (e) => typeof e != "string" ? e : e.toLowerCase().split(" ").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
2
+ export {
3
+ a as default
4
+ };
@@ -0,0 +1,4 @@
1
+ const t = (e, n) => typeof e != "string" || e.length <= n ? e : e.slice(0, n) + "…";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,10 @@
1
+ const s = (u, t) => {
2
+ const e = /* @__PURE__ */ new Set();
3
+ return u.filter((n) => {
4
+ const r = typeof t == "function" ? t(n) : n[t];
5
+ return e.has(r) ? !1 : (e.add(r), !0);
6
+ });
7
+ };
8
+ export {
9
+ s as default
10
+ };