sindresorhus

filter-obj

Filter object keys and values into a new object

by sindresorhus

JavaScript

JavaScript79.2%
TypeScript20.8%

Commit activity

Last 12 weeks · 1 commit

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 1 in progress · Last activity 1mo ago
See all on GitHub →
ehmicky

At the moment, non-enumerable properties are removed from the return value. On one hand: Most functional utilities iterate on objects using standard , , etc. which ignore non-enumerable properties. Object spreading itself removes non-enumerable properties. The concept of a property being non-enumerable implies that it should not be iterated when being copied over. Non-enumerable properties are much less common on plain objects than on class instances, and this library is meant for plain objects. On the other hand, some users might not expect non-enumerable properties removal as a side effect of this library. For example: : this would remove if it is non-enumerable, even though the user operation only intended to exclude . : this would not include if it is non-enumerable, even though the user explicitly requested to include it. For predicate functions, the user intent is less clear. @sindresorhus What are your thoughts on this?

ehmicky · 1y ago
gmaclennan

Similar to #34, this uses a distributive conditional type that returns the correct type when using on a union type. I'm not sure if there is a strange edge-case that means this does not work as-expected for , I don't want to break types for regular use.

gmaclennan · 1y ago
Richienb
Support `Set`sClosedIssue

Since the array case treats it like an iterable, we could replace the check with for a check with . We shouldn't just use because: https://github.com/sindresorhus/is#why-not-just-use-instanceof-instead-of-this-package

Richienb · 2y ago
Structured data for AI agents

Repository: sindresorhus/filter-obj. Description: Filter object keys and values into a new object Stars: 105, Forks: 12. Primary language: JavaScript. Languages: JavaScript (79.2%), TypeScript (20.8%). License: MIT. Latest release: v6.1.0 (2y ago). Open PRs: 1, open issues: 1. Last activity: 1mo ago. Community health: 85%. Top contributors: sindresorhus, ehmicky, Richienb, BendingBender, johansteffner, lo1tuma, SamVerschueren, ninevra.