@nkp/iterable

  • npm
  • Node.JS package

Utility classes for synchronous and lazy iterables.

Provides a fluent interface with utilities to transform the underlying value.

Often @nkp/iterable is faster than native array methods because it does not check for array holes.

import { collect } from '@nkp/iterate';

const collection = collect([
  'index.html',
  'styles/style.css',
  'styles/normalize.css',
  // ...
  'scripts/main.js',
  'scripts/utils.js',
  // ...
  'favicon.ico',
]);

collection
  .map(file => `public/${file}`)
  .matching(/.(css|js)^/)
  .tapSelf((self) => console.log(`assets: ${self.toArray()}`);
View on GitHub