Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

object-array-utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-array-utils - npm Package Compare versions

Comparing version
3.3.1
to
4.0.0
+5
-3
dist/index.d.ts

@@ -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: {};

{
"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": {

@@ -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';