New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

filter-arraylike-iterable

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-arraylike-iterable

array like iterable decorated with filter method

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

filter-arraylike-iterable

travis ci npm version Coverage Status Dependency Status

filter-arraylike-iterable exports a class that, given an array-like iterable, builds iterables that provide filter method.

Install

$ npm install filter-arraylike-iterable --save

Usage

const FilterArrayLikeIterable = require('filter-arraylike-iterable')

const iterable = new FilterArrayLikeIterable([4, 2, 7, 8, 4, 3, 1]) // (4 7 4 1)
    .filter(e => e % 3 === 1) // (4 7 8 7)
    .filter(e !== 4) // (7 1)

// converting to array:
[...iterable] // [7, 1]

// traversing values:
for (const val of iterable) {
    // ...
}

// creating an iterator that traverses the values
let iterator = iterable[Symbol.iterator]()
iterator.next() // {value: 7, done: false}
iterator.next() // {value: 1, done: false}
iterator.next() // {value: undefined, done: true}

// the same with string
const string = 'abcdef'

new FilterArrayLikeIterable(string) // ('a' 'b' 'c' 'd' 'e' 'f')
    .filter(e => e !== 'c' || e !== 'e') // ('a' 'b' 'd' 'f')

// the same with typed array
const typedArray = new Uint8Array([128, 0, 0, 1])

new FilterArrayLikeIterable(naturals) // (128 0 0 1)
    .filter(e => e !== 0) // (128 1)

Support

  • Node.js >=6
  • ES2015 transpilers

License

MIT

Keywords

FAQs

Package last updated on 08 Feb 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc