JSPM

object-filter

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 228369
  • Score
    100M100P100Q154240F
  • License MIT

`Array.prototype.filter` for objects

Package Exports

  • object-filter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-filter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

objfilter

Build Status

Array.prototype.filter for objects.

Usage

var assert = require('assert');
var objfilter = require('../');

var o1 = {
  a: 1,
  b: -1,
  c: 0,
  d: 42
};

objfilter(o1, function (n) {
  return n > 0;
}); // => `{ a: 1, d: 42 }`

API

objfilter(obj, iterator, this)

  • obj (object) - object to filter on
  • iterator (function, required) - iterator function
  • this (optional) - this for iterator

Creates a new object with all the elements that pass the test implemented by iterator.