Socket
Socket
Sign inDemoInstall

aceink

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aceink

Async tools


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

Changelog

Source

1.3.0 (2023-09-13)

Features

  • add gowait wrap (8dbfd3c)

Readme

Source

aceink

Useful async tools.

  • createLock
    • a simple counting sempahore
  • createDeferred
    • simple deferred promise
  • q
    • a concurrent work queue
  • each, map
    • optionally concurrent iteration functions
  • gowait
    • convert a promise or promise returning function to [error,result] tuples
  • delay
    • delay ms, optionally resolve an argument
  • noop, identity, once
    • Other useful language functions

Get it on npm: npm install aceink

See the generated documentation here


Example (queue)

import { q } from 'aceink'

const { ready, add, empty } = q(10)

function fetchQux(bar) {
  return fetch(`https://example.com/${bar}`)
}

for (const foo of Array(100).keys()) {
  await ready()
  add(fetchQux, foo)
}
return empty()

Example (gowait)

import { gowait, delay } from 'aceink'

const [err, value] = await gowait(delay(100, 42))
console.log(value) //42

FAQs

Last updated on 13 Sep 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc