@nkp/smart-promise
Zero dependency SmartPromise utility. SmartPromise is is a Promise that can be resolved from outside it's executor.
import { SmartPromise } from '@nkp/smart-promise';
const promise = new SmartPromsie<string>();
promise.then((value) => console.log('resolved with:', value));
promise.resolve('success :)');
// resolved with: success :)
Table of contents
Installation
npm
npm install @nkp/smart-promise
yarn
yarn add @nkp/smart-promise
pnpm
pnpm add @nkp/range
Exports
@nkp/smart-promise
targets CommonJS and ES modules. To utilise ES modules consider using a bundler like webpack
or rollup
.
Updating dependencies
To update dependencies run one of
# if npm
# update package.json
npx npm-check-updates -u
# install
npm install
# if yarn
# update package.json
yarn create npm-check-updates -u
# install
yarn
# if pnpm
# update package.json
pnpx npm-check-updates -u
# install
pnpm install
Publishing
To a release a new version:
- Update the version number in package.json
- Push the new version to the
master
branch on GitHub - Create a
new release
on GitHub for the latest version
This will trigger a GitHub action that tests and publishes the npm package.