@ntnyq/utils 0.11.2 → 0.11.4

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.d.ts CHANGED
@@ -25,7 +25,7 @@ declare const NOOP: typeof noop;
25
25
  * initialize() // Logs: 'Initialized', returns true
26
26
  * ```
27
27
  */
28
- declare function once<T extends unknown[]>(func: (...args: T) => void): (this: unknown, ...args: T) => boolean;
28
+ declare function once<T extends unknown[]>(func: (...args: T) => void): (...args: T) => boolean;
29
29
  //#endregion
30
30
  //#region src/is/dom.d.ts
31
31
  /**
@@ -89,6 +89,14 @@ type UrlString = string & {
89
89
  };
90
90
  declare function isUrlString(value: unknown): value is UrlString;
91
91
  //#endregion
92
+ //#region src/is/isAllEmpty.d.ts
93
+ /**
94
+ * Check if value is empty
95
+ * @param value - The value to check
96
+ * @returns True if the value is `null`, `undefined`, empty string, empty array, empty object, empty set, empty map, false otherwise
97
+ */
98
+ declare function isAllEmpty(value: unknown): boolean;
99
+ //#endregion
92
100
  //#region src/is/isDeepEqual.d.ts
93
101
  /**
94
102
  * check if two values are deeply equal
@@ -1009,4 +1017,4 @@ declare const RE_LINE_COMMENT: RegExp;
1009
1017
  */
1010
1018
  declare const RE_BLOCK_COMMENT: RegExp;
1011
1019
  //#endregion
1012
- export { AnyFn, Arrayable, Awaitable, Callable, CleanObjectOptions, Color, CreatePadStringOptions, DeepRequired, ElementOf, FlatTreeOptions, GetStringSimilarityOptions, InteropModuleDefault, JsonArray, JsonObject, JsonPrimitive, JsonValue, LiteralUnion, MayBe, Merge, NOOP, NonEmptyObject, NonEmptyString, Nullable, OpenExternalURLOptions, Overwrite, Prettify, PrettifyV2, Primitive, RE_BLOCK_COMMENT, RE_COMMENTS, RE_LINE_COMMENT, RamdomNumberOptions, ResolvedOptions, SPECIAL_CHAR, STORAGE_UNITS, SortObjectOptions, StorageUnit, TIME_UNITS, ThrottleDebounceOptions, TimeUnit, ToIntegerOptions, UrlString, ValueOf, Whitespace, at, cAF, chunk, clamp, cleanObject, convertFromBytes, convertFromMilliseconds, convertStorageUnit, convertTimeUnit, convertToBytes, convertToMilliseconds, createPadString, debounce, enhance, ensurePrefix, ensureSuffix, escapeHTML, escapeStringRegexp, flatTree, flattenArrayable, getFileExtension, getObjectType, getRoot, getStringLength, getStringSimilarity, hasOwn, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBlob, isBoolean, isBrowser, isDeepEqual, isElementVisibleInViewport, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFile, isFormData, isFunction, isHTMLElement, isInteger, isIterable, isKeyOf, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isTruthy, isUndefined, isUrlString, isWhitespaceString, isZero, join, last, mergeArrayable, noop, omit, once, openExternalURL, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, remove, removeFileExtension, resolveSubOptions, scrollElementIntoView, shuffle, slash, slugify, sortObject, throttle, toArray, toInteger, toNumber, unescapeHTML, unindent, unique, uniqueBy, waitFor, warnOnce };
1020
+ export { AnyFn, Arrayable, Awaitable, Callable, CleanObjectOptions, Color, CreatePadStringOptions, DeepRequired, ElementOf, FlatTreeOptions, GetStringSimilarityOptions, InteropModuleDefault, JsonArray, JsonObject, JsonPrimitive, JsonValue, LiteralUnion, MayBe, Merge, NOOP, NonEmptyObject, NonEmptyString, Nullable, OpenExternalURLOptions, Overwrite, Prettify, PrettifyV2, Primitive, RE_BLOCK_COMMENT, RE_COMMENTS, RE_LINE_COMMENT, RamdomNumberOptions, ResolvedOptions, SPECIAL_CHAR, STORAGE_UNITS, SortObjectOptions, StorageUnit, TIME_UNITS, ThrottleDebounceOptions, TimeUnit, ToIntegerOptions, UrlString, ValueOf, Whitespace, at, cAF, chunk, clamp, cleanObject, convertFromBytes, convertFromMilliseconds, convertStorageUnit, convertTimeUnit, convertToBytes, convertToMilliseconds, createPadString, debounce, enhance, ensurePrefix, ensureSuffix, escapeHTML, escapeStringRegexp, flatTree, flattenArrayable, getFileExtension, getObjectType, getRoot, getStringLength, getStringSimilarity, hasOwn, interopDefault, intersect, isAllEmpty, isArray, isArrayEqual, isBigInt, isBlob, isBoolean, isBrowser, isDeepEqual, isElementVisibleInViewport, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFile, isFormData, isFunction, isHTMLElement, isInteger, isIterable, isKeyOf, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isTruthy, isUndefined, isUrlString, isWhitespaceString, isZero, join, last, mergeArrayable, noop, omit, once, openExternalURL, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, remove, removeFileExtension, resolveSubOptions, scrollElementIntoView, shuffle, slash, slugify, sortObject, throttle, toArray, toInteger, toNumber, unescapeHTML, unindent, unique, uniqueBy, waitFor, warnOnce };
package/dist/index.js CHANGED
@@ -182,6 +182,17 @@ function isUrlString(value) {
182
182
  }
183
183
  }
184
184
  //#endregion
185
+ //#region src/is/isAllEmpty.ts
186
+ /**
187
+ * Check if value is empty
188
+ * @param value - The value to check
189
+ * @returns True if the value is `null`, `undefined`, empty string, empty array, empty object, empty set, empty map, false otherwise
190
+ */
191
+ function isAllEmpty(value) {
192
+ if (isNull(value) || isUndefined(value) || isEmptyString(value) || isEmptyArray(value) || isEmptySet(value) || isEmptyMap(value) || isEmptyObject(value)) return true;
193
+ return false;
194
+ }
195
+ //#endregion
185
196
  //#region src/is/isDeepEqual.ts
186
197
  /**
187
198
  * check if two values are deeply equal
@@ -340,7 +351,8 @@ function cAF(id) {
340
351
  * @returns the new value
341
352
  */
342
353
  function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY) {
343
- return Math.min(Math.max(value, min), max);
354
+ const [low, high] = [Math.min(min, max), Math.max(min, max)];
355
+ return Math.min(Math.max(value, low), high);
344
356
  }
345
357
  //#endregion
346
358
  //#region src/misc/waitFor.ts
@@ -1252,4 +1264,4 @@ const RE_LINE_COMMENT = /\/\/.*/;
1252
1264
  */
1253
1265
  const RE_BLOCK_COMMENT = /\/\*[\s\S]*?\*\//g;
1254
1266
  //#endregion
1255
- export { Color, NOOP, RE_BLOCK_COMMENT, RE_COMMENTS, RE_LINE_COMMENT, SPECIAL_CHAR, STORAGE_UNITS, TIME_UNITS, at, cAF, chunk, clamp, cleanObject, convertFromBytes, convertFromMilliseconds, convertStorageUnit, convertTimeUnit, convertToBytes, convertToMilliseconds, createPadString, debounce, enhance, ensurePrefix, ensureSuffix, escapeHTML, escapeStringRegexp, flatTree, flattenArrayable, getFileExtension, getObjectType, getRoot, getStringLength, getStringSimilarity, hasOwn, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBlob, isBoolean, isBrowser, isDeepEqual, isElementVisibleInViewport, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFile, isFormData, isFunction, isHTMLElement, isInteger, isIterable, isKeyOf, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isTruthy, isUndefined, isUrlString, isWhitespaceString, isZero, join, last, mergeArrayable, noop, omit, once, openExternalURL, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, remove, removeFileExtension, resolveSubOptions, scrollElementIntoView, shuffle, slash, slugify, sortObject, throttle, toArray, toInteger, toNumber, unescapeHTML, unindent, unique, uniqueBy, waitFor, warnOnce };
1267
+ export { Color, NOOP, RE_BLOCK_COMMENT, RE_COMMENTS, RE_LINE_COMMENT, SPECIAL_CHAR, STORAGE_UNITS, TIME_UNITS, at, cAF, chunk, clamp, cleanObject, convertFromBytes, convertFromMilliseconds, convertStorageUnit, convertTimeUnit, convertToBytes, convertToMilliseconds, createPadString, debounce, enhance, ensurePrefix, ensureSuffix, escapeHTML, escapeStringRegexp, flatTree, flattenArrayable, getFileExtension, getObjectType, getRoot, getStringLength, getStringSimilarity, hasOwn, interopDefault, intersect, isAllEmpty, isArray, isArrayEqual, isBigInt, isBlob, isBoolean, isBrowser, isDeepEqual, isElementVisibleInViewport, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFile, isFormData, isFunction, isHTMLElement, isInteger, isIterable, isKeyOf, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isTruthy, isUndefined, isUrlString, isWhitespaceString, isZero, join, last, mergeArrayable, noop, omit, once, openExternalURL, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, remove, removeFileExtension, resolveSubOptions, scrollElementIntoView, shuffle, slash, slugify, sortObject, throttle, toArray, toInteger, toNumber, unescapeHTML, unindent, unique, uniqueBy, waitFor, warnOnce };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntnyq/utils",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Common used utils.",
5
5
  "keywords": [
6
6
  "utils"
@@ -31,15 +31,15 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@ntnyq/tsconfig": "^3.1.0",
34
- "@typescript/native-preview": "^7.0.0-dev.20260320.1",
34
+ "@typescript/native-preview": "^7.0.0-dev.20260401.1",
35
35
  "bumpp": "^11.0.1",
36
36
  "husky": "^9.1.7",
37
37
  "nano-staged": "^0.9.0",
38
38
  "npm-run-all2": "^8.0.4",
39
- "oxfmt": "^0.41.0",
40
- "oxlint": "^1.56.0",
41
- "tsdown": "^0.21.4",
42
- "vitest": "^4.1.0"
39
+ "oxfmt": "^0.43.0",
40
+ "oxlint": "^1.58.0",
41
+ "tsdown": "^0.21.7",
42
+ "vitest": "^4.1.2"
43
43
  },
44
44
  "nano-staged": {
45
45
  "*.{js,ts,mjs,tsx}": "oxlint --fix",