new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import assertString from './util/assertString';
|
||||
import { CountryCodes } from './isISO31661Alpha2'; // https://en.wikipedia.org/wiki/ISO_9362
|
||||
|
||||
var isBICReg = /^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$/;
|
||||
export default function isBIC(str) {
|
||||
assertString(str); // toUpperCase() should be removed when a new major version goes out that changes
|
||||
// the regex to [A-Z] (per the spec).
|
||||
|
||||
var countryCode = str.slice(4, 6).toUpperCase();
|
||||
|
||||
if (!CountryCodes.has(countryCode) && countryCode !== 'XK') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isBICReg.test(str);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import type { Readable } from 'node:stream';
|
||||
type FormData = {
|
||||
getBoundary: () => string;
|
||||
getLength: (callback: (error: Error | null, length: number) => void) => void;
|
||||
} & Readable;
|
||||
export default function isFormData(body: unknown): body is FormData;
|
||||
export {};
|
||||
@@ -0,0 +1,15 @@
|
||||
function inlineOptionsFrom(rules) {
|
||||
if (Array.isArray(rules)) {
|
||||
return rules;
|
||||
}
|
||||
|
||||
if (rules === false) {
|
||||
return ['none'];
|
||||
}
|
||||
|
||||
return undefined === rules ?
|
||||
['local'] :
|
||||
rules.split(',');
|
||||
}
|
||||
|
||||
module.exports = inlineOptionsFrom;
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var globalObj = require("es5-ext/global")
|
||||
, polyfill = require("../polyfill");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var cache;
|
||||
|
||||
a(typeof t(), "boolean");
|
||||
cache = globalObj.WeakMap;
|
||||
globalObj.WeakMap = polyfill;
|
||||
a(t(), true);
|
||||
if (cache === undefined) delete globalObj.WeakMap;
|
||||
else globalObj.WeakMap = cache;
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $Date = GetIntrinsic('%Date%');
|
||||
var $String = GetIntrinsic('%String%');
|
||||
|
||||
var $isNaN = require('../helpers/isNaN');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-todatestring
|
||||
|
||||
module.exports = function ToDateString(tv) {
|
||||
if (Type(tv) !== 'Number') {
|
||||
throw new $TypeError('Assertion failed: `tv` must be a Number');
|
||||
}
|
||||
if ($isNaN(tv)) {
|
||||
return 'Invalid Date';
|
||||
}
|
||||
return $String(new $Date(tv));
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type {Writable} from './writable';
|
||||
|
||||
/** @deprecated @see Writable */
|
||||
export type Mutable<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
Writable<BaseType, Keys>;
|
||||
@@ -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,"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,"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,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":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,"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,"77":0,"78":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,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":100,"111":0,"112":0,"113":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,"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,"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,"94":0,"95":0,"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,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,_:"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,"12.1":0,"13.1":0,"14.1":0,"15.1":0,"15.2-15.3":0,"15.4":0,"15.5":0,"15.6":0,"16.0":0,"16.1":0,"16.2":0,"16.3":0,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0,"11.0-11.2":0,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0,"14.0-14.4":0,"14.5-14.8":0,"15.0-15.1":0,"15.2-15.3":0,"15.4":0,"15.5":0,"15.6":0,"16.0":0,"16.1":0,"16.2":0,"16.3":0,"16.4":0},P:{"4":0,"20":0,"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,"14.0":0,"15.0":0,"16.0":0,"17.0":0,"18.0":0,"19.0":0},I:{"0":0,"3":0,"4":0,"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},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0},H:{"0":0},L:{"0":0},R:{_:"0"},M:{"0":0},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"is-plain-object","version":"5.0.0","files":{"LICENSE":{"checkedAt":1678883670399,"integrity":"sha512-UOO2nHn9DAmjyzpwwV0Scu/0jezBkqGLoKZNVJCn7ZV+l7ApYhoDOI/OlCh2TR6tqwtrEPB/7ahRiuplEJnMXQ==","mode":420,"size":1088},"README.md":{"checkedAt":1678883670399,"integrity":"sha512-qHuNX+mUoB6TjrP05v3tSYR0MKijca3FT1Bgy0mPS4iTieJCqXS6ChcjD24os7h25FY+ofF9mt8g0U9rzbkjng==","mode":420,"size":4366},"is-plain-object.d.ts":{"checkedAt":1678883670399,"integrity":"sha512-uIpZn6CVc7Z/34Qzq57wes82GjlQPeBZ9LEWbjFfyyJTUr+02yKItXNNCYHqYW07b560YblMnodfjMPxRcihSA==","mode":420,"size":48},"package.json":{"checkedAt":1678883670399,"integrity":"sha512-TXzJC1wccIvL+9PRFc0c4YkW+ZduII9F5DRjXlixvtRqcC/9mOYHF9DYHuJvUNPvysboV+JtzVCTyhA3JmnpWg==","mode":420,"size":2048},"dist/is-plain-object.js":{"checkedAt":1678883670399,"integrity":"sha512-4cgGbzCVvf8URjfO6m2+1mPH2sdN37ieKEhiWkpwV7yZ5JC+zwOrEfwSzsnggVz9ImUaml6HXnJaiTUHvNgP8A==","mode":420,"size":850},"dist/is-plain-object.mjs":{"checkedAt":1678883670399,"integrity":"sha512-C63zrhwUloKZSoV7AX1XUUdpyiyFAuHl2+Vl4M9utQMG2PTyopyHzPXU1R5pe0Z8Dhjet17NMFn6yA+7XrzcpA==","mode":420,"size":758}}}
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var ensureValue = require("../valid-value");
|
||||
|
||||
module.exports = function (object) {
|
||||
ensureValue(object);
|
||||
var result = [];
|
||||
object = Object(object);
|
||||
for (var key in object) {
|
||||
if (!propertyIsEnumerable.call(object, key)) continue;
|
||||
result.push([key, object[key]]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/types/core.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM,GAAG,MAAM,CAAA;AAC3B,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAA;IACP,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ"}
|
||||
@@ -0,0 +1,101 @@
|
||||
var extractImportUrlAndMedia = require('./extract-import-url-and-media');
|
||||
var restoreImport = require('./restore-import');
|
||||
var rewriteUrl = require('./rewrite-url');
|
||||
|
||||
var Token = require('../tokenizer/token');
|
||||
var isImport = require('../utils/is-import');
|
||||
|
||||
var SOURCE_MAP_COMMENT_PATTERN = /^\/\*# sourceMappingURL=(\S+) \*\/$/;
|
||||
|
||||
function rebase(tokens, rebaseAll, validator, rebaseConfig) {
|
||||
return rebaseAll ?
|
||||
rebaseEverything(tokens, validator, rebaseConfig) :
|
||||
rebaseAtRules(tokens, validator, rebaseConfig);
|
||||
}
|
||||
|
||||
function rebaseEverything(tokens, validator, rebaseConfig) {
|
||||
var token;
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = tokens.length; i < l; i++) {
|
||||
token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case Token.AT_RULE:
|
||||
rebaseAtRule(token, validator, rebaseConfig);
|
||||
break;
|
||||
case Token.AT_RULE_BLOCK:
|
||||
rebaseProperties(token[2], validator, rebaseConfig);
|
||||
break;
|
||||
case Token.COMMENT:
|
||||
rebaseSourceMapComment(token, rebaseConfig);
|
||||
break;
|
||||
case Token.NESTED_BLOCK:
|
||||
rebaseEverything(token[2], validator, rebaseConfig);
|
||||
break;
|
||||
case Token.RULE:
|
||||
rebaseProperties(token[2], validator, rebaseConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
function rebaseAtRules(tokens, validator, rebaseConfig) {
|
||||
var token;
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = tokens.length; i < l; i++) {
|
||||
token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case Token.AT_RULE:
|
||||
rebaseAtRule(token, validator, rebaseConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
function rebaseAtRule(token, validator, rebaseConfig) {
|
||||
if (!isImport(token[1])) {
|
||||
return;
|
||||
}
|
||||
|
||||
var uriAndMediaQuery = extractImportUrlAndMedia(token[1]);
|
||||
var newUrl = rewriteUrl(uriAndMediaQuery[0], rebaseConfig);
|
||||
var mediaQuery = uriAndMediaQuery[1];
|
||||
|
||||
token[1] = restoreImport(newUrl, mediaQuery);
|
||||
}
|
||||
|
||||
function rebaseSourceMapComment(token, rebaseConfig) {
|
||||
var matches = SOURCE_MAP_COMMENT_PATTERN.exec(token[1]);
|
||||
|
||||
if (matches && matches[1].indexOf('data:') === -1) {
|
||||
token[1] = token[1].replace(matches[1], rewriteUrl(matches[1], rebaseConfig, true));
|
||||
}
|
||||
}
|
||||
|
||||
function rebaseProperties(properties, validator, rebaseConfig) {
|
||||
var property;
|
||||
var value;
|
||||
var i, l;
|
||||
var j, m;
|
||||
|
||||
for (i = 0, l = properties.length; i < l; i++) {
|
||||
property = properties[i];
|
||||
|
||||
for (j = 2 /* 0 is Token.PROPERTY, 1 is name */, m = property.length; j < m; j++) {
|
||||
value = property[j][1];
|
||||
|
||||
if (validator.isUrl(value)) {
|
||||
property[j][1] = rewriteUrl(value, rebaseConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rebase;
|
||||
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var $isFinite = require('../helpers/isFinite');
|
||||
var msPerDay = require('../helpers/timeConstants').msPerDay;
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-15.9.1.13
|
||||
|
||||
module.exports = function MakeDate(day, time) {
|
||||
if (!$isFinite(day) || !$isFinite(time)) {
|
||||
return NaN;
|
||||
}
|
||||
return (day * msPerDay) + time;
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
# picocolors
|
||||
|
||||
The tiniest and the fastest library for terminal output formatting with ANSI colors.
|
||||
|
||||
```javascript
|
||||
import pc from "picocolors"
|
||||
|
||||
console.log(
|
||||
pc.green(`How are ${pc.italic(`you`)} doing?`)
|
||||
)
|
||||
```
|
||||
|
||||
- **No dependencies.**
|
||||
- **14 times** smaller and **2 times** faster than chalk.
|
||||
- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist.
|
||||
- Node.js v6+ & browsers support. Support for both CJS and ESM projects.
|
||||
- TypeScript type declarations included.
|
||||
- [`NO_COLOR`](https://no-color.org/) friendly.
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub.
|
||||
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
// Dependencies
|
||||
var isSsh = require("../lib"),
|
||||
tester = require("tester");
|
||||
|
||||
// Prepare the input data
|
||||
var input = [
|
||||
// Secure Shell Transport Protocol (SSH)
|
||||
["ssh://user@host.xz:port/path/to/repo.git/", true], ["ssh://user@host.xz/path/to/repo.git/", true], ["ssh://host.xz:port/path/to/repo.git/", true], ["ssh://host.xz/path/to/repo.git/", true], ["ssh://user@host.xz/path/to/repo.git/", true], ["ssh://host.xz/path/to/repo.git/", true], ["ssh://user@host.xz/~user/path/to/repo.git/", true], ["ssh://host.xz/~user/path/to/repo.git/", true], ["ssh://user@host.xz/~/path/to/repo.git", true], ["ssh://host.xz/~/path/to/repo.git", true], ["user@host.xz:/path/to/repo.git/", true], ["user@host.xz:~user/path/to/repo.git/", true], ["user@host.xz:path/to/repo.git", true], ["host.xz:/path/to/repo.git/", true], ["host.xz:path/to/repo.git", true], ["host.xz:~user/path/to/repo.git/", true], ["rsync://host.xz/path/to/repo.git/", true]
|
||||
|
||||
// Git Transport Protocol
|
||||
, ["git://host.xz/path/to/repo.git/", false], ["git://host.xz/~user/path/to/repo.git/", false]
|
||||
|
||||
// HTTP/S Transport Protocol
|
||||
, ["http://host.xz/path/to/repo.git/", false], ["https://host.xz/path/to/repo.git/", false], ["http://host.xz:8000/path/to/repo.git/", false], ["https://host.xz:8000/path/to/repo.git/", false]
|
||||
// Local (Filesystem) Transport Protocol
|
||||
, ["/path/to/repo.git/", false], ["path/to/repo.git/", false], ["~/path/to/repo.git", false], ["file:///path/to/repo.git/", false], ["file://~/path/to/repo.git/", false]];
|
||||
|
||||
tester.describe("check urls", function (test) {
|
||||
// Run the tests
|
||||
input.forEach(function (c) {
|
||||
test.it(c[0] + " is supposed " + (!c[1] ? "not " : "") + "to be a ssh url", function () {
|
||||
test.expect(isSsh(c[0])).toBe(c[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"ansi-styles","version":"3.2.1","files":{"license":{"checkedAt":1678883669272,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"package.json":{"checkedAt":1678883670570,"integrity":"sha512-yzeJ/2MjB2GTzOPisZjtZdXkGuEZQ197gZvFmRfWx5XIpfYHkWIwwSSN+o491vKglAGt8VlEqeKPbWedLDdQyg==","mode":420,"size":977},"index.js":{"checkedAt":1678883670570,"integrity":"sha512-FDWPgc80FEs5ECfQapPaGlBymENEApliYavWaix6IDHGTjJhas1XdUD81WPsZKETheRAh5L+HLoeZwfxbw5sPw==","mode":420,"size":3574},"readme.md":{"checkedAt":1678883670570,"integrity":"sha512-wq/mIcJB7wXT8ay7i9rQhwClrWN5mq1wAzRDaA6qrhRjq9li8/118Y36cfgbKNsnHuxPuo76ZxqiSy8fsG/iow==","mode":420,"size":3711}}}
|
||||
@@ -0,0 +1,417 @@
|
||||
/**
|
||||
* Index.js
|
||||
*
|
||||
* a request API compatible with window.fetch
|
||||
*
|
||||
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
|
||||
*/
|
||||
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import zlib from 'node:zlib';
|
||||
import Stream, {PassThrough, pipeline as pump} from 'node:stream';
|
||||
import {Buffer} from 'node:buffer';
|
||||
|
||||
import dataUriToBuffer from 'data-uri-to-buffer';
|
||||
|
||||
import {writeToStream, clone} from './body.js';
|
||||
import Response from './response.js';
|
||||
import Headers, {fromRawHeaders} from './headers.js';
|
||||
import Request, {getNodeRequestOptions} from './request.js';
|
||||
import {FetchError} from './errors/fetch-error.js';
|
||||
import {AbortError} from './errors/abort-error.js';
|
||||
import {isRedirect} from './utils/is-redirect.js';
|
||||
import {FormData} from 'formdata-polyfill/esm.min.js';
|
||||
import {isDomainOrSubdomain, isSameProtocol} from './utils/is.js';
|
||||
import {parseReferrerPolicyFromHeader} from './utils/referrer.js';
|
||||
import {
|
||||
Blob,
|
||||
File,
|
||||
fileFromSync,
|
||||
fileFrom,
|
||||
blobFromSync,
|
||||
blobFrom
|
||||
} from 'fetch-blob/from.js';
|
||||
|
||||
export {FormData, Headers, Request, Response, FetchError, AbortError, isRedirect};
|
||||
export {Blob, File, fileFromSync, fileFrom, blobFromSync, blobFrom};
|
||||
|
||||
const supportedSchemas = new Set(['data:', 'http:', 'https:']);
|
||||
|
||||
/**
|
||||
* Fetch function
|
||||
*
|
||||
* @param {string | URL | import('./request').default} url - Absolute url or Request instance
|
||||
* @param {*} [options_] - Fetch options
|
||||
* @return {Promise<import('./response').default>}
|
||||
*/
|
||||
export default async function fetch(url, options_) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Build request object
|
||||
const request = new Request(url, options_);
|
||||
const {parsedURL, options} = getNodeRequestOptions(request);
|
||||
if (!supportedSchemas.has(parsedURL.protocol)) {
|
||||
throw new TypeError(`node-fetch cannot load ${url}. URL scheme "${parsedURL.protocol.replace(/:$/, '')}" is not supported.`);
|
||||
}
|
||||
|
||||
if (parsedURL.protocol === 'data:') {
|
||||
const data = dataUriToBuffer(request.url);
|
||||
const response = new Response(data, {headers: {'Content-Type': data.typeFull}});
|
||||
resolve(response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wrap http.request into fetch
|
||||
const send = (parsedURL.protocol === 'https:' ? https : http).request;
|
||||
const {signal} = request;
|
||||
let response = null;
|
||||
|
||||
const abort = () => {
|
||||
const error = new AbortError('The operation was aborted.');
|
||||
reject(error);
|
||||
if (request.body && request.body instanceof Stream.Readable) {
|
||||
request.body.destroy(error);
|
||||
}
|
||||
|
||||
if (!response || !response.body) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.body.emit('error', error);
|
||||
};
|
||||
|
||||
if (signal && signal.aborted) {
|
||||
abort();
|
||||
return;
|
||||
}
|
||||
|
||||
const abortAndFinalize = () => {
|
||||
abort();
|
||||
finalize();
|
||||
};
|
||||
|
||||
// Send request
|
||||
const request_ = send(parsedURL.toString(), options);
|
||||
|
||||
if (signal) {
|
||||
signal.addEventListener('abort', abortAndFinalize);
|
||||
}
|
||||
|
||||
const finalize = () => {
|
||||
request_.abort();
|
||||
if (signal) {
|
||||
signal.removeEventListener('abort', abortAndFinalize);
|
||||
}
|
||||
};
|
||||
|
||||
request_.on('error', error => {
|
||||
reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));
|
||||
finalize();
|
||||
});
|
||||
|
||||
fixResponseChunkedTransferBadEnding(request_, error => {
|
||||
if (response && response.body) {
|
||||
response.body.destroy(error);
|
||||
}
|
||||
});
|
||||
|
||||
/* c8 ignore next 18 */
|
||||
if (process.version < 'v14') {
|
||||
// Before Node.js 14, pipeline() does not fully support async iterators and does not always
|
||||
// properly handle when the socket close/end events are out of order.
|
||||
request_.on('socket', s => {
|
||||
let endedWithEventsCount;
|
||||
s.prependListener('end', () => {
|
||||
endedWithEventsCount = s._eventsCount;
|
||||
});
|
||||
s.prependListener('close', hadError => {
|
||||
// if end happened before close but the socket didn't emit an error, do it now
|
||||
if (response && endedWithEventsCount < s._eventsCount && !hadError) {
|
||||
const error = new Error('Premature close');
|
||||
error.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||
response.body.emit('error', error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
request_.on('response', response_ => {
|
||||
request_.setTimeout(0);
|
||||
const headers = fromRawHeaders(response_.rawHeaders);
|
||||
|
||||
// HTTP fetch step 5
|
||||
if (isRedirect(response_.statusCode)) {
|
||||
// HTTP fetch step 5.2
|
||||
const location = headers.get('Location');
|
||||
|
||||
// HTTP fetch step 5.3
|
||||
let locationURL = null;
|
||||
try {
|
||||
locationURL = location === null ? null : new URL(location, request.url);
|
||||
} catch {
|
||||
// error here can only be invalid URL in Location: header
|
||||
// do not throw when options.redirect == manual
|
||||
// let the user extract the errorneous redirect URL
|
||||
if (request.redirect !== 'manual') {
|
||||
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP fetch step 5.5
|
||||
switch (request.redirect) {
|
||||
case 'error':
|
||||
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
case 'manual':
|
||||
// Nothing to do
|
||||
break;
|
||||
case 'follow': {
|
||||
// HTTP-redirect fetch step 2
|
||||
if (locationURL === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 5
|
||||
if (request.counter >= request.follow) {
|
||||
reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 6 (counter increment)
|
||||
// Create a new Request object.
|
||||
const requestOptions = {
|
||||
headers: new Headers(request.headers),
|
||||
follow: request.follow,
|
||||
counter: request.counter + 1,
|
||||
agent: request.agent,
|
||||
compress: request.compress,
|
||||
method: request.method,
|
||||
body: clone(request),
|
||||
signal: request.signal,
|
||||
size: request.size,
|
||||
referrer: request.referrer,
|
||||
referrerPolicy: request.referrerPolicy
|
||||
};
|
||||
|
||||
// when forwarding sensitive headers like "Authorization",
|
||||
// "WWW-Authenticate", and "Cookie" to untrusted targets,
|
||||
// headers will be ignored when following a redirect to a domain
|
||||
// that is not a subdomain match or exact match of the initial domain.
|
||||
// For example, a redirect from "foo.com" to either "foo.com" or "sub.foo.com"
|
||||
// will forward the sensitive headers, but a redirect to "bar.com" will not.
|
||||
// headers will also be ignored when following a redirect to a domain using
|
||||
// a different protocol. For example, a redirect from "https://foo.com" to "http://foo.com"
|
||||
// will not forward the sensitive headers
|
||||
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||
requestOptions.headers.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 9
|
||||
if (response_.statusCode !== 303 && request.body && options_.body instanceof Stream.Readable) {
|
||||
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 11
|
||||
if (response_.statusCode === 303 || ((response_.statusCode === 301 || response_.statusCode === 302) && request.method === 'POST')) {
|
||||
requestOptions.method = 'GET';
|
||||
requestOptions.body = undefined;
|
||||
requestOptions.headers.delete('content-length');
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 14
|
||||
const responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);
|
||||
if (responseReferrerPolicy) {
|
||||
requestOptions.referrerPolicy = responseReferrerPolicy;
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 15
|
||||
resolve(fetch(new Request(locationURL, requestOptions)));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
return reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare response
|
||||
if (signal) {
|
||||
response_.once('end', () => {
|
||||
signal.removeEventListener('abort', abortAndFinalize);
|
||||
});
|
||||
}
|
||||
|
||||
let body = pump(response_, new PassThrough(), error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
// see https://github.com/nodejs/node/pull/29376
|
||||
/* c8 ignore next 3 */
|
||||
if (process.version < 'v12.10') {
|
||||
response_.on('aborted', abortAndFinalize);
|
||||
}
|
||||
|
||||
const responseOptions = {
|
||||
url: request.url,
|
||||
status: response_.statusCode,
|
||||
statusText: response_.statusMessage,
|
||||
headers,
|
||||
size: request.size,
|
||||
counter: request.counter,
|
||||
highWaterMark: request.highWaterMark
|
||||
};
|
||||
|
||||
// HTTP-network fetch step 12.1.1.3
|
||||
const codings = headers.get('Content-Encoding');
|
||||
|
||||
// HTTP-network fetch step 12.1.1.4: handle content codings
|
||||
|
||||
// in following scenarios we ignore compression support
|
||||
// 1. compression support is disabled
|
||||
// 2. HEAD request
|
||||
// 3. no Content-Encoding header
|
||||
// 4. no content response (204)
|
||||
// 5. content not modified response (304)
|
||||
if (!request.compress || request.method === 'HEAD' || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
|
||||
response = new Response(body, responseOptions);
|
||||
resolve(response);
|
||||
return;
|
||||
}
|
||||
|
||||
// For Node v6+
|
||||
// Be less strict when decoding compressed responses, since sometimes
|
||||
// servers send slightly invalid responses that are still accepted
|
||||
// by common browsers.
|
||||
// Always using Z_SYNC_FLUSH is what cURL does.
|
||||
const zlibOptions = {
|
||||
flush: zlib.Z_SYNC_FLUSH,
|
||||
finishFlush: zlib.Z_SYNC_FLUSH
|
||||
};
|
||||
|
||||
// For gzip
|
||||
if (codings === 'gzip' || codings === 'x-gzip') {
|
||||
body = pump(body, zlib.createGunzip(zlibOptions), error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
response = new Response(body, responseOptions);
|
||||
resolve(response);
|
||||
return;
|
||||
}
|
||||
|
||||
// For deflate
|
||||
if (codings === 'deflate' || codings === 'x-deflate') {
|
||||
// Handle the infamous raw deflate response from old servers
|
||||
// a hack for old IIS and Apache servers
|
||||
const raw = pump(response_, new PassThrough(), error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
raw.once('data', chunk => {
|
||||
// See http://stackoverflow.com/questions/37519828
|
||||
if ((chunk[0] & 0x0F) === 0x08) {
|
||||
body = pump(body, zlib.createInflate(), error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
body = pump(body, zlib.createInflateRaw(), error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
response = new Response(body, responseOptions);
|
||||
resolve(response);
|
||||
});
|
||||
raw.once('end', () => {
|
||||
// Some old IIS servers return zero-length OK deflate responses, so
|
||||
// 'data' is never emitted. See https://github.com/node-fetch/node-fetch/pull/903
|
||||
if (!response) {
|
||||
response = new Response(body, responseOptions);
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// For br
|
||||
if (codings === 'br') {
|
||||
body = pump(body, zlib.createBrotliDecompress(), error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
response = new Response(body, responseOptions);
|
||||
resolve(response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, use response as-is
|
||||
response = new Response(body, responseOptions);
|
||||
resolve(response);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line promise/prefer-await-to-then
|
||||
writeToStream(request_, request).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
||||
const LAST_CHUNK = Buffer.from('0\r\n\r\n');
|
||||
|
||||
let isChunkedTransfer = false;
|
||||
let properLastChunkReceived = false;
|
||||
let previousChunk;
|
||||
|
||||
request.on('response', response => {
|
||||
const {headers} = response;
|
||||
isChunkedTransfer = headers['transfer-encoding'] === 'chunked' && !headers['content-length'];
|
||||
});
|
||||
|
||||
request.on('socket', socket => {
|
||||
const onSocketClose = () => {
|
||||
if (isChunkedTransfer && !properLastChunkReceived) {
|
||||
const error = new Error('Premature close');
|
||||
error.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||
errorCallback(error);
|
||||
}
|
||||
};
|
||||
|
||||
const onData = buf => {
|
||||
properLastChunkReceived = Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;
|
||||
|
||||
// Sometimes final 0-length chunk and end of message code are in separate packets
|
||||
if (!properLastChunkReceived && previousChunk) {
|
||||
properLastChunkReceived = (
|
||||
Buffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 &&
|
||||
Buffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0
|
||||
);
|
||||
}
|
||||
|
||||
previousChunk = buf;
|
||||
};
|
||||
|
||||
socket.prependListener('close', onSocketClose);
|
||||
socket.on('data', onData);
|
||||
|
||||
request.on('close', () => {
|
||||
socket.removeListener('close', onSocketClose);
|
||||
socket.removeListener('data', onData);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
# os-name
|
||||
|
||||
> Get the name of the current operating system\
|
||||
> Example: `macOS Sierra`
|
||||
|
||||
Useful for analytics and debugging.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install os-name
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import os from 'node:os';
|
||||
import osName from 'os-name';
|
||||
|
||||
// On a macOS Sierra system
|
||||
|
||||
osName();
|
||||
//=> 'macOS Sierra'
|
||||
|
||||
osName(os.platform(), os.release());
|
||||
//=> 'macOS Sierra'
|
||||
|
||||
osName('darwin', '14.0.0');
|
||||
//=> 'OS X Yosemite'
|
||||
|
||||
osName('linux', '3.13.0-24-generic');
|
||||
//=> 'Linux 3.13'
|
||||
|
||||
osName('win32', '6.3.9600');
|
||||
//=> 'Windows 8.1'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### osName(platform?, release?)
|
||||
|
||||
By default, the name of the current operating system is returned.
|
||||
|
||||
You can optionally supply a custom [`os.platform()`](https://nodejs.org/api/os.html#os_os_platform) and [`os.release()`](https://nodejs.org/api/os.html#os_os_release).
|
||||
|
||||
Check out [`getos`](https://github.com/wblankenship/getos) if you need the Linux distribution name.
|
||||
|
||||
## Contributing
|
||||
|
||||
Production systems depend on this package for logging / tracking. Please be careful when introducing new output, and adhere to existing output format (whitespace, capitalization, etc.).
|
||||
|
||||
## Related
|
||||
|
||||
- [os-name-cli](https://github.com/sindresorhus/os-name-cli) - CLI for this module
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-os-name?utm_source=npm-os-name&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,144 @@
|
||||
import assertString from './util/assertString';
|
||||
/**
|
||||
* Reference:
|
||||
* https://en.wikipedia.org/ -- Wikipedia
|
||||
* https://docs.microsoft.com/en-us/microsoft-365/compliance/eu-passport-number -- EU Passport Number
|
||||
* https://countrycode.org/ -- Country Codes
|
||||
*/
|
||||
|
||||
var passportRegexByCountryCode = {
|
||||
AM: /^[A-Z]{2}\d{7}$/,
|
||||
// ARMENIA
|
||||
AR: /^[A-Z]{3}\d{6}$/,
|
||||
// ARGENTINA
|
||||
AT: /^[A-Z]\d{7}$/,
|
||||
// AUSTRIA
|
||||
AU: /^[A-Z]\d{7}$/,
|
||||
// AUSTRALIA
|
||||
AZ: /^[A-Z]{2,3}\d{7,8}$/,
|
||||
// AZERBAIJAN
|
||||
BE: /^[A-Z]{2}\d{6}$/,
|
||||
// BELGIUM
|
||||
BG: /^\d{9}$/,
|
||||
// BULGARIA
|
||||
BR: /^[A-Z]{2}\d{6}$/,
|
||||
// BRAZIL
|
||||
BY: /^[A-Z]{2}\d{7}$/,
|
||||
// BELARUS
|
||||
CA: /^[A-Z]{2}\d{6}$/,
|
||||
// CANADA
|
||||
CH: /^[A-Z]\d{7}$/,
|
||||
// SWITZERLAND
|
||||
CN: /^G\d{8}$|^E(?![IO])[A-Z0-9]\d{7}$/,
|
||||
// CHINA [G=Ordinary, E=Electronic] followed by 8-digits, or E followed by any UPPERCASE letter (except I and O) followed by 7 digits
|
||||
CY: /^[A-Z](\d{6}|\d{8})$/,
|
||||
// CYPRUS
|
||||
CZ: /^\d{8}$/,
|
||||
// CZECH REPUBLIC
|
||||
DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/,
|
||||
// GERMANY
|
||||
DK: /^\d{9}$/,
|
||||
// DENMARK
|
||||
DZ: /^\d{9}$/,
|
||||
// ALGERIA
|
||||
EE: /^([A-Z]\d{7}|[A-Z]{2}\d{7})$/,
|
||||
// ESTONIA (K followed by 7-digits), e-passports have 2 UPPERCASE followed by 7 digits
|
||||
ES: /^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/,
|
||||
// SPAIN
|
||||
FI: /^[A-Z]{2}\d{7}$/,
|
||||
// FINLAND
|
||||
FR: /^\d{2}[A-Z]{2}\d{5}$/,
|
||||
// FRANCE
|
||||
GB: /^\d{9}$/,
|
||||
// UNITED KINGDOM
|
||||
GR: /^[A-Z]{2}\d{7}$/,
|
||||
// GREECE
|
||||
HR: /^\d{9}$/,
|
||||
// CROATIA
|
||||
HU: /^[A-Z]{2}(\d{6}|\d{7})$/,
|
||||
// HUNGARY
|
||||
IE: /^[A-Z0-9]{2}\d{7}$/,
|
||||
// IRELAND
|
||||
IN: /^[A-Z]{1}-?\d{7}$/,
|
||||
// INDIA
|
||||
ID: /^[A-C]\d{7}$/,
|
||||
// INDONESIA
|
||||
IR: /^[A-Z]\d{8}$/,
|
||||
// IRAN
|
||||
IS: /^(A)\d{7}$/,
|
||||
// ICELAND
|
||||
IT: /^[A-Z0-9]{2}\d{7}$/,
|
||||
// ITALY
|
||||
JM: /^[Aa]\d{7}$/,
|
||||
// JAMAICA
|
||||
JP: /^[A-Z]{2}\d{7}$/,
|
||||
// JAPAN
|
||||
KR: /^[MS]\d{8}$/,
|
||||
// SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports]
|
||||
KZ: /^[a-zA-Z]\d{7}$/,
|
||||
// KAZAKHSTAN
|
||||
LI: /^[a-zA-Z]\d{5}$/,
|
||||
// LIECHTENSTEIN
|
||||
LT: /^[A-Z0-9]{8}$/,
|
||||
// LITHUANIA
|
||||
LU: /^[A-Z0-9]{8}$/,
|
||||
// LUXEMBURG
|
||||
LV: /^[A-Z0-9]{2}\d{7}$/,
|
||||
// LATVIA
|
||||
LY: /^[A-Z0-9]{8}$/,
|
||||
// LIBYA
|
||||
MT: /^\d{7}$/,
|
||||
// MALTA
|
||||
MZ: /^([A-Z]{2}\d{7})|(\d{2}[A-Z]{2}\d{5})$/,
|
||||
// MOZAMBIQUE
|
||||
MY: /^[AHK]\d{8}$/,
|
||||
// MALAYSIA
|
||||
MX: /^\d{10,11}$/,
|
||||
// MEXICO
|
||||
NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/,
|
||||
// NETHERLANDS
|
||||
NZ: /^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\d{6}$/,
|
||||
// NEW ZEALAND
|
||||
PH: /^([A-Z](\d{6}|\d{7}[A-Z]))|([A-Z]{2}(\d{6}|\d{7}))$/,
|
||||
// PHILIPPINES
|
||||
PK: /^[A-Z]{2}\d{7}$/,
|
||||
// PAKISTAN
|
||||
PL: /^[A-Z]{2}\d{7}$/,
|
||||
// POLAND
|
||||
PT: /^[A-Z]\d{6}$/,
|
||||
// PORTUGAL
|
||||
RO: /^\d{8,9}$/,
|
||||
// ROMANIA
|
||||
RU: /^\d{9}$/,
|
||||
// RUSSIAN FEDERATION
|
||||
SE: /^\d{8}$/,
|
||||
// SWEDEN
|
||||
SL: /^(P)[A-Z]\d{7}$/,
|
||||
// SLOVENIA
|
||||
SK: /^[0-9A-Z]\d{7}$/,
|
||||
// SLOVAKIA
|
||||
TH: /^[A-Z]{1,2}\d{6,7}$/,
|
||||
// THAILAND
|
||||
TR: /^[A-Z]\d{8}$/,
|
||||
// TURKEY
|
||||
UA: /^[A-Z]{2}\d{6}$/,
|
||||
// UKRAINE
|
||||
US: /^\d{9}$/ // UNITED STATES
|
||||
|
||||
};
|
||||
/**
|
||||
* Check if str is a valid passport number
|
||||
* relative to provided ISO Country Code.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {string} countryCode
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
export default function isPassportNumber(str, countryCode) {
|
||||
assertString(str);
|
||||
/** Remove All Whitespaces, Convert to UPPERCASE */
|
||||
|
||||
var normalizedStr = str.replace(/\s/g, '').toUpperCase();
|
||||
return countryCode.toUpperCase() in passportRegexByCountryCode && passportRegexByCountryCode[countryCode].test(normalizedStr);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var ES5Type = require('../5/Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values
|
||||
|
||||
module.exports = function Type(x) {
|
||||
if (typeof x === 'symbol') {
|
||||
return 'Symbol';
|
||||
}
|
||||
if (typeof x === 'bigint') {
|
||||
return 'BigInt';
|
||||
}
|
||||
return ES5Type(x);
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import CSVError from "./CSVError";
|
||||
import assert from "assert";
|
||||
describe("CSVError",()=>{
|
||||
it ("should toString()",()=>{
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C K L G M N O w g x y z EC FC","194":"0 1 2 3 4 5 6 7 8 9"},D:{"1":"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 h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 I v J D E F A B C K L G M N O w g x y z","33":"5 6 7 8"},E:{"1":"A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J HC zB IC JC","33":"D E F KC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C G PC QC RC SC qB AC TC rB","33":"M N O w"},G:{"1":"fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC WC XC","33":"E YC ZC aC bC cC dC eC"},H:{"2":"oC"},I:{"1":"f uC","2":"tB I pC qC rC sC BC","33":"tC"},J:{"2":"D","33":"A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:4,C:"CSS3 font-kerning"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e PC QC RC SC qB AC TC rB"},G:{"1":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"1":"oC"},I:{"1":"tB I f pC qC rC sC BC tC uC"},J:{"1":"D A"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"naturalWidth & naturalHeight image properties"};
|
||||
@@ -0,0 +1,4 @@
|
||||
export function not(pred, thisArg) {
|
||||
return function (value, index) { return !pred.call(thisArg, value, index); };
|
||||
}
|
||||
//# sourceMappingURL=not.js.map
|
||||
@@ -0,0 +1,34 @@
|
||||
import type {PascalCase} from './pascal-case';
|
||||
|
||||
/**
|
||||
Convert object properties to pascal case but not recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see PascalCase
|
||||
@see PascalCasedPropertiesDeep
|
||||
|
||||
@example
|
||||
```
|
||||
import type {PascalCasedProperties} from 'type-fest';
|
||||
|
||||
interface User {
|
||||
userId: number;
|
||||
userName: string;
|
||||
}
|
||||
|
||||
const result: PascalCasedProperties<User> = {
|
||||
UserId: 1,
|
||||
UserName: 'Tom',
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
@category Object
|
||||
*/
|
||||
export type PascalCasedProperties<Value> = Value extends Function
|
||||
? Value
|
||||
: Value extends Array<infer U>
|
||||
? Value
|
||||
: {[K in keyof Value as PascalCase<K>]: Value[K]};
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (from, to, events) => {
|
||||
for (const event of events) {
|
||||
from.on(event, (...args) => to.emit(event, ...args));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "merge-stream",
|
||||
"version": "2.0.0",
|
||||
"description": "Create a stream that emits events from multiple other streams",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "istanbul cover test.js && istanbul check-cover --statements 100 --branches 100"
|
||||
},
|
||||
"repository": "grncdr/merge-stream",
|
||||
"author": "Stephen Sugden <me@stephensugden.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"from2": "^2.0.3",
|
||||
"istanbul": "^0.4.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
var callable = require("es5-ext/object/valid-callable")
|
||||
, nextTick = require("next-tick")
|
||||
, validTimeout = require("./valid-timeout");
|
||||
|
||||
var apply = Function.prototype.apply;
|
||||
|
||||
module.exports = function (fn/*, timeout*/) {
|
||||
var delay, timeout = arguments[1];
|
||||
callable(fn);
|
||||
if (timeout === undefined) {
|
||||
delay = nextTick;
|
||||
} else {
|
||||
timeout = validTimeout(timeout);
|
||||
delay = setTimeout;
|
||||
}
|
||||
return function () {
|
||||
return delay(apply.bind(fn, this, arguments), timeout);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": "off",
|
||||
"new-cap": ["error", {
|
||||
"capIsNewExceptions": [
|
||||
"RequireObjectCoercible",
|
||||
],
|
||||
}],
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"id-length": 0,
|
||||
"no-invalid-this": 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errorContext.js","sourceRoot":"","sources":["../../../../src/internal/util/errorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,IAAI,OAAO,GAAgD,IAAI,CAAC;AAShE,MAAM,UAAU,YAAY,CAAC,EAAc;IACzC,IAAI,MAAM,CAAC,qCAAqC,EAAE;QAChD,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC;QACxB,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SAC/C;QACD,EAAE,EAAE,CAAC;QACL,IAAI,MAAM,EAAE;YACV,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,OAAQ,CAAC;YACxC,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,WAAW,EAAE;gBACf,MAAM,KAAK,CAAC;aACb;SACF;KACF;SAAM;QAGL,EAAE,EAAE,CAAC;KACN;AACH,CAAC;AAMD,MAAM,UAAU,YAAY,CAAC,GAAQ;IACnC,IAAI,MAAM,CAAC,qCAAqC,IAAI,OAAO,EAAE;QAC3D,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC;KACrB;AACH,CAAC"}
|
||||
@@ -0,0 +1,165 @@
|
||||
[](https://www.npmjs.com/package/human-signals)
|
||||
[](/types/main.d.ts)
|
||||
[](https://codecov.io/gh/ehmicky/human-signals)
|
||||
[](https://twitter.com/intent/follow?screen_name=ehmicky)
|
||||
[](https://medium.com/@ehmicky)
|
||||
|
||||
Human-friendly process signals.
|
||||
|
||||
This is a map of known process signals with some information about each signal.
|
||||
|
||||
Unlike
|
||||
[`os.constants.signals`](https://nodejs.org/api/os.html#os_signal_constants)
|
||||
this includes:
|
||||
|
||||
- human-friendly [descriptions](#description)
|
||||
- [default actions](#action), including whether they [can be prevented](#forced)
|
||||
- whether the signal is [supported](#supported) by the current OS
|
||||
|
||||
# Example
|
||||
|
||||
```js
|
||||
import { signalsByName, signalsByNumber } from 'human-signals'
|
||||
|
||||
console.log(signalsByName.SIGINT)
|
||||
// {
|
||||
// name: 'SIGINT',
|
||||
// number: 2,
|
||||
// description: 'User interruption with CTRL-C',
|
||||
// supported: true,
|
||||
// action: 'terminate',
|
||||
// forced: false,
|
||||
// standard: 'ansi'
|
||||
// }
|
||||
|
||||
console.log(signalsByNumber[8])
|
||||
// {
|
||||
// name: 'SIGFPE',
|
||||
// number: 8,
|
||||
// description: 'Floating point arithmetic error',
|
||||
// supported: true,
|
||||
// action: 'core',
|
||||
// forced: false,
|
||||
// standard: 'ansi'
|
||||
// }
|
||||
```
|
||||
|
||||
# Install
|
||||
|
||||
```bash
|
||||
npm install human-signals
|
||||
```
|
||||
|
||||
This package works in Node.js >=14.18.0. It is an ES module and must be loaded
|
||||
using
|
||||
[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),
|
||||
not `require()`.
|
||||
|
||||
# Usage
|
||||
|
||||
## signalsByName
|
||||
|
||||
_Type_: `object`
|
||||
|
||||
Object whose keys are signal [names](#name) and values are
|
||||
[signal objects](#signal).
|
||||
|
||||
## signalsByNumber
|
||||
|
||||
_Type_: `object`
|
||||
|
||||
Object whose keys are signal [numbers](#number) and values are
|
||||
[signal objects](#signal).
|
||||
|
||||
## signal
|
||||
|
||||
_Type_: `object`
|
||||
|
||||
Signal object with the following properties.
|
||||
|
||||
### name
|
||||
|
||||
_Type_: `string`
|
||||
|
||||
Standard name of the signal, for example `'SIGINT'`.
|
||||
|
||||
### number
|
||||
|
||||
_Type_: `number`
|
||||
|
||||
Code number of the signal, for example `2`. While most `number` are
|
||||
cross-platform, some are different between different OS.
|
||||
|
||||
### description
|
||||
|
||||
_Type_: `string`
|
||||
|
||||
Human-friendly description for the signal, for example
|
||||
`'User interruption with CTRL-C'`.
|
||||
|
||||
### supported
|
||||
|
||||
_Type_: `boolean`
|
||||
|
||||
Whether the current OS can handle this signal in Node.js using
|
||||
[`process.on(name, handler)`](https://nodejs.org/api/process.html#process_signal_events).
|
||||
|
||||
The list of supported signals
|
||||
[is OS-specific](https://github.com/ehmicky/cross-platform-node-guide/blob/main/docs/6_networking_ipc/signals.md#cross-platform-signals).
|
||||
|
||||
### action
|
||||
|
||||
_Type_: `string`\
|
||||
_Enum_: `'terminate'`, `'core'`, `'ignore'`, `'pause'`, `'unpause'`
|
||||
|
||||
What is the default action for this signal when it is not handled.
|
||||
|
||||
### forced
|
||||
|
||||
_Type_: `boolean`
|
||||
|
||||
Whether the signal's default action cannot be prevented. This is `true` for
|
||||
`SIGTERM`, `SIGKILL` and `SIGSTOP`.
|
||||
|
||||
### standard
|
||||
|
||||
_Type_: `string`\
|
||||
_Enum_: `'ansi'`, `'posix'`, `'bsd'`, `'systemv'`, `'other'`
|
||||
|
||||
Which standard defined that signal.
|
||||
|
||||
# Support
|
||||
|
||||
For any question, _don't hesitate_ to [submit an issue on GitHub](../../issues).
|
||||
|
||||
Everyone is welcome regardless of personal background. We enforce a
|
||||
[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and
|
||||
inclusive environment.
|
||||
|
||||
# Contributing
|
||||
|
||||
This project was made with ❤️. The simplest way to give back is by starring and
|
||||
sharing it online.
|
||||
|
||||
If the documentation is unclear or has a typo, please click on the page's `Edit`
|
||||
button (pencil icon) and suggest a correction.
|
||||
|
||||
If you would like to help us fix a bug or add a new feature, please check our
|
||||
[guidelines](CONTRIBUTING.md). Pull requests are welcome!
|
||||
|
||||
Thanks go to our wonderful contributors:
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="https://twitter.com/ehmicky"><img src="https://avatars2.githubusercontent.com/u/8136211?v=4" width="100px;" alt=""/><br /><sub><b>ehmicky</b></sub></a><br /><a href="https://github.com/ehmicky/human-signals/commits?author=ehmicky" title="Code">💻</a> <a href="#design-ehmicky" title="Design">🎨</a> <a href="#ideas-ehmicky" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ehmicky/human-signals/commits?author=ehmicky" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://www.electrovir.com"><img src="https://avatars0.githubusercontent.com/u/1205860?v=4" width="100px;" alt=""/><br /><sub><b>electrovir</b></sub></a><br /><a href="https://github.com/ehmicky/human-signals/commits?author=electrovir" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-enable -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
@@ -0,0 +1,16 @@
|
||||
export interface AnimationConfig {
|
||||
delay?: number;
|
||||
duration?: number;
|
||||
easing?: (t: number) => number;
|
||||
css?: (t: number, u: number) => string;
|
||||
tick?: (t: number, u: number) => void;
|
||||
}
|
||||
export interface FlipParams {
|
||||
delay?: number;
|
||||
duration?: number | ((len: number) => number);
|
||||
easing?: (t: number) => number;
|
||||
}
|
||||
export declare function flip(node: Element, { from, to }: {
|
||||
from: DOMRect;
|
||||
to: DOMRect;
|
||||
}, params?: FlipParams): AnimationConfig;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $Date = GetIntrinsic('%Date%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-15.9.1.3
|
||||
|
||||
module.exports = function YearFromTime(t) {
|
||||
// largest y such that this.TimeFromYear(y) <= t
|
||||
return $getUTCFullYear(new $Date(t));
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { AsapAction } from './AsapAction';
|
||||
import { AsapScheduler } from './AsapScheduler';
|
||||
export const asapScheduler = new AsapScheduler(AsapAction);
|
||||
export const asap = asapScheduler;
|
||||
//# sourceMappingURL=asap.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"finalize.js","sourceRoot":"","sources":["../../../../src/internal/operators/finalize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA+DvC,MAAM,UAAU,QAAQ,CAAI,QAAoB;IAC9C,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QAGpC,IAAI;YACF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;SAC9B;gBAAS;YACR,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').inject;
|
||||
@@ -0,0 +1,37 @@
|
||||
import type * as mri from 'mri';
|
||||
|
||||
type Arrayable<T> = T | T[];
|
||||
|
||||
declare function sade(usage: string, isSingle?: boolean): sade.Sade;
|
||||
|
||||
declare namespace sade {
|
||||
export type Handler = (...args: any[]) => any;
|
||||
export type Value = number | string | boolean | null;
|
||||
|
||||
export interface LazyOutput {
|
||||
name: string;
|
||||
handler: Handler;
|
||||
args: string[];
|
||||
}
|
||||
|
||||
export interface Sade {
|
||||
command(usage: string, description?: string, options?: {
|
||||
alias?: Arrayable<string>;
|
||||
default?: boolean;
|
||||
}): Sade;
|
||||
|
||||
option(flag: string, description?: string, value?: Value): Sade;
|
||||
action(handler: Handler): Sade;
|
||||
describe(text: Arrayable<string>): Sade;
|
||||
alias(...names: string[]): Sade;
|
||||
example(usage: string): Sade;
|
||||
|
||||
parse(arr: string[], opts: { lazy: true } & mri.Options): LazyOutput;
|
||||
parse(arr: string[], opts?: { lazy?: boolean } & mri.Options): void;
|
||||
|
||||
version(value: string): Sade;
|
||||
help(cmd?: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = sade;
|
||||
@@ -0,0 +1,33 @@
|
||||
var baseInvoke = require('./_baseInvoke'),
|
||||
baseRest = require('./_baseRest');
|
||||
|
||||
/**
|
||||
* The opposite of `_.method`; this method creates a function that invokes
|
||||
* the method at a given path of `object`. Any additional arguments are
|
||||
* provided to the invoked method.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.7.0
|
||||
* @category Util
|
||||
* @param {Object} object The object to query.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new invoker function.
|
||||
* @example
|
||||
*
|
||||
* var array = _.times(3, _.constant),
|
||||
* object = { 'a': array, 'b': array, 'c': array };
|
||||
*
|
||||
* _.map(['a[2]', 'c[0]'], _.methodOf(object));
|
||||
* // => [2, 0]
|
||||
*
|
||||
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
||||
* // => [2, 0]
|
||||
*/
|
||||
var methodOf = baseRest(function(object, args) {
|
||||
return function(path) {
|
||||
return baseInvoke(object, path, args);
|
||||
};
|
||||
});
|
||||
|
||||
module.exports = methodOf;
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "json-buffer",
|
||||
"description": "JSON parse & stringify that supports binary via bops & base64",
|
||||
"version": "3.0.1",
|
||||
"homepage": "https://github.com/dominictarr/json-buffer",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dominictarr/json-buffer.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^4.6.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "set -e; for t in test/*.js; do node $t; done"
|
||||
},
|
||||
"author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)",
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/17..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class BackgroundSize extends Declaration {
|
||||
/**
|
||||
* Duplication parameter for -webkit- browsers
|
||||
*/
|
||||
set(decl, prefix) {
|
||||
let value = decl.value.toLowerCase()
|
||||
if (
|
||||
prefix === '-webkit-' &&
|
||||
!value.includes(' ') &&
|
||||
value !== 'contain' &&
|
||||
value !== 'cover'
|
||||
) {
|
||||
decl.value = decl.value + ' ' + decl.value
|
||||
}
|
||||
return super.set(decl, prefix)
|
||||
}
|
||||
}
|
||||
|
||||
BackgroundSize.names = ['background-size']
|
||||
|
||||
module.exports = BackgroundSize
|
||||
@@ -0,0 +1,37 @@
|
||||
import {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert a string literal to kebab-case.
|
||||
|
||||
This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag.
|
||||
|
||||
@example
|
||||
```
|
||||
import {KebabCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: KebabCase<'fooBar'> = 'foo-bar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type KebabCasedProperties<T> = {
|
||||
[K in keyof T as KebabCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface CliOptions {
|
||||
dryRun: boolean;
|
||||
includeFile: string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const rawCliOptions: KebabCasedProperties<CliOptions> = {
|
||||
'dry-run': true,
|
||||
'include-file': 'bar.js',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
|
||||
@category Template Literals
|
||||
*/
|
||||
export type KebabCase<Value> = DelimiterCase<Value, '-'>;
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var has = require('has');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var getSymbolDescription = require('get-symbol-description');
|
||||
|
||||
var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
|
||||
var IsExtensible = require('./IsExtensible');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-setfunctionname
|
||||
|
||||
module.exports = function SetFunctionName(F, name) {
|
||||
if (typeof F !== 'function') {
|
||||
throw new $TypeError('Assertion failed: `F` must be a function');
|
||||
}
|
||||
if (!IsExtensible(F) || has(F, 'name')) {
|
||||
throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property');
|
||||
}
|
||||
var nameType = Type(name);
|
||||
if (nameType !== 'Symbol' && nameType !== 'String') {
|
||||
throw new $TypeError('Assertion failed: `name` must be a Symbol or a String');
|
||||
}
|
||||
if (nameType === 'Symbol') {
|
||||
var description = getSymbolDescription(name);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
name = typeof description === 'undefined' ? '' : '[' + description + ']';
|
||||
}
|
||||
if (arguments.length > 2) {
|
||||
var prefix = arguments[2];
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
name = prefix + ' ' + name;
|
||||
}
|
||||
return DefinePropertyOrThrow(F, 'name', {
|
||||
'[[Value]]': name,
|
||||
'[[Writable]]': false,
|
||||
'[[Enumerable]]': false,
|
||||
'[[Configurable]]': true
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('lte', require('../lte'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"onErrorResumeNextWith.js","sourceRoot":"","sources":["../../../../src/internal/operators/onErrorResumeNextWith.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,IAAI,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAiFlF,MAAM,UAAU,qBAAqB,CACnC,GAAG,OAAsE;IAMzE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAuC,CAAC;IAElF,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC;AACxD,CAAC;AAKD,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
|
||||
@@ -0,0 +1,4 @@
|
||||
export function identity(x) {
|
||||
return x;
|
||||
}
|
||||
//# sourceMappingURL=identity.js.map
|
||||
@@ -0,0 +1,22 @@
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import pkg from './package.json'
|
||||
|
||||
export default {
|
||||
input: `index.js`,
|
||||
plugins: [
|
||||
commonjs(),
|
||||
resolve(),
|
||||
],
|
||||
output: [
|
||||
{
|
||||
file: pkg.main,
|
||||
format: `cjs`
|
||||
},
|
||||
{
|
||||
name: 'deepmerge',
|
||||
file: 'dist/umd.js',
|
||||
format: `umd`
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,309 @@
|
||||
# fastq
|
||||
|
||||
![ci][ci-url]
|
||||
[![npm version][npm-badge]][npm-url]
|
||||
[![Dependency Status][david-badge]][david-url]
|
||||
|
||||
Fast, in memory work queue.
|
||||
|
||||
Benchmarks (1 million tasks):
|
||||
|
||||
* setImmediate: 812ms
|
||||
* fastq: 854ms
|
||||
* async.queue: 1298ms
|
||||
* neoAsync.queue: 1249ms
|
||||
|
||||
Obtained on node 12.16.1, on a dedicated server.
|
||||
|
||||
If you need zero-overhead series function call, check out
|
||||
[fastseries](http://npm.im/fastseries). For zero-overhead parallel
|
||||
function call, check out [fastparallel](http://npm.im/fastparallel).
|
||||
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
* <a href="#install">Installation</a>
|
||||
* <a href="#usage">Usage</a>
|
||||
* <a href="#api">API</a>
|
||||
* <a href="#license">Licence & copyright</a>
|
||||
|
||||
## Install
|
||||
|
||||
`npm i fastq --save`
|
||||
|
||||
## Usage (callback API)
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
|
||||
const queue = require('fastq')(worker, 1)
|
||||
|
||||
queue.push(42, function (err, result) {
|
||||
if (err) { throw err }
|
||||
console.log('the result is', result)
|
||||
})
|
||||
|
||||
function worker (arg, cb) {
|
||||
cb(null, arg * 2)
|
||||
}
|
||||
```
|
||||
|
||||
## Usage (promise API)
|
||||
|
||||
```js
|
||||
const queue = require('fastq').promise(worker, 1)
|
||||
|
||||
async function worker (arg) {
|
||||
return arg * 2
|
||||
}
|
||||
|
||||
async function run () {
|
||||
const result = await queue.push(42)
|
||||
console.log('the result is', result)
|
||||
}
|
||||
|
||||
run()
|
||||
```
|
||||
|
||||
### Setting "this"
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
|
||||
const that = { hello: 'world' }
|
||||
const queue = require('fastq')(that, worker, 1)
|
||||
|
||||
queue.push(42, function (err, result) {
|
||||
if (err) { throw err }
|
||||
console.log(this)
|
||||
console.log('the result is', result)
|
||||
})
|
||||
|
||||
function worker (arg, cb) {
|
||||
console.log(this)
|
||||
cb(null, arg * 2)
|
||||
}
|
||||
```
|
||||
|
||||
### Using with TypeScript (callback API)
|
||||
|
||||
```ts
|
||||
'use strict'
|
||||
|
||||
import * as fastq from "fastq";
|
||||
import type { queue, done } from "fastq";
|
||||
|
||||
type Task = {
|
||||
id: number
|
||||
}
|
||||
|
||||
const q: queue<Task> = fastq(worker, 1)
|
||||
|
||||
q.push({ id: 42})
|
||||
|
||||
function worker (arg: Task, cb: done) {
|
||||
console.log(arg.id)
|
||||
cb(null)
|
||||
}
|
||||
```
|
||||
|
||||
### Using with TypeScript (promise API)
|
||||
|
||||
```ts
|
||||
'use strict'
|
||||
|
||||
import * as fastq from "fastq";
|
||||
import type { queueAsPromised } from "fastq";
|
||||
|
||||
type Task = {
|
||||
id: number
|
||||
}
|
||||
|
||||
const q: queueAsPromised<Task> = fastq.promise(asyncWorker, 1)
|
||||
|
||||
q.push({ id: 42}).catch((err) => console.error(err))
|
||||
|
||||
async function asyncWorker (arg: Task): Promise<void> {
|
||||
// No need for a try-catch block, fastq handles errors automatically
|
||||
console.log(arg.id)
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
* <a href="#fastqueue"><code>fastqueue()</code></a>
|
||||
* <a href="#push"><code>queue#<b>push()</b></code></a>
|
||||
* <a href="#unshift"><code>queue#<b>unshift()</b></code></a>
|
||||
* <a href="#pause"><code>queue#<b>pause()</b></code></a>
|
||||
* <a href="#resume"><code>queue#<b>resume()</b></code></a>
|
||||
* <a href="#idle"><code>queue#<b>idle()</b></code></a>
|
||||
* <a href="#length"><code>queue#<b>length()</b></code></a>
|
||||
* <a href="#getQueue"><code>queue#<b>getQueue()</b></code></a>
|
||||
* <a href="#kill"><code>queue#<b>kill()</b></code></a>
|
||||
* <a href="#killAndDrain"><code>queue#<b>killAndDrain()</b></code></a>
|
||||
* <a href="#error"><code>queue#<b>error()</b></code></a>
|
||||
* <a href="#concurrency"><code>queue#<b>concurrency</b></code></a>
|
||||
* <a href="#drain"><code>queue#<b>drain</b></code></a>
|
||||
* <a href="#empty"><code>queue#<b>empty</b></code></a>
|
||||
* <a href="#saturated"><code>queue#<b>saturated</b></code></a>
|
||||
* <a href="#promise"><code>fastqueue.promise()</code></a>
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="fastqueue"></a>
|
||||
### fastqueue([that], worker, concurrency)
|
||||
|
||||
Creates a new queue.
|
||||
|
||||
Arguments:
|
||||
|
||||
* `that`, optional context of the `worker` function.
|
||||
* `worker`, worker function, it would be called with `that` as `this`,
|
||||
if that is specified.
|
||||
* `concurrency`, number of concurrent tasks that could be executed in
|
||||
parallel.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="push"></a>
|
||||
### queue.push(task, done)
|
||||
|
||||
Add a task at the end of the queue. `done(err, result)` will be called
|
||||
when the task was processed.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="unshift"></a>
|
||||
### queue.unshift(task, done)
|
||||
|
||||
Add a task at the beginning of the queue. `done(err, result)` will be called
|
||||
when the task was processed.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="pause"></a>
|
||||
### queue.pause()
|
||||
|
||||
Pause the processing of tasks. Currently worked tasks are not
|
||||
stopped.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="resume"></a>
|
||||
### queue.resume()
|
||||
|
||||
Resume the processing of tasks.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="idle"></a>
|
||||
### queue.idle()
|
||||
|
||||
Returns `false` if there are tasks being processed or waiting to be processed.
|
||||
`true` otherwise.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="length"></a>
|
||||
### queue.length()
|
||||
|
||||
Returns the number of tasks waiting to be processed (in the queue).
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="getQueue"></a>
|
||||
### queue.getQueue()
|
||||
|
||||
Returns all the tasks be processed (in the queue). Returns empty array when there are no tasks
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="kill"></a>
|
||||
### queue.kill()
|
||||
|
||||
Removes all tasks waiting to be processed, and reset `drain` to an empty
|
||||
function.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="killAndDrain"></a>
|
||||
### queue.killAndDrain()
|
||||
|
||||
Same than `kill` but the `drain` function will be called before reset to empty.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="error"></a>
|
||||
### queue.error(handler)
|
||||
|
||||
Set a global error handler. `handler(err, task)` will be called
|
||||
each time a task is completed, `err` will be not null if the task has thrown an error.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="concurrency"></a>
|
||||
### queue.concurrency
|
||||
|
||||
Property that returns the number of concurrent tasks that could be executed in
|
||||
parallel. It can be altered at runtime.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="drain"></a>
|
||||
### queue.drain
|
||||
|
||||
Function that will be called when the last
|
||||
item from the queue has been processed by a worker.
|
||||
It can be altered at runtime.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="empty"></a>
|
||||
### queue.empty
|
||||
|
||||
Function that will be called when the last
|
||||
item from the queue has been assigned to a worker.
|
||||
It can be altered at runtime.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="saturated"></a>
|
||||
### queue.saturated
|
||||
|
||||
Function that will be called when the queue hits the concurrency
|
||||
limit.
|
||||
It can be altered at runtime.
|
||||
|
||||
-------------------------------------------------------
|
||||
<a name="promise"></a>
|
||||
### fastqueue.promise([that], worker(arg), concurrency)
|
||||
|
||||
Creates a new queue with `Promise` apis. It also offers all the methods
|
||||
and properties of the object returned by [`fastqueue`](#fastqueue) with the modified
|
||||
[`push`](#pushPromise) and [`unshift`](#unshiftPromise) methods.
|
||||
|
||||
Node v10+ is required to use the promisified version.
|
||||
|
||||
Arguments:
|
||||
* `that`, optional context of the `worker` function.
|
||||
* `worker`, worker function, it would be called with `that` as `this`,
|
||||
if that is specified. It MUST return a `Promise`.
|
||||
* `concurrency`, number of concurrent tasks that could be executed in
|
||||
parallel.
|
||||
|
||||
<a name="pushPromise"></a>
|
||||
#### queue.push(task) => Promise
|
||||
|
||||
Add a task at the end of the queue. The returned `Promise` will be fulfilled (rejected)
|
||||
when the task is completed successfully (unsuccessfully).
|
||||
|
||||
This promise could be ignored as it will not lead to a `'unhandledRejection'`.
|
||||
|
||||
<a name="unshiftPromise"></a>
|
||||
#### queue.unshift(task) => Promise
|
||||
|
||||
Add a task at the beginning of the queue. The returned `Promise` will be fulfilled (rejected)
|
||||
when the task is completed successfully (unsuccessfully).
|
||||
|
||||
This promise could be ignored as it will not lead to a `'unhandledRejection'`.
|
||||
|
||||
<a name="drained"></a>
|
||||
#### queue.drained() => Promise
|
||||
|
||||
Wait for the queue to be drained. The returned `Promise` will be resolved when all tasks in the queue have been processed by a worker.
|
||||
|
||||
This promise could be ignored as it will not lead to a `'unhandledRejection'`.
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
[ci-url]: https://github.com/mcollina/fastq/workflows/ci/badge.svg
|
||||
[npm-badge]: https://badge.fury.io/js/fastq.svg
|
||||
[npm-url]: https://badge.fury.io/js/fastq
|
||||
[david-badge]: https://david-dm.org/mcollina/fastq.svg
|
||||
[david-url]: https://david-dm.org/mcollina/fastq
|
||||
@@ -0,0 +1,8 @@
|
||||
import assertString from './util/assertString'; // from https://en.wikipedia.org/wiki/ISO_4217
|
||||
|
||||
var validISO4217CurrencyCodes = new Set(['AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BOV', 'BRL', 'BSD', 'BTN', 'BWP', 'BYN', 'BZD', 'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLF', 'CLP', 'CNY', 'COP', 'COU', 'CRC', 'CUC', 'CUP', 'CVE', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EGP', 'ERN', 'ETB', 'EUR', 'FJD', 'FKP', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRU', 'MUR', 'MVR', 'MWK', 'MXN', 'MXV', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SBD', 'SCR', 'SDG', 'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'SSP', 'STN', 'SVC', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH', 'UGX', 'USD', 'USN', 'UYI', 'UYU', 'UYW', 'UZS', 'VES', 'VND', 'VUV', 'WST', 'XAF', 'XAG', 'XAU', 'XBA', 'XBB', 'XBC', 'XBD', 'XCD', 'XDR', 'XOF', 'XPD', 'XPF', 'XPT', 'XSU', 'XTS', 'XUA', 'XXX', 'YER', 'ZAR', 'ZMW', 'ZWL']);
|
||||
export default function isISO4217(str) {
|
||||
assertString(str);
|
||||
return validISO4217CurrencyCodes.has(str.toUpperCase());
|
||||
}
|
||||
export var CurrencyCodes = validISO4217CurrencyCodes;
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Number.isSafeInteger : require("./shim");
|
||||
@@ -0,0 +1,4 @@
|
||||
declare function getDirectory(filepath: string): Promise<string>;
|
||||
declare function getDirectorySync(filepath: string): string;
|
||||
export { getDirectory, getDirectorySync };
|
||||
//# sourceMappingURL=getDirectory.d.ts.map
|
||||
@@ -0,0 +1,39 @@
|
||||
/* codepage.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/** Codepage index type (integer or string representation) */
|
||||
export type CP$Index = number | string;
|
||||
|
||||
/* Individual codepage converter */
|
||||
export interface CP$Conv {
|
||||
enc: {[n: string]: number; };
|
||||
dec: {[n: number]: string; };
|
||||
}
|
||||
|
||||
/** Encode input type (string, array of characters, Buffer) */
|
||||
export type CP$String = string | string[] | Uint8Array;
|
||||
|
||||
/** Encode output / decode input type */
|
||||
export type CP$Data = string | number[] | Uint8Array;
|
||||
|
||||
/** General utilities */
|
||||
export interface CP$Utils {
|
||||
decode(cp: CP$Index, data: CP$Data): string;
|
||||
encode(cp: CP$Index, data: CP$String, opts?: any): CP$Data;
|
||||
hascp(n: number): boolean;
|
||||
magic: {[cp: string]: string};
|
||||
}
|
||||
|
||||
/* note: TS cannot export top-level indexer, hence default workaround */
|
||||
export interface CP$Module {
|
||||
/** Version string */
|
||||
version: string;
|
||||
|
||||
/** Utility Functions */
|
||||
utils: CP$Utils;
|
||||
|
||||
/** Codepage Converters */
|
||||
[cp: number]: CP$Conv;
|
||||
}
|
||||
export const cptable: CP$Module;
|
||||
export default cptable;
|
||||
Reference in New Issue
Block a user