new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/retryWhen';
|
||||
@@ -0,0 +1,263 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** fixed automated release pipeline ([1fe9135](https://www.github.com/yargs/yargs-parser/commit/1fe9135884790a083615419b2861683e2597dac3))
|
||||
|
||||
### [20.2.8](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.7...yargs-parser-v20.2.8) (2021-06-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **locale:** Turkish camelize and decamelize issues with toLocaleLowerCase/toLocaleUpperCase ([2617303](https://www.github.com/yargs/yargs-parser/commit/261730383e02448562f737b94bbd1f164aed5143))
|
||||
* **perf:** address slow parse when using unknown-options-as-args ([#394](https://www.github.com/yargs/yargs-parser/issues/394)) ([441f059](https://www.github.com/yargs/yargs-parser/commit/441f059d585d446551068ad213db79ac91daf83a))
|
||||
* **string-utils:** detect [0,1] ranged values as numbers ([#388](https://www.github.com/yargs/yargs-parser/issues/388)) ([efcc32c](https://www.github.com/yargs/yargs-parser/commit/efcc32c2d6b09aba31abfa2db9bd947befe5586b))
|
||||
|
||||
### [20.2.7](https://www.github.com/yargs/yargs-parser/compare/v20.2.6...v20.2.7) (2021-03-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** force release for Deno ([6687c97](https://www.github.com/yargs/yargs-parser/commit/6687c972d0f3ca7865a97908dde3080b05f8b026))
|
||||
|
||||
### [20.2.6](https://www.github.com/yargs/yargs-parser/compare/v20.2.5...v20.2.6) (2021-02-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **populate--:** -- should always be array ([#354](https://www.github.com/yargs/yargs-parser/issues/354)) ([585ae8f](https://www.github.com/yargs/yargs-parser/commit/585ae8ffad74cc02974f92d788e750137fd65146))
|
||||
|
||||
### [20.2.5](https://www.github.com/yargs/yargs-parser/compare/v20.2.4...v20.2.5) (2021-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not lowercase camel cased string ([#348](https://www.github.com/yargs/yargs-parser/issues/348)) ([5f4da1f](https://www.github.com/yargs/yargs-parser/commit/5f4da1f17d9d50542d2aaa206c9806ce3e320335))
|
||||
|
||||
### [20.2.4](https://www.github.com/yargs/yargs-parser/compare/v20.2.3...v20.2.4) (2020-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** address import issues in Deno ([#339](https://www.github.com/yargs/yargs-parser/issues/339)) ([3b54e5e](https://www.github.com/yargs/yargs-parser/commit/3b54e5eef6e9a7b7c6eec7c12bab3ba3b8ba8306))
|
||||
|
||||
### [20.2.3](https://www.github.com/yargs/yargs-parser/compare/v20.2.2...v20.2.3) (2020-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#336](https://www.github.com/yargs/yargs-parser/issues/336)) ([3ae7242](https://www.github.com/yargs/yargs-parser/commit/3ae7242040ff876d28dabded60ac226e00150c88))
|
||||
|
||||
### [20.2.2](https://www.github.com/yargs/yargs-parser/compare/v20.2.1...v20.2.2) (2020-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0-13.6 require a string fallback ([#333](https://www.github.com/yargs/yargs-parser/issues/333)) ([291aeda](https://www.github.com/yargs/yargs-parser/commit/291aeda06b685b7a015d83bdf2558e180b37388d))
|
||||
|
||||
### [20.2.1](https://www.github.com/yargs/yargs-parser/compare/v20.2.0...v20.2.1) (2020-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** update types for deno ^1.4.0 ([#330](https://www.github.com/yargs/yargs-parser/issues/330)) ([0ab92e5](https://www.github.com/yargs/yargs-parser/commit/0ab92e50b090f11196334c048c9c92cecaddaf56))
|
||||
|
||||
## [20.2.0](https://www.github.com/yargs/yargs-parser/compare/v20.1.0...v20.2.0) (2020-09-21)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **string-utils:** export looksLikeNumber helper ([#324](https://www.github.com/yargs/yargs-parser/issues/324)) ([c8580a2](https://www.github.com/yargs/yargs-parser/commit/c8580a2327b55f6342acecb6e72b62963d506750))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **unknown-options-as-args:** convert positionals that look like numbers ([#326](https://www.github.com/yargs/yargs-parser/issues/326)) ([f85ebb4](https://www.github.com/yargs/yargs-parser/commit/f85ebb4face9d4b0f56147659404cbe0002f3dad))
|
||||
|
||||
## [20.1.0](https://www.github.com/yargs/yargs-parser/compare/v20.0.0...v20.1.0) (2020-09-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* adds parse-positional-numbers configuration ([#321](https://www.github.com/yargs/yargs-parser/issues/321)) ([9cec00a](https://www.github.com/yargs/yargs-parser/commit/9cec00a622251292ffb7dce6f78f5353afaa0d4c))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** update release-please; make labels kick off builds ([#323](https://www.github.com/yargs/yargs-parser/issues/323)) ([09f448b](https://www.github.com/yargs/yargs-parser/commit/09f448b4cd66e25d2872544718df46dab8af062a))
|
||||
|
||||
## [20.0.0](https://www.github.com/yargs/yargs-parser/compare/v19.0.4...v20.0.0) (2020-09-09)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* do not ship type definitions (#318)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* only strip camel case if hyphenated ([#316](https://www.github.com/yargs/yargs-parser/issues/316)) ([95a9e78](https://www.github.com/yargs/yargs-parser/commit/95a9e785127b9bbf2d1db1f1f808ca1fb100e82a)), closes [#315](https://www.github.com/yargs/yargs-parser/issues/315)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* do not ship type definitions ([#318](https://www.github.com/yargs/yargs-parser/issues/318)) ([8fbd56f](https://www.github.com/yargs/yargs-parser/commit/8fbd56f1d0b6c44c30fca62708812151ca0ce330))
|
||||
|
||||
### [19.0.4](https://www.github.com/yargs/yargs-parser/compare/v19.0.3...v19.0.4) (2020-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** fixing publication ([#310](https://www.github.com/yargs/yargs-parser/issues/310)) ([5d3c6c2](https://www.github.com/yargs/yargs-parser/commit/5d3c6c29a9126248ba601920d9cf87c78e161ff5))
|
||||
|
||||
### [19.0.3](https://www.github.com/yargs/yargs-parser/compare/v19.0.2...v19.0.3) (2020-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** switch to action for publish ([#308](https://www.github.com/yargs/yargs-parser/issues/308)) ([5c2f305](https://www.github.com/yargs/yargs-parser/commit/5c2f30585342bcd8aaf926407c863099d256d174))
|
||||
|
||||
### [19.0.2](https://www.github.com/yargs/yargs-parser/compare/v19.0.1...v19.0.2) (2020-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **types:** envPrefix should be optional ([#305](https://www.github.com/yargs/yargs-parser/issues/305)) ([ae3f180](https://www.github.com/yargs/yargs-parser/commit/ae3f180e14df2de2fd962145f4518f9aa0e76523))
|
||||
|
||||
### [19.0.1](https://www.github.com/yargs/yargs-parser/compare/v19.0.0...v19.0.1) (2020-08-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** push tag created for deno ([2186a14](https://www.github.com/yargs/yargs-parser/commit/2186a14989749887d56189867602e39e6679f8b0))
|
||||
|
||||
## [19.0.0](https://www.github.com/yargs/yargs-parser/compare/v18.1.3...v19.0.0) (2020-08-09)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* adds support for ESM and Deno (#295)
|
||||
* **ts:** projects using `@types/yargs-parser` may see variations in type definitions.
|
||||
* drops Node 6. begin following Node.js LTS schedule (#278)
|
||||
|
||||
### Features
|
||||
|
||||
* adds support for ESM and Deno ([#295](https://www.github.com/yargs/yargs-parser/issues/295)) ([195bc4a](https://www.github.com/yargs/yargs-parser/commit/195bc4a7f20c2a8f8e33fbb6ba96ef6e9a0120a1))
|
||||
* expose camelCase and decamelize helpers ([#296](https://www.github.com/yargs/yargs-parser/issues/296)) ([39154ce](https://www.github.com/yargs/yargs-parser/commit/39154ceb5bdcf76b5f59a9219b34cedb79b67f26))
|
||||
* **deps:** update to latest camelcase/decamelize ([#281](https://www.github.com/yargs/yargs-parser/issues/281)) ([8931ab0](https://www.github.com/yargs/yargs-parser/commit/8931ab08f686cc55286f33a95a83537da2be5516))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* boolean numeric short option ([#294](https://www.github.com/yargs/yargs-parser/issues/294)) ([f600082](https://www.github.com/yargs/yargs-parser/commit/f600082c959e092076caf420bbbc9d7a231e2418))
|
||||
* raise permission error for Deno if config load fails ([#298](https://www.github.com/yargs/yargs-parser/issues/298)) ([1174e2b](https://www.github.com/yargs/yargs-parser/commit/1174e2b3f0c845a1cd64e14ffc3703e730567a84))
|
||||
* **deps:** update dependency decamelize to v3 ([#274](https://www.github.com/yargs/yargs-parser/issues/274)) ([4d98698](https://www.github.com/yargs/yargs-parser/commit/4d98698bc6767e84ec54a0842908191739be73b7))
|
||||
* **types:** switch back to using Partial types ([#293](https://www.github.com/yargs/yargs-parser/issues/293)) ([bdc80ba](https://www.github.com/yargs/yargs-parser/commit/bdc80ba59fa13bc3025ce0a85e8bad9f9da24ea7))
|
||||
|
||||
|
||||
### Build System
|
||||
|
||||
* drops Node 6. begin following Node.js LTS schedule ([#278](https://www.github.com/yargs/yargs-parser/issues/278)) ([9014ed7](https://www.github.com/yargs/yargs-parser/commit/9014ed722a32768b96b829e65a31705db5c1458a))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* **ts:** move index.js to TypeScript ([#292](https://www.github.com/yargs/yargs-parser/issues/292)) ([f78d2b9](https://www.github.com/yargs/yargs-parser/commit/f78d2b97567ac4828624406e420b4047c710b789))
|
||||
|
||||
### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e))
|
||||
|
||||
### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13))
|
||||
|
||||
### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential
|
||||
prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))
|
||||
|
||||
## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f))
|
||||
|
||||
## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* the narg count is now enforced when parsing arrays.
|
||||
|
||||
### Features
|
||||
|
||||
* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c))
|
||||
|
||||
## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb))
|
||||
|
||||
### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba))
|
||||
|
||||
## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* this reverts parsing behavior of booleans to that of yargs@14
|
||||
* objects used during parsing are now created with a null
|
||||
prototype. There may be some scenarios where this change in behavior
|
||||
leaks externally.
|
||||
|
||||
### Features
|
||||
|
||||
* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5))
|
||||
* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346))
|
||||
* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c))
|
||||
* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de))
|
||||
* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5))
|
||||
|
||||
## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* populate error if incompatible narg/count or array/count options are used (#191)
|
||||
|
||||
### Features
|
||||
|
||||
* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0))
|
||||
* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf))
|
||||
@@ -0,0 +1,108 @@
|
||||
const nock = require('nock');
|
||||
|
||||
const interceptAuthentication = ({ api = 'https://api.github.com', username = 'john' } = {}) =>
|
||||
nock(api).get('/user').reply(200, {
|
||||
login: username
|
||||
});
|
||||
|
||||
const interceptCollaborator = ({
|
||||
api = 'https://api.github.com',
|
||||
owner = 'user',
|
||||
project = 'repo',
|
||||
username = 'john'
|
||||
} = {}) => nock(api).get(`/repos/${owner}/${project}/collaborators/${username}`).reply(204);
|
||||
|
||||
const interceptListReleases = ({
|
||||
host = 'github.com',
|
||||
api = 'https://api.github.com',
|
||||
owner = 'user',
|
||||
project = 'repo',
|
||||
tag_name
|
||||
} = {}) =>
|
||||
nock(api)
|
||||
.get(`/repos/${owner}/${project}/releases?per_page=1&page=1`)
|
||||
.reply(200, [
|
||||
{
|
||||
id: 1,
|
||||
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/1/assets{?name,label}`,
|
||||
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`
|
||||
}
|
||||
]);
|
||||
|
||||
const interceptCreate = ({
|
||||
api = 'https://api.github.com',
|
||||
host = 'github.com',
|
||||
owner = 'user',
|
||||
project = 'repo',
|
||||
body: { tag_name, name = '', body = null, prerelease = false, draft = false }
|
||||
} = {}) =>
|
||||
nock(api)
|
||||
.post(`/repos/${owner}/${project}/releases`, { tag_name, name, body, prerelease, draft })
|
||||
.reply(() => {
|
||||
const id = 1;
|
||||
const responseBody = {
|
||||
id,
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
prerelease,
|
||||
draft,
|
||||
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/${id}/assets{?name,label}`,
|
||||
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`
|
||||
};
|
||||
return [200, responseBody, { location: `${api}/repos/${owner}/${project}/releases/${id}` }];
|
||||
});
|
||||
|
||||
const interceptUpdate = ({
|
||||
host = 'github.com',
|
||||
api = 'https://api.github.com',
|
||||
owner = 'user',
|
||||
project = 'repo',
|
||||
body: { tag_name, name = '', body = null, prerelease = false, draft = false }
|
||||
} = {}) =>
|
||||
nock(api)
|
||||
.patch(`/repos/${owner}/${project}/releases/1`, { tag_name, name, body, draft, prerelease })
|
||||
.reply(200, {
|
||||
id: 1,
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
prerelease,
|
||||
draft,
|
||||
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/1/assets{?name,label}`,
|
||||
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`
|
||||
});
|
||||
|
||||
const interceptAsset = ({
|
||||
api = 'https://api.github.com',
|
||||
host = 'github.com',
|
||||
owner = 'user',
|
||||
project = 'repo',
|
||||
tagName,
|
||||
body = {}
|
||||
} = {}) =>
|
||||
nock(`https://uploads.${host}`)
|
||||
.post(`/repos/${owner}/${project}/releases/1/assets`, body)
|
||||
.query(true)
|
||||
.reply(200, function () {
|
||||
const id = 1;
|
||||
const [, name] = this.req.path.match(/\?name=([^&]+)/);
|
||||
return {
|
||||
id,
|
||||
url: `${api}/repos/${owner}/${project}/releases/assets/${id}`,
|
||||
name,
|
||||
label: '',
|
||||
state: 'uploaded',
|
||||
size: this.req.headers['content-length'],
|
||||
browser_download_url: `https://${host}/${owner}/${project}/releases/download/${tagName}/${name}`
|
||||
};
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
interceptAuthentication,
|
||||
interceptCollaborator,
|
||||
interceptListReleases,
|
||||
interceptCreate,
|
||||
interceptUpdate,
|
||||
interceptAsset
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"find.js","sources":["../src/operators/find.ts"],"names":[],"mappings":";;;;;AAAA,gDAA2C"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"windowToggle.js","sources":["../../src/add/operator/windowToggle.ts"],"names":[],"mappings":";;AAAA,iDAA+C"}
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
const PassThrough = require('stream').PassThrough;
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const cloneResponse = response => {
|
||||
if (!(response && response.pipe)) {
|
||||
throw new TypeError('Parameter `response` must be a response stream.');
|
||||
}
|
||||
|
||||
const clone = new PassThrough();
|
||||
mimicResponse(response, clone);
|
||||
|
||||
return response.pipe(clone);
|
||||
};
|
||||
|
||||
module.exports = cloneResponse;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"G A B","2":"J E F BC"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"0 1 2 3 4 5 6 7 8 9 H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC tB I u J E F G A B C K L DC EC"},D:{"1":"6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 I u J E F G A B C K L H M N O v w x y z"},E:{"1":"B C K L H 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G A GC zB HC IC JC KC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d rB","2":"G B H M OC PC QC RC qB 9B SC","16":"C"},G:{"1":"bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC aC"},H:{"2":"nC"},I:{"1":"D sC tC","2":"tB I oC pC qC rC AC"},J:{"2":"E A"},K:{"1":"e rB","2":"A B qB 9B","16":"C"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:5,C:"KeyboardEvent.getModifierState()"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"first.js","sources":["../../src/add/operator/first.ts"],"names":[],"mappings":";;AAAA,0CAAwC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.01482,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.01976,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.02965,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00988,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.09882,"103":0.00494,"104":0.00494,"105":0,"106":0,"107":0.01482,"108":0.62751,"109":0.34587,"110":0,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00988,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.10376,"77":0.00494,"78":0,"79":0.00494,"80":0,"81":0,"83":0,"84":0.00988,"85":0,"86":0.00494,"87":0.00494,"88":0.00988,"89":0.00494,"90":0,"91":0.01482,"92":0.00494,"93":0.02471,"94":0.00494,"95":0.00494,"96":0.01976,"97":0,"98":0.00988,"99":0.00494,"100":0.00494,"101":0.01482,"102":0.00494,"103":0.07412,"104":0.00494,"105":0.01976,"106":0.05929,"107":0.19764,"108":5.08429,"109":4.58031,"110":0,"111":0,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0.00494,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0.00494,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.23717,"94":0.1087,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00494,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.02471,"104":0,"105":0,"106":0.00494,"107":0.084,"108":1.99616,"109":1.74417},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00988,"13":0.00494,"14":0.11364,"15":0.01482,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.05435,"12.1":0.01482,"13.1":0.25693,"14.1":0.3014,"15.1":0.05435,"15.2-15.3":0.00988,"15.4":0.09882,"15.5":0.29152,"15.6":3.47846,"16.0":0.20258,"16.1":0.27176,"16.2":1.72935,"16.3":0.11858},G:{"8":0.01673,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.01115,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.29552,"10.0-10.2":0,"10.3":0.61334,"11.0-11.2":0.10594,"11.3-11.4":0.00558,"12.0-12.1":0.0223,"12.2-12.5":1.43857,"13.0-13.1":0,"13.2":0,"13.3":0.02788,"13.4-13.7":0.06133,"14.0-14.4":1.41626,"14.5-14.8":1.91809,"15.0-15.1":0.36243,"15.2-15.3":0.21188,"15.4":0.41819,"15.5":0.93674,"15.6":9.41203,"16.0":6.22264,"16.1":17.61967,"16.2":10.60526,"16.3":0.94789},P:{"4":0.0107,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0.0321,"14.0":0,"15.0":0,"16.0":0,"17.0":0.0321,"18.0":0.0321,"19.0":3.60629},I:{"0":0,"3":0,"4":0.02335,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.30817},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.22235,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.92074},Q:{"13.1":0},O:{"0":0.00506},H:{"0":0.01437},L:{"0":16.80495},S:{"2.5":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TestMessage.js","sources":["../../../src/internal/testing/TestMessage.ts"],"names":[],"mappings":""}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operators/observeOn"));
|
||||
//# sourceMappingURL=observeOn.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "5.0.0";
|
||||
@@ -0,0 +1,669 @@
|
||||
# is
|
||||
|
||||
> Type check values
|
||||
|
||||
For example, `is.string('🦄') //=> true`
|
||||
|
||||
<img src="header.gif" width="182" align="right">
|
||||
|
||||
## Highlights
|
||||
|
||||
- Written in TypeScript
|
||||
- [Extensive use of type guards](#type-guards)
|
||||
- [Supports type assertions](#type-assertions)
|
||||
- [Aware of generic type parameters](#generic-type-parameters) (use with caution)
|
||||
- Actively maintained
|
||||
- 
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install @sindresorhus/is
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const is = require('@sindresorhus/is');
|
||||
|
||||
is('🦄');
|
||||
//=> 'string'
|
||||
|
||||
is(new Map());
|
||||
//=> 'Map'
|
||||
|
||||
is.number(6);
|
||||
//=> true
|
||||
```
|
||||
|
||||
[Assertions](#type-assertions) perform the same type checks, but throw an error if the type does not match.
|
||||
|
||||
```js
|
||||
const {assert} = require('@sindresorhus/is');
|
||||
|
||||
assert.string(2);
|
||||
//=> Error: Expected value which is `string`, received value of type `number`.
|
||||
```
|
||||
|
||||
And with TypeScript:
|
||||
|
||||
```ts
|
||||
import {assert} from '@sindresorhus/is';
|
||||
|
||||
assert.string(foo);
|
||||
// `foo` is now typed as a `string`.
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### is(value)
|
||||
|
||||
Returns the type of `value`.
|
||||
|
||||
Primitives are lowercase and object types are camelcase.
|
||||
|
||||
Example:
|
||||
|
||||
- `'undefined'`
|
||||
- `'null'`
|
||||
- `'string'`
|
||||
- `'symbol'`
|
||||
- `'Array'`
|
||||
- `'Function'`
|
||||
- `'Object'`
|
||||
|
||||
Note: It will throw an error if you try to feed it object-wrapped primitives, as that's a bad practice. For example `new String('foo')`.
|
||||
|
||||
### is.{method}
|
||||
|
||||
All the below methods accept a value and returns a boolean for whether the value is of the desired type.
|
||||
|
||||
#### Primitives
|
||||
|
||||
##### .undefined(value)
|
||||
##### .null(value)
|
||||
|
||||
**Note:** TypeScript users must use `.null_()` because of a TypeScript naming limitation.
|
||||
|
||||
##### .string(value)
|
||||
##### .number(value)
|
||||
|
||||
Note: `is.number(NaN)` returns `false`. This intentionally deviates from `typeof` behavior to increase user-friendliness of `is` type checks.
|
||||
|
||||
##### .boolean(value)
|
||||
##### .symbol(value)
|
||||
##### .bigint(value)
|
||||
|
||||
#### Built-in types
|
||||
|
||||
##### .array(value, assertion?)
|
||||
|
||||
Returns true if `value` is an array and all of its items match the assertion (if provided).
|
||||
|
||||
```js
|
||||
is.array(value); // Validate `value` is an array.
|
||||
is.array(value, is.number); // Validate `value` is an array and all of its items are numbers.
|
||||
```
|
||||
|
||||
##### .function(value)
|
||||
|
||||
**Note:** TypeScript users must use `.function_()` because of a TypeScript naming limitation.
|
||||
|
||||
##### .buffer(value)
|
||||
##### .blob(value)
|
||||
##### .object(value)
|
||||
|
||||
Keep in mind that [functions are objects too](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions).
|
||||
|
||||
##### .numericString(value)
|
||||
|
||||
Returns `true` for a string that represents a number satisfying `is.number`, for example, `'42'` and `'-8.3'`.
|
||||
|
||||
Note: `'NaN'` returns `false`, but `'Infinity'` and `'-Infinity'` return `true`.
|
||||
|
||||
##### .regExp(value)
|
||||
##### .date(value)
|
||||
##### .error(value)
|
||||
##### .nativePromise(value)
|
||||
##### .promise(value)
|
||||
|
||||
Returns `true` for any object with a `.then()` and `.catch()` method. Prefer this one over `.nativePromise()` as you usually want to allow userland promise implementations too.
|
||||
|
||||
##### .generator(value)
|
||||
|
||||
Returns `true` for any object that implements its own `.next()` and `.throw()` methods and has a function definition for `Symbol.iterator`.
|
||||
|
||||
##### .generatorFunction(value)
|
||||
|
||||
##### .asyncFunction(value)
|
||||
|
||||
Returns `true` for any `async` function that can be called with the `await` operator.
|
||||
|
||||
```js
|
||||
is.asyncFunction(async () => {});
|
||||
//=> true
|
||||
|
||||
is.asyncFunction(() => {});
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .asyncGenerator(value)
|
||||
|
||||
```js
|
||||
is.asyncGenerator(
|
||||
(async function * () {
|
||||
yield 4;
|
||||
})()
|
||||
);
|
||||
//=> true
|
||||
|
||||
is.asyncGenerator(
|
||||
(function * () {
|
||||
yield 4;
|
||||
})()
|
||||
);
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .asyncGeneratorFunction(value)
|
||||
|
||||
```js
|
||||
is.asyncGeneratorFunction(async function * () {
|
||||
yield 4;
|
||||
});
|
||||
//=> true
|
||||
|
||||
is.asyncGeneratorFunction(function * () {
|
||||
yield 4;
|
||||
});
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .boundFunction(value)
|
||||
|
||||
Returns `true` for any `bound` function.
|
||||
|
||||
```js
|
||||
is.boundFunction(() => {});
|
||||
//=> true
|
||||
|
||||
is.boundFunction(function () {}.bind(null));
|
||||
//=> true
|
||||
|
||||
is.boundFunction(function () {});
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .map(value)
|
||||
##### .set(value)
|
||||
##### .weakMap(value)
|
||||
##### .weakSet(value)
|
||||
|
||||
#### Typed arrays
|
||||
|
||||
##### .int8Array(value)
|
||||
##### .uint8Array(value)
|
||||
##### .uint8ClampedArray(value)
|
||||
##### .int16Array(value)
|
||||
##### .uint16Array(value)
|
||||
##### .int32Array(value)
|
||||
##### .uint32Array(value)
|
||||
##### .float32Array(value)
|
||||
##### .float64Array(value)
|
||||
##### .bigInt64Array(value)
|
||||
##### .bigUint64Array(value)
|
||||
|
||||
#### Structured data
|
||||
|
||||
##### .arrayBuffer(value)
|
||||
##### .sharedArrayBuffer(value)
|
||||
##### .dataView(value)
|
||||
|
||||
##### .enumCase(value, enum)
|
||||
|
||||
TypeScript-only. Returns `true` if `value` is a member of `enum`.
|
||||
|
||||
```ts
|
||||
enum Direction {
|
||||
Ascending = 'ascending',
|
||||
Descending = 'descending'
|
||||
}
|
||||
|
||||
is.enumCase('ascending', Direction);
|
||||
//=> true
|
||||
|
||||
is.enumCase('other', Direction);
|
||||
//=> false
|
||||
```
|
||||
|
||||
#### Emptiness
|
||||
|
||||
##### .emptyString(value)
|
||||
|
||||
Returns `true` if the value is a `string` and the `.length` is 0.
|
||||
|
||||
##### .emptyStringOrWhitespace(value)
|
||||
|
||||
Returns `true` if `is.emptyString(value)` or if it's a `string` that is all whitespace.
|
||||
|
||||
##### .nonEmptyString(value)
|
||||
|
||||
Returns `true` if the value is a `string` and the `.length` is more than 0.
|
||||
|
||||
##### .nonEmptyStringAndNotWhitespace(value)
|
||||
|
||||
Returns `true` if the value is a `string` that is not empty and not whitespace.
|
||||
|
||||
```js
|
||||
const values = ['property1', '', null, 'property2', ' ', undefined];
|
||||
|
||||
values.filter(is.nonEmptyStringAndNotWhitespace);
|
||||
//=> ['property1', 'property2']
|
||||
```
|
||||
|
||||
##### .emptyArray(value)
|
||||
|
||||
Returns `true` if the value is an `Array` and the `.length` is 0.
|
||||
|
||||
##### .nonEmptyArray(value)
|
||||
|
||||
Returns `true` if the value is an `Array` and the `.length` is more than 0.
|
||||
|
||||
##### .emptyObject(value)
|
||||
|
||||
Returns `true` if the value is an `Object` and `Object.keys(value).length` is 0.
|
||||
|
||||
Please note that `Object.keys` returns only own enumerable properties. Hence something like this can happen:
|
||||
|
||||
```js
|
||||
const object1 = {};
|
||||
|
||||
Object.defineProperty(object1, 'property1', {
|
||||
value: 42,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
is.emptyObject(object1);
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### .nonEmptyObject(value)
|
||||
|
||||
Returns `true` if the value is an `Object` and `Object.keys(value).length` is more than 0.
|
||||
|
||||
##### .emptySet(value)
|
||||
|
||||
Returns `true` if the value is a `Set` and the `.size` is 0.
|
||||
|
||||
##### .nonEmptySet(Value)
|
||||
|
||||
Returns `true` if the value is a `Set` and the `.size` is more than 0.
|
||||
|
||||
##### .emptyMap(value)
|
||||
|
||||
Returns `true` if the value is a `Map` and the `.size` is 0.
|
||||
|
||||
##### .nonEmptyMap(value)
|
||||
|
||||
Returns `true` if the value is a `Map` and the `.size` is more than 0.
|
||||
|
||||
#### Miscellaneous
|
||||
|
||||
##### .directInstanceOf(value, class)
|
||||
|
||||
Returns `true` if `value` is a direct instance of `class`.
|
||||
|
||||
```js
|
||||
is.directInstanceOf(new Error(), Error);
|
||||
//=> true
|
||||
|
||||
class UnicornError extends Error {}
|
||||
|
||||
is.directInstanceOf(new UnicornError(), Error);
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .urlInstance(value)
|
||||
|
||||
Returns `true` if `value` is an instance of the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL).
|
||||
|
||||
```js
|
||||
const url = new URL('https://example.com');
|
||||
|
||||
is.urlInstance(url);
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### .urlString(value)
|
||||
|
||||
Returns `true` if `value` is a URL string.
|
||||
|
||||
Note: this only does basic checking using the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL) constructor.
|
||||
|
||||
```js
|
||||
const url = 'https://example.com';
|
||||
|
||||
is.urlString(url);
|
||||
//=> true
|
||||
|
||||
is.urlString(new URL(url));
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .truthy(value)
|
||||
|
||||
Returns `true` for all values that evaluate to true in a boolean context:
|
||||
|
||||
```js
|
||||
is.truthy('🦄');
|
||||
//=> true
|
||||
|
||||
is.truthy(undefined);
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .falsy(value)
|
||||
|
||||
Returns `true` if `value` is one of: `false`, `0`, `''`, `null`, `undefined`, `NaN`.
|
||||
|
||||
##### .nan(value)
|
||||
##### .nullOrUndefined(value)
|
||||
##### .primitive(value)
|
||||
|
||||
JavaScript primitives are as follows: `null`, `undefined`, `string`, `number`, `boolean`, `symbol`.
|
||||
|
||||
##### .integer(value)
|
||||
|
||||
##### .safeInteger(value)
|
||||
|
||||
Returns `true` if `value` is a [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
|
||||
|
||||
##### .plainObject(value)
|
||||
|
||||
An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
||||
|
||||
##### .iterable(value)
|
||||
##### .asyncIterable(value)
|
||||
##### .class(value)
|
||||
|
||||
Returns `true` for instances created by a class.
|
||||
|
||||
**Note:** TypeScript users must use `.class_()` because of a TypeScript naming limitation.
|
||||
|
||||
##### .typedArray(value)
|
||||
|
||||
##### .arrayLike(value)
|
||||
|
||||
A `value` is array-like if it is not a function and has a `value.length` that is a safe integer greater than or equal to 0.
|
||||
|
||||
```js
|
||||
is.arrayLike(document.forms);
|
||||
//=> true
|
||||
|
||||
function foo() {
|
||||
is.arrayLike(arguments);
|
||||
//=> true
|
||||
}
|
||||
foo();
|
||||
```
|
||||
|
||||
##### .inRange(value, range)
|
||||
|
||||
Check if `value` (number) is in the given `range`. The range is an array of two values, lower bound and upper bound, in no specific order.
|
||||
|
||||
```js
|
||||
is.inRange(3, [0, 5]);
|
||||
is.inRange(3, [5, 0]);
|
||||
is.inRange(0, [-2, 2]);
|
||||
```
|
||||
|
||||
##### .inRange(value, upperBound)
|
||||
|
||||
Check if `value` (number) is in the range of `0` to `upperBound`.
|
||||
|
||||
```js
|
||||
is.inRange(3, 10);
|
||||
```
|
||||
|
||||
##### .domElement(value)
|
||||
|
||||
Returns `true` if `value` is a DOM Element.
|
||||
|
||||
##### .nodeStream(value)
|
||||
|
||||
Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html).
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
|
||||
is.nodeStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### .observable(value)
|
||||
|
||||
Returns `true` if `value` is an `Observable`.
|
||||
|
||||
```js
|
||||
const {Observable} = require('rxjs');
|
||||
|
||||
is.observable(new Observable());
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### .infinite(value)
|
||||
|
||||
Check if `value` is `Infinity` or `-Infinity`.
|
||||
|
||||
##### .evenInteger(value)
|
||||
|
||||
Returns `true` if `value` is an even integer.
|
||||
|
||||
##### .oddInteger(value)
|
||||
|
||||
Returns `true` if `value` is an odd integer.
|
||||
|
||||
##### .propertyKey(value)
|
||||
|
||||
Returns `true` if `value` can be used as an object property key (either `string`, `number`, or `symbol`).
|
||||
|
||||
##### .formData(value)
|
||||
|
||||
Returns `true` if `value` is an instance of the [`FormData` class](https://developer.mozilla.org/en-US/docs/Web/API/FormData).
|
||||
|
||||
```js
|
||||
const data = new FormData();
|
||||
|
||||
is.formData(data);
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### .urlSearchParams(value)
|
||||
|
||||
Returns `true` if `value` is an instance of the [`URLSearchParams` class](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams).
|
||||
|
||||
```js
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
is.urlSearchParams(searchParams);
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### .any(predicate | predicate[], ...values)
|
||||
|
||||
Using a single `predicate` argument, returns `true` if **any** of the input `values` returns true in the `predicate`:
|
||||
|
||||
```js
|
||||
is.any(is.string, {}, true, '🦄');
|
||||
//=> true
|
||||
|
||||
is.any(is.boolean, 'unicorns', [], new Map());
|
||||
//=> false
|
||||
```
|
||||
|
||||
Using an array of `predicate[]`, returns `true` if **any** of the input `values` returns true for **any** of the `predicates` provided in an array:
|
||||
|
||||
```js
|
||||
is.any([is.string, is.number], {}, true, '🦄');
|
||||
//=> true
|
||||
|
||||
is.any([is.boolean, is.number], 'unicorns', [], new Map());
|
||||
//=> false
|
||||
```
|
||||
|
||||
##### .all(predicate, ...values)
|
||||
|
||||
Returns `true` if **all** of the input `values` returns true in the `predicate`:
|
||||
|
||||
```js
|
||||
is.all(is.object, {}, new Map(), new Set());
|
||||
//=> true
|
||||
|
||||
is.all(is.string, '🦄', [], 'unicorns');
|
||||
//=> false
|
||||
```
|
||||
|
||||
## Type guards
|
||||
|
||||
When using `is` together with TypeScript, [type guards](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types) are being used extensively to infer the correct type inside if-else statements.
|
||||
|
||||
```ts
|
||||
import is from '@sindresorhus/is';
|
||||
|
||||
const padLeft = (value: string, padding: string | number) => {
|
||||
if (is.number(padding)) {
|
||||
// `padding` is typed as `number`
|
||||
return Array(padding + 1).join(' ') + value;
|
||||
}
|
||||
|
||||
if (is.string(padding)) {
|
||||
// `padding` is typed as `string`
|
||||
return padding + value;
|
||||
}
|
||||
|
||||
throw new TypeError(`Expected 'padding' to be of type 'string' or 'number', got '${is(padding)}'.`);
|
||||
}
|
||||
|
||||
padLeft('🦄', 3);
|
||||
//=> ' 🦄'
|
||||
|
||||
padLeft('🦄', '🌈');
|
||||
//=> '🌈🦄'
|
||||
```
|
||||
|
||||
## Type assertions
|
||||
|
||||
The type guards are also available as [type assertions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions), which throw an error for unexpected types. It is a convenient one-line version of the often repetitive "if-not-expected-type-throw" pattern.
|
||||
|
||||
```ts
|
||||
import {assert} from '@sindresorhus/is';
|
||||
|
||||
const handleMovieRatingApiResponse = (response: unknown) => {
|
||||
assert.plainObject(response);
|
||||
// `response` is now typed as a plain `object` with `unknown` properties.
|
||||
|
||||
assert.number(response.rating);
|
||||
// `response.rating` is now typed as a `number`.
|
||||
|
||||
assert.string(response.title);
|
||||
// `response.title` is now typed as a `string`.
|
||||
|
||||
return `${response.title} (${response.rating * 10})`;
|
||||
};
|
||||
|
||||
handleMovieRatingApiResponse({rating: 0.87, title: 'The Matrix'});
|
||||
//=> 'The Matrix (8.7)'
|
||||
|
||||
// This throws an error.
|
||||
handleMovieRatingApiResponse({rating: '🦄'});
|
||||
```
|
||||
|
||||
## Generic type parameters
|
||||
|
||||
The type guards and type assertions are aware of [generic type parameters](https://www.typescriptlang.org/docs/handbook/generics.html), such as `Promise<T>` and `Map<Key, Value>`. The default is `unknown` for most cases, since `is` cannot check them at runtime. If the generic type is known at compile-time, either implicitly (inferred) or explicitly (provided), `is` propagates the type so it can be used later.
|
||||
|
||||
Use generic type parameters with caution. They are only checked by the TypeScript compiler, and not checked by `is` at runtime. This can lead to unexpected behavior, where the generic type is _assumed_ at compile-time, but actually is something completely different at runtime. It is best to use `unknown` (default) and type-check the value of the generic type parameter at runtime with `is` or `assert`.
|
||||
|
||||
```ts
|
||||
import {assert} from '@sindresorhus/is';
|
||||
|
||||
async function badNumberAssumption(input: unknown) {
|
||||
// Bad assumption about the generic type parameter fools the compile-time type system.
|
||||
assert.promise<number>(input);
|
||||
// `input` is a `Promise` but only assumed to be `Promise<number>`.
|
||||
|
||||
const resolved = await input;
|
||||
// `resolved` is typed as `number` but was not actually checked at runtime.
|
||||
|
||||
// Multiplication will return NaN if the input promise did not actually contain a number.
|
||||
return 2 * resolved;
|
||||
}
|
||||
|
||||
async function goodNumberAssertion(input: unknown) {
|
||||
assert.promise(input);
|
||||
// `input` is typed as `Promise<unknown>`
|
||||
|
||||
const resolved = await input;
|
||||
// `resolved` is typed as `unknown`
|
||||
|
||||
assert.number(resolved);
|
||||
// `resolved` is typed as `number`
|
||||
|
||||
// Uses runtime checks so only numbers will reach the multiplication.
|
||||
return 2 * resolved;
|
||||
}
|
||||
|
||||
badNumberAssumption(Promise.resolve('An unexpected string'));
|
||||
//=> NaN
|
||||
|
||||
// This correctly throws an error because of the unexpected string value.
|
||||
goodNumberAssertion(Promise.resolve('An unexpected string'));
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why yet another type checking module?
|
||||
|
||||
There are hundreds of type checking modules on npm, unfortunately, I couldn't find any that fit my needs:
|
||||
|
||||
- Includes both type methods and ability to get the type
|
||||
- Types of primitives returned as lowercase and object types as camelcase
|
||||
- Covers all built-ins
|
||||
- Unsurprising behavior
|
||||
- Well-maintained
|
||||
- Comprehensive test suite
|
||||
|
||||
For the ones I found, pick 3 of these.
|
||||
|
||||
The most common mistakes I noticed in these modules was using `instanceof` for type checking, forgetting that functions are objects, and omitting `symbol` as a primitive.
|
||||
|
||||
### Why not just use `instanceof` instead of this package?
|
||||
|
||||
`instanceof` does not work correctly for all types and it does not work across [realms](https://stackoverflow.com/a/49832343/64949). Examples of realms are iframes, windows, web workers, and the `vm` module in Node.js.
|
||||
|
||||
## For enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of @sindresorhus/is and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-sindresorhus-is?utm_source=npm-sindresorhus-is&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [ow](https://github.com/sindresorhus/ow) - Function argument validation for humans
|
||||
- [is-stream](https://github.com/sindresorhus/is-stream) - Check if something is a Node.js stream
|
||||
- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable
|
||||
- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array
|
||||
- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address
|
||||
- [is-array-sorted](https://github.com/sindresorhus/is-array-sorted) - Check if an Array is sorted
|
||||
- [is-error-constructor](https://github.com/sindresorhus/is-error-constructor) - Check if a value is an error constructor
|
||||
- [is-empty-iterable](https://github.com/sindresorhus/is-empty-iterable) - Check if an Iterable is empty
|
||||
- [is-blob](https://github.com/sindresorhus/is-blob) - Check if a value is a Blob - File-like object of immutable, raw data
|
||||
- [has-emoji](https://github.com/sindresorhus/has-emoji) - Check whether a string has any emoji
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Giora Guttsait](https://github.com/gioragutt)
|
||||
- [Brandon Smith](https://github.com/brandon93s)
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/fromEventPattern';
|
||||
@@ -0,0 +1,186 @@
|
||||
export class Buffer extends Uint8Array {
|
||||
length: number
|
||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
toJSON(): { type: 'Buffer', data: any[] };
|
||||
equals(otherBuffer: Buffer): boolean;
|
||||
compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUInt8(offset: number, noAssert?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readInt8(offset: number, noAssert?: boolean): number;
|
||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
reverse(): this;
|
||||
swap16(): Buffer;
|
||||
swap32(): Buffer;
|
||||
swap64(): Buffer;
|
||||
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
fill(value: any, offset?: number, end?: number): this;
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
||||
|
||||
/**
|
||||
* Allocates a new buffer containing the given {str}.
|
||||
*
|
||||
* @param str String to store in buffer.
|
||||
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||
*/
|
||||
constructor (str: string, encoding?: string);
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
*/
|
||||
constructor (size: number);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
*/
|
||||
constructor (array: Uint8Array);
|
||||
/**
|
||||
* Produces a Buffer backed by the same allocated memory as
|
||||
* the given {ArrayBuffer}.
|
||||
*
|
||||
*
|
||||
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||
*/
|
||||
constructor (arrayBuffer: ArrayBuffer);
|
||||
/**
|
||||
* Allocates a new buffer containing the given {array} of octets.
|
||||
*
|
||||
* @param array The octets to store.
|
||||
*/
|
||||
constructor (array: any[]);
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
||||
*
|
||||
* @param buffer The buffer to copy.
|
||||
*/
|
||||
constructor (buffer: Buffer);
|
||||
prototype: Buffer;
|
||||
/**
|
||||
* Allocates a new Buffer using an {array} of octets.
|
||||
*
|
||||
* @param array
|
||||
*/
|
||||
static from(array: any[]): Buffer;
|
||||
/**
|
||||
* When passed a reference to the .buffer property of a TypedArray instance,
|
||||
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
||||
* The optional {byteOffset} and {length} arguments specify a memory range
|
||||
* within the {arrayBuffer} that will be shared by the Buffer.
|
||||
*
|
||||
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
||||
* @param byteOffset
|
||||
* @param length
|
||||
*/
|
||||
static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
||||
/**
|
||||
* Copies the passed {buffer} data onto a new Buffer instance.
|
||||
*
|
||||
* @param buffer
|
||||
*/
|
||||
static from(buffer: Buffer | Uint8Array): Buffer;
|
||||
/**
|
||||
* Creates a new Buffer containing the given JavaScript string {str}.
|
||||
* If provided, the {encoding} parameter identifies the character encoding.
|
||||
* If not provided, {encoding} defaults to 'utf8'.
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
static from(str: string, encoding?: string): Buffer;
|
||||
/**
|
||||
* Returns true if {obj} is a Buffer
|
||||
*
|
||||
* @param obj object to test.
|
||||
*/
|
||||
static isBuffer(obj: any): obj is Buffer;
|
||||
/**
|
||||
* Returns true if {encoding} is a valid encoding argument.
|
||||
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
||||
*
|
||||
* @param encoding string to test.
|
||||
*/
|
||||
static isEncoding(encoding: string): boolean;
|
||||
/**
|
||||
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
||||
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
||||
*
|
||||
* @param string string to test.
|
||||
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
||||
*/
|
||||
static byteLength(string: string, encoding?: string): number;
|
||||
/**
|
||||
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
||||
*
|
||||
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
||||
* If the list has exactly one item, then the first item of the list is returned.
|
||||
* If the list has more than one item, then a new Buffer is created.
|
||||
*
|
||||
* @param list An array of Buffer objects to concatenate
|
||||
* @param totalLength Total length of the buffers when concatenated.
|
||||
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
||||
*/
|
||||
static concat(list: Buffer[], totalLength?: number): Buffer;
|
||||
/**
|
||||
* The same as buf1.compare(buf2).
|
||||
*/
|
||||
static compare(buf1: Buffer, buf2: Buffer): number;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets.
|
||||
*
|
||||
* @param size count of octets to allocate.
|
||||
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
||||
* If parameter is omitted, buffer will be filled with zeros.
|
||||
* @param encoding encoding used for call to buf.fill while initializing
|
||||
*/
|
||||
static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
||||
/**
|
||||
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafe(size: number): Buffer;
|
||||
/**
|
||||
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
||||
* of the newly created Buffer are unknown and may contain sensitive data.
|
||||
*
|
||||
* @param size count of octets to allocate
|
||||
*/
|
||||
static allocUnsafeSlow(size: number): Buffer;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"using.js","sources":["../../src/add/observable/using.ts"],"names":[],"mappings":";;AAAA,4CAA0C"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"retryWhen.js","sources":["../src/operator/retryWhen.ts"],"names":[],"mappings":";;;;;AAAA,oDAA+C"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"OuterSubscriber.js","sources":["../../src/internal/OuterSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C;IAA2C,2CAAa;IAAxD;;IAcA,CAAC;IAbC,oCAAU,GAAV,UAAW,UAAa,EAAE,UAAa,EAC5B,UAAkB,EAAE,UAAkB,EACtC,QAA+B;QACxC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,qCAAW,GAAX,UAAY,KAAU,EAAE,QAA+B;QACrD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,wCAAc,GAAd,UAAe,QAA+B;QAC5C,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IACH,sBAAC;AAAD,CAAC,AAdD,CAA2C,UAAU,GAcpD"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"tinro","version":"0.6.1","files":{"LICENSE":{"checkedAt":1678887830447,"integrity":"sha512-/ir3U8EqV8gVmh7zz0V84blY74KNGJmP7VhCsxrq62D7oKU/aGcZS0mkwpa/Npg1JTJyLfAxUEs/rgP2cVNBGA==","mode":420,"size":1073},"cmp/index.js":{"checkedAt":1678887830447,"integrity":"sha512-fT46MGv3NFwEP+TGepf4176999CmoPHvQP9WPQsciuPli7THAthHNf7hK2Wmxo4vwOoUIqstYoyMh0xb+vUDCA==","mode":420,"size":104},"dist/tinro_lib.js":{"checkedAt":1678887830439,"integrity":"sha512-oJCu5Oiyc+Ak9qP9Ceo+1gbtme5NTGqTSBxYqwJ60csYn7v0OELB/QG63cJ+5D6OBtOISvOg0jcgV6sC4bi6kg==","mode":420,"size":5934},"dist/tinro.es.js":{"checkedAt":1678887830447,"integrity":"sha512-7VKmWQx66DY/JyIUl45Xw4HMrvBE+OSZecsZ7d9rF/XvTHIjkZ981thq3mbhDyyIrD+jtlQ8tKsxHJ9NzvNxQw==","mode":420,"size":7418},"dist/tinro.js":{"checkedAt":1678887830447,"integrity":"sha512-sqnYu4Ekcw1/X7aw+j2zkqDclsUW3NC8twKkMz5AEtTRnKgSY/Yh0ncqVPzxzf9AuaLSv8AleNtEclzjy/kFHg==","mode":420,"size":8108},"package.json":{"checkedAt":1678887830447,"integrity":"sha512-8dcIjQmY400pxoCM4pyb3ZLYsa5XjvLnyFrlKWP1YQ+DtRh1grOZZV0eyH08Xuc7Pt81wCw8xZakMeXSJUJJVQ==","mode":420,"size":1084},"CHANGELOG.md":{"checkedAt":1678887830452,"integrity":"sha512-PUAcr+GO+cozQjiPUbyzrLCFCazrMGp+Aa+RMFo6a1HoxoKW5/nh+G2PgVuA6p3stinXel8/K7ALqwMHvBdQ2Q==","mode":420,"size":19546},"README.md":{"checkedAt":1678887830460,"integrity":"sha512-nYrhUNU3LK0nU9WL5a195Xe1eT6MwjglWjekifNX67Lo2w3UMaEwbNNaxf0nLT1HadHNUPf4aChH2c7FH4m5bQ==","mode":420,"size":16868},"cmp/Route.svelte":{"checkedAt":1678887830460,"integrity":"sha512-RaO6MHptN+RYHiT/arTPx4WEV6fGXM4okUb+wtxa44NScMe0o9B6UrYaLeVdg59nPOGHNIhSy9OPmZVGNDCXhA==","mode":420,"size":739},"index.d.ts":{"checkedAt":1678887830460,"integrity":"sha512-d4lhMaweP1kaNVsyw4HTZaZgr1Dqf/EHTf66EVepAqbBHd3l0K7/aplE/b1ToKnSA4aaE/mNx8pZCK1CoiRqQw==","mode":420,"size":2966},".github/workflows/generate_changelog.yml":{"checkedAt":1678887830460,"integrity":"sha512-GpgIPo7ccomguktcwG/Oo2BvbIhfzniYEG2tZVyuB5IVAkG0pmUyvBmiVmWllXNkyLQNfoTpEbangQc67blbYA==","mode":420,"size":597},".github/workflows/npm-publish.yml":{"checkedAt":1678887830465,"integrity":"sha512-Hzg6pTZxpQ/LFrKkZ+hd8oHgwPu3qqP/3ayd82jw/CkZtMPvOapzc7UQiqc+HbpsrMhBbAjOBB6gVtUbDBNQtg==","mode":420,"size":956}}}
|
||||
@@ -0,0 +1,130 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Subject_1 = require("./Subject");
|
||||
var queue_1 = require("./scheduler/queue");
|
||||
var Subscription_1 = require("./Subscription");
|
||||
var observeOn_1 = require("./operators/observeOn");
|
||||
var ObjectUnsubscribedError_1 = require("./util/ObjectUnsubscribedError");
|
||||
var SubjectSubscription_1 = require("./SubjectSubscription");
|
||||
var ReplaySubject = (function (_super) {
|
||||
__extends(ReplaySubject, _super);
|
||||
function ReplaySubject(bufferSize, windowTime, scheduler) {
|
||||
if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; }
|
||||
if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; }
|
||||
var _this = _super.call(this) || this;
|
||||
_this.scheduler = scheduler;
|
||||
_this._events = [];
|
||||
_this._infiniteTimeWindow = false;
|
||||
_this._bufferSize = bufferSize < 1 ? 1 : bufferSize;
|
||||
_this._windowTime = windowTime < 1 ? 1 : windowTime;
|
||||
if (windowTime === Number.POSITIVE_INFINITY) {
|
||||
_this._infiniteTimeWindow = true;
|
||||
_this.next = _this.nextInfiniteTimeWindow;
|
||||
}
|
||||
else {
|
||||
_this.next = _this.nextTimeWindow;
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
ReplaySubject.prototype.nextInfiniteTimeWindow = function (value) {
|
||||
if (!this.isStopped) {
|
||||
var _events = this._events;
|
||||
_events.push(value);
|
||||
if (_events.length > this._bufferSize) {
|
||||
_events.shift();
|
||||
}
|
||||
}
|
||||
_super.prototype.next.call(this, value);
|
||||
};
|
||||
ReplaySubject.prototype.nextTimeWindow = function (value) {
|
||||
if (!this.isStopped) {
|
||||
this._events.push(new ReplayEvent(this._getNow(), value));
|
||||
this._trimBufferThenGetEvents();
|
||||
}
|
||||
_super.prototype.next.call(this, value);
|
||||
};
|
||||
ReplaySubject.prototype._subscribe = function (subscriber) {
|
||||
var _infiniteTimeWindow = this._infiniteTimeWindow;
|
||||
var _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();
|
||||
var scheduler = this.scheduler;
|
||||
var len = _events.length;
|
||||
var subscription;
|
||||
if (this.closed) {
|
||||
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
|
||||
}
|
||||
else if (this.isStopped || this.hasError) {
|
||||
subscription = Subscription_1.Subscription.EMPTY;
|
||||
}
|
||||
else {
|
||||
this.observers.push(subscriber);
|
||||
subscription = new SubjectSubscription_1.SubjectSubscription(this, subscriber);
|
||||
}
|
||||
if (scheduler) {
|
||||
subscriber.add(subscriber = new observeOn_1.ObserveOnSubscriber(subscriber, scheduler));
|
||||
}
|
||||
if (_infiniteTimeWindow) {
|
||||
for (var i = 0; i < len && !subscriber.closed; i++) {
|
||||
subscriber.next(_events[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < len && !subscriber.closed; i++) {
|
||||
subscriber.next(_events[i].value);
|
||||
}
|
||||
}
|
||||
if (this.hasError) {
|
||||
subscriber.error(this.thrownError);
|
||||
}
|
||||
else if (this.isStopped) {
|
||||
subscriber.complete();
|
||||
}
|
||||
return subscription;
|
||||
};
|
||||
ReplaySubject.prototype._getNow = function () {
|
||||
return (this.scheduler || queue_1.queue).now();
|
||||
};
|
||||
ReplaySubject.prototype._trimBufferThenGetEvents = function () {
|
||||
var now = this._getNow();
|
||||
var _bufferSize = this._bufferSize;
|
||||
var _windowTime = this._windowTime;
|
||||
var _events = this._events;
|
||||
var eventsCount = _events.length;
|
||||
var spliceCount = 0;
|
||||
while (spliceCount < eventsCount) {
|
||||
if ((now - _events[spliceCount].time) < _windowTime) {
|
||||
break;
|
||||
}
|
||||
spliceCount++;
|
||||
}
|
||||
if (eventsCount > _bufferSize) {
|
||||
spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);
|
||||
}
|
||||
if (spliceCount > 0) {
|
||||
_events.splice(0, spliceCount);
|
||||
}
|
||||
return _events;
|
||||
};
|
||||
return ReplaySubject;
|
||||
}(Subject_1.Subject));
|
||||
exports.ReplaySubject = ReplaySubject;
|
||||
var ReplayEvent = (function () {
|
||||
function ReplayEvent(time, value) {
|
||||
this.time = time;
|
||||
this.value = value;
|
||||
}
|
||||
return ReplayEvent;
|
||||
}());
|
||||
//# sourceMappingURL=ReplaySubject.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"partition.js","sources":["../../src/internal/operators/partition.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,mCAAkC;AAoDlC,SAAgB,SAAS,CAAI,SAA+C,EAC/C,OAAa;IACxC,OAAO,UAAC,MAAqB,IAAK,OAAA;QAChC,eAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;QAClC,eAAM,CAAC,SAAG,CAAC,SAAS,EAAE,OAAO,CAAQ,CAAC,CAAC,MAAM,CAAC;KACb,EAHD,CAGC,CAAC;AACtC,CAAC;AAND,8BAMC"}
|
||||
@@ -0,0 +1,118 @@
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Observable } from '../Observable';
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
import { subscribeToResult } from '../util/subscribeToResult';
|
||||
export function delayWhen(delayDurationSelector, subscriptionDelay) {
|
||||
if (subscriptionDelay) {
|
||||
return (source) => new SubscriptionDelayObservable(source, subscriptionDelay)
|
||||
.lift(new DelayWhenOperator(delayDurationSelector));
|
||||
}
|
||||
return (source) => source.lift(new DelayWhenOperator(delayDurationSelector));
|
||||
}
|
||||
class DelayWhenOperator {
|
||||
constructor(delayDurationSelector) {
|
||||
this.delayDurationSelector = delayDurationSelector;
|
||||
}
|
||||
call(subscriber, source) {
|
||||
return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector));
|
||||
}
|
||||
}
|
||||
class DelayWhenSubscriber extends OuterSubscriber {
|
||||
constructor(destination, delayDurationSelector) {
|
||||
super(destination);
|
||||
this.delayDurationSelector = delayDurationSelector;
|
||||
this.completed = false;
|
||||
this.delayNotifierSubscriptions = [];
|
||||
this.index = 0;
|
||||
}
|
||||
notifyNext(outerValue, _innerValue, _outerIndex, _innerIndex, innerSub) {
|
||||
this.destination.next(outerValue);
|
||||
this.removeSubscription(innerSub);
|
||||
this.tryComplete();
|
||||
}
|
||||
notifyError(error, innerSub) {
|
||||
this._error(error);
|
||||
}
|
||||
notifyComplete(innerSub) {
|
||||
const value = this.removeSubscription(innerSub);
|
||||
if (value) {
|
||||
this.destination.next(value);
|
||||
}
|
||||
this.tryComplete();
|
||||
}
|
||||
_next(value) {
|
||||
const index = this.index++;
|
||||
try {
|
||||
const delayNotifier = this.delayDurationSelector(value, index);
|
||||
if (delayNotifier) {
|
||||
this.tryDelay(delayNotifier, value);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
}
|
||||
}
|
||||
_complete() {
|
||||
this.completed = true;
|
||||
this.tryComplete();
|
||||
this.unsubscribe();
|
||||
}
|
||||
removeSubscription(subscription) {
|
||||
subscription.unsubscribe();
|
||||
const subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription);
|
||||
if (subscriptionIdx !== -1) {
|
||||
this.delayNotifierSubscriptions.splice(subscriptionIdx, 1);
|
||||
}
|
||||
return subscription.outerValue;
|
||||
}
|
||||
tryDelay(delayNotifier, value) {
|
||||
const notifierSubscription = subscribeToResult(this, delayNotifier, value);
|
||||
if (notifierSubscription && !notifierSubscription.closed) {
|
||||
const destination = this.destination;
|
||||
destination.add(notifierSubscription);
|
||||
this.delayNotifierSubscriptions.push(notifierSubscription);
|
||||
}
|
||||
}
|
||||
tryComplete() {
|
||||
if (this.completed && this.delayNotifierSubscriptions.length === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
class SubscriptionDelayObservable extends Observable {
|
||||
constructor(source, subscriptionDelay) {
|
||||
super();
|
||||
this.source = source;
|
||||
this.subscriptionDelay = subscriptionDelay;
|
||||
}
|
||||
_subscribe(subscriber) {
|
||||
this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source));
|
||||
}
|
||||
}
|
||||
class SubscriptionDelaySubscriber extends Subscriber {
|
||||
constructor(parent, source) {
|
||||
super();
|
||||
this.parent = parent;
|
||||
this.source = source;
|
||||
this.sourceSubscribed = false;
|
||||
}
|
||||
_next(unused) {
|
||||
this.subscribeToSource();
|
||||
}
|
||||
_error(err) {
|
||||
this.unsubscribe();
|
||||
this.parent.error(err);
|
||||
}
|
||||
_complete() {
|
||||
this.unsubscribe();
|
||||
this.subscribeToSource();
|
||||
}
|
||||
subscribeToSource() {
|
||||
if (!this.sourceSubscribed) {
|
||||
this.sourceSubscribed = true;
|
||||
this.unsubscribe();
|
||||
this.source.subscribe(this.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=delayWhen.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
let printed = {}
|
||||
|
||||
module.exports = function warnOnce(message) {
|
||||
if (printed[message]) return
|
||||
printed[message] = true
|
||||
|
||||
if (typeof console !== 'undefined' && console.warn) {
|
||||
console.warn(message)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.errorObject = { e: {} };
|
||||
//# sourceMappingURL=errorObject.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"generate.js","sources":["../../../src/internal/observable/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA8PlD,MAAM,UAAU,QAAQ,CAAO,qBAAgD,EAChD,SAA4B,EAC5B,OAAwB,EACxB,0BAA+D,EAC/D,SAAyB;IAEtD,IAAI,cAAgC,CAAC;IACrC,IAAI,YAAe,CAAC;IAEpB,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;QACzB,MAAM,OAAO,GAAG,qBAA8C,CAAC;QAC/D,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACpC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC1B,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,QAA4B,CAAC;QACxE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;KAC/B;SAAM,IAAI,0BAA0B,KAAK,SAAS,IAAI,WAAW,CAAC,0BAA0B,CAAC,EAAE;QAC9F,YAAY,GAAG,qBAA0B,CAAC;QAC1C,cAAc,GAAG,QAA4B,CAAC;QAC9C,SAAS,GAAG,0BAA2C,CAAC;KACzD;SAAM;QACL,YAAY,GAAG,qBAA0B,CAAC;QAC1C,cAAc,GAAG,0BAA8C,CAAC;KACjE;IAED,OAAO,IAAI,UAAU,CAAI,UAAU,CAAC,EAAE;QACpC,IAAI,KAAK,GAAG,YAAY,CAAC;QACzB,IAAI,SAAS,EAAE;YACb,OAAO,SAAS,CAAC,QAAQ,CAAuB,QAAQ,EAAE,CAAC,EAAE;gBAC3D,UAAU;gBACV,OAAO;gBACP,SAAS;gBACT,cAAc;gBACd,KAAK;aACN,CAAC,CAAC;SACJ;QAED,GAAG;YACD,IAAI,SAAS,EAAE;gBACb,IAAI,eAAwB,CAAC;gBAC7B,IAAI;oBACF,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;iBACpC;gBAAC,OAAO,GAAG,EAAE;oBACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACtB,OAAO,SAAS,CAAC;iBAClB;gBACD,IAAI,CAAC,eAAe,EAAE;oBACpB,UAAU,CAAC,QAAQ,EAAE,CAAC;oBACtB,MAAM;iBACP;aACF;YACD,IAAI,KAAQ,CAAC;YACb,IAAI;gBACF,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;aAC/B;YAAC,OAAO,GAAG,EAAE;gBACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,OAAO,SAAS,CAAC;aAClB;YACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,IAAI,UAAU,CAAC,MAAM,EAAE;gBACrB,MAAM;aACP;YACD,IAAI;gBACF,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;aACxB;YAAC,OAAO,GAAG,EAAE;gBACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACtB,OAAO,SAAS,CAAC;aAClB;SACF,QAAQ,IAAI,EAAE;QAEf,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAoD,KAA2B;IAC9F,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACxC,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,KAAK,CAAC,WAAW,EAAE;QACrB,IAAI;YACF,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1C;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;KACF;SAAM;QACL,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;KAC1B;IACD,IAAI,SAAS,EAAE;QACb,IAAI,eAAwB,CAAC;QAC7B,IAAI;YACF,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1C;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,eAAe,EAAE;YACpB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,UAAU,CAAC,MAAM,EAAE;YACrB,OAAO,SAAS,CAAC;SAClB;KACF;IACD,IAAI,KAAQ,CAAC;IACb,IAAI;QACF,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAG,EAAE;QACZ,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
||||
Reference in New Issue
Block a user