Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @queso/pick-by with all npm packages installed. Try it out:

var pickBy = require("@queso/pick-by")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@queso/pick-by v0.1.0

Creates an object composed of the object properties for which predicate returns truthy.

@queso/pick-by

npm license Travis Build Status codecov Try @queso/pick-by on RunKit

Part of a library of zero-dependency npm modules that do just one thing.

npm

min + gzip | 124 bytes

source

Creates an object composed of the object properties for which predicate returns truthy.

Usage

import pickBy from '@queso/pick-by'

const obj = { a: 0, b: '', c: true, d: 'hello' }
pickBy(obj)
// => { c: true, d: 'hello' }

Parameters

NameTypeDescription
objectTThe source object.
predicate<K extends keyof T>(value: T[K], key: K) => anyThe function invoked per property.

Type parameters

NameConstraint
Tobject
Kkeyof T

Returns

The new object.

Return type

Partial<T>

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free