1.0.0 • Published 8 years ago

reduce-extract v1.0.0

Weekly downloads
73,987
License
MIT
Repository
github
Last release
8 years ago

view on npm npm module downloads Build Status Dependency Status js-standard-style

reduce-extract

extract(query) ⏏

Removes items from array which satisfy the query. Modifies the input array, returns the extracted.

Kind: Exported function

ParamTypeDescription
queryArraythe input array, modified directly
anyif an item in the input array passes this test it is removed

Example

> DJs = [
    { name: "Trevor", sacked: true },
    { name: "Mike", sacked: true },
    { name: "Chris", sacked: false },
    { name: "Alan", sacked: false }
]

> a.extract(DJs, { sacked: true })
[ { name: 'Trevor', sacked: true },
  { name: 'Mike', sacked: true } ]

> DJs
[ { name: 'Chris', sacked: false },
  { name: 'Alan', sacked: false } ]

© 2016 Lloyd Brookes 75pound@gmail.com. Documented by jsdoc-to-markdown.