# cc-promise-shim

> a promise shim

Latest version **1.0.0** (published 2018-07-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install cc-promise-shim
pnpm add cc-promise-shim
yarn add cc-promise-shim
bun add cc-promise-shim
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-09 |
| First published | 2018-07-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | chenqf |
| Maintainers | chenqf |
| Keywords | es6, promise, shim |

## Links

- npm: https://www.npmjs.com/package/cc-promise-shim
- Repository: https://github.com/chenqf/de-promise
- Homepage: https://github.com/chenqf/de-promise#readme
- Issues: https://github.com/chenqf/de-promise/issues
- npm.io page: https://npm.io/package/cc-promise-shim

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-07-09
- 0.9.1 — 2018-07-09
- 0.9.0 — 2018-07-09
- 0.0.3 — 2018-07-09
- 0.0.2 — 2018-07-09
- 0.0.1 — 2018-07-09

## README

# cc-promise-shim


## Installation
    $ npm install --save cc-promise-shim 
    
## Usage
```javascript
const Promise = require('cc-promise-shim');

new Promise(function (resolve, reject) {
  get('http://www.google.com', function (err, res) {
    if (err) reject(err);
    else resolve(res);
  });
}).then((data)=>{
    console.log(data);
}).catch((err)=>{
    console.error(err);
});
```
## API

Before all examples, you will need:

```js
const Promise = require('cc-promise-shim');
```
### new Promise(fn)
This creates and returns a new promise.  `fn` must be a function.  The `fn` function is passed two arguments:

 1. `resolve` should be called with a single argument.  If it is called with a non-promise value then the promise is fulfilled with that value.  If it is called with a promise (A) then the returned promise takes on the state of that new promise (A).
 2. `reject` should be called with a single argument.  The returned promise will be rejected with that argument.
 
### Static Functions
  These methods are invoked by calling `Promise.methodName`.
  
__Promise.resolve(value)__

__Promise.reject(value)__

__Promise.all(array)__

__Promise.race(array)__

---
_Source: https://npm.io/package/cc-promise-shim · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
