utilful 2.5.0 → 2.5.1
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.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/object.d.mts +5 -1
- package/dist/object.mjs +4 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,9 +4,9 @@ import { DefuFn, DefuMerger, createDefu, defu } from "./defu.mjs";
|
|
|
4
4
|
import { Emitter, EventHandlerList, EventHandlerMap, EventType, Handler, WildCardEventHandlerList, WildcardHandler, createEmitter } from "./emitter.mjs";
|
|
5
5
|
import { cloneJSON, tryParseJSON } from "./json.mjs";
|
|
6
6
|
import { interopDefault } from "./module.mjs";
|
|
7
|
-
import { deepApply, memoize, objectEntries, objectKeys } from "./object.mjs";
|
|
7
|
+
import { deepApply, isObject, memoize, objectEntries, objectKeys } from "./object.mjs";
|
|
8
8
|
import { QueryObject, QueryValue, getPathname, joinURL, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash } from "./path.mjs";
|
|
9
9
|
import { Err, ErrData, Ok, OkData, Result, ResultData, err, isErr, isOk, ok, toResult, tryCatch, unwrapResult } from "./result.mjs";
|
|
10
10
|
import { generateRandomId, template } from "./string.mjs";
|
|
11
11
|
import { AutocompletableString, BrandedType, LooseAutocomplete, UnifyIntersection } from "./types.mjs";
|
|
12
|
-
export { AutocompletableString, BrandedType, CSVCreateOptions, CSVRow, DefuFn, DefuMerger, Emitter, Err, ErrData, EventHandlerList, EventHandlerMap, EventType, Handler, LooseAutocomplete, MaybeArray, Ok, OkData, QueryObject, QueryValue, Result, ResultData, UnifyIntersection, WildCardEventHandlerList, WildcardHandler, cloneJSON, createCSV, createCSVAsync, createCSVStream, createDefu, createEmitter, deepApply, defu, err, escapeCSVValue, generateRandomId, getPathname, interopDefault, isErr, isOk, joinURL, memoize, objectEntries, objectKeys, ok, parseCSV, parseCSVFromLines, parseCSVStream, template, toArray, toResult, tryCatch, tryParseJSON, unwrapResult, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash };
|
|
12
|
+
export { AutocompletableString, BrandedType, CSVCreateOptions, CSVRow, DefuFn, DefuMerger, Emitter, Err, ErrData, EventHandlerList, EventHandlerMap, EventType, Handler, LooseAutocomplete, MaybeArray, Ok, OkData, QueryObject, QueryValue, Result, ResultData, UnifyIntersection, WildCardEventHandlerList, WildcardHandler, cloneJSON, createCSV, createCSVAsync, createCSVStream, createDefu, createEmitter, deepApply, defu, err, escapeCSVValue, generateRandomId, getPathname, interopDefault, isErr, isObject, isOk, joinURL, memoize, objectEntries, objectKeys, ok, parseCSV, parseCSVFromLines, parseCSVStream, template, toArray, toResult, tryCatch, tryParseJSON, unwrapResult, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash };
|
package/dist/index.mjs
CHANGED
|
@@ -4,9 +4,9 @@ import { createDefu, defu } from "./defu.mjs";
|
|
|
4
4
|
import { createEmitter } from "./emitter.mjs";
|
|
5
5
|
import { cloneJSON, tryParseJSON } from "./json.mjs";
|
|
6
6
|
import { interopDefault } from "./module.mjs";
|
|
7
|
-
import { deepApply, memoize, objectEntries, objectKeys } from "./object.mjs";
|
|
7
|
+
import { deepApply, isObject, memoize, objectEntries, objectKeys } from "./object.mjs";
|
|
8
8
|
import { getPathname, joinURL, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash } from "./path.mjs";
|
|
9
9
|
import { Err, Ok, err, isErr, isOk, ok, toResult, tryCatch, unwrapResult } from "./result.mjs";
|
|
10
10
|
import { generateRandomId, template } from "./string.mjs";
|
|
11
11
|
|
|
12
|
-
export { Err, Ok, cloneJSON, createCSV, createCSVAsync, createCSVStream, createDefu, createEmitter, deepApply, defu, err, escapeCSVValue, generateRandomId, getPathname, interopDefault, isErr, isOk, joinURL, memoize, objectEntries, objectKeys, ok, parseCSV, parseCSVFromLines, parseCSVStream, template, toArray, toResult, tryCatch, tryParseJSON, unwrapResult, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash };
|
|
12
|
+
export { Err, Ok, cloneJSON, createCSV, createCSVAsync, createCSVStream, createDefu, createEmitter, deepApply, defu, err, escapeCSVValue, generateRandomId, getPathname, interopDefault, isErr, isObject, isOk, joinURL, memoize, objectEntries, objectKeys, ok, parseCSV, parseCSVFromLines, parseCSVStream, template, toArray, toResult, tryCatch, tryParseJSON, unwrapResult, withBase, withLeadingSlash, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash };
|
package/dist/object.d.mts
CHANGED
|
@@ -28,5 +28,9 @@ declare function objectEntries<T extends Record<any, any>>(obj: T): Array<[keyof
|
|
|
28
28
|
* Deeply applies a callback to every key-value pair in the given object, as well as nested objects and arrays.
|
|
29
29
|
*/
|
|
30
30
|
declare function deepApply<T extends Record<any, any>>(data: T, callback: (item: T, key: keyof T, value: T[keyof T]) => void): void;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a value is a plain object.
|
|
33
|
+
*/
|
|
34
|
+
declare function isObject(value: unknown): value is Record<any, any>;
|
|
31
35
|
//#endregion
|
|
32
|
-
export { deepApply, memoize, objectEntries, objectKeys };
|
|
36
|
+
export { deepApply, isObject, memoize, objectEntries, objectKeys };
|
package/dist/object.mjs
CHANGED
|
@@ -43,9 +43,12 @@ function deepApply(data, callback) {
|
|
|
43
43
|
} else if (isObject(value)) deepApply(value, callback);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a value is a plain object.
|
|
48
|
+
*/
|
|
46
49
|
function isObject(value) {
|
|
47
50
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
//#endregion
|
|
51
|
-
export { deepApply, memoize, objectEntries, objectKeys };
|
|
54
|
+
export { deepApply, isObject, memoize, objectEntries, objectKeys };
|
package/package.json
CHANGED