• Stars
    star
    137
  • Rank 266,121 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Itty bitty little widdle twinkie pinkie ES2015 Promise implementation


pinkie

Itty bitty little widdle twinkie pinkie ES2015 Promise implementation

Build Status Coverage Status

There are tons of Promise implementations out there, but all of them focus on browser compatibility and are often bloated with functionality.

This module is an exact Promise specification polyfill (like native-promise-only), but in Node.js land (it should be browserify-able though).

Install

$ npm install --save pinkie

Usage

var fs = require('fs');
var Promise = require('pinkie');

new Promise(function (resolve, reject) {
	fs.readFile('foo.json', 'utf8', function (err, data) {
		if (err) {
			reject(err);
			return;
		}

		resolve(data);
	});
});
//=> Promise

API

pinkie exports bare ES2015 Promise implementation and polyfills Node.js rejection events. In case you forgot:

new Promise(executor)

Returns new instance of Promise.

executor

Required
Type: function

Function with two arguments resolve and reject. The first argument fulfills the promise, the second argument rejects it.

pinkie.all(promises)

Returns a promise that resolves when all of the promises in the promises Array argument have resolved.

pinkie.race(promises)

Returns a promise that resolves or rejects as soon as one of the promises in the promises Array resolves or rejects, with the value or reason from that promise.

pinkie.reject(reason)

Returns a Promise object that is rejected with the given reason.

pinkie.resolve(value)

Returns a Promise object that is resolved with the given value. If the value is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the value.

Related

License

MIT Β© Vsevolod Strukchinsky

More Repositories

1

gulp-plumber

Fixing Node pipes
JavaScript
805
star
2

gulp-watch

Watch, that actually is an endless stream
JavaScript
643
star
3

require-from-string

Load module from string
JavaScript
293
star
4

debug-http

Debug HTTP/HTTPS requests in Node.js
JavaScript
194
star
5

pinkie-promise

Promise ponyfill with pinkie
JavaScript
120
star
6

express-request-id

Middleware for setting unique request id
JavaScript
117
star
7

express-mongo-db

Get db connection in request object
JavaScript
79
star
8

node-cctz

⚑️ Fast parsing, formatting and timezone manipulations for dates
C++
59
star
9

express-dinja

Dependency injection for Express applications
JavaScript
58
star
10

chnpm

npm configuration switcher
JavaScript
44
star
11

create-error-class

Create Error classes
JavaScript
42
star
12

gulp-batch

Event batcher for gulp-watcher
JavaScript
38
star
13

plugin-jsx

JSX loader plugin
JavaScript
36
star
14

pff

Minimal implementation of printf, which is really fast
JavaScript
29
star
15

gulp-bem

BEM toolset for gulp
JavaScript
26
star
16

2q

Go
24
star
17

cacha

Cache on file-system
JavaScript
21
star
18

migratio

Automated migrations for 🐘
JavaScript
20
star
19

lru

Thread safe GoLang LRU cache
Go
19
star
20

stream-assert

Assertion library for streams
JavaScript
18
star
21

read-all-stream

Read stream to buffer or string
JavaScript
15
star
22

Aux

🚫 Project is deprecated
JavaScript
14
star
23

infinity-agent

Creates HTTP/HTTPS Agent with Infinity maxSockets
JavaScript
12
star
24

node-parsetrace

Minimal library for parsing and printing node stacktrace
JavaScript
11
star
25

yajob

Generator friendly job queue on MongoDB
JavaScript
10
star
26

proxy-support

Patch http and https request method to use tunnel-agent
JavaScript
10
star
27

vinyl-git

Vinyl adapter for working with git
JavaScript
9
star
28

got-promise

Promise wrapper around sindresorhus/got
JavaScript
9
star
29

connect-once

Connect once and memorize connection for next usages
JavaScript
9
star
30

express-stackman

Enrich Express error handler which inserts source code within stack frames
CSS
8
star
31

memorize-middleware

Cache middleware request changes
JavaScript
7
star
32

dns-graceful-stack-switch

Monkey patch DNS lookup method for node.js.
JavaScript
6
star
33

gulp-bem-debug

Debug utility for BEM objects
JavaScript
5
star
34

gulp-reload

JavaScript
5
star
35

memorize-promise

Cache promise result and update from time to time
JavaScript
5
star
36

save-stream

Save stream contents and pipe it again later
JavaScript
5
star
37

gulp-grep-stream

Grep for gulp
JavaScript
5
star
38

configs-overload

Load configs file with ease
JavaScript
5
star
39

mmo.jit.su

JavaScript
5
star
40

bemjson-to-html

BEMJSON to HTML serializer
JavaScript
4
star
41

react-styled

⚠️ Highly experimental tool for applying styles to React components
JavaScript
4
star
42

nested-prop

Get and set nested properties
JavaScript
4
star
43

deps-normalize

Dependencies normalization for gulp-bem
JavaScript
4
star
44

dag

Directed acyclic graph for JavaScript
JavaScript
4
star
45

bem-pack

Pack node-style source files from a stream of path's into a browser bundle
JavaScript
4
star
46

funsert

Functional assert library
JavaScript
4
star
47

aoc

Rust
4
star
48

flatit

Another flatten implementation for arrays
JavaScript
3
star
49

deps-graph

Builds graph by BEM deps
JavaScript
3
star
50

gulp-start-process

Just start process with `stdio: inherit`
JavaScript
3
star
51

express-real-ip

Use X-Real-IP header for ip address in express
JavaScript
3
star
52

p-batch

Batch async operations
JavaScript
2
star
53

wsping

WebSockets ping application for nodejitsu
JavaScript
2
star
54

grid

Server for distributed WebRTC networking
JavaScript
2
star
55

gulp-bem-specs

Specifications for the gulp-bem project
2
star
56

tech-deps.js

Read deps.js files for bem-object
JavaScript
2
star
57

after-event

Execute function after event is emitted and on any proceeding call
JavaScript
2
star
58

each-done

each-async + async-done = each-done
JavaScript
2
star
59

gulp-start

Start process based on filename
JavaScript
2
star
60

language-yate

Yate language support for atom
CoffeeScript
2
star
61

rndart

Google Art as a service
JavaScript
1
star
62

express-render-jsx

Render jsx files from express
JavaScript
1
star
63

bem-object

Data abstraction for gulp-bem
JavaScript
1
star
64

jsot

JSON object transformation
JavaScript
1
star
65

nodejs-shri-2013

Presentation on NodeJS
JavaScript
1
star
66

enb-browserify

Browserify tech for ENB
JavaScript
1
star
67

gulp-bem-pack

Browserify JavaScript files with levels support
JavaScript
1
star
68

httpinkie

HTTP as a Promise
JavaScript
1
star
69

get-iterable

Get a iterable as a array of items
JavaScript
1
star
70

jsot-bh

BH matchers for JSOT templating engine
JavaScript
1
star
71

wrap-middleware

Wraps middleware
JavaScript
1
star
72

glue-streams

Compose one stream from other streams, arrays or individual objects
JavaScript
1
star
73

gulp-mocha-example

JavaScript
1
star
74

ava-in-node-0.10

JavaScript
1
star
75

gulp-jscs-plumber

JavaScript
1
star
76

pg-parade

JavaScript
1
star
77

missing-middleware-error

Error class for missing middlewares
JavaScript
1
star
78

js-to-gcc

icpf2014 contest javascript to gcc translator
JavaScript
1
star
79

parse-bem-identifier

Parse B__E_M identifier
JavaScript
1
star
80

hashdir

Hashes content in directory and returning object with file structure and hashes (useful in tests)
1
star
81

require-or-die

Require common-js modules and js files that return values
JavaScript
1
star
82

web-rtchat

JavaScript
1
star
83

information-processing

C#
1
star
84

snap-context

Snapshot and restore context variables
JavaScript
1
star
85

npmup

Cli tool to update dependencies in json files
JavaScript
1
star
86

express-public-ip

Filter private addresses from req.ips
JavaScript
1
star
87

gulp-bh

Gulp plugin for bh files rendering
JavaScript
1
star