유희정

google api test

Showing 1000 changed files with 4775 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +{"web":{"client_id":"978869138601-u3euf0c04sbdor68r30m599gilvjn91e.apps.googleusercontent.com","project_id":"reminder-talk","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"N7Uh_oVQZt-almzA4DkM4bm_","redirect_uris":["http://localhost:3000"],"javascript_origins":["http://localhost:3000"]}}
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\google-p12-pem\build\src\bin\gp12-pem.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../uuid/bin/uuid" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\uuid\bin\uuid" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../uuid/bin/uuid" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../uuid/bin/uuid" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +MIT License
2 +
3 +Copyright (c) 2017 Toru Nagashima
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
1 +# abort-controller
2 +
3 +[![npm version](https://img.shields.io/npm/v/abort-controller.svg)](https://www.npmjs.com/package/abort-controller)
4 +[![Downloads/month](https://img.shields.io/npm/dm/abort-controller.svg)](http://www.npmtrends.com/abort-controller)
5 +[![Build Status](https://travis-ci.org/mysticatea/abort-controller.svg?branch=master)](https://travis-ci.org/mysticatea/abort-controller)
6 +[![Coverage Status](https://codecov.io/gh/mysticatea/abort-controller/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/abort-controller)
7 +[![Dependency Status](https://david-dm.org/mysticatea/abort-controller.svg)](https://david-dm.org/mysticatea/abort-controller)
8 +
9 +An implementation of [WHATWG AbortController interface](https://dom.spec.whatwg.org/#interface-abortcontroller).
10 +
11 +```js
12 +import AbortController from "abort-controller"
13 +
14 +const controller = new AbortController()
15 +const signal = controller.signal
16 +
17 +signal.addEventListener("abort", () => {
18 + console.log("aborted!")
19 +})
20 +
21 +controller.abort()
22 +```
23 +
24 +> https://jsfiddle.net/1r2994qp/1/
25 +
26 +## 💿 Installation
27 +
28 +Use [npm](https://www.npmjs.com/) to install then use a bundler.
29 +
30 +```
31 +npm install abort-controller
32 +```
33 +
34 +Or download from [`dist` directory](./dist).
35 +
36 +- [dist/abort-controller.mjs](dist/abort-controller.mjs) ... ES modules version.
37 +- [dist/abort-controller.js](dist/abort-controller.js) ... Common JS version.
38 +- [dist/abort-controller.umd.js](dist/abort-controller.umd.js) ... UMD (Universal Module Definition) version. This is transpiled by [Babel](https://babeljs.io/) for IE 11.
39 +
40 +## 📖 Usage
41 +
42 +### Basic
43 +
44 +```js
45 +import AbortController from "abort-controller"
46 +// or
47 +const AbortController = require("abort-controller")
48 +
49 +// or UMD version defines a global variable:
50 +const AbortController = window.AbortControllerShim
51 +```
52 +
53 +If your bundler recognizes `browser` field of `package.json`, the imported `AbortController` is the native one and it doesn't contain shim (even if the native implementation was nothing).
54 +If you wanted to polyfill `AbortController` for IE, use `abort-controller/polyfill`.
55 +
56 +### Polyfilling
57 +
58 +Importing `abort-controller/polyfill` assigns the `AbortController` shim to the `AbortController` global variable if the native implementation was nothing.
59 +
60 +```js
61 +import "abort-controller/polyfill"
62 +// or
63 +require("abort-controller/polyfill")
64 +```
65 +
66 +### API
67 +
68 +#### AbortController
69 +
70 +> https://dom.spec.whatwg.org/#interface-abortcontroller
71 +
72 +##### controller.signal
73 +
74 +The [AbortSignal](https://dom.spec.whatwg.org/#interface-AbortSignal) object which is associated to this controller.
75 +
76 +##### controller.abort()
77 +
78 +Notify `abort` event to listeners that the `signal` has.
79 +
80 +## 📰 Changelog
81 +
82 +- See [GitHub releases](https://github.com/mysticatea/abort-controller/releases).
83 +
84 +## 🍻 Contributing
85 +
86 +Contributing is welcome ❤️
87 +
88 +Please use GitHub issues/PRs.
89 +
90 +### Development tools
91 +
92 +- `npm install` installs dependencies for development.
93 +- `npm test` runs tests and measures code coverage.
94 +- `npm run clean` removes temporary files of tests.
95 +- `npm run coverage` opens code coverage of the previous test with your default browser.
96 +- `npm run lint` runs ESLint.
97 +- `npm run build` generates `dist` codes.
98 +- `npm run watch` runs tests on each file change.
1 +/*globals self, window */
2 +"use strict"
3 +
4 +/*eslint-disable @mysticatea/prettier */
5 +const { AbortController, AbortSignal } =
6 + typeof self !== "undefined" ? self :
7 + typeof window !== "undefined" ? window :
8 + /* otherwise */ undefined
9 +/*eslint-enable @mysticatea/prettier */
10 +
11 +module.exports = AbortController
12 +module.exports.AbortSignal = AbortSignal
13 +module.exports.default = AbortController
1 +/*globals self, window */
2 +
3 +/*eslint-disable @mysticatea/prettier */
4 +const { AbortController, AbortSignal } =
5 + typeof self !== "undefined" ? self :
6 + typeof window !== "undefined" ? window :
7 + /* otherwise */ undefined
8 +/*eslint-enable @mysticatea/prettier */
9 +
10 +export default AbortController
11 +export { AbortController, AbortSignal }
1 +import { EventTarget } from "event-target-shim"
2 +
3 +type Events = {
4 + abort: any
5 +}
6 +type EventAttributes = {
7 + onabort: any
8 +}
9 +/**
10 + * The signal class.
11 + * @see https://dom.spec.whatwg.org/#abortsignal
12 + */
13 +declare class AbortSignal extends EventTarget<Events, EventAttributes> {
14 + /**
15 + * AbortSignal cannot be constructed directly.
16 + */
17 + constructor()
18 + /**
19 + * Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise.
20 + */
21 + readonly aborted: boolean
22 +}
23 +/**
24 + * The AbortController.
25 + * @see https://dom.spec.whatwg.org/#abortcontroller
26 + */
27 +declare class AbortController {
28 + /**
29 + * Initialize this controller.
30 + */
31 + constructor()
32 + /**
33 + * Returns the `AbortSignal` object associated with this object.
34 + */
35 + readonly signal: AbortSignal
36 + /**
37 + * Abort and signal to any observers that the associated activity is to be aborted.
38 + */
39 + abort(): void
40 +}
41 +
42 +export default AbortController
43 +export { AbortController, AbortSignal }
1 +/**
2 + * @author Toru Nagashima <https://github.com/mysticatea>
3 + * See LICENSE file in root directory for full license.
4 + */
5 +'use strict';
6 +
7 +Object.defineProperty(exports, '__esModule', { value: true });
8 +
9 +var eventTargetShim = require('event-target-shim');
10 +
11 +/**
12 + * The signal class.
13 + * @see https://dom.spec.whatwg.org/#abortsignal
14 + */
15 +class AbortSignal extends eventTargetShim.EventTarget {
16 + /**
17 + * AbortSignal cannot be constructed directly.
18 + */
19 + constructor() {
20 + super();
21 + throw new TypeError("AbortSignal cannot be constructed directly");
22 + }
23 + /**
24 + * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
25 + */
26 + get aborted() {
27 + const aborted = abortedFlags.get(this);
28 + if (typeof aborted !== "boolean") {
29 + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
30 + }
31 + return aborted;
32 + }
33 +}
34 +eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
35 +/**
36 + * Create an AbortSignal object.
37 + */
38 +function createAbortSignal() {
39 + const signal = Object.create(AbortSignal.prototype);
40 + eventTargetShim.EventTarget.call(signal);
41 + abortedFlags.set(signal, false);
42 + return signal;
43 +}
44 +/**
45 + * Abort a given signal.
46 + */
47 +function abortSignal(signal) {
48 + if (abortedFlags.get(signal) !== false) {
49 + return;
50 + }
51 + abortedFlags.set(signal, true);
52 + signal.dispatchEvent({ type: "abort" });
53 +}
54 +/**
55 + * Aborted flag for each instances.
56 + */
57 +const abortedFlags = new WeakMap();
58 +// Properties should be enumerable.
59 +Object.defineProperties(AbortSignal.prototype, {
60 + aborted: { enumerable: true },
61 +});
62 +// `toString()` should return `"[object AbortSignal]"`
63 +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
64 + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
65 + configurable: true,
66 + value: "AbortSignal",
67 + });
68 +}
69 +
70 +/**
71 + * The AbortController.
72 + * @see https://dom.spec.whatwg.org/#abortcontroller
73 + */
74 +class AbortController {
75 + /**
76 + * Initialize this controller.
77 + */
78 + constructor() {
79 + signals.set(this, createAbortSignal());
80 + }
81 + /**
82 + * Returns the `AbortSignal` object associated with this object.
83 + */
84 + get signal() {
85 + return getSignal(this);
86 + }
87 + /**
88 + * Abort and signal to any observers that the associated activity is to be aborted.
89 + */
90 + abort() {
91 + abortSignal(getSignal(this));
92 + }
93 +}
94 +/**
95 + * Associated signals.
96 + */
97 +const signals = new WeakMap();
98 +/**
99 + * Get the associated signal of a given controller.
100 + */
101 +function getSignal(controller) {
102 + const signal = signals.get(controller);
103 + if (signal == null) {
104 + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
105 + }
106 + return signal;
107 +}
108 +// Properties should be enumerable.
109 +Object.defineProperties(AbortController.prototype, {
110 + signal: { enumerable: true },
111 + abort: { enumerable: true },
112 +});
113 +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
114 + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
115 + configurable: true,
116 + value: "AbortController",
117 + });
118 +}
119 +
120 +exports.AbortController = AbortController;
121 +exports.AbortSignal = AbortSignal;
122 +exports.default = AbortController;
123 +
124 +module.exports = AbortController
125 +module.exports.AbortController = module.exports["default"] = AbortController
126 +module.exports.AbortSignal = AbortSignal
127 +//# sourceMappingURL=abort-controller.js.map
1 +{"version":3,"file":"abort-controller.js","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["EventTarget","defineEventAttribute"],"mappings":";;;;;;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQA,2BAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACDC,oCAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnDD,2BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACpC,OAAM;KACT;IAED,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,MAAM,CAAC,aAAa,CAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;CACnD;;;;AAKD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAwB,CAAA;;AAGxD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE;IAC3C,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAChC,CAAC,CAAA;;AAGF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QAC7D,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,aAAa;KACvB,CAAC,CAAA;CACL;;ACpFD;;;;AAIA,MAAqB,eAAe;;;;IAIhC;QACI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;KACzC;;;;IAKD,IAAW,MAAM;QACb,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;KACzB;;;;IAKM,KAAK;QACR,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC/B;CACJ;;;;AAKD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAgC,CAAA;;;;AAK3D,SAAS,SAAS,CAAC,UAA2B;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,SAAS,CACf,8DACI,UAAU,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,UAC1C,EAAE,CACL,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;CAChB;;AAGD,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5B,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA;AAEF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;;;;;;;;;"}
...\ No newline at end of file ...\ No newline at end of file
1 +/**
2 + * @author Toru Nagashima <https://github.com/mysticatea>
3 + * See LICENSE file in root directory for full license.
4 + */
5 +import { EventTarget, defineEventAttribute } from 'event-target-shim';
6 +
7 +/**
8 + * The signal class.
9 + * @see https://dom.spec.whatwg.org/#abortsignal
10 + */
11 +class AbortSignal extends EventTarget {
12 + /**
13 + * AbortSignal cannot be constructed directly.
14 + */
15 + constructor() {
16 + super();
17 + throw new TypeError("AbortSignal cannot be constructed directly");
18 + }
19 + /**
20 + * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
21 + */
22 + get aborted() {
23 + const aborted = abortedFlags.get(this);
24 + if (typeof aborted !== "boolean") {
25 + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
26 + }
27 + return aborted;
28 + }
29 +}
30 +defineEventAttribute(AbortSignal.prototype, "abort");
31 +/**
32 + * Create an AbortSignal object.
33 + */
34 +function createAbortSignal() {
35 + const signal = Object.create(AbortSignal.prototype);
36 + EventTarget.call(signal);
37 + abortedFlags.set(signal, false);
38 + return signal;
39 +}
40 +/**
41 + * Abort a given signal.
42 + */
43 +function abortSignal(signal) {
44 + if (abortedFlags.get(signal) !== false) {
45 + return;
46 + }
47 + abortedFlags.set(signal, true);
48 + signal.dispatchEvent({ type: "abort" });
49 +}
50 +/**
51 + * Aborted flag for each instances.
52 + */
53 +const abortedFlags = new WeakMap();
54 +// Properties should be enumerable.
55 +Object.defineProperties(AbortSignal.prototype, {
56 + aborted: { enumerable: true },
57 +});
58 +// `toString()` should return `"[object AbortSignal]"`
59 +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
60 + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
61 + configurable: true,
62 + value: "AbortSignal",
63 + });
64 +}
65 +
66 +/**
67 + * The AbortController.
68 + * @see https://dom.spec.whatwg.org/#abortcontroller
69 + */
70 +class AbortController {
71 + /**
72 + * Initialize this controller.
73 + */
74 + constructor() {
75 + signals.set(this, createAbortSignal());
76 + }
77 + /**
78 + * Returns the `AbortSignal` object associated with this object.
79 + */
80 + get signal() {
81 + return getSignal(this);
82 + }
83 + /**
84 + * Abort and signal to any observers that the associated activity is to be aborted.
85 + */
86 + abort() {
87 + abortSignal(getSignal(this));
88 + }
89 +}
90 +/**
91 + * Associated signals.
92 + */
93 +const signals = new WeakMap();
94 +/**
95 + * Get the associated signal of a given controller.
96 + */
97 +function getSignal(controller) {
98 + const signal = signals.get(controller);
99 + if (signal == null) {
100 + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
101 + }
102 + return signal;
103 +}
104 +// Properties should be enumerable.
105 +Object.defineProperties(AbortController.prototype, {
106 + signal: { enumerable: true },
107 + abort: { enumerable: true },
108 +});
109 +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
110 + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
111 + configurable: true,
112 + value: "AbortController",
113 + });
114 +}
115 +
116 +export default AbortController;
117 +export { AbortController, AbortSignal };
118 +//# sourceMappingURL=abort-controller.mjs.map
1 +{"version":3,"file":"abort-controller.mjs","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":[],"mappings":";;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQ,WAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACD,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACpC,OAAM;KACT;IAED,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,MAAM,CAAC,aAAa,CAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;CACnD;;;;AAKD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAwB,CAAA;;AAGxD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,SAAS,EAAE;IAC3C,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAChC,CAAC,CAAA;;AAGF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QAC7D,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,aAAa;KACvB,CAAC,CAAA;CACL;;ACpFD;;;;AAIA,MAAqB,eAAe;;;;IAIhC;QACI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;KACzC;;;;IAKD,IAAW,MAAM;QACb,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;KACzB;;;;IAKM,KAAK;QACR,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC/B;CACJ;;;;AAKD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAgC,CAAA;;;;AAK3D,SAAS,SAAS,CAAC,UAA2B;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,SAAS,CACf,8DACI,UAAU,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,UAC1C,EAAE,CACL,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;CAChB;;AAGD,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5B,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA;AAEF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;"}
...\ No newline at end of file ...\ No newline at end of file
1 +/**
2 + * @author Toru Nagashima <https://github.com/mysticatea>
3 + * See LICENSE file in root directory for full license.
4 + */(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.AbortControllerShim={}))})(this,function(a){'use strict';function b(a){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},b(a)}function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function e(a,b,c){return b&&d(a.prototype,b),c&&d(a,c),a}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&h(a,b)}function g(a){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},g(a)}function h(a,b){return h=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},h(a,b)}function i(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function j(a,b){return b&&("object"==typeof b||"function"==typeof b)?b:i(a)}function k(a){var b=F.get(a);return console.assert(null!=b,"'this' is expected an Event object, but got",a),b}function l(a){return null==a.passiveListener?void(!a.event.cancelable||(a.canceled=!0,"function"==typeof a.event.preventDefault&&a.event.preventDefault())):void("undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",a.passiveListener))}function m(a,b){F.set(this,{eventTarget:a,event:b,eventPhase:2,currentTarget:a,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:b.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});for(var c,d=Object.keys(b),e=0;e<d.length;++e)c=d[e],c in this||Object.defineProperty(this,c,n(c))}function n(a){return{get:function(){return k(this).event[a]},set:function(b){k(this).event[a]=b},configurable:!0,enumerable:!0}}function o(a){return{value:function(){var b=k(this).event;return b[a].apply(b,arguments)},configurable:!0,enumerable:!0}}function p(a,b){function c(b,c){a.call(this,b,c)}var d=Object.keys(b);if(0===d.length)return a;c.prototype=Object.create(a.prototype,{constructor:{value:c,configurable:!0,writable:!0}});for(var e,f=0;f<d.length;++f)if(e=d[f],!(e in a.prototype)){var g=Object.getOwnPropertyDescriptor(b,e),h="function"==typeof g.value;Object.defineProperty(c.prototype,e,h?o(e):n(e))}return c}function q(a){if(null==a||a===Object.prototype)return m;var b=G.get(a);return null==b&&(b=p(q(Object.getPrototypeOf(a)),a),G.set(a,b)),b}function r(a,b){var c=q(Object.getPrototypeOf(b));return new c(a,b)}function s(a){return k(a).immediateStopped}function t(a,b){k(a).eventPhase=b}function u(a,b){k(a).currentTarget=b}function v(a,b){k(a).passiveListener=b}function w(a){return null!==a&&"object"===b(a)}function x(a){var b=H.get(a);if(null==b)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return b}function y(a){return{get:function(){for(var b=x(this),c=b.get(a);null!=c;){if(3===c.listenerType)return c.listener;c=c.next}return null},set:function(b){"function"==typeof b||w(b)||(b=null);for(var c=x(this),d=null,e=c.get(a);null!=e;)3===e.listenerType?null===d?null===e.next?c.delete(a):c.set(a,e.next):d.next=e.next:d=e,e=e.next;if(null!==b){var f={listener:b,listenerType:3,passive:!1,once:!1,next:null};null===d?c.set(a,f):d.next=f}},configurable:!0,enumerable:!0}}function z(a,b){Object.defineProperty(a,"on".concat(b),y(b))}function A(a){function b(){B.call(this)}b.prototype=Object.create(B.prototype,{constructor:{value:b,configurable:!0,writable:!0}});for(var c=0;c<a.length;++c)z(b.prototype,a[c]);return b}function B(){if(this instanceof B)return void H.set(this,new Map);if(1===arguments.length&&Array.isArray(arguments[0]))return A(arguments[0]);if(0<arguments.length){for(var a=Array(arguments.length),b=0;b<arguments.length;++b)a[b]=arguments[b];return A(a)}throw new TypeError("Cannot call a class as a function")}function C(){var a=Object.create(K.prototype);return B.call(a),L.set(a,!1),a}function D(a){!1!==L.get(a)||(L.set(a,!0),a.dispatchEvent({type:"abort"}))}function E(a){var c=N.get(a);if(null==c)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got ".concat(null===a?"null":b(a)));return c}var F=new WeakMap,G=new WeakMap;m.prototype={get type(){return k(this).event.type},get target(){return k(this).eventTarget},get currentTarget(){return k(this).currentTarget},composedPath:function(){var a=k(this).currentTarget;return null==a?[]:[a]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return k(this).eventPhase},stopPropagation:function(){var a=k(this);a.stopped=!0,"function"==typeof a.event.stopPropagation&&a.event.stopPropagation()},stopImmediatePropagation:function(){var a=k(this);a.stopped=!0,a.immediateStopped=!0,"function"==typeof a.event.stopImmediatePropagation&&a.event.stopImmediatePropagation()},get bubbles(){return!!k(this).event.bubbles},get cancelable(){return!!k(this).event.cancelable},preventDefault:function(){l(k(this))},get defaultPrevented(){return k(this).canceled},get composed(){return!!k(this).event.composed},get timeStamp(){return k(this).timeStamp},get srcElement(){return k(this).eventTarget},get cancelBubble(){return k(this).stopped},set cancelBubble(a){if(a){var b=k(this);b.stopped=!0,"boolean"==typeof b.event.cancelBubble&&(b.event.cancelBubble=!0)}},get returnValue(){return!k(this).canceled},set returnValue(a){a||l(k(this))},initEvent:function(){}},Object.defineProperty(m.prototype,"constructor",{value:m,configurable:!0,writable:!0}),"undefined"!=typeof window&&"undefined"!=typeof window.Event&&(Object.setPrototypeOf(m.prototype,window.Event.prototype),G.set(window.Event.prototype,m));var H=new WeakMap,I=1,J=2;B.prototype={addEventListener:function(a,b,c){if(null!=b){if("function"!=typeof b&&!w(b))throw new TypeError("'listener' should be a function or an object.");var d=x(this),e=w(c),f=e?!!c.capture:!!c,g=f?I:J,h={listener:b,listenerType:g,passive:e&&!!c.passive,once:e&&!!c.once,next:null},i=d.get(a);if(void 0===i)return void d.set(a,h);for(var j=null;null!=i;){if(i.listener===b&&i.listenerType===g)return;j=i,i=i.next}j.next=h}},removeEventListener:function(a,b,c){if(null!=b)for(var d=x(this),e=w(c)?!!c.capture:!!c,f=e?I:J,g=null,h=d.get(a);null!=h;){if(h.listener===b&&h.listenerType===f)return void(null===g?null===h.next?d.delete(a):d.set(a,h.next):g.next=h.next);g=h,h=h.next}},dispatchEvent:function(a){if(null==a||"string"!=typeof a.type)throw new TypeError("\"event.type\" should be a string.");var b=x(this),c=a.type,d=b.get(c);if(null==d)return!0;for(var e=r(this,a),f=null;null!=d;){if(d.once?null===f?null===d.next?b.delete(c):b.set(c,d.next):f.next=d.next:f=d,v(e,d.passive?d.listener:null),"function"==typeof d.listener)try{d.listener.call(this,e)}catch(a){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(a)}else d.listenerType!==3&&"function"==typeof d.listener.handleEvent&&d.listener.handleEvent(e);if(s(e))break;d=d.next}return v(e,null),t(e,0),u(e,null),!e.defaultPrevented}},Object.defineProperty(B.prototype,"constructor",{value:B,configurable:!0,writable:!0}),"undefined"!=typeof window&&"undefined"!=typeof window.EventTarget&&Object.setPrototypeOf(B.prototype,window.EventTarget.prototype);var K=function(a){function d(){var a;throw c(this,d),a=j(this,g(d).call(this)),new TypeError("AbortSignal cannot be constructed directly")}return f(d,a),e(d,[{key:"aborted",get:function(){var a=L.get(this);if("boolean"!=typeof a)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got ".concat(null===this?"null":b(this)));return a}}]),d}(B);z(K.prototype,"abort");var L=new WeakMap;Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"===b(Symbol.toStringTag)&&Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var M=function(){function a(){c(this,a),N.set(this,C())}return e(a,[{key:"abort",value:function(){D(E(this))}},{key:"signal",get:function(){return E(this)}}]),a}(),N=new WeakMap;if(Object.defineProperties(M.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"===b(Symbol.toStringTag)&&Object.defineProperty(M.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),a.AbortController=M,a.AbortSignal=K,a.default=M,Object.defineProperty(a,"__esModule",{value:!0}),"undefined"==typeof module&&"undefined"==typeof define){var O=Function("return this")();"undefined"==typeof O.AbortController&&(O.AbortController=M,O.AbortSignal=K)}});
5 +//# sourceMappingURL=abort-controller.umd.js.map
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "abort-controller@^3.0.0",
3 + "_id": "abort-controller@3.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
6 + "_location": "/abort-controller",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "abort-controller@^3.0.0",
12 + "name": "abort-controller",
13 + "escapedName": "abort-controller",
14 + "rawSpec": "^3.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^3.0.0"
17 + },
18 + "_requiredBy": [
19 + "/gaxios"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
22 + "_shasum": "eaf54d53b62bae4138e809ca225c8439a6efb392",
23 + "_spec": "abort-controller@^3.0.0",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\gaxios",
25 + "author": {
26 + "name": "Toru Nagashima",
27 + "url": "https://github.com/mysticatea"
28 + },
29 + "browser": "./browser.js",
30 + "bugs": {
31 + "url": "https://github.com/mysticatea/abort-controller/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "event-target-shim": "^5.0.0"
36 + },
37 + "deprecated": false,
38 + "description": "An implementation of WHATWG AbortController interface.",
39 + "devDependencies": {
40 + "@babel/core": "^7.2.2",
41 + "@babel/plugin-transform-modules-commonjs": "^7.2.0",
42 + "@babel/preset-env": "^7.3.0",
43 + "@babel/register": "^7.0.0",
44 + "@mysticatea/eslint-plugin": "^8.0.1",
45 + "@mysticatea/spy": "^0.1.2",
46 + "@types/mocha": "^5.2.5",
47 + "@types/node": "^10.12.18",
48 + "assert": "^1.4.1",
49 + "codecov": "^3.1.0",
50 + "dts-bundle-generator": "^2.0.0",
51 + "eslint": "^5.12.1",
52 + "karma": "^3.1.4",
53 + "karma-chrome-launcher": "^2.2.0",
54 + "karma-coverage": "^1.1.2",
55 + "karma-firefox-launcher": "^1.1.0",
56 + "karma-growl-reporter": "^1.0.0",
57 + "karma-ie-launcher": "^1.0.0",
58 + "karma-mocha": "^1.3.0",
59 + "karma-rollup-preprocessor": "^7.0.0-rc.2",
60 + "mocha": "^5.2.0",
61 + "npm-run-all": "^4.1.5",
62 + "nyc": "^13.1.0",
63 + "opener": "^1.5.1",
64 + "rimraf": "^2.6.3",
65 + "rollup": "^1.1.2",
66 + "rollup-plugin-babel": "^4.3.2",
67 + "rollup-plugin-babel-minify": "^7.0.0",
68 + "rollup-plugin-commonjs": "^9.2.0",
69 + "rollup-plugin-node-resolve": "^4.0.0",
70 + "rollup-plugin-sourcemaps": "^0.4.2",
71 + "rollup-plugin-typescript": "^1.0.0",
72 + "rollup-watch": "^4.3.1",
73 + "ts-node": "^8.0.1",
74 + "type-tester": "^1.0.0",
75 + "typescript": "^3.2.4"
76 + },
77 + "engines": {
78 + "node": ">=6.5"
79 + },
80 + "files": [
81 + "dist",
82 + "polyfill.*",
83 + "browser.*"
84 + ],
85 + "homepage": "https://github.com/mysticatea/abort-controller#readme",
86 + "keywords": [
87 + "w3c",
88 + "whatwg",
89 + "event",
90 + "events",
91 + "abort",
92 + "cancel",
93 + "abortcontroller",
94 + "abortsignal",
95 + "controller",
96 + "signal",
97 + "shim"
98 + ],
99 + "license": "MIT",
100 + "main": "dist/abort-controller",
101 + "name": "abort-controller",
102 + "repository": {
103 + "type": "git",
104 + "url": "git+https://github.com/mysticatea/abort-controller.git"
105 + },
106 + "scripts": {
107 + "build": "run-s -s build:*",
108 + "build:dts": "dts-bundle-generator -o dist/abort-controller.d.ts src/abort-controller.ts && ts-node scripts/fix-dts",
109 + "build:rollup": "rollup -c",
110 + "clean": "rimraf .nyc_output coverage",
111 + "codecov": "codecov",
112 + "coverage": "opener coverage/lcov-report/index.html",
113 + "lint": "eslint . --ext .ts",
114 + "postversion": "git push && git push --tags",
115 + "preversion": "npm test",
116 + "test": "run-s -s lint test:*",
117 + "test:karma": "karma start --single-run",
118 + "test:mocha": "nyc mocha test/*.ts",
119 + "version": "npm run -s build && git add dist/*",
120 + "watch": "run-p -s watch:*",
121 + "watch:karma": "karma start --watch",
122 + "watch:mocha": "mocha test/*.ts --require ts-node/register --watch-extensions ts --watch --growl"
123 + },
124 + "version": "3.0.0"
125 +}
1 +/*globals require, self, window */
2 +"use strict"
3 +
4 +const ac = require("./dist/abort-controller")
5 +
6 +/*eslint-disable @mysticatea/prettier */
7 +const g =
8 + typeof self !== "undefined" ? self :
9 + typeof window !== "undefined" ? window :
10 + typeof global !== "undefined" ? global :
11 + /* otherwise */ undefined
12 +/*eslint-enable @mysticatea/prettier */
13 +
14 +if (g) {
15 + if (typeof g.AbortController === "undefined") {
16 + g.AbortController = ac.AbortController
17 + }
18 + if (typeof g.AbortSignal === "undefined") {
19 + g.AbortSignal = ac.AbortSignal
20 + }
21 +}
1 +/*globals self, window */
2 +import * as ac from "./dist/abort-controller"
3 +
4 +/*eslint-disable @mysticatea/prettier */
5 +const g =
6 + typeof self !== "undefined" ? self :
7 + typeof window !== "undefined" ? window :
8 + typeof global !== "undefined" ? global :
9 + /* otherwise */ undefined
10 +/*eslint-enable @mysticatea/prettier */
11 +
12 +if (g) {
13 + if (typeof g.AbortController === "undefined") {
14 + g.AbortController = ac.AbortController
15 + }
16 + if (typeof g.AbortSignal === "undefined") {
17 + g.AbortSignal = ac.AbortSignal
18 + }
19 +}
1 +sudo: false
2 +
3 +language: node_js
4 +
5 +node_js:
6 + - "4"
7 + - "5"
8 + - "6"
9 + - "7"
10 + - "8"
11 + - "9"
12 + - "10"
13 +
14 +install:
15 + - PATH="`npm bin`:`npm bin -g`:$PATH"
16 + # Install dependencies and build
17 + - npm install
18 +
19 +script:
20 + # Output useful info for debugging
21 + - node --version
22 + - npm --version
23 + # Run tests
24 + - npm test
1 +
2 +4.2.0 / 2018-01-15
3 +==================
4 +
5 + * Add support for returning an `http.Agent` instance
6 + * Optimize promisifying logic
7 + * Set `timeout` to null for proper cleanup
8 + * Remove Node.js <= 0.11.3 special-casing from test case
9 +
10 +4.1.2 / 2017-11-20
11 +==================
12 +
13 + * test Node 9 on Travis
14 + * ensure that `https.get()` uses the patched `https.request()`
15 +
16 +4.1.1 / 2017-07-20
17 +==================
18 +
19 + * Correct `https.request()` with a String (#9)
20 +
21 +4.1.0 / 2017-06-26
22 +==================
23 +
24 + * mix in Agent options into Request options
25 + * throw when nothing is returned from agent-base callback
26 + * do not modify the options object for https requests
27 +
28 +4.0.1 / 2017-06-13
29 +==================
30 +
31 + * add `this` context tests and fixes
32 +
33 +4.0.0 / 2017-06-06
34 +==================
35 +
36 + * drop support for Node.js < 4
37 + * drop old versions of Node.js from Travis-CI
38 + * specify Node.js >= 4.0.0 in `engines.node`
39 + * remove more old code
40 + * remove "extend" dependency
41 + * remove "semver" dependency
42 + * make the Promise logic a bit cleaner
43 + * add async function pseudo-example to README
44 + * use direct return in README example
45 +
46 +3.0.0 / 2017-06-02
47 +==================
48 +
49 + * drop support for Node.js v0.8 and v0.10
50 + * add support for async, Promises, and direct return
51 + * add a couple `options` test cases
52 + * implement a `"timeout"` option
53 + * rename main file to `index.js`
54 + * test Node 8 on Travis
55 +
56 +2.1.1 / 2017-05-30
57 +==================
58 +
59 + * Revert [`fe2162e`](https://github.com/TooTallNate/node-agent-base/commit/fe2162e0ba18123f5b301cba4de1e9dd74e437cd) and [`270bdc9`](https://github.com/TooTallNate/node-agent-base/commit/270bdc92eb8e3bd0444d1e5266e8e9390aeb3095) (fixes #7)
60 +
61 +2.1.0 / 2017-05-26
62 +==================
63 +
64 + * unref is not supported for node < 0.9.1 (@pi0)
65 + * add tests to dangling socket (@pi0)
66 + * check unref() is supported (@pi0)
67 + * fix dangling sockets problem (@pi0)
68 + * add basic "ws" module tests
69 + * make `Agent` be subclassable
70 + * turn `addRequest()` into a named function
71 + * test: Node.js v4 likes to call `cork` on the stream (#3, @tomhughes)
72 + * travis: test node v4, v5, v6 and v7
73 +
74 +2.0.1 / 2015-09-10
75 +==================
76 +
77 + * package: update "semver" to v5.0.1 for WebPack (#1, @vhpoet)
78 +
79 +2.0.0 / 2015-07-10
80 +==================
81 +
82 + * refactor to patch Node.js core for more consistent `opts` values
83 + * ensure that HTTP(s) default port numbers are always given
84 + * test: use ssl-cert-snakeoil SSL certs
85 + * test: add tests for arbitrary options
86 + * README: add API section
87 + * README: make the Agent HTTP/HTTPS generic in the example
88 + * README: use SVG for Travis-CI badge
89 +
90 +1.0.2 / 2015-06-27
91 +==================
92 +
93 + * agent: set `req._hadError` to true after emitting "error"
94 + * package: update "mocha" to v2
95 + * test: add artificial HTTP GET request test
96 + * test: add artificial data events test
97 + * test: fix artifical GET response test on node > v0.11.3
98 + * test: use a real timeout for the async error test
99 +
100 +1.0.1 / 2013-09-09
101 +==================
102 +
103 + * Fix passing an "error" object to the callback function on the first tick
104 +
105 +1.0.0 / 2013-09-09
106 +==================
107 +
108 + * New API: now you pass a callback function directly
109 +
110 +0.0.1 / 2013-07-09
111 +==================
112 +
113 + * Initial release
1 +agent-base
2 +==========
3 +### Turn a function into an [`http.Agent`][http.Agent] instance
4 +[![Build Status](https://travis-ci.org/TooTallNate/node-agent-base.svg?branch=master)](https://travis-ci.org/TooTallNate/node-agent-base)
5 +
6 +This module provides an `http.Agent` generator. That is, you pass it an async
7 +callback function, and it returns a new `http.Agent` instance that will invoke the
8 +given callback function when sending outbound HTTP requests.
9 +
10 +#### Some subclasses:
11 +
12 +Here's some more interesting uses of `agent-base`.
13 +Send a pull request to list yours!
14 +
15 + * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
16 + * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
17 + * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
18 + * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS (v4a) proxy `http.Agent` implementation for HTTP and HTTPS
19 +
20 +
21 +Installation
22 +------------
23 +
24 +Install with `npm`:
25 +
26 +``` bash
27 +$ npm install agent-base
28 +```
29 +
30 +
31 +Example
32 +-------
33 +
34 +Here's a minimal example that creates a new `net.Socket` connection to the server
35 +for every HTTP request (i.e. the equivalent of `agent: false` option):
36 +
37 +```js
38 +var net = require('net');
39 +var tls = require('tls');
40 +var url = require('url');
41 +var http = require('http');
42 +var agent = require('agent-base');
43 +
44 +var endpoint = 'http://nodejs.org/api/';
45 +var parsed = url.parse(endpoint);
46 +
47 +// This is the important part!
48 +parsed.agent = agent(function (req, opts) {
49 + var socket;
50 + // `secureEndpoint` is true when using the https module
51 + if (opts.secureEndpoint) {
52 + socket = tls.connect(opts);
53 + } else {
54 + socket = net.connect(opts);
55 + }
56 + return socket;
57 +});
58 +
59 +// Everything else works just like normal...
60 +http.get(parsed, function (res) {
61 + console.log('"response" event!', res.headers);
62 + res.pipe(process.stdout);
63 +});
64 +```
65 +
66 +Returning a Promise or using an `async` function is also supported:
67 +
68 +```js
69 +agent(async function (req, opts) {
70 + await sleep(1000);
71 + // etc…
72 +});
73 +```
74 +
75 +Return another `http.Agent` instance to "pass through" the responsibility
76 +for that HTTP request to that agent:
77 +
78 +```js
79 +agent(function (req, opts) {
80 + return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
81 +});
82 +```
83 +
84 +
85 +API
86 +---
87 +
88 +## Agent(Function callback[, Object options]) → [http.Agent][]
89 +
90 +Creates a base `http.Agent` that will execute the callback function `callback`
91 +for every HTTP request that it is used as the `agent` for. The callback function
92 +is responsible for creating a `stream.Duplex` instance of some kind that will be
93 +used as the underlying socket in the HTTP request.
94 +
95 +The `options` object accepts the following properties:
96 +
97 + * `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
98 +
99 +The callback function should have the following signature:
100 +
101 +### callback(http.ClientRequest req, Object options, Function cb) → undefined
102 +
103 +The ClientRequest `req` can be accessed to read request headers and
104 +and the path, etc. The `options` object contains the options passed
105 +to the `http.request()`/`https.request()` function call, and is formatted
106 +to be directly passed to `net.connect()`/`tls.connect()`, or however
107 +else you want a Socket to be created. Pass the created socket to
108 +the callback function `cb` once created, and the HTTP request will
109 +continue to proceed.
110 +
111 +If the `https` module is used to invoke the HTTP request, then the
112 +`secureEndpoint` property on `options` _will be set to `true`_.
113 +
114 +
115 +License
116 +-------
117 +
118 +(The MIT License)
119 +
120 +Copyright (c) 2013 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
121 +
122 +Permission is hereby granted, free of charge, to any person obtaining
123 +a copy of this software and associated documentation files (the
124 +'Software'), to deal in the Software without restriction, including
125 +without limitation the rights to use, copy, modify, merge, publish,
126 +distribute, sublicense, and/or sell copies of the Software, and to
127 +permit persons to whom the Software is furnished to do so, subject to
128 +the following conditions:
129 +
130 +The above copyright notice and this permission notice shall be
131 +included in all copies or substantial portions of the Software.
132 +
133 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
134 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
136 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
137 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
138 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
139 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140 +
141 +[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
142 +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
143 +[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
144 +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
145 +[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
1 +// Type definitions for agent-base 4.2.1
2 +// Project: https://github.com/TooTallNate/node-agent-base
3 +// Definitions by: Christopher Quadflieg <https://github.com/Shinigami92>
4 +
5 +/// <reference types="node" />
6 +import { EventEmitter } from 'events';
7 +
8 +declare namespace Agent {
9 + export type AgentCallback = (
10 + req?: any,
11 + opts?: {
12 + secureEndpoint: boolean;
13 + }
14 + ) => void;
15 +
16 + export interface AgentOptions {
17 + timeout?: number;
18 + host?: string;
19 + port?: number;
20 + [key: string]: any;
21 + }
22 +
23 + export interface Agent extends EventEmitter {
24 + _promisifiedCallback: boolean;
25 + timeout: number | null;
26 + options?: AgentOptions;
27 + callback: AgentCallback;
28 + addRequest: (req?: any, opts?: any) => void;
29 + freeSocket: (socket: any, opts: any) => void;
30 + }
31 +}
32 +
33 +/**
34 + * Base `http.Agent` implementation.
35 + * No pooling/keep-alive is implemented by default.
36 + */
37 +declare function Agent(opts?: Agent.AgentOptions): Agent.Agent;
38 +declare function Agent(
39 + callback: Agent.AgentCallback,
40 + opts?: Agent.AgentOptions
41 +): Agent.Agent;
42 +
43 +export = Agent;
1 +'use strict';
2 +require('./patch-core');
3 +const inherits = require('util').inherits;
4 +const promisify = require('es6-promisify');
5 +const EventEmitter = require('events').EventEmitter;
6 +
7 +module.exports = Agent;
8 +
9 +function isAgent(v) {
10 + return v && typeof v.addRequest === 'function';
11 +}
12 +
13 +/**
14 + * Base `http.Agent` implementation.
15 + * No pooling/keep-alive is implemented by default.
16 + *
17 + * @param {Function} callback
18 + * @api public
19 + */
20 +function Agent(callback, _opts) {
21 + if (!(this instanceof Agent)) {
22 + return new Agent(callback, _opts);
23 + }
24 +
25 + EventEmitter.call(this);
26 +
27 + // The callback gets promisified if it has 3 parameters
28 + // (i.e. it has a callback function) lazily
29 + this._promisifiedCallback = false;
30 +
31 + let opts = _opts;
32 + if ('function' === typeof callback) {
33 + this.callback = callback;
34 + } else if (callback) {
35 + opts = callback;
36 + }
37 +
38 + // timeout for the socket to be returned from the callback
39 + this.timeout = (opts && opts.timeout) || null;
40 +
41 + this.options = opts;
42 +}
43 +inherits(Agent, EventEmitter);
44 +
45 +/**
46 + * Override this function in your subclass!
47 + */
48 +Agent.prototype.callback = function callback(req, opts) {
49 + throw new Error(
50 + '"agent-base" has no default implementation, you must subclass and override `callback()`'
51 + );
52 +};
53 +
54 +/**
55 + * Called by node-core's "_http_client.js" module when creating
56 + * a new HTTP request with this Agent instance.
57 + *
58 + * @api public
59 + */
60 +Agent.prototype.addRequest = function addRequest(req, _opts) {
61 + const ownOpts = Object.assign({}, _opts);
62 +
63 + // Set default `host` for HTTP to localhost
64 + if (null == ownOpts.host) {
65 + ownOpts.host = 'localhost';
66 + }
67 +
68 + // Set default `port` for HTTP if none was explicitly specified
69 + if (null == ownOpts.port) {
70 + ownOpts.port = ownOpts.secureEndpoint ? 443 : 80;
71 + }
72 +
73 + const opts = Object.assign({}, this.options, ownOpts);
74 +
75 + if (opts.host && opts.path) {
76 + // If both a `host` and `path` are specified then it's most likely the
77 + // result of a `url.parse()` call... we need to remove the `path` portion so
78 + // that `net.connect()` doesn't attempt to open that as a unix socket file.
79 + delete opts.path;
80 + }
81 +
82 + delete opts.agent;
83 + delete opts.hostname;
84 + delete opts._defaultAgent;
85 + delete opts.defaultPort;
86 + delete opts.createConnection;
87 +
88 + // Hint to use "Connection: close"
89 + // XXX: non-documented `http` module API :(
90 + req._last = true;
91 + req.shouldKeepAlive = false;
92 +
93 + // Create the `stream.Duplex` instance
94 + let timeout;
95 + let timedOut = false;
96 + const timeoutMs = this.timeout;
97 + const freeSocket = this.freeSocket;
98 +
99 + function onerror(err) {
100 + if (req._hadError) return;
101 + req.emit('error', err);
102 + // For Safety. Some additional errors might fire later on
103 + // and we need to make sure we don't double-fire the error event.
104 + req._hadError = true;
105 + }
106 +
107 + function ontimeout() {
108 + timeout = null;
109 + timedOut = true;
110 + const err = new Error(
111 + 'A "socket" was not created for HTTP request before ' + timeoutMs + 'ms'
112 + );
113 + err.code = 'ETIMEOUT';
114 + onerror(err);
115 + }
116 +
117 + function callbackError(err) {
118 + if (timedOut) return;
119 + if (timeout != null) {
120 + clearTimeout(timeout);
121 + timeout = null;
122 + }
123 + onerror(err);
124 + }
125 +
126 + function onsocket(socket) {
127 + if (timedOut) return;
128 + if (timeout != null) {
129 + clearTimeout(timeout);
130 + timeout = null;
131 + }
132 + if (isAgent(socket)) {
133 + // `socket` is actually an http.Agent instance, so relinquish
134 + // responsibility for this `req` to the Agent from here on
135 + socket.addRequest(req, opts);
136 + } else if (socket) {
137 + function onfree() {
138 + freeSocket(socket, opts);
139 + }
140 + socket.on('free', onfree);
141 + req.onSocket(socket);
142 + } else {
143 + const err = new Error(
144 + 'no Duplex stream was returned to agent-base for `' + req.method + ' ' + req.path + '`'
145 + );
146 + onerror(err);
147 + }
148 + }
149 +
150 + if (!this._promisifiedCallback && this.callback.length >= 3) {
151 + // Legacy callback function - convert to a Promise
152 + this.callback = promisify(this.callback, this);
153 + this._promisifiedCallback = true;
154 + }
155 +
156 + if (timeoutMs > 0) {
157 + timeout = setTimeout(ontimeout, timeoutMs);
158 + }
159 +
160 + try {
161 + Promise.resolve(this.callback(req, opts)).then(onsocket, callbackError);
162 + } catch (err) {
163 + Promise.reject(err).catch(callbackError);
164 + }
165 +};
166 +
167 +Agent.prototype.freeSocket = function freeSocket(socket, opts) {
168 + // TODO reuse sockets
169 + socket.destroy();
170 +};
1 +{
2 + "_from": "agent-base@^4.3.0",
3 + "_id": "agent-base@4.3.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==",
6 + "_location": "/agent-base",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "agent-base@^4.3.0",
12 + "name": "agent-base",
13 + "escapedName": "agent-base",
14 + "rawSpec": "^4.3.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^4.3.0"
17 + },
18 + "_requiredBy": [
19 + "/https-proxy-agent"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
22 + "_shasum": "8165f01c436009bccad0b1d122f05ed770efc6ee",
23 + "_spec": "agent-base@^4.3.0",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\https-proxy-agent",
25 + "author": {
26 + "name": "Nathan Rajlich",
27 + "email": "nathan@tootallnate.net",
28 + "url": "http://n8.io/"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/TooTallNate/node-agent-base/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "es6-promisify": "^5.0.0"
36 + },
37 + "deprecated": false,
38 + "description": "Turn a function into an `http.Agent` instance",
39 + "devDependencies": {
40 + "@types/es6-promisify": "^5.0.0",
41 + "@types/node": "^10.5.3",
42 + "mocha": "^3.4.2",
43 + "ws": "^3.0.0"
44 + },
45 + "engines": {
46 + "node": ">= 4.0.0"
47 + },
48 + "homepage": "https://github.com/TooTallNate/node-agent-base#readme",
49 + "keywords": [
50 + "http",
51 + "agent",
52 + "base",
53 + "barebones",
54 + "https"
55 + ],
56 + "license": "MIT",
57 + "main": "./index.js",
58 + "name": "agent-base",
59 + "repository": {
60 + "type": "git",
61 + "url": "git://github.com/TooTallNate/node-agent-base.git"
62 + },
63 + "scripts": {
64 + "test": "mocha --reporter spec"
65 + },
66 + "version": "4.3.0"
67 +}
1 +'use strict';
2 +const url = require('url');
3 +const https = require('https');
4 +
5 +/**
6 + * This currently needs to be applied to all Node.js versions
7 + * in order to determine if the `req` is an HTTP or HTTPS request.
8 + *
9 + * There is currently no PR attempting to move this property upstream.
10 + */
11 +const patchMarker = "__agent_base_https_request_patched__";
12 +if (!https.request[patchMarker]) {
13 + https.request = (function(request) {
14 + return function(_options, cb) {
15 + let options;
16 + if (typeof _options === 'string') {
17 + options = url.parse(_options);
18 + } else {
19 + options = Object.assign({}, _options);
20 + }
21 + if (null == options.port) {
22 + options.port = 443;
23 + }
24 + options.secureEndpoint = true;
25 + return request.call(https, options, cb);
26 + };
27 + })(https.request);
28 + https.request[patchMarker] = true;
29 +}
30 +
31 +/**
32 + * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the
33 + * patched `https.request()`.
34 + *
35 + * Ref: https://github.com/nodejs/node/commit/5118f31
36 + */
37 +https.get = function (_url, _options, cb) {
38 + let options;
39 + if (typeof _url === 'string' && _options && typeof _options !== 'function') {
40 + options = Object.assign({}, url.parse(_url), _options);
41 + } else if (!_options && !cb) {
42 + options = _url;
43 + } else if (!cb) {
44 + options = _url;
45 + cb = _options;
46 + }
47 +
48 + const req = https.request(options, cb);
49 + req.end();
50 + return req;
51 +};
1 +-----BEGIN RSA PRIVATE KEY-----
2 +MIICWwIBAAKBgQCzURxIqzer0ACAbX/lHdsn4Gd9PLKrf7EeDYfIdV0HZKPD8WDr
3 +bBx2/fBu0OW2sjnzv/SVZbJ0DAuPE/p0+eT0qb2qC10iz9iTD7ribd7gxhirVb8y
4 +b3fBjXsxc8V8p4Ny1LcvNSqCjwUbJqdRogfoJeTiqPM58z5sNzuv5iq7iwIDAQAB
5 +AoGAPMQy4olrP0UotlzlJ36bowLP70ffgHCwU+/f4NWs5fF78c3du0oSx1w820Dd
6 +Z7E0JF8bgnlJJTxjumPZz0RUCugrEHBKJmzEz3cxF5E3+7NvteZcjKn9D67RrM5x
7 +1/uSZ9cqKE9cYvY4fSuHx18diyZ4axR/wB1Pea2utjjDM+ECQQDb9ZbmmaWMiRpQ
8 +5Up+loxP7BZNPsEVsm+DVJmEFbaFgGfncWBqSIqnPNjMwTwj0OigTwCAEGPkfRVW
9 +T0pbYWCxAkEA0LK7SCTwzyDmhASUalk0x+3uCAA6ryFdwJf/wd8TRAvVOmkTEldX
10 +uJ7ldLvfrONYO3v56uKTU/SoNdZYzKtO+wJAX2KM4ctXYy5BXztPpr2acz4qHa1N
11 +Bh+vBAC34fOYhyQ76r3b1btHhWZ5jbFuZwm9F2erC94Ps5IaoqcX07DSwQJAPKGw
12 +h2U0EPkd/3zVIZCJJQya+vgWFIs9EZcXVtvYXQyTBkVApTN66MhBIYjzkub5205J
13 +bVQmOV37AKklY1DhwQJAA1wos0cYxro02edzatxd0DIR2r4qqOqLkw6BhYHhq6HJ
14 +ZvIcQkHqdSXzdETFc01I1znDGGIrJHcnvKWgBPoEUg==
15 +-----END RSA PRIVATE KEY-----
1 +-----BEGIN CERTIFICATE-----
2 +MIIB1TCCAT4CCQDV5mPlzm9+izANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQ3
3 +NTI3YmQ3Ny1hYjNlLTQ3NGItYWNlNy1lZWQ2MDUzOTMxZTcwHhcNMTUwNzA2MjI0
4 +NTA3WhcNMjUwNzAzMjI0NTA3WjAvMS0wKwYDVQQDEyQ3NTI3YmQ3Ny1hYjNlLTQ3
5 +NGItYWNlNy1lZWQ2MDUzOTMxZTcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
6 +ALNRHEirN6vQAIBtf+Ud2yfgZ308sqt/sR4Nh8h1XQdko8PxYOtsHHb98G7Q5bay
7 +OfO/9JVlsnQMC48T+nT55PSpvaoLXSLP2JMPuuJt3uDGGKtVvzJvd8GNezFzxXyn
8 +g3LUty81KoKPBRsmp1GiB+gl5OKo8znzPmw3O6/mKruLAgMBAAEwDQYJKoZIhvcN
9 +AQEFBQADgYEACzoHUF8UV2Z6541Q2wKEA0UFUzmUjf/E1XwBO+1P15ZZ64uw34B4
10 +1RwMPtAo9RY/PmICTWtNxWGxkzwb2JtDWtnxVER/lF8k2XcXPE76fxTHJF/BKk9J
11 +QU8OTD1dd9gHCBviQB9TqntRZ5X7axjtuWjb2umY+owBYzAHZkp1HKI=
12 +-----END CERTIFICATE-----
This diff is collapsed. Click to expand it.
1 +/**
2 +Convert a value to an array.
3 +
4 +_Supplying `null` or `undefined` results in an empty array._
5 +
6 +@example
7 +```
8 +import arrify = require('arrify');
9 +
10 +arrify('🦄');
11 +//=> ['🦄']
12 +
13 +arrify(['🦄']);
14 +//=> ['🦄']
15 +
16 +arrify(new Set(['🦄']));
17 +//=> ['🦄']
18 +
19 +arrify(null);
20 +//=> []
21 +
22 +arrify(undefined);
23 +//=> []
24 +```
25 +*/
26 +declare function arrify<ValueType>(
27 + value: ValueType
28 +): ValueType extends (null | undefined)
29 + ? []
30 + : ValueType extends string
31 + ? [string]
32 + : ValueType extends ReadonlyArray<unknown> // TODO: Use 'readonly unknown[]' in the next major version
33 + ? ValueType
34 + : ValueType extends Iterable<infer T>
35 + ? T[]
36 + : [ValueType];
37 +
38 +export = arrify;
1 +'use strict';
2 +
3 +const arrify = value => {
4 + if (value === null || value === undefined) {
5 + return [];
6 + }
7 +
8 + if (Array.isArray(value)) {
9 + return value;
10 + }
11 +
12 + if (typeof value === 'string') {
13 + return [value];
14 + }
15 +
16 + if (typeof value[Symbol.iterator] === 'function') {
17 + return [...value];
18 + }
19 +
20 + return [value];
21 +};
22 +
23 +module.exports = arrify;
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "arrify@^2.0.0",
3 + "_id": "arrify@2.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==",
6 + "_location": "/arrify",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "arrify@^2.0.0",
12 + "name": "arrify",
13 + "escapedName": "arrify",
14 + "rawSpec": "^2.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^2.0.0"
17 + },
18 + "_requiredBy": [
19 + "/google-auth-library"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
22 + "_shasum": "c9655e9331e0abcd588d2a7cad7e9956f66701fa",
23 + "_spec": "arrify@^2.0.0",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\google-auth-library",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/sindresorhus/arrify/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Convert a value to an array",
36 + "devDependencies": {
37 + "ava": "^1.4.1",
38 + "tsd": "^0.7.2",
39 + "xo": "^0.24.0"
40 + },
41 + "engines": {
42 + "node": ">=8"
43 + },
44 + "files": [
45 + "index.js",
46 + "index.d.ts"
47 + ],
48 + "homepage": "https://github.com/sindresorhus/arrify#readme",
49 + "keywords": [
50 + "array",
51 + "arrify",
52 + "arrayify",
53 + "convert",
54 + "value",
55 + "ensure"
56 + ],
57 + "license": "MIT",
58 + "name": "arrify",
59 + "repository": {
60 + "type": "git",
61 + "url": "git+https://github.com/sindresorhus/arrify.git"
62 + },
63 + "scripts": {
64 + "test": "xo && ava && tsd"
65 + },
66 + "version": "2.0.1"
67 +}
1 +# arrify [![Build Status](https://travis-ci.org/sindresorhus/arrify.svg?branch=master)](https://travis-ci.org/sindresorhus/arrify)
2 +
3 +> Convert a value to an array
4 +
5 +
6 +## Install
7 +
8 +```
9 +$ npm install arrify
10 +```
11 +
12 +
13 +## Usage
14 +
15 +```js
16 +const arrify = require('arrify');
17 +
18 +arrify('🦄');
19 +//=> ['🦄']
20 +
21 +arrify(['🦄']);
22 +//=> ['🦄']
23 +
24 +arrify(new Set(['🦄']));
25 +//=> ['🦄']
26 +
27 +arrify(null);
28 +//=> []
29 +
30 +arrify(undefined);
31 +//=> []
32 +```
33 +
34 +*Supplying `null` or `undefined` results in an empty array.*
35 +
36 +
37 +## License
38 +
39 +MIT © [Sindre Sorhus](https://sindresorhus.com)
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2014 Jameson Little
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in
13 +all copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 +THE SOFTWARE.
1 +base64-js
2 +=========
3 +
4 +`base64-js` does basic base64 encoding/decoding in pure JS.
5 +
6 +[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js)
7 +
8 +Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
9 +
10 +Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
11 +
12 +## install
13 +
14 +With [npm](https://npmjs.org) do:
15 +
16 +`npm install base64-js` and `var base64js = require('base64-js')`
17 +
18 +For use in web browsers do:
19 +
20 +`<script src="base64js.min.js"></script>`
21 +
22 +## methods
23 +
24 +`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
25 +
26 +* `byteLength` - Takes a base64 string and returns length of byte array
27 +* `toByteArray` - Takes a base64 string and returns a byte array
28 +* `fromByteArray` - Takes a byte array and returns a base64 string
29 +
30 +## license
31 +
32 +MIT
1 +(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function d(a,f,i){function u(n,r){if(!f[n]){if(!a[n]){var e="function"==typeof require&&require;if(!r&&e)return e(n,!0);if(v)return v(n,!0);var t=new Error("Cannot find module '"+n+"'");throw t.code="MODULE_NOT_FOUND",t}var o=f[n]={exports:{}};a[n][0].call(o.exports,function(r){var e=a[n][1][r];return u(e||r)},o,o.exports,d,a,f,i)}return f[n].exports}for(var v="function"==typeof require&&require,r=0;r<i.length;r++)u(i[r]);return u}return d}()({"/":[function(r,e,n){"use strict";n.byteLength=f;n.toByteArray=i;n.fromByteArray=p;var u=[];var v=[];var d=typeof Uint8Array!=="undefined"?Uint8Array:Array;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var o=0,a=t.length;o<a;++o){u[o]=t[o];v[t.charCodeAt(o)]=o}v["-".charCodeAt(0)]=62;v["_".charCodeAt(0)]=63;function c(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function f(r){var e=c(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function h(r,e,n){return(e+n)*3/4-n}function i(r){var e;var n=c(r);var t=n[0];var o=n[1];var a=new d(h(r,t,o));var f=0;var i=o>0?t-4:t;var u;for(u=0;u<i;u+=4){e=v[r.charCodeAt(u)]<<18|v[r.charCodeAt(u+1)]<<12|v[r.charCodeAt(u+2)]<<6|v[r.charCodeAt(u+3)];a[f++]=e>>16&255;a[f++]=e>>8&255;a[f++]=e&255}if(o===2){e=v[r.charCodeAt(u)]<<2|v[r.charCodeAt(u+1)]>>4;a[f++]=e&255}if(o===1){e=v[r.charCodeAt(u)]<<10|v[r.charCodeAt(u+1)]<<4|v[r.charCodeAt(u+2)]>>2;a[f++]=e>>8&255;a[f++]=e&255}return a}function s(r){return u[r>>18&63]+u[r>>12&63]+u[r>>6&63]+u[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;a<n;a+=3){t=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255);o.push(s(t))}return o.join("")}function p(r){var e;var n=r.length;var t=n%3;var o=[];var a=16383;for(var f=0,i=n-t;f<i;f+=a){o.push(l(r,f,f+a>i?i:f+a))}if(t===1){e=r[n-1];o.push(u[e>>2]+u[e<<4&63]+"==")}else if(t===2){e=(r[n-2]<<8)+r[n-1];o.push(u[e>>10]+u[e>>4&63]+u[e<<2&63]+"=")}return o.join("")}},{}]},{},[])("/")});
1 +'use strict'
2 +
3 +exports.byteLength = byteLength
4 +exports.toByteArray = toByteArray
5 +exports.fromByteArray = fromByteArray
6 +
7 +var lookup = []
8 +var revLookup = []
9 +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
10 +
11 +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
12 +for (var i = 0, len = code.length; i < len; ++i) {
13 + lookup[i] = code[i]
14 + revLookup[code.charCodeAt(i)] = i
15 +}
16 +
17 +// Support decoding URL-safe base64 strings, as Node.js does.
18 +// See: https://en.wikipedia.org/wiki/Base64#URL_applications
19 +revLookup['-'.charCodeAt(0)] = 62
20 +revLookup['_'.charCodeAt(0)] = 63
21 +
22 +function getLens (b64) {
23 + var len = b64.length
24 +
25 + if (len % 4 > 0) {
26 + throw new Error('Invalid string. Length must be a multiple of 4')
27 + }
28 +
29 + // Trim off extra bytes after placeholder bytes are found
30 + // See: https://github.com/beatgammit/base64-js/issues/42
31 + var validLen = b64.indexOf('=')
32 + if (validLen === -1) validLen = len
33 +
34 + var placeHoldersLen = validLen === len
35 + ? 0
36 + : 4 - (validLen % 4)
37 +
38 + return [validLen, placeHoldersLen]
39 +}
40 +
41 +// base64 is 4/3 + up to two characters of the original data
42 +function byteLength (b64) {
43 + var lens = getLens(b64)
44 + var validLen = lens[0]
45 + var placeHoldersLen = lens[1]
46 + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
47 +}
48 +
49 +function _byteLength (b64, validLen, placeHoldersLen) {
50 + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
51 +}
52 +
53 +function toByteArray (b64) {
54 + var tmp
55 + var lens = getLens(b64)
56 + var validLen = lens[0]
57 + var placeHoldersLen = lens[1]
58 +
59 + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
60 +
61 + var curByte = 0
62 +
63 + // if there are placeholders, only get up to the last complete 4 chars
64 + var len = placeHoldersLen > 0
65 + ? validLen - 4
66 + : validLen
67 +
68 + var i
69 + for (i = 0; i < len; i += 4) {
70 + tmp =
71 + (revLookup[b64.charCodeAt(i)] << 18) |
72 + (revLookup[b64.charCodeAt(i + 1)] << 12) |
73 + (revLookup[b64.charCodeAt(i + 2)] << 6) |
74 + revLookup[b64.charCodeAt(i + 3)]
75 + arr[curByte++] = (tmp >> 16) & 0xFF
76 + arr[curByte++] = (tmp >> 8) & 0xFF
77 + arr[curByte++] = tmp & 0xFF
78 + }
79 +
80 + if (placeHoldersLen === 2) {
81 + tmp =
82 + (revLookup[b64.charCodeAt(i)] << 2) |
83 + (revLookup[b64.charCodeAt(i + 1)] >> 4)
84 + arr[curByte++] = tmp & 0xFF
85 + }
86 +
87 + if (placeHoldersLen === 1) {
88 + tmp =
89 + (revLookup[b64.charCodeAt(i)] << 10) |
90 + (revLookup[b64.charCodeAt(i + 1)] << 4) |
91 + (revLookup[b64.charCodeAt(i + 2)] >> 2)
92 + arr[curByte++] = (tmp >> 8) & 0xFF
93 + arr[curByte++] = tmp & 0xFF
94 + }
95 +
96 + return arr
97 +}
98 +
99 +function tripletToBase64 (num) {
100 + return lookup[num >> 18 & 0x3F] +
101 + lookup[num >> 12 & 0x3F] +
102 + lookup[num >> 6 & 0x3F] +
103 + lookup[num & 0x3F]
104 +}
105 +
106 +function encodeChunk (uint8, start, end) {
107 + var tmp
108 + var output = []
109 + for (var i = start; i < end; i += 3) {
110 + tmp =
111 + ((uint8[i] << 16) & 0xFF0000) +
112 + ((uint8[i + 1] << 8) & 0xFF00) +
113 + (uint8[i + 2] & 0xFF)
114 + output.push(tripletToBase64(tmp))
115 + }
116 + return output.join('')
117 +}
118 +
119 +function fromByteArray (uint8) {
120 + var tmp
121 + var len = uint8.length
122 + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
123 + var parts = []
124 + var maxChunkLength = 16383 // must be multiple of 3
125 +
126 + // go through the array every three bytes, we'll deal with trailing stuff later
127 + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
128 + parts.push(encodeChunk(
129 + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
130 + ))
131 + }
132 +
133 + // pad the end with zeros, but make sure to not forget the extra bytes
134 + if (extraBytes === 1) {
135 + tmp = uint8[len - 1]
136 + parts.push(
137 + lookup[tmp >> 2] +
138 + lookup[(tmp << 4) & 0x3F] +
139 + '=='
140 + )
141 + } else if (extraBytes === 2) {
142 + tmp = (uint8[len - 2] << 8) + uint8[len - 1]
143 + parts.push(
144 + lookup[tmp >> 10] +
145 + lookup[(tmp >> 4) & 0x3F] +
146 + lookup[(tmp << 2) & 0x3F] +
147 + '='
148 + )
149 + }
150 +
151 + return parts.join('')
152 +}
1 +{
2 + "_from": "base64-js@^1.3.0",
3 + "_id": "base64-js@1.3.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
6 + "_location": "/base64-js",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "base64-js@^1.3.0",
12 + "name": "base64-js",
13 + "escapedName": "base64-js",
14 + "rawSpec": "^1.3.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^1.3.0"
17 + },
18 + "_requiredBy": [
19 + "/google-auth-library"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
22 + "_shasum": "58ece8cb75dd07e71ed08c736abc5fac4dbf8df1",
23 + "_spec": "base64-js@^1.3.0",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\google-auth-library",
25 + "author": {
26 + "name": "T. Jameson Little",
27 + "email": "t.jameson.little@gmail.com"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/beatgammit/base64-js/issues"
31 + },
32 + "bundleDependencies": false,
33 + "deprecated": false,
34 + "description": "Base64 encoding/decoding in pure JS",
35 + "devDependencies": {
36 + "benchmark": "^2.1.4",
37 + "browserify": "^16.3.0",
38 + "standard": "*",
39 + "tape": "4.x",
40 + "uglify-js": "^3.6.0"
41 + },
42 + "homepage": "https://github.com/beatgammit/base64-js",
43 + "keywords": [
44 + "base64"
45 + ],
46 + "license": "MIT",
47 + "main": "index.js",
48 + "name": "base64-js",
49 + "repository": {
50 + "type": "git",
51 + "url": "git://github.com/beatgammit/base64-js.git"
52 + },
53 + "scripts": {
54 + "build": "browserify -s base64js -r ./ | uglifyjs -m > base64js.min.js",
55 + "lint": "standard",
56 + "test": "npm run lint && npm run unit",
57 + "unit": "tape test/*.js"
58 + },
59 + "version": "1.3.1"
60 +}
1 +#### 7.2.1
2 +* 24/05/2018
3 +* Add `browser` field to *package.json*.
4 +
5 +#### 7.2.0
6 +* 22/05/2018
7 +* #166 Correct *.mjs* file. Remove extension from `main` field in *package.json*.
8 +
9 +#### 7.1.0
10 +* 18/05/2018
11 +* Add `module` field to *package.json* for *bignumber.mjs*.
12 +
13 +#### 7.0.2
14 +* 17/05/2018
15 +* #165 Bugfix: upper-case letters for bases 11-36 in a custom alphabet.
16 +* Add note to *README* regarding creating BigNumbers from Number values.
17 +
18 +#### 7.0.1
19 +* 26/04/2018
20 +* #158 Fix global object variable name typo.
21 +
22 +#### 7.0.0
23 +* 26/04/2018
24 +* #143 Remove global BigNumber from typings.
25 +* #144 Enable compatibility with `Object.freeze(Object.prototype)`.
26 +* #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`.
27 +* Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead.
28 +* #154 `exponentiatedBy`: allow BigNumber exponent.
29 +* #156 Prevent Content Security Policy *unsafe-eval* issue.
30 +* `toFraction`: allow `Infinity` maximum denominator.
31 +* Comment-out some excess tests to reduce test time.
32 +* Amend indentation and other spacing.
33 +
34 +#### 6.0.0
35 +* 26/01/2018
36 +* #137 Implement `APLHABET` configuration option.
37 +* Remove `ERRORS` configuration option.
38 +* Remove `toDigits` method; extend `precision` method accordingly.
39 +* Remove s`round` method; extend `decimalPlaces` method accordingly.
40 +* Remove methods: `ceil`, `floor`, and `truncated`.
41 +* Remove method aliases: `add`, `cmp`, `isInt`, `isNeg`, `trunc`, `mul`, `neg` and `sub`.
42 +* Rename methods: `shift` to `shiftedBy`, `another` to `clone`, `toPower` to `exponentiatedBy`, and `equals` to `isEqualTo`.
43 +* Rename methods: add `is` prefix to `greaterThan`, `greaterThanOrEqualTo`, `lessThan` and `lessThanOrEqualTo`.
44 +* Add methods: `multipliedBy`, `isBigNumber`, `isPositive`, `integerValue`, `maximum` and `minimum`.
45 +* Refactor test suite.
46 +* Add *CHANGELOG.md*.
47 +* Rewrite *bignumber.d.ts*.
48 +* Redo API image.
49 +
50 +#### 5.0.0
51 +* 27/11/2017
52 +* #81 Don't throw on constructor call without `new`.
53 +
54 +#### 4.1.0
55 +* 26/09/2017
56 +* Remove node 0.6 from *.travis.yml*.
57 +* Add *bignumber.mjs*.
58 +
59 +#### 4.0.4
60 +* 03/09/2017
61 +* Add missing aliases to *bignumber.d.ts*.
62 +
63 +#### 4.0.3
64 +* 30/08/2017
65 +* Add types: *bignumber.d.ts*.
66 +
67 +#### 4.0.2
68 +* 03/05/2017
69 +* #120 Workaround Safari/Webkit bug.
70 +
71 +#### 4.0.1
72 +* 05/04/2017
73 +* #121 BigNumber.default to BigNumber['default'].
74 +
75 +#### 4.0.0
76 +* 09/01/2017
77 +* Replace BigNumber.isBigNumber method with isBigNumber prototype property.
78 +
79 +#### 3.1.2
80 +* 08/01/2017
81 +* Minor documentation edit.
82 +
83 +#### 3.1.1
84 +* 08/01/2017
85 +* Uncomment `isBigNumber` tests.
86 +* Ignore dot files.
87 +
88 +#### 3.1.0
89 +* 08/01/2017
90 +* Add `isBigNumber` method.
91 +
92 +#### 3.0.2
93 +* 08/01/2017
94 +* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope).
95 +
96 +#### 3.0.1
97 +* 23/11/2016
98 +* Apply fix for old ipads with `%` issue, see #57 and #102.
99 +* Correct error message.
100 +
101 +#### 3.0.0
102 +* 09/11/2016
103 +* Remove `require('crypto')` - leave it to the user.
104 +* Add `BigNumber.set` as `BigNumber.config` alias.
105 +* Default `POW_PRECISION` to `0`.
106 +
107 +#### 2.4.0
108 +* 14/07/2016
109 +* #97 Add exports to support ES6 imports.
110 +
111 +#### 2.3.0
112 +* 07/03/2016
113 +* #86 Add modulus parameter to `toPower`.
114 +
115 +#### 2.2.0
116 +* 03/03/2016
117 +* #91 Permit larger JS integers.
118 +
119 +#### 2.1.4
120 +* 15/12/2015
121 +* Correct UMD.
122 +
123 +#### 2.1.3
124 +* 13/12/2015
125 +* Refactor re global object and crypto availability when bundling.
126 +
127 +#### 2.1.2
128 +* 10/12/2015
129 +* Bugfix: `window.crypto` not assigned to `crypto`.
130 +
131 +#### 2.1.1
132 +* 09/12/2015
133 +* Prevent code bundler from adding `crypto` shim.
134 +
135 +#### 2.1.0
136 +* 26/10/2015
137 +* For `valueOf` and `toJSON`, include the minus sign with negative zero.
138 +
139 +#### 2.0.8
140 +* 2/10/2015
141 +* Internal round function bugfix.
142 +
143 +#### 2.0.6
144 +* 31/03/2015
145 +* Add bower.json. Tweak division after in-depth review.
146 +
147 +#### 2.0.5
148 +* 25/03/2015
149 +* Amend README. Remove bitcoin address.
150 +
151 +#### 2.0.4
152 +* 25/03/2015
153 +* Critical bugfix #58: division.
154 +
155 +#### 2.0.3
156 +* 18/02/2015
157 +* Amend README. Add source map.
158 +
159 +#### 2.0.2
160 +* 18/02/2015
161 +* Correct links.
162 +
163 +#### 2.0.1
164 +* 18/02/2015
165 +* Add `max`, `min`, `precision`, `random`, `shiftedBy`, `toDigits` and `truncated` methods.
166 +* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`.
167 +* Add an `another` method to enable multiple independent constructors to be created.
168 +* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`.
169 +* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`.
170 +* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified.
171 +* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified.
172 +* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited.
173 +* Improve code quality.
174 +* Improve documentation.
175 +
176 +#### 2.0.0
177 +* 29/12/2014
178 +* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods.
179 +* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`.
180 +* Store a BigNumber's coefficient in base 1e14, rather than base 10.
181 +* Add fast path for integers to BigNumber constructor.
182 +* Incorporate the library into the online documentation.
183 +
184 +#### 1.5.0
185 +* 13/11/2014
186 +* Add `toJSON` and `decimalPlaces` methods.
187 +
188 +#### 1.4.1
189 +* 08/06/2014
190 +* Amend README.
191 +
192 +#### 1.4.0
193 +* 08/05/2014
194 +* Add `toNumber`.
195 +
196 +#### 1.3.0
197 +* 08/11/2013
198 +* Ensure correct rounding of `sqrt` in all, rather than almost all, cases.
199 +* Maximum radix to 64.
200 +
201 +#### 1.2.1
202 +* 17/10/2013
203 +* Sign of zero when x < 0 and x + (-x) = 0.
204 +
205 +#### 1.2.0
206 +* 19/9/2013
207 +* Throw Error objects for stack.
208 +
209 +#### 1.1.1
210 +* 22/8/2013
211 +* Show original value in constructor error message.
212 +
213 +#### 1.1.0
214 +* 1/8/2013
215 +* Allow numbers with trailing radix point.
216 +
217 +#### 1.0.1
218 +* Bugfix: error messages with incorrect method name
219 +
220 +#### 1.0.0
221 +* 8/11/2012
222 +* Initial release
1 +The MIT Licence.
2 +
3 +Copyright (c) 2018 Michael Mclaughlin
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining
6 +a copy of this software and associated documentation files (the
7 +'Software'), to deal in the Software without restriction, including
8 +without limitation the rights to use, copy, modify, merge, publish,
9 +distribute, sublicense, and/or sell copies of the Software, and to
10 +permit persons to whom the Software is furnished to do so, subject to
11 +the following conditions:
12 +
13 +The above copyright notice and this permission notice shall be
14 +included in all copies or substantial portions of the Software.
15 +
16 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 +
1 +![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png)
2 +
3 +A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.
4 +
5 +[![Build Status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js)
6 +
7 +<br />
8 +
9 +## Features
10 +
11 + - Integers and decimals
12 + - Simple API but full-featured
13 + - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
14 + - 8 KB minified and gzipped
15 + - Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type
16 + - Includes a `toFraction` and a correctly-rounded `squareRoot` method
17 + - Supports cryptographically-secure pseudo-random number generation
18 + - No dependencies
19 + - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only
20 + - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set
21 +
22 +![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png)
23 +
24 +If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/).
25 +It's less than half the size but only works with decimal numbers and only has half the methods.
26 +It also does not allow `NaN` or `Infinity`, or have the configuration options of this library.
27 +
28 +See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits.
29 +
30 +## Load
31 +
32 +The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*).
33 +
34 +Browser:
35 +
36 +```html
37 +<script src='path/to/bignumber.js'></script>
38 +```
39 +
40 +[Node.js](http://nodejs.org):
41 +
42 +```bash
43 +$ npm install --save bignumber.js
44 +```
45 +
46 +```javascript
47 +var BigNumber = require('bignumber.js');
48 +```
49 +
50 +ES6 module (*bignumber.mjs*):
51 +
52 +```javascript
53 +//import BigNumber from 'bignumber.js';
54 +import {BigNumber} from 'bignumber.js';
55 +```
56 +
57 +AMD loader libraries such as [requireJS](http://requirejs.org/):
58 +
59 +```javascript
60 +require(['bignumber'], function(BigNumber) {
61 + // Use BigNumber here in local scope. No global BigNumber.
62 +});
63 +```
64 +
65 +## Use
66 +
67 +*In all examples below, `var`, semicolons and `toString` calls are not shown.
68 +If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
69 +
70 +The library exports a single function: `BigNumber`, the constructor of BigNumber instances.
71 +
72 +It accepts a value of type Number, String or BigNumber,
73 +
74 +```javascript
75 +x = new BigNumber(123.4567)
76 +y = BigNumber('123456.7e-3')
77 +z = new BigNumber(x)
78 +x.isEqualTo(y) && y.isEqualTo(z) && x.isEqualTo(z) // true
79 +```
80 +
81 +and a base can be specified.
82 +
83 +```javascript
84 +a = new BigNumber(1011, 2) // "11"
85 +b = new BigNumber('zz.9', 36) // "1295.25"
86 +c = x.plus(y) // "1306.25"
87 +```
88 +
89 +Note that a BigNumber is created from a Number's decimal `toString()` value not from its underlying binary value. If the latter is required, then pass the Number's `toString(2)` value and specify base 2.
90 +
91 +```javascript
92 +new BigNumber(Number.MAX_VALUE.toString(2), 2)
93 +```
94 +
95 +If the limited precision of Number values is not well understood, **it is recommended to pass String values rather than Number values** to avoid a potential loss of precision.
96 +
97 +```javascript
98 +// Precision loss from using numeric literals with more than 15 significant digits.
99 +new BigNumber(1.0000000000000001); // '1'
100 +new BigNumber(88259496234518.57); // '88259496234518.56'
101 +new BigNumber(99999999999999999999); // '100000000000000000000'
102 +
103 +// Precision loss from using numeric literals outside the range of Number values.
104 +new BigNumber(2e+308); // 'Infinity'
105 +new BigNumber(1e-324); // '0'
106 +
107 +// Precision loss from the unexpected result of arithmetic with Number values.
108 +new BigNumber(0.7 + 0.1); // '0.7999999999999999'
109 +```
110 +
111 +A BigNumber is immutable in the sense that it is not changed by its methods.
112 +
113 +```javascript
114 +0.3 - 0.1 // 0.19999999999999998
115 +x = new BigNumber(0.3)
116 +x.minus(0.1) // "0.2"
117 +x // "0.3"
118 +```
119 +
120 +The methods that return a BigNumber can be chained.
121 +
122 +```javascript
123 +x.dividedBy(y).plus(z).times(9)
124 +x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').integerValue()
125 +```
126 +
127 +Some of the longer method names have a shorter alias.
128 +
129 +```javascript
130 +x.squareRoot().dividedBy(y).exponentiatedBy(3).isEqualTo( x.sqrt().div(y).pow(3) ) // true
131 +x.modulo(y).multipliedBy(z).eq( x.mod(y).times(z) ) // true
132 +```
133 +
134 +As with JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods
135 +
136 +```javascript
137 +x = new BigNumber(255.5)
138 +x.toExponential(5) // "2.55500e+2"
139 +x.toFixed(5) // "255.50000"
140 +x.toPrecision(5) // "255.50"
141 +x.toNumber() // 255.5
142 +```
143 +
144 + and a base can be specified for `toString`.
145 +
146 + ```javascript
147 + x.toString(16) // "ff.8"
148 + ```
149 +
150 +There is also a `toFormat` method which may be useful for internationalisation
151 +
152 +```javascript
153 +y = new BigNumber('1234567.898765')
154 +y.toFormat(2) // "1,234,567.90"
155 +```
156 +
157 +The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `config` method of the `BigNumber` constructor.
158 +
159 +The other arithmetic operations always give the exact result.
160 +
161 +```javascript
162 +BigNumber.config({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 })
163 +
164 +x = new BigNumber(2);
165 +y = new BigNumber(3);
166 +z = x.dividedBy(y) // "0.6666666667"
167 +z.squareRoot() // "0.8164965809"
168 +z.exponentiatedBy(-3) // "3.3749999995"
169 +z.toString(2) // "0.1010101011"
170 +z.multipliedBy(z) // "0.44444444448888888889"
171 +z.multipliedBy(z).decimalPlaces(10) // "0.4444444445"
172 +```
173 +
174 +There is a `toFraction` method with an optional *maximum denominator* argument
175 +
176 +```javascript
177 +y = new BigNumber(355)
178 +pi = y.dividedBy(113) // "3.1415929204"
179 +pi.toFraction() // [ "7853982301", "2500000000" ]
180 +pi.toFraction(1000) // [ "355", "113" ]
181 +```
182 +
183 +and `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `BigNumber` values.
184 +
185 +```javascript
186 +x = new BigNumber(NaN) // "NaN"
187 +y = new BigNumber(Infinity) // "Infinity"
188 +x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true
189 +```
190 +
191 +The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
192 +
193 +```javascript
194 +x = new BigNumber(-123.456);
195 +x.c // [ 123, 45600000000000 ] coefficient (i.e. significand)
196 +x.e // 2 exponent
197 +x.s // -1 sign
198 +```
199 +
200 +For advanced usage, multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it.
201 +
202 +```javascript
203 +// Set DECIMAL_PLACES for the original BigNumber constructor
204 +BigNumber.config({ DECIMAL_PLACES: 10 })
205 +
206 +// Create another BigNumber constructor, optionally passing in a configuration object
207 +BN = BigNumber.clone({ DECIMAL_PLACES: 5 })
208 +
209 +x = new BigNumber(1)
210 +y = new BN(1)
211 +
212 +x.div(3) // '0.3333333333'
213 +y.div(3) // '0.33333'
214 +```
215 +
216 +For futher information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory.
217 +
218 +## Test
219 +
220 +The *test/modules* directory contains the test scripts for each method.
221 +
222 +The tests can be run with Node.js or a browser. For Node.js use
223 +
224 + $ npm test
225 +
226 +or
227 +
228 + $ node test/test
229 +
230 +To test a single method, use, for example
231 +
232 + $ node test/methods/toFraction
233 +
234 +For the browser, open *test/test.html*.
235 +
236 +## Performance
237 +
238 +See the [README](https://github.com/MikeMcl/bignumber.js/tree/master/perf) in the *perf* directory.
239 +
240 +## Build
241 +
242 +For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed
243 +
244 + npm install uglify-js -g
245 +
246 +then
247 +
248 + npm run build
249 +
250 +will create *bignumber.min.js*.
251 +
252 +A source map will also be created in the root directory.
253 +
254 +## Feedback
255 +
256 +Open an issue, or email
257 +
258 +Michael
259 +
260 +<a href="mailto:M8ch88l@gmail.com">M8ch88l@gmail.com</a>
261 +
262 +## Licence
263 +
264 +The MIT Licence.
265 +
266 +See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE).
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "bignumber.js",
3 + "main": "bignumber.js",
4 + "version": "7.2.1",
5 + "homepage": "https://github.com/MikeMcl/bignumber.js",
6 + "authors": [
7 + "Michael Mclaughlin <M8ch88l@gmail.com>"
8 + ],
9 + "description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
10 + "moduleType": [
11 + "amd",
12 + "globals",
13 + "node"
14 + ],
15 + "keywords": [
16 + "arbitrary",
17 + "precision",
18 + "arithmetic",
19 + "big",
20 + "number",
21 + "decimal",
22 + "float",
23 + "biginteger",
24 + "bigdecimal",
25 + "bignumber",
26 + "bigint",
27 + "bignum"
28 + ],
29 + "license": "MIT",
30 + "ignore": [
31 + ".*",
32 + "*.json",
33 + "test"
34 + ]
35 +}
36 +
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "bignumber.js@^7.0.0",
3 + "_id": "bignumber.js@7.2.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==",
6 + "_location": "/bignumber.js",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "bignumber.js@^7.0.0",
12 + "name": "bignumber.js",
13 + "escapedName": "bignumber.js",
14 + "rawSpec": "^7.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^7.0.0"
17 + },
18 + "_requiredBy": [
19 + "/json-bigint"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz",
22 + "_shasum": "80c048759d826800807c4bfd521e50edbba57a5f",
23 + "_spec": "bignumber.js@^7.0.0",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\json-bigint",
25 + "author": {
26 + "name": "Michael Mclaughlin",
27 + "email": "M8ch88l@gmail.com"
28 + },
29 + "browser": "bignumber.js",
30 + "bugs": {
31 + "url": "https://github.com/MikeMcl/bignumber.js/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
36 + "engines": {
37 + "node": "*"
38 + },
39 + "homepage": "https://github.com/MikeMcl/bignumber.js#readme",
40 + "keywords": [
41 + "arbitrary",
42 + "precision",
43 + "arithmetic",
44 + "big",
45 + "number",
46 + "decimal",
47 + "float",
48 + "biginteger",
49 + "bigdecimal",
50 + "bignumber",
51 + "bigint",
52 + "bignum"
53 + ],
54 + "license": "MIT",
55 + "main": "bignumber",
56 + "module": "bignumber.mjs",
57 + "name": "bignumber.js",
58 + "repository": {
59 + "type": "git",
60 + "url": "git+https://github.com/MikeMcl/bignumber.js.git"
61 + },
62 + "scripts": {
63 + "build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v7.2.1 https://github.com/MikeMcl/bignumber.js/LICENCE */\"",
64 + "test": "node test/test"
65 + },
66 + "types": "bignumber.d.ts",
67 + "version": "7.2.1"
68 +}
1 +language: node_js
2 +node_js:
3 +- "0.11"
4 +- "0.10"
1 +Copyright (c) 2013, GoInstant Inc., a salesforce.com company
2 +All rights reserved.
3 +
4 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 +
6 +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 +
8 +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +
10 +* Neither the name of salesforce.com, nor GoInstant, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 +
12 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +# buffer-equal-constant-time
2 +
3 +Constant-time `Buffer` comparison for node.js. Should work with browserify too.
4 +
5 +[![Build Status](https://travis-ci.org/goinstant/buffer-equal-constant-time.png?branch=master)](https://travis-ci.org/goinstant/buffer-equal-constant-time)
6 +
7 +```sh
8 + npm install buffer-equal-constant-time
9 +```
10 +
11 +# Usage
12 +
13 +```js
14 + var bufferEq = require('buffer-equal-constant-time');
15 +
16 + var a = new Buffer('asdf');
17 + var b = new Buffer('asdf');
18 + if (bufferEq(a,b)) {
19 + // the same!
20 + } else {
21 + // different in at least one byte!
22 + }
23 +```
24 +
25 +If you'd like to install an `.equal()` method onto the node.js `Buffer` and
26 +`SlowBuffer` prototypes:
27 +
28 +```js
29 + require('buffer-equal-constant-time').install();
30 +
31 + var a = new Buffer('asdf');
32 + var b = new Buffer('asdf');
33 + if (a.equal(b)) {
34 + // the same!
35 + } else {
36 + // different in at least one byte!
37 + }
38 +```
39 +
40 +To get rid of the installed `.equal()` method, call `.restore()`:
41 +
42 +```js
43 + require('buffer-equal-constant-time').restore();
44 +```
45 +
46 +# Legal
47 +
48 +&copy; 2013 GoInstant Inc., a salesforce.com company
49 +
50 +Licensed under the BSD 3-clause license.
1 +/*jshint node:true */
2 +'use strict';
3 +var Buffer = require('buffer').Buffer; // browserify
4 +var SlowBuffer = require('buffer').SlowBuffer;
5 +
6 +module.exports = bufferEq;
7 +
8 +function bufferEq(a, b) {
9 +
10 + // shortcutting on type is necessary for correctness
11 + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
12 + return false;
13 + }
14 +
15 + // buffer sizes should be well-known information, so despite this
16 + // shortcutting, it doesn't leak any information about the *contents* of the
17 + // buffers.
18 + if (a.length !== b.length) {
19 + return false;
20 + }
21 +
22 + var c = 0;
23 + for (var i = 0; i < a.length; i++) {
24 + /*jshint bitwise:false */
25 + c |= a[i] ^ b[i]; // XOR
26 + }
27 + return c === 0;
28 +}
29 +
30 +bufferEq.install = function() {
31 + Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
32 + return bufferEq(this, that);
33 + };
34 +};
35 +
36 +var origBufEqual = Buffer.prototype.equal;
37 +var origSlowBufEqual = SlowBuffer.prototype.equal;
38 +bufferEq.restore = function() {
39 + Buffer.prototype.equal = origBufEqual;
40 + SlowBuffer.prototype.equal = origSlowBufEqual;
41 +};
1 +{
2 + "_from": "buffer-equal-constant-time@1.0.1",
3 + "_id": "buffer-equal-constant-time@1.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=",
6 + "_location": "/buffer-equal-constant-time",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "version",
10 + "registry": true,
11 + "raw": "buffer-equal-constant-time@1.0.1",
12 + "name": "buffer-equal-constant-time",
13 + "escapedName": "buffer-equal-constant-time",
14 + "rawSpec": "1.0.1",
15 + "saveSpec": null,
16 + "fetchSpec": "1.0.1"
17 + },
18 + "_requiredBy": [
19 + "/jwa"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
22 + "_shasum": "f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819",
23 + "_spec": "buffer-equal-constant-time@1.0.1",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\jwa",
25 + "author": {
26 + "name": "GoInstant Inc., a salesforce.com company"
27 + },
28 + "bugs": {
29 + "url": "https://github.com/goinstant/buffer-equal-constant-time/issues"
30 + },
31 + "bundleDependencies": false,
32 + "deprecated": false,
33 + "description": "Constant-time comparison of Buffers",
34 + "devDependencies": {
35 + "mocha": "~1.15.1"
36 + },
37 + "homepage": "https://github.com/goinstant/buffer-equal-constant-time#readme",
38 + "keywords": [
39 + "buffer",
40 + "equal",
41 + "constant-time",
42 + "crypto"
43 + ],
44 + "license": "BSD-3-Clause",
45 + "main": "index.js",
46 + "name": "buffer-equal-constant-time",
47 + "repository": {
48 + "type": "git",
49 + "url": "git+ssh://git@github.com/goinstant/buffer-equal-constant-time.git"
50 + },
51 + "scripts": {
52 + "test": "mocha test.js"
53 + },
54 + "version": "1.0.1"
55 +}
1 +/*jshint node:true */
2 +'use strict';
3 +
4 +var bufferEq = require('./index');
5 +var assert = require('assert');
6 +
7 +describe('buffer-equal-constant-time', function() {
8 + var a = new Buffer('asdfasdf123456');
9 + var b = new Buffer('asdfasdf123456');
10 + var c = new Buffer('asdfasdf');
11 +
12 + describe('bufferEq', function() {
13 + it('says a == b', function() {
14 + assert.strictEqual(bufferEq(a, b), true);
15 + });
16 +
17 + it('says a != c', function() {
18 + assert.strictEqual(bufferEq(a, c), false);
19 + });
20 + });
21 +
22 + describe('install/restore', function() {
23 + before(function() {
24 + bufferEq.install();
25 + });
26 + after(function() {
27 + bufferEq.restore();
28 + });
29 +
30 + it('installed an .equal method', function() {
31 + var SlowBuffer = require('buffer').SlowBuffer;
32 + assert.ok(Buffer.prototype.equal);
33 + assert.ok(SlowBuffer.prototype.equal);
34 + });
35 +
36 + it('infected existing Buffers', function() {
37 + assert.strictEqual(a.equal(b), true);
38 + assert.strictEqual(a.equal(c), false);
39 + });
40 + });
41 +
42 +});
This diff is collapsed. Click to expand it.
1 +# ecdsa-sig-formatter
2 +
3 +[![Build Status](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter.svg?branch=master)](https://travis-ci.org/Brightspace/node-ecdsa-sig-formatter) [![Coverage Status](https://coveralls.io/repos/Brightspace/node-ecdsa-sig-formatter/badge.svg)](https://coveralls.io/r/Brightspace/node-ecdsa-sig-formatter)
4 +
5 +Translate between JOSE and ASN.1/DER encodings for ECDSA signatures
6 +
7 +## Install
8 +```sh
9 +npm install ecdsa-sig-formatter --save
10 +```
11 +
12 +## Usage
13 +```js
14 +var format = require('ecdsa-sig-formatter');
15 +
16 +var derSignature = '..'; // asn.1/DER encoded ecdsa signature
17 +
18 +var joseSignature = format.derToJose(derSignature);
19 +
20 +```
21 +
22 +### API
23 +
24 +---
25 +
26 +#### `.derToJose(Buffer|String signature, String alg)` -> `String`
27 +
28 +Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature.
29 +Returns a _base64 url_ encoded `String`.
30 +
31 +* If _signature_ is a `String`, it should be _base64_ encoded
32 +* _alg_ must be one of _ES256_, _ES384_ or _ES512_
33 +
34 +---
35 +
36 +#### `.joseToDer(Buffer|String signature, String alg)` -> `Buffer`
37 +
38 +Convert the JOSE-style concatenated signature to an ASN.1/DER encoded
39 +signature. Returns a `Buffer`
40 +
41 +* If _signature_ is a `String`, it should be _base64 url_ encoded
42 +* _alg_ must be one of _ES256_, _ES384_ or _ES512_
43 +
44 +## Contributing
45 +
46 +1. **Fork** the repository. Committing directly against this repository is
47 + highly discouraged.
48 +
49 +2. Make your modifications in a branch, updating and writing new unit tests
50 + as necessary in the `spec` directory.
51 +
52 +3. Ensure that all tests pass with `npm test`
53 +
54 +4. `rebase` your changes against master. *Do not merge*.
55 +
56 +5. Submit a pull request to this repository. Wait for tests to run and someone
57 + to chime in.
58 +
59 +### Code Style
60 +
61 +This repository is configured with [EditorConfig][EditorConfig] and
62 +[ESLint][ESLint] rules.
63 +
64 +[EditorConfig]: http://editorconfig.org/
65 +[ESLint]: http://eslint.org
1 +{
2 + "_from": "ecdsa-sig-formatter@1.0.11",
3 + "_id": "ecdsa-sig-formatter@1.0.11",
4 + "_inBundle": false,
5 + "_integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
6 + "_location": "/ecdsa-sig-formatter",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "version",
10 + "registry": true,
11 + "raw": "ecdsa-sig-formatter@1.0.11",
12 + "name": "ecdsa-sig-formatter",
13 + "escapedName": "ecdsa-sig-formatter",
14 + "rawSpec": "1.0.11",
15 + "saveSpec": null,
16 + "fetchSpec": "1.0.11"
17 + },
18 + "_requiredBy": [
19 + "/jwa"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
22 + "_shasum": "ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf",
23 + "_spec": "ecdsa-sig-formatter@1.0.11",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\jwa",
25 + "author": {
26 + "name": "D2L Corporation"
27 + },
28 + "bugs": {
29 + "url": "https://github.com/Brightspace/node-ecdsa-sig-formatter/issues"
30 + },
31 + "bundleDependencies": false,
32 + "dependencies": {
33 + "safe-buffer": "^5.0.1"
34 + },
35 + "deprecated": false,
36 + "description": "Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation",
37 + "devDependencies": {
38 + "bench": "^0.3.6",
39 + "chai": "^3.5.0",
40 + "coveralls": "^2.11.9",
41 + "eslint": "^2.12.0",
42 + "eslint-config-brightspace": "^0.2.1",
43 + "istanbul": "^0.4.3",
44 + "jwk-to-pem": "^1.2.5",
45 + "mocha": "^2.5.3",
46 + "native-crypto": "^1.7.0"
47 + },
48 + "homepage": "https://github.com/Brightspace/node-ecdsa-sig-formatter#readme",
49 + "keywords": [
50 + "ecdsa",
51 + "der",
52 + "asn.1",
53 + "jwt",
54 + "jwa",
55 + "jsonwebtoken",
56 + "jose"
57 + ],
58 + "license": "Apache-2.0",
59 + "main": "src/ecdsa-sig-formatter.js",
60 + "name": "ecdsa-sig-formatter",
61 + "repository": {
62 + "type": "git",
63 + "url": "git+ssh://git@github.com/Brightspace/node-ecdsa-sig-formatter.git"
64 + },
65 + "scripts": {
66 + "check-style": "eslint .",
67 + "pretest": "npm run check-style",
68 + "report-cov": "cat ./coverage/lcov.info | coveralls",
69 + "test": "istanbul cover --root src _mocha -- spec"
70 + },
71 + "typings": "./src/ecdsa-sig-formatter.d.ts",
72 + "version": "1.0.11"
73 +}
1 +/// <reference types="node" />
2 +
3 +declare module "ecdsa-sig-formatter" {
4 + /**
5 + * Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String.
6 + * If signature is a String, it should be base64 encoded
7 + * alg must be one of ES256, ES384 or ES512
8 + */
9 + export function derToJose(signature: Buffer | string, alg: string): string;
10 +
11 + /**
12 + * Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer
13 + * If signature is a String, it should be base64 url encoded
14 + * alg must be one of ES256, ES384 or ES512
15 + */
16 + export function joseToDer(signature: Buffer | string, alg: string): Buffer
17 +}
1 +'use strict';
2 +
3 +var Buffer = require('safe-buffer').Buffer;
4 +
5 +var getParamBytesForAlg = require('./param-bytes-for-alg');
6 +
7 +var MAX_OCTET = 0x80,
8 + CLASS_UNIVERSAL = 0,
9 + PRIMITIVE_BIT = 0x20,
10 + TAG_SEQ = 0x10,
11 + TAG_INT = 0x02,
12 + ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6),
13 + ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6);
14 +
15 +function base64Url(base64) {
16 + return base64
17 + .replace(/=/g, '')
18 + .replace(/\+/g, '-')
19 + .replace(/\//g, '_');
20 +}
21 +
22 +function signatureAsBuffer(signature) {
23 + if (Buffer.isBuffer(signature)) {
24 + return signature;
25 + } else if ('string' === typeof signature) {
26 + return Buffer.from(signature, 'base64');
27 + }
28 +
29 + throw new TypeError('ECDSA signature must be a Base64 string or a Buffer');
30 +}
31 +
32 +function derToJose(signature, alg) {
33 + signature = signatureAsBuffer(signature);
34 + var paramBytes = getParamBytesForAlg(alg);
35 +
36 + // the DER encoded param should at most be the param size, plus a padding
37 + // zero, since due to being a signed integer
38 + var maxEncodedParamLength = paramBytes + 1;
39 +
40 + var inputLength = signature.length;
41 +
42 + var offset = 0;
43 + if (signature[offset++] !== ENCODED_TAG_SEQ) {
44 + throw new Error('Could not find expected "seq"');
45 + }
46 +
47 + var seqLength = signature[offset++];
48 + if (seqLength === (MAX_OCTET | 1)) {
49 + seqLength = signature[offset++];
50 + }
51 +
52 + if (inputLength - offset < seqLength) {
53 + throw new Error('"seq" specified length of "' + seqLength + '", only "' + (inputLength - offset) + '" remaining');
54 + }
55 +
56 + if (signature[offset++] !== ENCODED_TAG_INT) {
57 + throw new Error('Could not find expected "int" for "r"');
58 + }
59 +
60 + var rLength = signature[offset++];
61 +
62 + if (inputLength - offset - 2 < rLength) {
63 + throw new Error('"r" specified length of "' + rLength + '", only "' + (inputLength - offset - 2) + '" available');
64 + }
65 +
66 + if (maxEncodedParamLength < rLength) {
67 + throw new Error('"r" specified length of "' + rLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
68 + }
69 +
70 + var rOffset = offset;
71 + offset += rLength;
72 +
73 + if (signature[offset++] !== ENCODED_TAG_INT) {
74 + throw new Error('Could not find expected "int" for "s"');
75 + }
76 +
77 + var sLength = signature[offset++];
78 +
79 + if (inputLength - offset !== sLength) {
80 + throw new Error('"s" specified length of "' + sLength + '", expected "' + (inputLength - offset) + '"');
81 + }
82 +
83 + if (maxEncodedParamLength < sLength) {
84 + throw new Error('"s" specified length of "' + sLength + '", max of "' + maxEncodedParamLength + '" is acceptable');
85 + }
86 +
87 + var sOffset = offset;
88 + offset += sLength;
89 +
90 + if (offset !== inputLength) {
91 + throw new Error('Expected to consume entire buffer, but "' + (inputLength - offset) + '" bytes remain');
92 + }
93 +
94 + var rPadding = paramBytes - rLength,
95 + sPadding = paramBytes - sLength;
96 +
97 + var dst = Buffer.allocUnsafe(rPadding + rLength + sPadding + sLength);
98 +
99 + for (offset = 0; offset < rPadding; ++offset) {
100 + dst[offset] = 0;
101 + }
102 + signature.copy(dst, offset, rOffset + Math.max(-rPadding, 0), rOffset + rLength);
103 +
104 + offset = paramBytes;
105 +
106 + for (var o = offset; offset < o + sPadding; ++offset) {
107 + dst[offset] = 0;
108 + }
109 + signature.copy(dst, offset, sOffset + Math.max(-sPadding, 0), sOffset + sLength);
110 +
111 + dst = dst.toString('base64');
112 + dst = base64Url(dst);
113 +
114 + return dst;
115 +}
116 +
117 +function countPadding(buf, start, stop) {
118 + var padding = 0;
119 + while (start + padding < stop && buf[start + padding] === 0) {
120 + ++padding;
121 + }
122 +
123 + var needsSign = buf[start + padding] >= MAX_OCTET;
124 + if (needsSign) {
125 + --padding;
126 + }
127 +
128 + return padding;
129 +}
130 +
131 +function joseToDer(signature, alg) {
132 + signature = signatureAsBuffer(signature);
133 + var paramBytes = getParamBytesForAlg(alg);
134 +
135 + var signatureBytes = signature.length;
136 + if (signatureBytes !== paramBytes * 2) {
137 + throw new TypeError('"' + alg + '" signatures must be "' + paramBytes * 2 + '" bytes, saw "' + signatureBytes + '"');
138 + }
139 +
140 + var rPadding = countPadding(signature, 0, paramBytes);
141 + var sPadding = countPadding(signature, paramBytes, signature.length);
142 + var rLength = paramBytes - rPadding;
143 + var sLength = paramBytes - sPadding;
144 +
145 + var rsBytes = 1 + 1 + rLength + 1 + 1 + sLength;
146 +
147 + var shortLength = rsBytes < MAX_OCTET;
148 +
149 + var dst = Buffer.allocUnsafe((shortLength ? 2 : 3) + rsBytes);
150 +
151 + var offset = 0;
152 + dst[offset++] = ENCODED_TAG_SEQ;
153 + if (shortLength) {
154 + // Bit 8 has value "0"
155 + // bits 7-1 give the length.
156 + dst[offset++] = rsBytes;
157 + } else {
158 + // Bit 8 of first octet has value "1"
159 + // bits 7-1 give the number of additional length octets.
160 + dst[offset++] = MAX_OCTET | 1;
161 + // length, base 256
162 + dst[offset++] = rsBytes & 0xff;
163 + }
164 + dst[offset++] = ENCODED_TAG_INT;
165 + dst[offset++] = rLength;
166 + if (rPadding < 0) {
167 + dst[offset++] = 0;
168 + offset += signature.copy(dst, offset, 0, paramBytes);
169 + } else {
170 + offset += signature.copy(dst, offset, rPadding, paramBytes);
171 + }
172 + dst[offset++] = ENCODED_TAG_INT;
173 + dst[offset++] = sLength;
174 + if (sPadding < 0) {
175 + dst[offset++] = 0;
176 + signature.copy(dst, offset, paramBytes);
177 + } else {
178 + signature.copy(dst, offset, paramBytes + sPadding);
179 + }
180 +
181 + return dst;
182 +}
183 +
184 +module.exports = {
185 + derToJose: derToJose,
186 + joseToDer: joseToDer
187 +};
1 +'use strict';
2 +
3 +function getParamSize(keySize) {
4 + var result = ((keySize / 8) | 0) + (keySize % 8 === 0 ? 0 : 1);
5 + return result;
6 +}
7 +
8 +var paramBytesForAlg = {
9 + ES256: getParamSize(256),
10 + ES384: getParamSize(384),
11 + ES512: getParamSize(521)
12 +};
13 +
14 +function getParamBytesForAlg(alg) {
15 + var paramBytes = paramBytesForAlg[alg];
16 + if (paramBytes) {
17 + return paramBytes;
18 + }
19 +
20 + throw new Error('Unknown algorithm "' + alg + '"');
21 +}
22 +
23 +module.exports = getParamBytesForAlg;
1 +# Master
2 +
3 +# 4.2.5
4 +
5 +* remove old try/catch performance hacks, modern runtimes do not require these tricks
6 +
7 +# 4.2.4
8 +
9 +* [Fixes #305] Confuse webpack
10 +
11 +# 4.2.3
12 +
13 +* Cleanup testem related build configuration
14 +* Use `prepublishOnly` instead of `prepublish` (thanks @rhysd)
15 +* Add Node.js 9, 8 to testing matrix
16 +* drop now unused s3 deployment files
17 +* internal cleanup (thanks to @bekzod, @mariusschulz)
18 +* Fixup Changelog
19 +
20 +# 4.2.2
21 +
22 +* Ensure PROMISE_ID works correctly
23 +* internal cleanup (thanks yo @mariusschulz)
24 +
25 +# 4.2.1
26 +
27 +* drop bower support
28 +
29 +# 4.2.0
30 +
31 +* drop `dist` from git repo
32 +* add `Promise.prototype.finally`
33 +* update various build related dependencies
34 +* add CDN links
35 +
36 +# 4.1.0
37 +
38 +* [BUGFIX] Fix memory leak [#269]
39 +* [BUGFIX] Auto Bundles within an AMD Environment [#263]
40 +
41 +# 4.0.5
42 +
43 +* fix require('es6-promise/auto') for Node < 4
44 +
45 +# 4.0.4
46 +
47 +* fix asap when using https://github.com/Kinvey/titanium-sdk
48 +
49 +# 4.0.3
50 +
51 +* fix Readme links
52 +
53 +# 4.0.2
54 +
55 +* fix require('es6-promise/auto');
56 +
57 +# 4.0.0
58 +
59 +* no longer polyfill automatically, if needed one can still invoke
60 + `require('es6-promise/auto')` directly.
61 +
62 +# 3.3.1
63 +
64 +* fix links in readme
65 +
66 +# 3.3.0
67 +
68 +* support polyfil on WebMAF (playstation env)
69 +* fix tampering related bug global `constructor` was referenced by mistake.
70 +* provide TS Typings
71 +* increase compatibliity with sinon.useFakeTimers();
72 +* update build tools (use rollup)
73 +* directly export promise;
74 +
75 +# 3.2.2
76 +
77 +* IE8: use isArray
78 +* update build dependencies
79 +
80 +# 3.2.1
81 +
82 +* fix race tampering issue
83 +* use eslint
84 +* fix Promise.all tampering
85 +* remove unused code
86 +* fix issues with NWJS/electron
87 +
88 +# 3.2.0
89 +
90 +* improve tamper resistence of Promise.all Promise.race and
91 + Promise.prototype.then (note, this isn't complete, but addresses an exception
92 + when used \w core-js, follow up work will address entirely)
93 +* remove spec incompatible then chaining fast-path
94 +* add eslint
95 +* update build deps
96 +
97 +# 3.1.2
98 +
99 +* fix node detection issues with NWJS/electron
100 +
101 +# 3.1.0
102 +
103 +* improve performance of Promise.all when it encounters a non-promise input object input
104 +* then/resolve tamper protection
105 +* reduce AST size of promise constructor, to facilitate more inlining
106 +* Update README.md with details about PhantomJS requirement for running tests
107 +* Mangle and compress the minified version
108 +
109 +# 3.0.2
110 +
111 +* correctly bump both bower and package.json versions
112 +
113 +# 3.0.1
114 +
115 +* no longer include dist/test in npm releases
116 +
117 +# 3.0.0
118 +
119 +* use nextTick() instead of setImmediate() to schedule microtasks with node 0.10. Later versions of
120 + nodes are not affected as they were already using nextTick(). Note that using nextTick() might
121 + trigger a depreciation warning on 0.10 as described at https://github.com/cujojs/when/issues/410.
122 + The reason why nextTick() is preferred is that is setImmediate() would schedule a macrotask
123 + instead of a microtask and might result in a different scheduling.
124 + If needed you can revert to the former behavior as follow:
125 +
126 + var Promise = require('es6-promise').Promise;
127 + Promise._setScheduler(setImmediate);
128 +
129 +# 2.3.0
130 +
131 +* #121: Ability to override the internal asap implementation
132 +* #120: Use an ascii character for an apostrophe, for source maps
133 +
134 +# 2.2.0
135 +
136 +* #116: Expose asap() and a way to override the scheduling mechanism on Promise
137 +* Lock to v0.2.3 of ember-cli
138 +
139 +# 2.1.1
140 +
141 +* Fix #100 via #105: tell browserify to ignore vertx require
142 +* Fix #101 via #102: "follow thenable state, not own state"
143 +
144 +# 2.1.0
145 +
146 +* #59: Automatic polyfill. No need to invoke `ES6Promise.polyfill()` anymore.
147 +* ... (see the commit log)
148 +
149 +# 2.0.0
150 +
151 +* re-sync with RSVP. Many large performance improvements and bugfixes.
152 +
153 +# 1.0.0
154 +
155 +* first subset of RSVP
1 +Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy of
4 +this software and associated documentation files (the "Software"), to deal in
5 +the Software without restriction, including without limitation the rights to
6 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 +of the Software, and to permit persons to whom the Software is furnished to do
8 +so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in all
11 +copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 +SOFTWARE.
1 +# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) [![Build Status](https://travis-ci.org/stefanpenner/es6-promise.svg?branch=master)](https://travis-ci.org/stefanpenner/es6-promise)
2 +
3 +This is a polyfill of the [ES6 Promise](http://www.ecma-international.org/ecma-262/6.0/#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js) extracted by @jakearchibald, if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js).
4 +
5 +For API details and how to use promises, see the <a href="http://www.html5rocks.com/en/tutorials/es6/promises/">JavaScript Promises HTML5Rocks article</a>.
6 +
7 +## Downloads
8 +
9 +* [es6-promise 27.86 KB (7.33 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js)
10 +* [es6-promise-auto 27.78 KB (7.3 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.js) - Automatically provides/replaces `Promise` if missing or broken.
11 +* [es6-promise-min 6.17 KB (2.4 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.min.js)
12 +* [es6-promise-auto-min 6.19 KB (2.4 KB gzipped)](https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.min.js) - Minified version of `es6-promise-auto` above.
13 +
14 +## CDN
15 +
16 +To use via a CDN include this in your html:
17 +
18 +```html
19 +<!-- Automatically provides/replaces `Promise` if missing or broken. -->
20 +<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.js"></script>
21 +<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script>
22 +
23 +<!-- Minified version of `es6-promise-auto` below. -->
24 +<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.min.js"></script>
25 +<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js"></script>
26 +
27 +```
28 +
29 +## Node.js
30 +
31 +To install:
32 +
33 +```sh
34 +yarn add es6-promise
35 +```
36 +
37 +or
38 +
39 +```sh
40 +npm install es6-promise
41 +```
42 +
43 +To use:
44 +
45 +```js
46 +var Promise = require('es6-promise').Promise;
47 +```
48 +
49 +
50 +## Usage in IE<9
51 +
52 +`catch` and `finally` are reserved keywords in IE<9, meaning
53 +`promise.catch(func)` or `promise.finally(func)` throw a syntax error. To work
54 +around this, you can use a string to access the property as shown in the
55 +following example.
56 +
57 +However most minifiers will automatically fix this for you, making the
58 +resulting code safe for old browsers and production:
59 +
60 +```js
61 +promise['catch'](function(err) {
62 + // ...
63 +});
64 +```
65 +
66 +```js
67 +promise['finally'](function() {
68 + // ...
69 +});
70 +```
71 +
72 +## Auto-polyfill
73 +
74 +To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet:
75 +
76 +```js
77 +require('es6-promise').polyfill();
78 +```
79 +
80 +Alternatively
81 +
82 +```js
83 +require('es6-promise/auto');
84 +```
85 +
86 +Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called.
87 +
88 +## Building & Testing
89 +
90 +You will need to have PhantomJS installed globally in order to run the tests.
91 +
92 +`npm install -g phantomjs`
93 +
94 +* `npm run build` to build
95 +* `npm test` to run tests
96 +* `npm start` to run a build watcher, and webserver to test
97 +* `npm run test:server` for a testem test runner and watching builder
1 +// This file can be required in Browserify and Node.js for automatic polyfill
2 +// To use it: require('es6-promise/auto');
3 +'use strict';
4 +module.exports = require('./').polyfill();
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){W=t}function r(t){z=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof U?function(){U(a)}:c()}function s(){var t=0,e=new H(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<N;t+=2){var e=Q[t],n=Q[t+1];e(n),Q[t]=void 0,Q[t+1]=void 0}N=0}function f(){try{var t=Function("return this")().require("vertx");return U=t.runOnLoop||t.runOnContext,i()}catch(e){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[V]&&x(r);var o=n._state;if(o){var i=arguments[o-1];z(function(){return T(o,r,i,n._result)})}else j(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return w(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function y(t,e,n){z(function(t){var r=!1,o=_(n,e,function(n){r||(r=!0,e!==n?w(t,n):A(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,S(t,o))},t)}function m(t,e){e._state===Z?A(t,e._result):e._state===$?S(t,e._result):j(e,void 0,function(e){return w(t,e)},function(e){return S(t,e)})}function b(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?m(t,n):void 0===r?A(t,n):e(r)?y(t,n,r):A(t,n)}function w(e,n){if(e===n)S(e,v());else if(t(n)){var r=void 0;try{r=n.then}catch(o){return void S(e,o)}b(e,n,r)}else A(e,n)}function g(t){t._onerror&&t._onerror(t._result),E(t)}function A(t,e){t._state===X&&(t._result=e,t._state=Z,0!==t._subscribers.length&&z(E,t))}function S(t,e){t._state===X&&(t._state=$,t._result=e,z(g,t))}function j(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+Z]=n,o[i+$]=r,0===i&&t._state&&z(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?T(n,r,o,i):o(i);t._subscribers.length=0}}function T(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=!0;if(i){try{s=r(o)}catch(a){c=!1,u=a}if(n===s)return void S(n,d())}else s=o;n._state!==X||(i&&c?w(n,s):c===!1?S(n,u):t===Z?A(n,s):t===$&&S(n,s))}function M(t,e){try{e(function(e){w(t,e)},function(e){S(t,e)})}catch(n){S(t,n)}}function P(){return tt++}function x(t){t[V]=tt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function C(){return new Error("Array Methods must be provided an Array")}function O(t){return new et(this,t).promise}function k(t){var e=this;return new e(L(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return S(n,t),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function D(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=nt}var K=void 0;K=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var L=K,N=0,U=void 0,W=void 0,z=function(t,e){Q[N]=t,Q[N+1]=e,N+=2,2===N&&(W?W(a):R())},B="undefined"!=typeof window?window:void 0,G=B||{},H=G.MutationObserver||G.WebKitMutationObserver,I="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),J="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),R=void 0;R=I?o():H?s():J?u():void 0===B&&"function"==typeof require?f():c();var V=Math.random().toString(36).substring(2),X=void 0,Z=1,$=2,tt=0,et=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[V]||x(this.promise),L(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&A(this.promise,this._result))):S(this.promise,C())}return t.prototype._enumerate=function(t){for(var e=0;this._state===X&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=void 0,i=void 0,s=!1;try{o=t.then}catch(u){s=!0,i=u}if(o===l&&t._state!==X)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===nt){var c=new n(p);s?S(c,i):b(c,t,o),this._willSettleAt(c,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===X&&(this._remaining--,t===$?S(r,n):this._result[e]=n),0===this._remaining&&A(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){return n._settledAt(Z,e,t)},function(t){return n._settledAt($,e,t)})},t}(),nt=function(){function t(e){this[V]=P(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&Y(),this instanceof t?M(this,e):q())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var n=this,r=n.constructor;return e(t)?n.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})}):n.then(t,t)},t}();return nt.prototype.then=l,nt.all=O,nt.race=k,nt.resolve=h,nt.reject=F,nt._setScheduler=n,nt._setAsap=r,nt._asap=z,nt.polyfill=D,nt.Promise=nt,nt.polyfill(),nt});
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){W=t}function r(t){z=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof U?function(){U(a)}:c()}function s(){var t=0,e=new H(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<N;t+=2){var e=Q[t],n=Q[t+1];e(n),Q[t]=void 0,Q[t+1]=void 0}N=0}function f(){try{var t=Function("return this")().require("vertx");return U=t.runOnLoop||t.runOnContext,i()}catch(e){return c()}}function l(t,e){var n=this,r=new this.constructor(v);void 0===r[V]&&x(r);var o=n._state;if(o){var i=arguments[o-1];z(function(){return T(o,r,i,n._result)})}else j(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(v);return w(n,t),n}function v(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function y(t,e,n){z(function(t){var r=!1,o=_(n,e,function(n){r||(r=!0,e!==n?w(t,n):A(t,n))},function(e){r||(r=!0,S(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,S(t,o))},t)}function m(t,e){e._state===Z?A(t,e._result):e._state===$?S(t,e._result):j(e,void 0,function(e){return w(t,e)},function(e){return S(t,e)})}function b(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?m(t,n):void 0===r?A(t,n):e(r)?y(t,n,r):A(t,n)}function w(e,n){if(e===n)S(e,p());else if(t(n)){var r=void 0;try{r=n.then}catch(o){return void S(e,o)}b(e,n,r)}else A(e,n)}function g(t){t._onerror&&t._onerror(t._result),E(t)}function A(t,e){t._state===X&&(t._result=e,t._state=Z,0!==t._subscribers.length&&z(E,t))}function S(t,e){t._state===X&&(t._state=$,t._result=e,z(g,t))}function j(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+Z]=n,o[i+$]=r,0===i&&t._state&&z(E,t)}function E(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?T(n,r,o,i):o(i);t._subscribers.length=0}}function T(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=!0;if(i){try{s=r(o)}catch(a){c=!1,u=a}if(n===s)return void S(n,d())}else s=o;n._state!==X||(i&&c?w(n,s):c===!1?S(n,u):t===Z?A(n,s):t===$&&S(n,s))}function M(t,e){try{e(function(e){w(t,e)},function(e){S(t,e)})}catch(n){S(t,n)}}function P(){return tt++}function x(t){t[V]=tt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function C(){return new Error("Array Methods must be provided an Array")}function O(t){return new et(this,t).promise}function k(t){var e=this;return new e(L(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(v);return S(n,t),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function D(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=nt}var K=void 0;K=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var L=K,N=0,U=void 0,W=void 0,z=function(t,e){Q[N]=t,Q[N+1]=e,N+=2,2===N&&(W?W(a):R())},B="undefined"!=typeof window?window:void 0,G=B||{},H=G.MutationObserver||G.WebKitMutationObserver,I="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),J="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),R=void 0;R=I?o():H?s():J?u():void 0===B&&"function"==typeof require?f():c();var V=Math.random().toString(36).substring(2),X=void 0,Z=1,$=2,tt=0,et=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(v),this.promise[V]||x(this.promise),L(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&A(this.promise,this._result))):S(this.promise,C())}return t.prototype._enumerate=function(t){for(var e=0;this._state===X&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=void 0,i=void 0,s=!1;try{o=t.then}catch(u){s=!0,i=u}if(o===l&&t._state!==X)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===nt){var c=new n(v);s?S(c,i):b(c,t,o),this._willSettleAt(c,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===X&&(this._remaining--,t===$?S(r,n):this._result[e]=n),0===this._remaining&&A(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;j(t,void 0,function(t){return n._settledAt(Z,e,t)},function(t){return n._settledAt($,e,t)})},t}(),nt=function(){function t(e){this[V]=P(),this._result=this._state=void 0,this._subscribers=[],v!==e&&("function"!=typeof e&&Y(),this instanceof t?M(this,e):q())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var n=this,r=n.constructor;return e(t)?n.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})}):n.then(t,t)},t}();return nt.prototype.then=l,nt.all=O,nt.race=k,nt.resolve=h,nt.reject=F,nt._setScheduler=n,nt._setAsap=r,nt._asap=z,nt.polyfill=D,nt.Promise=nt,nt});
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +export interface Thenable <R> {
2 + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
3 + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
4 +}
5 +
6 +export class Promise <R> implements Thenable <R> {
7 + /**
8 + * If you call resolve in the body of the callback passed to the constructor,
9 + * your promise is fulfilled with result object passed to resolve.
10 + * If you call reject your promise is rejected with the object passed to resolve.
11 + * For consistency and debugging (eg stack traces), obj should be an instanceof Error.
12 + * Any errors thrown in the constructor callback will be implicitly passed to reject().
13 + */
14 + constructor (callback: (resolve : (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);
15 +
16 + /**
17 + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
18 + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
19 + * Both callbacks have a single parameter , the fulfillment value or rejection reason.
20 + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
21 + * If an error is thrown in the callback, the returned promise rejects with that error.
22 + *
23 + * @param onFulfilled called when/if "promise" resolves
24 + * @param onRejected called when/if "promise" rejects
25 + */
26 + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
27 + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
28 +
29 + /**
30 + * Sugar for promise.then(undefined, onRejected)
31 + *
32 + * @param onRejected called when/if "promise" rejects
33 + */
34 + catch <U> (onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
35 +
36 + /**
37 + * onSettled is invoked when/if the "promise" settles (either rejects or fulfills).
38 + * The returned promise is settled when the `Thenable` returned by `onFinally` settles;
39 + * it is rejected if `onFinally` throws or rejects; otherwise it assumes the state of the
40 + * original Promise.
41 + *
42 + * @param onFinally called when/if "promise" settles
43 +
44 + */
45 + finally (onFinally?: () => any | Thenable<any>): Promise<R>;
46 +
47 + /**
48 + * Make a new promise from the thenable.
49 + * A thenable is promise-like in as far as it has a "then" method.
50 + */
51 + static resolve (): Promise<void>;
52 + static resolve <R> (value: R | Thenable<R>): Promise<R>;
53 +
54 + /**
55 + * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
56 + */
57 + static reject <R> (error: any): Promise<R>;
58 +
59 + /**
60 + * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
61 + * the array passed to all can be a mixture of promise-like objects and other objects.
62 + * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
63 + */
64 + static all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
65 + static all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
66 + static all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
67 + static all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
68 + static all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
69 + static all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
70 + static all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
71 + static all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
72 + static all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
73 + static all<T1>(values: [T1 | Thenable<T1>]): Promise<[T1]>;
74 + static all<TAll>(values: Array<TAll | Thenable<TAll>>): Promise<TAll[]>;
75 +
76 + /**
77 + * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
78 + */
79 + static race <R> (promises: (R | Thenable<R>)[]): Promise<R>;
80 +}
81 +
82 +/**
83 + * The polyfill method will patch the global environment (in this case to the Promise name) when called.
84 + */
85 +export function polyfill (): void;
1 +import Promise from './es6-promise';
2 +Promise.polyfill();
3 +export default Promise;
1 +import Promise from './es6-promise/promise';
2 +import polyfill from './es6-promise/polyfill';
3 +
4 +// Strange compat..
5 +Promise.polyfill = polyfill;
6 +Promise.Promise = Promise;
7 +export default Promise;
1 +import {
2 + objectOrFunction,
3 + isFunction
4 +} from './utils';
5 +
6 +import {
7 + asap
8 +} from './asap';
9 +
10 +import originalThen from './then';
11 +import originalResolve from './promise/resolve';
12 +
13 +export const PROMISE_ID = Math.random().toString(36).substring(2);
14 +
15 +function noop() {}
16 +
17 +const PENDING = void 0;
18 +const FULFILLED = 1;
19 +const REJECTED = 2;
20 +
21 +function selfFulfillment() {
22 + return new TypeError("You cannot resolve a promise with itself");
23 +}
24 +
25 +function cannotReturnOwn() {
26 + return new TypeError('A promises callback cannot return that same promise.');
27 +}
28 +
29 +function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
30 + try {
31 + then.call(value, fulfillmentHandler, rejectionHandler);
32 + } catch(e) {
33 + return e;
34 + }
35 +}
36 +
37 +function handleForeignThenable(promise, thenable, then) {
38 + asap(promise => {
39 + let sealed = false;
40 + let error = tryThen(then, thenable, value => {
41 + if (sealed) { return; }
42 + sealed = true;
43 + if (thenable !== value) {
44 + resolve(promise, value);
45 + } else {
46 + fulfill(promise, value);
47 + }
48 + }, reason => {
49 + if (sealed) { return; }
50 + sealed = true;
51 +
52 + reject(promise, reason);
53 + }, 'Settle: ' + (promise._label || ' unknown promise'));
54 +
55 + if (!sealed && error) {
56 + sealed = true;
57 + reject(promise, error);
58 + }
59 + }, promise);
60 +}
61 +
62 +function handleOwnThenable(promise, thenable) {
63 + if (thenable._state === FULFILLED) {
64 + fulfill(promise, thenable._result);
65 + } else if (thenable._state === REJECTED) {
66 + reject(promise, thenable._result);
67 + } else {
68 + subscribe(thenable, undefined, value => resolve(promise, value),
69 + reason => reject(promise, reason))
70 + }
71 +}
72 +
73 +function handleMaybeThenable(promise, maybeThenable, then) {
74 + if (maybeThenable.constructor === promise.constructor &&
75 + then === originalThen &&
76 + maybeThenable.constructor.resolve === originalResolve) {
77 + handleOwnThenable(promise, maybeThenable);
78 + } else {
79 + if (then === undefined) {
80 + fulfill(promise, maybeThenable);
81 + } else if (isFunction(then)) {
82 + handleForeignThenable(promise, maybeThenable, then);
83 + } else {
84 + fulfill(promise, maybeThenable);
85 + }
86 + }
87 +}
88 +
89 +function resolve(promise, value) {
90 + if (promise === value) {
91 + reject(promise, selfFulfillment());
92 + } else if (objectOrFunction(value)) {
93 + let then;
94 + try {
95 + then = value.then;
96 + } catch (error) {
97 + reject(promise, error);
98 + return;
99 + }
100 + handleMaybeThenable(promise, value, then);
101 + } else {
102 + fulfill(promise, value);
103 + }
104 +}
105 +
106 +function publishRejection(promise) {
107 + if (promise._onerror) {
108 + promise._onerror(promise._result);
109 + }
110 +
111 + publish(promise);
112 +}
113 +
114 +function fulfill(promise, value) {
115 + if (promise._state !== PENDING) { return; }
116 +
117 + promise._result = value;
118 + promise._state = FULFILLED;
119 +
120 + if (promise._subscribers.length !== 0) {
121 + asap(publish, promise);
122 + }
123 +}
124 +
125 +function reject(promise, reason) {
126 + if (promise._state !== PENDING) { return; }
127 + promise._state = REJECTED;
128 + promise._result = reason;
129 +
130 + asap(publishRejection, promise);
131 +}
132 +
133 +function subscribe(parent, child, onFulfillment, onRejection) {
134 + let { _subscribers } = parent;
135 + let { length } = _subscribers;
136 +
137 + parent._onerror = null;
138 +
139 + _subscribers[length] = child;
140 + _subscribers[length + FULFILLED] = onFulfillment;
141 + _subscribers[length + REJECTED] = onRejection;
142 +
143 + if (length === 0 && parent._state) {
144 + asap(publish, parent);
145 + }
146 +}
147 +
148 +function publish(promise) {
149 + let subscribers = promise._subscribers;
150 + let settled = promise._state;
151 +
152 + if (subscribers.length === 0) { return; }
153 +
154 + let child, callback, detail = promise._result;
155 +
156 + for (let i = 0; i < subscribers.length; i += 3) {
157 + child = subscribers[i];
158 + callback = subscribers[i + settled];
159 +
160 + if (child) {
161 + invokeCallback(settled, child, callback, detail);
162 + } else {
163 + callback(detail);
164 + }
165 + }
166 +
167 + promise._subscribers.length = 0;
168 +}
169 +
170 +function invokeCallback(settled, promise, callback, detail) {
171 + let hasCallback = isFunction(callback),
172 + value, error, succeeded = true;
173 +
174 + if (hasCallback) {
175 + try {
176 + value = callback(detail);
177 + } catch (e) {
178 + succeeded = false;
179 + error = e;
180 + }
181 +
182 + if (promise === value) {
183 + reject(promise, cannotReturnOwn());
184 + return;
185 + }
186 + } else {
187 + value = detail;
188 + }
189 +
190 + if (promise._state !== PENDING) {
191 + // noop
192 + } else if (hasCallback && succeeded) {
193 + resolve(promise, value);
194 + } else if (succeeded === false) {
195 + reject(promise, error);
196 + } else if (settled === FULFILLED) {
197 + fulfill(promise, value);
198 + } else if (settled === REJECTED) {
199 + reject(promise, value);
200 + }
201 +}
202 +
203 +function initializePromise(promise, resolver) {
204 + try {
205 + resolver(function resolvePromise(value){
206 + resolve(promise, value);
207 + }, function rejectPromise(reason) {
208 + reject(promise, reason);
209 + });
210 + } catch(e) {
211 + reject(promise, e);
212 + }
213 +}
214 +
215 +let id = 0;
216 +function nextId() {
217 + return id++;
218 +}
219 +
220 +function makePromise(promise) {
221 + promise[PROMISE_ID] = id++;
222 + promise._state = undefined;
223 + promise._result = undefined;
224 + promise._subscribers = [];
225 +}
226 +
227 +export {
228 + nextId,
229 + makePromise,
230 + noop,
231 + resolve,
232 + reject,
233 + fulfill,
234 + subscribe,
235 + publish,
236 + publishRejection,
237 + initializePromise,
238 + invokeCallback,
239 + FULFILLED,
240 + REJECTED,
241 + PENDING,
242 + handleMaybeThenable
243 +};
1 +let len = 0;
2 +let vertxNext;
3 +let customSchedulerFn;
4 +
5 +export var asap = function asap(callback, arg) {
6 + queue[len] = callback;
7 + queue[len + 1] = arg;
8 + len += 2;
9 + if (len === 2) {
10 + // If len is 2, that means that we need to schedule an async flush.
11 + // If additional callbacks are queued before the queue is flushed, they
12 + // will be processed by this flush that we are scheduling.
13 + if (customSchedulerFn) {
14 + customSchedulerFn(flush);
15 + } else {
16 + scheduleFlush();
17 + }
18 + }
19 +}
20 +
21 +export function setScheduler(scheduleFn) {
22 + customSchedulerFn = scheduleFn;
23 +}
24 +
25 +export function setAsap(asapFn) {
26 + asap = asapFn;
27 +}
28 +
29 +const browserWindow = (typeof window !== 'undefined') ? window : undefined;
30 +const browserGlobal = browserWindow || {};
31 +const BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
32 +const isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
33 +
34 +// test for web worker but not in IE10
35 +const isWorker = typeof Uint8ClampedArray !== 'undefined' &&
36 + typeof importScripts !== 'undefined' &&
37 + typeof MessageChannel !== 'undefined';
38 +
39 +// node
40 +function useNextTick() {
41 + // node version 0.10.x displays a deprecation warning when nextTick is used recursively
42 + // see https://github.com/cujojs/when/issues/410 for details
43 + return () => process.nextTick(flush);
44 +}
45 +
46 +// vertx
47 +function useVertxTimer() {
48 + if (typeof vertxNext !== 'undefined') {
49 + return function() {
50 + vertxNext(flush);
51 + };
52 + }
53 +
54 + return useSetTimeout();
55 +}
56 +
57 +function useMutationObserver() {
58 + let iterations = 0;
59 + const observer = new BrowserMutationObserver(flush);
60 + const node = document.createTextNode('');
61 + observer.observe(node, { characterData: true });
62 +
63 + return () => {
64 + node.data = (iterations = ++iterations % 2);
65 + };
66 +}
67 +
68 +// web worker
69 +function useMessageChannel() {
70 + const channel = new MessageChannel();
71 + channel.port1.onmessage = flush;
72 + return () => channel.port2.postMessage(0);
73 +}
74 +
75 +function useSetTimeout() {
76 + // Store setTimeout reference so es6-promise will be unaffected by
77 + // other code modifying setTimeout (like sinon.useFakeTimers())
78 + const globalSetTimeout = setTimeout;
79 + return () => globalSetTimeout(flush, 1);
80 +}
81 +
82 +const queue = new Array(1000);
83 +function flush() {
84 + for (let i = 0; i < len; i+=2) {
85 + let callback = queue[i];
86 + let arg = queue[i+1];
87 +
88 + callback(arg);
89 +
90 + queue[i] = undefined;
91 + queue[i+1] = undefined;
92 + }
93 +
94 + len = 0;
95 +}
96 +
97 +function attemptVertx() {
98 + try {
99 + const vertx = Function('return this')().require('vertx');
100 + vertxNext = vertx.runOnLoop || vertx.runOnContext;
101 + return useVertxTimer();
102 + } catch(e) {
103 + return useSetTimeout();
104 + }
105 +}
106 +
107 +let scheduleFlush;
108 +// Decide what async method to use to triggering processing of queued callbacks:
109 +if (isNode) {
110 + scheduleFlush = useNextTick();
111 +} else if (BrowserMutationObserver) {
112 + scheduleFlush = useMutationObserver();
113 +} else if (isWorker) {
114 + scheduleFlush = useMessageChannel();
115 +} else if (browserWindow === undefined && typeof require === 'function') {
116 + scheduleFlush = attemptVertx();
117 +} else {
118 + scheduleFlush = useSetTimeout();
119 +}
1 +import {
2 + isArray,
3 + isMaybeThenable
4 +} from './utils';
5 +import {
6 + noop,
7 + reject,
8 + fulfill,
9 + subscribe,
10 + FULFILLED,
11 + REJECTED,
12 + PENDING,
13 + handleMaybeThenable
14 +} from './-internal';
15 +
16 +import then from './then';
17 +import Promise from './promise';
18 +import originalResolve from './promise/resolve';
19 +import originalThen from './then';
20 +import { makePromise, PROMISE_ID } from './-internal';
21 +
22 +function validationError() {
23 + return new Error('Array Methods must be provided an Array');
24 +};
25 +
26 +export default class Enumerator {
27 + constructor(Constructor, input) {
28 + this._instanceConstructor = Constructor;
29 + this.promise = new Constructor(noop);
30 +
31 + if (!this.promise[PROMISE_ID]) {
32 + makePromise(this.promise);
33 + }
34 +
35 + if (isArray(input)) {
36 + this.length = input.length;
37 + this._remaining = input.length;
38 +
39 + this._result = new Array(this.length);
40 +
41 + if (this.length === 0) {
42 + fulfill(this.promise, this._result);
43 + } else {
44 + this.length = this.length || 0;
45 + this._enumerate(input);
46 + if (this._remaining === 0) {
47 + fulfill(this.promise, this._result);
48 + }
49 + }
50 + } else {
51 + reject(this.promise, validationError());
52 + }
53 + }
54 + _enumerate(input) {
55 + for (let i = 0; this._state === PENDING && i < input.length; i++) {
56 + this._eachEntry(input[i], i);
57 + }
58 + }
59 +
60 + _eachEntry(entry, i) {
61 + let c = this._instanceConstructor;
62 + let { resolve } = c;
63 +
64 + if (resolve === originalResolve) {
65 + let then;
66 + let error;
67 + let didError = false;
68 + try {
69 + then = entry.then;
70 + } catch (e) {
71 + didError = true;
72 + error = e;
73 + }
74 +
75 + if (then === originalThen &&
76 + entry._state !== PENDING) {
77 + this._settledAt(entry._state, i, entry._result);
78 + } else if (typeof then !== 'function') {
79 + this._remaining--;
80 + this._result[i] = entry;
81 + } else if (c === Promise) {
82 + let promise = new c(noop);
83 + if (didError) {
84 + reject(promise, error);
85 + } else {
86 + handleMaybeThenable(promise, entry, then);
87 + }
88 + this._willSettleAt(promise, i);
89 + } else {
90 + this._willSettleAt(new c(resolve => resolve(entry)), i);
91 + }
92 + } else {
93 + this._willSettleAt(resolve(entry), i);
94 + }
95 + }
96 +
97 + _settledAt(state, i, value) {
98 + let { promise } = this;
99 +
100 + if (promise._state === PENDING) {
101 + this._remaining--;
102 +
103 + if (state === REJECTED) {
104 + reject(promise, value);
105 + } else {
106 + this._result[i] = value;
107 + }
108 + }
109 +
110 + if (this._remaining === 0) {
111 + fulfill(promise, this._result);
112 + }
113 + }
114 +
115 + _willSettleAt(promise, i) {
116 + let enumerator = this;
117 +
118 + subscribe(
119 + promise, undefined,
120 + value => enumerator._settledAt(FULFILLED, i, value),
121 + reason => enumerator._settledAt(REJECTED, i, reason)
122 + );
123 + }
124 +};
1 +/*global self*/
2 +import Promise from './promise';
3 +
4 +export default function polyfill() {
5 + let local;
6 +
7 + if (typeof global !== 'undefined') {
8 + local = global;
9 + } else if (typeof self !== 'undefined') {
10 + local = self;
11 + } else {
12 + try {
13 + local = Function('return this')();
14 + } catch (e) {
15 + throw new Error('polyfill failed because global object is unavailable in this environment');
16 + }
17 + }
18 +
19 + let P = local.Promise;
20 +
21 + if (P) {
22 + var promiseToString = null;
23 + try {
24 + promiseToString = Object.prototype.toString.call(P.resolve());
25 + } catch(e) {
26 + // silently ignored
27 + }
28 +
29 + if (promiseToString === '[object Promise]' && !P.cast){
30 + return;
31 + }
32 + }
33 +
34 + local.Promise = Promise;
35 +}
1 +import {
2 + isFunction
3 +} from './utils';
4 +import {
5 + noop,
6 + nextId,
7 + PROMISE_ID,
8 + initializePromise
9 +} from './-internal';
10 +import {
11 + asap,
12 + setAsap,
13 + setScheduler
14 +} from './asap';
15 +
16 +import all from './promise/all';
17 +import race from './promise/race';
18 +import Resolve from './promise/resolve';
19 +import Reject from './promise/reject';
20 +import then from './then';
21 +
22 +function needsResolver() {
23 + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
24 +}
25 +
26 +function needsNew() {
27 + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
28 +}
29 +
30 +/**
31 + Promise objects represent the eventual result of an asynchronous operation. The
32 + primary way of interacting with a promise is through its `then` method, which
33 + registers callbacks to receive either a promise's eventual value or the reason
34 + why the promise cannot be fulfilled.
35 +
36 + Terminology
37 + -----------
38 +
39 + - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
40 + - `thenable` is an object or function that defines a `then` method.
41 + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
42 + - `exception` is a value that is thrown using the throw statement.
43 + - `reason` is a value that indicates why a promise was rejected.
44 + - `settled` the final resting state of a promise, fulfilled or rejected.
45 +
46 + A promise can be in one of three states: pending, fulfilled, or rejected.
47 +
48 + Promises that are fulfilled have a fulfillment value and are in the fulfilled
49 + state. Promises that are rejected have a rejection reason and are in the
50 + rejected state. A fulfillment value is never a thenable.
51 +
52 + Promises can also be said to *resolve* a value. If this value is also a
53 + promise, then the original promise's settled state will match the value's
54 + settled state. So a promise that *resolves* a promise that rejects will
55 + itself reject, and a promise that *resolves* a promise that fulfills will
56 + itself fulfill.
57 +
58 +
59 + Basic Usage:
60 + ------------
61 +
62 + ```js
63 + let promise = new Promise(function(resolve, reject) {
64 + // on success
65 + resolve(value);
66 +
67 + // on failure
68 + reject(reason);
69 + });
70 +
71 + promise.then(function(value) {
72 + // on fulfillment
73 + }, function(reason) {
74 + // on rejection
75 + });
76 + ```
77 +
78 + Advanced Usage:
79 + ---------------
80 +
81 + Promises shine when abstracting away asynchronous interactions such as
82 + `XMLHttpRequest`s.
83 +
84 + ```js
85 + function getJSON(url) {
86 + return new Promise(function(resolve, reject){
87 + let xhr = new XMLHttpRequest();
88 +
89 + xhr.open('GET', url);
90 + xhr.onreadystatechange = handler;
91 + xhr.responseType = 'json';
92 + xhr.setRequestHeader('Accept', 'application/json');
93 + xhr.send();
94 +
95 + function handler() {
96 + if (this.readyState === this.DONE) {
97 + if (this.status === 200) {
98 + resolve(this.response);
99 + } else {
100 + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
101 + }
102 + }
103 + };
104 + });
105 + }
106 +
107 + getJSON('/posts.json').then(function(json) {
108 + // on fulfillment
109 + }, function(reason) {
110 + // on rejection
111 + });
112 + ```
113 +
114 + Unlike callbacks, promises are great composable primitives.
115 +
116 + ```js
117 + Promise.all([
118 + getJSON('/posts'),
119 + getJSON('/comments')
120 + ]).then(function(values){
121 + values[0] // => postsJSON
122 + values[1] // => commentsJSON
123 +
124 + return values;
125 + });
126 + ```
127 +
128 + @class Promise
129 + @param {Function} resolver
130 + Useful for tooling.
131 + @constructor
132 +*/
133 +
134 +class Promise {
135 + constructor(resolver) {
136 + this[PROMISE_ID] = nextId();
137 + this._result = this._state = undefined;
138 + this._subscribers = [];
139 +
140 + if (noop !== resolver) {
141 + typeof resolver !== 'function' && needsResolver();
142 + this instanceof Promise ? initializePromise(this, resolver) : needsNew();
143 + }
144 + }
145 +
146 + /**
147 + The primary way of interacting with a promise is through its `then` method,
148 + which registers callbacks to receive either a promise's eventual value or the
149 + reason why the promise cannot be fulfilled.
150 +
151 + ```js
152 + findUser().then(function(user){
153 + // user is available
154 + }, function(reason){
155 + // user is unavailable, and you are given the reason why
156 + });
157 + ```
158 +
159 + Chaining
160 + --------
161 +
162 + The return value of `then` is itself a promise. This second, 'downstream'
163 + promise is resolved with the return value of the first promise's fulfillment
164 + or rejection handler, or rejected if the handler throws an exception.
165 +
166 + ```js
167 + findUser().then(function (user) {
168 + return user.name;
169 + }, function (reason) {
170 + return 'default name';
171 + }).then(function (userName) {
172 + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
173 + // will be `'default name'`
174 + });
175 +
176 + findUser().then(function (user) {
177 + throw new Error('Found user, but still unhappy');
178 + }, function (reason) {
179 + throw new Error('`findUser` rejected and we're unhappy');
180 + }).then(function (value) {
181 + // never reached
182 + }, function (reason) {
183 + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
184 + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
185 + });
186 + ```
187 + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
188 +
189 + ```js
190 + findUser().then(function (user) {
191 + throw new PedagogicalException('Upstream error');
192 + }).then(function (value) {
193 + // never reached
194 + }).then(function (value) {
195 + // never reached
196 + }, function (reason) {
197 + // The `PedgagocialException` is propagated all the way down to here
198 + });
199 + ```
200 +
201 + Assimilation
202 + ------------
203 +
204 + Sometimes the value you want to propagate to a downstream promise can only be
205 + retrieved asynchronously. This can be achieved by returning a promise in the
206 + fulfillment or rejection handler. The downstream promise will then be pending
207 + until the returned promise is settled. This is called *assimilation*.
208 +
209 + ```js
210 + findUser().then(function (user) {
211 + return findCommentsByAuthor(user);
212 + }).then(function (comments) {
213 + // The user's comments are now available
214 + });
215 + ```
216 +
217 + If the assimliated promise rejects, then the downstream promise will also reject.
218 +
219 + ```js
220 + findUser().then(function (user) {
221 + return findCommentsByAuthor(user);
222 + }).then(function (comments) {
223 + // If `findCommentsByAuthor` fulfills, we'll have the value here
224 + }, function (reason) {
225 + // If `findCommentsByAuthor` rejects, we'll have the reason here
226 + });
227 + ```
228 +
229 + Simple Example
230 + --------------
231 +
232 + Synchronous Example
233 +
234 + ```javascript
235 + let result;
236 +
237 + try {
238 + result = findResult();
239 + // success
240 + } catch(reason) {
241 + // failure
242 + }
243 + ```
244 +
245 + Errback Example
246 +
247 + ```js
248 + findResult(function(result, err){
249 + if (err) {
250 + // failure
251 + } else {
252 + // success
253 + }
254 + });
255 + ```
256 +
257 + Promise Example;
258 +
259 + ```javascript
260 + findResult().then(function(result){
261 + // success
262 + }, function(reason){
263 + // failure
264 + });
265 + ```
266 +
267 + Advanced Example
268 + --------------
269 +
270 + Synchronous Example
271 +
272 + ```javascript
273 + let author, books;
274 +
275 + try {
276 + author = findAuthor();
277 + books = findBooksByAuthor(author);
278 + // success
279 + } catch(reason) {
280 + // failure
281 + }
282 + ```
283 +
284 + Errback Example
285 +
286 + ```js
287 +
288 + function foundBooks(books) {
289 +
290 + }
291 +
292 + function failure(reason) {
293 +
294 + }
295 +
296 + findAuthor(function(author, err){
297 + if (err) {
298 + failure(err);
299 + // failure
300 + } else {
301 + try {
302 + findBoooksByAuthor(author, function(books, err) {
303 + if (err) {
304 + failure(err);
305 + } else {
306 + try {
307 + foundBooks(books);
308 + } catch(reason) {
309 + failure(reason);
310 + }
311 + }
312 + });
313 + } catch(error) {
314 + failure(err);
315 + }
316 + // success
317 + }
318 + });
319 + ```
320 +
321 + Promise Example;
322 +
323 + ```javascript
324 + findAuthor().
325 + then(findBooksByAuthor).
326 + then(function(books){
327 + // found books
328 + }).catch(function(reason){
329 + // something went wrong
330 + });
331 + ```
332 +
333 + @method then
334 + @param {Function} onFulfilled
335 + @param {Function} onRejected
336 + Useful for tooling.
337 + @return {Promise}
338 + */
339 +
340 + /**
341 + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
342 + as the catch block of a try/catch statement.
343 +
344 + ```js
345 + function findAuthor(){
346 + throw new Error('couldn't find that author');
347 + }
348 +
349 + // synchronous
350 + try {
351 + findAuthor();
352 + } catch(reason) {
353 + // something went wrong
354 + }
355 +
356 + // async with promises
357 + findAuthor().catch(function(reason){
358 + // something went wrong
359 + });
360 + ```
361 +
362 + @method catch
363 + @param {Function} onRejection
364 + Useful for tooling.
365 + @return {Promise}
366 + */
367 + catch(onRejection) {
368 + return this.then(null, onRejection);
369 + }
370 +
371 +/**
372 + `finally` will be invoked regardless of the promise's fate just as native
373 + try/catch/finally behaves
374 +
375 + Synchronous example:
376 +
377 + ```js
378 + findAuthor() {
379 + if (Math.random() > 0.5) {
380 + throw new Error();
381 + }
382 + return new Author();
383 + }
384 +
385 + try {
386 + return findAuthor(); // succeed or fail
387 + } catch(error) {
388 + return findOtherAuther();
389 + } finally {
390 + // always runs
391 + // doesn't affect the return value
392 + }
393 + ```
394 +
395 + Asynchronous example:
396 +
397 + ```js
398 + findAuthor().catch(function(reason){
399 + return findOtherAuther();
400 + }).finally(function(){
401 + // author was either found, or not
402 + });
403 + ```
404 +
405 + @method finally
406 + @param {Function} callback
407 + @return {Promise}
408 +*/
409 + finally(callback) {
410 + let promise = this;
411 + let constructor = promise.constructor;
412 +
413 + if ( isFunction(callback) ) {
414 + return promise.then(value => constructor.resolve(callback()).then(() => value),
415 + reason => constructor.resolve(callback()).then(() => { throw reason; }));
416 + }
417 +
418 + return promise.then(callback, callback);
419 + }
420 +}
421 +
422 +Promise.prototype.then = then;
423 +export default Promise;
424 +Promise.all = all;
425 +Promise.race = race;
426 +Promise.resolve = Resolve;
427 +Promise.reject = Reject;
428 +Promise._setScheduler = setScheduler;
429 +Promise._setAsap = setAsap;
430 +Promise._asap = asap;
431 +
1 +import Enumerator from '../enumerator';
2 +
3 +/**
4 + `Promise.all` accepts an array of promises, and returns a new promise which
5 + is fulfilled with an array of fulfillment values for the passed promises, or
6 + rejected with the reason of the first passed promise to be rejected. It casts all
7 + elements of the passed iterable to promises as it runs this algorithm.
8 +
9 + Example:
10 +
11 + ```javascript
12 + let promise1 = resolve(1);
13 + let promise2 = resolve(2);
14 + let promise3 = resolve(3);
15 + let promises = [ promise1, promise2, promise3 ];
16 +
17 + Promise.all(promises).then(function(array){
18 + // The array here would be [ 1, 2, 3 ];
19 + });
20 + ```
21 +
22 + If any of the `promises` given to `all` are rejected, the first promise
23 + that is rejected will be given as an argument to the returned promises's
24 + rejection handler. For example:
25 +
26 + Example:
27 +
28 + ```javascript
29 + let promise1 = resolve(1);
30 + let promise2 = reject(new Error("2"));
31 + let promise3 = reject(new Error("3"));
32 + let promises = [ promise1, promise2, promise3 ];
33 +
34 + Promise.all(promises).then(function(array){
35 + // Code here never runs because there are rejected promises!
36 + }, function(error) {
37 + // error.message === "2"
38 + });
39 + ```
40 +
41 + @method all
42 + @static
43 + @param {Array} entries array of promises
44 + @param {String} label optional string for labeling the promise.
45 + Useful for tooling.
46 + @return {Promise} promise that is fulfilled when all `promises` have been
47 + fulfilled, or rejected if any of them become rejected.
48 + @static
49 +*/
50 +export default function all(entries) {
51 + return new Enumerator(this, entries).promise;
52 +}
1 +import {
2 + isArray
3 +} from "../utils";
4 +
5 +/**
6 + `Promise.race` returns a new promise which is settled in the same way as the
7 + first passed promise to settle.
8 +
9 + Example:
10 +
11 + ```javascript
12 + let promise1 = new Promise(function(resolve, reject){
13 + setTimeout(function(){
14 + resolve('promise 1');
15 + }, 200);
16 + });
17 +
18 + let promise2 = new Promise(function(resolve, reject){
19 + setTimeout(function(){
20 + resolve('promise 2');
21 + }, 100);
22 + });
23 +
24 + Promise.race([promise1, promise2]).then(function(result){
25 + // result === 'promise 2' because it was resolved before promise1
26 + // was resolved.
27 + });
28 + ```
29 +
30 + `Promise.race` is deterministic in that only the state of the first
31 + settled promise matters. For example, even if other promises given to the
32 + `promises` array argument are resolved, but the first settled promise has
33 + become rejected before the other promises became fulfilled, the returned
34 + promise will become rejected:
35 +
36 + ```javascript
37 + let promise1 = new Promise(function(resolve, reject){
38 + setTimeout(function(){
39 + resolve('promise 1');
40 + }, 200);
41 + });
42 +
43 + let promise2 = new Promise(function(resolve, reject){
44 + setTimeout(function(){
45 + reject(new Error('promise 2'));
46 + }, 100);
47 + });
48 +
49 + Promise.race([promise1, promise2]).then(function(result){
50 + // Code here never runs
51 + }, function(reason){
52 + // reason.message === 'promise 2' because promise 2 became rejected before
53 + // promise 1 became fulfilled
54 + });
55 + ```
56 +
57 + An example real-world use case is implementing timeouts:
58 +
59 + ```javascript
60 + Promise.race([ajax('foo.json'), timeout(5000)])
61 + ```
62 +
63 + @method race
64 + @static
65 + @param {Array} promises array of promises to observe
66 + Useful for tooling.
67 + @return {Promise} a promise which settles in the same way as the first passed
68 + promise to settle.
69 +*/
70 +export default function race(entries) {
71 + /*jshint validthis:true */
72 + let Constructor = this;
73 +
74 + if (!isArray(entries)) {
75 + return new Constructor((_, reject) => reject(new TypeError('You must pass an array to race.')));
76 + } else {
77 + return new Constructor((resolve, reject) => {
78 + let length = entries.length;
79 + for (let i = 0; i < length; i++) {
80 + Constructor.resolve(entries[i]).then(resolve, reject);
81 + }
82 + });
83 + }
84 +}
1 +import {
2 + noop,
3 + reject as _reject
4 +} from '../-internal';
5 +
6 +/**
7 + `Promise.reject` returns a promise rejected with the passed `reason`.
8 + It is shorthand for the following:
9 +
10 + ```javascript
11 + let promise = new Promise(function(resolve, reject){
12 + reject(new Error('WHOOPS'));
13 + });
14 +
15 + promise.then(function(value){
16 + // Code here doesn't run because the promise is rejected!
17 + }, function(reason){
18 + // reason.message === 'WHOOPS'
19 + });
20 + ```
21 +
22 + Instead of writing the above, your code now simply becomes the following:
23 +
24 + ```javascript
25 + let promise = Promise.reject(new Error('WHOOPS'));
26 +
27 + promise.then(function(value){
28 + // Code here doesn't run because the promise is rejected!
29 + }, function(reason){
30 + // reason.message === 'WHOOPS'
31 + });
32 + ```
33 +
34 + @method reject
35 + @static
36 + @param {Any} reason value that the returned promise will be rejected with.
37 + Useful for tooling.
38 + @return {Promise} a promise rejected with the given `reason`.
39 +*/
40 +export default function reject(reason) {
41 + /*jshint validthis:true */
42 + let Constructor = this;
43 + let promise = new Constructor(noop);
44 + _reject(promise, reason);
45 + return promise;
46 +}
1 +import {
2 + noop,
3 + resolve as _resolve
4 +} from '../-internal';
5 +
6 +/**
7 + `Promise.resolve` returns a promise that will become resolved with the
8 + passed `value`. It is shorthand for the following:
9 +
10 + ```javascript
11 + let promise = new Promise(function(resolve, reject){
12 + resolve(1);
13 + });
14 +
15 + promise.then(function(value){
16 + // value === 1
17 + });
18 + ```
19 +
20 + Instead of writing the above, your code now simply becomes the following:
21 +
22 + ```javascript
23 + let promise = Promise.resolve(1);
24 +
25 + promise.then(function(value){
26 + // value === 1
27 + });
28 + ```
29 +
30 + @method resolve
31 + @static
32 + @param {Any} value value that the returned promise will be resolved with
33 + Useful for tooling.
34 + @return {Promise} a promise that will become fulfilled with the given
35 + `value`
36 +*/
37 +export default function resolve(object) {
38 + /*jshint validthis:true */
39 + let Constructor = this;
40 +
41 + if (object && typeof object === 'object' && object.constructor === Constructor) {
42 + return object;
43 + }
44 +
45 + let promise = new Constructor(noop);
46 + _resolve(promise, object);
47 + return promise;
48 +}
1 +import {
2 + invokeCallback,
3 + subscribe,
4 + FULFILLED,
5 + REJECTED,
6 + noop,
7 + makePromise,
8 + PROMISE_ID
9 +} from './-internal';
10 +
11 +import { asap } from './asap';
12 +
13 +export default function then(onFulfillment, onRejection) {
14 + const parent = this;
15 +
16 + const child = new this.constructor(noop);
17 +
18 + if (child[PROMISE_ID] === undefined) {
19 + makePromise(child);
20 + }
21 +
22 + const { _state } = parent;
23 +
24 + if (_state) {
25 + const callback = arguments[_state - 1];
26 + asap(() => invokeCallback(_state, child, callback, parent._result));
27 + } else {
28 + subscribe(parent, child, onFulfillment, onRejection);
29 + }
30 +
31 + return child;
32 +}
1 +export function objectOrFunction(x) {
2 + let type = typeof x;
3 + return x !== null && (type === 'object' || type === 'function');
4 +}
5 +
6 +export function isFunction(x) {
7 + return typeof x === 'function';
8 +}
9 +
10 +export function isMaybeThenable(x) {
11 + return x !== null && typeof x === 'object';
12 +}
13 +
14 +let _isArray;
15 +if (Array.isArray) {
16 + _isArray = Array.isArray;
17 +} else {
18 + _isArray = x => Object.prototype.toString.call(x) === '[object Array]';
19 +}
20 +
21 +export const isArray = _isArray;
1 +{
2 + "_from": "es6-promise@^4.0.3",
3 + "_id": "es6-promise@4.2.8",
4 + "_inBundle": false,
5 + "_integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
6 + "_location": "/es6-promise",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "es6-promise@^4.0.3",
12 + "name": "es6-promise",
13 + "escapedName": "es6-promise",
14 + "rawSpec": "^4.0.3",
15 + "saveSpec": null,
16 + "fetchSpec": "^4.0.3"
17 + },
18 + "_requiredBy": [
19 + "/es6-promisify"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
22 + "_shasum": "4eb21594c972bc40553d276e510539143db53e0a",
23 + "_spec": "es6-promise@^4.0.3",
24 + "_where": "C:\\Users\\LG\\Desktop\\4-1\\Reminder-Talk\\node_modules\\es6-promisify",
25 + "author": {
26 + "name": "Yehuda Katz, Tom Dale, Stefan Penner and contributors",
27 + "url": "Conversion to ES6 API by Jake Archibald"
28 + },
29 + "browser": {
30 + "vertx": false
31 + },
32 + "bugs": {
33 + "url": "https://github.com/stefanpenner/es6-promise/issues"
34 + },
35 + "bundleDependencies": false,
36 + "dependencies": {},
37 + "deprecated": false,
38 + "description": "A lightweight library that provides tools for organizing asynchronous code",
39 + "devDependencies": {
40 + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
41 + "babel-plugin-transform-es2015-block-scoping": "^6.24.1",
42 + "babel-plugin-transform-es2015-classes": "^6.24.1",
43 + "babel-plugin-transform-es2015-computed-properties": "^6.24.1",
44 + "babel-plugin-transform-es2015-constants": "^6.1.4",
45 + "babel-plugin-transform-es2015-destructuring": "^6.23.0",
46 + "babel-plugin-transform-es2015-parameters": "^6.24.1",
47 + "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
48 + "babel-plugin-transform-es2015-spread": "^6.22.0",
49 + "babel-plugin-transform-es2015-template-literals": "^6.22.0",
50 + "babel6-plugin-strip-class-callcheck": "^6.0.0",
51 + "broccoli-babel-transpiler": "^6.0.0",
52 + "broccoli-concat": "^3.1.0",
53 + "broccoli-merge-trees": "^2.0.0",
54 + "broccoli-rollup": "^2.0.0",
55 + "broccoli-stew": "^1.5.0",
56 + "broccoli-uglify-js": "^0.2.0",
57 + "broccoli-watchify": "^1.0.1",
58 + "ember-cli": "2.18.0-beta.2",
59 + "ember-cli-dependency-checker": "^2.1.0",
60 + "git-repo-version": "1.0.1",
61 + "json3": "^3.3.2",
62 + "mocha": "^4.0.1",
63 + "promises-aplus-tests-phantom": "^2.1.0-revise"
64 + },
65 + "directories": {
66 + "lib": "lib"
67 + },
68 + "files": [
69 + "dist",
70 + "lib",
71 + "es6-promise.d.ts",
72 + "auto.js",
73 + "!dist/test"
74 + ],
75 + "homepage": "https://github.com/stefanpenner/es6-promise",
76 + "jsdelivr": "dist/es6-promise.auto.min.js",
77 + "keywords": [
78 + "futures",
79 + "polyfill",
80 + "promise",
81 + "promises"
82 + ],
83 + "license": "MIT",
84 + "main": "dist/es6-promise.js",
85 + "name": "es6-promise",
86 + "namespace": "es6-promise",
87 + "repository": {
88 + "type": "git",
89 + "url": "git://github.com/stefanpenner/es6-promise.git"
90 + },
91 + "scripts": {
92 + "build": "ember build --environment production",
93 + "prepublishOnly": "ember build --environment production",
94 + "start": "ember s",
95 + "test": "ember test",
96 + "test:browser": "ember test --launch PhantomJS",
97 + "test:node": "ember test --launch Mocha",
98 + "test:server": "ember test --server"
99 + },
100 + "spm": {
101 + "main": "dist/es6-promise.js"
102 + },
103 + "typings": "es6-promise.d.ts",
104 + "unpkg": "dist/es6-promise.auto.min.js",
105 + "version": "4.2.8"
106 +}
1 +[![Travis CI](https://travis-ci.org/digitaldesignlabs/es6-promisify.svg)](https://travis-ci.org/digitaldesignlabs/es6-promisify)
2 +
3 +# es6-promisify
4 +
5 +Converts callback-based functions to Promise-based functions.
6 +
7 +## Install
8 +
9 +Install with [npm](https://npmjs.org/package/es6-promisify)
10 +
11 +```bash
12 +npm install --save es6-promisify
13 +```
14 +
15 +## Example
16 +
17 +```js
18 +"use strict";
19 +
20 +// Declare variables
21 +const promisify = require("es6-promisify");
22 +const fs = require("fs");
23 +
24 +// Convert the stat function
25 +const stat = promisify(fs.stat);
26 +
27 +// Now usable as a promise!
28 +stat("example.txt").then(function (stats) {
29 + console.log("Got stats", stats);
30 +}).catch(function (err) {
31 + console.error("Yikes!", err);
32 +});
33 +```
34 +
35 +## Promisify methods
36 +```js
37 +"use strict";
38 +
39 +// Declare variables
40 +const promisify = require("es6-promisify");
41 +const redis = require("redis").createClient(6379, "localhost");
42 +
43 +// Create a promise-based version of send_command
44 +const client = promisify(redis.send_command, redis);
45 +
46 +// Send commands to redis and get a promise back
47 +client("ping").then(function (pong) {
48 + console.log("Got", pong);
49 +}).catch(function (err) {
50 + console.error("Unexpected error", err);
51 +}).then(function () {
52 + redis.quit();
53 +});
54 +```
55 +
56 +## Handle callback multiple arguments
57 +```js
58 +"use strict";
59 +
60 +// Declare functions
61 +function test(cb) {
62 + return cb(undefined, 1, 2, 3);
63 +}
64 +
65 +// Declare variables
66 +const promisify = require("es6-promisify");
67 +
68 +// Create promise-based version of test
69 +const single = promisify(test);
70 +const multi = promisify(test, {multiArgs: true});
71 +
72 +// Discards additional arguments
73 +single().then(function (result) {
74 + console.log(result); // 1
75 +});
76 +
77 +// Returns all arguments as an array
78 +multi().then(function (result) {
79 + console.log(result); // [1, 2, 3]
80 +});
81 +```
82 +
83 +### Tests
84 +Test with nodeunit
85 +```bash
86 +$ npm test
87 +```
88 +
89 +Published under the [MIT License](http://opensource.org/licenses/MIT).
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.