@ntnyq/utils 0.5.2 → 0.6.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/dist/index.cjs +2 -16
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +2 -119
- package/package.json +6 -9
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,6 @@ 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"));
|
|
19
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
19
|
|
|
21
20
|
// src/index.ts
|
|
@@ -358,13 +357,13 @@ function debounce(delay, callback, options = {}) {
|
|
|
358
357
|
|
|
359
358
|
// src/misc/warnOnce.ts
|
|
360
359
|
var warned = /* @__PURE__ */ new Set();
|
|
361
|
-
|
|
360
|
+
function warnOnce(message) {
|
|
362
361
|
if (warned.has(message)) {
|
|
363
362
|
return;
|
|
364
363
|
}
|
|
365
364
|
warned.add(message);
|
|
366
365
|
console.warn(message);
|
|
367
|
-
}
|
|
366
|
+
}
|
|
368
367
|
|
|
369
368
|
// src/html/escapeHtml.ts
|
|
370
369
|
function escapeHtml(unsafe) {
|
|
@@ -721,19 +720,6 @@ function sortObject(obj, options = {}) {
|
|
|
721
720
|
return sortKeys(obj);
|
|
722
721
|
}
|
|
723
722
|
|
|
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"));
|
|
730
|
-
|
|
731
|
-
// src/vendor/index.ts
|
|
732
|
-
__reExport(vendor_exports, changeCase_exports);
|
|
733
|
-
|
|
734
|
-
// src/index.ts
|
|
735
|
-
__reExport(index_exports, vendor_exports, module.exports);
|
|
736
|
-
|
|
737
723
|
// src/module/interopDefault.ts
|
|
738
724
|
async function interopDefault(mod) {
|
|
739
725
|
const resolved = await mod;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export * from 'change-case';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* check if two values are deeply equal
|
|
5
3
|
*/
|
|
@@ -54,7 +52,7 @@ declare const noop: () => void;
|
|
|
54
52
|
/**
|
|
55
53
|
* Alias of {@link noop}.
|
|
56
54
|
*/
|
|
57
|
-
declare const NOOP:
|
|
55
|
+
declare const NOOP: typeof noop;
|
|
58
56
|
|
|
59
57
|
declare function once<T extends unknown[]>(func: (...args: T) => void): (this: unknown, ...args: T) => boolean;
|
|
60
58
|
|
|
@@ -141,7 +139,7 @@ declare function debounce<T extends ((...args: any[]) => undefined | void) | und
|
|
|
141
139
|
cancel: () => void;
|
|
142
140
|
};
|
|
143
141
|
|
|
144
|
-
declare
|
|
142
|
+
declare function warnOnce(message: string): void;
|
|
145
143
|
|
|
146
144
|
declare function escapeHtml(unsafe: string): string;
|
|
147
145
|
|
|
@@ -193,6 +191,19 @@ type JsonPrimitive = boolean | number | string | null;
|
|
|
193
191
|
*/
|
|
194
192
|
type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
195
193
|
|
|
194
|
+
/**
|
|
195
|
+
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
|
|
196
|
+
*
|
|
197
|
+
* @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609
|
|
198
|
+
*/
|
|
199
|
+
type LiteralUnion<Union extends Base, Base = string> = Union | (Base & {
|
|
200
|
+
zz_IGNORE_ME?: never;
|
|
201
|
+
});
|
|
202
|
+
/**
|
|
203
|
+
* Non empty object `{}`
|
|
204
|
+
*/
|
|
205
|
+
type NonEmptyObject<T> = T extends Record<string, never> ? never : T;
|
|
206
|
+
|
|
196
207
|
/**
|
|
197
208
|
* interop module
|
|
198
209
|
*/
|
|
@@ -513,4 +524,4 @@ interface RamdomNumberOptions {
|
|
|
513
524
|
*/
|
|
514
525
|
declare function randomNumber(min: number, max?: number, options?: RamdomNumberOptions): number;
|
|
515
526
|
|
|
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 };
|
|
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 LiteralUnion, type MayBe, NOOP, type NonEmptyObject, 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,3 @@
|
|
|
1
|
-
export * from 'change-case';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* check if two values are deeply equal
|
|
5
3
|
*/
|
|
@@ -54,7 +52,7 @@ declare const noop: () => void;
|
|
|
54
52
|
/**
|
|
55
53
|
* Alias of {@link noop}.
|
|
56
54
|
*/
|
|
57
|
-
declare const NOOP:
|
|
55
|
+
declare const NOOP: typeof noop;
|
|
58
56
|
|
|
59
57
|
declare function once<T extends unknown[]>(func: (...args: T) => void): (this: unknown, ...args: T) => boolean;
|
|
60
58
|
|
|
@@ -141,7 +139,7 @@ declare function debounce<T extends ((...args: any[]) => undefined | void) | und
|
|
|
141
139
|
cancel: () => void;
|
|
142
140
|
};
|
|
143
141
|
|
|
144
|
-
declare
|
|
142
|
+
declare function warnOnce(message: string): void;
|
|
145
143
|
|
|
146
144
|
declare function escapeHtml(unsafe: string): string;
|
|
147
145
|
|
|
@@ -193,6 +191,19 @@ type JsonPrimitive = boolean | number | string | null;
|
|
|
193
191
|
*/
|
|
194
192
|
type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
195
193
|
|
|
194
|
+
/**
|
|
195
|
+
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
|
|
196
|
+
*
|
|
197
|
+
* @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609
|
|
198
|
+
*/
|
|
199
|
+
type LiteralUnion<Union extends Base, Base = string> = Union | (Base & {
|
|
200
|
+
zz_IGNORE_ME?: never;
|
|
201
|
+
});
|
|
202
|
+
/**
|
|
203
|
+
* Non empty object `{}`
|
|
204
|
+
*/
|
|
205
|
+
type NonEmptyObject<T> = T extends Record<string, never> ? never : T;
|
|
206
|
+
|
|
196
207
|
/**
|
|
197
208
|
* interop module
|
|
198
209
|
*/
|
|
@@ -513,4 +524,4 @@ interface RamdomNumberOptions {
|
|
|
513
524
|
*/
|
|
514
525
|
declare function randomNumber(min: number, max?: number, options?: RamdomNumberOptions): number;
|
|
515
526
|
|
|
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 };
|
|
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 LiteralUnion, type MayBe, NOOP, type NonEmptyObject, 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,106 +1,3 @@
|
|
|
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
|
-
|
|
104
1
|
// src/is/isDeepEqual.ts
|
|
105
2
|
function isDeepEqual(value1, value2) {
|
|
106
3
|
const type1 = getObjectType(value1);
|
|
@@ -355,13 +252,13 @@ function debounce(delay, callback, options = {}) {
|
|
|
355
252
|
|
|
356
253
|
// src/misc/warnOnce.ts
|
|
357
254
|
var warned = /* @__PURE__ */ new Set();
|
|
358
|
-
|
|
255
|
+
function warnOnce(message) {
|
|
359
256
|
if (warned.has(message)) {
|
|
360
257
|
return;
|
|
361
258
|
}
|
|
362
259
|
warned.add(message);
|
|
363
260
|
console.warn(message);
|
|
364
|
-
}
|
|
261
|
+
}
|
|
365
262
|
|
|
366
263
|
// src/html/escapeHtml.ts
|
|
367
264
|
function escapeHtml(unsafe) {
|
|
@@ -718,20 +615,6 @@ function sortObject(obj, options = {}) {
|
|
|
718
615
|
return sortKeys(obj);
|
|
719
616
|
}
|
|
720
617
|
|
|
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);
|
|
731
|
-
|
|
732
|
-
// src/index.ts
|
|
733
|
-
__reExport(index_exports, vendor_exports);
|
|
734
|
-
|
|
735
618
|
// src/module/interopDefault.ts
|
|
736
619
|
async function interopDefault(mod) {
|
|
737
620
|
const resolved = await mod;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"description": "Common used utils.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"utils"
|
|
@@ -36,13 +36,10 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"sideEffects": false,
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"change-case": "^5.4.4"
|
|
41
|
-
},
|
|
42
39
|
"devDependencies": {
|
|
43
|
-
"@ntnyq/eslint-config": "^4.0.0-beta.
|
|
44
|
-
"@ntnyq/prettier-config": "^2.0.0
|
|
45
|
-
"@vitest/coverage-v8": "^3.0.
|
|
40
|
+
"@ntnyq/eslint-config": "^4.0.0-beta.7",
|
|
41
|
+
"@ntnyq/prettier-config": "^2.0.0",
|
|
42
|
+
"@vitest/coverage-v8": "^3.0.6",
|
|
46
43
|
"bumpp": "^10.0.3",
|
|
47
44
|
"eslint": "^9.20.1",
|
|
48
45
|
"husky": "^9.1.7",
|
|
@@ -51,13 +48,13 @@
|
|
|
51
48
|
"prettier": "^3.5.1",
|
|
52
49
|
"tsup": "^8.3.6",
|
|
53
50
|
"typescript": "^5.7.3",
|
|
54
|
-
"vitest": "^3.0.
|
|
51
|
+
"vitest": "^3.0.6"
|
|
55
52
|
},
|
|
56
53
|
"engines": {
|
|
57
54
|
"node": ">=18.18.0"
|
|
58
55
|
},
|
|
59
56
|
"nano-staged": {
|
|
60
|
-
"*.{js,ts,mjs,cjs,
|
|
57
|
+
"*.{js,ts,mjs,cjs,md,yml,yaml,json}": "eslint --fix"
|
|
61
58
|
},
|
|
62
59
|
"scripts": {
|
|
63
60
|
"build": "tsup",
|