new license file version [CI SKIP]

This commit is contained in:
2023-03-15 12:34:41 +00:00
parent 0a6d92a1f3
commit 61328d20ed
13115 changed files with 1892314 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
import { Response } from "node-fetch";
export default function getBufferResponse(response: Response): Promise<ArrayBuffer>;

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Jordan Harband
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.

View File

@@ -0,0 +1,46 @@
{
"name": "normalize-range",
"version": "0.1.2",
"description": "Utility for normalizing a numeric range, with a wrapping function useful for polar coordinates",
"license": "MIT",
"repository": "jamestalmage/normalize-range",
"author": {
"name": "James Talmage",
"email": "james@talmage.io",
"url": "github.com/jamestalmage"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "npm run cover && npm run lint && npm run style",
"cover": "istanbul cover ./node_modules/.bin/_mocha",
"lint": "jshint --reporter=node_modules/jshint-stylish *.js test/*.js",
"debug": "mocha",
"watch": "mocha -w",
"style": "jscs *.js ./**/*.js && jscs ./test/** --config=./test/.jscsrc"
},
"files": [
"index.js"
],
"keywords": [
"range",
"normalize",
"utility",
"angle",
"degrees",
"polar"
],
"dependencies": {},
"devDependencies": {
"almost-equal": "^1.0.0",
"codeclimate-test-reporter": "^0.1.0",
"coveralls": "^2.11.2",
"istanbul": "^0.3.17",
"jscs": "^2.1.1",
"jshint": "^2.8.0",
"jshint-stylish": "^2.0.1",
"mocha": "^2.2.5",
"stringify-pi": "0.0.3"
}
}

View File

@@ -0,0 +1,7 @@
**string_decoder.js** (`require('string_decoder')`) from Node.js core
Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details.
Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**
The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.

View File

@@ -0,0 +1 @@
{"version":3,"file":"manipulator.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/manipulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EAErB,MAAM,SAAS,CAAA;AAkBhB;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,oBAAoB,EAAE,GAC1B,oBAAoB,EAAE,CAyBxB"}

View File

@@ -0,0 +1,104 @@
import { __extends } from "tslib";
import { AsyncAction } from './AsyncAction';
import { Subscription } from '../Subscription';
import { AsyncScheduler } from './AsyncScheduler';
var VirtualTimeScheduler = (function (_super) {
__extends(VirtualTimeScheduler, _super);
function VirtualTimeScheduler(schedulerActionCtor, maxFrames) {
if (schedulerActionCtor === void 0) { schedulerActionCtor = VirtualAction; }
if (maxFrames === void 0) { maxFrames = Infinity; }
var _this = _super.call(this, schedulerActionCtor, function () { return _this.frame; }) || this;
_this.maxFrames = maxFrames;
_this.frame = 0;
_this.index = -1;
return _this;
}
VirtualTimeScheduler.prototype.flush = function () {
var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;
var error;
var action;
while ((action = actions[0]) && action.delay <= maxFrames) {
actions.shift();
this.frame = action.delay;
if ((error = action.execute(action.state, action.delay))) {
break;
}
}
if (error) {
while ((action = actions.shift())) {
action.unsubscribe();
}
throw error;
}
};
VirtualTimeScheduler.frameTimeFactor = 10;
return VirtualTimeScheduler;
}(AsyncScheduler));
export { VirtualTimeScheduler };
var VirtualAction = (function (_super) {
__extends(VirtualAction, _super);
function VirtualAction(scheduler, work, index) {
if (index === void 0) { index = (scheduler.index += 1); }
var _this = _super.call(this, scheduler, work) || this;
_this.scheduler = scheduler;
_this.work = work;
_this.index = index;
_this.active = true;
_this.index = scheduler.index = index;
return _this;
}
VirtualAction.prototype.schedule = function (state, delay) {
if (delay === void 0) { delay = 0; }
if (Number.isFinite(delay)) {
if (!this.id) {
return _super.prototype.schedule.call(this, state, delay);
}
this.active = false;
var action = new VirtualAction(this.scheduler, this.work);
this.add(action);
return action.schedule(state, delay);
}
else {
return Subscription.EMPTY;
}
};
VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) {
if (delay === void 0) { delay = 0; }
this.delay = scheduler.frame + delay;
var actions = scheduler.actions;
actions.push(this);
actions.sort(VirtualAction.sortActions);
return 1;
};
VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
if (delay === void 0) { delay = 0; }
return undefined;
};
VirtualAction.prototype._execute = function (state, delay) {
if (this.active === true) {
return _super.prototype._execute.call(this, state, delay);
}
};
VirtualAction.sortActions = function (a, b) {
if (a.delay === b.delay) {
if (a.index === b.index) {
return 0;
}
else if (a.index > b.index) {
return 1;
}
else {
return -1;
}
}
else if (a.delay > b.delay) {
return 1;
}
else {
return -1;
}
};
return VirtualAction;
}(AsyncAction));
export { VirtualAction };
//# sourceMappingURL=VirtualTimeScheduler.js.map

View File

@@ -0,0 +1,19 @@
var assocIndexOf = require('./_assocIndexOf');
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
module.exports = listCacheGet;

View File

@@ -0,0 +1,2 @@
if(typeof cptable === 'undefined') cptable = {};
cptable[1132] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ<E0BAAD><E0BAAE><EFBFBD>ຯະາຳິີຶືຸູຼັົຽ<E0BABB><E0BABD><EFBFBD>ເແໂໃໄ່້໊໋໌ໍໆ<E0BB8D>ໜໝ₭<E0BB9D><E282AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>໑໒໓໔໕໖໗໘໙<E0BB98><E0BB99>¢¬¦ ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();

View File

@@ -0,0 +1 @@
{"version":3,"file":"Subscriber.js","sourceRoot":"","sources":["../../../src/internal/Subscriber.ts"],"names":[],"mappings":"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"}

View File

@@ -0,0 +1,91 @@
import { __spreadArray } from "tslib";
import { isLiteralElement, isTagElement, isSelectElement, isArgumentElement, isDateElement, isTimeElement, isNumberElement, isPluralElement, TYPE, SKELETON_TYPE, isPoundElement, } from './types';
export function printAST(ast) {
return doPrintAST(ast, false);
}
export function doPrintAST(ast, isInPlural) {
var printedNodes = ast.map(function (el) {
if (isLiteralElement(el)) {
return printLiteralElement(el, isInPlural);
}
if (isArgumentElement(el)) {
return printArgumentElement(el);
}
if (isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {
return printSimpleFormatElement(el);
}
if (isPluralElement(el)) {
return printPluralElement(el);
}
if (isSelectElement(el)) {
return printSelectElement(el);
}
if (isPoundElement(el)) {
return '#';
}
if (isTagElement(el)) {
return printTagElement(el);
}
});
return printedNodes.join('');
}
function printTagElement(el) {
return "<".concat(el.value, ">").concat(printAST(el.children), "</").concat(el.value, ">");
}
function printEscapedMessage(message) {
return message.replace(/([{}](?:.*[{}])?)/su, "'$1'");
}
function printLiteralElement(_a, isInPlural) {
var value = _a.value;
var escaped = printEscapedMessage(value);
return isInPlural ? escaped.replace('#', "'#'") : escaped;
}
function printArgumentElement(_a) {
var value = _a.value;
return "{".concat(value, "}");
}
function printSimpleFormatElement(el) {
return "{".concat(el.value, ", ").concat(TYPE[el.type]).concat(el.style ? ", ".concat(printArgumentStyle(el.style)) : '', "}");
}
function printNumberSkeletonToken(token) {
var stem = token.stem, options = token.options;
return options.length === 0
? stem
: "".concat(stem).concat(options.map(function (o) { return "/".concat(o); }).join(''));
}
function printArgumentStyle(style) {
if (typeof style === 'string') {
return printEscapedMessage(style);
}
else if (style.type === SKELETON_TYPE.dateTime) {
return "::".concat(printDateTimeSkeleton(style));
}
else {
return "::".concat(style.tokens.map(printNumberSkeletonToken).join(' '));
}
}
export function printDateTimeSkeleton(style) {
return style.pattern;
}
function printSelectElement(el) {
var msg = [
el.value,
'select',
Object.keys(el.options)
.map(function (id) { return "".concat(id, "{").concat(doPrintAST(el.options[id].value, false), "}"); })
.join(' '),
].join(',');
return "{".concat(msg, "}");
}
function printPluralElement(el) {
var type = el.pluralType === 'cardinal' ? 'plural' : 'selectordinal';
var msg = [
el.value,
type,
__spreadArray([
el.offset ? "offset:".concat(el.offset) : ''
], Object.keys(el.options).map(function (id) { return "".concat(id, "{").concat(doPrintAST(el.options[id].value, true), "}"); }), true).filter(Boolean)
.join(' '),
].join(',');
return "{".concat(msg, "}");
}

View File

@@ -0,0 +1,130 @@
// Generated by LiveScript 1.4.0
var max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm;
max = curry$(function(x$, y$){
return x$ > y$ ? x$ : y$;
});
min = curry$(function(x$, y$){
return x$ < y$ ? x$ : y$;
});
negate = function(x){
return -x;
};
abs = Math.abs;
signum = function(x){
if (x < 0) {
return -1;
} else if (x > 0) {
return 1;
} else {
return 0;
}
};
quot = curry$(function(x, y){
return ~~(x / y);
});
rem = curry$(function(x$, y$){
return x$ % y$;
});
div = curry$(function(x, y){
return Math.floor(x / y);
});
mod = curry$(function(x$, y$){
var ref$;
return (((x$) % (ref$ = y$) + ref$) % ref$);
});
recip = (function(it){
return 1 / it;
});
pi = Math.PI;
tau = pi * 2;
exp = Math.exp;
sqrt = Math.sqrt;
ln = Math.log;
pow = curry$(function(x$, y$){
return Math.pow(x$, y$);
});
sin = Math.sin;
tan = Math.tan;
cos = Math.cos;
asin = Math.asin;
acos = Math.acos;
atan = Math.atan;
atan2 = curry$(function(x, y){
return Math.atan2(x, y);
});
truncate = function(x){
return ~~x;
};
round = Math.round;
ceiling = Math.ceil;
floor = Math.floor;
isItNaN = function(x){
return x !== x;
};
even = function(x){
return x % 2 === 0;
};
odd = function(x){
return x % 2 !== 0;
};
gcd = curry$(function(x, y){
var z;
x = Math.abs(x);
y = Math.abs(y);
while (y !== 0) {
z = x % y;
x = y;
y = z;
}
return x;
});
lcm = curry$(function(x, y){
return Math.abs(Math.floor(x / gcd(x, y) * y));
});
module.exports = {
max: max,
min: min,
negate: negate,
abs: abs,
signum: signum,
quot: quot,
rem: rem,
div: div,
mod: mod,
recip: recip,
pi: pi,
tau: tau,
exp: exp,
sqrt: sqrt,
ln: ln,
pow: pow,
sin: sin,
tan: tan,
cos: cos,
acos: acos,
asin: asin,
atan: atan,
atan2: atan2,
truncate: truncate,
round: round,
ceiling: ceiling,
floor: floor,
isItNaN: isItNaN,
even: even,
odd: odd,
gcd: gcd,
lcm: lcm
};
function curry$(f, bound){
var context,
_curry = function(args) {
return f.length > 1 ? function(){
var params = args ? args.concat() : [];
context = bound ? context || this : this;
return params.push.apply(params, arguments) <
f.length && arguments.length ?
_curry.call(context, params) : f.apply(context, params);
} : f;
};
return _curry();
}

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isMACAddress;
var _assertString = _interopRequireDefault(require("./util/assertString"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
var macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/;
var macAddress48WithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
var macAddress64 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/;
var macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/;
var macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;
function isMACAddress(str, options) {
(0, _assertString.default)(str);
if (options !== null && options !== void 0 && options.eui) {
options.eui = String(options.eui);
}
/**
* @deprecated `no_colons` TODO: remove it in the next major
*/
if (options !== null && options !== void 0 && options.no_colons || options !== null && options !== void 0 && options.no_separators) {
if (options.eui === '48') {
return macAddress48NoSeparators.test(str);
}
if (options.eui === '64') {
return macAddress64NoSeparators.test(str);
}
return macAddress48NoSeparators.test(str) || macAddress64NoSeparators.test(str);
}
if ((options === null || options === void 0 ? void 0 : options.eui) === '48') {
return macAddress48.test(str) || macAddress48WithDots.test(str);
}
if ((options === null || options === void 0 ? void 0 : options.eui) === '64') {
return macAddress64.test(str) || macAddress64WithDots.test(str);
}
return isMACAddress(str, {
eui: '48'
}) || isMACAddress(str, {
eui: '64'
});
}
module.exports = exports.default;
module.exports.default = exports.default;

View File

@@ -0,0 +1,52 @@
var baseToString = require('./_baseToString'),
castSlice = require('./_castSlice'),
hasUnicode = require('./_hasUnicode'),
isIterateeCall = require('./_isIterateeCall'),
isRegExp = require('./isRegExp'),
stringToArray = require('./_stringToArray'),
toString = require('./toString');
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295;
/**
* Splits `string` by `separator`.
*
* **Note:** This method is based on
* [`String#split`](https://mdn.io/String/split).
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to split.
* @param {RegExp|string} separator The separator pattern to split by.
* @param {number} [limit] The length to truncate results to.
* @returns {Array} Returns the string segments.
* @example
*
* _.split('a-b-c', '-', 2);
* // => ['a', 'b']
*/
function split(string, separator, limit) {
if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
separator = limit = undefined;
}
limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
string = toString(string);
if (string && (
typeof separator == 'string' ||
(separator != null && !isRegExp(separator))
)) {
separator = baseToString(separator);
if (!separator && hasUnicode(string)) {
return castSlice(stringToArray(string), 0, limit);
}
}
return string.split(separator, limit);
}
module.exports = split;

View File

@@ -0,0 +1,55 @@
var baseFindIndex = require('./_baseFindIndex'),
baseIteratee = require('./_baseIteratee'),
toInteger = require('./toInteger');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, baseIteratee(predicate, 3), index);
}
module.exports = findIndex;

View File

@@ -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","1028":"K L G M N O","1346":"C"},C:{"1":"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 EC","196":"AB","516":"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 FC"},D:{"1":"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":"I v J D E F A B C K L G M N","33":"0 1 2 3 4 5 6 7 8 9 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"},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 HC zB IC","33":"J D E F JC KC"},F:{"1":"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 PC QC RC SC qB AC TC rB","33":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB"},G:{"1":"aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC","33":"E WC XC YC ZC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC","33":"tC uC"},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":"g yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","33":"I wC xC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"CSS Filter Effects"};

View File

@@ -0,0 +1,30 @@
/**
Join an array of strings and/or numbers using the given string as a delimiter.
Use-case: Defining key paths in a nested object. For example, for dot-notation fields in MongoDB queries.
@example
```
import type {Join} from 'type-fest';
// Mixed (strings & numbers) items; result is: 'foo.0.baz'
const path: Join<['foo', 0, 'baz'], '.'> = ['foo', 0, 'baz'].join('.');
// Only string items; result is: 'foo.bar.baz'
const path: Join<['foo', 'bar', 'baz'], '.'> = ['foo', 'bar', 'baz'].join('.');
// Only number items; result is: '1.2.3'
const path: Join<[1, 2, 3], '.'> = [1, 2, 3].join('.');
```
@category Array
@category Template literal
*/
export type Join<
Strings extends Array<string | number>,
Delimiter extends string,
> = Strings extends [] ? '' :
Strings extends [string | number] ? `${Strings[0]}` :
// @ts-expect-error `Rest` is inferred as `unknown` here: https://github.com/microsoft/TypeScript/issues/45281
Strings extends [string | number, ...infer Rest] ? `${Strings[0]}${Delimiter}${Join<Rest, Delimiter>}` :
string;

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('upperCase', require('../upperCase'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,42 @@
var baseClone = require('./_baseClone');
/** Used to compose bitmasks for cloning. */
var CLONE_SYMBOLS_FLAG = 4;
/**
* This method is like `_.clone` except that it accepts `customizer` which
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
* cloning is handled by the method instead. The `customizer` is invoked with
* up to four arguments; (value [, index|key, object, stack]).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the cloned value.
* @see _.cloneDeepWith
* @example
*
* function customizer(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* }
*
* var el = _.cloneWith(document.body, customizer);
*
* console.log(el === document.body);
* // => false
* console.log(el.nodeName);
* // => 'BODY'
* console.log(el.childNodes.length);
* // => 0
*/
function cloneWith(value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
}
module.exports = cloneWith;

View File

@@ -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","322":"L","8196":"G M N O"},C:{"2":"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 EC FC","4162":"VB WB XB YB uB ZB vB aB bB cB dB","16452":"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"},D:{"1":"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 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","194":"TB UB VB WB XB YB","1090":"uB ZB","8196":"vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB"},E:{"1":"K L G rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F HC zB IC JC KC LC","514":"A B 0B","8196":"C qB"},F:{"1":"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":"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 PC QC RC SC qB AC TC rB","194":"GB HB IB JB KB LB MB NB","8196":"OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB"},G:{"1":"gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC","514":"bC cC dC","8196":"eC fC"},H:{"2":"oC"},I:{"2":"tB I f pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"2049":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"1":"g 2C 3C 4C 5C sB 6C 7C 8C","2":"I","8196":"wC xC yC zC 0C 0B 1C"},Q:{"8196":"1B"},R:{"2":"9C"},S:{"2":"AD BD"}},B:2,C:"Payment Request API"};

View File

@@ -0,0 +1,31 @@
import type { TimerHandle } from './timerHandle';
type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;
type ClearTimeoutFunction = (handle: TimerHandle) => void;
interface TimeoutProvider {
setTimeout: SetTimeoutFunction;
clearTimeout: ClearTimeoutFunction;
delegate:
| {
setTimeout: SetTimeoutFunction;
clearTimeout: ClearTimeoutFunction;
}
| undefined;
}
export const timeoutProvider: TimeoutProvider = {
// When accessing the delegate, use the variable rather than `this` so that
// the functions can be called without being bound to the provider.
setTimeout(handler: () => void, timeout?: number, ...args) {
const { delegate } = timeoutProvider;
if (delegate?.setTimeout) {
return delegate.setTimeout(handler, timeout, ...args);
}
return setTimeout(handler, timeout, ...args);
},
clearTimeout(handle) {
const { delegate } = timeoutProvider;
return (delegate?.clearTimeout || clearTimeout)(handle as any);
},
delegate: undefined,
};

View File

@@ -0,0 +1,117 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for csv2json/src/Processor.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> Processor.ts
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>5/5</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">75x</span>
<span class="cline-any cline-yes">75x</span>
<span class="cline-any cline-yes">75x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Converter } from "./Converter";
import P from "bluebird";
import { JSONResult } from "./lineToJson";
import { CSVParseParam } from "./Parameters";
import { ParseRuntime } from "./ParseRuntime";
&nbsp;
export abstract class Processor {
protected params: CSVParseParam;
protected runtime: ParseRuntime;
constructor(protected converter: Converter) {
this.params = converter.parseParam;
this.runtime = converter.parseRuntime;
}
abstract process(chunk: Buffer,finalChunk?:boolean): P&lt;ProcessLineResult[]&gt;
}
export type ProcessLineResult = string | string[] | JSONResult;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
<script src="../../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,15 @@
var ListCache = require('./_ListCache');
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
module.exports = stackClear;

View File

@@ -0,0 +1 @@
{"name":"unique-string","version":"3.0.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883672490,"integrity":"sha512-NJxkaRKdr4RGIK8tOpW6bExUCRRe9Lgil2PnlmTWkfAINuVVbmd4LkSXVyiVUq9ZfTFyrkEFWPaLW++gxGWT/g==","mode":420,"size":141},"package.json":{"checkedAt":1678883672490,"integrity":"sha512-nHRlSGoijkkDCCVH6JGLL85bmy4bZrQQQdrR+8g3pddlwpBePJ9RuL6wPXUeTGxIHCl/yO76DDWpnDezgsNd+g==","mode":420,"size":759},"readme.md":{"checkedAt":1678883672490,"integrity":"sha512-IRzWvXSh1HXpqyxEOoeHWFh9+H0G7vlT0oM3UedpC7aXMX/r3O1UOO7RDFXWAd5+moEfLB8jafSmF8G0cHYNQw==","mode":420,"size":407},"index.d.ts":{"checkedAt":1678883672491,"integrity":"sha512-yYyFcj4zoQ5iXbIOAMxEiYzmBoppqkkOq3t9tzkPn6tGvqsWzAR6lfhEadODRwqY8aWZ6EjpQvE6uN+lnRuM3Q==","mode":420,"size":365}}}

View File

@@ -0,0 +1,12 @@
import { AuthOptions } from './';
/**
* Get the registry URL for a given npm scope
*
* @param scope - npm scope to resolve URL for
* @param [npmrc] - Optional object of npmrc properties to use instead of looking up the users local npmrc file
* @returns The resolved registry URL, falling back to the global npm registry
*/
declare function registryUrl(scope: string, npmrc?: Pick<AuthOptions, 'npmrc'>): string;
export = registryUrl;

View File

@@ -0,0 +1 @@
{"name":"cli-cursor","version":"4.0.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883671090,"integrity":"sha512-6LPEwFDaY0sPIrY/KQP5lwIIQo2Nq5UkFunpZt282OnyblRYKBtae6FhIr4UdvhAhtJS8/gEqQmqzp8INL7iXg==","mode":420,"size":694},"package.json":{"checkedAt":1678883671090,"integrity":"sha512-JS/+Yj2WPXJzqzrzRdyXotcNoXjQ5Tx4mZZ4og85dtGINOJsaVAgJXvAnwYZw1ZP7rwsPzeqNXqARGcqYdQ3OA==","mode":420,"size":855},"readme.md":{"checkedAt":1678883671090,"integrity":"sha512-IRi/E9lT5VpJrMlY8pUmkRc7zjQTwgc2YTR/rztqr+XTJVm+OSqdwE6aSvsFWwo3PJSEajjexgDo611fBcYfwQ==","mode":420,"size":993},"index.d.ts":{"checkedAt":1678883671090,"integrity":"sha512-co9CkVtA4EYtZpnGzSHFo8ObnbDMWrixA6VF3bzwKY2eyl9TBh/5631M1kDLm58YeAfRWFN5p8zmn5JUGnX3sw==","mode":420,"size":791}}}

View File

@@ -0,0 +1,33 @@
declare type Func = (...args: any[]) => any;
export interface Cache<K, V> {
create: CacheCreateFunc<K, V>;
}
interface CacheCreateFunc<K, V> {
(): DefaultCache<K, V>;
}
interface DefaultCache<K, V> {
get(key: K): V;
set(key: K, value: V): void;
}
export declare type Serializer = (args: any[]) => string;
export interface Options<F extends Func> {
cache?: Cache<string, ReturnType<F>>;
serializer?: Serializer;
strategy?: MemoizeFunc<F>;
}
export interface ResolvedOptions<F extends Func> {
cache: Cache<string, ReturnType<F>>;
serializer: Serializer;
}
export interface MemoizeFunc<F extends Func> {
(fn: F, options?: Options<F>): F;
}
export default function memoize<F extends Func>(fn: F, options?: Options<F>): F | ((arg: any) => any);
export declare type StrategyFn = <F extends Func>(this: unknown, fn: F, cache: DefaultCache<string, ReturnType<F>>, serializer: Serializer, arg: any) => any;
export interface Strategies<F extends Func> {
variadic: MemoizeFunc<F>;
monadic: MemoizeFunc<F>;
}
export declare const strategies: Strategies<Func>;
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,413 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
const base64VLQ = require("./base64-vlq");
const util = require("./util");
const ArraySet = require("./array-set").ArraySet;
const MappingList = require("./mapping-list").MappingList;
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. You may pass an object with the following
* properties:
*
* - file: The filename of the generated source.
* - sourceRoot: A root for all relative URLs in this source map.
*/
class SourceMapGenerator {
constructor(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, "file", null);
this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
this._skipValidation = util.getArg(aArgs, "skipValidation", false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
static fromSourceMap(aSourceMapConsumer) {
const sourceRoot = aSourceMapConsumer.sourceRoot;
const generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot
});
aSourceMapConsumer.eachMapping(function(mapping) {
const newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function(sourceFile) {
let sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util.relative(sourceRoot, sourceFile);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
}
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
addMapping(aArgs) {
const generated = util.getArg(aArgs, "generated");
const original = util.getArg(aArgs, "original", null);
let source = util.getArg(aArgs, "source", null);
let name = util.getArg(aArgs, "name", null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source,
name
});
}
/**
* Set the source content for a source file.
*/
setSourceContent(aSourceFile, aSourceContent) {
let source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
}
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param aSourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
let sourceFile = aSourceFile;
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(
"SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, " +
'or the source map\'s "file" property. Both were omitted.'
);
}
sourceFile = aSourceMapConsumer.file;
}
const sourceRoot = this._sourceRoot;
// Make "sourceFile" relative if an absolute Url is passed.
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
// Applying the SourceMap can add and remove items from the sources and
// the names array.
const newSources = this._mappings.toArray().length > 0
? new ArraySet()
: this._sources;
const newNames = new ArraySet();
// Find mappings for the "sourceFile"
this._mappings.unsortedForEach(function(mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
// Check if it can be mapped by the source map, then update the mapping.
const original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source);
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
const source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
const name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
// Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function(srcFile) {
const content = aSourceMapConsumer.sourceContentFor(srcFile);
if (content != null) {
if (aSourceMapPath != null) {
srcFile = util.join(aSourceMapPath, srcFile);
}
if (sourceRoot != null) {
srcFile = util.relative(sourceRoot, srcFile);
}
this.setSourceContent(srcFile, content);
}
}, this);
}
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
_validateMapping(aGenerated, aOriginal, aSource, aName) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
throw new Error(
"original.line and original.column are not numbers -- you probably meant to omit " +
"the original mapping entirely and only map the generated position. If so, pass " +
"null for the original mapping instead of an object with empty or null values."
);
}
if (aGenerated && "line" in aGenerated && "column" in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
// Case 1.
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated
&& aOriginal && "line" in aOriginal && "column" in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
// Cases 2 and 3.
} else {
throw new Error("Invalid mapping: " + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
}
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
_serializeMappings() {
let previousGeneratedColumn = 0;
let previousGeneratedLine = 1;
let previousOriginalColumn = 0;
let previousOriginalLine = 0;
let previousName = 0;
let previousSource = 0;
let result = "";
let next;
let mapping;
let nameIdx;
let sourceIdx;
const mappings = this._mappings.toArray();
for (let i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = "";
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ";";
previousGeneratedLine++;
}
} else if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ",";
}
next += base64VLQ.encode(mapping.generatedColumn
- previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx;
// lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1
- previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn
- previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
}
_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function(source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util.relative(aSourceRoot, source);
}
const key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
? this._sourcesContents[key]
: null;
}, this);
}
/**
* Externalize the source map.
*/
toJSON() {
const map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
}
/**
* Render the source map being generated to a string.
*/
toString() {
return JSON.stringify(this.toJSON());
}
}
SourceMapGenerator.prototype._version = 3;
exports.SourceMapGenerator = SourceMapGenerator;

View File

@@ -0,0 +1 @@
[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html)

View File

@@ -0,0 +1,35 @@
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;

View File

@@ -0,0 +1,28 @@
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeMax = Math.max;
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
module.exports = baseRange;

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BestFitMatcher = void 0;
var BestAvailableLocale_1 = require("./BestAvailableLocale");
var utils_1 = require("./utils");
/**
* https://tc39.es/ecma402/#sec-bestfitmatcher
* @param availableLocales
* @param requestedLocales
* @param getDefaultLocale
*/
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
var minimizedAvailableLocaleMap = {};
var availableLocaleMap = {};
var canonicalizedLocaleMap = {};
var minimizedAvailableLocales = new Set();
availableLocales.forEach(function (locale) {
var minimizedLocale = new Intl.Locale(locale)
.minimize()
.toString();
var canonicalizedLocale = Intl.getCanonicalLocales(locale)[0] || locale;
minimizedAvailableLocaleMap[minimizedLocale] = locale;
availableLocaleMap[locale] = locale;
canonicalizedLocaleMap[canonicalizedLocale] = locale;
minimizedAvailableLocales.add(minimizedLocale);
minimizedAvailableLocales.add(locale);
minimizedAvailableLocales.add(canonicalizedLocale);
});
var foundLocale;
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
var l = requestedLocales_1[_i];
if (foundLocale) {
break;
}
var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');
if (availableLocales.has(noExtensionLocale)) {
foundLocale = noExtensionLocale;
break;
}
if (minimizedAvailableLocales.has(noExtensionLocale)) {
foundLocale = noExtensionLocale;
break;
}
var locale = new Intl.Locale(noExtensionLocale);
var maximizedRequestedLocale = locale.maximize().toString();
var minimizedRequestedLocale = locale.minimize().toString();
// Check minimized locale
if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {
foundLocale = minimizedRequestedLocale;
break;
}
// Lookup algo on maximized locale
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
}
if (!foundLocale) {
return { locale: getDefaultLocale() };
}
return {
locale: availableLocaleMap[foundLocale] ||
canonicalizedLocaleMap[foundLocale] ||
minimizedAvailableLocaleMap[foundLocale] ||
foundLocale,
};
}
exports.BestFitMatcher = BestFitMatcher;

View File

@@ -0,0 +1,177 @@
// @ts-check
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
parseCandidateFiles: ()=>parseCandidateFiles,
resolvedChangedContent: ()=>resolvedChangedContent
});
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
const _isGlob = /*#__PURE__*/ _interopRequireDefault(require("is-glob"));
const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
const _parseGlob = require("../util/parseGlob");
const _sharedState = require("./sharedState");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function parseCandidateFiles(context, tailwindConfig) {
let files = tailwindConfig.content.files;
// Normalize the file globs
files = files.filter((filePath)=>typeof filePath === "string");
files = files.map(_normalizePath.default);
// Split into included and excluded globs
let tasks = _fastGlob.default.generateTasks(files);
/** @type {ContentPath[]} */ let included = [];
/** @type {ContentPath[]} */ let excluded = [];
for (const task of tasks){
included.push(...task.positive.map((filePath)=>parseFilePath(filePath, false)));
excluded.push(...task.negative.map((filePath)=>parseFilePath(filePath, true)));
}
let paths = [
...included,
...excluded
];
// Resolve paths relative to the config file or cwd
paths = resolveRelativePaths(context, paths);
// Resolve symlinks if possible
paths = paths.flatMap(resolvePathSymlinks);
// Update cached patterns
paths = paths.map(resolveGlobPattern);
return paths;
}
/**
*
* @param {string} filePath
* @param {boolean} ignore
* @returns {ContentPath}
*/ function parseFilePath(filePath, ignore) {
let contentPath = {
original: filePath,
base: filePath,
ignore,
pattern: filePath,
glob: null
};
if ((0, _isGlob.default)(filePath)) {
Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
}
return contentPath;
}
/**
*
* @param {ContentPath} contentPath
* @returns {ContentPath}
*/ function resolveGlobPattern(contentPath) {
// This is required for Windows support to properly pick up Glob paths.
// Afaik, this technically shouldn't be needed but there's probably
// some internal, direct path matching with a normalized path in
// a package which can't handle mixed directory separators
let base = (0, _normalizePath.default)(contentPath.base);
// If the user's file path contains any special characters (like parens) for instance fast-glob
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
base = _fastGlob.default.escapePath(base);
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
return contentPath;
}
/**
* Resolve each path relative to the config file (when possible) if the experimental flag is enabled
* Otherwise, resolve relative to the current working directory
*
* @param {any} context
* @param {ContentPath[]} contentPaths
* @returns {ContentPath[]}
*/ function resolveRelativePaths(context, contentPaths) {
let resolveFrom = [];
// Resolve base paths relative to the config file (when possible) if the experimental flag is enabled
if (context.userConfigPath && context.tailwindConfig.content.relative) {
resolveFrom = [
_path.default.dirname(context.userConfigPath)
];
}
return contentPaths.map((contentPath)=>{
contentPath.base = _path.default.resolve(...resolveFrom, contentPath.base);
return contentPath;
});
}
/**
* Resolve the symlink for the base directory / file in each path
* These are added as additional dependencies to watch for changes because
* some tools (like webpack) will only watch the actual file or directory
* but not the symlink itself even in projects that use monorepos.
*
* @param {ContentPath} contentPath
* @returns {ContentPath[]}
*/ function resolvePathSymlinks(contentPath) {
let paths = [
contentPath
];
try {
let resolvedPath = _fs.default.realpathSync(contentPath.base);
if (resolvedPath !== contentPath.base) {
paths.push({
...contentPath,
base: resolvedPath
});
}
} catch {
// TODO: log this?
}
return paths;
}
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
content: raw,
extension
}));
let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
for (let changedFile of changedFiles){
let extension = _path.default.extname(changedFile).slice(1);
changedContent.push({
file: changedFile,
extension
});
}
return [
changedContent,
mTimesToCommit
];
}
/**
*
* @param {ContentPath[]} candidateFiles
* @param {Map<string, number>} fileModifiedMap
* @returns {[Set<string>, Map<string, number>]}
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
let mTimesToCommit = new Map();
let changedFiles = new Set();
_sharedState.env.DEBUG && console.time("Finding changed files");
let files = _fastGlob.default.sync(paths, {
absolute: true
});
for (let file of files){
let prevModified = fileModifiedMap.get(file) || -Infinity;
let modified = _fs.default.statSync(file).mtimeMs;
if (modified > prevModified) {
changedFiles.add(file);
mTimesToCommit.set(file, modified);
}
}
_sharedState.env.DEBUG && console.timeEnd("Finding changed files");
return [
changedFiles,
mTimesToCommit
];
}

View File

@@ -0,0 +1 @@
module.exports={C:{"109":0.01822,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 3.5 3.6"},D:{"106":0.01822,"108":0.01093,"109":0.02915,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 107 110 111 112 113"},F:{_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110"},E:{"4":0,"14":0.01093,_:"0 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 14.1","13.1":0.02915,"15.1":0.696,"15.2-15.3":0.49923,"15.4":0.32067,"15.5":2.11352,"15.6":7.84918,"16.0":3.37434,"16.1":4.25984,"16.2":7.59774,"16.3":7.73621,"16.4":0.58304},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.74664,"15.2-15.3":2.34471,"15.4":0.24233,"15.5":0.47811,"15.6":6.08447,"16.0":6.06482,"16.1":19.91697,"16.2":18.17481,"16.3":8.46848,"16.4":0.94967},P:{"4":0.24775,"20":0.75357,"5.0-5.4":0.04075,"6.2-6.4":0.08151,"7.2-7.4":0.23743,"8.2":0.01016,"9.2":0.03097,"10.1":0.01011,"11.1-11.2":0.07226,"12.0":0.02065,"13.0":0.08258,"14.0":0.08258,"15.0":0.04129,"16.0":0.15484,"17.0":0.14452,"18.0":0.1342,"19.0":2.07491},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 7 8 9 10 11 5.5"},N:{"10":0.03712,"11":0.07423},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0},H:{"0":0},L:{"0":0.08898},R:{_:"0"},M:{"0":0},Q:{"13.1":0}};

View File

@@ -0,0 +1,15 @@
"use strict";
var resolveException = require("../lib/resolve-exception")
, coerce = require("./coerce");
module.exports = function (value/*, options*/) {
var coerced = coerce(value);
if (coerced !== null) return coerced;
var options = arguments[1];
var errorMessage =
options && options.name
? "Expected an array length for %n, received %v"
: "%v is not an array length";
return resolveException(value, errorMessage, options);
};

View File

@@ -0,0 +1,104 @@
let postcss = require('postcss')
let IMPORTANT = /\s*!important\s*$/i
let UNITLESS = {
'box-flex': true,
'box-flex-group': true,
'column-count': true,
'flex': true,
'flex-grow': true,
'flex-positive': true,
'flex-shrink': true,
'flex-negative': true,
'font-weight': true,
'line-clamp': true,
'line-height': true,
'opacity': true,
'order': true,
'orphans': true,
'tab-size': true,
'widows': true,
'z-index': true,
'zoom': true,
'fill-opacity': true,
'stroke-dashoffset': true,
'stroke-opacity': true,
'stroke-width': true
}
function dashify(str) {
return str
.replace(/([A-Z])/g, '-$1')
.replace(/^ms-/, '-ms-')
.toLowerCase()
}
function decl(parent, name, value) {
if (value === false || value === null) return
if (!name.startsWith('--')) {
name = dashify(name)
}
if (typeof value === 'number') {
if (value === 0 || UNITLESS[name]) {
value = value.toString()
} else {
value += 'px'
}
}
if (name === 'css-float') name = 'float'
if (IMPORTANT.test(value)) {
value = value.replace(IMPORTANT, '')
parent.push(postcss.decl({ prop: name, value, important: true }))
} else {
parent.push(postcss.decl({ prop: name, value }))
}
}
function atRule(parent, parts, value) {
let node = postcss.atRule({ name: parts[1], params: parts[3] || '' })
if (typeof value === 'object') {
node.nodes = []
parse(value, node)
}
parent.push(node)
}
function parse(obj, parent) {
let name, value, node
for (name in obj) {
value = obj[name]
if (value === null || typeof value === 'undefined') {
continue
} else if (name[0] === '@') {
let parts = name.match(/@(\S+)(\s+([\W\w]*)\s*)?/)
if (Array.isArray(value)) {
for (let i of value) {
atRule(parent, parts, i)
}
} else {
atRule(parent, parts, value)
}
} else if (Array.isArray(value)) {
for (let i of value) {
decl(parent, name, i)
}
} else if (typeof value === 'object') {
node = postcss.rule({ selector: name })
parse(value, node)
parent.push(node)
} else {
decl(parent, name, value)
}
}
}
module.exports = function (obj) {
let root = postcss.root()
parse(obj, root)
return root
}

View File

@@ -0,0 +1,9 @@
export function getUserAgent() {
if (typeof navigator === "object" && "userAgent" in navigator) {
return navigator.userAgent;
}
if (typeof process === "object" && "version" in process) {
return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`;
}
return "<environment undetectable>";
}

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('rest', require('../rest'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,17 @@
export declare const regex_whitespace: RegExp;
export declare const regex_whitespaces: RegExp;
export declare const regex_starts_with_whitespace: RegExp;
export declare const regex_starts_with_whitespaces: RegExp;
export declare const regex_ends_with_whitespace: RegExp;
export declare const regex_ends_with_whitespaces: RegExp;
export declare const regex_only_whitespaces: RegExp;
export declare const regex_whitespace_characters: RegExp;
export declare const regex_non_whitespace_character: RegExp;
export declare const regex_starts_with_newline: RegExp;
export declare const regex_not_newline_characters: RegExp;
export declare const regex_double_quotes: RegExp;
export declare const regex_backslashes: RegExp;
export declare const regex_starts_with_underscore: RegExp;
export declare const regex_ends_with_underscore: RegExp;
export declare const regex_invalid_variable_identifier_characters: RegExp;
export declare const regex_dimensions: RegExp;

View File

@@ -0,0 +1,16 @@
@root
module
es5
indent 2
maxlen 100
tabs
ass
bitwise
nomen
plusplus
vars
predef+ queueMicrotask, process, setImmediate, setTimeout, clearTimeout, document, MutationObserver, WebKitMutationObserver

View File

@@ -0,0 +1,60 @@
declare namespace globalDirectories {
interface GlobalDirectories {
/**
Directory with globally installed packages.
Equivalent to `npm root --global`.
*/
readonly packages: string;
/**
Directory with globally installed binaries.
Equivalent to `npm bin --global`.
*/
readonly binaries: string;
/**
Directory with directories for packages and binaries. You probably want either of the above.
Equivalent to `npm prefix --global`.
*/
readonly prefix: string;
}
}
declare const globalDirectories: {
/**
Get the directory of globally installed packages and binaries.
@example
```
import globalDirectories = require('global-dirs');
console.log(globalDirectories.npm.prefix);
//=> '/usr/local'
console.log(globalDirectories.npm.packages);
//=> '/usr/local/lib/node_modules'
```
*/
readonly npm: globalDirectories.GlobalDirectories;
/**
Get the directory of globally installed packages and binaries.
@example
```
import globalDirectories = require('global-dirs');
console.log(globalDirectories.npm.binaries);
//=> '/usr/local/bin'
console.log(globalDirectories.yarn.packages);
//=> '/Users/sindresorhus/.config/yarn/global/node_modules'
```
*/
readonly yarn: globalDirectories.GlobalDirectories;
};
export = globalDirectories;

View File

@@ -0,0 +1,106 @@
# fetch-blob
[![npm version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![coverage status][codecov-image]][codecov-url]
[![install size][install-size-image]][install-size-url]
A Blob implementation in Node.js, originally from [node-fetch](https://github.com/node-fetch/node-fetch).
## Installation
```sh
npm install fetch-blob
```
<details>
<summary>Upgrading from 2x to 3x</summary>
Updating from 2 to 3 should be a breeze since there is not many changes to the blob specification.
The major cause of a major release is coding standards.
- internal WeakMaps was replaced with private fields
- internal Buffer.from was replaced with TextEncoder/Decoder
- internal buffers was replaced with Uint8Arrays
- CommonJS was replaced with ESM
- The node stream returned by calling `blob.stream()` was replaced with whatwg streams
- (Read "Differences from other blobs" for more info.)
</details>
<details>
<summary>Differences from other Blobs</summary>
- Unlike NodeJS `buffer.Blob` (Added in: v15.7.0) and browser native Blob this polyfilled version can't be sent via PostMessage
- This blob version is more arbitrary, it can be constructed with blob parts that isn't a instance of itself
it has to look and behave as a blob to be accepted as a blob part.
- The benefit of this is that you can create other types of blobs that don't contain any internal data that has to be read in other ways, such as the `BlobDataItem` created in `from.js` that wraps a file path into a blob-like item and read lazily (nodejs plans to [implement this][fs-blobs] as well)
- The `blob.stream()` is the most noticeable differences. It returns a WHATWG stream now. to keep it as a node stream you would have to do:
```js
import {Readable} from 'stream'
const stream = Readable.from(blob.stream())
```
</details>
## Usage
```js
// Ways to import
// (PS it's dependency free ESM package so regular http-import from CDN works too)
import Blob from 'fetch-blob'
import File from 'fetch-blob/file.js'
import {Blob} from 'fetch-blob'
import {File} from 'fetch-blob/file.js'
const {Blob} = await import('fetch-blob')
// Ways to read the blob:
const blob = new Blob(['hello, world'])
await blob.text()
await blob.arrayBuffer()
for await (let chunk of blob.stream()) { ... }
blob.stream().getReader().read()
blob.stream().getReader({mode: 'byob'}).read(view)
```
### Blob part backed up by filesystem
`fetch-blob/from.js` comes packed with tools to convert any filepath into either a Blob or a File
It will not read the content into memory. It will only stat the file for last modified date and file size.
```js
// The default export is sync and use fs.stat to retrieve size & last modified as a blob
import blobFromSync from 'fetch-blob/from.js'
import {File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync} from 'fetch-blob/from.js'
const fsFile = fileFromSync('./2-GiB-file.bin', 'application/octet-stream')
const fsBlob = await blobFrom('./2-GiB-file.mp4')
// Not a 4 GiB memory snapshot, just holds references
// points to where data is located on the disk
const blob = new Blob([fsFile, fsBlob, 'memory', new Uint8Array(10)])
console.log(blob.size) // ~4 GiB
```
`blobFrom|blobFromSync|fileFrom|fileFromSync(path, [mimetype])`
### Creating Blobs backed up by other async sources
Our Blob & File class are more generic then any other polyfills in the way that it can accept any blob look-a-like item
An example of this is that our blob implementation can be constructed with parts coming from [BlobDataItem](https://github.com/node-fetch/fetch-blob/blob/8ef89adad40d255a3bbd55cf38b88597c1cd5480/from.js#L32) (aka a filepath) or from [buffer.Blob](https://nodejs.org/api/buffer.html#buffer_new_buffer_blob_sources_options), It dose not have to implement all the methods - just enough that it can be read/understood by our Blob implementation. The minium requirements is that it has `Symbol.toStringTag`, `size`, `slice()` and either a `stream()` or a `arrayBuffer()` method. If you then wrap it in our Blob or File `new Blob([blobDataItem])` then you get all of the other methods that should be implemented in a blob or file
An example of this could be to create a file or blob like item coming from a remote HTTP request. Or from a DataBase
See the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob) and [tests](https://github.com/node-fetch/fetch-blob/blob/master/test.js) for more details of how to use the Blob.
[npm-image]: https://flat.badgen.net/npm/v/fetch-blob
[npm-url]: https://www.npmjs.com/package/fetch-blob
[ci-image]: https://github.com/node-fetch/fetch-blob/workflows/CI/badge.svg
[ci-url]: https://github.com/node-fetch/fetch-blob/actions
[codecov-image]: https://flat.badgen.net/codecov/c/github/node-fetch/fetch-blob/master
[codecov-url]: https://codecov.io/gh/node-fetch/fetch-blob
[install-size-image]: https://flat.badgen.net/packagephobia/install/fetch-blob
[install-size-url]: https://packagephobia.now.sh/result?p=fetch-blob
[fs-blobs]: https://github.com/nodejs/node/issues/37340

View File

@@ -0,0 +1,31 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $BigInt = GetIntrinsic('%BigInt%', true);
var $RangeError = GetIntrinsic('%RangeError%');
var $TypeError = GetIntrinsic('%TypeError%');
var Type = require('../Type');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate
module.exports = function BigIntExponentiate(base, exponent) {
if (Type(base) !== 'BigInt' || Type(exponent) !== 'BigInt') {
throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts');
}
if (exponent < $BigInt(0)) {
throw new $RangeError('Exponent must be positive');
}
if (/* base === $BigInt(0) && */ exponent === $BigInt(0)) {
return $BigInt(1);
}
var square = base;
var remaining = exponent;
while (remaining > $BigInt(0)) {
square += exponent;
--remaining; // eslint-disable-line no-plusplus
}
return square;
};

View File

@@ -0,0 +1 @@
{"version":3,"file":"ArgumentOutOfRangeError.js","sourceRoot":"","sources":["../../../../src/internal/util/ArgumentOutOfRangeError.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAsBzC,QAAA,uBAAuB,GAAgC,mCAAgB,CAClF,UAAC,MAAM;IACL,OAAA,SAAS,2BAA2B;QAClC,MAAM,CAAC,IAAI,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,uBAAuB,CAAC;IACzC,CAAC;AAJD,CAIC,CACJ,CAAC"}

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('./async').reflect;

View File

@@ -0,0 +1,44 @@
import type {Subtract} from './internal';
import type {IsEqual} from './is-equal';
type Recursive<T> = Array<Recursive<T>>;
/**
Creates a type that represents a multidimensional array of the given type and dimension.
Use-cases:
- Return a n-dimensional array from functions.
- Declare a n-dimensional array by defining its dimensions rather than declaring `[]` repetitively.
- Infer the dimensions of a n-dimensional array automatically from function arguments.
- Avoid the need to know in advance the dimensions of a n-dimensional array allowing them to be dynamic.
@example
```
import type {MultidimensionalArray} from 'type-fest';
function emptyMatrix<T extends number>(dimensions: T): MultidimensionalArray<unknown, T> {
const matrix: unknown[] = [];
let subMatrix = matrix;
for (let dimension = 1; dimension < dimensions; ++dimension) {
console.log(`Initializing dimension #${dimension}`);
subMatrix[0] = [];
subMatrix = subMatrix[0] as unknown[];
}
return matrix as MultidimensionalArray<unknown, T>;
}
const matrix = emptyMatrix(3);
matrix[0][0][0] = 42;
```
@category Array
*/
export type MultidimensionalArray<Element, Dimensions extends number> = number extends Dimensions
? Recursive<Element>
: IsEqual<Dimensions, 0> extends true
? Element
: Array<MultidimensionalArray<Element, Subtract<Dimensions, 1>>>;

View File

@@ -0,0 +1,58 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = require('call-bind/callBound');
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
var Type = require('./Type');
var UTF16SurrogatePairToCodePoint = require('./UTF16SurrogatePairToCodePoint');
var $charAt = callBound('String.prototype.charAt');
var $charCodeAt = callBound('String.prototype.charCodeAt');
// https://262.ecma-international.org/12.0/#sec-codepointat
module.exports = function CodePointAt(string, position) {
if (Type(string) !== 'String') {
throw new $TypeError('Assertion failed: `string` must be a String');
}
var size = string.length;
if (position < 0 || position >= size) {
throw new $TypeError('Assertion failed: `position` must be >= 0, and < the length of `string`');
}
var first = $charCodeAt(string, position);
var cp = $charAt(string, position);
var firstIsLeading = isLeadingSurrogate(first);
var firstIsTrailing = isTrailingSurrogate(first);
if (!firstIsLeading && !firstIsTrailing) {
return {
'[[CodePoint]]': cp,
'[[CodeUnitCount]]': 1,
'[[IsUnpairedSurrogate]]': false
};
}
if (firstIsTrailing || (position + 1 === size)) {
return {
'[[CodePoint]]': cp,
'[[CodeUnitCount]]': 1,
'[[IsUnpairedSurrogate]]': true
};
}
var second = $charCodeAt(string, position + 1);
if (!isTrailingSurrogate(second)) {
return {
'[[CodePoint]]': cp,
'[[CodeUnitCount]]': 1,
'[[IsUnpairedSurrogate]]': true
};
}
return {
'[[CodePoint]]': UTF16SurrogatePairToCodePoint(first, second),
'[[CodeUnitCount]]': 2,
'[[IsUnpairedSurrogate]]': false
};
};

View File

@@ -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.02817,"99":0,"100":0,"101":0,"102":0,"103":0.09859,"104":0.01408,"105":0.01408,"106":0,"107":0.02817,"108":0.91898,"109":1.00701,"110":1.11968,"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.05282,"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.00704,"104":0,"105":0.01408,"106":0,"107":0,"108":0.04577,"109":2.25344,"110":1.38023,"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.20774,"95":0.0669,"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.1338,"79":0,"80":0.03873,"81":0,"83":0,"84":0.02817,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.04577,"92":0.02817,"93":0.00704,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00704,"101":0,"102":0.00704,"103":0.10563,"104":0.02113,"105":0,"106":0,"107":0,"108":0.05986,"109":1.54572,"110":1.16545},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.26055,"14":0.01408,"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.01408,"15.1":0,"15.2-15.3":0,"15.4":0.01408,"15.5":0,"15.6":0.15845,"16.0":0,"16.1":0.01408,"16.2":0.12676,"16.3":0.50702,"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.08236,"7.0-7.1":0,"8.1-8.4":0.05412,"9.0-9.2":0,"9.3":0.02824,"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.38119,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0,"14.0-14.4":0.05412,"14.5-14.8":0.46355,"15.0-15.1":0.1906,"15.2-15.3":0.27295,"15.4":0.24472,"15.5":0.13648,"15.6":4.73431,"16.0":1.22358,"16.1":4.81431,"16.2":2.99306,"16.3":6.50144,"16.4":0},P:{"4":0,"20":4.38028,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0.02047,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0,"14.0":7.55291,"15.0":0,"16.0":0,"17.0":0,"18.0":0.04094,"19.0":7.48127},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.08098,"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":38.2088},R:{_:"0"},M:{"0":0.97833},Q:{"13.1":0}};

View File

@@ -0,0 +1,132 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
// It turns out that some (most?) JavaScript engines don't self-host
// `Array.prototype.sort`. This makes sense because C++ will likely remain
// faster than JS when doing raw CPU-intensive sorting. However, when using a
// custom comparator function, calling back and forth between the VM's C++ and
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
// worse generated code for the comparator function than would be optimal. In
// fact, when sorting with a comparator, these costs outweigh the benefits of
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
// a ~3500ms mean speed-up in `bench/bench.html`.
function SortTemplate(comparator) {
/**
* Swap the elements indexed by `x` and `y` in the array `ary`.
*
* @param {Array} ary
* The array.
* @param {Number} x
* The index of the first item.
* @param {Number} y
* The index of the second item.
*/
function swap(ary, x, y) {
var temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
/**
* Returns a random integer within the range `low .. high` inclusive.
*
* @param {Number} low
* The lower bound on the range.
* @param {Number} high
* The upper bound on the range.
*/
function randomIntInRange(low, high) {
return Math.round(low + (Math.random() * (high - low)));
}
/**
* The Quick Sort algorithm.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
* @param {Number} p
* Start index of the array
* @param {Number} r
* End index of the array
*/
function doQuickSort(ary, comparator, p, r) {
// If our lower bound is less than our upper bound, we (1) partition the
// array into two pieces and (2) recurse on each half. If it is not, this is
// the empty array and our base case.
if (p < r) {
// (1) Partitioning.
//
// The partitioning chooses a pivot between `p` and `r` and moves all
// elements that are less than or equal to the pivot to the before it, and
// all the elements that are greater than it after it. The effect is that
// once partition is done, the pivot is in the exact place it will be when
// the array is put in sorted order, and it will not need to be moved
// again. This runs in O(n) time.
// Always choose a random pivot so that an input array which is reverse
// sorted does not cause O(n^2) running time.
var pivotIndex = randomIntInRange(p, r);
var i = p - 1;
swap(ary, pivotIndex, r);
var pivot = ary[r];
// Immediately after `j` is incremented in this loop, the following hold
// true:
//
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
//
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
for (var j = p; j < r; j++) {
if (comparator(ary[j], pivot, false) <= 0) {
i += 1;
swap(ary, i, j);
}
}
swap(ary, i + 1, j);
var q = i + 1;
// (2) Recurse on each half.
doQuickSort(ary, comparator, p, q - 1);
doQuickSort(ary, comparator, q + 1, r);
}
}
return doQuickSort;
}
function cloneSort(comparator) {
let template = SortTemplate.toString();
let templateFn = new Function(`return ${template}`)();
return templateFn(comparator);
}
/**
* Sort the given array in-place with the given comparator function.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
*/
let sortCache = new WeakMap();
exports.quickSort = function (ary, comparator, start = 0) {
let doQuickSort = sortCache.get(comparator);
if (doQuickSort === void 0) {
doQuickSort = cloneSort(comparator);
sortCache.set(comparator, doQuickSort);
}
doQuickSort(ary, comparator, start, ary.length - 1);
};

View File

@@ -0,0 +1,20 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = require('./IsPropertyKey');
var Type = require('./Type');
// https://262.ecma-international.org/6.0/#sec-ordinaryhasproperty
module.exports = function OrdinaryHasProperty(O, P) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: P must be a Property Key');
}
return P in O;
};

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('update', require('../update'));
func.placeholder = require('./placeholder');
module.exports = func;