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

promised-map

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promised-map

A map of promises that can be resolved or rejected by key

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
increased by104.57%
Maintainers
1
Weekly downloads
 
Created
Source

promised-map

Actions Status npm license

A map of promises that can be resolved or rejected by key. Once promise is resolved/rejected, related key/value pair is automatically removed from map.

Contents

Installation

npm install promised-map

Usage

import { PromisedMap } from 'promised-map';

const map = new PromisedMap();

// set key/value pair and retrieve related promise.
const promise = map.set('foo', 42);

// resolve promise later by key
map.resolve('foo', 'bar');

// reject promise by key
map.reject('foo', new Error('error'));

// check if promise is still pending
map.has('foo');

// resolve all promises and clear map
map.resolveAll('bar');

// reject all promises and clear map
map.rejectAll(new Error('error'));

// iterate all promises
map.forEach((value, key) => { /* ... */ });

License

MIT @ Vitaliy Potapov

Keywords

FAQs

Package last updated on 08 Feb 2021

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