@ntnyq/utils 0.5.1 → 0.5.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/dist/index.cjs CHANGED
@@ -15,6 +15,7 @@ var __copyProps = (to, from, except, desc) => {
15
15
  }
16
16
  return to;
17
17
  };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
20
 
20
21
  // src/index.ts
@@ -24,8 +25,6 @@ __export(index_exports, {
24
25
  NOOP: () => NOOP,
25
26
  at: () => at,
26
27
  cAF: () => cAF,
27
- camelCase: () => camelCase,
28
- capitalize: () => capitalize,
29
28
  chunk: () => chunk,
30
29
  clamp: () => clamp,
31
30
  cleanObject: () => cleanObject,
@@ -36,7 +35,6 @@ __export(index_exports, {
36
35
  ensurePrefix: () => ensurePrefix,
37
36
  ensureSuffix: () => ensureSuffix,
38
37
  escapeHtml: () => escapeHtml,
39
- flatCase: () => flatCase,
40
38
  flattenArrayable: () => flattenArrayable,
41
39
  getObjectType: () => getObjectType,
42
40
  hasOwn: () => hasOwn,
@@ -75,19 +73,15 @@ __export(index_exports, {
75
73
  isSet: () => isSet,
76
74
  isString: () => isString,
77
75
  isUndefined: () => isUndefined,
78
- isUppercase: () => isUppercase,
79
76
  isWhitespaceString: () => isWhitespaceString,
80
77
  isZero: () => isZero,
81
78
  join: () => join,
82
- kebabCase: () => kebabCase,
83
79
  last: () => last,
84
- lowerFirst: () => lowerFirst,
85
80
  mergeArrayable: () => mergeArrayable,
86
81
  minutes: () => minutes,
87
82
  noop: () => noop,
88
83
  omit: () => omit,
89
84
  once: () => once,
90
- pascalCase: () => pascalCase,
91
85
  pick: () => pick,
92
86
  rAF: () => rAF,
93
87
  randomHexColor: () => randomHexColor,
@@ -98,17 +92,12 @@ __export(index_exports, {
98
92
  resolveSubOptions: () => resolveSubOptions,
99
93
  seconds: () => seconds,
100
94
  slash: () => slash,
101
- snakeCase: () => snakeCase,
102
95
  sortObject: () => sortObject,
103
- splitByCase: () => splitByCase,
104
96
  throttle: () => throttle,
105
- titleCase: () => titleCase,
106
97
  toArray: () => toArray,
107
- trainCase: () => trainCase,
108
98
  unindent: () => unindent,
109
99
  unique: () => unique,
110
100
  uniqueBy: () => uniqueBy,
111
- upperFirst: () => upperFirst,
112
101
  waitFor: () => waitFor,
113
102
  warnOnce: () => warnOnce,
114
103
  weeks: () => weeks
@@ -122,19 +111,22 @@ function isDeepEqual(value1, value2) {
122
111
  if (type1 !== type2) {
123
112
  return false;
124
113
  }
125
- if (isArray(value1)) {
114
+ if (isArray(value1) && isArray(value2)) {
126
115
  if (value1.length !== value2.length) {
127
116
  return false;
128
117
  }
129
118
  return value1.every((item, index) => isDeepEqual(item, value2[index]));
130
119
  }
131
- if (isObject(value1)) {
120
+ if (isObject(value1) && isObject(value2)) {
132
121
  const keys = Object.keys(value1);
133
122
  if (keys.length !== Object.keys(value2).length) {
134
123
  return false;
135
124
  }
136
125
  return keys.every(
137
- (key) => isDeepEqual(value1[key], value2[key])
126
+ (key) => isDeepEqual(
127
+ value1[key],
128
+ value2[key]
129
+ )
138
130
  );
139
131
  }
140
132
  return Object.is(value1, value2);
@@ -227,7 +219,10 @@ function isError(value) {
227
219
  return getObjectType(value) === "Error";
228
220
  }
229
221
  function hasPromiseApi(value) {
230
- return isFunction(value?.then) && isFunction(value?.catch);
222
+ return (
223
+ // eslint-disable-next-line @typescript-eslint/unbound-method
224
+ isFunction(value?.then) && isFunction(value?.catch)
225
+ );
231
226
  }
232
227
  function isNativePromise(value) {
233
228
  return getObjectType(value) === "Promise";
@@ -307,7 +302,7 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
307
302
  }
308
303
 
309
304
  // src/misc/waitFor.ts
310
- function waitFor(ms) {
305
+ async function waitFor(ms) {
311
306
  return new Promise((resolve) => setTimeout(resolve, ms));
312
307
  }
313
308
 
@@ -726,88 +721,18 @@ function sortObject(obj, options = {}) {
726
721
  return sortKeys(obj);
727
722
  }
728
723
 
729
- // node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
730
- var NUMBER_CHAR_RE = /\d/;
731
- var STR_SPLITTERS = ["-", "_", "/", "."];
732
- function isUppercase(char = "") {
733
- if (NUMBER_CHAR_RE.test(char)) {
734
- return void 0;
735
- }
736
- return char !== char.toLowerCase();
737
- }
738
- function splitByCase(str, separators) {
739
- const splitters = separators ?? STR_SPLITTERS;
740
- const parts = [];
741
- if (!str || typeof str !== "string") {
742
- return parts;
743
- }
744
- let buff = "";
745
- let previousUpper;
746
- let previousSplitter;
747
- for (const char of str) {
748
- const isSplitter = splitters.includes(char);
749
- if (isSplitter === true) {
750
- parts.push(buff);
751
- buff = "";
752
- previousUpper = void 0;
753
- continue;
754
- }
755
- const isUpper = isUppercase(char);
756
- if (previousSplitter === false) {
757
- if (previousUpper === false && isUpper === true) {
758
- parts.push(buff);
759
- buff = char;
760
- previousUpper = isUpper;
761
- continue;
762
- }
763
- if (previousUpper === true && isUpper === false && buff.length > 1) {
764
- const lastChar = buff.at(-1);
765
- parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
766
- buff = lastChar + char;
767
- previousUpper = isUpper;
768
- continue;
769
- }
770
- }
771
- buff += char;
772
- previousUpper = isUpper;
773
- previousSplitter = isSplitter;
774
- }
775
- parts.push(buff);
776
- return parts;
777
- }
778
- function upperFirst(str) {
779
- return str ? str[0].toUpperCase() + str.slice(1) : "";
780
- }
781
- function lowerFirst(str) {
782
- return str ? str[0].toLowerCase() + str.slice(1) : "";
783
- }
784
- function pascalCase(str, opts) {
785
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
786
- }
787
- function camelCase(str, opts) {
788
- return lowerFirst(pascalCase(str || "", opts));
789
- }
790
- function kebabCase(str, joiner) {
791
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
792
- }
793
- function snakeCase(str) {
794
- return kebabCase(str || "", "_");
795
- }
796
- function flatCase(str) {
797
- return kebabCase(str || "", "");
798
- }
799
- function trainCase(str, opts) {
800
- return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
801
- }
802
- var titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
803
- function titleCase(str, opts) {
804
- return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map(
805
- (p) => titleCaseExceptions.test(p) ? p.toLowerCase() : upperFirst(opts?.normalize ? p.toLowerCase() : p)
806
- ).join(" ");
807
- }
724
+ // src/vendor/index.ts
725
+ var vendor_exports = {};
726
+
727
+ // src/vendor/changeCase.ts
728
+ var changeCase_exports = {};
729
+ __reExport(changeCase_exports, require("change-case"));
808
730
 
809
- // src/vendor/scule.ts
810
- var capitalize = upperFirst;
731
+ // src/vendor/index.ts
732
+ __reExport(vendor_exports, changeCase_exports);
733
+
734
+ // src/index.ts
735
+ __reExport(index_exports, vendor_exports, module.exports);
811
736
 
812
737
  // src/module/interopDefault.ts
813
738
  async function interopDefault(mod) {
@@ -825,8 +750,6 @@ function resolveSubOptions(options, key) {
825
750
  NOOP,
826
751
  at,
827
752
  cAF,
828
- camelCase,
829
- capitalize,
830
753
  chunk,
831
754
  clamp,
832
755
  cleanObject,
@@ -837,7 +760,6 @@ function resolveSubOptions(options, key) {
837
760
  ensurePrefix,
838
761
  ensureSuffix,
839
762
  escapeHtml,
840
- flatCase,
841
763
  flattenArrayable,
842
764
  getObjectType,
843
765
  hasOwn,
@@ -876,19 +798,15 @@ function resolveSubOptions(options, key) {
876
798
  isSet,
877
799
  isString,
878
800
  isUndefined,
879
- isUppercase,
880
801
  isWhitespaceString,
881
802
  isZero,
882
803
  join,
883
- kebabCase,
884
804
  last,
885
- lowerFirst,
886
805
  mergeArrayable,
887
806
  minutes,
888
807
  noop,
889
808
  omit,
890
809
  once,
891
- pascalCase,
892
810
  pick,
893
811
  rAF,
894
812
  randomHexColor,
@@ -899,17 +817,12 @@ function resolveSubOptions(options, key) {
899
817
  resolveSubOptions,
900
818
  seconds,
901
819
  slash,
902
- snakeCase,
903
820
  sortObject,
904
- splitByCase,
905
821
  throttle,
906
- titleCase,
907
822
  toArray,
908
- trainCase,
909
823
  unindent,
910
824
  unique,
911
825
  uniqueBy,
912
- upperFirst,
913
826
  waitFor,
914
827
  warnOnce,
915
828
  weeks
package/dist/index.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import { upperFirst } from 'scule';
2
- export * from 'scule';
1
+ export * from 'change-case';
3
2
 
4
3
  /**
5
4
  * check if two values are deeply equal
@@ -119,7 +118,7 @@ declare function clamp(value: number, min?: number, max?: number): number;
119
118
  * // do somthing after 3 seconds
120
119
  * ```
121
120
  */
122
- declare function waitFor(ms: number): Promise<unknown>;
121
+ declare function waitFor(ms: number): Promise<void>;
123
122
 
124
123
  interface ThrottleDebounceOptions {
125
124
  /**
@@ -452,16 +451,6 @@ interface SortObjectOptions {
452
451
  */
453
452
  declare function sortObject<T extends Record<string, any>>(obj: T, options?: SortObjectOptions): T;
454
453
 
455
- /**
456
- * @file case utils
457
- * @module vendor
458
- */
459
-
460
- /**
461
- * @deprecated use upperFirst instead
462
- */
463
- declare const capitalize: typeof upperFirst;
464
-
465
454
  /**
466
455
  * Interop default export from a module
467
456
  *
@@ -524,4 +513,4 @@ interface RamdomNumberOptions {
524
513
  */
525
514
  declare function randomNumber(min: number, max?: number, options?: RamdomNumberOptions): number;
526
515
 
527
- export { type AnyFn, type Arrayable, type Awaitable, type Callable, type CleanObjectOptions, Color, type CreatePadStringOptions, type InteropModuleDefault, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type MayBe, NOOP, type NonEmptyString, type Nullable, type Overwrite, type Prettify, type PrettifyV2, type PrimitiveType, type RamdomNumberOptions, type ResolvedOptions, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, capitalize, chunk, clamp, cleanObject, createPadString, days, debounce, enhance, ensurePrefix, ensureSuffix, escapeHtml, flattenArrayable, getObjectType, hasOwn, hours, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBoolean, isBrowser, isDeepEqual, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFunction, isInteger, isIterable, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, isZero, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, resolveSubOptions, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
516
+ export { type AnyFn, type Arrayable, type Awaitable, type Callable, type CleanObjectOptions, Color, type CreatePadStringOptions, type InteropModuleDefault, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type MayBe, NOOP, type NonEmptyString, type Nullable, type Overwrite, type Prettify, type PrettifyV2, type PrimitiveType, type RamdomNumberOptions, type ResolvedOptions, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, chunk, clamp, cleanObject, createPadString, days, debounce, enhance, ensurePrefix, ensureSuffix, escapeHtml, flattenArrayable, getObjectType, hasOwn, hours, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBoolean, isBrowser, isDeepEqual, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFunction, isInteger, isIterable, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, isZero, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, resolveSubOptions, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { upperFirst } from 'scule';
2
- export * from 'scule';
1
+ export * from 'change-case';
3
2
 
4
3
  /**
5
4
  * check if two values are deeply equal
@@ -119,7 +118,7 @@ declare function clamp(value: number, min?: number, max?: number): number;
119
118
  * // do somthing after 3 seconds
120
119
  * ```
121
120
  */
122
- declare function waitFor(ms: number): Promise<unknown>;
121
+ declare function waitFor(ms: number): Promise<void>;
123
122
 
124
123
  interface ThrottleDebounceOptions {
125
124
  /**
@@ -452,16 +451,6 @@ interface SortObjectOptions {
452
451
  */
453
452
  declare function sortObject<T extends Record<string, any>>(obj: T, options?: SortObjectOptions): T;
454
453
 
455
- /**
456
- * @file case utils
457
- * @module vendor
458
- */
459
-
460
- /**
461
- * @deprecated use upperFirst instead
462
- */
463
- declare const capitalize: typeof upperFirst;
464
-
465
454
  /**
466
455
  * Interop default export from a module
467
456
  *
@@ -524,4 +513,4 @@ interface RamdomNumberOptions {
524
513
  */
525
514
  declare function randomNumber(min: number, max?: number, options?: RamdomNumberOptions): number;
526
515
 
527
- export { type AnyFn, type Arrayable, type Awaitable, type Callable, type CleanObjectOptions, Color, type CreatePadStringOptions, type InteropModuleDefault, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type MayBe, NOOP, type NonEmptyString, type Nullable, type Overwrite, type Prettify, type PrettifyV2, type PrimitiveType, type RamdomNumberOptions, type ResolvedOptions, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, capitalize, chunk, clamp, cleanObject, createPadString, days, debounce, enhance, ensurePrefix, ensureSuffix, escapeHtml, flattenArrayable, getObjectType, hasOwn, hours, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBoolean, isBrowser, isDeepEqual, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFunction, isInteger, isIterable, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, isZero, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, resolveSubOptions, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
516
+ export { type AnyFn, type Arrayable, type Awaitable, type Callable, type CleanObjectOptions, Color, type CreatePadStringOptions, type InteropModuleDefault, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type MayBe, NOOP, type NonEmptyString, type Nullable, type Overwrite, type Prettify, type PrettifyV2, type PrimitiveType, type RamdomNumberOptions, type ResolvedOptions, type SortObjectOptions, type ThrottleDebounceOptions, type Whitespace, at, cAF, chunk, clamp, cleanObject, createPadString, days, debounce, enhance, ensurePrefix, ensureSuffix, escapeHtml, flattenArrayable, getObjectType, hasOwn, hours, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBoolean, isBrowser, isDeepEqual, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFunction, isInteger, isIterable, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isUndefined, isWhitespaceString, isZero, join, last, mergeArrayable, minutes, noop, omit, once, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, resolveSubOptions, seconds, slash, sortObject, throttle, toArray, unindent, unique, uniqueBy, waitFor, warnOnce, weeks };
package/dist/index.js CHANGED
@@ -1,3 +1,106 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+
19
+ // src/index.ts
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ Color: () => Color,
23
+ NOOP: () => NOOP,
24
+ at: () => at,
25
+ cAF: () => cAF,
26
+ chunk: () => chunk,
27
+ clamp: () => clamp,
28
+ cleanObject: () => cleanObject,
29
+ createPadString: () => createPadString,
30
+ days: () => days,
31
+ debounce: () => debounce,
32
+ enhance: () => enhance,
33
+ ensurePrefix: () => ensurePrefix,
34
+ ensureSuffix: () => ensureSuffix,
35
+ escapeHtml: () => escapeHtml,
36
+ flattenArrayable: () => flattenArrayable,
37
+ getObjectType: () => getObjectType,
38
+ hasOwn: () => hasOwn,
39
+ hours: () => hours,
40
+ interopDefault: () => interopDefault,
41
+ intersect: () => intersect,
42
+ isArray: () => isArray,
43
+ isArrayEqual: () => isArrayEqual,
44
+ isBigInt: () => isBigInt,
45
+ isBoolean: () => isBoolean,
46
+ isBrowser: () => isBrowser,
47
+ isDeepEqual: () => isDeepEqual,
48
+ isEmptyArray: () => isEmptyArray,
49
+ isEmptyMap: () => isEmptyMap,
50
+ isEmptyObject: () => isEmptyObject,
51
+ isEmptySet: () => isEmptySet,
52
+ isEmptyString: () => isEmptyString,
53
+ isEmptyStringOrWhitespace: () => isEmptyStringOrWhitespace,
54
+ isError: () => isError,
55
+ isFunction: () => isFunction,
56
+ isInteger: () => isInteger,
57
+ isIterable: () => isIterable,
58
+ isMap: () => isMap,
59
+ isNaN: () => isNaN,
60
+ isNativePromise: () => isNativePromise,
61
+ isNil: () => isNil,
62
+ isNonEmptyArray: () => isNonEmptyArray,
63
+ isNonEmptyString: () => isNonEmptyString,
64
+ isNull: () => isNull,
65
+ isNullOrUndefined: () => isNullOrUndefined,
66
+ isNumber: () => isNumber,
67
+ isNumbericString: () => isNumbericString,
68
+ isObject: () => isObject,
69
+ isPromise: () => isPromise,
70
+ isRegExp: () => isRegExp,
71
+ isSet: () => isSet,
72
+ isString: () => isString,
73
+ isUndefined: () => isUndefined,
74
+ isWhitespaceString: () => isWhitespaceString,
75
+ isZero: () => isZero,
76
+ join: () => join,
77
+ last: () => last,
78
+ mergeArrayable: () => mergeArrayable,
79
+ minutes: () => minutes,
80
+ noop: () => noop,
81
+ omit: () => omit,
82
+ once: () => once,
83
+ pick: () => pick,
84
+ rAF: () => rAF,
85
+ randomHexColor: () => randomHexColor,
86
+ randomNumber: () => randomNumber,
87
+ randomRGBAColor: () => randomRGBAColor,
88
+ randomRGBColor: () => randomRGBColor,
89
+ randomString: () => randomString,
90
+ resolveSubOptions: () => resolveSubOptions,
91
+ seconds: () => seconds,
92
+ slash: () => slash,
93
+ sortObject: () => sortObject,
94
+ throttle: () => throttle,
95
+ toArray: () => toArray,
96
+ unindent: () => unindent,
97
+ unique: () => unique,
98
+ uniqueBy: () => uniqueBy,
99
+ waitFor: () => waitFor,
100
+ warnOnce: () => warnOnce,
101
+ weeks: () => weeks
102
+ });
103
+
1
104
  // src/is/isDeepEqual.ts
2
105
  function isDeepEqual(value1, value2) {
3
106
  const type1 = getObjectType(value1);
@@ -5,19 +108,22 @@ function isDeepEqual(value1, value2) {
5
108
  if (type1 !== type2) {
6
109
  return false;
7
110
  }
8
- if (isArray(value1)) {
111
+ if (isArray(value1) && isArray(value2)) {
9
112
  if (value1.length !== value2.length) {
10
113
  return false;
11
114
  }
12
115
  return value1.every((item, index) => isDeepEqual(item, value2[index]));
13
116
  }
14
- if (isObject(value1)) {
117
+ if (isObject(value1) && isObject(value2)) {
15
118
  const keys = Object.keys(value1);
16
119
  if (keys.length !== Object.keys(value2).length) {
17
120
  return false;
18
121
  }
19
122
  return keys.every(
20
- (key) => isDeepEqual(value1[key], value2[key])
123
+ (key) => isDeepEqual(
124
+ value1[key],
125
+ value2[key]
126
+ )
21
127
  );
22
128
  }
23
129
  return Object.is(value1, value2);
@@ -110,7 +216,10 @@ function isError(value) {
110
216
  return getObjectType(value) === "Error";
111
217
  }
112
218
  function hasPromiseApi(value) {
113
- return isFunction(value?.then) && isFunction(value?.catch);
219
+ return (
220
+ // eslint-disable-next-line @typescript-eslint/unbound-method
221
+ isFunction(value?.then) && isFunction(value?.catch)
222
+ );
114
223
  }
115
224
  function isNativePromise(value) {
116
225
  return getObjectType(value) === "Promise";
@@ -190,7 +299,7 @@ function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFI
190
299
  }
191
300
 
192
301
  // src/misc/waitFor.ts
193
- function waitFor(ms) {
302
+ async function waitFor(ms) {
194
303
  return new Promise((resolve) => setTimeout(resolve, ms));
195
304
  }
196
305
 
@@ -609,88 +718,19 @@ function sortObject(obj, options = {}) {
609
718
  return sortKeys(obj);
610
719
  }
611
720
 
612
- // node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
613
- var NUMBER_CHAR_RE = /\d/;
614
- var STR_SPLITTERS = ["-", "_", "/", "."];
615
- function isUppercase(char = "") {
616
- if (NUMBER_CHAR_RE.test(char)) {
617
- return void 0;
618
- }
619
- return char !== char.toLowerCase();
620
- }
621
- function splitByCase(str, separators) {
622
- const splitters = separators ?? STR_SPLITTERS;
623
- const parts = [];
624
- if (!str || typeof str !== "string") {
625
- return parts;
626
- }
627
- let buff = "";
628
- let previousUpper;
629
- let previousSplitter;
630
- for (const char of str) {
631
- const isSplitter = splitters.includes(char);
632
- if (isSplitter === true) {
633
- parts.push(buff);
634
- buff = "";
635
- previousUpper = void 0;
636
- continue;
637
- }
638
- const isUpper = isUppercase(char);
639
- if (previousSplitter === false) {
640
- if (previousUpper === false && isUpper === true) {
641
- parts.push(buff);
642
- buff = char;
643
- previousUpper = isUpper;
644
- continue;
645
- }
646
- if (previousUpper === true && isUpper === false && buff.length > 1) {
647
- const lastChar = buff.at(-1);
648
- parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
649
- buff = lastChar + char;
650
- previousUpper = isUpper;
651
- continue;
652
- }
653
- }
654
- buff += char;
655
- previousUpper = isUpper;
656
- previousSplitter = isSplitter;
657
- }
658
- parts.push(buff);
659
- return parts;
660
- }
661
- function upperFirst(str) {
662
- return str ? str[0].toUpperCase() + str.slice(1) : "";
663
- }
664
- function lowerFirst(str) {
665
- return str ? str[0].toLowerCase() + str.slice(1) : "";
666
- }
667
- function pascalCase(str, opts) {
668
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
669
- }
670
- function camelCase(str, opts) {
671
- return lowerFirst(pascalCase(str || "", opts));
672
- }
673
- function kebabCase(str, joiner) {
674
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
675
- }
676
- function snakeCase(str) {
677
- return kebabCase(str || "", "_");
678
- }
679
- function flatCase(str) {
680
- return kebabCase(str || "", "");
681
- }
682
- function trainCase(str, opts) {
683
- return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
684
- }
685
- var titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
686
- function titleCase(str, opts) {
687
- return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map(
688
- (p) => titleCaseExceptions.test(p) ? p.toLowerCase() : upperFirst(opts?.normalize ? p.toLowerCase() : p)
689
- ).join(" ");
690
- }
721
+ // src/vendor/index.ts
722
+ var vendor_exports = {};
723
+
724
+ // src/vendor/changeCase.ts
725
+ var changeCase_exports = {};
726
+ __reExport(changeCase_exports, change_case_star);
727
+ import * as change_case_star from "change-case";
728
+
729
+ // src/vendor/index.ts
730
+ __reExport(vendor_exports, changeCase_exports);
691
731
 
692
- // src/vendor/scule.ts
693
- var capitalize = upperFirst;
732
+ // src/index.ts
733
+ __reExport(index_exports, vendor_exports);
694
734
 
695
735
  // src/module/interopDefault.ts
696
736
  async function interopDefault(mod) {
@@ -707,8 +747,6 @@ export {
707
747
  NOOP,
708
748
  at,
709
749
  cAF,
710
- camelCase,
711
- capitalize,
712
750
  chunk,
713
751
  clamp,
714
752
  cleanObject,
@@ -719,7 +757,6 @@ export {
719
757
  ensurePrefix,
720
758
  ensureSuffix,
721
759
  escapeHtml,
722
- flatCase,
723
760
  flattenArrayable,
724
761
  getObjectType,
725
762
  hasOwn,
@@ -758,19 +795,15 @@ export {
758
795
  isSet,
759
796
  isString,
760
797
  isUndefined,
761
- isUppercase,
762
798
  isWhitespaceString,
763
799
  isZero,
764
800
  join,
765
- kebabCase,
766
801
  last,
767
- lowerFirst,
768
802
  mergeArrayable,
769
803
  minutes,
770
804
  noop,
771
805
  omit,
772
806
  once,
773
- pascalCase,
774
807
  pick,
775
808
  rAF,
776
809
  randomHexColor,
@@ -781,17 +814,12 @@ export {
781
814
  resolveSubOptions,
782
815
  seconds,
783
816
  slash,
784
- snakeCase,
785
817
  sortObject,
786
- splitByCase,
787
818
  throttle,
788
- titleCase,
789
819
  toArray,
790
- trainCase,
791
820
  unindent,
792
821
  unique,
793
822
  uniqueBy,
794
- upperFirst,
795
823
  waitFor,
796
824
  warnOnce,
797
825
  weeks
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/utils",
3
3
  "type": "module",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "description": "Common used utils.",
6
6
  "keywords": [
7
7
  "utils"
@@ -37,18 +37,18 @@
37
37
  ],
38
38
  "sideEffects": false,
39
39
  "dependencies": {
40
- "scule": "^1.3.0"
40
+ "change-case": "^5.4.4"
41
41
  },
42
42
  "devDependencies": {
43
- "@ntnyq/eslint-config": "^4.0.0-beta.3",
43
+ "@ntnyq/eslint-config": "^4.0.0-beta.4",
44
44
  "@ntnyq/prettier-config": "^2.0.0-beta.2",
45
45
  "@vitest/coverage-v8": "^3.0.5",
46
46
  "bumpp": "^10.0.3",
47
- "eslint": "^9.20.0",
47
+ "eslint": "^9.20.1",
48
48
  "husky": "^9.1.7",
49
49
  "nano-staged": "^0.8.0",
50
50
  "npm-run-all2": "^7.0.2",
51
- "prettier": "^3.5.0",
51
+ "prettier": "^3.5.1",
52
52
  "tsup": "^8.3.6",
53
53
  "typescript": "^5.7.3",
54
54
  "vitest": "^3.0.5"