Socket
Socket
Sign inDemoInstall

nice-loops

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nice-loops

Array iterators that yield to the event-loop periodically


Version published
Maintainers
1
Created
Source

nice-loops

A spin on common Array methods like forEach, map, reduce, that periodically yield to the event loop

Implemented

  • forEach
  • map
  • reduce
  • find
  • some
  • every

Ending Iteration

Unlike in regular JavaScript, all iterations can be terminated early. In the callback function, returning the EndIteration symbol will stop iteration. At the moment you'll need to read the source to see what gets returned.

import { map, symbol } from "nice-loops"

await map([1, 2, 3, 4, 5], (n => (n < 3) ? (n * 2) : symbol.EndIteration) //=> [2, 4]

FAQs

Package last updated on 09 Nov 2023

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