New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nativebird

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativebird

Ultralight promise extension compatible with Bluebird

latest
Source
npmnpm
Version
1.3.0
Version published
Weekly downloads
4.6K
-3.17%
Maintainers
0
Weekly downloads
 
Created
Source

NativeBird

Ultralight promise extension compatible with Bluebird

logo

Introduction

中文介绍

As a pioneer in JavaScript async ecosystem, Bluebird is a great userland promise library with handy utility methods included. However the way it works leads to larger bundle size and more verbose stack trace.

NativeBird is compatible with a core Bluebird subset by extending native promise, and all of its extended APIs (implemented within ~200 lines) are fully tested with the corresponding test cases in Bluebird.

NativeBird can be used in several scenarios:

  • To reuse promise utility methods like Promise.map and Promise.each without copying snippets from a gist.
  • To perform migration in existing Bluebird projects.
  • To simply learn JavaScript async operation skills 🐶.

Installation

npm install nativebird
import Promise from "nativebird";

It's also fine to copy promise.mjs and its type definition directly into your project directory.

API

Since NativeBird inherits from native promise, all promise APIs defined in ECMAScript standard (say Promise.allSettled and Promise.any) are naturally supported.

Caveats

  • Promise.cancel is not supported.
  • Synchronous inspection (e.g. Promise.isFulfilled) is not supported.

Contribution

To implement a new API in Bluebird, please also port the corresponding test cases under test/mocha in Bluebird repo and test it with npm test.

License

MIT

Keywords

promise

FAQs

Package last updated on 02 Jul 2024

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