New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@micro-js/filter-obj

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@micro-js/filter-obj

Functional, data-last object filter.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

filter-obj

Build status Git tag NPM version Code style

Functional, data-last object filter.

Installation

$ npm install @micro-js/filter-obj

Usage

var filterObj = require('@micro-js/filter-obj')

filterObj(isEven, {a: 1, b: 2, c: 3, d: 4, e: 5}) // -> {b: 2, c: 4}

function isEven (n) {
  return n % 2 === 0
}

API

filterObj(fn, obj)

  • fn - The predicate function. Receives fn(val, key) for each key/value pair in the object. Returns a bool indicating whether to keep it or not.
  • obj - The object to filter

Returns: A new object containing only the key/value pairs that passed the fn(val, key) truth test (that it returned truthy for).

License

MIT

FAQs

Package last updated on 12 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts