object-array-utils
Advanced tools
+5
-3
@@ -33,5 +33,7 @@ export declare type ObjectLiteral<T = unknown> = Record<string, T>; | ||
| declare function hasProperties(o: ObjectInstance | ObjectLiteral, props: string[]): boolean; | ||
| declare function filterProperties<T>(o: ObjectLiteral<T>, arg: string[] | ((key: string, val: T) => boolean)): {}; | ||
| declare function rejectProperties<T>(o: ObjectLiteral<T>, arg: string[] | ((key: string, val: T) => boolean)): {}; | ||
| declare function takeProperties<T>(o: ObjectLiteral<T>, arg: string[] | ((key: string, val: T) => boolean)): { | ||
| declare function filterProperties<T = unknown>(o: object, arg: string[] | ((key: string, val: T) => boolean)): {}; | ||
| declare function rejectProperties<T = unknown>(o: object, arg: string[] | ((key: string, val: T) => boolean)): { | ||
| [k: string]: any; | ||
| }; | ||
| declare function takeProperties<T = unknown>(o: object, arg: string[] | ((key: string, val: T) => boolean)): { | ||
| filtered: {}; | ||
@@ -38,0 +40,0 @@ rejected: {}; |
+4
-4
| { | ||
| "name": "object-array-utils", | ||
| "version": "3.3.1", | ||
| "version": "4.0.0", | ||
| "description": "Utilities for working with arrays and objects", | ||
@@ -19,7 +19,7 @@ "funding": "https://github.com/mathieuprog/object-array-utils?sponsor=1", | ||
| "devDependencies": { | ||
| "@tsconfig/node18": "^18.2.1", | ||
| "rollup": "^3.28.1", | ||
| "@tsconfig/node18": "^18.2.2", | ||
| "rollup": "^3.29.3", | ||
| "typescript": "^5.2.2", | ||
| "vite": "^4.4.9", | ||
| "vitest": "^0.34.3" | ||
| "vitest": "^0.34.5" | ||
| }, | ||
@@ -26,0 +26,0 @@ "repository": { |
+3
-3
@@ -67,3 +67,3 @@ # `object-array-utils` | ||
| filterProperties({ prop1: 1, prop2: 2 }, ['prop1', 'prop3']) // { prop1: 1 } | ||
| filterProperties({ prop1: 1, prop2: 2 }, (_key, val) => val < 2) // { prop1: 1 } | ||
| filterProperties<number>({ prop1: 1, prop2: 2 }, (_key, val) => val < 2) // { prop1: 1 } | ||
@@ -73,3 +73,3 @@ import { rejectProperties } from 'object-array-utils'; | ||
| rejectProperties({ prop1: 1, prop2: 2 }, ['prop1', 'prop3']) // { prop2: 2 } | ||
| rejectProperties({ prop1: 1, prop2: 2 }, (_key, val) => val < 2) // { prop2: 2 } | ||
| rejectProperties<number>({ prop1: 1, prop2: 2 }, (_key, val) => val < 2) // { prop2: 2 } | ||
@@ -79,3 +79,3 @@ import { takeProperties } from 'object-array-utils'; | ||
| takeProperties({ prop1: 1, prop2: 2 }, ['prop1', 'prop3']) // { filtered: { prop1: 1 }, rejected: { prop2: 2 } } | ||
| takeProperties({ prop1: 1, prop2: 2 }, (_key, val) => val < 2) // { filtered: { prop1: 1 }, rejected: { prop2: 2 } } | ||
| takeProperties<number>({ prop1: 1, prop2: 2 }, (_key, val) => val < 2) // { filtered: { prop1: 1 }, rejected: { prop2: 2 } } | ||
@@ -82,0 +82,0 @@ import { sortProperties } from 'object-array-utils'; |
51081
0.1%731
0.27%