Socket
Socket
Sign inDemoInstall

nice-loops

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nice-loops

Array iterators that yield to the event-loop periodically


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
75.2 kB
Created
Weekly downloads
 

Readme

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

Last updated on 09 Nov 2023

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc