Socket
Socket
Sign inDemoInstall

filter-obj

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-obj - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

4

index.d.ts

@@ -36,3 +36,3 @@ /**

object: ObjectType,
keys: readonly IncludedKeys[]
keys: readonly IncludedKeys[] | ReadonlySet<IncludedKeys>
): Pick<ObjectType, IncludedKeys>;

@@ -75,5 +75,5 @@

object: ObjectType,
keys: readonly ExcludedKeys[]
keys: readonly ExcludedKeys[] | ReadonlySet<ExcludedKeys>
): DistributiveOmit<ObjectType, ExcludedKeys>;
type DistributiveOmit<Value, Key extends PropertyKey> = Value extends unknown ? Omit<Value, Key> : never;

@@ -0,5 +1,8 @@

// https://github.com/sindresorhus/is/tree/main?tab=readme-ov-file#why-not-just-use-instanceof-instead-of-this-package
const isSet = input => Object.prototype.toString.call(input) === '[object Set]';
export function includeKeys(object, predicate) {
const result = {};
if (Array.isArray(predicate)) {
if (Array.isArray(predicate) || isSet(predicate)) {
for (const key of predicate) {

@@ -39,3 +42,7 @@ const descriptor = Object.getOwnPropertyDescriptor(object, key);

if (isSet(predicate)) {
return includeKeys(object, key => !predicate.has(key));
}
return includeKeys(object, (key, value, object) => !predicate(key, value, object));
}
{
"name": "filter-obj",
"version": "6.0.0",
"version": "6.1.0",
"description": "Filter object keys and values into a new object",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -55,5 +55,5 @@ # filter-obj

Type: `Array<string | symbol>`
Type: `Array<string | symbol> | Set<string | symbol>`
An array of property keys to be filtered.
An array or [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) of property keys to be filtered.

@@ -60,0 +60,0 @@ ## Related

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc