@omnific/utils 0.4.0 → 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.
Files changed (71) hide show
  1. package/dist/@types/GetFieldType.d.ts +1 -2
  2. package/dist/@types/Many.d.ts +1 -3
  3. package/dist/@types/PropertyPath.d.ts +1 -3
  4. package/dist/_internal/isDeepKey.js +1 -2
  5. package/dist/_internal/isUnsafeProperty.js +1 -2
  6. package/dist/_internal/toKey.js +1 -2
  7. package/dist/buildURL.d.ts +20 -0
  8. package/dist/buildURL.js +39 -0
  9. package/dist/createChainedFunction.d.ts +0 -2
  10. package/dist/createChainedFunction.js +1 -2
  11. package/dist/createEmitter.d.ts +23 -0
  12. package/dist/createEmitter.js +28 -0
  13. package/dist/debounce.d.ts +1 -3
  14. package/dist/debounce.js +3 -4
  15. package/dist/get.d.ts +1 -3
  16. package/dist/get.js +6 -7
  17. package/dist/hasValue.d.ts +0 -2
  18. package/dist/hasValue.js +1 -2
  19. package/dist/isArray.d.ts +1 -3
  20. package/dist/isArray.js +1 -2
  21. package/dist/isArrayBuffer.d.ts +1 -3
  22. package/dist/isArrayBuffer.js +1 -2
  23. package/dist/isArrayEmpty.d.ts +1 -3
  24. package/dist/isArrayEmpty.js +2 -3
  25. package/dist/isBlob.d.ts +1 -3
  26. package/dist/isBlob.js +1 -2
  27. package/dist/isBoolean.d.ts +1 -3
  28. package/dist/isBoolean.js +1 -2
  29. package/dist/isFormData.d.ts +1 -3
  30. package/dist/isFormData.js +1 -2
  31. package/dist/isFunction.d.ts +1 -3
  32. package/dist/isFunction.js +1 -2
  33. package/dist/isNil.d.ts +1 -3
  34. package/dist/isNil.js +1 -2
  35. package/dist/isNull.d.ts +1 -3
  36. package/dist/isNull.js +1 -2
  37. package/dist/isNumber.d.ts +1 -3
  38. package/dist/isNumber.js +1 -2
  39. package/dist/isObject.d.ts +1 -3
  40. package/dist/isObject.js +1 -2
  41. package/dist/isPlainObject.d.ts +1 -3
  42. package/dist/isPlainObject.js +2 -3
  43. package/dist/isPromise.d.ts +1 -3
  44. package/dist/isPromise.js +2 -3
  45. package/dist/isString.d.ts +1 -3
  46. package/dist/isString.js +1 -2
  47. package/dist/isStringEmpty.d.ts +1 -3
  48. package/dist/isStringEmpty.js +2 -3
  49. package/dist/isSymbol.d.ts +1 -3
  50. package/dist/isSymbol.js +1 -2
  51. package/dist/isURLSearchParameters.d.ts +1 -3
  52. package/dist/isURLSearchParameters.js +1 -2
  53. package/dist/isUndefined.d.ts +1 -3
  54. package/dist/isUndefined.js +1 -2
  55. package/dist/kebabCase.d.ts +1 -3
  56. package/dist/kebabCase.js +1 -2
  57. package/dist/main.d.ts +17 -14
  58. package/dist/main.js +11 -8
  59. package/dist/noop.d.ts +4 -0
  60. package/dist/noop.js +6 -0
  61. package/dist/parseJson.d.ts +1 -3
  62. package/dist/parseJson.js +1 -2
  63. package/dist/resolveValue.d.ts +0 -2
  64. package/dist/resolveValue.js +1 -2
  65. package/dist/throttle.d.ts +1 -3
  66. package/dist/throttle.js +2 -3
  67. package/dist/uniqueId.d.ts +1 -3
  68. package/dist/uniqueId.js +1 -2
  69. package/dist/utils/toPath.js +2 -3
  70. package/dist/utils/toString.js +2 -3
  71. package/package.json +4 -3
@@ -1,4 +1,3 @@
1
- //#region @types/GetFieldType.d.ts
2
1
  type GetFieldTypeOfArrayLikeByKey<T extends unknown[], K> = K extends number ? T[K] : K extends `${infer N extends number}` ? T[N] : K extends keyof T ? T[K] : undefined;
3
2
  type GetFieldTypeOfStringByKey<T extends string, K> = K extends number ? T[K] : K extends `${infer N extends number}` ? T[N] : K extends keyof T ? T[K] : undefined;
4
3
  type GetFieldTypeOfNarrowedByKey<T, K> = T extends unknown[] ? GetFieldTypeOfArrayLikeByKey<T, K> : T extends string ? GetFieldTypeOfStringByKey<T, K> : K extends keyof T ? T[K] : K extends number ? `${K}` extends keyof T ? T[`${K}`] : undefined : K extends `${infer N extends number}` ? N extends keyof T ? T[N] : undefined : undefined;
@@ -12,4 +11,4 @@ type GetFieldTypeOfPrimitive<T, X, XT extends 'DotPath' | 'Key' | 'Path'> = Extr
12
11
  * 解析指定键、点路径或括号路径对应的值类型。
13
12
  */
14
13
  export type GetFieldType<T, X, XT extends 'DotPath' | 'Key' | 'Path' = 'Path'> = Extract<T, object> extends never ? GetFieldTypeOfPrimitive<T, X, XT> : GetFieldTypeOfPrimitive<Exclude<T, object>, X, XT> | GetFieldTypeOfObject<Extract<T, object>, X, XT>;
15
- //#endregion
14
+ export {};
@@ -1,6 +1,4 @@
1
- //#region @types/Many.d.ts
2
1
  /**
3
2
  * 表示单个值或只读值列表。
4
3
  */
5
- export type Many<T> = T | readonly T[];
6
- //#endregion
4
+ export type Many<T> = T | readonly T[];
@@ -1,7 +1,5 @@
1
1
  import { Many } from "./Many.js";
2
- //#region @types/PropertyPath.d.ts
3
2
  /**
4
3
  * 用于对象路径访问的单个属性键或只读属性键列表。
5
4
  */
6
- export type PropertyPath = Many<PropertyKey>;
7
- //#endregion
5
+ export type PropertyPath = Many<PropertyKey>;
@@ -1,5 +1,5 @@
1
1
  import { isString } from "../isString.js";
2
- //#region _internal/isDeepKey.ts
2
+ // _internal/isDeepKey.ts
3
3
  /**
4
4
  * Checks if a given key is a deep key.
5
5
  *
@@ -20,5 +20,4 @@ import { isString } from "../isString.js";
20
20
  function isDeepKey(key) {
21
21
  return isString(key) ? key.includes(".") || key.includes("[") || key.includes("]") : false;
22
22
  }
23
- //#endregion
24
23
  export { isDeepKey };
@@ -1,4 +1,4 @@
1
- //#region _internal/isUnsafeProperty.ts
1
+ // _internal/isUnsafeProperty.ts
2
2
  /**
3
3
  * Checks if a property key is unsafe to modify directly.
4
4
  *
@@ -12,5 +12,4 @@
12
12
  function isUnsafeProperty(key) {
13
13
  return key === "__proto__";
14
14
  }
15
- //#endregion
16
15
  export { isUnsafeProperty };
@@ -1,6 +1,6 @@
1
1
  import { isString } from "../isString.js";
2
2
  import { isSymbol } from "../isSymbol.js";
3
- //#region _internal/toKey.ts
3
+ // _internal/toKey.ts
4
4
  /**
5
5
  * 将属性路径片段规范化为字符串键。
6
6
  */
@@ -17,5 +17,4 @@ function normalizeKey(path) {
17
17
  function toKey(value) {
18
18
  return isString(value) || isSymbol(value) ? value : normalizeKey(value);
19
19
  }
20
- //#endregion
21
20
  export { normalizeKey, toKey };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 查询参数序列化时接受的基础值类型。
3
+ */
4
+ export type QueryValue = string | number | boolean | null | undefined;
5
+ /**
6
+ * 查询参数映射。
7
+ */
8
+ export type QueryParameters = Record<string, QueryValue | readonly QueryValue[]>;
9
+ /**
10
+ * buildURL 接受的查询参数。
11
+ */
12
+ export type QueryInput = QueryParameters | URLSearchParams | string;
13
+ /**
14
+ * 将查询参数追加到 URL。
15
+ *
16
+ * - 支持对象、URLSearchParams 和原始查询字符串。
17
+ * - 对象中的 null/undefined 会被跳过,数组会展开为重复参数。
18
+ * - 保留已有查询参数,并按现有 request 行为移除 hash。
19
+ */
20
+ export declare function buildURL(url: string, parameters?: QueryInput): string;
@@ -0,0 +1,39 @@
1
+ import hasValue from "./hasValue.js";
2
+ import { isNil } from "./isNil.js";
3
+ import { isString } from "./isString.js";
4
+ import { isStringEmpty } from "./isStringEmpty.js";
5
+ import { isURLSearchParameters } from "./isURLSearchParameters.js";
6
+ // buildURL.ts
7
+ function serializeParameters(parameters) {
8
+ if (isString(parameters)) return new URLSearchParams(parameters).toString();
9
+ if (isURLSearchParameters(parameters)) return parameters.toString();
10
+ const searchParameters = new URLSearchParams();
11
+ const keys = Object.keys(parameters);
12
+ for (let index = 0; index < keys.length; index += 1) {
13
+ const key = keys[index];
14
+ const value = parameters[key];
15
+ if (isNil(value)) continue;
16
+ if (Array.isArray(value)) {
17
+ for (const item of value) if (hasValue(item)) searchParameters.append(key, String(item));
18
+ continue;
19
+ }
20
+ searchParameters.append(key, String(value));
21
+ }
22
+ return searchParameters.toString();
23
+ }
24
+ /**
25
+ * 将查询参数追加到 URL。
26
+ *
27
+ * - 支持对象、URLSearchParams 和原始查询字符串。
28
+ * - 对象中的 null/undefined 会被跳过,数组会展开为重复参数。
29
+ * - 保留已有查询参数,并按现有 request 行为移除 hash。
30
+ */
31
+ function buildURL(url, parameters) {
32
+ if (isNil(parameters)) return url;
33
+ const serializedParameters = serializeParameters(parameters);
34
+ if (isStringEmpty(serializedParameters)) return url;
35
+ const hashMarkIndex = url.indexOf("#");
36
+ const nextURL = hashMarkIndex === -1 ? url : url.slice(0, hashMarkIndex);
37
+ return `${nextURL}${nextURL.includes("?") ? "&" : "?"}${serializedParameters}`;
38
+ }
39
+ export { buildURL };
@@ -1,4 +1,3 @@
1
- //#region createChainedFunction.d.ts
2
1
  /**
3
2
  * A function with a bound `this` context and variadic arguments.
4
3
  */
@@ -15,5 +14,4 @@ export type ChainedFunction<TArguments extends any[], TThis> = (this: TThis, ...
15
14
  * @returns {ChainedFunction<TArgs, TThis>} A single chained callback.
16
15
  */
17
16
  export declare function createChainedFunction<TArguments extends any[], TThis>(...funcs: Array<ChainedFunction<TArguments, TThis> | null | undefined>): ChainedFunction<TArguments, TThis>;
18
- //#endregion
19
17
  export { createChainedFunction as default };
@@ -1,7 +1,7 @@
1
1
  import { isArrayEmpty } from "./isArrayEmpty.js";
2
2
  import hasValue from "./hasValue.js";
3
3
  import { isFunction } from "./isFunction.js";
4
- //#region createChainedFunction.ts
4
+ // createChainedFunction.ts
5
5
  /**
6
6
  * Composes multiple callbacks into a single callback while preserving `this`.
7
7
  *
@@ -24,5 +24,4 @@ function createChainedFunction(...funcs) {
24
24
  for (const function_ of validFuncs) function_.apply(this, arguments_);
25
25
  };
26
26
  }
27
- //#endregion
28
27
  export { createChainedFunction, createChainedFunction as default };
@@ -0,0 +1,23 @@
1
+ /** 发射器订阅者。 */
2
+ export type EmitterListener<T> = (value: T) => void;
3
+ /** 提供订阅能力的对象。 */
4
+ export interface Subscribable<T = void> {
5
+ /** 订阅变化,返回取消订阅函数。 */
6
+ readonly subscribe: (listener: EmitterListener<T>) => () => void;
7
+ }
8
+ /** 单通道变更发射器。 */
9
+ export interface Emitter<T = void> extends Subscribable<T> {
10
+ /** 通知所有订阅者。 */
11
+ readonly emit: (value: T) => void;
12
+ }
13
+ /**
14
+ * 创建单通道变更发射器。
15
+ *
16
+ * 只负责保存订阅者并在 `emit` 时逐个触发,不包含状态与通知时机。
17
+ *
18
+ * @example
19
+ * const emitter = createEmitter<string>();
20
+ * const unsubscribe = emitter.subscribe(value => console.log(value));
21
+ * emitter.emit('ready');
22
+ */
23
+ export declare const createEmitter: <T = void>() => Emitter<T>;
@@ -0,0 +1,28 @@
1
+ // createEmitter.ts
2
+ /**
3
+ * 创建单通道变更发射器。
4
+ *
5
+ * 只负责保存订阅者并在 `emit` 时逐个触发,不包含状态与通知时机。
6
+ *
7
+ * @example
8
+ * const emitter = createEmitter<string>();
9
+ * const unsubscribe = emitter.subscribe(value => console.log(value));
10
+ * emitter.emit('ready');
11
+ */
12
+ const createEmitter = () => {
13
+ const listeners = /* @__PURE__ */ new Set();
14
+ const subscribe = (listener) => {
15
+ listeners.add(listener);
16
+ return () => {
17
+ listeners.delete(listener);
18
+ };
19
+ };
20
+ const emit = (value) => {
21
+ for (const listener of listeners) listener(value);
22
+ };
23
+ return {
24
+ subscribe,
25
+ emit
26
+ };
27
+ };
28
+ export { createEmitter };
@@ -1,4 +1,3 @@
1
- //#region debounce.d.ts
2
1
  /**
3
2
  * 控制防抖函数何时调用或取消的选项。
4
3
  */
@@ -76,5 +75,4 @@ export interface DebouncedFunction<F extends (...arguments_: any[]) => void> {
76
75
  * // Will cancel the debounced function call
77
76
  * controller.abort();
78
77
  */
79
- export declare function debounce<F extends (...arguments_: any[]) => void>(function_: F, debounceMs: number, { signal, edges }?: DebounceOptions): DebouncedFunction<F>;
80
- //#endregion
78
+ export declare function debounce<F extends (...arguments_: any[]) => void>(function_: F, debounceMs: number, { signal, edges }?: DebounceOptions): DebouncedFunction<F>;
package/dist/debounce.js CHANGED
@@ -1,7 +1,7 @@
1
- import { isUndefined } from "./isUndefined.js";
2
- import { isNil } from "./isNil.js";
3
1
  import hasValue from "./hasValue.js";
4
- //#region debounce.ts
2
+ import { isNil } from "./isNil.js";
3
+ import { isUndefined } from "./isUndefined.js";
4
+ // debounce.ts
5
5
  /**
6
6
  * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
7
7
  * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
@@ -86,5 +86,4 @@ function debounce(function_, debounceMs, { signal, edges } = {}) {
86
86
  signal?.addEventListener("abort", cancel, { once: true });
87
87
  return debounced;
88
88
  }
89
- //#endregion
90
89
  export { debounce };
package/dist/get.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { GetFieldType } from "./@types/GetFieldType.js";
2
2
  import { PropertyPath } from "./@types/PropertyPath.js";
3
- //#region get.d.ts
4
3
  /**
5
4
  * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
6
5
  *
@@ -322,5 +321,4 @@ export declare function get<TObject, TPath extends string, TDefault = GetFieldTy
322
321
  * get(object, 'a.b.c', 'default');
323
322
  * // => 1
324
323
  */
325
- export declare function get(object: any, path: PropertyPath, defaultValue?: any): any;
326
- //#endregion
324
+ export declare function get(object: any, path: PropertyPath, defaultValue?: any): any;
package/dist/get.js CHANGED
@@ -1,14 +1,14 @@
1
- import { isUndefined } from "./isUndefined.js";
2
- import { isNil } from "./isNil.js";
3
1
  import { isArrayEmpty } from "./isArrayEmpty.js";
4
- import { isNumber } from "./isNumber.js";
5
- import { isString } from "./isString.js";
2
+ import { isUndefined } from "./isUndefined.js";
6
3
  import { isUnsafeProperty } from "./_internal/isUnsafeProperty.js";
7
4
  import { isDeepKey } from "./_internal/isDeepKey.js";
8
- import { isSymbol } from "./isSymbol.js";
5
+ import { isNil } from "./isNil.js";
6
+ import { isNumber } from "./isNumber.js";
9
7
  import { normalizeKey, toKey } from "./_internal/toKey.js";
10
8
  import { toPath } from "./utils/toPath.js";
11
- //#region get.ts
9
+ import { isString } from "./isString.js";
10
+ import { isSymbol } from "./isSymbol.js";
11
+ // get.ts
12
12
  /**
13
13
  * Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
14
14
  *
@@ -54,5 +54,4 @@ function getDirect(object, key, defaultValue) {
54
54
  const result = object[key];
55
55
  return isUndefined(result) ? defaultValue : result;
56
56
  }
57
- //#endregion
58
57
  export { get };
@@ -1,4 +1,3 @@
1
- //#region hasValue.d.ts
2
1
  /**
3
2
  * Checks whether a value is neither `null` nor `undefined`.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * }
17
16
  */
18
17
  export declare function hasValue<T>(value: T): value is NonNullable<T>;
19
- //#endregion
20
18
  export { hasValue as default };
package/dist/hasValue.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region hasValue.ts
1
+ // hasValue.ts
2
2
  /**
3
3
  * Checks whether a value is neither `null` nor `undefined`.
4
4
  *
@@ -18,5 +18,4 @@
18
18
  function hasValue(value) {
19
19
  return value !== null && value !== void 0;
20
20
  }
21
- //#endregion
22
21
  export { hasValue as default, hasValue };
package/dist/isArray.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region isArray.d.ts
2
1
  /**
3
2
  * Checks if the given value is an array.
4
3
  *
@@ -19,5 +18,4 @@
19
18
  * console.log(isArray(value2)); // false
20
19
  * console.log(isArray(value3)); // false
21
20
  */
22
- export declare function isArray<T = unknown>(value: unknown): value is T[];
23
- //#endregion
21
+ export declare function isArray<T = unknown>(value: unknown): value is T[];
package/dist/isArray.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isArray.ts
1
+ // isArray.ts
2
2
  /**
3
3
  * Checks if the given value is an array.
4
4
  *
@@ -22,5 +22,4 @@
22
22
  function isArray(value) {
23
23
  return Array.isArray(value);
24
24
  }
25
- //#endregion
26
25
  export { isArray };
@@ -1,4 +1,3 @@
1
- //#region isArrayBuffer.d.ts
2
1
  /**
3
2
  * Checks if a given value is `ArrayBuffer`.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * console.log(isArrayBuffer(value2)); // false
17
16
  * console.log(isArrayBuffer(value3)); // false
18
17
  */
19
- export declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
20
- //#endregion
18
+ export declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
@@ -1,5 +1,5 @@
1
1
  import hasValue from "./hasValue.js";
2
- //#region isArrayBuffer.ts
2
+ // isArrayBuffer.ts
3
3
  /**
4
4
  * Checks if a given value is `ArrayBuffer`.
5
5
  *
@@ -20,5 +20,4 @@ import hasValue from "./hasValue.js";
20
20
  function isArrayBuffer(value) {
21
21
  return hasValue(value) && value instanceof ArrayBuffer;
22
22
  }
23
- //#endregion
24
23
  export { isArrayBuffer };
@@ -1,8 +1,6 @@
1
- //#region isArrayEmpty.d.ts
2
1
  /**
3
2
  * Checks whether a value is nullish or an empty array.
4
3
  *
5
4
  * `null`, `undefined`, and arrays without elements are considered empty.
6
5
  */
7
- export declare function isArrayEmpty<T>(value: readonly T[] | null | undefined): value is null | undefined | readonly [];
8
- //#endregion
6
+ export declare function isArrayEmpty<T>(value: readonly T[] | null | undefined): value is null | undefined | readonly [];
@@ -1,12 +1,11 @@
1
1
  import { isNil } from "./isNil.js";
2
- //#region isArrayEmpty.ts
2
+ // isArrayEmpty.ts
3
3
  /**
4
4
  * Checks whether a value is nullish or an empty array.
5
5
  *
6
6
  * `null`, `undefined`, and arrays without elements are considered empty.
7
7
  */
8
8
  function isArrayEmpty(value) {
9
- return isNil(value) ? true : value.length === 0;
9
+ return isNil(value) || value.length === 0;
10
10
  }
11
- //#endregion
12
11
  export { isArrayEmpty };
package/dist/isBlob.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region isBlob.d.ts
2
1
  /**
3
2
  * Checks if a given value is `Blob`.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * console.log(isBlob(value2)); // false
17
16
  * console.log(isBlob(value3)); // false
18
17
  */
19
- export declare function isBlob(value: unknown): value is Blob;
20
- //#endregion
18
+ export declare function isBlob(value: unknown): value is Blob;
package/dist/isBlob.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import hasValue from "./hasValue.js";
2
- //#region isBlob.ts
2
+ // isBlob.ts
3
3
  /**
4
4
  * Checks if a given value is `Blob`.
5
5
  *
@@ -20,5 +20,4 @@ import hasValue from "./hasValue.js";
20
20
  function isBlob(value) {
21
21
  return hasValue(value) && value instanceof Blob;
22
22
  }
23
- //#endregion
24
23
  export { isBlob };
@@ -1,4 +1,3 @@
1
- //#region isBoolean.d.ts
2
1
  /**
3
2
  * Checks if the given value is boolean.
4
3
  *
@@ -21,5 +20,4 @@
21
20
  * console.log(isBoolean(value3)); // false
22
21
  *
23
22
  */
24
- export declare function isBoolean(x: unknown): x is boolean;
25
- //#endregion
23
+ export declare function isBoolean(x: unknown): x is boolean;
package/dist/isBoolean.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isBoolean.ts
1
+ // isBoolean.ts
2
2
  /**
3
3
  * Checks if the given value is boolean.
4
4
  *
@@ -24,5 +24,4 @@
24
24
  function isBoolean(x) {
25
25
  return typeof x === "boolean";
26
26
  }
27
- //#endregion
28
27
  export { isBoolean };
@@ -1,4 +1,3 @@
1
- //#region isFormData.d.ts
2
1
  /**
3
2
  * Checks if a given value is `FormData`.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * console.log(isFormData(value2)); // false
17
16
  * console.log(isFormData(value3)); // false
18
17
  */
19
- export declare function isFormData(value: unknown): value is FormData;
20
- //#endregion
18
+ export declare function isFormData(value: unknown): value is FormData;
@@ -1,5 +1,5 @@
1
1
  import hasValue from "./hasValue.js";
2
- //#region isFormData.ts
2
+ // isFormData.ts
3
3
  /**
4
4
  * Checks if a given value is `FormData`.
5
5
  *
@@ -20,5 +20,4 @@ import hasValue from "./hasValue.js";
20
20
  function isFormData(value) {
21
21
  return hasValue(value) && value instanceof FormData;
22
22
  }
23
- //#endregion
24
23
  export { isFormData };
@@ -1,4 +1,3 @@
1
- //#region isFunction.d.ts
2
1
  /**
3
2
  * Checks if `value` is a function.
4
3
  *
@@ -12,5 +11,4 @@
12
11
  * isFunction(Proxy); // true
13
12
  * isFunction(Int8Array); // true
14
13
  */
15
- export declare function isFunction(value: any): value is (...arguments_: any[]) => any;
16
- //#endregion
14
+ export declare function isFunction(value: any): value is (...arguments_: any[]) => any;
@@ -1,4 +1,4 @@
1
- //#region isFunction.ts
1
+ // isFunction.ts
2
2
  /**
3
3
  * Checks if `value` is a function.
4
4
  *
@@ -15,5 +15,4 @@
15
15
  function isFunction(value) {
16
16
  return typeof value === "function";
17
17
  }
18
- //#endregion
19
18
  export { isFunction };
package/dist/isNil.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region isNil.d.ts
2
1
  /**
3
2
  * Checks if a given value is null or undefined.
4
3
  *
@@ -18,5 +17,4 @@
18
17
  * const result2 = isNil(value2); // true
19
18
  * const result3 = isNil(value3); // false
20
19
  */
21
- export declare function isNil(x: unknown): x is null | undefined;
22
- //#endregion
20
+ export declare function isNil(x: unknown): x is null | undefined;
package/dist/isNil.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { isUndefined } from "./isUndefined.js";
2
2
  import { isNull } from "./isNull.js";
3
- //#region isNil.ts
3
+ // isNil.ts
4
4
  /**
5
5
  * Checks if a given value is null or undefined.
6
6
  *
@@ -23,5 +23,4 @@ import { isNull } from "./isNull.js";
23
23
  function isNil(x) {
24
24
  return isNull(x) || isUndefined(x);
25
25
  }
26
- //#endregion
27
26
  export { isNil };
package/dist/isNull.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region isNull.d.ts
2
1
  /**
3
2
  * Checks if the given value is null.
4
3
  *
@@ -19,5 +18,4 @@
19
18
  * console.log(isNull(value2)); // false
20
19
  * console.log(isNull(value3)); // false
21
20
  */
22
- export declare function isNull(x: unknown): x is null;
23
- //#endregion
21
+ export declare function isNull(x: unknown): x is null;
package/dist/isNull.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isNull.ts
1
+ // isNull.ts
2
2
  /**
3
3
  * Checks if the given value is null.
4
4
  *
@@ -22,5 +22,4 @@
22
22
  function isNull(x) {
23
23
  return x === null;
24
24
  }
25
- //#endregion
26
25
  export { isNull };
@@ -1,4 +1,3 @@
1
- //#region isNumber.d.ts
2
1
  /**
3
2
  * Checks if the given value is a number.
4
3
  *
@@ -21,5 +20,4 @@
21
20
  * console.log(isNumber(value3)); // false
22
21
  *
23
22
  */
24
- export declare function isNumber(value: unknown): value is number;
25
- //#endregion
23
+ export declare function isNumber(value: unknown): value is number;
package/dist/isNumber.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isNumber.ts
1
+ // isNumber.ts
2
2
  /**
3
3
  * Checks if the given value is a number.
4
4
  *
@@ -24,5 +24,4 @@
24
24
  function isNumber(value) {
25
25
  return typeof value === "number" && !Number.isNaN(value);
26
26
  }
27
- //#endregion
28
27
  export { isNumber };
@@ -1,4 +1,3 @@
1
- //#region isObject.d.ts
2
1
  /**
3
2
  * Checks if the given value is an object. An object is a value that is
4
3
  * not a primitive type (string, number, boolean, symbol, null, or undefined).
@@ -22,5 +21,4 @@
22
21
  * console.log(isObject(value3)); // true
23
22
  * console.log(isObject(value4)); // false
24
23
  */
25
- export declare function isObject(value?: any): value is object;
26
- //#endregion
24
+ export declare function isObject(value?: any): value is object;
package/dist/isObject.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isObject.ts
1
+ // isObject.ts
2
2
  /**
3
3
  * Checks if the given value is an object. An object is a value that is
4
4
  * not a primitive type (string, number, boolean, symbol, null, or undefined).
@@ -25,5 +25,4 @@
25
25
  function isObject(value) {
26
26
  return value !== null && (typeof value === "object" || typeof value === "function");
27
27
  }
28
- //#endregion
29
28
  export { isObject };
@@ -1,4 +1,3 @@
1
- //#region isPlainObject.d.ts
2
1
  /**
3
2
  * Checks if a given value is a plain object.
4
3
  *
@@ -41,5 +40,4 @@
41
40
  * isPlainObject(globalThis); // ❌
42
41
  * ```
43
42
  */
44
- export declare function isPlainObject(value: unknown): value is Record<PropertyKey, any>;
45
- //#endregion
43
+ export declare function isPlainObject(value: unknown): value is Record<PropertyKey, any>;
@@ -1,6 +1,6 @@
1
1
  import { isNull } from "./isNull.js";
2
2
  import { isObject } from "./isObject.js";
3
- //#region isPlainObject.ts
3
+ // isPlainObject.ts
4
4
  /**
5
5
  * Checks if a given value is a plain object.
6
6
  *
@@ -46,7 +46,6 @@ import { isObject } from "./isObject.js";
46
46
  function isPlainObject(value) {
47
47
  if (!isObject(value)) return false;
48
48
  const prototype = Object.getPrototypeOf(value);
49
- return isNull(prototype) || prototype === Object.prototype || isNull(Object.getPrototypeOf(prototype)) ? Object.prototype.toString.call(value) === "[object Object]" : false;
49
+ return (isNull(prototype) || prototype === Object.prototype || isNull(Object.getPrototypeOf(prototype))) && Object.prototype.toString.call(value) === "[object Object]";
50
50
  }
51
- //#endregion
52
51
  export { isPlainObject };
@@ -1,4 +1,3 @@
1
- //#region isPromise.d.ts
2
1
  /**
3
2
  * Checks if a given value is `Promise`.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * console.log(isPromise(value2)); // false
17
16
  * console.log(isPromise(value3)); // false
18
17
  */
19
- export declare function isPromise(value: unknown): value is Promise<any>;
20
- //#endregion
18
+ export declare function isPromise(value: unknown): value is Promise<any>;
package/dist/isPromise.js CHANGED
@@ -1,7 +1,7 @@
1
- import hasValue from "./hasValue.js";
2
1
  import { isFunction } from "./isFunction.js";
2
+ import hasValue from "./hasValue.js";
3
3
  import { isObject } from "./isObject.js";
4
- //#region isPromise.ts
4
+ // isPromise.ts
5
5
  /**
6
6
  * Checks if a given value is `Promise`.
7
7
  *
@@ -22,5 +22,4 @@ import { isObject } from "./isObject.js";
22
22
  function isPromise(value) {
23
23
  return hasValue(value) && (isObject(value) || isFunction(value)) && isFunction(value.then);
24
24
  }
25
- //#endregion
26
25
  export { isPromise };
@@ -1,4 +1,3 @@
1
- //#region isString.d.ts
2
1
  /**
3
2
  * Checks if a given value is string.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * console.log(isString(value2)); // false
17
16
  * console.log(isString(value3)); // false
18
17
  */
19
- export declare function isString(value: unknown): value is string;
20
- //#endregion
18
+ export declare function isString(value: unknown): value is string;
package/dist/isString.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isString.ts
1
+ // isString.ts
2
2
  /**
3
3
  * Checks if a given value is string.
4
4
  *
@@ -19,5 +19,4 @@
19
19
  function isString(value) {
20
20
  return typeof value === "string";
21
21
  }
22
- //#endregion
23
22
  export { isString };
@@ -1,8 +1,6 @@
1
- //#region isStringEmpty.d.ts
2
1
  /**
3
2
  * Checks whether a value is nullish or an empty string.
4
3
  *
5
4
  * `null`, `undefined`, and whitespace-only strings are considered empty.
6
5
  */
7
- export declare function isStringEmpty(value: string | null | undefined): value is '' | null | undefined;
8
- //#endregion
6
+ export declare function isStringEmpty(value: string | null | undefined): value is '' | null | undefined;
@@ -1,12 +1,11 @@
1
1
  import { isNil } from "./isNil.js";
2
- //#region isStringEmpty.ts
2
+ // isStringEmpty.ts
3
3
  /**
4
4
  * Checks whether a value is nullish or an empty string.
5
5
  *
6
6
  * `null`, `undefined`, and whitespace-only strings are considered empty.
7
7
  */
8
8
  function isStringEmpty(value) {
9
- return isNil(value) ? true : value.trim().length === 0;
9
+ return isNil(value) || value.trim().length === 0;
10
10
  }
11
- //#endregion
12
11
  export { isStringEmpty };
@@ -1,4 +1,3 @@
1
- //#region isSymbol.d.ts
2
1
  /**
3
2
  * Check whether a value is a symbol.
4
3
  *
@@ -22,5 +21,4 @@
22
21
  * isSymbol({}); // false
23
22
  * isSymbol([1, 2, 3]); // false
24
23
  */
25
- export declare function isSymbol(value: unknown): value is symbol;
26
- //#endregion
24
+ export declare function isSymbol(value: unknown): value is symbol;
package/dist/isSymbol.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region isSymbol.ts
1
+ // isSymbol.ts
2
2
  /**
3
3
  * Check whether a value is a symbol.
4
4
  *
@@ -25,5 +25,4 @@
25
25
  function isSymbol(value) {
26
26
  return typeof value === "symbol";
27
27
  }
28
- //#endregion
29
28
  export { isSymbol };
@@ -1,4 +1,3 @@
1
- //#region isURLSearchParameters.d.ts
2
1
  /**
3
2
  * Checks if a given value is `URLSearchParams`.
4
3
  *
@@ -16,5 +15,4 @@
16
15
  * console.log(isURLSearchParameters(value2)); // false
17
16
  * console.log(isURLSearchParameters(value3)); // false
18
17
  */
19
- export declare function isURLSearchParameters(value: unknown): value is URLSearchParams;
20
- //#endregion
18
+ export declare function isURLSearchParameters(value: unknown): value is URLSearchParams;
@@ -1,5 +1,5 @@
1
1
  import hasValue from "./hasValue.js";
2
- //#region isURLSearchParameters.ts
2
+ // isURLSearchParameters.ts
3
3
  /**
4
4
  * Checks if a given value is `URLSearchParams`.
5
5
  *
@@ -20,5 +20,4 @@ import hasValue from "./hasValue.js";
20
20
  function isURLSearchParameters(value) {
21
21
  return hasValue(value) && value instanceof URLSearchParams;
22
22
  }
23
- //#endregion
24
23
  export { isURLSearchParameters };
@@ -1,4 +1,3 @@
1
- //#region isUndefined.d.ts
2
1
  /**
3
2
  * Checks if the given value is undefined.
4
3
  *
@@ -19,5 +18,4 @@
19
18
  * console.log(isUndefined(value2)); // false
20
19
  * console.log(isUndefined(value3)); // false
21
20
  */
22
- export declare const isUndefined: (value: unknown) => value is undefined;
23
- //#endregion
21
+ export declare const isUndefined: (value: unknown) => value is undefined;
@@ -1,4 +1,4 @@
1
- //#region isUndefined.ts
1
+ // isUndefined.ts
2
2
  /**
3
3
  * Checks if the given value is undefined.
4
4
  *
@@ -22,5 +22,4 @@
22
22
  const isUndefined = (value) => {
23
23
  return value === void 0;
24
24
  };
25
- //#endregion
26
25
  export { isUndefined };
@@ -1,4 +1,3 @@
1
- //#region kebabCase.d.ts
2
1
  /**
3
2
  * 将字符串转换为 kebab-case。
4
3
  *
@@ -10,5 +9,4 @@
10
9
  * kebabCase('some whitespace') // 'some-whitespace'
11
10
  * kebabCase('HTTPRequest') // 'http-request'
12
11
  */
13
- export declare function kebabCase(value: string): string;
14
- //#endregion
12
+ export declare function kebabCase(value: string): string;
package/dist/kebabCase.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region kebabCase.ts
1
+ // kebabCase.ts
2
2
  /**
3
3
  * 用于拆分常见命名格式的正则;实现参考 es-toolkit 的 `kebabCase`。
4
4
  */
@@ -26,5 +26,4 @@ function words(value) {
26
26
  function kebabCase(value) {
27
27
  return words(value).map((word) => word.toLowerCase()).join("-");
28
28
  }
29
- //#endregion
30
29
  export { kebabCase };
package/dist/main.d.ts CHANGED
@@ -1,28 +1,31 @@
1
- import { ChainedFunction, createChainedFunction } from "./createChainedFunction.js";
2
- import { DebounceOptions, DebouncedFunction, debounce } from "./debounce.js";
3
- import { get } from "./get.js";
4
- import hasValue from "./hasValue.js";
5
1
  import { isArray } from "./isArray.js";
6
- import { isArrayBuffer } from "./isArrayBuffer.js";
2
+ import { QueryInput, QueryParameters, QueryValue, buildURL } from "./buildURL.js";
7
3
  import { isArrayEmpty } from "./isArrayEmpty.js";
8
- import { isBlob } from "./isBlob.js";
9
4
  import { isBoolean } from "./isBoolean.js";
10
- import { isFormData } from "./isFormData.js";
5
+ import { isBlob } from "./isBlob.js";
6
+ import { ChainedFunction, createChainedFunction } from "./createChainedFunction.js";
7
+ import { Emitter, EmitterListener, Subscribable, createEmitter } from "./createEmitter.js";
8
+ import { DebounceOptions, DebouncedFunction, debounce } from "./debounce.js";
11
9
  import { isFunction } from "./isFunction.js";
10
+ import hasValue from "./hasValue.js";
11
+ import { isFormData } from "./isFormData.js";
12
12
  import { isNil } from "./isNil.js";
13
- import { isNull } from "./isNull.js";
13
+ import { noop } from "./noop.js";
14
14
  import { isNumber } from "./isNumber.js";
15
- import { isObject } from "./isObject.js";
16
15
  import { isPlainObject } from "./isPlainObject.js";
17
- import { isPromise } from "./isPromise.js";
18
16
  import { isString } from "./isString.js";
19
17
  import { isStringEmpty } from "./isStringEmpty.js";
20
- import { isSymbol } from "./isSymbol.js";
21
- import { isURLSearchParameters } from "./isURLSearchParameters.js";
22
18
  import { isUndefined } from "./isUndefined.js";
23
- import { kebabCase } from "./kebabCase.js";
19
+ import { isNull } from "./isNull.js";
20
+ import { isPromise } from "./isPromise.js";
21
+ import { isObject } from "./isObject.js";
22
+ import { isArrayBuffer } from "./isArrayBuffer.js";
23
+ import { isURLSearchParameters } from "./isURLSearchParameters.js";
24
24
  import { parseJson } from "./parseJson.js";
25
+ import { get } from "./get.js";
26
+ import { kebabCase } from "./kebabCase.js";
27
+ import { isSymbol } from "./isSymbol.js";
25
28
  import { ThrottleOptions, ThrottledFunction, throttle } from "./throttle.js";
26
29
  import resolveValue from "./resolveValue.js";
27
30
  import { uniqueId } from "./uniqueId.js";
28
- export { type ChainedFunction, type DebounceOptions, type DebouncedFunction, type ThrottleOptions, type ThrottledFunction, createChainedFunction, debounce, get, hasValue, isArray, isArrayBuffer, isArrayEmpty, isBlob, isBoolean, isFormData, isFunction, isNil, isNull, isNumber, isObject, isPlainObject, isPromise, isString, isStringEmpty, isSymbol, isURLSearchParameters, isUndefined, kebabCase, parseJson, resolveValue, throttle, uniqueId };
31
+ export { type ChainedFunction, type DebounceOptions, type DebouncedFunction, type Emitter, type EmitterListener, type QueryInput, type QueryParameters, type QueryValue, type Subscribable, type ThrottleOptions, type ThrottledFunction, buildURL, createChainedFunction, createEmitter, debounce, get, hasValue, isArray, isArrayBuffer, isArrayEmpty, isBlob, isBoolean, isFormData, isFunction, isNil, isNull, isNumber, isObject, isPlainObject, isPromise, isString, isStringEmpty, isSymbol, isURLSearchParameters, isUndefined, kebabCase, noop, parseJson, resolveValue, throttle, uniqueId };
package/dist/main.js CHANGED
@@ -1,28 +1,31 @@
1
1
  import { isArray } from "./isArray.js";
2
- import { isUndefined } from "./isUndefined.js";
3
- import { isNull } from "./isNull.js";
4
- import { isNil } from "./isNil.js";
2
+ import { buildURL } from "./buildURL.js";
5
3
  import { isArrayEmpty } from "./isArrayEmpty.js";
6
4
  import { isBoolean } from "./isBoolean.js";
7
- import hasValue from "./hasValue.js";
8
5
  import { isBlob } from "./isBlob.js";
9
- import { isFunction } from "./isFunction.js";
10
6
  import { createChainedFunction } from "./createChainedFunction.js";
7
+ import { createEmitter } from "./createEmitter.js";
11
8
  import { debounce } from "./debounce.js";
9
+ import { isFunction } from "./isFunction.js";
10
+ import hasValue from "./hasValue.js";
12
11
  import { isFormData } from "./isFormData.js";
12
+ import { isNil } from "./isNil.js";
13
+ import { noop } from "./noop.js";
13
14
  import { isNumber } from "./isNumber.js";
14
- import { isObject } from "./isObject.js";
15
15
  import { isPlainObject } from "./isPlainObject.js";
16
16
  import { isString } from "./isString.js";
17
17
  import { isStringEmpty } from "./isStringEmpty.js";
18
+ import { isUndefined } from "./isUndefined.js";
19
+ import { isNull } from "./isNull.js";
18
20
  import { isPromise } from "./isPromise.js";
21
+ import { isObject } from "./isObject.js";
19
22
  import { isArrayBuffer } from "./isArrayBuffer.js";
20
23
  import { isURLSearchParameters } from "./isURLSearchParameters.js";
21
24
  import { parseJson } from "./parseJson.js";
22
- import { isSymbol } from "./isSymbol.js";
23
25
  import { get } from "./get.js";
24
26
  import { kebabCase } from "./kebabCase.js";
27
+ import { isSymbol } from "./isSymbol.js";
25
28
  import { throttle } from "./throttle.js";
26
29
  import resolveValue from "./resolveValue.js";
27
30
  import { uniqueId } from "./uniqueId.js";
28
- export { createChainedFunction, debounce, get, hasValue, isArray, isArrayBuffer, isArrayEmpty, isBlob, isBoolean, isFormData, isFunction, isNil, isNull, isNumber, isObject, isPlainObject, isPromise, isString, isStringEmpty, isSymbol, isURLSearchParameters, isUndefined, kebabCase, parseJson, resolveValue, throttle, uniqueId };
31
+ export { buildURL, createChainedFunction, createEmitter, debounce, get, hasValue, isArray, isArrayBuffer, isArrayEmpty, isBlob, isBoolean, isFormData, isFunction, isNil, isNull, isNumber, isObject, isPlainObject, isPromise, isString, isStringEmpty, isSymbol, isURLSearchParameters, isUndefined, kebabCase, noop, parseJson, resolveValue, throttle, uniqueId };
package/dist/noop.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 不执行任何操作的空函数。
3
+ */
4
+ export declare const noop: () => void;
package/dist/noop.js ADDED
@@ -0,0 +1,6 @@
1
+ // noop.ts
2
+ /**
3
+ * 不执行任何操作的空函数。
4
+ */
5
+ const noop = () => {};
6
+ export { noop };
@@ -1,9 +1,7 @@
1
- //#region parseJson.d.ts
2
1
  /**
3
2
  * Parses JSON text into a value.
4
3
  *
5
4
  * Returns `undefined` for blank strings. When `fallback` is provided, invalid JSON
6
5
  * returns the fallback instead of throwing.
7
6
  */
8
- export declare function parseJson<T>(text: string, fallback?: T): T | undefined;
9
- //#endregion
7
+ export declare function parseJson<T>(text: string, fallback?: T): T | undefined;
package/dist/parseJson.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { isStringEmpty } from "./isStringEmpty.js";
2
- //#region parseJson.ts
2
+ // parseJson.ts
3
3
  /**
4
4
  * Parses JSON text into a value.
5
5
  *
@@ -15,5 +15,4 @@ function parseJson(text, fallback) {
15
15
  throw error;
16
16
  }
17
17
  }
18
- //#endregion
19
18
  export { parseJson };
@@ -1,4 +1,3 @@
1
- //#region resolveValue.d.ts
2
1
  /**
3
2
  * Resolves either a plain value or a lazily evaluated value factory.
4
3
  *
@@ -13,5 +12,4 @@
13
12
  * resolveValue(status => status === 'error' ? 'retry' : 'ok', 'error');
14
13
  */
15
14
  export declare function resolveValue<TValue, TArguments extends any[]>(value: TValue | ((...arguments_: TArguments) => TValue), ...arguments_: TArguments): TValue;
16
- //#endregion
17
15
  export { resolveValue as default };
@@ -1,5 +1,5 @@
1
1
  import { isFunction } from "./isFunction.js";
2
- //#region resolveValue.ts
2
+ // resolveValue.ts
3
3
  /**
4
4
  * Resolves either a plain value or a lazily evaluated value factory.
5
5
  *
@@ -16,5 +16,4 @@ import { isFunction } from "./isFunction.js";
16
16
  function resolveValue(value, ...arguments_) {
17
17
  return isFunction(value) ? value(...arguments_) : value;
18
18
  }
19
- //#endregion
20
19
  export { resolveValue as default, resolveValue };
@@ -1,4 +1,3 @@
1
- //#region throttle.d.ts
2
1
  /**
3
2
  * 控制节流函数何时调用或取消的选项。
4
3
  */
@@ -50,5 +49,4 @@ export interface ThrottledFunction<F extends (...arguments_: any[]) => void> {
50
49
  * throttledFunction(); // Will log 'Function executed'
51
50
  * }, 1000);
52
51
  */
53
- export declare function throttle<F extends (...arguments_: any[]) => void>(function_: F, throttleMs: number, { signal, edges }?: ThrottleOptions): ThrottledFunction<F>;
54
- //#endregion
52
+ export declare function throttle<F extends (...arguments_: any[]) => void>(function_: F, throttleMs: number, { signal, edges }?: ThrottleOptions): ThrottledFunction<F>;
package/dist/throttle.js CHANGED
@@ -1,6 +1,6 @@
1
- import { isUndefined } from "./isUndefined.js";
2
1
  import { debounce } from "./debounce.js";
3
- //#region throttle.ts
2
+ import { isUndefined } from "./isUndefined.js";
3
+ // throttle.ts
4
4
  /**
5
5
  * Creates a throttled function that only invokes the provided function at most once
6
6
  * per every `throttleMs` milliseconds. Subsequent calls to the throttled function
@@ -54,5 +54,4 @@ function throttle(function_, throttleMs, { signal, edges = ["leading", "trailing
54
54
  throttled.flush = debounced.flush;
55
55
  return throttled;
56
56
  }
57
- //#endregion
58
57
  export { throttle };
@@ -1,4 +1,3 @@
1
- //#region uniqueId.d.ts
2
1
  /**
3
2
  * Generates a unique ID.
4
3
  *
@@ -12,5 +11,4 @@
12
11
  * uniqueId('contact_'); // 'contact_2'
13
12
  * uniqueId('contact_'); // 'contact_3'
14
13
  */
15
- export declare function uniqueId(prefix?: string): string;
16
- //#endregion
14
+ export declare function uniqueId(prefix?: string): string;
package/dist/uniqueId.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region uniqueId.ts
1
+ // uniqueId.ts
2
2
  const uniqueIdCounter = { value: 0 };
3
3
  /**
4
4
  * Generates a unique ID.
@@ -16,5 +16,4 @@ const uniqueIdCounter = { value: 0 };
16
16
  function uniqueId(prefix = "") {
17
17
  return `${prefix}${++uniqueIdCounter.value}`;
18
18
  }
19
- //#endregion
20
19
  export { uniqueId };
@@ -1,7 +1,7 @@
1
+ import { toString } from "./toString.js";
1
2
  import { isSymbol } from "../isSymbol.js";
2
3
  import { toKey } from "../_internal/toKey.js";
3
- import { toString } from "./toString.js";
4
- //#region utils/toPath.ts
4
+ // utils/toPath.ts
5
5
  /**
6
6
  * Converts a deep key string into an array of path segments.
7
7
  *
@@ -66,5 +66,4 @@ function toPath(deepKey) {
66
66
  if (key) result.push(key);
67
67
  return result;
68
68
  }
69
- //#endregion
70
69
  export { toPath };
@@ -1,7 +1,7 @@
1
+ import { normalizeKey } from "../_internal/toKey.js";
1
2
  import { isNil } from "../isNil.js";
2
3
  import { isString } from "../isString.js";
3
- import { normalizeKey } from "../_internal/toKey.js";
4
- //#region utils/toString.ts
4
+ // utils/toString.ts
5
5
  /**
6
6
  * Converts `value` to a string.
7
7
  *
@@ -23,5 +23,4 @@ function toString(value) {
23
23
  if (isString(value)) return value;
24
24
  return Array.isArray(value) ? value.map((item) => toString(item)).join(",") : normalizeKey(value);
25
25
  }
26
- //#endregion
27
26
  export { toString };
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@omnific/utils",
3
- "version": "0.4.0",
4
- "description": "Shared utility predicates for Omnific packages",
3
+ "version": "0.6.0",
4
+ "description": "Shared utilities for Omnific packages",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "utils",
9
9
  "type-guards",
10
- "predicates"
10
+ "predicates",
11
+ "url"
11
12
  ],
12
13
  "author": "monhan-97",
13
14
  "repository": {