filter-obj

WebJar for filter-obj

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

filter-obj
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

filter-obj
WebJar for filter-obj
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/filter-obj

Download filter-obj

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/filter-obj/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>filter-obj</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/filter-obj/
implementation 'org.webjars.npm:filter-obj:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/filter-obj/
implementation ("org.webjars.npm:filter-obj:1.1.0")
'org.webjars.npm:filter-obj:jar:1.1.0'
<dependency org="org.webjars.npm" name="filter-obj" rev="1.1.0">
  <artifact name="filter-obj" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='filter-obj', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "filter-obj" % "1.1.0"
[org.webjars.npm/filter-obj "1.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

filter-obj

Filter object keys and values into a new object

Install

$ npm install filter-obj

Usage

const filterObject = require('filter-obj');

const object = {
	foo: true,
	bar: false
};

const newObject = filterObject(object, (key, value) => value === true);
//=> {foo: true}

const newObject2 = filterObject(object, ['bar']);
//=> {bar: false}

API

filterObject(source, filter)

filterObject(source, includeKeys)

source

Type: object

Source object to filter properties from.

filter

Type: (sourceKey, sourceValue, source) => boolean

A predicate function that detemines whether a property should be assigned to the new object.

includeKeys

Type: string[]

Array of property names that should be assigned to the new object.

Related

  • map-obj - Map object keys and values into a new object

Versions

Version
1.1.0