new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/internal/observable/dom/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AA4FvD,MAAM,UAAU,SAAS,CACvB,KAAuB,EACvB,mBAEI,EAAE;IAEN,MAAM,EAAE,QAAQ,KAAc,gBAAgB,EAAzB,IAAI,UAAK,gBAAgB,EAAxC,YAAqB,CAAmB,CAAC;IAC/C,OAAO,IAAI,UAAU,CAAe,CAAC,UAAU,EAAE,EAAE;QAKjD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAK9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAKrB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QACrC,IAAI,WAAW,EAAE;YACf,IAAI,WAAW,CAAC,OAAO,EAAE;gBACvB,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;iBAAM;gBAGL,MAAM,kBAAkB,GAAG,GAAG,EAAE;oBAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,UAAU,CAAC,KAAK,EAAE,CAAC;qBACpB;gBACH,CAAC,CAAC;gBACF,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;gBAC1D,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;aACpF;SACF;QAOD,MAAM,iBAAiB,mCAAqB,IAAI,KAAE,MAAM,GAAE,CAAC;QAE3D,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,EAAE;YAC/B,SAAS,GAAG,KAAK,CAAC;YAClB,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;QAEF,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC;aAC5B,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,IAAI,QAAQ,EAAE;gBAIZ,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CACrC,wBAAwB,CACtB,UAAU,EAEV,SAAS,EAET,GAAG,EAAE;oBACH,SAAS,GAAG,KAAK,CAAC;oBAClB,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,CAAC,EACD,WAAW,CACZ,CACF,CAAC;aACH;iBAAM;gBACL,SAAS,GAAG,KAAK,CAAC;gBAClB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC1B,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;QACH,CAAC,CAAC;aACD,KAAK,CAAC,WAAW,CAAC,CAAC;QAEtB,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,EAAE;gBACb,UAAU,CAAC,KAAK,EAAE,CAAC;aACpB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,2 @@
|
||||
title,actors,data,uuid,fieldA,fieldB
|
||||
"""","[""Neil"", ""Bill"""", ""Carl"",""Richard"",""Linus""]",xyabcde,"fejal""eifa","bnej""""falkfe","""eisjfes"""
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"global-dirs","version":"3.0.1","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"package.json":{"checkedAt":1678883672613,"integrity":"sha512-TqsDUmvDq1uBuDkrleY0gX97Cd2ui1uCOvvIxd3dcbguxhhY8cu1zKW8aCf2yHnEvKnLVr3LK27F1W2U7Q1EPA==","mode":420,"size":934},"readme.md":{"checkedAt":1678883672613,"integrity":"sha512-DsXesQX9ZmHaB/FpSq7VS3QlrsEZo7QSxaKoQaoeuWdJKb92EGe56P+4SBZ8jjlgPMlIpB+Dvf27rvl7KciROg==","mode":420,"size":1758},"index.js":{"checkedAt":1678883672613,"integrity":"sha512-/61eeg46WpqFo2BIt6dfZz5zgXMhCFo3aBVgCezcE304TO7+oicg3bZ+7vR4byBguyq5rIFS1ViUx0Ws6jB/rg==","mode":420,"size":3266},"index.d.ts":{"checkedAt":1678883672613,"integrity":"sha512-VNgl2x29caJwJHTPg15xWreLX17LiLmfl0SaYxnxy6xWJsQ4WhXjptOX6WRAJPb1OEYld79SzuVuNX/D+JxILg==","mode":420,"size":1288}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cacheWrapper.js","names":["cacheWrapper","cache","key","fn","cached","get","undefined","result","set","cacheWrapperSync"],"sources":["../src/cacheWrapper.ts"],"sourcesContent":["import { Cache, CosmiconfigResult } from './types';\n\nasync function cacheWrapper(\n cache: Cache,\n key: string,\n fn: () => Promise<CosmiconfigResult>,\n): Promise<CosmiconfigResult> {\n const cached = cache.get(key);\n if (cached !== undefined) {\n return cached;\n }\n\n const result = await fn();\n cache.set(key, result);\n return result;\n}\n\nfunction cacheWrapperSync(\n cache: Cache,\n key: string,\n fn: () => CosmiconfigResult,\n): CosmiconfigResult {\n const cached = cache.get(key);\n if (cached !== undefined) {\n return cached;\n }\n\n const result = fn();\n cache.set(key, result);\n return result;\n}\n\nexport { cacheWrapper, cacheWrapperSync };\n"],"mappings":";;;;;;;;AAEA,eAAeA,YAAf,CACEC,KADF,EAEEC,GAFF,EAGEC,EAHF,EAI8B;EAC5B,MAAMC,MAAM,GAAGH,KAAK,CAACI,GAAN,CAAUH,GAAV,CAAf;;EACA,IAAIE,MAAM,KAAKE,SAAf,EAA0B;IACxB,OAAOF,MAAP;EACD;;EAED,MAAMG,MAAM,GAAG,MAAMJ,EAAE,EAAvB;EACAF,KAAK,CAACO,GAAN,CAAUN,GAAV,EAAeK,MAAf;EACA,OAAOA,MAAP;AACD;;AAED,SAASE,gBAAT,CACER,KADF,EAEEC,GAFF,EAGEC,EAHF,EAIqB;EACnB,MAAMC,MAAM,GAAGH,KAAK,CAACI,GAAN,CAAUH,GAAV,CAAf;;EACA,IAAIE,MAAM,KAAKE,SAAf,EAA0B;IACxB,OAAOF,MAAP;EACD;;EAED,MAAMG,MAAM,GAAGJ,EAAE,EAAjB;EACAF,KAAK,CAACO,GAAN,CAAUN,GAAV,EAAeK,MAAf;EACA,OAAOA,MAAP;AACD"}
|
||||
@@ -0,0 +1,98 @@
|
||||
import assertString from './util/assertString'; // common patterns
|
||||
|
||||
var threeDigit = /^\d{3}$/;
|
||||
var fourDigit = /^\d{4}$/;
|
||||
var fiveDigit = /^\d{5}$/;
|
||||
var sixDigit = /^\d{6}$/;
|
||||
var patterns = {
|
||||
AD: /^AD\d{3}$/,
|
||||
AT: fourDigit,
|
||||
AU: fourDigit,
|
||||
AZ: /^AZ\d{4}$/,
|
||||
BA: /^([7-8]\d{4}$)/,
|
||||
BE: fourDigit,
|
||||
BG: fourDigit,
|
||||
BR: /^\d{5}-\d{3}$/,
|
||||
BY: /^2[1-4]\d{4}$/,
|
||||
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
|
||||
CH: fourDigit,
|
||||
CN: /^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/,
|
||||
CZ: /^\d{3}\s?\d{2}$/,
|
||||
DE: fiveDigit,
|
||||
DK: fourDigit,
|
||||
DO: fiveDigit,
|
||||
DZ: fiveDigit,
|
||||
EE: fiveDigit,
|
||||
ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/,
|
||||
FI: fiveDigit,
|
||||
FR: /^\d{2}\s?\d{3}$/,
|
||||
GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,
|
||||
GR: /^\d{3}\s?\d{2}$/,
|
||||
HR: /^([1-5]\d{4}$)/,
|
||||
HT: /^HT\d{4}$/,
|
||||
HU: fourDigit,
|
||||
ID: fiveDigit,
|
||||
IE: /^(?!.*(?:o))[A-Za-z]\d[\dw]\s\w{4}$/i,
|
||||
IL: /^(\d{5}|\d{7})$/,
|
||||
IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
|
||||
IR: /^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/,
|
||||
IS: threeDigit,
|
||||
IT: fiveDigit,
|
||||
JP: /^\d{3}\-\d{4}$/,
|
||||
KE: fiveDigit,
|
||||
KR: /^(\d{5}|\d{6})$/,
|
||||
LI: /^(948[5-9]|949[0-7])$/,
|
||||
LT: /^LT\-\d{5}$/,
|
||||
LU: fourDigit,
|
||||
LV: /^LV\-\d{4}$/,
|
||||
LK: fiveDigit,
|
||||
MG: threeDigit,
|
||||
MX: fiveDigit,
|
||||
MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
|
||||
MY: fiveDigit,
|
||||
NL: /^\d{4}\s?[a-z]{2}$/i,
|
||||
NO: fourDigit,
|
||||
NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,
|
||||
NZ: fourDigit,
|
||||
PL: /^\d{2}\-\d{3}$/,
|
||||
PR: /^00[679]\d{2}([ -]\d{4})?$/,
|
||||
PT: /^\d{4}\-\d{3}?$/,
|
||||
RO: sixDigit,
|
||||
RU: sixDigit,
|
||||
SA: fiveDigit,
|
||||
SE: /^[1-9]\d{2}\s?\d{2}$/,
|
||||
SG: sixDigit,
|
||||
SI: fourDigit,
|
||||
SK: /^\d{3}\s?\d{2}$/,
|
||||
TH: fiveDigit,
|
||||
TN: fourDigit,
|
||||
TW: /^\d{3}(\d{2})?$/,
|
||||
UA: fiveDigit,
|
||||
US: /^\d{5}(-\d{4})?$/,
|
||||
ZA: fourDigit,
|
||||
ZM: fiveDigit
|
||||
};
|
||||
export var locales = Object.keys(patterns);
|
||||
export default function isPostalCode(str, locale) {
|
||||
assertString(str);
|
||||
|
||||
if (locale in patterns) {
|
||||
return patterns[locale].test(str);
|
||||
} else if (locale === 'any') {
|
||||
for (var key in patterns) {
|
||||
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
|
||||
// istanbul ignore else
|
||||
if (patterns.hasOwnProperty(key)) {
|
||||
var pattern = patterns[key];
|
||||
|
||||
if (pattern.test(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new Error("Invalid locale '".concat(locale, "'"));
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { distinctUntilChanged } from './distinctUntilChanged';
|
||||
export function distinctUntilKeyChanged(key, compare) {
|
||||
return distinctUntilChanged(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; });
|
||||
}
|
||||
//# sourceMappingURL=distinctUntilKeyChanged.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var inspect = require('object-inspect');
|
||||
var forEach = require('for-each');
|
||||
|
||||
var isWeakRef = require('..');
|
||||
|
||||
test('isWeakRef', function (t) {
|
||||
t.equal(typeof isWeakRef, 'function', 'is a function');
|
||||
|
||||
var nonWeakRefs = [undefined, null, true, false, 42, 0, Infinity, NaN, /a/g, function () {}, {}, []];
|
||||
forEach(nonWeakRefs, function (nonWeakRef) {
|
||||
t.equal(isWeakRef(nonWeakRef), false, inspect(nonWeakRef) + ' is not a WeakRef');
|
||||
});
|
||||
|
||||
t.test('actual WeakRefs', { skip: typeof WeakRef === 'undefined' }, function (st) {
|
||||
var ref = new WeakRef({});
|
||||
|
||||
st.equal(isWeakRef(ref), true, inspect(ref) + ' is a WeakRef');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
var VENDOR_PREFIX_PATTERN = /(?:^|\W)(\-\w+\-)/g;
|
||||
|
||||
function unique(value) {
|
||||
var prefixes = [];
|
||||
var match;
|
||||
|
||||
while ((match = VENDOR_PREFIX_PATTERN.exec(value)) !== null) {
|
||||
if (prefixes.indexOf(match[0]) == -1) {
|
||||
prefixes.push(match[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return prefixes;
|
||||
}
|
||||
|
||||
function same(value1, value2) {
|
||||
return unique(value1).sort().join(',') == unique(value2).sort().join(',');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
unique: unique,
|
||||
same: same
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
export interface Options {
|
||||
/**
|
||||
The stream to check.
|
||||
|
||||
@default process.stdout
|
||||
*/
|
||||
readonly stream?: NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if stdout or stderr is [interactive](https://unix.stackexchange.com/a/43389/7678).
|
||||
|
||||
It checks that the stream is [TTY](https://jameshfisher.com/2017/12/09/what-is-a-tty/), not a dumb terminal, and not running in a CI.
|
||||
|
||||
This can be useful to decide whether to present interactive UI or animations in the terminal.
|
||||
|
||||
@example
|
||||
```
|
||||
import isInteractive from 'is-interactive';
|
||||
|
||||
isInteractive();
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export default function isInteractive(options?: Options): boolean;
|
||||
@@ -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 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","2":"DC tB EC FC"},D:{"1":"4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB 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","132":"0 1 2 3 I v J D E F A B C K L G M N O w g x y z"},E:{"1":"F A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"HC","4":"zB","132":"I v J D E IC JC KC"},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":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","132":"E zB UC BC VC WC XC YC"},H:{"1":"oC"},I:{"1":"f tC uC","2":"pC qC rC","132":"tB I sC BC"},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:"SVG in HTML img element"};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
|
||||
<script>
|
||||
export let getSelectionLabel = undefined;
|
||||
export let item = undefined;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.selection {
|
||||
text-overflow: ellipsis;
|
||||
overflow-x: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="selection">
|
||||
{@html getSelectionLabel(item)}
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [2.0.3](https://github.com/medikoo/es6-weak-map/compare/v2.0.2...v2.0.3) (2019-06-07)
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "ieee754",
|
||||
"description": "Read/write IEEE754 floating point numbers from/to a Buffer or array-like object",
|
||||
"version": "1.2.1",
|
||||
"author": {
|
||||
"name": "Feross Aboukhadijeh",
|
||||
"email": "feross@feross.org",
|
||||
"url": "https://feross.org"
|
||||
},
|
||||
"contributors": [
|
||||
"Romain Beauxis <toots@rastageeks.org>"
|
||||
],
|
||||
"devDependencies": {
|
||||
"airtap": "^3.0.0",
|
||||
"standard": "*",
|
||||
"tape": "^5.0.1"
|
||||
},
|
||||
"keywords": [
|
||||
"IEEE 754",
|
||||
"buffer",
|
||||
"convert",
|
||||
"floating point",
|
||||
"ieee754"
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/feross/ieee754.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && npm run test-node && npm run test-browser",
|
||||
"test-browser": "airtap -- test/*.js",
|
||||
"test-browser-local": "airtap --local -- test/*.js",
|
||||
"test-node": "tape test/*.js"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
var value = require("../../object/valid-value")
|
||||
, aFrom = require("../from")
|
||||
, toArray = require("../to-array")
|
||||
, contains = require("./contains")
|
||||
, byLength = require("./_compare-by-length")
|
||||
, filter = Array.prototype.filter
|
||||
, push = Array.prototype.push;
|
||||
|
||||
module.exports = function (/* …lists*/) {
|
||||
var lists, seen, result;
|
||||
if (!arguments.length) return aFrom(this);
|
||||
push.apply((lists = [this]), arguments);
|
||||
lists.forEach(value);
|
||||
seen = [];
|
||||
result = [];
|
||||
lists.sort(byLength).forEach(function (list) {
|
||||
result = result
|
||||
.filter(function (item) { return !contains.call(list, item); })
|
||||
.concat(filter.call(list, function (item) { return !contains.call(seen, item); }));
|
||||
push.apply(seen, toArray(list));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Gets the number of `placeholder` occurrences in `array`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} placeholder The placeholder to search for.
|
||||
* @returns {number} Returns the placeholder count.
|
||||
*/
|
||||
function countHolders(array, placeholder) {
|
||||
var length = array.length,
|
||||
result = 0;
|
||||
|
||||
while (length--) {
|
||||
if (array[length] === placeholder) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = countHolders;
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2012-2014 Raynos.
|
||||
|
||||
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 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J D E F 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 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","2":"DC tB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 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","2":"I v J D E F A B C"},E:{"1":"J D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB","132":"v IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 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 TC rB","2":"F B PC QC RC SC qB AC"},G:{"1":"E 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","2":"zB UC BC"},H:{"1":"oC"},I:{"1":"tB I f sC BC tC uC","2":"pC qC rC"},J:{"1":"D A"},K:{"1":"C h AC rB","2":"A B qB"},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:6,C:"ECMAScript 5 Strict Mode"};
|
||||
@@ -0,0 +1,20 @@
|
||||
var baseAssignValue = require('./_baseAssignValue'),
|
||||
eq = require('./eq');
|
||||
|
||||
/**
|
||||
* This function is like `assignValue` except that it doesn't assign
|
||||
* `undefined` values.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {*} value The value to assign.
|
||||
*/
|
||||
function assignMergeValue(object, key, value) {
|
||||
if ((value !== undefined && !eq(object[key], value)) ||
|
||||
(value === undefined && !(key in object))) {
|
||||
baseAssignValue(object, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = assignMergeValue;
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"new-github-release-url","version":"2.0.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883671426,"integrity":"sha512-a7vbPE06ewl1usCONu0+0uEUOkup/mrChq0i5sMBCjBfcyngpxn8fY6Qia/7c7bvqNfuswiHOnwnLWpBgg4Ljw==","mode":420,"size":725},"package.json":{"checkedAt":1678883671426,"integrity":"sha512-n8CrYbrJcDsLex333Z7yepvrz3mm3kJvnmAMe4MPjeezcNOmZ0wHva+uf3dIfWORF6b0WirMh03ykCm3NMJMHg==","mode":420,"size":944},"readme.md":{"checkedAt":1678883671426,"integrity":"sha512-VhAQU39ilV0NBtGMDpDqZHw1B5gkUaa2SQHFO8shftAagNuAiF9nwlLAPPA9kUt4BiKCMXUrMus4QouUQ0tlLA==","mode":420,"size":1816},"index.d.ts":{"checkedAt":1678883671426,"integrity":"sha512-x11Ow5X3IfoSwZKR7PrvhN0mdfLtnNZ8irMqoVW14kgmZuIGmpz+dtJPPPoDAWXHerLXEHRkKKl9KkwDoU2pIg==","mode":420,"size":1572}}}
|
||||
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
|
||||
var indexOf = require("es5-ext/array/#/e-index-of")
|
||||
, create = Object.create;
|
||||
|
||||
module.exports = function (length) {
|
||||
var lastId = 0, map = [[], []], cache = create(null);
|
||||
return {
|
||||
get: function (args) {
|
||||
var index = 0, set = map, i;
|
||||
while (index < length - 1) {
|
||||
i = indexOf.call(set[0], args[index]);
|
||||
if (i === -1) return null;
|
||||
set = set[1][i];
|
||||
++index;
|
||||
}
|
||||
i = indexOf.call(set[0], args[index]);
|
||||
if (i === -1) return null;
|
||||
return set[1][i] || null;
|
||||
},
|
||||
set: function (args) {
|
||||
var index = 0, set = map, i;
|
||||
while (index < length - 1) {
|
||||
i = indexOf.call(set[0], args[index]);
|
||||
if (i === -1) {
|
||||
i = set[0].push(args[index]) - 1;
|
||||
set[1].push([[], []]);
|
||||
}
|
||||
set = set[1][i];
|
||||
++index;
|
||||
}
|
||||
i = indexOf.call(set[0], args[index]);
|
||||
if (i === -1) {
|
||||
i = set[0].push(args[index]) - 1;
|
||||
}
|
||||
set[1][i] = ++lastId;
|
||||
cache[lastId] = args;
|
||||
return lastId;
|
||||
},
|
||||
delete: function (id) {
|
||||
var index = 0, set = map, i, path = [], args = cache[id];
|
||||
while (index < length - 1) {
|
||||
i = indexOf.call(set[0], args[index]);
|
||||
if (i === -1) {
|
||||
return;
|
||||
}
|
||||
path.push(set, i);
|
||||
set = set[1][i];
|
||||
++index;
|
||||
}
|
||||
i = indexOf.call(set[0], args[index]);
|
||||
if (i === -1) {
|
||||
return;
|
||||
}
|
||||
id = set[1][i];
|
||||
set[0].splice(i, 1);
|
||||
set[1].splice(i, 1);
|
||||
while (!set[0].length && path.length) {
|
||||
i = path.pop();
|
||||
set = path.pop();
|
||||
set[0].splice(i, 1);
|
||||
set[1].splice(i, 1);
|
||||
}
|
||||
delete cache[id];
|
||||
},
|
||||
clear: function () {
|
||||
map = [[], []];
|
||||
cache = create(null);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Inspect JS
|
||||
|
||||
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,222 @@
|
||||
import assert from './_assert.js';
|
||||
import u64 from './_u64.js';
|
||||
import {
|
||||
Hash,
|
||||
u32,
|
||||
Input,
|
||||
toBytes,
|
||||
wrapConstructor,
|
||||
wrapConstructorWithOpts,
|
||||
HashXOF,
|
||||
} from './utils.js';
|
||||
|
||||
// Various per round constants calculations
|
||||
const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA]: [number[], number[], bigint[]] = [[], [], []];
|
||||
const _0n = BigInt(0);
|
||||
const _1n = BigInt(1);
|
||||
const _2n = BigInt(2);
|
||||
const _7n = BigInt(7);
|
||||
const _256n = BigInt(256);
|
||||
const _0x71n = BigInt(0x71);
|
||||
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
||||
// Pi
|
||||
[x, y] = [y, (2 * x + 3 * y) % 5];
|
||||
SHA3_PI.push(2 * (5 * y + x));
|
||||
// Rotational
|
||||
SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
|
||||
// Iota
|
||||
let t = _0n;
|
||||
for (let j = 0; j < 7; j++) {
|
||||
R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
|
||||
if (R & _2n) t ^= _1n << ((_1n << BigInt(j)) - _1n);
|
||||
}
|
||||
_SHA3_IOTA.push(t);
|
||||
}
|
||||
const [SHA3_IOTA_H, SHA3_IOTA_L] = u64.split(_SHA3_IOTA, true);
|
||||
|
||||
// Left rotation (without 0, 32, 64)
|
||||
const rotlH = (h: number, l: number, s: number) =>
|
||||
s > 32 ? u64.rotlBH(h, l, s) : u64.rotlSH(h, l, s);
|
||||
const rotlL = (h: number, l: number, s: number) =>
|
||||
s > 32 ? u64.rotlBL(h, l, s) : u64.rotlSL(h, l, s);
|
||||
|
||||
// Same as keccakf1600, but allows to skip some rounds
|
||||
export function keccakP(s: Uint32Array, rounds: number = 24) {
|
||||
const B = new Uint32Array(5 * 2);
|
||||
// NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
|
||||
for (let round = 24 - rounds; round < 24; round++) {
|
||||
// Theta θ
|
||||
for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
||||
for (let x = 0; x < 10; x += 2) {
|
||||
const idx1 = (x + 8) % 10;
|
||||
const idx0 = (x + 2) % 10;
|
||||
const B0 = B[idx0];
|
||||
const B1 = B[idx0 + 1];
|
||||
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
||||
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
||||
for (let y = 0; y < 50; y += 10) {
|
||||
s[x + y] ^= Th;
|
||||
s[x + y + 1] ^= Tl;
|
||||
}
|
||||
}
|
||||
// Rho (ρ) and Pi (π)
|
||||
let curH = s[2];
|
||||
let curL = s[3];
|
||||
for (let t = 0; t < 24; t++) {
|
||||
const shift = SHA3_ROTL[t];
|
||||
const Th = rotlH(curH, curL, shift);
|
||||
const Tl = rotlL(curH, curL, shift);
|
||||
const PI = SHA3_PI[t];
|
||||
curH = s[PI];
|
||||
curL = s[PI + 1];
|
||||
s[PI] = Th;
|
||||
s[PI + 1] = Tl;
|
||||
}
|
||||
// Chi (χ)
|
||||
for (let y = 0; y < 50; y += 10) {
|
||||
for (let x = 0; x < 10; x++) B[x] = s[y + x];
|
||||
for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
||||
}
|
||||
// Iota (ι)
|
||||
s[0] ^= SHA3_IOTA_H[round];
|
||||
s[1] ^= SHA3_IOTA_L[round];
|
||||
}
|
||||
B.fill(0);
|
||||
}
|
||||
|
||||
export class Keccak extends Hash<Keccak> implements HashXOF<Keccak> {
|
||||
protected state: Uint8Array;
|
||||
protected pos = 0;
|
||||
protected posOut = 0;
|
||||
protected finished = false;
|
||||
protected state32: Uint32Array;
|
||||
protected destroyed = false;
|
||||
// NOTE: we accept arguments in bytes instead of bits here.
|
||||
constructor(
|
||||
public blockLen: number,
|
||||
public suffix: number,
|
||||
public outputLen: number,
|
||||
protected enableXOF = false,
|
||||
protected rounds: number = 24
|
||||
) {
|
||||
super();
|
||||
// Can be passed from user as dkLen
|
||||
assert.number(outputLen);
|
||||
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
|
||||
if (0 >= this.blockLen || this.blockLen >= 200)
|
||||
throw new Error('Sha3 supports only keccak-f1600 function');
|
||||
this.state = new Uint8Array(200);
|
||||
this.state32 = u32(this.state);
|
||||
}
|
||||
protected keccak() {
|
||||
keccakP(this.state32, this.rounds);
|
||||
this.posOut = 0;
|
||||
this.pos = 0;
|
||||
}
|
||||
update(data: Input) {
|
||||
assert.exists(this);
|
||||
const { blockLen, state } = this;
|
||||
data = toBytes(data);
|
||||
const len = data.length;
|
||||
for (let pos = 0; pos < len; ) {
|
||||
const take = Math.min(blockLen - this.pos, len - pos);
|
||||
for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];
|
||||
if (this.pos === blockLen) this.keccak();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
protected finish() {
|
||||
if (this.finished) return;
|
||||
this.finished = true;
|
||||
const { state, suffix, pos, blockLen } = this;
|
||||
// Do the padding
|
||||
state[pos] ^= suffix;
|
||||
if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
|
||||
state[blockLen - 1] ^= 0x80;
|
||||
this.keccak();
|
||||
}
|
||||
protected writeInto(out: Uint8Array): Uint8Array {
|
||||
assert.exists(this, false);
|
||||
assert.bytes(out);
|
||||
this.finish();
|
||||
const bufferOut = this.state;
|
||||
const { blockLen } = this;
|
||||
for (let pos = 0, len = out.length; pos < len; ) {
|
||||
if (this.posOut >= blockLen) this.keccak();
|
||||
const take = Math.min(blockLen - this.posOut, len - pos);
|
||||
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
||||
this.posOut += take;
|
||||
pos += take;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
xofInto(out: Uint8Array): Uint8Array {
|
||||
// Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
|
||||
if (!this.enableXOF) throw new Error('XOF is not possible for this instance');
|
||||
return this.writeInto(out);
|
||||
}
|
||||
xof(bytes: number): Uint8Array {
|
||||
assert.number(bytes);
|
||||
return this.xofInto(new Uint8Array(bytes));
|
||||
}
|
||||
digestInto(out: Uint8Array) {
|
||||
assert.output(out, this);
|
||||
if (this.finished) throw new Error('digest() was already called');
|
||||
this.writeInto(out);
|
||||
this.destroy();
|
||||
return out;
|
||||
}
|
||||
digest() {
|
||||
return this.digestInto(new Uint8Array(this.outputLen));
|
||||
}
|
||||
destroy() {
|
||||
this.destroyed = true;
|
||||
this.state.fill(0);
|
||||
}
|
||||
_cloneInto(to?: Keccak): Keccak {
|
||||
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
||||
to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
|
||||
to.state32.set(this.state32);
|
||||
to.pos = this.pos;
|
||||
to.posOut = this.posOut;
|
||||
to.finished = this.finished;
|
||||
to.rounds = rounds;
|
||||
// Suffix can change in cSHAKE
|
||||
to.suffix = suffix;
|
||||
to.outputLen = outputLen;
|
||||
to.enableXOF = enableXOF;
|
||||
to.destroyed = this.destroyed;
|
||||
return to;
|
||||
}
|
||||
}
|
||||
|
||||
const gen = (suffix: number, blockLen: number, outputLen: number) =>
|
||||
wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
||||
|
||||
export const sha3_224 = gen(0x06, 144, 224 / 8);
|
||||
/**
|
||||
* SHA3-256 hash function
|
||||
* @param message - that would be hashed
|
||||
*/
|
||||
export const sha3_256 = gen(0x06, 136, 256 / 8);
|
||||
export const sha3_384 = gen(0x06, 104, 384 / 8);
|
||||
export const sha3_512 = gen(0x06, 72, 512 / 8);
|
||||
export const keccak_224 = gen(0x01, 144, 224 / 8);
|
||||
/**
|
||||
* keccak-256 hash function. Different from SHA3-256.
|
||||
* @param message - that would be hashed
|
||||
*/
|
||||
export const keccak_256 = gen(0x01, 136, 256 / 8);
|
||||
export const keccak_384 = gen(0x01, 104, 384 / 8);
|
||||
export const keccak_512 = gen(0x01, 72, 512 / 8);
|
||||
|
||||
export type ShakeOpts = { dkLen?: number };
|
||||
|
||||
const genShake = (suffix: number, blockLen: number, outputLen: number) =>
|
||||
wrapConstructorWithOpts<Keccak, ShakeOpts>(
|
||||
(opts: ShakeOpts = {}) =>
|
||||
new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)
|
||||
);
|
||||
|
||||
export const shake128 = genShake(0x1f, 168, 128 / 8);
|
||||
export const shake256 = genShake(0x1f, 136, 256 / 8);
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "is-map",
|
||||
"version": "2.0.2",
|
||||
"description": "Is this value a JS Map? This module works cross-realm/iframe, and despite ES6 @@toStringTag.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
|
||||
"prepublish": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"tests:shims": "nyc tape --require=es5-shim --require=es5-shim 'test/**/*.js'",
|
||||
"tests:corejs": "nyc tape --require=core-js 'test/**/*.js'",
|
||||
"test": "npm run tests-only && npm run tests:shims && npm run tests:corejs",
|
||||
"posttest": "aud --production"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/is-map.git"
|
||||
},
|
||||
"keywords": [
|
||||
"map",
|
||||
"set",
|
||||
"collection",
|
||||
"is",
|
||||
"robust"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/is-map/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/is-map#readme",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^17.3.0",
|
||||
"aud": "^1.1.3",
|
||||
"auto-changelog": "^2.2.1",
|
||||
"core-js": "^2.6.12",
|
||||
"es5-shim": "^4.5.14",
|
||||
"es6-shim": "^0.35.6",
|
||||
"eslint": "^7.15.0",
|
||||
"for-each": "^0.3.3",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.9.0",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.0.1"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(NaN), 0, "NaN");
|
||||
a(t(-343), 0, "Negative");
|
||||
a(t(232342), 232342, "Positive");
|
||||
a.throws(function () {
|
||||
t(1e23);
|
||||
}, TypeError, "Too large");
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
/**
|
||||
* Emits only the first `count` values emitted by the source Observable.
|
||||
*
|
||||
* <span class="informal">Takes the first `count` values from the source, then
|
||||
* completes.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `take` returns an Observable that emits only the first `count` values emitted
|
||||
* by the source Observable. If the source emits fewer than `count` values then
|
||||
* all of its values are emitted. After that, it completes, regardless if the
|
||||
* source completes.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Take the first 5 seconds of an infinite 1-second interval Observable
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, take } from 'rxjs';
|
||||
*
|
||||
* const intervalCount = interval(1000);
|
||||
* const takeFive = intervalCount.pipe(take(5));
|
||||
* takeFive.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1
|
||||
* // 2
|
||||
* // 3
|
||||
* // 4
|
||||
* ```
|
||||
*
|
||||
* @see {@link takeLast}
|
||||
* @see {@link takeUntil}
|
||||
* @see {@link takeWhile}
|
||||
* @see {@link skip}
|
||||
*
|
||||
* @param count The maximum number of `next` values to emit.
|
||||
* @return A function that returns an Observable that emits only the first
|
||||
* `count` values emitted by the source Observable, or all of the values from
|
||||
* the source if the source emits fewer than `count` values.
|
||||
*/
|
||||
export declare function take<T>(count: number): MonoTypeOperatorFunction<T>;
|
||||
//# sourceMappingURL=take.d.ts.map
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 David Frank
|
||||
|
||||
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,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('flow', require('../flow'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,20 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2018-2021 Josh Junon
|
||||
|
||||
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.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
||||
import { withDefaults } from "./with-defaults";
|
||||
import { DEFAULTS } from "./defaults";
|
||||
export const endpoint = withDefaults(null, DEFAULTS);
|
||||
@@ -0,0 +1,31 @@
|
||||
type IsAny<T> = 0 extends (1 & T) ? true : false; // https://stackoverflow.com/a/49928360/3406963
|
||||
type IsNever<T> = [T] extends [never] ? true : false;
|
||||
type IsUnknown<T> = IsNever<T> extends false ? T extends unknown ? unknown extends T ? IsAny<T> extends false ? true : false : false : false : false;
|
||||
|
||||
/**
|
||||
Create a function type with a return type of your choice and the same parameters as the given function type.
|
||||
|
||||
Use-case: You want to define a wrapped function that returns something different while receiving the same parameters. For example, you might want to wrap a function that can throw an error into one that will return `undefined` instead.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetReturnType} from 'type-fest';
|
||||
|
||||
type MyFunctionThatCanThrow = (foo: SomeType, bar: unknown) => SomeOtherType;
|
||||
|
||||
type MyWrappedFunction = SetReturnType<MyFunctionThatCanThrow, SomeOtherType | undefined>;
|
||||
//=> type MyWrappedFunction = (foo: SomeType, bar: unknown) => SomeOtherType | undefined;
|
||||
```
|
||||
|
||||
@category Utilities
|
||||
*/
|
||||
export type SetReturnType<Fn extends (...args: any[]) => any, TypeToReturn> =
|
||||
// Just using `Parameters<Fn>` isn't ideal because it doesn't handle the `this` fake parameter.
|
||||
Fn extends (this: infer ThisArg, ...args: infer Arguments) => any ? (
|
||||
// If a function did not specify the `this` fake parameter, it will be inferred to `unknown`.
|
||||
// We want to detect this situation just to display a friendlier type upon hovering on an IntelliSense-powered IDE.
|
||||
IsUnknown<ThisArg> extends true ? (...args: Arguments) => TypeToReturn : (this: ThisArg, ...args: Arguments) => TypeToReturn
|
||||
) : (
|
||||
// This part should be unreachable, but we make it meaningful just in case…
|
||||
(...args: Parameters<Fn>) => TypeToReturn
|
||||
);
|
||||
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
var includes = require("../array/#/contains")
|
||||
, uniq = require("../array/#/uniq")
|
||||
, copyDeep = require("./copy-deep")
|
||||
, objForEach = require("./for-each")
|
||||
, isPlainObject = require("./is-plain-object")
|
||||
, ensureValue = require("./valid-value");
|
||||
|
||||
var isArray = Array.isArray, slice = Array.prototype.slice;
|
||||
|
||||
var deepAssign = function (target, source) {
|
||||
if (target === source) return target;
|
||||
if (isPlainObject(target) && isPlainObject(source)) {
|
||||
objForEach(source, function (value, key) { target[key] = deepAssign(target[key], value); });
|
||||
return target;
|
||||
}
|
||||
if (isArray(target) && isArray(source)) {
|
||||
source.forEach(function (item) {
|
||||
if (includes.call(target, item)) return;
|
||||
if (isArray(item) || isPlainObject(item)) item = copyDeep(item);
|
||||
target.push(item);
|
||||
});
|
||||
return target;
|
||||
}
|
||||
if (isPlainObject(source) || isArray(source)) return copyDeep(source);
|
||||
return source;
|
||||
};
|
||||
|
||||
module.exports = function (target /*, ...objects*/) {
|
||||
return uniq
|
||||
.call([ensureValue(target)].concat(slice.call(arguments, 1).map(ensureValue)))
|
||||
.reduce(deepAssign);
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export type RunnerCardIdOutOfRangeError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var symbol = t("test"), obj = {};
|
||||
defineProperty(obj, symbol, d("foo"));
|
||||
a(obj.test, undefined, "Name");
|
||||
a(obj[symbol], "foo", "Get");
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import cryptoRandomString from 'crypto-random-string';
|
||||
|
||||
export default function uniqueString() {
|
||||
return cryptoRandomString({length: 32});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"es6-symbol","version":"3.1.3","files":{"LICENSE":{"checkedAt":1678883668421,"integrity":"sha512-wBINe6YmCgsIktIi7R3eMLEdtYCgwaHN4g/lUlpehsFshJXVGDr9Gk94f17QSF2Q3bm99uVxRaO3BKukwuQukw==","mode":420,"size":773},".editorconfig":{"checkedAt":1678883668460,"integrity":"sha512-UxFUp3I+5xuYgyrI3NGrxt1Pc22gpmpcWYXjLgf7DEKHy/qCMN4/AuuCOrm+WzniooGROVkEyDYaoVkivbFwow==","mode":448,"size":288},".testignore":{"checkedAt":1678883668460,"integrity":"sha512-G5bwH/PdTLf6zYW0fmzjG+mmWhU3hKXyQ0/eYdwGJwfWjcRJP8YV0+994cBFhabYn7oTXiBF7ibeHf9e5iuhLg==","mode":420,"size":13},"implement.js":{"checkedAt":1678883668460,"integrity":"sha512-Jeof+oxmz57mV8I42N+S5CszlnXQdLZGbzgQnf36O70nlfJPcvCFGS/AoCLDyZm7/hJYM86yyNWEB26TK8ZS2g==","mode":420,"size":215},"test/implement.js":{"checkedAt":1678883668460,"integrity":"sha512-JkQz72XSXl4uj3k5u9Gn4aumG292ibMdlI6VX95k3npLW9QJ0ELXNbWwv8h0RLyW/3Vi3dAChqjuh55zwPqo1w==","mode":420,"size":83},"lib/private/generate-name.js":{"checkedAt":1678883668460,"integrity":"sha512-3Zvc+ERvZXl2vNjyii9m+/fSjrFZvf7UN6egflm9KKXE4xRjqH1GzDqmsGKyPWS/kwwfdhPHAc9/jyLnH8xOOQ==","mode":420,"size":791},"CHANGES":{"checkedAt":1678883668460,"integrity":"sha512-Nu2yNUTaNlWj0s2ujp7nQVNhIikmS1gF4Qej4m92DgBu3HoRCgz2n4I8n2sH8xV1Hsvv3quDscwU3yHTAEs9Ew==","mode":420,"size":1937},"index.js":{"checkedAt":1678883668460,"integrity":"sha512-X58+MYJJj24VcencoQcbqbP2pQFjUyaJZ8HyBVmp3d11FNnNu41iyHcPSuAqzMmytyBxZ37cgmW7SzrfArqR3Q==","mode":420,"size":125},"test/index.js":{"checkedAt":1678883668460,"integrity":"sha512-NJwi0I8l0LqvOTl4rhKrIrQXIO+67S7cHpDQRv2avxp2B4s7FgCzjFTloEZgydmZThZdj2gTLjq12ZOLjat+zg==","mode":420,"size":271},"is-implemented.js":{"checkedAt":1678883668460,"integrity":"sha512-C/ueh7vQKhNe+1iBvKq2pScLXNNaUuREe/R6EtLEgT26MJtXa7VG+AHnC8rCwxiY/rYt2KwRSeYytzfGbdigxA==","mode":420,"size":548},"test/is-implemented.js":{"checkedAt":1678883668460,"integrity":"sha512-ZbCd7IO1X+e5hw4YhUZaFP+kirkxfDgD1uI9zBvmWXD+ZD0GFZvqYmHMgV2vO3f8co5qxbzjNslAqGyglb/nIw==","mode":420,"size":317},"is-native-implemented.js":{"checkedAt":1678883668460,"integrity":"sha512-i+WfMdHmxVKxjzmO+BE8f1m2LVFLPyq9pcyQ/9YQImCGdEBA+ijJmQfraJ320N04nlUH25seFxV2puVAp2UfQA==","mode":420,"size":215},"test/is-native-implemented.js":{"checkedAt":1678883668460,"integrity":"sha512-RdwFSm0OimOF1rceh0fhA8rcDjZMQtPjHlc2s+JjU2II+e4467OYJ3AqsByA3VMlPy/XEzCpqNFW01s9d3tFMQ==","mode":420,"size":77},"is-symbol.js":{"checkedAt":1678883668475,"integrity":"sha512-i/QUROwLsPRQiXKLqe+ivqlyP3hujfYD4J9OXvFZVRBoCUoFOttz8P2Gayytzvee9OZA70kZKXCZqF2bZJsmhQ==","mode":420,"size":280},"test/is-symbol.js":{"checkedAt":1678883668475,"integrity":"sha512-8sF2HZvjuXig3622pXjumiUag2GaSo3VE8cxKd0wjqjyvJ6epnPLRAwkGhC+PrYH0/Cl/kWCjqw0P/6p2WyEfQ==","mode":420,"size":407},"test/polyfill.js":{"checkedAt":1678883668475,"integrity":"sha512-13S7OhF2UfvxUvxd7mY9kJsrA1zaiXEokC3sGDaswQcOKIfmgOO8k3NDrs8imSWf0WFPTA+AW+aiJv+cKAaW3g==","mode":420,"size":806},"polyfill.js":{"checkedAt":1678883668475,"integrity":"sha512-Lc3SmtePQbK4Ba5sdt8ufxjNhaqkIixXdbDSAiCrd/GbibvmRaAzsZTYRfsVzo1/rKEN+N8qVbW8bdiI+PqB8g==","mode":420,"size":3240},"lib/private/setup/standard-symbols.js":{"checkedAt":1678883668475,"integrity":"sha512-LLsf9B6fkxhj0IBwA71PmbsaeBIWmqcSgvooxD4UXje8tazXHQ6s1H4RCicla0VShHh93VDPGFrAohsQIk6ivQ==","mode":420,"size":1421},"lib/private/setup/symbol-registry.js":{"checkedAt":1678883668475,"integrity":"sha512-05zDyx0dql2lkWSBKBywFzynK+CVGmeu5y4HTISmRLMcKyI7VPVDFmLJYJij/ybe6XwUAnCCsnas9wzRAelx6Q==","mode":420,"size":556},"validate-symbol.js":{"checkedAt":1678883668475,"integrity":"sha512-EkVoCXzClwfVDhwB09emOiusInexiAaQS8nTPyfFwhUbMhX/qBlEXRgBtpJAK0HHvnjPH7qrEdfMPsie1KzEUg==","mode":420,"size":181},"test/validate-symbol.js":{"checkedAt":1678883668475,"integrity":"sha512-CdvbCaiXoIS/TLYbOUoMn4EJH0b+xKhHSiASy5YyflKIvo1pbKJSvhj+e+ewyYk+gSUW9T0zfSRZp5nYPfFR9g==","mode":420,"size":629},"package.json":{"checkedAt":1678883668482,"integrity":"sha512-V/v4DFAjemni7TJdj5vCCmFoshBLnPIJ0C4X/oNmlInO1D/hdguOzpgK7R9ca+qMZRtXs+IyesOtPdW9AI4uYQ==","mode":420,"size":2063},"CHANGELOG.md":{"checkedAt":1678883668482,"integrity":"sha512-PAgws1nzmE+VzuhNgONiQlKFAXg4Qq0WhTUS3NIOIvjNXNUKNP8PsNB3bvz5zk7fMcCkTENxygQrB3Z9GgXDMg==","mode":420,"size":775},".github/FUNDING.yml":{"checkedAt":1678883668482,"integrity":"sha512-UNAEji5MxJFUC5za9gZ9+zgT/lfdgLNTq119SO/BK2TMacbQkhNq6fUDL/Wx0SCG2pucejVk5NIHG/Bg7o7dDQ==","mode":420,"size":27},"README.md":{"checkedAt":1678883668482,"integrity":"sha512-PFb5ELABrA90DlRTM6nqbz+iSje6K3X5areXhgu+LY2g1ZWvBCA7Mgu9mpCk1RIhRuF9Sw2BKHBk8r8O4hwKKg==","mode":420,"size":3321}}}
|
||||
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"name": "release-it",
|
||||
"version": "15.8.0",
|
||||
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",
|
||||
"keywords": [
|
||||
"build",
|
||||
"changelog",
|
||||
"commit",
|
||||
"distribution",
|
||||
"git",
|
||||
"github",
|
||||
"gitlab",
|
||||
"interactive",
|
||||
"ci",
|
||||
"npm",
|
||||
"publish",
|
||||
"push",
|
||||
"release",
|
||||
"release-it",
|
||||
"repository",
|
||||
"script",
|
||||
"shell",
|
||||
"tag",
|
||||
"tool",
|
||||
"version",
|
||||
"semver",
|
||||
"plugin"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/release-it/release-it.git"
|
||||
},
|
||||
"homepage": "https://github.com/release-it/release-it#readme",
|
||||
"bugs": "https://github.com/release-it/release-it/issues",
|
||||
"bin": {
|
||||
"release-it": "bin/release-it.js"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./lib/index.js",
|
||||
"./package.json": "./package.json",
|
||||
"./test/util/index.js": "./test/util/index.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"config",
|
||||
"lib",
|
||||
"test"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"format": "prettier --write \"{lib,test}/**/*.js\"",
|
||||
"test": "ava --no-worker-threads",
|
||||
"release": "./bin/release-it.js"
|
||||
},
|
||||
"author": {
|
||||
"email": "lars@webpro.nl",
|
||||
"name": "Lars Kappert"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@iarna/toml": "2.2.5",
|
||||
"@octokit/rest": "19.0.7",
|
||||
"async-retry": "1.3.3",
|
||||
"chalk": "5.2.0",
|
||||
"cosmiconfig": "8.1.0",
|
||||
"execa": "7.0.0",
|
||||
"git-url-parse": "13.1.0",
|
||||
"globby": "13.1.3",
|
||||
"got": "12.6.0",
|
||||
"inquirer": "9.1.4",
|
||||
"is-ci": "3.0.1",
|
||||
"lodash": "4.17.21",
|
||||
"mime-types": "2.1.35",
|
||||
"new-github-release-url": "2.0.0",
|
||||
"node-fetch": "3.3.0",
|
||||
"open": "8.4.2",
|
||||
"ora": "6.1.2",
|
||||
"os-name": "5.1.0",
|
||||
"promise.allsettled": "1.0.6",
|
||||
"proxy-agent": "5.0.0",
|
||||
"semver": "7.3.8",
|
||||
"shelljs": "0.8.5",
|
||||
"update-notifier": "6.0.2",
|
||||
"url-join": "5.0.0",
|
||||
"wildcard-match": "5.1.2",
|
||||
"yargs-parser": "21.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/request-error": "3.0.3",
|
||||
"ava": "5.2.0",
|
||||
"eslint": "8.35.0",
|
||||
"eslint-config-prettier": "8.7.0",
|
||||
"eslint-plugin-ava": "14.0.0",
|
||||
"eslint-plugin-import": "2.27.5",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"mock-fs": "5.2.0",
|
||||
"mock-stdio": "1.0.3",
|
||||
"nock": "13.3.0",
|
||||
"nyc": "15.1.0",
|
||||
"prettier": "2.8.4",
|
||||
"sinon": "15.0.1",
|
||||
"strip-ansi": "7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.9"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
module.exports = addHook;
|
||||
|
||||
function addHook(state, kind, name, hook) {
|
||||
var orig = hook;
|
||||
if (!state.registry[name]) {
|
||||
state.registry[name] = [];
|
||||
}
|
||||
|
||||
if (kind === "before") {
|
||||
hook = function (method, options) {
|
||||
return Promise.resolve()
|
||||
.then(orig.bind(null, options))
|
||||
.then(method.bind(null, options));
|
||||
};
|
||||
}
|
||||
|
||||
if (kind === "after") {
|
||||
hook = function (method, options) {
|
||||
var result;
|
||||
return Promise.resolve()
|
||||
.then(method.bind(null, options))
|
||||
.then(function (result_) {
|
||||
result = result_;
|
||||
return orig(result, options);
|
||||
})
|
||||
.then(function () {
|
||||
return result;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if (kind === "error") {
|
||||
hook = function (method, options) {
|
||||
return Promise.resolve()
|
||||
.then(method.bind(null, options))
|
||||
.catch(function (error) {
|
||||
return orig(error, options);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
state.registry[name].push({
|
||||
hook: hook,
|
||||
orig: orig,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021 Alex Schneider
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,9 @@
|
||||
import { asyncScheduler } from '../scheduler/async';
|
||||
import { timer } from './timer';
|
||||
export function interval(period = 0, scheduler = asyncScheduler) {
|
||||
if (period < 0) {
|
||||
period = 0;
|
||||
}
|
||||
return timer(period, period, scheduler);
|
||||
}
|
||||
//# sourceMappingURL=interval.js.map
|
||||
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2015 Tyler Kellen
|
||||
|
||||
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.
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,835 @@
|
||||
# ShellJS - Unix shell commands for Node.js
|
||||
|
||||
[](https://travis-ci.org/shelljs/shelljs)
|
||||
[](https://ci.appveyor.com/project/shelljs/shelljs/branch/master)
|
||||
[](https://codecov.io/gh/shelljs/shelljs)
|
||||
[](https://www.npmjs.com/package/shelljs)
|
||||
[](https://www.npmjs.com/package/shelljs)
|
||||
|
||||
ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell
|
||||
commands on top of the Node.js API. You can use it to eliminate your shell
|
||||
script's dependency on Unix while still keeping its familiar and powerful
|
||||
commands. You can also install it globally so you can run it from outside Node
|
||||
projects - say goodbye to those gnarly Bash scripts!
|
||||
|
||||
ShellJS is proudly tested on every node release since `v4`!
|
||||
|
||||
The project is [unit-tested](http://travis-ci.org/shelljs/shelljs) and battle-tested in projects like:
|
||||
|
||||
+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
|
||||
+ [JSHint](http://jshint.com) & [ESLint](http://eslint.org/) - popular JavaScript linters
|
||||
+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers
|
||||
+ [Yeoman](http://yeoman.io/) - Web application stack and development tool
|
||||
+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation
|
||||
+ And [many more](https://npmjs.org/browse/depended/shelljs).
|
||||
|
||||
If you have feedback, suggestions, or need help, feel free to post in our [issue
|
||||
tracker](https://github.com/shelljs/shelljs/issues).
|
||||
|
||||
Think ShellJS is cool? Check out some related projects in our [Wiki
|
||||
page](https://github.com/shelljs/shelljs/wiki)!
|
||||
|
||||
Upgrading from an older version? Check out our [breaking
|
||||
changes](https://github.com/shelljs/shelljs/wiki/Breaking-Changes) page to see
|
||||
what changes to watch out for while upgrading.
|
||||
|
||||
## Command line use
|
||||
|
||||
If you just want cross platform UNIX commands, checkout our new project
|
||||
[shelljs/shx](https://github.com/shelljs/shx), a utility to expose `shelljs` to
|
||||
the command line.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
$ shx mkdir -p foo
|
||||
$ shx touch foo/bar.txt
|
||||
$ shx rm -rf foo
|
||||
```
|
||||
|
||||
## Plugin API
|
||||
|
||||
ShellJS now supports third-party plugins! You can learn more about using plugins
|
||||
and writing your own ShellJS commands in [the
|
||||
wiki](https://github.com/shelljs/shelljs/wiki/Using-ShellJS-Plugins).
|
||||
|
||||
## A quick note about the docs
|
||||
|
||||
For documentation on all the latest features, check out our
|
||||
[README](https://github.com/shelljs/shelljs). To read docs that are consistent
|
||||
with the latest release, check out [the npm
|
||||
page](https://www.npmjs.com/package/shelljs) or
|
||||
[shelljs.org](http://documentup.com/shelljs/shelljs).
|
||||
|
||||
## Installing
|
||||
|
||||
Via npm:
|
||||
|
||||
```bash
|
||||
$ npm install [-g] shelljs
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```javascript
|
||||
var shell = require('shelljs');
|
||||
|
||||
if (!shell.which('git')) {
|
||||
shell.echo('Sorry, this script requires git');
|
||||
shell.exit(1);
|
||||
}
|
||||
|
||||
// Copy files to release dir
|
||||
shell.rm('-rf', 'out/Release');
|
||||
shell.cp('-R', 'stuff/', 'out/Release');
|
||||
|
||||
// Replace macros in each .js file
|
||||
shell.cd('lib');
|
||||
shell.ls('*.js').forEach(function (file) {
|
||||
shell.sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
|
||||
shell.sed('-i', /^.*REMOVE_THIS_LINE.*$/, '', file);
|
||||
shell.sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, shell.cat('macro.js'), file);
|
||||
});
|
||||
shell.cd('..');
|
||||
|
||||
// Run external tool synchronously
|
||||
if (shell.exec('git commit -am "Auto-commit"').code !== 0) {
|
||||
shell.echo('Error: Git commit failed');
|
||||
shell.exit(1);
|
||||
}
|
||||
```
|
||||
|
||||
## Exclude options
|
||||
|
||||
If you need to pass a parameter that looks like an option, you can do so like:
|
||||
|
||||
```js
|
||||
shell.grep('--', '-v', 'path/to/file'); // Search for "-v", no grep options
|
||||
|
||||
shell.cp('-R', '-dir', 'outdir'); // If already using an option, you're done
|
||||
```
|
||||
|
||||
## Global vs. Local
|
||||
|
||||
We no longer recommend using a global-import for ShellJS (i.e.
|
||||
`require('shelljs/global')`). While still supported for convenience, this
|
||||
pollutes the global namespace, and should therefore only be used with caution.
|
||||
|
||||
Instead, we recommend a local import (standard for npm packages):
|
||||
|
||||
```javascript
|
||||
var shell = require('shelljs');
|
||||
shell.echo('hello world');
|
||||
```
|
||||
|
||||
<!-- DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED -->
|
||||
|
||||
|
||||
## Command reference
|
||||
|
||||
|
||||
All commands run synchronously, unless otherwise stated.
|
||||
All commands accept standard bash globbing characters (`*`, `?`, etc.),
|
||||
compatible with the [node `glob` module](https://github.com/isaacs/node-glob).
|
||||
|
||||
For less-commonly used commands and features, please check out our [wiki
|
||||
page](https://github.com/shelljs/shelljs/wiki).
|
||||
|
||||
|
||||
### cat([options,] file [, file ...])
|
||||
### cat([options,] file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n`: number all output lines
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var str = cat('file*.txt');
|
||||
var str = cat('file1', 'file2');
|
||||
var str = cat(['file1', 'file2']); // same as above
|
||||
```
|
||||
|
||||
Returns a string containing the given file, or a concatenated string
|
||||
containing the files if more than one file is given (a new line character is
|
||||
introduced between each file).
|
||||
|
||||
|
||||
### cd([dir])
|
||||
|
||||
Changes to directory `dir` for the duration of the script. Changes to home
|
||||
directory if no argument is supplied.
|
||||
|
||||
|
||||
### chmod([options,] octal_mode || octal_string, file)
|
||||
### chmod([options,] symbolic_mode, file)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-v`: output a diagnostic for every file processed
|
||||
+ `-c`: like verbose, but report only when a change is made
|
||||
+ `-R`: change files and directories recursively
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
chmod(755, '/Users/brandon');
|
||||
chmod('755', '/Users/brandon'); // same as above
|
||||
chmod('u+x', '/Users/brandon');
|
||||
chmod('-R', 'a-w', '/Users/brandon');
|
||||
```
|
||||
|
||||
Alters the permissions of a file or directory by either specifying the
|
||||
absolute permissions in octal form or expressing the changes in symbols.
|
||||
This command tries to mimic the POSIX behavior as much as possible.
|
||||
Notable exceptions:
|
||||
|
||||
+ In symbolic modes, `a-r` and `-r` are identical. No consideration is
|
||||
given to the `umask`.
|
||||
+ There is no "quiet" option, since default behavior is to run silent.
|
||||
|
||||
|
||||
### cp([options,] source [, source ...], dest)
|
||||
### cp([options,] source_array, dest)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-f`: force (default behavior)
|
||||
+ `-n`: no-clobber
|
||||
+ `-u`: only copy if `source` is newer than `dest`
|
||||
+ `-r`, `-R`: recursive
|
||||
+ `-L`: follow symlinks
|
||||
+ `-P`: don't follow symlinks
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
cp('file1', 'dir1');
|
||||
cp('-R', 'path/to/dir/', '~/newCopy/');
|
||||
cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
|
||||
cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
|
||||
```
|
||||
|
||||
Copies files.
|
||||
|
||||
|
||||
### pushd([options,] [dir | '-N' | '+N'])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
|
||||
+ `-q`: Supresses output to the console.
|
||||
|
||||
Arguments:
|
||||
|
||||
+ `dir`: Sets the current working directory to the top of the stack, then executes the equivalent of `cd dir`.
|
||||
+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
// process.cwd() === '/usr'
|
||||
pushd('/etc'); // Returns /etc /usr
|
||||
pushd('+1'); // Returns /usr /etc
|
||||
```
|
||||
|
||||
Save the current directory on the top of the directory stack and then `cd` to `dir`. With no arguments, `pushd` exchanges the top two directories. Returns an array of paths in the stack.
|
||||
|
||||
|
||||
### popd([options,] ['-N' | '+N'])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n`: Suppress the normal directory change when removing directories from the stack, so that only the stack is manipulated.
|
||||
+ `-q`: Supresses output to the console.
|
||||
|
||||
Arguments:
|
||||
|
||||
+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
|
||||
+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
echo(process.cwd()); // '/usr'
|
||||
pushd('/etc'); // '/etc /usr'
|
||||
echo(process.cwd()); // '/etc'
|
||||
popd(); // '/usr'
|
||||
echo(process.cwd()); // '/usr'
|
||||
```
|
||||
|
||||
When no arguments are given, `popd` removes the top directory from the stack and performs a `cd` to the new top directory. The elements are numbered from 0, starting at the first directory listed with dirs (i.e., `popd` is equivalent to `popd +0`). Returns an array of paths in the stack.
|
||||
|
||||
|
||||
### dirs([options | '+N' | '-N'])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-c`: Clears the directory stack by deleting all of the elements.
|
||||
+ `-q`: Supresses output to the console.
|
||||
|
||||
Arguments:
|
||||
|
||||
+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
|
||||
+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
|
||||
|
||||
Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if `+N` or `-N` was specified.
|
||||
|
||||
See also: `pushd`, `popd`
|
||||
|
||||
|
||||
### echo([options,] string [, string ...])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-e`: interpret backslash escapes (default)
|
||||
+ `-n`: remove trailing newline from output
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
echo('hello world');
|
||||
var str = echo('hello world');
|
||||
echo('-n', 'no newline at end');
|
||||
```
|
||||
|
||||
Prints `string` to stdout, and returns string with additional utility methods
|
||||
like `.to()`.
|
||||
|
||||
|
||||
### exec(command [, options] [, callback])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `async`: Asynchronous execution. If a callback is provided, it will be set to
|
||||
`true`, regardless of the passed value (default: `false`).
|
||||
+ `silent`: Do not echo program output to console (default: `false`).
|
||||
+ `encoding`: Character encoding to use. Affects the values returned to stdout and stderr, and
|
||||
what is written to stdout and stderr when not in silent mode (default: `'utf8'`).
|
||||
+ and any option available to Node.js's
|
||||
[`child_process.exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var version = exec('node --version', {silent:true}).stdout;
|
||||
|
||||
var child = exec('some_long_running_process', {async:true});
|
||||
child.stdout.on('data', function(data) {
|
||||
/* ... do something with data ... */
|
||||
});
|
||||
|
||||
exec('some_long_running_process', function(code, stdout, stderr) {
|
||||
console.log('Exit code:', code);
|
||||
console.log('Program output:', stdout);
|
||||
console.log('Program stderr:', stderr);
|
||||
});
|
||||
```
|
||||
|
||||
Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous
|
||||
mode, this returns a `ShellString` (compatible with ShellJS v0.6.x, which returns an object
|
||||
of the form `{ code:..., stdout:... , stderr:... }`). Otherwise, this returns the child process
|
||||
object, and the `callback` receives the arguments `(code, stdout, stderr)`.
|
||||
|
||||
Not seeing the behavior you want? `exec()` runs everything through `sh`
|
||||
by default (or `cmd.exe` on Windows), which differs from `bash`. If you
|
||||
need bash-specific behavior, try out the `{shell: 'path/to/bash'}` option.
|
||||
|
||||
|
||||
### find(path [, path ...])
|
||||
### find(path_array)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
find('src', 'lib');
|
||||
find(['src', 'lib']); // same as above
|
||||
find('.').filter(function(file) { return file.match(/\.js$/); });
|
||||
```
|
||||
|
||||
Returns array of all files (however deep) in the given paths.
|
||||
|
||||
The main difference from `ls('-R', path)` is that the resulting file names
|
||||
include the base directories (e.g., `lib/resources/file1` instead of just `file1`).
|
||||
|
||||
|
||||
### grep([options,] regex_filter, file [, file ...])
|
||||
### grep([options,] regex_filter, file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-v`: Invert `regex_filter` (only print non-matching lines).
|
||||
+ `-l`: Print only filenames of matching files.
|
||||
+ `-i`: Ignore case.
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
grep('-v', 'GLOBAL_VARIABLE', '*.js');
|
||||
grep('GLOBAL_VARIABLE', '*.js');
|
||||
```
|
||||
|
||||
Reads input string from given files and returns a string containing all lines of the
|
||||
file that match the given `regex_filter`.
|
||||
|
||||
|
||||
### head([{'-n': \<num\>},] file [, file ...])
|
||||
### head([{'-n': \<num\>},] file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n <num>`: Show the first `<num>` lines of the files
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var str = head({'-n': 1}, 'file*.txt');
|
||||
var str = head('file1', 'file2');
|
||||
var str = head(['file1', 'file2']); // same as above
|
||||
```
|
||||
|
||||
Read the start of a file.
|
||||
|
||||
|
||||
### ln([options,] source, dest)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-s`: symlink
|
||||
+ `-f`: force
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
ln('file', 'newlink');
|
||||
ln('-sf', 'file', 'existing');
|
||||
```
|
||||
|
||||
Links `source` to `dest`. Use `-f` to force the link, should `dest` already exist.
|
||||
|
||||
|
||||
### ls([options,] [path, ...])
|
||||
### ls([options,] path_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-R`: recursive
|
||||
+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
|
||||
+ `-L`: follow symlinks
|
||||
+ `-d`: list directories themselves, not their contents
|
||||
+ `-l`: list objects representing each file, each with fields containing `ls
|
||||
-l` output fields. See
|
||||
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
|
||||
for more info
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
ls('projs/*.js');
|
||||
ls('-R', '/users/me', '/tmp');
|
||||
ls('-R', ['/users/me', '/tmp']); // same as above
|
||||
ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
|
||||
```
|
||||
|
||||
Returns array of files in the given `path`, or files in
|
||||
the current directory if no `path` is provided.
|
||||
|
||||
|
||||
### mkdir([options,] dir [, dir ...])
|
||||
### mkdir([options,] dir_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-p`: full path (and create intermediate directories, if necessary)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
|
||||
mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
|
||||
```
|
||||
|
||||
Creates directories.
|
||||
|
||||
|
||||
### mv([options ,] source [, source ...], dest')
|
||||
### mv([options ,] source_array, dest')
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-f`: force (default behavior)
|
||||
+ `-n`: no-clobber
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
mv('-n', 'file', 'dir/');
|
||||
mv('file1', 'file2', 'dir/');
|
||||
mv(['file1', 'file2'], 'dir/'); // same as above
|
||||
```
|
||||
|
||||
Moves `source` file(s) to `dest`.
|
||||
|
||||
|
||||
### pwd()
|
||||
|
||||
Returns the current directory.
|
||||
|
||||
|
||||
### rm([options,] file [, file ...])
|
||||
### rm([options,] file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-f`: force
|
||||
+ `-r, -R`: recursive
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
rm('-rf', '/tmp/*');
|
||||
rm('some_file.txt', 'another_file.txt');
|
||||
rm(['some_file.txt', 'another_file.txt']); // same as above
|
||||
```
|
||||
|
||||
Removes files.
|
||||
|
||||
|
||||
### sed([options,] search_regex, replacement, file [, file ...])
|
||||
### sed([options,] search_regex, replacement, file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-i`: Replace contents of `file` in-place. _Note that no backups will be created!_
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
|
||||
sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
|
||||
```
|
||||
|
||||
Reads an input string from `file`s, and performs a JavaScript `replace()` on the input
|
||||
using the given `search_regex` and `replacement` string or function. Returns the new string after replacement.
|
||||
|
||||
Note:
|
||||
|
||||
Like unix `sed`, ShellJS `sed` supports capture groups. Capture groups are specified
|
||||
using the `$n` syntax:
|
||||
|
||||
```javascript
|
||||
sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');
|
||||
```
|
||||
|
||||
|
||||
### set(options)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `+/-e`: exit upon error (`config.fatal`)
|
||||
+ `+/-v`: verbose: show all commands (`config.verbose`)
|
||||
+ `+/-f`: disable filename expansion (globbing)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
set('-e'); // exit upon first error
|
||||
set('+e'); // this undoes a "set('-e')"
|
||||
```
|
||||
|
||||
Sets global configuration variables.
|
||||
|
||||
|
||||
### sort([options,] file [, file ...])
|
||||
### sort([options,] file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-r`: Reverse the results
|
||||
+ `-n`: Compare according to numerical value
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
sort('foo.txt', 'bar.txt');
|
||||
sort('-r', 'foo.txt');
|
||||
```
|
||||
|
||||
Return the contents of the `file`s, sorted line-by-line. Sorting multiple
|
||||
files mixes their content (just as unix `sort` does).
|
||||
|
||||
|
||||
### tail([{'-n': \<num\>},] file [, file ...])
|
||||
### tail([{'-n': \<num\>},] file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-n <num>`: Show the last `<num>` lines of `file`s
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var str = tail({'-n': 1}, 'file*.txt');
|
||||
var str = tail('file1', 'file2');
|
||||
var str = tail(['file1', 'file2']); // same as above
|
||||
```
|
||||
|
||||
Read the end of a `file`.
|
||||
|
||||
|
||||
### tempdir()
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var tmp = tempdir(); // "/tmp" for most *nix platforms
|
||||
```
|
||||
|
||||
Searches and returns string containing a writeable, platform-dependent temporary directory.
|
||||
Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
|
||||
|
||||
|
||||
### test(expression)
|
||||
|
||||
Available expression primaries:
|
||||
|
||||
+ `'-b', 'path'`: true if path is a block device
|
||||
+ `'-c', 'path'`: true if path is a character device
|
||||
+ `'-d', 'path'`: true if path is a directory
|
||||
+ `'-e', 'path'`: true if path exists
|
||||
+ `'-f', 'path'`: true if path is a regular file
|
||||
+ `'-L', 'path'`: true if path is a symbolic link
|
||||
+ `'-p', 'path'`: true if path is a pipe (FIFO)
|
||||
+ `'-S', 'path'`: true if path is a socket
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
if (test('-d', path)) { /* do something with dir */ };
|
||||
if (!test('-f', path)) continue; // skip if it's a regular file
|
||||
```
|
||||
|
||||
Evaluates `expression` using the available primaries and returns corresponding value.
|
||||
|
||||
|
||||
### ShellString.prototype.to(file)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
cat('input.txt').to('output.txt');
|
||||
```
|
||||
|
||||
Analogous to the redirection operator `>` in Unix, but works with
|
||||
`ShellStrings` (such as those returned by `cat`, `grep`, etc.). _Like Unix
|
||||
redirections, `to()` will overwrite any existing file!_
|
||||
|
||||
|
||||
### ShellString.prototype.toEnd(file)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
cat('input.txt').toEnd('output.txt');
|
||||
```
|
||||
|
||||
Analogous to the redirect-and-append operator `>>` in Unix, but works with
|
||||
`ShellStrings` (such as those returned by `cat`, `grep`, etc.).
|
||||
|
||||
|
||||
### touch([options,] file [, file ...])
|
||||
### touch([options,] file_array)
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-a`: Change only the access time
|
||||
+ `-c`: Do not create any files
|
||||
+ `-m`: Change only the modification time
|
||||
+ `-d DATE`: Parse `DATE` and use it instead of current time
|
||||
+ `-r FILE`: Use `FILE`'s times instead of current time
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
touch('source.js');
|
||||
touch('-c', '/path/to/some/dir/source.js');
|
||||
touch({ '-r': FILE }, '/path/to/some/dir/source.js');
|
||||
```
|
||||
|
||||
Update the access and modification times of each `FILE` to the current time.
|
||||
A `FILE` argument that does not exist is created empty, unless `-c` is supplied.
|
||||
This is a partial implementation of [`touch(1)`](http://linux.die.net/man/1/touch).
|
||||
|
||||
|
||||
### uniq([options,] [input, [output]])
|
||||
|
||||
Available options:
|
||||
|
||||
+ `-i`: Ignore case while comparing
|
||||
+ `-c`: Prefix lines by the number of occurrences
|
||||
+ `-d`: Only print duplicate lines, one for each group of identical lines
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
uniq('foo.txt');
|
||||
uniq('-i', 'foo.txt');
|
||||
uniq('-cd', 'foo.txt', 'bar.txt');
|
||||
```
|
||||
|
||||
Filter adjacent matching lines from `input`.
|
||||
|
||||
|
||||
### which(command)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var nodeExec = which('node');
|
||||
```
|
||||
|
||||
Searches for `command` in the system's `PATH`. On Windows, this uses the
|
||||
`PATHEXT` variable to append the extension if it's not already executable.
|
||||
Returns string containing the absolute path to `command`.
|
||||
|
||||
|
||||
### exit(code)
|
||||
|
||||
Exits the current process with the given exit `code`.
|
||||
|
||||
### error()
|
||||
|
||||
Tests if error occurred in the last command. Returns a truthy value if an
|
||||
error returned, or a falsy value otherwise.
|
||||
|
||||
**Note**: do not rely on the
|
||||
return value to be an error message. If you need the last error message, use
|
||||
the `.stderr` attribute from the last command's return value instead.
|
||||
|
||||
|
||||
### ShellString(str)
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
var foo = ShellString('hello world');
|
||||
```
|
||||
|
||||
Turns a regular string into a string-like object similar to what each
|
||||
command returns. This has special methods, like `.to()` and `.toEnd()`.
|
||||
|
||||
|
||||
### env['VAR_NAME']
|
||||
|
||||
Object containing environment variables (both getter and setter). Shortcut
|
||||
to `process.env`.
|
||||
|
||||
### Pipes
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
|
||||
echo('files with o\'s in the name:\n' + ls().grep('o'));
|
||||
cat('test.js').exec('node'); // pipe to exec() call
|
||||
```
|
||||
|
||||
Commands can send their output to another command in a pipe-like fashion.
|
||||
`sed`, `grep`, `cat`, `exec`, `to`, and `toEnd` can appear on the right-hand
|
||||
side of a pipe. Pipes can be chained.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
### config.silent
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
var sh = require('shelljs');
|
||||
var silentState = sh.config.silent; // save old silent state
|
||||
sh.config.silent = true;
|
||||
/* ... */
|
||||
sh.config.silent = silentState; // restore old silent state
|
||||
```
|
||||
|
||||
Suppresses all command output if `true`, except for `echo()` calls.
|
||||
Default is `false`.
|
||||
|
||||
### config.fatal
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
require('shelljs/global');
|
||||
config.fatal = true; // or set('-e');
|
||||
cp('this_file_does_not_exist', '/dev/null'); // throws Error here
|
||||
/* more commands... */
|
||||
```
|
||||
|
||||
If `true`, the script will throw a Javascript error when any shell.js
|
||||
command encounters an error. Default is `false`. This is analogous to
|
||||
Bash's `set -e`.
|
||||
|
||||
### config.verbose
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
config.verbose = true; // or set('-v');
|
||||
cd('dir/');
|
||||
rm('-rf', 'foo.txt', 'bar.txt');
|
||||
exec('echo hello');
|
||||
```
|
||||
|
||||
Will print each command as follows:
|
||||
|
||||
```
|
||||
cd dir/
|
||||
rm -rf foo.txt bar.txt
|
||||
exec echo hello
|
||||
```
|
||||
|
||||
### config.globOptions
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
config.globOptions = {nodir: true};
|
||||
```
|
||||
|
||||
Use this value for calls to `glob.sync()` instead of the default options.
|
||||
|
||||
### config.reset()
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
var shell = require('shelljs');
|
||||
// Make changes to shell.config, and do stuff...
|
||||
/* ... */
|
||||
shell.config.reset(); // reset to original state
|
||||
// Do more stuff, but with original settings
|
||||
/* ... */
|
||||
```
|
||||
|
||||
Reset `shell.config` to the defaults:
|
||||
|
||||
```javascript
|
||||
{
|
||||
fatal: false,
|
||||
globOptions: {},
|
||||
maxdepth: 255,
|
||||
noglob: false,
|
||||
silent: false,
|
||||
verbose: false,
|
||||
}
|
||||
```
|
||||
|
||||
## Team
|
||||
|
||||
| [](https://github.com/nfischer) | [](http://github.com/freitagbr) |
|
||||
|:---:|:---:|
|
||||
| [Nate Fischer](https://github.com/nfischer) | [Brandon Freitag](http://github.com/freitagbr) |
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.schedulePromise = void 0;
|
||||
var innerFrom_1 = require("../observable/innerFrom");
|
||||
var observeOn_1 = require("../operators/observeOn");
|
||||
var subscribeOn_1 = require("../operators/subscribeOn");
|
||||
function schedulePromise(input, scheduler) {
|
||||
return innerFrom_1.innerFrom(input).pipe(subscribeOn_1.subscribeOn(scheduler), observeOn_1.observeOn(scheduler));
|
||||
}
|
||||
exports.schedulePromise = schedulePromise;
|
||||
//# sourceMappingURL=schedulePromise.js.map
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "parse-url",
|
||||
"version": "8.1.0",
|
||||
"description": "An advanced url parser supporting git urls too.",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./index.d.ts",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"require": "./dist/index.js",
|
||||
"import": "./dist/index.mjs"
|
||||
},
|
||||
"directories": {
|
||||
"example": "example",
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/index.mjs",
|
||||
"build": "pkgroll"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/IonicaBizau/parse-url.git"
|
||||
},
|
||||
"keywords": [
|
||||
"parse",
|
||||
"url",
|
||||
"node",
|
||||
"git",
|
||||
"advanced"
|
||||
],
|
||||
"author": "Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/IonicaBizau/parse-url/issues"
|
||||
},
|
||||
"homepage": "https://github.com/IonicaBizau/parse-url",
|
||||
"devDependencies": {
|
||||
"normalize-url": "^7.0.3",
|
||||
"pkgroll": "^1.4.0",
|
||||
"tester": "^1.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"parse-path": "^7.0.0"
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"app/",
|
||||
"lib/",
|
||||
"dist/",
|
||||
"src/",
|
||||
"scripts/",
|
||||
"resources/",
|
||||
"menu/",
|
||||
"cli.js",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"bloggify.js",
|
||||
"bloggify.json",
|
||||
"bloggify/"
|
||||
],
|
||||
"blah": {
|
||||
"description": [
|
||||
"For low-level path parsing, check out [`parse-path`](https://github.com/IonicaBizau/parse-path). This very module is designed to parse urls. By default the urls are normalized."
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"throwError.js","sourceRoot":"","sources":["../../../../src/internal/observable/throwError.ts"],"names":[],"mappings":";;;AAAA,4CAA2C;AAG3C,iDAAgD;AAqHhD,SAAgB,UAAU,CAAC,mBAAwB,EAAE,SAAyB;IAC5E,IAAM,YAAY,GAAG,uBAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,cAAM,OAAA,mBAAmB,EAAnB,CAAmB,CAAC;IACvG,IAAM,IAAI,GAAG,UAAC,UAA6B,IAAK,OAAA,UAAU,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,EAAhC,CAAgC,CAAC;IACjF,OAAO,IAAI,uBAAU,CAAC,SAAS,CAAC,CAAC,CAAC,UAAC,UAAU,IAAK,OAAA,SAAS,CAAC,QAAQ,CAAC,IAAW,EAAE,CAAC,EAAE,UAAU,CAAC,EAA9C,CAA8C,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3G,CAAC;AAJD,gCAIC"}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* The abstract operation ComputeExponentForMagnitude computes an exponent by which to scale a
|
||||
* number of the given magnitude (power of ten of the most significant digit) according to the
|
||||
* locale and the desired notation (scientific, engineering, or compact).
|
||||
*/
|
||||
export function ComputeExponentForMagnitude(numberFormat, magnitude, _a) {
|
||||
var getInternalSlots = _a.getInternalSlots;
|
||||
var internalSlots = getInternalSlots(numberFormat);
|
||||
var notation = internalSlots.notation, dataLocaleData = internalSlots.dataLocaleData, numberingSystem = internalSlots.numberingSystem;
|
||||
switch (notation) {
|
||||
case 'standard':
|
||||
return 0;
|
||||
case 'scientific':
|
||||
return magnitude;
|
||||
case 'engineering':
|
||||
return Math.floor(magnitude / 3) * 3;
|
||||
default: {
|
||||
// Let exponent be an implementation- and locale-dependent (ILD) integer by which to scale a
|
||||
// number of the given magnitude in compact notation for the current locale.
|
||||
var compactDisplay = internalSlots.compactDisplay, style = internalSlots.style, currencyDisplay = internalSlots.currencyDisplay;
|
||||
var thresholdMap = void 0;
|
||||
if (style === 'currency' && currencyDisplay !== 'name') {
|
||||
var currency = dataLocaleData.numbers.currency[numberingSystem] ||
|
||||
dataLocaleData.numbers.currency[dataLocaleData.numbers.nu[0]];
|
||||
thresholdMap = currency.short;
|
||||
}
|
||||
else {
|
||||
var decimal = dataLocaleData.numbers.decimal[numberingSystem] ||
|
||||
dataLocaleData.numbers.decimal[dataLocaleData.numbers.nu[0]];
|
||||
thresholdMap = compactDisplay === 'long' ? decimal.long : decimal.short;
|
||||
}
|
||||
if (!thresholdMap) {
|
||||
return 0;
|
||||
}
|
||||
var num = String(Math.pow(10, magnitude));
|
||||
var thresholds = Object.keys(thresholdMap); // TODO: this can be pre-processed
|
||||
if (num < thresholds[0]) {
|
||||
return 0;
|
||||
}
|
||||
if (num > thresholds[thresholds.length - 1]) {
|
||||
return thresholds[thresholds.length - 1].length - 1;
|
||||
}
|
||||
var i = thresholds.indexOf(num);
|
||||
if (i === -1) {
|
||||
return 0;
|
||||
}
|
||||
// See https://unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats
|
||||
// Special handling if the pattern is precisely `0`.
|
||||
var magnitudeKey = thresholds[i];
|
||||
// TODO: do we need to handle plural here?
|
||||
var compactPattern = thresholdMap[magnitudeKey].other;
|
||||
if (compactPattern === '0') {
|
||||
return 0;
|
||||
}
|
||||
// Example: in zh-TW, `10000000` maps to `0000萬`. So we need to return 8 - 4 = 4 here.
|
||||
return (magnitudeKey.length -
|
||||
thresholdMap[magnitudeKey].other.match(/0+/)[0].length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
var path = require('path');
|
||||
var url = require('url');
|
||||
|
||||
function rebaseRemoteMap(sourceMap, sourceUri) {
|
||||
var sourceDirectory = path.dirname(sourceUri);
|
||||
|
||||
sourceMap.sources = sourceMap.sources.map(function(source) {
|
||||
return url.resolve(sourceDirectory, source);
|
||||
});
|
||||
|
||||
return sourceMap;
|
||||
}
|
||||
|
||||
module.exports = rebaseRemoteMap;
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Returns true if the object is a function.
|
||||
* @param value The value to check
|
||||
*/
|
||||
export declare function isFunction(value: any): value is (...args: any[]) => any;
|
||||
//# sourceMappingURL=isFunction.d.ts.map
|
||||
@@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||
const rgb = fn(...args);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
const setLazyProperty = (object, property, get) => {
|
||||
Object.defineProperty(object, property, {
|
||||
get: () => {
|
||||
const value = get();
|
||||
|
||||
Object.defineProperty(object, property, {
|
||||
value,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return value;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
|
||||
/** @type {typeof import('color-convert')} */
|
||||
let colorConvert;
|
||||
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||
if (colorConvert === undefined) {
|
||||
colorConvert = require('color-convert');
|
||||
}
|
||||
|
||||
const offset = isBackground ? 10 : 0;
|
||||
const styles = {};
|
||||
|
||||
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||
if (sourceSpace === targetSpace) {
|
||||
styles[name] = wrap(identity, offset);
|
||||
} else if (typeof suite === 'object') {
|
||||
styles[name] = wrap(suite[targetSpace], offset);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Alias bright black as gray (and grey)
|
||||
styles.color.gray = styles.color.blackBright;
|
||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||
styles.color.grey = styles.color.blackBright;
|
||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||
|
||||
for (const [groupName, group] of Object.entries(styles)) {
|
||||
for (const [styleName, style] of Object.entries(group)) {
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright Michael Ciniawsky <michael.ciniawsky@gmail.com>
|
||||
|
||||
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,54 @@
|
||||
module.exports = {
|
||||
"39": "0.20",
|
||||
"40": "0.21",
|
||||
"41": "0.21",
|
||||
"42": "0.25",
|
||||
"43": "0.27",
|
||||
"44": "0.30",
|
||||
"45": "0.31",
|
||||
"47": "0.36",
|
||||
"49": "0.37",
|
||||
"50": "1.1",
|
||||
"51": "1.2",
|
||||
"52": "1.3",
|
||||
"53": "1.4",
|
||||
"54": "1.4",
|
||||
"56": "1.6",
|
||||
"58": "1.7",
|
||||
"59": "1.8",
|
||||
"61": "2.0",
|
||||
"66": "3.0",
|
||||
"69": "4.0",
|
||||
"72": "5.0",
|
||||
"73": "5.0",
|
||||
"76": "6.0",
|
||||
"78": "7.0",
|
||||
"79": "8.0",
|
||||
"80": "8.0",
|
||||
"82": "9.0",
|
||||
"83": "9.0",
|
||||
"84": "10.0",
|
||||
"85": "10.0",
|
||||
"86": "11.0",
|
||||
"87": "11.0",
|
||||
"89": "12.0",
|
||||
"90": "13.0",
|
||||
"91": "13.0",
|
||||
"92": "14.0",
|
||||
"93": "14.0",
|
||||
"94": "15.0",
|
||||
"95": "16.0",
|
||||
"96": "16.0",
|
||||
"98": "17.0",
|
||||
"99": "18.0",
|
||||
"100": "18.0",
|
||||
"102": "19.0",
|
||||
"103": "20.0",
|
||||
"104": "20.0",
|
||||
"105": "21.0",
|
||||
"106": "21.0",
|
||||
"107": "22.0",
|
||||
"108": "22.0",
|
||||
"110": "23.0",
|
||||
"111": "24.0"
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component } from 'preact';
|
||||
import { Config } from '../config';
|
||||
export interface BaseProps {}
|
||||
export declare abstract class BaseComponent<
|
||||
P extends BaseProps = {},
|
||||
S = {}
|
||||
> extends Component<P, S> {
|
||||
protected config: Config;
|
||||
protected _: (message: string, ...args: any[]) => string;
|
||||
constructor(props: P, context: any);
|
||||
}
|
||||
export interface BaseComponent<P> {
|
||||
new (props: P, context?: any): Component<P>;
|
||||
}
|
||||
@@ -0,0 +1,618 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for Converter.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> Converter.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>98/98</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>18/18</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>29/29</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>92/92</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>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<a name='L93'></a><a href='#L93'>93</a>
|
||||
<a name='L94'></a><a href='#L94'>94</a>
|
||||
<a name='L95'></a><a href='#L95'>95</a>
|
||||
<a name='L96'></a><a href='#L96'>96</a>
|
||||
<a name='L97'></a><a href='#L97'>97</a>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a>
|
||||
<a name='L166'></a><a href='#L166'>166</a>
|
||||
<a name='L167'></a><a href='#L167'>167</a>
|
||||
<a name='L168'></a><a href='#L168'>168</a>
|
||||
<a name='L169'></a><a href='#L169'>169</a>
|
||||
<a name='L170'></a><a href='#L170'>170</a>
|
||||
<a name='L171'></a><a href='#L171'>171</a>
|
||||
<a name='L172'></a><a href='#L172'>172</a>
|
||||
<a name='L173'></a><a href='#L173'>173</a>
|
||||
<a name='L174'></a><a href='#L174'>174</a>
|
||||
<a name='L175'></a><a href='#L175'>175</a>
|
||||
<a name='L176'></a><a href='#L176'>176</a>
|
||||
<a name='L177'></a><a href='#L177'>177</a>
|
||||
<a name='L178'></a><a href='#L178'>178</a>
|
||||
<a name='L179'></a><a href='#L179'>179</a>
|
||||
<a name='L180'></a><a href='#L180'>180</a>
|
||||
<a name='L181'></a><a href='#L181'>181</a>
|
||||
<a name='L182'></a><a href='#L182'>182</a>
|
||||
<a name='L183'></a><a href='#L183'>183</a>
|
||||
<a name='L184'></a><a href='#L184'>184</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-yes">65x</span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">35x</span>
|
||||
<span class="cline-any cline-yes">35x</span>
|
||||
<span class="cline-any cline-yes">35x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">86x</span>
|
||||
<span class="cline-any cline-yes">86x</span>
|
||||
<span class="cline-any cline-yes">86x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">79x</span>
|
||||
<span class="cline-any cline-yes">78x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">166228x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">442655x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">356x</span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-yes">37x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">83x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-yes">113x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">120x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">217x</span>
|
||||
<span class="cline-any cline-yes">217x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">215x</span>
|
||||
<span class="cline-any cline-yes">81x</span>
|
||||
<span class="cline-any cline-yes">81x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">215x</span>
|
||||
<span class="cline-any cline-yes">215x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">110x</span>
|
||||
<span class="cline-any cline-yes">110x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">104x</span>
|
||||
<span class="cline-any cline-yes">66x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">104x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">104x</span>
|
||||
<span class="cline-any cline-yes">104x</span>
|
||||
<span class="cline-any cline-yes">104x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { Transform, TransformOptions, Readable } from "stream";
|
||||
import { CSVParseParam, mergeParams } from "./Parameters";
|
||||
import { ParseRuntime, initParseRuntime } from "./ParseRuntime";
|
||||
import P from "bluebird";
|
||||
import { stringToLines } from "./fileline";
|
||||
import { map } from "lodash/map";
|
||||
import { RowSplit, RowSplitResult } from "./rowSplit";
|
||||
import getEol from "./getEol";
|
||||
import lineToJson, { JSONResult } from "./lineToJson";
|
||||
import { Processor, ProcessLineResult } from "./Processor";
|
||||
import { ProcessorFork } from "./ProcessFork";
|
||||
import { ProcessorLocal } from "./ProcessorLocal";
|
||||
import { Result } from "./Result";
|
||||
import CSVError from "./CSVError";
|
||||
import { bufFromString } from "./util";
|
||||
export class Converter extends Transform {
|
||||
preRawData(onRawData: PreRawDataCallback):Converter {
|
||||
this.runtime.preRawDataHook = onRawData;
|
||||
return this;
|
||||
}
|
||||
preFileLine(onFileLine: PreFileLineCallback):Converter {
|
||||
this.runtime.preFileLineHook = onFileLine;
|
||||
return this;
|
||||
}
|
||||
subscribe(
|
||||
onNext?: (data: any, lineNumber: number) => void | PromiseLike<void>,
|
||||
onError?: (err: CSVError) => void,
|
||||
onCompleted?: () => void): Converter {
|
||||
this.parseRuntime.subscribe = {
|
||||
onNext,
|
||||
onError,
|
||||
onCompleted
|
||||
}
|
||||
return this;
|
||||
}
|
||||
fromFile(filePath: string, options?: string | CreateReadStreamOption | undefined): Converter {
|
||||
const fs = require("fs");
|
||||
// var rs = null;
|
||||
// this.wrapCallback(cb, function () {
|
||||
// if (rs && rs.destroy) {
|
||||
// rs.destroy();
|
||||
// }
|
||||
// });
|
||||
fs.exists(filePath, (exist) => {
|
||||
if (exist) {
|
||||
const rs = fs.createReadStream(filePath, options);
|
||||
rs.pipe(this);
|
||||
} else {
|
||||
this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
fromStream(readStream: Readable): Converter {
|
||||
readStream.pipe(this);
|
||||
return this;
|
||||
}
|
||||
fromString(csvString: string): Converter {
|
||||
const csv = csvString.toString();
|
||||
const read = new Readable();
|
||||
let idx = 0;
|
||||
read._read = function (size) {
|
||||
if (idx >= csvString.length) {
|
||||
this.push(null);
|
||||
} else {
|
||||
const str = csvString.substr(idx, size);
|
||||
this.push(str);
|
||||
idx += size;
|
||||
}
|
||||
}
|
||||
return this.fromStream(read);
|
||||
}
|
||||
then<TResult1 = any[], TResult2 = never>(onfulfilled?: (value: any[]) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2> {
|
||||
return new P((resolve, reject) => {
|
||||
this.parseRuntime.then = {
|
||||
onfulfilled: (value: any[]) => {
|
||||
if (onfulfilled) {
|
||||
resolve(onfulfilled(value));
|
||||
} else {
|
||||
resolve(value as any);
|
||||
}
|
||||
},
|
||||
onrejected: (err: Error) => {
|
||||
if (onrejected) {
|
||||
resolve(onrejected(err));
|
||||
} else {
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public get parseParam(): CSVParseParam {
|
||||
return this.params;
|
||||
}
|
||||
public get parseRuntime(): ParseRuntime {
|
||||
return this.runtime;
|
||||
}
|
||||
private params: CSVParseParam;
|
||||
private runtime: ParseRuntime;
|
||||
private processor: Processor;
|
||||
private result: Result;
|
||||
constructor(param?: Partial<CSVParseParam>, public options: TransformOptions = {}) {
|
||||
super(options);
|
||||
this.params = mergeParams(param);
|
||||
this.runtime = initParseRuntime(this);
|
||||
this.result = new Result(this);
|
||||
if (this.params.fork) {
|
||||
this.processor = new ProcessorFork(this);
|
||||
} else {
|
||||
this.processor = new ProcessorLocal(this);
|
||||
}
|
||||
this.once("error", (err: any) => {
|
||||
// console.log("BBB");
|
||||
|
||||
setTimeout(() => {
|
||||
this.result.processError(err);
|
||||
this.emit("done", err);
|
||||
},0);
|
||||
|
||||
});
|
||||
this.once("done",()=>{
|
||||
this.processor.destroy();
|
||||
})
|
||||
|
||||
return this;
|
||||
}
|
||||
_transform(chunk: any, encoding: string, cb: Function) {
|
||||
this.processor.process(chunk)
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
this.runtime.started = true;
|
||||
return this.result.processResult(result);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
this.emit("drained");
|
||||
cb();
|
||||
}, (error) => {
|
||||
this.runtime.hasError = true;
|
||||
this.runtime.error = error;
|
||||
this.emit("error", error);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
_flush(cb: Function) {
|
||||
this.processor.flush()
|
||||
.then((data)=>{
|
||||
if (data.length>0){
|
||||
return this.result.processResult(data);
|
||||
}
|
||||
})
|
||||
.then(()=>{
|
||||
this.processEnd(cb);
|
||||
},(err)=>{
|
||||
this.emit("error",err);
|
||||
cb();
|
||||
})
|
||||
}
|
||||
private processEnd(cb) {
|
||||
this.result.endProcess();
|
||||
this.emit("done");
|
||||
cb();
|
||||
}
|
||||
get parsedLineNumber(): number {
|
||||
return this.runtime.parsedLineNumber;
|
||||
}
|
||||
}
|
||||
export interface CreateReadStreamOption {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
autoClose?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
export type CallBack = (err: Error, data: Array<any>) => void;
|
||||
|
||||
|
||||
export type PreFileLineCallback = (line: string, lineNumber: number) => string | PromiseLike<string>;
|
||||
export type PreRawDataCallback = (csvString: string) => string | PromiseLike<string>;
|
||||
</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 Thu May 17 2018 01:25:26 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>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user