Projects
Mega:23.09
nodejs-promise
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:nodejs-promise.spec
Changed
@@ -3,7 +3,7 @@ %global enable_tests 1 Name: nodejs-promise -Version: 8.0.1 +Version: 8.3.0 Release: 1 Summary: Bare bones Promises/A+ implementation for Node.js License: MIT @@ -65,5 +65,8 @@ %changelog +* Thu Nov 2 2023 liyanan <liyanan61@h-parners.com> - 8.3.0-1 +- Update to 8.3.0 + * Wed Aug 19 2020 wangxiao <wangxiao65@huawei.com> - 8.0.1-1 - package init
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/nodejs-promise.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:promise-8.0.1.tgz/.npmignore
Deleted
@@ -1,7 +0,0 @@ -components -node_modules -test -.gitignore -.travis.yml -component.json -coverage
View file
_service:tar_scm:promise-8.0.1.tgz/package-lock.json
Deleted
@@ -1,741 +0,0 @@ -{ - "name": "promise", - "version": "7.1.1", - "lockfileVersion": 1, - "dependencies": { - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, - "acorn": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz", - "integrity": "sha1-yM4n3grMdtiW0rH6099YjZ6C8BQ=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dev": true - }, - "asap": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz", - "integrity": "sha1-UidltQw1EEkOUtfc/ghe+bqWlY8=" - }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true - }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", - "dev": true - }, - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true, - "optional": true - }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "optional": true - }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "optional": true, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true, - "optional": true - } - } - }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "debug": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", - "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true, - "optional": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.7.1.tgz", - "integrity": "sha1-MOz89mypjcZ80v0WKr626vqM5vw=", - "dev": true, - "dependencies": { - "esprima": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.5.tgz", - "integrity": "sha1-CZNQL+r2aBODJXVvMPmlH+7sEek=", - "dev": true - } - } - }, - "esprima": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.5.0.tgz", - "integrity": "sha1-84ekb9NEwbGjm6+MIL+0O20AWMw=", - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "fast-levenshtein": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.0.7.tgz", - "integrity": "sha1-AXjc3uAjuSkFGTrwlZ6KdjnP3Lk=", - "dev": true - }, - "fileset": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fileset/-/fileset-0.2.1.tgz", - "integrity": "sha1-WI74lzxmI7KnbfRlEFaWuWqsgGc=", - "dev": true - }, - "formatio": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true - }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, - "handlebars": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", - "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", - "dev": true, - "dependencies": { - "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "dev": true - } - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "istanbul": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.3.22.tgz", - "integrity": "sha1-PhZNhQIf4ZyYXR8OfvDD4i0BLrY=", - "dev": true - }, - "jade": { - "version": "0.26.3", - "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", - "integrity": "sha1-jxDXl32NefL2/4YqgbBRPMslaGw=", - "dev": true, - "dependencies": { - "commander": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz", - "integrity": "sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=", - "dev": true - }, - "mkdirp": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", - "integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=", - "dev": true - } - } - }, - "js-yaml": { - "version": "3.8.4", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.8.4.tgz", - "integrity": "sha1-UgtFZPhlc7qWZir4Woyvp7S1pvY=", - "dev": true, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - } - } - }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true, - "optional": true - }, - "levn": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.2.5.tgz", - "integrity": "sha1-uo0znQykphDjo/FFucr0iAcVUFQ=", - "dev": true - }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true - }, - "lolex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", - "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", - "dev": true - }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", - "dev": true - }, - "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", - "dev": true - }, - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "mocha": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.4.2.tgz", - "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", - "dev": true, - "dependencies": { - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true - } - } - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } - } - }, - "optionator": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.5.0.tgz", - "integrity": "sha1-t1qJlaLUF98ltuTjhi9QqohlE2g=", - "dev": true, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "promises-aplus-tests": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/promises-aplus-tests/-/promises-aplus-tests-2.1.2.tgz", - "integrity": "sha1-drfFY4locghhlpz7zYeVr9J0iFw=", - "dev": true, - "dependencies": { - "commander": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.3.0.tgz", - "integrity": "sha1-/UMOiJgy7DU7ms0d4hfBHLPu+HM=", - "dev": true - }, - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "dev": true - }, - "diff": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz", - "integrity": "sha1-fyjS657nsVqX79ic5j3P2qPMur8=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", - "integrity": "sha1-Tbwv5nTnGUnK8/smlc5/LcHZqNE=", - "dev": true - }, - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "dev": true - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "dev": true - }, - "mocha": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-2.5.3.tgz", - "integrity": "sha1-FhvlvetJZ3HrmzV0UFC2IrWu/Fg=", - "dev": true - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", - "dev": true - }, - "supports-color": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.2.0.tgz", - "integrity": "sha1-/x7R5hFp0Gs88tWI4YixjYhH4X4=", - "dev": true - } - } - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "optional": true - }, - "rimraf": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", - "dev": true, - "dependencies": { - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true - } - } - }, - "samsam": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", - "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", - "dev": true - }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", - "dev": true - }, - "sinon": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", - "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=", - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true - }, - "to-iso-string": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/to-iso-string/-/to-iso-string-0.0.2.tgz", - "integrity": "sha1-TcGeZk38y+Jb2NtQiwDG2hWCVdE=", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "optional": true, - "dependencies": { - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", - "dev": true, - "optional": true - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - } - } - }, - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", - "dev": true - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true, - "optional": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "optional": true - } - } -}
View file
_service:tar_scm:promise-8.0.1.tgz/Readme.md -> _service:tar_scm:promise-8.3.0.tgz/Readme.md
Changed
@@ -7,19 +7,10 @@ **N.B.** This promise exposes internals via underscore (`_`) prefixed properties. If you use these, your code will break with each new release. -!travistravis-imagetravis-url -!depdep-imagedep-url -!npmnpm-imagenpm-url -!downloadsdownloads-imagedownloads-url - -travis-image: https://img.shields.io/travis/then/promise.svg?style=flat -travis-url: https://travis-ci.org/then/promise -dep-image: https://img.shields.io/david/then/promise.svg?style=flat -dep-url: https://david-dm.org/then/promise -npm-image: https://img.shields.io/npm/v/promise.svg?style=flat -npm-url: https://npmjs.org/package/promise -downloads-image: https://img.shields.io/npm/dm/promise.svg?style=flat -downloads-url: https://npmjs.org/package/promise +!Build Status(https://img.shields.io/github/workflow/status/then/promise/Publish%20Canary/master?style=for-the-badge)(https://github.com/then/promise/actions?query=workflow%3APublish%20Canary+branch%3Amaster) +!Rolling Versions(https://img.shields.io/badge/Rolling%20Versions-Enabled-brightgreen?style=for-the-badge)(https://rollingversions.com/then/promise) +!NPM version(https://img.shields.io/npm/v/promise?style=for-the-badge)(https://www.npmjs.com/package/promise) +!Downloads(https://img.shields.io/npm/dm/promise.svg?style=for-the-badge)(https://www.npmjs.org/package/promise) ## Installation @@ -56,7 +47,7 @@ }); ``` -If you need domains(https://iojs.org/api/domain.html) support, you should instead use: +If you need domains(https://nodejs.org/api/domain.html) support, you should instead use: ```js var Promise = require('promise/domains'); @@ -100,7 +91,7 @@ `rejection-tracking.enable(options)` takes the following options: - - allRejections (`boolean`) - track all exceptions, not just reference errors and type errors. Note that this has a high probability of resulting in false positives if your code loads data optimisticly + - allRejections (`boolean`) - track all exceptions, not just reference errors and type errors. Note that this has a high probability of resulting in false positives if your code loads data optimistically - whitelist (`Array<ErrorConstructor>`) - this defaults to `ReferenceError, TypeError` but you can override it with your own list of error constructors to track. - `onUnhandled(id, error)` and `onHandled(id, error)` - you can use these to provide your own customised display for errors. Note that if possible you should indicate that the error was a false positive if `onHandled` is called. `onHandled` is only called if `onUnhandled` has already been called. @@ -108,6 +99,8 @@ ## API +Detailed API reference docs are available at https://www.promisejs.org/api/. + Before all examples, you will need: ```js @@ -148,6 +141,50 @@ }) ``` +#### Promise.any(array) + +Returns a single promise that fulfills as soon as any of the promises in the iterable fulfills, with the value of the fulfilled promise. If no promises in the iterable fulfill (if all of the given promises are rejected), then the returned promise is rejected with an `AggregateError` + +```js +var rejected = Promise.reject(0); +var first = new Promise(function (resolve){ setTimeout(resolve, 100, 'quick') }); +var second = new Promise(function (resolve){ setTimeout(resolve, 500, 'slow') }); + +var promises = rejected, first, second; + +Promise.any(promises) // => succeeds with `quick` +``` + +#### Promise.allSettled(array) + +Returns a promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects that each describes the outcome of each promise. + +```js +Promise.allSettled(Promise.resolve('a'), Promise.reject('error'), Promise.resolve('c')) + .then(function (res) { + res0 // { status: "fulfilled", value: 'a' } + res1 // { status: "rejected", reason: 'error' } + res2 // { status: "fulfilled", value: 'c' } + }) +``` + +#### Promise.race(array) + +Returns a promise that resolves or rejects with the result of the first promise to resolve/reject, e.g. +```js +var rejected = Promise.reject(new Error('Whatever')); +var fulfilled = new Promise(function (resolve) { + setTimeout(() => resolve('success'), 500); +}); + +var race = Promise.race(rejected, fulfilled); +// => immediately rejected with `new Error('Whatever')` + +var success = Promise.resolve('immediate success'); +var first = Promise.race(success, fulfilled); +// => immediately succeeds with `immediate success` +``` + #### Promise.denodeify(fn) _Non Standard_ @@ -226,6 +263,12 @@ People who use typical node.js style callbacks will be able to just pass a callback and get the expected behavior. The enlightened people can not pass a callback and will get awesome promises. +## Enterprise Support + +Available as part of the Tidelift Subscription + +The maintainers of promise and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.(https://tidelift.com/subscription/pkg/npm-promise?utm_source=npm-promise&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + ## License MIT
View file
_service:tar_scm:promise-8.0.1.tgz/build.js -> _service:tar_scm:promise-8.3.0.tgz/build.js
Changed
@@ -4,19 +4,19 @@ var rimraf = require('rimraf'); var acorn = require('acorn'); var walk = require('acorn/dist/walk'); +var crypto = require('crypto'); -var ids = ; -var names = {}; +var shasum = crypto.createHash('sha512'); +fs.readdirSync(__dirname + '/src').sort().forEach(function (filename) { + shasum.update(fs.readFileSync(__dirname + '/src/' + filename, 'utf8')); +}); +const names = {}; +const characterSet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; +let i = characterSet.indexOf(shasum.digest('base64').replace(/^0-9a-zA-Z/g, '')0); function getIdFor(name) { - if (name in names) return namesname; - var id; - do { - id = '_' + Math.floor(Math.random() * 100); - } while (ids.indexOf(id) !== -1) - ids.push(id); - namesname = id; - return id; + if (namesname) return namesname; + return namesname = '_' + characterSeti++ % characterSet.length } function fixup(src) { @@ -30,9 +30,6 @@ replace(node.property, getIdFor(node.property.name)); } }); - function source(node) { - return src.slice(node.start, node.end).join(''); - } function replace(node, str) { for (var i = node.start; i < node.end; i++) { srci = '';
View file
_service:tar_scm:promise-8.0.1.tgz/domains/core.js -> _service:tar_scm:promise-8.3.0.tgz/domains/core.js
Changed
@@ -58,16 +58,16 @@ if (typeof fn !== 'function') { throw new TypeError('Promise constructor\'s argument is not a function'); } - this._75 = 0; - this._83 = 0; - this._18 = null; - this._38 = null; + this._x = 0; + this._y = 0; + this._z = null; + this._A = null; if (fn === noop) return; doResolve(fn, this); } -Promise._47 = null; -Promise._71 = null; -Promise._44 = noop; +Promise._B = null; +Promise._C = null; +Promise._D = noop; Promise.prototype.then = function(onFulfilled, onRejected) { if (this.constructor !== Promise) { @@ -86,24 +86,24 @@ }); } function handle(self, deferred) { - while (self._83 === 3) { - self = self._18; + while (self._y === 3) { + self = self._z; } - if (Promise._47) { - Promise._47(self); + if (Promise._B) { + Promise._B(self); } - if (self._83 === 0) { - if (self._75 === 0) { - self._75 = 1; - self._38 = deferred; + if (self._y === 0) { + if (self._x === 0) { + self._x = 1; + self._A = deferred; return; } - if (self._75 === 1) { - self._75 = 2; - self._38 = self._38, deferred; + if (self._x === 1) { + self._x = 2; + self._A = self._A, deferred; return; } - self._38.push(deferred); + self._A.push(deferred); return; } handleResolved(self, deferred); @@ -111,16 +111,16 @@ function handleResolved(self, deferred) { asap(function() { - var cb = self._83 === 1 ? deferred.onFulfilled : deferred.onRejected; + var cb = self._y === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { - if (self._83 === 1) { - resolve(deferred.promise, self._18); + if (self._y === 1) { + resolve(deferred.promise, self._z); } else { - reject(deferred.promise, self._18); + reject(deferred.promise, self._z); } return; } - var ret = tryCallOne(cb, self._18); + var ret = tryCallOne(cb, self._z); if (ret === IS_ERROR) { reject(deferred.promise, LAST_ERROR); } else { @@ -148,8 +148,8 @@ then === self.then && newValue instanceof Promise ) { - self._83 = 3; - self._18 = newValue; + self._y = 3; + self._z = newValue; finale(self); return; } else if (typeof then === 'function') { @@ -157,29 +157,29 @@ return; } } - self._83 = 1; - self._18 = newValue; + self._y = 1; + self._z = newValue; finale(self); } function reject(self, newValue) { - self._83 = 2; - self._18 = newValue; - if (Promise._71) { - Promise._71(self, newValue); + self._y = 2; + self._z = newValue; + if (Promise._C) { + Promise._C(self, newValue); } finale(self); } function finale(self) { - if (self._75 === 1) { - handle(self, self._38); - self._38 = null; + if (self._x === 1) { + handle(self, self._A); + self._A = null; } - if (self._75 === 2) { - for (var i = 0; i < self._38.length; i++) { - handle(self, self._38i); + if (self._x === 2) { + for (var i = 0; i < self._A.length; i++) { + handle(self, self._Ai); } - self._38 = null; + self._A = null; } }
View file
_service:tar_scm:promise-8.0.1.tgz/domains/es6-extensions.js -> _service:tar_scm:promise-8.3.0.tgz/domains/es6-extensions.js
Changed
@@ -16,9 +16,9 @@ var EMPTYSTRING = valuePromise(''); function valuePromise(value) { - var p = new Promise(Promise._44); - p._83 = 1; - p._18 = value; + var p = new Promise(Promise._D); + p._y = 1; + p._z = value; return p; } Promise.resolve = function (value) { @@ -46,8 +46,20 @@ return valuePromise(value); }; +var iterableToArray = function (iterable) { + if (typeof Array.from === 'function') { + // ES2015+, iterables exist + iterableToArray = Array.from; + return Array.from(iterable); + } + + // ES5, only arrays and array-likes exist + iterableToArray = function (x) { return Array.prototype.slice.call(x); }; + return Array.prototype.slice.call(iterable); +} + Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); + var args = iterableToArray(arr); return new Promise(function (resolve, reject) { if (args.length === 0) return resolve(); @@ -55,11 +67,11 @@ function res(i, val) { if (val && (typeof val === 'object' || typeof val === 'function')) { if (val instanceof Promise && val.then === Promise.prototype.then) { - while (val._83 === 3) { - val = val._18; + while (val._y === 3) { + val = val._z; } - if (val._83 === 1) return res(i, val._18); - if (val._83 === 2) reject(val._18); + if (val._y === 1) return res(i, val._z); + if (val._y === 2) reject(val._z); val.then(function (val) { res(i, val); }, reject); @@ -86,6 +98,29 @@ }); }; +function onSettledFulfill(value) { + return { status: 'fulfilled', value: value }; +} +function onSettledReject(reason) { + return { status: 'rejected', reason: reason }; +} +function mapAllSettled(item) { + if(item && (typeof item === 'object' || typeof item === 'function')){ + if(item instanceof Promise && item.then === Promise.prototype.then){ + return item.then(onSettledFulfill, onSettledReject); + } + var then = item.then; + if (typeof then === 'function') { + return new Promise(then.bind(item)).then(onSettledFulfill, onSettledReject) + } + } + + return onSettledFulfill(item); +} +Promise.allSettled = function (iterable) { + return Promise.all(iterableToArray(iterable).map(mapAllSettled)); +}; + Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); @@ -94,7 +129,7 @@ Promise.race = function (values) { return new Promise(function (resolve, reject) { - values.forEach(function(value){ + iterableToArray(values).forEach(function(value){ Promise.resolve(value).then(resolve, reject); }); }); @@ -105,3 +140,47 @@ Promise.prototype'catch' = function (onRejected) { return this.then(null, onRejected); }; + +function getAggregateError(errors){ + if(typeof AggregateError === 'function'){ + return new AggregateError(errors,'All promises were rejected'); + } + + var error = new Error('All promises were rejected'); + + error.name = 'AggregateError'; + error.errors = errors; + + return error; +} + +Promise.any = function promiseAny(values) { + return new Promise(function(resolve, reject) { + var promises = iterableToArray(values); + var hasResolved = false; + var rejectionReasons = ; + + function resolveOnce(value) { + if (!hasResolved) { + hasResolved = true; + resolve(value); + } + } + + function rejectionCheck(reason) { + rejectionReasons.push(reason); + + if (rejectionReasons.length === promises.length) { + reject(getAggregateError(rejectionReasons)); + } + } + + if(promises.length === 0){ + reject(getAggregateError(rejectionReasons)); + } else { + promises.forEach(function(value){ + Promise.resolve(value).then(resolveOnce, rejectionCheck); + }); + } + }); +};
View file
_service:tar_scm:promise-8.0.1.tgz/domains/finally.js -> _service:tar_scm:promise-8.3.0.tgz/domains/finally.js
Changed
@@ -3,7 +3,7 @@ var Promise = require('./core.js'); module.exports = Promise; -Promise.prototype'finally' = function (f) { +Promise.prototype.finally = function (f) { return this.then(function (value) { return Promise.resolve(f()).then(function () { return value;
View file
_service:tar_scm:promise-8.0.1.tgz/domains/rejection-tracking.js -> _service:tar_scm:promise-8.3.0.tgz/domains/rejection-tracking.js
Changed
@@ -12,8 +12,8 @@ exports.disable = disable; function disable() { enabled = false; - Promise._47 = null; - Promise._71 = null; + Promise._B = null; + Promise._C = null; } exports.enable = enable; @@ -24,27 +24,27 @@ var id = 0; var displayId = 0; var rejections = {}; - Promise._47 = function (promise) { + Promise._B = function (promise) { if ( - promise._83 === 2 && // IS REJECTED - rejectionspromise._56 + promise._y === 2 && // IS REJECTED + rejectionspromise._E ) { - if (rejectionspromise._56.logged) { - onHandled(promise._56); + if (rejectionspromise._E.logged) { + onHandled(promise._E); } else { - clearTimeout(rejectionspromise._56.timeout); + clearTimeout(rejectionspromise._E.timeout); } - delete rejectionspromise._56; + delete rejectionspromise._E; } }; - Promise._71 = function (promise, err) { - if (promise._75 === 0) { // not yet handled - promise._56 = id++; - rejectionspromise._56 = { + Promise._C = function (promise, err) { + if (promise._x === 0) { // not yet handled + promise._E = id++; + rejectionspromise._E = { displayId: null, error: err, timeout: setTimeout( - onUnhandled.bind(null, promise._56), + onUnhandled.bind(null, promise._E), // For reference errors and type errors, this almost always // means the programmer made a mistake, so log them after just // 100ms
View file
_service:tar_scm:promise-8.0.1.tgz/domains/synchronous.js -> _service:tar_scm:promise-8.3.0.tgz/domains/synchronous.js
Changed
@@ -17,38 +17,38 @@ }; Promise.prototype.getValue = function () { - if (this._83 === 3) { - return this._18.getValue(); + if (this._y === 3) { + return this._z.getValue(); } if (!this.isFulfilled()) { throw new Error('Cannot get a value of an unfulfilled promise.'); } - return this._18; + return this._z; }; Promise.prototype.getReason = function () { - if (this._83 === 3) { - return this._18.getReason(); + if (this._y === 3) { + return this._z.getReason(); } if (!this.isRejected()) { throw new Error('Cannot get a rejection reason of a non-rejected promise.'); } - return this._18; + return this._z; }; Promise.prototype.getState = function () { - if (this._83 === 3) { - return this._18.getState(); + if (this._y === 3) { + return this._z.getState(); } - if (this._83 === -1 || this._83 === -2) { + if (this._y === -1 || this._y === -2) { return 0; } - return this._83; + return this._y; }; };
View file
_service:tar_scm:promise-8.0.1.tgz/index.d.ts -> _service:tar_scm:promise-8.3.0.tgz/index.d.ts
Changed
@@ -34,6 +34,18 @@ nodeify(callback: (err: Error, value: T) => void): void; } +interface PromiseFulfilledResult<T> { + status: "fulfilled"; + value: T; +} + +interface PromiseRejectedResult { + status: "rejected"; + reason: any; +} + +type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult; + interface ThenPromiseConstructor { /** * A reference to the prototype. @@ -48,6 +60,101 @@ */ new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => any): ThenPromise<T>; + + /** + * The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm. + * @param values An array or iterable of Promises. + * @returns A new Promise. + */ + any<T extends readonly unknown | >(values: T): Promise<Awaited<Tnumber>>; + + /** + * The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm. + * @param values An array or iterable of Promises. + * @returns A new Promise. + */ + any<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>, PromiseSettledResult<T8>, PromiseSettledResult<T9>, PromiseSettledResult<T10>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>, PromiseSettledResult<T8>, PromiseSettledResult<T9>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4, T5, T6, T7, T8>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>, PromiseSettledResult<T8>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4, T5, T6, T7>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4, T5, T6>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4, T5>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3, T4>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2, T3>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T1, T2>(values: T1 | PromiseLike<T1>, T2 | PromiseLike<T2>): ThenPromise<PromiseSettledResult<T1>, PromiseSettledResult<T2>>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled<T>(values: (T | PromiseLike<T>)): ThenPromise<PromiseSettledResult<T>>; + /** * Creates a ThenPromise that is resolved with an array of results when all of the provided Promises * resolve, or rejected when any ThenPromise is rejected. @@ -243,4 +350,4 @@ declare var ThenPromise: ThenPromiseConstructor; -export = ThenPromise; \ No newline at end of file +export = ThenPromise;
View file
_service:tar_scm:promise-8.0.1.tgz/index.js.flow -> _service:tar_scm:promise-8.3.0.tgz/index.js.flow
Changed
@@ -6,13 +6,21 @@ reject: (error: any) => void ) => mixed): void; + + then(onFulfill: null | void, onReject: null | void): ThenPromise<R>; + then<U>( + onFulfill: null | void, + onReject: (error: any) => Promise<U> | U + ): ThenPromise<R | U>; then<U>( - onFulfill?: (value: R) => Promise<U> | U, - onReject?: (error: any) => Promise<U> | U + onFulfill: (value: R) => Promise<U> | U, + onReject: null | void | ((error: any) => Promise<U> | U) ): ThenPromise<U>; + + catch(onReject: null | void): ThenPromise<R>; catch<U>( - onReject?: (error: any) => Promise<U> | U + onReject: (error: any) => Promise<U> | U ): ThenPromise<R | U>; // Extensions specific to then/promise @@ -33,8 +41,8 @@ static resolve<T>(object: Promise<T> | T): ThenPromise<T>; static reject<T>(error?: any): ThenPromise<T>; - static all<Elem, T:Iterable<Elem>>(promises: T): ThenPromise<$TupleMap<T, typeof $await>>; - static race<T, Elem: Promise<T> | T>(promises: Array<Elem>): ThenPromise<T>; + static all<T: Iterable<mixed>>(promises: T): ThenPromise<$TupleMap<T, typeof $await>>; + static race<T, Elem: Promise<T> | T>(promises: Iterable<Elem>): ThenPromise<T>; // Extensions specific to then/promise
View file
_service:tar_scm:promise-8.0.1.tgz/lib/core.js -> _service:tar_scm:promise-8.3.0.tgz/lib/core.js
Changed
@@ -58,16 +58,16 @@ if (typeof fn !== 'function') { throw new TypeError('Promise constructor\'s argument is not a function'); } - this._75 = 0; - this._83 = 0; - this._18 = null; - this._38 = null; + this._x = 0; + this._y = 0; + this._z = null; + this._A = null; if (fn === noop) return; doResolve(fn, this); } -Promise._47 = null; -Promise._71 = null; -Promise._44 = noop; +Promise._B = null; +Promise._C = null; +Promise._D = noop; Promise.prototype.then = function(onFulfilled, onRejected) { if (this.constructor !== Promise) { @@ -86,24 +86,24 @@ }); } function handle(self, deferred) { - while (self._83 === 3) { - self = self._18; + while (self._y === 3) { + self = self._z; } - if (Promise._47) { - Promise._47(self); + if (Promise._B) { + Promise._B(self); } - if (self._83 === 0) { - if (self._75 === 0) { - self._75 = 1; - self._38 = deferred; + if (self._y === 0) { + if (self._x === 0) { + self._x = 1; + self._A = deferred; return; } - if (self._75 === 1) { - self._75 = 2; - self._38 = self._38, deferred; + if (self._x === 1) { + self._x = 2; + self._A = self._A, deferred; return; } - self._38.push(deferred); + self._A.push(deferred); return; } handleResolved(self, deferred); @@ -111,16 +111,16 @@ function handleResolved(self, deferred) { asap(function() { - var cb = self._83 === 1 ? deferred.onFulfilled : deferred.onRejected; + var cb = self._y === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { - if (self._83 === 1) { - resolve(deferred.promise, self._18); + if (self._y === 1) { + resolve(deferred.promise, self._z); } else { - reject(deferred.promise, self._18); + reject(deferred.promise, self._z); } return; } - var ret = tryCallOne(cb, self._18); + var ret = tryCallOne(cb, self._z); if (ret === IS_ERROR) { reject(deferred.promise, LAST_ERROR); } else { @@ -148,8 +148,8 @@ then === self.then && newValue instanceof Promise ) { - self._83 = 3; - self._18 = newValue; + self._y = 3; + self._z = newValue; finale(self); return; } else if (typeof then === 'function') { @@ -157,29 +157,29 @@ return; } } - self._83 = 1; - self._18 = newValue; + self._y = 1; + self._z = newValue; finale(self); } function reject(self, newValue) { - self._83 = 2; - self._18 = newValue; - if (Promise._71) { - Promise._71(self, newValue); + self._y = 2; + self._z = newValue; + if (Promise._C) { + Promise._C(self, newValue); } finale(self); } function finale(self) { - if (self._75 === 1) { - handle(self, self._38); - self._38 = null; + if (self._x === 1) { + handle(self, self._A); + self._A = null; } - if (self._75 === 2) { - for (var i = 0; i < self._38.length; i++) { - handle(self, self._38i); + if (self._x === 2) { + for (var i = 0; i < self._A.length; i++) { + handle(self, self._Ai); } - self._38 = null; + self._A = null; } }
View file
_service:tar_scm:promise-8.0.1.tgz/lib/es6-extensions.js -> _service:tar_scm:promise-8.3.0.tgz/lib/es6-extensions.js
Changed
@@ -16,9 +16,9 @@ var EMPTYSTRING = valuePromise(''); function valuePromise(value) { - var p = new Promise(Promise._44); - p._83 = 1; - p._18 = value; + var p = new Promise(Promise._D); + p._y = 1; + p._z = value; return p; } Promise.resolve = function (value) { @@ -46,8 +46,20 @@ return valuePromise(value); }; +var iterableToArray = function (iterable) { + if (typeof Array.from === 'function') { + // ES2015+, iterables exist + iterableToArray = Array.from; + return Array.from(iterable); + } + + // ES5, only arrays and array-likes exist + iterableToArray = function (x) { return Array.prototype.slice.call(x); }; + return Array.prototype.slice.call(iterable); +} + Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); + var args = iterableToArray(arr); return new Promise(function (resolve, reject) { if (args.length === 0) return resolve(); @@ -55,11 +67,11 @@ function res(i, val) { if (val && (typeof val === 'object' || typeof val === 'function')) { if (val instanceof Promise && val.then === Promise.prototype.then) { - while (val._83 === 3) { - val = val._18; + while (val._y === 3) { + val = val._z; } - if (val._83 === 1) return res(i, val._18); - if (val._83 === 2) reject(val._18); + if (val._y === 1) return res(i, val._z); + if (val._y === 2) reject(val._z); val.then(function (val) { res(i, val); }, reject); @@ -86,6 +98,29 @@ }); }; +function onSettledFulfill(value) { + return { status: 'fulfilled', value: value }; +} +function onSettledReject(reason) { + return { status: 'rejected', reason: reason }; +} +function mapAllSettled(item) { + if(item && (typeof item === 'object' || typeof item === 'function')){ + if(item instanceof Promise && item.then === Promise.prototype.then){ + return item.then(onSettledFulfill, onSettledReject); + } + var then = item.then; + if (typeof then === 'function') { + return new Promise(then.bind(item)).then(onSettledFulfill, onSettledReject) + } + } + + return onSettledFulfill(item); +} +Promise.allSettled = function (iterable) { + return Promise.all(iterableToArray(iterable).map(mapAllSettled)); +}; + Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); @@ -94,7 +129,7 @@ Promise.race = function (values) { return new Promise(function (resolve, reject) { - values.forEach(function(value){ + iterableToArray(values).forEach(function(value){ Promise.resolve(value).then(resolve, reject); }); }); @@ -105,3 +140,47 @@ Promise.prototype'catch' = function (onRejected) { return this.then(null, onRejected); }; + +function getAggregateError(errors){ + if(typeof AggregateError === 'function'){ + return new AggregateError(errors,'All promises were rejected'); + } + + var error = new Error('All promises were rejected'); + + error.name = 'AggregateError'; + error.errors = errors; + + return error; +} + +Promise.any = function promiseAny(values) { + return new Promise(function(resolve, reject) { + var promises = iterableToArray(values); + var hasResolved = false; + var rejectionReasons = ; + + function resolveOnce(value) { + if (!hasResolved) { + hasResolved = true; + resolve(value); + } + } + + function rejectionCheck(reason) { + rejectionReasons.push(reason); + + if (rejectionReasons.length === promises.length) { + reject(getAggregateError(rejectionReasons)); + } + } + + if(promises.length === 0){ + reject(getAggregateError(rejectionReasons)); + } else { + promises.forEach(function(value){ + Promise.resolve(value).then(resolveOnce, rejectionCheck); + }); + } + }); +};
View file
_service:tar_scm:promise-8.0.1.tgz/lib/finally.js -> _service:tar_scm:promise-8.3.0.tgz/lib/finally.js
Changed
@@ -3,7 +3,7 @@ var Promise = require('./core.js'); module.exports = Promise; -Promise.prototype'finally' = function (f) { +Promise.prototype.finally = function (f) { return this.then(function (value) { return Promise.resolve(f()).then(function () { return value;
View file
_service:tar_scm:promise-8.0.1.tgz/lib/rejection-tracking.js -> _service:tar_scm:promise-8.3.0.tgz/lib/rejection-tracking.js
Changed
@@ -12,8 +12,8 @@ exports.disable = disable; function disable() { enabled = false; - Promise._47 = null; - Promise._71 = null; + Promise._B = null; + Promise._C = null; } exports.enable = enable; @@ -24,27 +24,27 @@ var id = 0; var displayId = 0; var rejections = {}; - Promise._47 = function (promise) { + Promise._B = function (promise) { if ( - promise._83 === 2 && // IS REJECTED - rejectionspromise._56 + promise._y === 2 && // IS REJECTED + rejectionspromise._E ) { - if (rejectionspromise._56.logged) { - onHandled(promise._56); + if (rejectionspromise._E.logged) { + onHandled(promise._E); } else { - clearTimeout(rejectionspromise._56.timeout); + clearTimeout(rejectionspromise._E.timeout); } - delete rejectionspromise._56; + delete rejectionspromise._E; } }; - Promise._71 = function (promise, err) { - if (promise._75 === 0) { // not yet handled - promise._56 = id++; - rejectionspromise._56 = { + Promise._C = function (promise, err) { + if (promise._x === 0) { // not yet handled + promise._E = id++; + rejectionspromise._E = { displayId: null, error: err, timeout: setTimeout( - onUnhandled.bind(null, promise._56), + onUnhandled.bind(null, promise._E), // For reference errors and type errors, this almost always // means the programmer made a mistake, so log them after just // 100ms
View file
_service:tar_scm:promise-8.0.1.tgz/lib/synchronous.js -> _service:tar_scm:promise-8.3.0.tgz/lib/synchronous.js
Changed
@@ -17,38 +17,38 @@ }; Promise.prototype.getValue = function () { - if (this._83 === 3) { - return this._18.getValue(); + if (this._y === 3) { + return this._z.getValue(); } if (!this.isFulfilled()) { throw new Error('Cannot get a value of an unfulfilled promise.'); } - return this._18; + return this._z; }; Promise.prototype.getReason = function () { - if (this._83 === 3) { - return this._18.getReason(); + if (this._y === 3) { + return this._z.getReason(); } if (!this.isRejected()) { throw new Error('Cannot get a rejection reason of a non-rejected promise.'); } - return this._18; + return this._z; }; Promise.prototype.getState = function () { - if (this._83 === 3) { - return this._18.getState(); + if (this._y === 3) { + return this._z.getState(); } - if (this._83 === -1 || this._83 === -2) { + if (this._y === -1 || this._y === -2) { return 0; } - return this._83; + return this._y; }; };
View file
_service:tar_scm:promise-8.0.1.tgz/package.json -> _service:tar_scm:promise-8.3.0.tgz/package.json
Changed
@@ -1,10 +1,10 @@ { "name": "promise", - "version": "8.0.1", + "version": "8.3.0", "description": "Bare bones Promises/A+ implementation", "main": "index.js", "scripts": { - "prepublish": "node build", + "build": "node build", "pretest": "node build", "pretest-resolve": "node build", "pretest-extensions": "node build", @@ -30,6 +30,6 @@ "rimraf": "^2.3.2" }, "dependencies": { - "asap": "~2.0.3" + "asap": "~2.0.6" } -} \ No newline at end of file +}
View file
_service:tar_scm:promise-8.0.1.tgz/setimmediate/core.js -> _service:tar_scm:promise-8.3.0.tgz/setimmediate/core.js
Changed
@@ -58,16 +58,16 @@ if (typeof fn !== 'function') { throw new TypeError('Promise constructor\'s argument is not a function'); } - this._75 = 0; - this._83 = 0; - this._18 = null; - this._38 = null; + this._x = 0; + this._y = 0; + this._z = null; + this._A = null; if (fn === noop) return; doResolve(fn, this); } -Promise._47 = null; -Promise._71 = null; -Promise._44 = noop; +Promise._B = null; +Promise._C = null; +Promise._D = noop; Promise.prototype.then = function(onFulfilled, onRejected) { if (this.constructor !== Promise) { @@ -86,24 +86,24 @@ }); } function handle(self, deferred) { - while (self._83 === 3) { - self = self._18; + while (self._y === 3) { + self = self._z; } - if (Promise._47) { - Promise._47(self); + if (Promise._B) { + Promise._B(self); } - if (self._83 === 0) { - if (self._75 === 0) { - self._75 = 1; - self._38 = deferred; + if (self._y === 0) { + if (self._x === 0) { + self._x = 1; + self._A = deferred; return; } - if (self._75 === 1) { - self._75 = 2; - self._38 = self._38, deferred; + if (self._x === 1) { + self._x = 2; + self._A = self._A, deferred; return; } - self._38.push(deferred); + self._A.push(deferred); return; } handleResolved(self, deferred); @@ -111,16 +111,16 @@ function handleResolved(self, deferred) { setImmediate(function() { - var cb = self._83 === 1 ? deferred.onFulfilled : deferred.onRejected; + var cb = self._y === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { - if (self._83 === 1) { - resolve(deferred.promise, self._18); + if (self._y === 1) { + resolve(deferred.promise, self._z); } else { - reject(deferred.promise, self._18); + reject(deferred.promise, self._z); } return; } - var ret = tryCallOne(cb, self._18); + var ret = tryCallOne(cb, self._z); if (ret === IS_ERROR) { reject(deferred.promise, LAST_ERROR); } else { @@ -148,8 +148,8 @@ then === self.then && newValue instanceof Promise ) { - self._83 = 3; - self._18 = newValue; + self._y = 3; + self._z = newValue; finale(self); return; } else if (typeof then === 'function') { @@ -157,29 +157,29 @@ return; } } - self._83 = 1; - self._18 = newValue; + self._y = 1; + self._z = newValue; finale(self); } function reject(self, newValue) { - self._83 = 2; - self._18 = newValue; - if (Promise._71) { - Promise._71(self, newValue); + self._y = 2; + self._z = newValue; + if (Promise._C) { + Promise._C(self, newValue); } finale(self); } function finale(self) { - if (self._75 === 1) { - handle(self, self._38); - self._38 = null; + if (self._x === 1) { + handle(self, self._A); + self._A = null; } - if (self._75 === 2) { - for (var i = 0; i < self._38.length; i++) { - handle(self, self._38i); + if (self._x === 2) { + for (var i = 0; i < self._A.length; i++) { + handle(self, self._Ai); } - self._38 = null; + self._A = null; } }
View file
_service:tar_scm:promise-8.0.1.tgz/setimmediate/es6-extensions.js -> _service:tar_scm:promise-8.3.0.tgz/setimmediate/es6-extensions.js
Changed
@@ -16,9 +16,9 @@ var EMPTYSTRING = valuePromise(''); function valuePromise(value) { - var p = new Promise(Promise._44); - p._83 = 1; - p._18 = value; + var p = new Promise(Promise._D); + p._y = 1; + p._z = value; return p; } Promise.resolve = function (value) { @@ -46,8 +46,20 @@ return valuePromise(value); }; +var iterableToArray = function (iterable) { + if (typeof Array.from === 'function') { + // ES2015+, iterables exist + iterableToArray = Array.from; + return Array.from(iterable); + } + + // ES5, only arrays and array-likes exist + iterableToArray = function (x) { return Array.prototype.slice.call(x); }; + return Array.prototype.slice.call(iterable); +} + Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); + var args = iterableToArray(arr); return new Promise(function (resolve, reject) { if (args.length === 0) return resolve(); @@ -55,11 +67,11 @@ function res(i, val) { if (val && (typeof val === 'object' || typeof val === 'function')) { if (val instanceof Promise && val.then === Promise.prototype.then) { - while (val._83 === 3) { - val = val._18; + while (val._y === 3) { + val = val._z; } - if (val._83 === 1) return res(i, val._18); - if (val._83 === 2) reject(val._18); + if (val._y === 1) return res(i, val._z); + if (val._y === 2) reject(val._z); val.then(function (val) { res(i, val); }, reject); @@ -86,6 +98,29 @@ }); }; +function onSettledFulfill(value) { + return { status: 'fulfilled', value: value }; +} +function onSettledReject(reason) { + return { status: 'rejected', reason: reason }; +} +function mapAllSettled(item) { + if(item && (typeof item === 'object' || typeof item === 'function')){ + if(item instanceof Promise && item.then === Promise.prototype.then){ + return item.then(onSettledFulfill, onSettledReject); + } + var then = item.then; + if (typeof then === 'function') { + return new Promise(then.bind(item)).then(onSettledFulfill, onSettledReject) + } + } + + return onSettledFulfill(item); +} +Promise.allSettled = function (iterable) { + return Promise.all(iterableToArray(iterable).map(mapAllSettled)); +}; + Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); @@ -94,7 +129,7 @@ Promise.race = function (values) { return new Promise(function (resolve, reject) { - values.forEach(function(value){ + iterableToArray(values).forEach(function(value){ Promise.resolve(value).then(resolve, reject); }); }); @@ -105,3 +140,47 @@ Promise.prototype'catch' = function (onRejected) { return this.then(null, onRejected); }; + +function getAggregateError(errors){ + if(typeof AggregateError === 'function'){ + return new AggregateError(errors,'All promises were rejected'); + } + + var error = new Error('All promises were rejected'); + + error.name = 'AggregateError'; + error.errors = errors; + + return error; +} + +Promise.any = function promiseAny(values) { + return new Promise(function(resolve, reject) { + var promises = iterableToArray(values); + var hasResolved = false; + var rejectionReasons = ; + + function resolveOnce(value) { + if (!hasResolved) { + hasResolved = true; + resolve(value); + } + } + + function rejectionCheck(reason) { + rejectionReasons.push(reason); + + if (rejectionReasons.length === promises.length) { + reject(getAggregateError(rejectionReasons)); + } + } + + if(promises.length === 0){ + reject(getAggregateError(rejectionReasons)); + } else { + promises.forEach(function(value){ + Promise.resolve(value).then(resolveOnce, rejectionCheck); + }); + } + }); +};
View file
_service:tar_scm:promise-8.0.1.tgz/setimmediate/finally.js -> _service:tar_scm:promise-8.3.0.tgz/setimmediate/finally.js
Changed
@@ -3,7 +3,7 @@ var Promise = require('./core.js'); module.exports = Promise; -Promise.prototype'finally' = function (f) { +Promise.prototype.finally = function (f) { return this.then(function (value) { return Promise.resolve(f()).then(function () { return value;
View file
_service:tar_scm:promise-8.0.1.tgz/setimmediate/rejection-tracking.js -> _service:tar_scm:promise-8.3.0.tgz/setimmediate/rejection-tracking.js
Changed
@@ -12,8 +12,8 @@ exports.disable = disable; function disable() { enabled = false; - Promise._47 = null; - Promise._71 = null; + Promise._B = null; + Promise._C = null; } exports.enable = enable; @@ -24,27 +24,27 @@ var id = 0; var displayId = 0; var rejections = {}; - Promise._47 = function (promise) { + Promise._B = function (promise) { if ( - promise._83 === 2 && // IS REJECTED - rejectionspromise._56 + promise._y === 2 && // IS REJECTED + rejectionspromise._E ) { - if (rejectionspromise._56.logged) { - onHandled(promise._56); + if (rejectionspromise._E.logged) { + onHandled(promise._E); } else { - clearTimeout(rejectionspromise._56.timeout); + clearTimeout(rejectionspromise._E.timeout); } - delete rejectionspromise._56; + delete rejectionspromise._E; } }; - Promise._71 = function (promise, err) { - if (promise._75 === 0) { // not yet handled - promise._56 = id++; - rejectionspromise._56 = { + Promise._C = function (promise, err) { + if (promise._x === 0) { // not yet handled + promise._E = id++; + rejectionspromise._E = { displayId: null, error: err, timeout: setTimeout( - onUnhandled.bind(null, promise._56), + onUnhandled.bind(null, promise._E), // For reference errors and type errors, this almost always // means the programmer made a mistake, so log them after just // 100ms
View file
_service:tar_scm:promise-8.0.1.tgz/setimmediate/synchronous.js -> _service:tar_scm:promise-8.3.0.tgz/setimmediate/synchronous.js
Changed
@@ -17,38 +17,38 @@ }; Promise.prototype.getValue = function () { - if (this._83 === 3) { - return this._18.getValue(); + if (this._y === 3) { + return this._z.getValue(); } if (!this.isFulfilled()) { throw new Error('Cannot get a value of an unfulfilled promise.'); } - return this._18; + return this._z; }; Promise.prototype.getReason = function () { - if (this._83 === 3) { - return this._18.getReason(); + if (this._y === 3) { + return this._z.getReason(); } if (!this.isRejected()) { throw new Error('Cannot get a rejection reason of a non-rejected promise.'); } - return this._18; + return this._z; }; Promise.prototype.getState = function () { - if (this._83 === 3) { - return this._18.getState(); + if (this._y === 3) { + return this._z.getState(); } - if (this._83 === -1 || this._83 === -2) { + if (this._y === -1 || this._y === -2) { return 0; } - return this._83; + return this._y; }; };
View file
_service:tar_scm:promise-8.0.1.tgz/src/es6-extensions.js -> _service:tar_scm:promise-8.3.0.tgz/src/es6-extensions.js
Changed
@@ -46,8 +46,20 @@ return valuePromise(value); }; +var iterableToArray = function (iterable) { + if (typeof Array.from === 'function') { + // ES2015+, iterables exist + iterableToArray = Array.from; + return Array.from(iterable); + } + + // ES5, only arrays and array-likes exist + iterableToArray = function (x) { return Array.prototype.slice.call(x); }; + return Array.prototype.slice.call(iterable); +} + Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); + var args = iterableToArray(arr); return new Promise(function (resolve, reject) { if (args.length === 0) return resolve(); @@ -86,6 +98,29 @@ }); }; +function onSettledFulfill(value) { + return { status: 'fulfilled', value: value }; +} +function onSettledReject(reason) { + return { status: 'rejected', reason: reason }; +} +function mapAllSettled(item) { + if(item && (typeof item === 'object' || typeof item === 'function')){ + if(item instanceof Promise && item.then === Promise.prototype.then){ + return item.then(onSettledFulfill, onSettledReject); + } + var then = item.then; + if (typeof then === 'function') { + return new Promise(then.bind(item)).then(onSettledFulfill, onSettledReject) + } + } + + return onSettledFulfill(item); +} +Promise.allSettled = function (iterable) { + return Promise.all(iterableToArray(iterable).map(mapAllSettled)); +}; + Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); @@ -94,7 +129,7 @@ Promise.race = function (values) { return new Promise(function (resolve, reject) { - values.forEach(function(value){ + iterableToArray(values).forEach(function(value){ Promise.resolve(value).then(resolve, reject); }); }); @@ -105,3 +140,47 @@ Promise.prototype'catch' = function (onRejected) { return this.then(null, onRejected); }; + +function getAggregateError(errors){ + if(typeof AggregateError === 'function'){ + return new AggregateError(errors,'All promises were rejected'); + } + + var error = new Error('All promises were rejected'); + + error.name = 'AggregateError'; + error.errors = errors; + + return error; +} + +Promise.any = function promiseAny(values) { + return new Promise(function(resolve, reject) { + var promises = iterableToArray(values); + var hasResolved = false; + var rejectionReasons = ; + + function resolveOnce(value) { + if (!hasResolved) { + hasResolved = true; + resolve(value); + } + } + + function rejectionCheck(reason) { + rejectionReasons.push(reason); + + if (rejectionReasons.length === promises.length) { + reject(getAggregateError(rejectionReasons)); + } + } + + if(promises.length === 0){ + reject(getAggregateError(rejectionReasons)); + } else { + promises.forEach(function(value){ + Promise.resolve(value).then(resolveOnce, rejectionCheck); + }); + } + }); +};
View file
_service:tar_scm:promise-8.0.1.tgz/src/finally.js -> _service:tar_scm:promise-8.3.0.tgz/src/finally.js
Changed
@@ -3,7 +3,7 @@ var Promise = require('./core.js'); module.exports = Promise; -Promise.prototype'finally' = function (f) { +Promise.prototype.finally = function (f) { return this.then(function (value) { return Promise.resolve(f()).then(function () { return value;
View file
_service:tar_scm:tests-8.0.1.tar.bz2/adapter-a.js -> _service:tar_scm:tests-8.3.0.tar.bz2/adapter-a.js
Changed
@@ -1,6 +1,5 @@ var Promise = require('../'); - exports.deferred = function () { var resolve, reject; var promise = new Promise(function (_resolve, _reject) {
View file
_service:tar_scm:tests-8.0.1.tar.bz2/extensions-tests.js -> _service:tar_scm:tests-8.3.0.tar.bz2/extensions-tests.js
Changed
@@ -4,8 +4,8 @@ var promise = new Promise(function (resolve) { resolve(sentinel) }) -var thenable = {then: function (fullfilled, rejected) { fullfilled(sentinel) }} -var thenableRejected = {then: function (fullfilled, rejected) { rejected(sentinel) }} +var thenable = {then: function (fulfilled, rejected) { fulfilled(sentinel) }} +var thenableRejected = {then: function (fulfilled, rejected) { rejected(sentinel) }} var a = {} var b = {} @@ -130,6 +130,332 @@ }) }) }) + describe('Promise.any(...)', function () { + describe('an array', function () { + describe('that is empty', function () { + it('returns a rejected promise for an empty array', function (done) { + var res = Promise.any() + assert(res instanceof Promise) + res.catch(function (err) { + assert(Array.isArray(err.errors)) + assert(err.errors.length === 0) + }).nodeify(done) + }) + it('returns a rejected promise for not argument', function (done) { + var res = Promise.any() + assert(res instanceof Promise) + res.catch(function (err) { + assert(err instanceof Error) + }).nodeify(done) + }) + }) + describe('of objects', function () { + it('resolved with a first fulfilled value', function (done) { + var res = Promise.any(a, b, c) + assert(res instanceof Promise) + res.then(function (res) { + assert(a === res) + }).nodeify(done) + }) + }) + describe('of promises', function () { + it('resolved with a first fulfilled value', function (done) { + var res = Promise.any(B, C) + assert(res instanceof Promise) + res.then(function (res) { + assert(b === res) + }).nodeify(done) + }) + }) + describe('of mixed values', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var res = Promise.any(c,B) + assert(res instanceof Promise) + res.then(function (res) { + assert(res === c) + }).nodeify(done) + }) + }) + describe('containing all rejected promise', function () { + it('rejects the resulting promise', function (done) { + var rejectionB ={test:2} + var rejectedB = new Promise(function (resolve, reject) { reject(rejectionB) }) + var res = Promise.any(rejected, rejectedB) + assert(res instanceof Promise) + res.catch(function (err) { + assert(Array.isArray(err.errors)) + assert(err.errors0 === rejection) + assert(err.errors1 === rejectionB) + assert(err.errors.length === 2) + }).nodeify(done) + }) + }) + describe('when given a foreign promise', function () { + it('should provide the correct value of `this`', function (done) { + var p = {then: function (onFulfilled) { onFulfilled({self: this}); }}; + Promise.any(p).then(function (results) { + assert(p === results.self); + }).nodeify(done); + }); + }); + }) + }) + describe('Promise.allSettled(...)', function () { + describe('an array', function () { + describe('that is empty', function () { + it('returns a promise for an empty array', function (done) { + var res = Promise.allSettled() + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res.length === 0) + }) + .nodeify(done) + }) + }) + describe('of objects', function () { + it('returns a promise for the array', function (done) { + var res = Promise.allSettled(a, b, c) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "fulfilled") + assert(res1.value === b) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + }) + }) + describe('of promises', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var d = {} + var resolveD + var res = Promise.allSettled(A, B, C, new Promise(function (resolve) { resolveD = resolve })) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "fulfilled") + assert(res1.value === b) + assert(res2.status === "fulfilled") + assert(res2.value === c) + assert(res3.status === "fulfilled") + assert(res3.value === d) + }) + .nodeify(done) + resolveD(d) + }) + }) + describe('of mixed values', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var res = Promise.allSettled(A, b, C) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "fulfilled") + assert(res1.value === b) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + }) + }) + describe('containing at least one rejected promise', function () { + it('should not rejects the resulting promise', function (done) { + var res = Promise.allSettled(A, rejected, C) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "rejected") + assert(res1.reason === rejection) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + }) + }) + describe('containing at least one eventually rejected promise', function () { + it('rejects the resulting promise', function (done) { + var rejectB + var rejected = new Promise(function (resolve, reject) { rejectB = reject }) + var res = Promise.allSettled(A, rejected, C) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "rejected") + assert(res1.reason === rejection) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + rejectB(rejection) + }) + }) + describe('with a promise that resolves twice', function () { + it('still waits for all the other promises', function (done) { + var a = 1; + var fakePromise = {then: function (onFulfilled) { onFulfilled(a); onFulfilled(2) }} + var eventuallyRejected = {then: function (_, onRejected) { this.onRejected = onRejected }} + var res = Promise.allSettled(fakePromise, eventuallyRejected) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "rejected") + assert(res1.reason === rejection) + }) + .nodeify(done) + eventuallyRejected.onRejected(rejection); + }) + }) + describe('when given a foreign promise', function () { + it('should provide the correct value of `this`', function (done) { + var p = {then: function (onFulfilled) { onFulfilled({self: this}); }}; + Promise.allSettled(p).then(function (results) { + assert(p === results0.value.self); + }).nodeify(done); + }); + }); + }) + describe('a Set', function () { + describe('that is empty', function () { + it('returns a promise for an empty array', function (done) { + var res = Promise.allSettled(new Set()) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res.length === 0) + }) + .nodeify(done) + }) + }) + describe('of objects', function () { + it('returns a promise for the array', function (done) { + var res = Promise.allSettled(new Set(a, b, c)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "fulfilled") + assert(res1.value === b) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + }) + }) + describe('of promises', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var d = {} + var resolveD + var res = Promise.allSettled(new Set(A, B, C, new Promise(function (resolve) { resolveD = resolve }))) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "fulfilled") + assert(res1.value === b) + assert(res2.status === "fulfilled") + assert(res2.value === c) + assert(res3.status === "fulfilled") + assert(res3.value === d) + }) + .nodeify(done) + resolveD(d) + }) + }) + describe('of mixed values', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var res = Promise.allSettled(new Set(A, b, C)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "fulfilled") + assert(res1.value === b) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + }) + }) + describe('containing at least one rejected promise', function () { + it('rejects the resulting promise', function (done) { + var res = Promise.allSettled(new Set(A, rejected, C)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "rejected") + assert(res1.reason === rejection) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + }) + }) + describe('containing at least one eventually rejected promise', function () { + it('rejects the resulting promise', function (done) { + var rejectB + var rejected = new Promise(function (resolve, reject) { rejectB = reject }) + var res = Promise.allSettled(new Set(A, rejected, C)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "rejected") + assert(res1.reason === rejection) + assert(res2.status === "fulfilled") + assert(res2.value === c) + }) + .nodeify(done) + rejectB(rejection) + }) + }) + describe('with a promise that resolves twice', function () { + it('still waits for all the other promises', function (done) { + var a = 1 + var fakePromise = {then: function (onFulfilled) { onFulfilled(a); onFulfilled(2) }} + var eventuallyRejected = {then: function (_, onRejected) { this.onRejected = onRejected }} + var res = Promise.allSettled(new Set(fakePromise, eventuallyRejected)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0.status === "fulfilled") + assert(res0.value === a) + assert(res1.status === "rejected") + assert(res1.reason === rejection) + }) + .nodeify(done) + eventuallyRejected.onRejected(rejection); + }) + }) + describe('when given a foreign promise', function () { + it('should provide the correct value of `this`', function (done) { + var p = {then: function (onFulfilled) { onFulfilled({self: this}); }}; + Promise.allSettled(new Set(p)).then(function (results) { + assert(p === results0.value.self); + }).nodeify(done); + }); + }); + }) + }) describe('Promise.all(...)', function () { describe('an array', function () { describe('that is empty', function () { @@ -240,6 +566,116 @@ }); }); }) + + describe('a Set', function () { + describe('that is empty', function () { + it('returns a promise for an empty array', function (done) { + var res = Promise.all(new Set()) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res.length === 0) + }) + .nodeify(done) + }) + }) + describe('of objects', function () { + it('returns a promise for the array', function (done) { + var res = Promise.all(new Set(a, b, c)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0 === a) + assert(res1 === b) + assert(res2 === c) + }) + .nodeify(done) + }) + }) + describe('of promises', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var d = {} + var resolveD + var res = Promise.all(new Set(A, B, C, new Promise(function (resolve) { resolveD = resolve }))) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0 === a) + assert(res1 === b) + assert(res2 === c) + assert(res3 === d) + }) + .nodeify(done) + resolveD(d) + }) + }) + describe('of mixed values', function () { + it('returns a promise for an array containing the fulfilled values', function (done) { + var res = Promise.all(new Set(A, b, C)) + assert(res instanceof Promise) + res.then(function (res) { + assert(Array.isArray(res)) + assert(res0 === a) + assert(res1 === b) + assert(res2 === c) + }) + .nodeify(done) + }) + }) + describe('containing at least one rejected promise', function () { + it('rejects the resulting promise', function (done) { + var res = Promise.all(new Set(A, rejected, C)) + assert(res instanceof Promise) + res.then(function (res) { + throw new Error('Should be rejected') + }, + function (err) { + assert(err === rejection) + }) + .nodeify(done) + }) + }) + describe('containing at least one eventually rejected promise', function () { + it('rejects the resulting promise', function (done) { + var rejectB + var rejected = new Promise(function (resolve, reject) { rejectB = reject }) + var res = Promise.all(new Set(A, rejected, C)) + assert(res instanceof Promise) + res.then(function (res) { + throw new Error('Should be rejected') + }, + function (err) { + assert(err === rejection) + }) + .nodeify(done) + rejectB(rejection) + }) + }) + describe('with a promise that resolves twice', function () { + it('still waits for all the other promises', function (done) { + var fakePromise = {then: function (onFulfilled) { onFulfilled(1); onFulfilled(2) }} + var eventuallyRejected = {then: function (_, onRejected) { this.onRejected = onRejected }} + var res = Promise.all(new Set(fakePromise, eventuallyRejected)) + assert(res instanceof Promise) + res.then(function (res) { + throw new Error('Should be rejected') + }, + function (err) { + assert(err === rejection) + }) + .nodeify(done) + eventuallyRejected.onRejected(rejection); + }) + }) + describe('when given a foreign promise', function () { + it('should provide the correct value of `this`', function (done) { + var p = {then: function (onFulfilled) { onFulfilled({self: this}); }}; + Promise.all(new Set(p)).then(function (results) { + assert(p === results0.self); + }).nodeify(done); + }); + }); + }) }) describe('promise.done(onFulfilled, onRejected)', function () {
View file
_service:tar_scm:tests-8.0.1.tar.bz2/nested-promises.js -> _service:tar_scm:tests-8.3.0.tar.bz2/nested-promises.js
Changed
@@ -4,7 +4,7 @@ var Promise = require('../'); describe('nested promises', function () { - it('does not result in any wierd behaviour - 1', function (done) { + it('does not result in any weird behaviour - 1', function (done) { var resolveA, resolveB, resolveC; var A = new Promise(function (resolve, reject) { resolveA = resolve; @@ -23,7 +23,7 @@ done(); }); }); - it('does not result in any wierd behaviour - 2', function (done) { + it('does not result in any weird behaviour - 2', function (done) { var resolveA, resolveB, resolveC, resolveD; var A = new Promise(function (resolve, reject) { resolveA = resolve; @@ -47,7 +47,7 @@ done(); }); }); - it('does not result in any wierd behaviour - 2', function (done) { + it('does not result in any weird behaviour - 2', function (done) { var promises = ; var resolveFns = ; for (var i = 0; i < 100; i++) {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2