radashi 12.2.0-beta.2c63f67 → 12.2.0-beta.321515e

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/README.md CHANGED
@@ -51,9 +51,7 @@
51
51
  - ⚠️ **Beware:** Preview releases are not audited by the Radashi team. Always look at their
52
52
  changes in the PR to ensure no malicious code was introduced.
53
53
 
54
-  
55
-
56
- <img src="https://github.com/radashi-org/radashi/raw/main/img/rule.png" width="100%" />
54
+ <img src="https://github.com/radashi-org/radashi/raw/b80a0e4/img/rule.png" width="100%" />
57
55
 
58
56
  ## Install
59
57
 
@@ -69,9 +67,7 @@ yarn add radashi
69
67
  npm install radashi
70
68
  ```
71
69
 
72
- &nbsp;
73
-
74
- <img src="https://github.com/radashi-org/radashi/raw/main/img/rule.png" width="100%" />
70
+ <img src="https://github.com/radashi-org/radashi/raw/b80a0e4/img/rule.png" width="100%" />
75
71
 
76
72
  ## Contributing
77
73
 
@@ -81,9 +77,7 @@ Contributions are welcome and appreciated! Check out the contributing guide befo
81
77
  <img src="https://github.com/radashi-org/radashi/raw/main/img/contributing-button.png" alt="Contributing to Radashi" width="250px" />
82
78
  </a>
83
79
 
84
- &nbsp;
85
-
86
- <img src="https://github.com/radashi-org/radashi/raw/main/img/rule.png" width="100%" />
80
+ <img src="https://github.com/radashi-org/radashi/raw/b80a0e4/img/rule.png" width="100%" />
87
81
 
88
82
  ## Changelog
89
83
 
@@ -97,6 +91,6 @@ This section documents the changes between the original `radash` library and thi
97
91
 
98
92
  <div align="center">
99
93
  <p align="center">
100
- <img src="https://github.com/radashi-org/radashi/raw/main/img/footer.png" alt="Radashi" width="100%" />
94
+ <img src="https://github.com/radashi-org/radashi/raw/46c8897/img/footer.png" alt="Radashi" width="100%" />
101
95
  </p>
102
96
  </div>
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, filter) => {
760
+ return Object.hasOwnProperty.call(obj, key) && (filter == null || (isArray(filter) ? filter.includes(key) : filter(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);
@@ -1046,7 +1052,7 @@ var trim = (str, charsToTrim = " ") => {
1046
1052
  };
1047
1053
 
1048
1054
  // src/typed/isArray.ts
1049
- var isArray = Array.isArray;
1055
+ var isArray = /* @__PURE__ */ (() => Array.isArray)();
1050
1056
 
1051
1057
  // src/typed/isDate.ts
1052
1058
  var isDate = (value) => {
@@ -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,20 @@ 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 function.
520
+ */
521
+ type KeyFilter<T extends object = object, Key extends keyof any = keyof any> = KeyFilterFunction<T> | readonly Key[];
522
+ /**
523
+ * Returns true if the key is in the “keys array” or if the “filter
524
+ * function” returns true.
525
+ */
526
+ declare const filterKey: (obj: object, key: string, filter: KeyFilter | null | undefined) => boolean;
527
+
514
528
  /**
515
529
  * Dynamically get a nested value from an array or object with a
516
530
  * string.
@@ -699,7 +713,7 @@ declare const title: (str: string | null | undefined) => string;
699
713
  */
700
714
  declare const trim: (str: string | null | undefined, charsToTrim?: string) => string;
701
715
 
702
- declare const isArray: (arg: any) => arg is any[];
716
+ declare const isArray: (value: unknown) => value is readonly any[];
703
717
 
704
718
  declare const isDate: (value: any) => value is Date;
705
719
 
@@ -743,4 +757,4 @@ declare const isString: (value: any) => value is string;
743
757
 
744
758
  declare const isSymbol: (value: any) => value is symbol;
745
759
 
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 };
760
+ 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,20 @@ 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 function.
520
+ */
521
+ type KeyFilter<T extends object = object, Key extends keyof any = keyof any> = KeyFilterFunction<T> | readonly Key[];
522
+ /**
523
+ * Returns true if the key is in the “keys array” or if the “filter
524
+ * function” returns true.
525
+ */
526
+ declare const filterKey: (obj: object, key: string, filter: KeyFilter | null | undefined) => boolean;
527
+
514
528
  /**
515
529
  * Dynamically get a nested value from an array or object with a
516
530
  * string.
@@ -699,7 +713,7 @@ declare const title: (str: string | null | undefined) => string;
699
713
  */
700
714
  declare const trim: (str: string | null | undefined, charsToTrim?: string) => string;
701
715
 
702
- declare const isArray: (arg: any) => arg is any[];
716
+ declare const isArray: (value: unknown) => value is readonly any[];
703
717
 
704
718
  declare const isDate: (value: any) => value is Date;
705
719
 
@@ -743,4 +757,4 @@ declare const isString: (value: any) => value is string;
743
757
 
744
758
  declare const isSymbol: (value: any) => value is symbol;
745
759
 
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 };
760
+ 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, filter) => {
637
+ return Object.hasOwnProperty.call(obj, key) && (filter == null || (isArray(filter) ? filter.includes(key) : filter(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);
@@ -924,7 +929,7 @@ var trim = (str, charsToTrim = " ") => {
924
929
  };
925
930
 
926
931
  // src/typed/isArray.ts
927
- var isArray = Array.isArray;
932
+ var isArray = /* @__PURE__ */ (() => Array.isArray)();
928
933
 
929
934
  // src/typed/isDate.ts
930
935
  var isDate = (value) => {
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radashi",
3
- "version": "12.2.0-beta.2c63f67",
3
+ "version": "12.2.0-beta.321515e",
4
4
  "description": "Functional utility library - modern, simple, typed, powerful",
5
5
  "sideEffects": false,
6
6
  "author": "Alec Larson",