radashi 12.2.0-beta.437b4fe → 12.2.0-beta.68f53c8
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 +7 -0
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +6 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
defer: () => defer,
|
|
41
41
|
diff: () => diff,
|
|
42
42
|
draw: () => draw,
|
|
43
|
+
filterKey: () => filterKey,
|
|
43
44
|
first: () => first,
|
|
44
45
|
flat: () => flat,
|
|
45
46
|
fork: () => fork,
|
|
@@ -754,6 +755,11 @@ var crush = (value) => {
|
|
|
754
755
|
);
|
|
755
756
|
};
|
|
756
757
|
|
|
758
|
+
// src/object/filterKey.ts
|
|
759
|
+
var filterKey = (obj, key, keys2) => {
|
|
760
|
+
return isArray(keys2) ? Object.hasOwnProperty.call(obj, key) && keys2.includes(key) : keys2(obj[key], key, obj);
|
|
761
|
+
};
|
|
762
|
+
|
|
757
763
|
// src/object/get.ts
|
|
758
764
|
var get = (value, path, defaultValue) => {
|
|
759
765
|
const segments = path.split(/[\.\[\]]/g);
|
|
@@ -1180,6 +1186,7 @@ var isSymbol = (value) => {
|
|
|
1180
1186
|
defer,
|
|
1181
1187
|
diff,
|
|
1182
1188
|
draw,
|
|
1189
|
+
filterKey,
|
|
1183
1190
|
first,
|
|
1184
1191
|
flat,
|
|
1185
1192
|
fork,
|
package/dist/index.d.cts
CHANGED
|
@@ -511,6 +511,22 @@ declare const construct: <TObject extends object>(obj: TObject) => object;
|
|
|
511
511
|
*/
|
|
512
512
|
declare const crush: <TValue extends object>(value: TValue) => object;
|
|
513
513
|
|
|
514
|
+
type KeyOf<T extends object> = object extends T ? keyof any : keyof T;
|
|
515
|
+
type ValueOf<T extends object> = object extends T ? unknown : T[keyof T];
|
|
516
|
+
type KeyFilterFunction<T extends object = object> = (value: ValueOf<T>, key: KeyOf<T>, obj: T) => boolean;
|
|
517
|
+
/**
|
|
518
|
+
* Functions can use this type to accept either an array of keys or a
|
|
519
|
+
* filter callback. This provides type safety for such a parameter
|
|
520
|
+
* type, whose value can then be passed into `matchKeys` to receive a
|
|
521
|
+
* matching function.
|
|
522
|
+
*/
|
|
523
|
+
type KeyFilter<T extends object = object, Key extends keyof any = keyof any> = KeyFilterFunction<T> | readonly Key[];
|
|
524
|
+
/**
|
|
525
|
+
* Returns true if the key is in the “keys array” or if the “filter
|
|
526
|
+
* function” returns true.
|
|
527
|
+
*/
|
|
528
|
+
declare const filterKey: (obj: object, key: string, keys: KeyFilter) => boolean;
|
|
529
|
+
|
|
514
530
|
/**
|
|
515
531
|
* Dynamically get a nested value from an array or object with a
|
|
516
532
|
* string.
|
|
@@ -743,4 +759,4 @@ declare const isString: (value: any) => value is string;
|
|
|
743
759
|
|
|
744
760
|
declare const isSymbol: (value: any) => value is symbol;
|
|
745
761
|
|
|
746
|
-
export { AggregateError, type DebounceFunction, type RetryOptions, type ThrottledFunction, all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, first, flat, fork, get, group, guard, inRange, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isIntString, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };
|
|
762
|
+
export { AggregateError, type DebounceFunction, type KeyFilter, type KeyFilterFunction, type RetryOptions, type ThrottledFunction, all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, filterKey, first, flat, fork, get, group, guard, inRange, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isIntString, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };
|
package/dist/index.d.ts
CHANGED
|
@@ -511,6 +511,22 @@ declare const construct: <TObject extends object>(obj: TObject) => object;
|
|
|
511
511
|
*/
|
|
512
512
|
declare const crush: <TValue extends object>(value: TValue) => object;
|
|
513
513
|
|
|
514
|
+
type KeyOf<T extends object> = object extends T ? keyof any : keyof T;
|
|
515
|
+
type ValueOf<T extends object> = object extends T ? unknown : T[keyof T];
|
|
516
|
+
type KeyFilterFunction<T extends object = object> = (value: ValueOf<T>, key: KeyOf<T>, obj: T) => boolean;
|
|
517
|
+
/**
|
|
518
|
+
* Functions can use this type to accept either an array of keys or a
|
|
519
|
+
* filter callback. This provides type safety for such a parameter
|
|
520
|
+
* type, whose value can then be passed into `matchKeys` to receive a
|
|
521
|
+
* matching function.
|
|
522
|
+
*/
|
|
523
|
+
type KeyFilter<T extends object = object, Key extends keyof any = keyof any> = KeyFilterFunction<T> | readonly Key[];
|
|
524
|
+
/**
|
|
525
|
+
* Returns true if the key is in the “keys array” or if the “filter
|
|
526
|
+
* function” returns true.
|
|
527
|
+
*/
|
|
528
|
+
declare const filterKey: (obj: object, key: string, keys: KeyFilter) => boolean;
|
|
529
|
+
|
|
514
530
|
/**
|
|
515
531
|
* Dynamically get a nested value from an array or object with a
|
|
516
532
|
* string.
|
|
@@ -743,4 +759,4 @@ declare const isString: (value: any) => value is string;
|
|
|
743
759
|
|
|
744
760
|
declare const isSymbol: (value: any) => value is symbol;
|
|
745
761
|
|
|
746
|
-
export { AggregateError, type DebounceFunction, type RetryOptions, type ThrottledFunction, all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, first, flat, fork, get, group, guard, inRange, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isIntString, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };
|
|
762
|
+
export { AggregateError, type DebounceFunction, type KeyFilter, type KeyFilterFunction, type RetryOptions, type ThrottledFunction, all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, filterKey, first, flat, fork, get, group, guard, inRange, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isIntString, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };
|
package/dist/index.js
CHANGED
|
@@ -632,6 +632,11 @@ var crush = (value) => {
|
|
|
632
632
|
);
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
+
// src/object/filterKey.ts
|
|
636
|
+
var filterKey = (obj, key, keys2) => {
|
|
637
|
+
return isArray(keys2) ? Object.hasOwnProperty.call(obj, key) && keys2.includes(key) : keys2(obj[key], key, obj);
|
|
638
|
+
};
|
|
639
|
+
|
|
635
640
|
// src/object/get.ts
|
|
636
641
|
var get = (value, path, defaultValue) => {
|
|
637
642
|
const segments = path.split(/[\.\[\]]/g);
|
|
@@ -1057,6 +1062,7 @@ export {
|
|
|
1057
1062
|
defer,
|
|
1058
1063
|
diff,
|
|
1059
1064
|
draw,
|
|
1065
|
+
filterKey,
|
|
1060
1066
|
first,
|
|
1061
1067
|
flat,
|
|
1062
1068
|
fork,
|