summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules')
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/index.js292
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/license21
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/package.json47
-rw-r--r--deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/readme.md83
4 files changed, 443 insertions, 0 deletions
diff --git a/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/index.js b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/index.js
new file mode 100644
index 0000000000..14ce1bfe3d
--- /dev/null
+++ b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/index.js
@@ -0,0 +1,292 @@
+'use strict';
+
+var PENDING = 'pending';
+var SETTLED = 'settled';
+var FULFILLED = 'fulfilled';
+var REJECTED = 'rejected';
+var NOOP = function () {};
+var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
+
+var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
+var asyncQueue = [];
+var asyncTimer;
+
+function asyncFlush() {
+ // run promise callbacks
+ for (var i = 0; i < asyncQueue.length; i++) {
+ asyncQueue[i][0](asyncQueue[i][1]);
+ }
+
+ // reset async asyncQueue
+ asyncQueue = [];
+ asyncTimer = false;
+}
+
+function asyncCall(callback, arg) {
+ asyncQueue.push([callback, arg]);
+
+ if (!asyncTimer) {
+ asyncTimer = true;
+ asyncSetTimer(asyncFlush, 0);
+ }
+}
+
+function invokeResolver(resolver, promise) {
+ function resolvePromise(value) {
+ resolve(promise, value);
+ }
+
+ function rejectPromise(reason) {
+ reject(promise, reason);
+ }
+
+ try {
+ resolver(resolvePromise, rejectPromise);
+ } catch (e) {
+ rejectPromise(e);
+ }
+}
+
+function invokeCallback(subscriber) {
+ var owner = subscriber.owner;
+ var settled = owner._state;
+ var value = owner._data;
+ var callback = subscriber[settled];
+ var promise = subscriber.then;
+
+ if (typeof callback === 'function') {
+ settled = FULFILLED;
+ try {
+ value = callback(value);
+ } catch (e) {
+ reject(promise, e);
+ }
+ }
+
+ if (!handleThenable(promise, value)) {
+ if (settled === FULFILLED) {
+ resolve(promise, value);
+ }
+
+ if (settled === REJECTED) {
+ reject(promise, value);
+ }
+ }
+}
+
+function handleThenable(promise, value) {
+ var resolved;
+
+ try {
+ if (promise === value) {
+ throw new TypeError('A promises callback cannot return that same promise.');
+ }
+
+ if (value && (typeof value === 'function' || typeof value === 'object')) {
+ // then should be retrieved only once
+ var then = value.then;
+
+ if (typeof then === 'function') {
+ then.call(value, function (val) {
+ if (!resolved) {
+ resolved = true;
+
+ if (value === val) {
+ fulfill(promise, val);
+ } else {
+ resolve(promise, val);
+ }
+ }
+ }, function (reason) {
+ if (!resolved) {
+ resolved = true;
+
+ reject(promise, reason);
+ }
+ });
+
+ return true;
+ }
+ }
+ } catch (e) {
+ if (!resolved) {
+ reject(promise, e);
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+function resolve(promise, value) {
+ if (promise === value || !handleThenable(promise, value)) {
+ fulfill(promise, value);
+ }
+}
+
+function fulfill(promise, value) {
+ if (promise._state === PENDING) {
+ promise._state = SETTLED;
+ promise._data = value;
+
+ asyncCall(publishFulfillment, promise);
+ }
+}
+
+function reject(promise, reason) {
+ if (promise._state === PENDING) {
+ promise._state = SETTLED;
+ promise._data = reason;
+
+ asyncCall(publishRejection, promise);
+ }
+}
+
+function publish(promise) {
+ promise._then = promise._then.forEach(invokeCallback);
+}
+
+function publishFulfillment(promise) {
+ promise._state = FULFILLED;
+ publish(promise);
+}
+
+function publishRejection(promise) {
+ promise._state = REJECTED;
+ publish(promise);
+ if (!promise._handled && isNode) {
+ global.process.emit('unhandledRejection', promise._data, promise);
+ }
+}
+
+function notifyRejectionHandled(promise) {
+ global.process.emit('rejectionHandled', promise);
+}
+
+/**
+ * @class
+ */
+function Promise(resolver) {
+ if (typeof resolver !== 'function') {
+ throw new TypeError('Promise resolver ' + resolver + ' is not a function');
+ }
+
+ if (this instanceof Promise === false) {
+ throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
+ }
+
+ this._then = [];
+
+ invokeResolver(resolver, this);
+}
+
+Promise.prototype = {
+ constructor: Promise,
+
+ _state: PENDING,
+ _then: null,
+ _data: undefined,
+ _handled: false,
+
+ then: function (onFulfillment, onRejection) {
+ var subscriber = {
+ owner: this,
+ then: new this.constructor(NOOP),
+ fulfilled: onFulfillment,
+ rejected: onRejection
+ };
+
+ if ((onRejection || onFulfillment) && !this._handled) {
+ this._handled = true;
+ if (this._state === REJECTED && isNode) {
+ asyncCall(notifyRejectionHandled, this);
+ }
+ }
+
+ if (this._state === FULFILLED || this._state === REJECTED) {
+ // already resolved, call callback async
+ asyncCall(invokeCallback, subscriber);
+ } else {
+ // subscribe
+ this._then.push(subscriber);
+ }
+
+ return subscriber.then;
+ },
+
+ catch: function (onRejection) {
+ return this.then(null, onRejection);
+ }
+};
+
+Promise.all = function (promises) {
+ if (!Array.isArray(promises)) {
+ throw new TypeError('You must pass an array to Promise.all().');
+ }
+
+ return new Promise(function (resolve, reject) {
+ var results = [];
+ var remaining = 0;
+
+ function resolver(index) {
+ remaining++;
+ return function (value) {
+ results[index] = value;
+ if (!--remaining) {
+ resolve(results);
+ }
+ };
+ }
+
+ for (var i = 0, promise; i < promises.length; i++) {
+ promise = promises[i];
+
+ if (promise && typeof promise.then === 'function') {
+ promise.then(resolver(i), reject);
+ } else {
+ results[i] = promise;
+ }
+ }
+
+ if (!remaining) {
+ resolve(results);
+ }
+ });
+};
+
+Promise.race = function (promises) {
+ if (!Array.isArray(promises)) {
+ throw new TypeError('You must pass an array to Promise.race().');
+ }
+
+ return new Promise(function (resolve, reject) {
+ for (var i = 0, promise; i < promises.length; i++) {
+ promise = promises[i];
+
+ if (promise && typeof promise.then === 'function') {
+ promise.then(resolve, reject);
+ } else {
+ resolve(promise);
+ }
+ }
+ });
+};
+
+Promise.resolve = function (value) {
+ if (value && typeof value === 'object' && value.constructor === Promise) {
+ return value;
+ }
+
+ return new Promise(function (resolve) {
+ resolve(value);
+ });
+};
+
+Promise.reject = function (reason) {
+ return new Promise(function (resolve, reject) {
+ reject(reason);
+ });
+};
+
+module.exports = Promise;
diff --git a/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/license b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/license
new file mode 100644
index 0000000000..1aeb74fd25
--- /dev/null
+++ b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/package.json b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/package.json
new file mode 100644
index 0000000000..d94124cdf5
--- /dev/null
+++ b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/package.json
@@ -0,0 +1,47 @@
+{
+ "_from": "pinkie@^2.0.0",
+ "_id": "pinkie@2.0.4",
+ "_inBundle": false,
+ "_integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+ "_location": "/libnpx/yargs/os-locale/execa/get-stream/pinkie-promise/pinkie",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "pinkie@^2.0.0",
+ "name": "pinkie",
+ "escapedName": "pinkie",
+ "rawSpec": "^2.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.0"
+ },
+ "_requiredBy": [
+ "/libnpx/yargs/os-locale/execa/get-stream/pinkie-promise"
+ ],
+ "_resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "_shasum": "72556b80cfa0d48a974e80e77248e80ed4f7f870",
+ "_shrinkwrap": null,
+ "_spec": "pinkie@^2.0.0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise",
+ "bin": null,
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "<h1 align=\"center\"> \t<br> \t<img width=\"256\" src=\"media/logo.png\" alt=\"pinkie\"> \t<br> \t<br> </h1>",
+ "devDependencies": {
+ "core-assert": "^0.1.1",
+ "coveralls": "^2.11.4",
+ "mocha": "*",
+ "nyc": "^3.2.2",
+ "promises-aplus-tests": "*",
+ "xo": "^0.10.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "name": "pinkie",
+ "optionalDependencies": {},
+ "peerDependencies": {},
+ "scripts": {},
+ "version": "2.0.4"
+}
diff --git a/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/readme.md b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/readme.md
new file mode 100644
index 0000000000..54747f60cc
--- /dev/null
+++ b/deps/npm/node_modules/libnpx/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/get-stream/node_modules/pinkie-promise/node_modules/pinkie/readme.md
@@ -0,0 +1,83 @@
+<h1 align="center">
+ <br>
+ <img width="256" src="media/logo.png" alt="pinkie">
+ <br>
+ <br>
+</h1>
+
+> Itty bitty little widdle twinkie pinkie [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation
+
+[![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie) [![Coverage Status](https://coveralls.io/repos/floatdrop/pinkie/badge.svg?branch=master&service=github)](https://coveralls.io/github/floatdrop/pinkie?branch=master)
+
+There are [tons of Promise implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md#standalone) 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](https://github.com/getify/native-promise-only)), but in Node.js land (it should be browserify-able though).
+
+
+## Install
+
+```
+$ npm install --save pinkie
+```
+
+
+## Usage
+
+```js
+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](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation and polyfills [Node.js rejection events](https://nodejs.org/api/process.html#process_event_unhandledrejection). 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
+
+- [pinkie-promise](https://github.com/floatdrop/pinkie-promise) - Returns the native Promise or this module
+
+
+## License
+
+MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)