JSPM

object-filter-sequence

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 325109
  • Score
    100M100P100Q174838F
  • License MIT

Apply a sequence of filter functions to an object

Package Exports

  • object-filter-sequence

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-sequence) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

object-filter-sequence

npm Build status codecov Standard - JavaScript Style Guide

This module provides an interface to apply a sequence of filters to an object. It is a subclass of Array, so any array method can be used on it.

Installation

npm install object-filter-sequence

Example Usage

const Filters = require('object-filter-sequence')

const filters = new Filters()

filters.push(previous => {
  const next = {}
  next.key = previous.key.toUpperCase()
  return next
})

filters.push(previous => {
  const next = {}
  next.key = previous.key.reverse()
  return next
})

filters.process({ key: 'value' }) // { key: 'EULAV' }

API

filters.process(object)

This is the only unique method from the Array base class. It is used to apply the filters in the array to the provided object.

License

MIT