new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
# mimic-response [](https://travis-ci.com/sindresorhus/mimic-response)
|
||||
|
||||
> Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install mimic-response
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const stream = require('stream');
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const responseStream = getHttpResponseStream();
|
||||
const myStream = new stream.PassThrough();
|
||||
|
||||
mimicResponse(responseStream, myStream);
|
||||
|
||||
console.log(myStream.statusCode);
|
||||
//=> 200
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### mimicResponse(from, to)
|
||||
|
||||
**Note #1:** The `from.destroy(error)` function is not proxied. You have to call it manually:
|
||||
|
||||
```js
|
||||
const stream = require('stream');
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const responseStream = getHttpResponseStream();
|
||||
|
||||
const myStream = new stream.PassThrough({
|
||||
destroy(error, callback) {
|
||||
responseStream.destroy();
|
||||
|
||||
callback(error);
|
||||
}
|
||||
});
|
||||
|
||||
myStream.destroy();
|
||||
```
|
||||
|
||||
Please note that `myStream` and `responseStream` never throws. The error is passed to the request instead.
|
||||
|
||||
#### from
|
||||
|
||||
Type: `Stream`
|
||||
|
||||
[Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
#### to
|
||||
|
||||
Type: `Stream`
|
||||
|
||||
Any stream.
|
||||
|
||||
## Related
|
||||
|
||||
- [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one
|
||||
- [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-mimic-response?utm_source=npm-mimic-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
import { exhaustAll } from './exhaustAll';
|
||||
export const exhaust = exhaustAll;
|
||||
//# sourceMappingURL=exhaust.js.map
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "next-tick",
|
||||
"version": "1.1.0",
|
||||
"description": "Environment agnostic nextTick polyfill",
|
||||
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
|
||||
"keywords": [
|
||||
"nexttick",
|
||||
"setImmediate",
|
||||
"setTimeout",
|
||||
"async"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/next-tick.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tad": "^3.0.1",
|
||||
"xlint": "^0.2.2",
|
||||
"xlint-jslint-medikoo": "^0.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
|
||||
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
|
||||
"test": "node node_modules/tad/bin/tad"
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var queue = t(3);
|
||||
|
||||
a(queue.hit('raz'), undefined, "Hit #1");
|
||||
a(queue.hit('raz'), undefined, "Hit #2");
|
||||
a(queue.hit('dwa'), undefined, "Hit #3");
|
||||
a(queue.hit('raz'), undefined, "Hit #4");
|
||||
a(queue.hit('dwa'), undefined, "Hit #5");
|
||||
a(queue.hit('trzy'), undefined, "Hit #6");
|
||||
a(queue.hit('raz'), undefined, "Hit #7");
|
||||
a(queue.hit('dwa'), undefined, "Hit #8");
|
||||
|
||||
a(queue.hit('cztery'), 'trzy', "Overflow #1");
|
||||
a(queue.hit('dwa'), undefined, "Hit #9");
|
||||
|
||||
a(queue.hit('trzy'), 'raz', "Overflow #2");
|
||||
|
||||
a(queue.hit('raz'), 'cztery', "Overflow #3");
|
||||
a(queue.hit('cztery'), 'dwa', "Overflow #4");
|
||||
a(queue.hit('trzy'), undefined, "Hit #10");
|
||||
|
||||
a(queue.hit('dwa'), 'raz', "Overflow #4");
|
||||
a(queue.hit('cztery'), undefined, "Hit #11");
|
||||
|
||||
queue.delete('cztery');
|
||||
a(queue.hit('cztery'), undefined, "Hit #12");
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.invariant = exports.isMissingLocaleDataError = exports.defineProperty = exports.getMagnitude = exports.setMultiInternalSlots = exports.setInternalSlot = exports.isLiteralPart = exports.getMultiInternalSlots = exports.getInternalSlot = exports._formatToParts = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
(0, tslib_1.__exportStar)(require("./CanonicalizeLocaleList"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./CanonicalizeTimeZoneName"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./CoerceOptionsToObject"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./GetNumberOption"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./GetOption"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./GetOptionsObject"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./IsSanctionedSimpleUnitIdentifier"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./IsValidTimeZoneName"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./IsWellFormedCurrencyCode"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./IsWellFormedUnitIdentifier"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/ComputeExponent"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/ComputeExponentForMagnitude"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/CurrencyDigits"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/FormatNumericToParts"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/FormatNumericToString"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/InitializeNumberFormat"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/PartitionNumberPattern"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/SetNumberFormatDigitOptions"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/SetNumberFormatUnitOptions"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/ToRawFixed"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./NumberFormat/ToRawPrecision"), exports);
|
||||
var format_to_parts_1 = require("./NumberFormat/format_to_parts");
|
||||
Object.defineProperty(exports, "_formatToParts", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(format_to_parts_1).default; } });
|
||||
(0, tslib_1.__exportStar)(require("./PartitionPattern"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./SupportedLocales"), exports);
|
||||
var utils_1 = require("./utils");
|
||||
Object.defineProperty(exports, "getInternalSlot", { enumerable: true, get: function () { return utils_1.getInternalSlot; } });
|
||||
Object.defineProperty(exports, "getMultiInternalSlots", { enumerable: true, get: function () { return utils_1.getMultiInternalSlots; } });
|
||||
Object.defineProperty(exports, "isLiteralPart", { enumerable: true, get: function () { return utils_1.isLiteralPart; } });
|
||||
Object.defineProperty(exports, "setInternalSlot", { enumerable: true, get: function () { return utils_1.setInternalSlot; } });
|
||||
Object.defineProperty(exports, "setMultiInternalSlots", { enumerable: true, get: function () { return utils_1.setMultiInternalSlots; } });
|
||||
Object.defineProperty(exports, "getMagnitude", { enumerable: true, get: function () { return utils_1.getMagnitude; } });
|
||||
Object.defineProperty(exports, "defineProperty", { enumerable: true, get: function () { return utils_1.defineProperty; } });
|
||||
var data_1 = require("./data");
|
||||
Object.defineProperty(exports, "isMissingLocaleDataError", { enumerable: true, get: function () { return data_1.isMissingLocaleDataError; } });
|
||||
(0, tslib_1.__exportStar)(require("./types/relative-time"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./types/date-time"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./types/list"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./types/plural-rules"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./types/number"), exports);
|
||||
(0, tslib_1.__exportStar)(require("./types/displaynames"), exports);
|
||||
var utils_2 = require("./utils");
|
||||
Object.defineProperty(exports, "invariant", { enumerable: true, get: function () { return utils_2.invariant; } });
|
||||
(0, tslib_1.__exportStar)(require("./262"), exports);
|
||||
@@ -0,0 +1,8 @@
|
||||
// Exports true if environment provides native `WeakMap` implementation, whatever that is.
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = (function () {
|
||||
if (typeof WeakMap !== "function") return false;
|
||||
return Object.prototype.toString.call(new WeakMap()) === "[object WeakMap]";
|
||||
}());
|
||||
@@ -0,0 +1,101 @@
|
||||
import {
|
||||
appendContextPath,
|
||||
blockParams,
|
||||
createFrame,
|
||||
isArray,
|
||||
isFunction
|
||||
} from '../utils';
|
||||
import Exception from '../exception';
|
||||
|
||||
export default function(instance) {
|
||||
instance.registerHelper('each', function(context, options) {
|
||||
if (!options) {
|
||||
throw new Exception('Must pass iterator to #each');
|
||||
}
|
||||
|
||||
let fn = options.fn,
|
||||
inverse = options.inverse,
|
||||
i = 0,
|
||||
ret = '',
|
||||
data,
|
||||
contextPath;
|
||||
|
||||
if (options.data && options.ids) {
|
||||
contextPath =
|
||||
appendContextPath(options.data.contextPath, options.ids[0]) + '.';
|
||||
}
|
||||
|
||||
if (isFunction(context)) {
|
||||
context = context.call(this);
|
||||
}
|
||||
|
||||
if (options.data) {
|
||||
data = createFrame(options.data);
|
||||
}
|
||||
|
||||
function execIteration(field, index, last) {
|
||||
if (data) {
|
||||
data.key = field;
|
||||
data.index = index;
|
||||
data.first = index === 0;
|
||||
data.last = !!last;
|
||||
|
||||
if (contextPath) {
|
||||
data.contextPath = contextPath + field;
|
||||
}
|
||||
}
|
||||
|
||||
ret =
|
||||
ret +
|
||||
fn(context[field], {
|
||||
data: data,
|
||||
blockParams: blockParams(
|
||||
[context[field], field],
|
||||
[contextPath + field, null]
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
if (context && typeof context === 'object') {
|
||||
if (isArray(context)) {
|
||||
for (let j = context.length; i < j; i++) {
|
||||
if (i in context) {
|
||||
execIteration(i, i, i === context.length - 1);
|
||||
}
|
||||
}
|
||||
} else if (global.Symbol && context[global.Symbol.iterator]) {
|
||||
const newContext = [];
|
||||
const iterator = context[global.Symbol.iterator]();
|
||||
for (let it = iterator.next(); !it.done; it = iterator.next()) {
|
||||
newContext.push(it.value);
|
||||
}
|
||||
context = newContext;
|
||||
for (let j = context.length; i < j; i++) {
|
||||
execIteration(i, i, i === context.length - 1);
|
||||
}
|
||||
} else {
|
||||
let priorKey;
|
||||
|
||||
Object.keys(context).forEach(key => {
|
||||
// We're running the iterations one step out of sync so we can detect
|
||||
// the last iteration without have to scan the object twice and create
|
||||
// an itermediate keys array.
|
||||
if (priorKey !== undefined) {
|
||||
execIteration(priorKey, i - 1);
|
||||
}
|
||||
priorKey = key;
|
||||
i++;
|
||||
});
|
||||
if (priorKey !== undefined) {
|
||||
execIteration(priorKey, i - 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
ret = inverse(this);
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { __asyncGenerator, __await } from "tslib";
|
||||
import { isFunction } from './isFunction';
|
||||
export function readableStreamLikeToAsyncGenerator(readableStream) {
|
||||
return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {
|
||||
const reader = readableStream.getReader();
|
||||
try {
|
||||
while (true) {
|
||||
const { value, done } = yield __await(reader.read());
|
||||
if (done) {
|
||||
return yield __await(void 0);
|
||||
}
|
||||
yield yield __await(value);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
reader.releaseLock();
|
||||
}
|
||||
});
|
||||
}
|
||||
export function isReadableStreamLike(obj) {
|
||||
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
||||
}
|
||||
//# sourceMappingURL=isReadableStreamLike.js.map
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CanonicalizeTimeZoneName = void 0;
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-canonicalizetimezonename
|
||||
* @param tz
|
||||
*/
|
||||
function CanonicalizeTimeZoneName(tz, _a) {
|
||||
var tzData = _a.tzData, uppercaseLinks = _a.uppercaseLinks;
|
||||
var uppercasedTz = tz.toUpperCase();
|
||||
var uppercasedZones = Object.keys(tzData).reduce(function (all, z) {
|
||||
all[z.toUpperCase()] = z;
|
||||
return all;
|
||||
}, {});
|
||||
var ianaTimeZone = uppercaseLinks[uppercasedTz] || uppercasedZones[uppercasedTz];
|
||||
if (ianaTimeZone === 'Etc/UTC' || ianaTimeZone === 'Etc/GMT') {
|
||||
return 'UTC';
|
||||
}
|
||||
return ianaTimeZone;
|
||||
}
|
||||
exports.CanonicalizeTimeZoneName = CanonicalizeTimeZoneName;
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').detectSeries;
|
||||
@@ -0,0 +1,162 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core/defaultParsers</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> csv2json/libs/core/defaultParsers
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/63</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/40</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/63</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 low'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file low" data-value="index.js"><a href="index.js.html">index.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parser_array.js"><a href="parser_array.js.html">parser_array.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="2" class="abs low">0/2</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5" class="abs low">0/5</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parser_flat.js"><a href="parser_flat.js.html">parser_flat.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="4" class="abs low">0/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="4" class="abs low">0/4</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parser_json.js"><a href="parser_json.js.html">parser_json.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="39" class="abs low">0/39</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="34" class="abs low">0/34</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="2" class="abs low">0/2</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="39" class="abs low">0/39</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parser_jsonarray.js"><a href="parser_jsonarray.js.html">parser_jsonarray.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="13" class="abs low">0/13</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="4" class="abs low">0/4</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="13" class="abs low">0/13</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="parser_omit.js"><a href="parser_omit.js.html">parser_omit.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 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>
|
||||
@@ -0,0 +1,17 @@
|
||||
export type User = {
|
||||
uuid: string;
|
||||
email: string;
|
||||
phone?: string;
|
||||
username: string;
|
||||
firstname: string;
|
||||
middlename?: string;
|
||||
lastname: string;
|
||||
password: string;
|
||||
groups?: any;
|
||||
enabled: boolean;
|
||||
refreshTokenCount: number;
|
||||
profilePic: string;
|
||||
resetRequestedTimestamp?: string;
|
||||
actions?: any;
|
||||
id: number;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"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","132":"C"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB EC FC","1090":"TB UB VB WB","2052":"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","4100":"c d e i j k l m n o p q r s t u f H xB yB"},D:{"1":"1 2 3 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","2":"I v J D E F A B C K L G M N O w","2052":"0 g x y z"},E:{"2":"I v J D E F A B C K L HC zB IC JC KC LC 0B qB rB 1B","4100":"G MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e PC QC RC SC qB AC TC rB"},G:{"2":"zB UC BC","260":"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"},H:{"2":"oC"},I:{"1":"f tC uC","2":"tB pC qC rC","514":"I sC BC"},J:{"1":"A","2":"D"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"4100":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"2052":"AD BD"}},B:1,C:"Date and time input types"};
|
||||
@@ -0,0 +1,186 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { ObservedValueOf, ObservableInputTuple, ObservableInput } from '../types';
|
||||
import { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';
|
||||
import { innerFrom } from './innerFrom';
|
||||
import { popResultSelector } from '../util/args';
|
||||
import { createOperatorSubscriber } from '../operators/OperatorSubscriber';
|
||||
import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';
|
||||
import { createObject } from '../util/createObject';
|
||||
import { AnyCatcher } from '../AnyCatcher';
|
||||
|
||||
// forkJoin(any)
|
||||
// We put this first because we need to catch cases where the user has supplied
|
||||
// _exactly `any`_ as the argument. Since `any` literally matches _anything_,
|
||||
// we don't want it to randomly hit one of the other type signatures below,
|
||||
// as we have no idea at build-time what type we should be returning when given an any.
|
||||
|
||||
/**
|
||||
* You have passed `any` here, we can't figure out if it is
|
||||
* an array or an object, so you're getting `unknown`. Use better types.
|
||||
* @param arg Something typed as `any`
|
||||
*/
|
||||
export function forkJoin<T extends AnyCatcher>(arg: T): Observable<unknown>;
|
||||
|
||||
// forkJoin(null | undefined)
|
||||
export function forkJoin(scheduler: null | undefined): Observable<never>;
|
||||
|
||||
// forkJoin([a, b, c])
|
||||
export function forkJoin(sources: readonly []): Observable<never>;
|
||||
export function forkJoin<A extends readonly unknown[]>(sources: readonly [...ObservableInputTuple<A>]): Observable<A>;
|
||||
export function forkJoin<A extends readonly unknown[], R>(
|
||||
sources: readonly [...ObservableInputTuple<A>],
|
||||
resultSelector: (...values: A) => R
|
||||
): Observable<R>;
|
||||
|
||||
// forkJoin(a, b, c)
|
||||
/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */
|
||||
export function forkJoin<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;
|
||||
/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */
|
||||
export function forkJoin<A extends readonly unknown[], R>(
|
||||
...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]
|
||||
): Observable<R>;
|
||||
|
||||
// forkJoin({a, b, c})
|
||||
export function forkJoin(sourcesObject: { [K in any]: never }): Observable<never>;
|
||||
export function forkJoin<T extends Record<string, ObservableInput<any>>>(
|
||||
sourcesObject: T
|
||||
): Observable<{ [K in keyof T]: ObservedValueOf<T[K]> }>;
|
||||
|
||||
/**
|
||||
* Accepts an `Array` of {@link ObservableInput} or a dictionary `Object` of {@link ObservableInput} and returns
|
||||
* an {@link Observable} that emits either an array of values in the exact same order as the passed array,
|
||||
* or a dictionary of values in the same shape as the passed dictionary.
|
||||
*
|
||||
* <span class="informal">Wait for Observables to complete and then combine last values they emitted;
|
||||
* complete immediately if an empty array is passed.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `forkJoin` is an operator that takes any number of input observables which can be passed either as an array
|
||||
* or a dictionary of input observables. If no input observables are provided (e.g. an empty array is passed),
|
||||
* then the resulting stream will complete immediately.
|
||||
*
|
||||
* `forkJoin` will wait for all passed observables to emit and complete and then it will emit an array or an object with last
|
||||
* values from corresponding observables.
|
||||
*
|
||||
* If you pass an array of `n` observables to the operator, then the resulting
|
||||
* array will have `n` values, where the first value is the last one emitted by the first observable,
|
||||
* second value is the last one emitted by the second observable and so on.
|
||||
*
|
||||
* If you pass a dictionary of observables to the operator, then the resulting
|
||||
* objects will have the same keys as the dictionary passed, with their last values they have emitted
|
||||
* located at the corresponding key.
|
||||
*
|
||||
* That means `forkJoin` will not emit more than once and it will complete after that. If you need to emit combined
|
||||
* values not only at the end of the lifecycle of passed observables, but also throughout it, try out {@link combineLatest}
|
||||
* or {@link zip} instead.
|
||||
*
|
||||
* In order for the resulting array to have the same length as the number of input observables, whenever any of
|
||||
* the given observables completes without emitting any value, `forkJoin` will complete at that moment as well
|
||||
* and it will not emit anything either, even if it already has some last values from other observables.
|
||||
* Conversely, if there is an observable that never completes, `forkJoin` will never complete either,
|
||||
* unless at any point some other observable completes without emitting a value, which brings us back to
|
||||
* the previous case. Overall, in order for `forkJoin` to emit a value, all given observables
|
||||
* have to emit something at least once and complete.
|
||||
*
|
||||
* If any given observable errors at some point, `forkJoin` will error as well and immediately unsubscribe
|
||||
* from the other observables.
|
||||
*
|
||||
* Optionally `forkJoin` accepts a `resultSelector` function, that will be called with values which normally
|
||||
* would land in the emitted array. Whatever is returned by the `resultSelector`, will appear in the output
|
||||
* observable instead. This means that the default `resultSelector` can be thought of as a function that takes
|
||||
* all its arguments and puts them into an array. Note that the `resultSelector` will be called only
|
||||
* when `forkJoin` is supposed to emit a result.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Use `forkJoin` with a dictionary of observable inputs
|
||||
*
|
||||
* ```ts
|
||||
* import { forkJoin, of, timer } from 'rxjs';
|
||||
*
|
||||
* const observable = forkJoin({
|
||||
* foo: of(1, 2, 3, 4),
|
||||
* bar: Promise.resolve(8),
|
||||
* baz: timer(4000)
|
||||
* });
|
||||
* observable.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('This is how it ends!'),
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // { foo: 4, bar: 8, baz: 0 } after 4 seconds
|
||||
* // 'This is how it ends!' immediately after
|
||||
* ```
|
||||
*
|
||||
* Use `forkJoin` with an array of observable inputs
|
||||
*
|
||||
* ```ts
|
||||
* import { forkJoin, of, timer } from 'rxjs';
|
||||
*
|
||||
* const observable = forkJoin([
|
||||
* of(1, 2, 3, 4),
|
||||
* Promise.resolve(8),
|
||||
* timer(4000)
|
||||
* ]);
|
||||
* observable.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('This is how it ends!'),
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // [4, 8, 0] after 4 seconds
|
||||
* // 'This is how it ends!' immediately after
|
||||
* ```
|
||||
*
|
||||
* @see {@link combineLatest}
|
||||
* @see {@link zip}
|
||||
*
|
||||
* @param {...ObservableInput} args Any number of Observables provided either as an array or as an arguments
|
||||
* passed directly to the operator.
|
||||
* @param {function} [project] Function that takes values emitted by input Observables and returns value
|
||||
* that will appear in resulting Observable instead of default array.
|
||||
* @return {Observable} Observable emitting either an array of last values emitted by passed Observables
|
||||
* or value from project function.
|
||||
*/
|
||||
export function forkJoin(...args: any[]): Observable<any> {
|
||||
const resultSelector = popResultSelector(args);
|
||||
const { args: sources, keys } = argsArgArrayOrObject(args);
|
||||
const result = new Observable((subscriber) => {
|
||||
const { length } = sources;
|
||||
if (!length) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
const values = new Array(length);
|
||||
let remainingCompletions = length;
|
||||
let remainingEmissions = length;
|
||||
for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {
|
||||
let hasValue = false;
|
||||
innerFrom(sources[sourceIndex]).subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => {
|
||||
if (!hasValue) {
|
||||
hasValue = true;
|
||||
remainingEmissions--;
|
||||
}
|
||||
values[sourceIndex] = value;
|
||||
},
|
||||
() => remainingCompletions--,
|
||||
undefined,
|
||||
() => {
|
||||
if (!remainingCompletions || !hasValue) {
|
||||
if (!remainingEmissions) {
|
||||
subscriber.next(keys ? createObject(keys, values) : values);
|
||||
}
|
||||
subscriber.complete();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.lastValueFrom = void 0;
|
||||
var EmptyError_1 = require("./util/EmptyError");
|
||||
function lastValueFrom(source, config) {
|
||||
var hasConfig = typeof config === 'object';
|
||||
return new Promise(function (resolve, reject) {
|
||||
var _hasValue = false;
|
||||
var _value;
|
||||
source.subscribe({
|
||||
next: function (value) {
|
||||
_value = value;
|
||||
_hasValue = true;
|
||||
},
|
||||
error: reject,
|
||||
complete: function () {
|
||||
if (_hasValue) {
|
||||
resolve(_value);
|
||||
}
|
||||
else if (hasConfig) {
|
||||
resolve(config.defaultValue);
|
||||
}
|
||||
else {
|
||||
reject(new EmptyError_1.EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.lastValueFrom = lastValueFrom;
|
||||
//# sourceMappingURL=lastValueFrom.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"using.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/using.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI5E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,CAAC,EAClD,eAAe,EAAE,MAAM,cAAc,GAAG,IAAI,EAC5C,iBAAiB,EAAE,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI,GAC/D,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAchC"}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,660 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/lineToJson.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> lineToJson.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.92% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>91/99</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">86.75% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>72/83</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.86% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>13/14</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.92% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>91/99</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>
|
||||
<a name='L185'></a><a href='#L185'>185</a>
|
||||
<a name='L186'></a><a href='#L186'>186</a>
|
||||
<a name='L187'></a><a href='#L187'>187</a>
|
||||
<a name='L188'></a><a href='#L188'>188</a>
|
||||
<a name='L189'></a><a href='#L189'>189</a>
|
||||
<a name='L190'></a><a href='#L190'>190</a>
|
||||
<a name='L191'></a><a href='#L191'>191</a>
|
||||
<a name='L192'></a><a href='#L192'>192</a>
|
||||
<a name='L193'></a><a href='#L193'>193</a>
|
||||
<a name='L194'></a><a href='#L194'>194</a>
|
||||
<a name='L195'></a><a href='#L195'>195</a>
|
||||
<a name='L196'></a><a href='#L196'>196</a>
|
||||
<a name='L197'></a><a href='#L197'>197</a>
|
||||
<a name='L198'></a><a href='#L198'>198</a></td><td class="line-coverage quiet"><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-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-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">102x</span>
|
||||
<span class="cline-any cline-yes">102x</span>
|
||||
<span class="cline-any cline-yes">32101x</span>
|
||||
<span class="cline-any cline-yes">32099x</span>
|
||||
<span class="cline-any cline-yes">32090x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">100x</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-yes">32101x</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">32099x</span>
|
||||
<span class="cline-any cline-yes">32099x</span>
|
||||
<span class="cline-any cline-yes">32099x</span>
|
||||
<span class="cline-any cline-yes">32090x</span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-yes">32099x</span>
|
||||
<span class="cline-any cline-yes">32099x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">32099x</span>
|
||||
<span class="cline-any cline-yes">65788x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65788x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65781x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65781x</span>
|
||||
<span class="cline-any cline-yes">65781x</span>
|
||||
<span class="cline-any cline-yes">50x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65781x</span>
|
||||
<span class="cline-any cline-yes">65781x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</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">65775x</span>
|
||||
<span class="cline-any cline-yes">75x</span>
|
||||
<span class="cline-any cline-yes">75x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65775x</span>
|
||||
<span class="cline-any cline-yes">65775x</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">32099x</span>
|
||||
<span class="cline-any cline-yes">32090x</span>
|
||||
<span class="cline-any cline-neutral"> </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">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">65781x</span>
|
||||
<span class="cline-any cline-yes">65243x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">538x</span>
|
||||
<span class="cline-any cline-yes">538x</span>
|
||||
<span class="cline-any cline-yes">533x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">1x</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-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </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-no"> </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">65781x</span>
|
||||
<span class="cline-any cline-yes">538x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">535x</span>
|
||||
<span class="cline-any cline-yes">103x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">102x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">432x</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">65781x</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">64992x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">789x</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">75x</span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-yes">66x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-yes">66x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-yes">66x</span>
|
||||
<span class="cline-any cline-yes">66x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </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">13x</span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">13x</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">60x</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">75x</span>
|
||||
<span class="cline-any cline-yes">75x</span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">62x</span>
|
||||
<span class="cline-any cline-yes">13x</span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">47x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">42x</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">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </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-no"> </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 { Converter } from "./Converter";
|
||||
import CSVError from "./CSVError";
|
||||
import { CellParser, ColumnParam } from "./Parameters";
|
||||
import set from "lodash/set";
|
||||
import { ParseRuntime } from "./ParseRuntime";
|
||||
|
||||
var numReg = /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;
|
||||
|
||||
export default function (csvRows: string[][], conv: Converter): JSONResult[] {
|
||||
const res: JSONResult[] = [];
|
||||
for (let i = 0, len = csvRows.length; i < len; i++) {
|
||||
const r = processRow(csvRows[i], conv, i);
|
||||
if (r) {
|
||||
res.push(r);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
};
|
||||
export type JSONResult = {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
function processRow(row: string[], conv: Converter, index): JSONResult | null {
|
||||
|
||||
if (conv.parseParam.checkColumn && conv.parseRuntime.headers && row.length !== conv.parseRuntime.headers.length) {
|
||||
throw (CSVError.column_mismatched(conv.parseRuntime.parsedLineNumber + index))
|
||||
}
|
||||
|
||||
const headRow = conv.parseRuntime.headers || <span class="branch-1 cbranch-no" title="branch not covered" >[];</span>
|
||||
const resultRow = convertRowToJson(row, headRow, conv);
|
||||
if (resultRow) {
|
||||
return resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function convertRowToJson(row: string[], headRow: string[], conv: Converter): { [key: string]: any } | null {
|
||||
let hasValue = false;
|
||||
const resultRow = {};
|
||||
|
||||
for (let i = 0, len = row.length; i < len; i++) {
|
||||
let item = row[i];
|
||||
|
||||
if (conv.parseParam.ignoreEmpty && item === '') {
|
||||
continue;
|
||||
}
|
||||
hasValue = true;
|
||||
|
||||
let head = headRow[i];
|
||||
if (!head || head === "") {
|
||||
head = headRow[i] = "field" + (i + 1);
|
||||
}
|
||||
const convFunc = getConvFunc(head, i, conv);
|
||||
if (convFunc) {
|
||||
const convRes = convFunc(item, head, resultRow, row, i);
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (convRes !== undefined) {
|
||||
setPath(resultRow, head, convRes, conv,i);
|
||||
}
|
||||
} else {
|
||||
// var flag = getFlag(head, i, param);
|
||||
// if (flag === 'omit') {
|
||||
// continue;
|
||||
// }
|
||||
if (conv.parseParam.checkType) {
|
||||
const convertFunc = checkType(item, head, i, conv);
|
||||
item = convertFunc(item);
|
||||
}
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (item !== undefined) {
|
||||
setPath(resultRow, head, item, conv,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasValue) {
|
||||
return resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const builtInConv: { [key: string]: CellParser } = {
|
||||
"string": stringType,
|
||||
"number": numberType,
|
||||
"omit": <span class="fstat-no" title="function not covered" >function () { </span>}
|
||||
}
|
||||
function getConvFunc(head: string, i: number, conv: Converter): CellParser | null {
|
||||
if (conv.parseRuntime.columnConv[i] !== undefined) {
|
||||
return conv.parseRuntime.columnConv[i];
|
||||
} else {
|
||||
let flag = conv.parseParam.colParser[head];
|
||||
if (flag === undefined) {
|
||||
return conv.parseRuntime.columnConv[i] = null;
|
||||
}
|
||||
if (typeof flag === "object") {
|
||||
flag = (flag as ColumnParam).cellParser || "string";
|
||||
}
|
||||
if (typeof flag === "string") {
|
||||
flag = flag.trim().toLowerCase();
|
||||
const builtInFunc = builtInConv[flag];
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (builtInFunc) {
|
||||
return conv.parseRuntime.columnConv[i] = builtInFunc;
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > return conv.parseRuntime.columnConv[i] = null;</span>
|
||||
}
|
||||
} else <span class="missing-if-branch" title="else path not taken" >E</span>if (typeof flag === "function") {
|
||||
return conv.parseRuntime.columnConv[i] = flag;
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > return conv.parseRuntime.columnConv[i] = null;</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
function setPath(resultJson: any, head: string, value: any, conv: Converter,headIdx:number) {
|
||||
if (!conv.parseRuntime.columnValueSetter[headIdx]) {
|
||||
if (conv.parseParam.flatKeys) {
|
||||
conv.parseRuntime.columnValueSetter[headIdx] = flatSetter;
|
||||
} else {
|
||||
if (head.indexOf(".") > -1) {
|
||||
if (conv.parseParam.colParser[head] && (conv.parseParam.colParser[head] as ColumnParam).flat) {
|
||||
conv.parseRuntime.columnValueSetter[headIdx] = flatSetter;
|
||||
} else {
|
||||
conv.parseRuntime.columnValueSetter[headIdx] = jsonSetter;
|
||||
}
|
||||
} else {
|
||||
conv.parseRuntime.columnValueSetter[headIdx] = flatSetter;
|
||||
}
|
||||
}
|
||||
}
|
||||
conv.parseRuntime.columnValueSetter[headIdx](resultJson, head, value);
|
||||
// flatSetter(resultJson, head, value);
|
||||
|
||||
}
|
||||
function flatSetter(resultJson: any, head: string, value: any) {
|
||||
resultJson[head] = value;
|
||||
}
|
||||
function jsonSetter(resultJson: any, head: string, value: any) {
|
||||
set(resultJson, head, value);
|
||||
}
|
||||
|
||||
|
||||
function checkType(item: string, head: string, headIdx: number, conv: Converter): Function {
|
||||
if (conv.parseRuntime.headerType[headIdx]) {
|
||||
return conv.parseRuntime.headerType[headIdx];
|
||||
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (head.indexOf('number#!') > -1) {
|
||||
<span class="cstat-no" title="statement not covered" > return conv.parseRuntime.headerType[headIdx] = numberType;</span>
|
||||
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (head.indexOf('string#!') > -1) {
|
||||
<span class="cstat-no" title="statement not covered" > return conv.parseRuntime.headerType[headIdx] = stringType;</span>
|
||||
} else <span class="missing-if-branch" title="else path not taken" >E</span>if (conv.parseParam.checkType) {
|
||||
return conv.parseRuntime.headerType[headIdx] = dynamicType;
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > return conv.parseRuntime.headerType[headIdx] = stringType;</span>
|
||||
}
|
||||
}
|
||||
|
||||
function numberType(item) {
|
||||
var rtn = parseFloat(item);
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (isNaN(rtn)) {
|
||||
<span class="cstat-no" title="statement not covered" > return item;</span>
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
function stringType(item: string): string {
|
||||
return item.toString();
|
||||
}
|
||||
|
||||
function dynamicType(item) {
|
||||
var trimed = item.trim();
|
||||
if (trimed === "") {
|
||||
return stringType(item);
|
||||
}
|
||||
if (numReg.test(trimed)) {
|
||||
return numberType(item);
|
||||
} else if (trimed.length === 5 && trimed.toLowerCase() === "false" || trimed.length === 4 && trimed.toLowerCase() === "true") {
|
||||
return booleanType(item);
|
||||
} else if (trimed[0] === "{" && trimed[trimed.length - 1] === "}" || trimed[0] === "[" && trimed[trimed.length - 1] === "]") {
|
||||
return jsonType(item);
|
||||
} else {
|
||||
return stringType(item);
|
||||
}
|
||||
}
|
||||
|
||||
function booleanType(item) {
|
||||
var trimed = item.trim();
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (trimed.length === 5 && <span class="branch-1 cbranch-no" title="branch not covered" >trimed.toLowerCase() === "false")</span> {
|
||||
<span class="cstat-no" title="statement not covered" > return false;</span>
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function jsonType(item) {
|
||||
try {
|
||||
return JSON.parse(item);
|
||||
} catch (e) {
|
||||
<span class="cstat-no" title="statement not covered" > return item;</span>
|
||||
}
|
||||
}
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 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>
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0.00573,"49":0,"50":0,"51":0,"52":0.01718,"53":0,"54":0,"55":0,"56":0.00573,"57":0,"58":0,"59":0,"60":0.00573,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00573,"67":0.00573,"68":0.00573,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.0229,"79":0,"80":0,"81":0,"82":0,"83":0.00573,"84":0,"85":0,"86":0,"87":0,"88":0.00573,"89":0,"90":0,"91":0.00573,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0.00573,"98":0,"99":0.00573,"100":0.00573,"101":0.00573,"102":0.05725,"103":0.00573,"104":0.01145,"105":0.00573,"106":0.02863,"107":0.01145,"108":0.04008,"109":1.05913,"110":0.69273,"111":0.00573,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.0458,"50":0,"51":0,"52":0.00573,"53":0,"54":0,"55":0,"56":0.00573,"57":0,"58":0.0229,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0.00573,"65":0.00573,"66":0,"67":0.00573,"68":0,"69":0.00573,"70":0.00573,"71":0,"72":0.00573,"73":0.00573,"74":0.01145,"75":0.00573,"76":0.00573,"77":0.00573,"78":0.00573,"79":0.01718,"80":0.01145,"81":0.07443,"83":0.0229,"84":0.01718,"85":0.0229,"86":0.02863,"87":0.02863,"88":0.00573,"89":0.01718,"90":0.00573,"91":0.01145,"92":0.02863,"93":0.00573,"94":0.01718,"95":0.01718,"96":0.0229,"97":0.0229,"98":0.03435,"99":0.0229,"100":0.0229,"101":0.0229,"102":0.02863,"103":0.08588,"104":0.02863,"105":0.05725,"106":0.07443,"107":0.09733,"108":0.47518,"109":7.98638,"110":5.59905,"111":0.01145,"112":0.00573,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.00573,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.00573,"94":0.07443,"95":0.08588,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0.00573,"18":0.00573,"79":0,"80":0,"81":0,"83":0,"84":0.00573,"85":0.00573,"86":0.00573,"87":0,"88":0,"89":0,"90":0.00573,"91":0.00573,"92":0.00573,"93":0,"94":0.00573,"95":0,"96":0.00573,"97":0,"98":0.00573,"99":0.00573,"100":0.00573,"101":0.00573,"102":0.00573,"103":0.00573,"104":0.00573,"105":0.00573,"106":0.01718,"107":0.02863,"108":0.15458,"109":2.9999,"110":4.04758},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00573,"13":0.01718,"14":0.05725,"15":0.01145,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.00573,"12.1":0.01718,"13.1":0.07443,"14.1":0.14313,"15.1":0.01718,"15.2-15.3":0.01718,"15.4":0.06298,"15.5":0.0916,"15.6":0.49235,"16.0":0.0458,"16.1":0.14313,"16.2":0.50953,"16.3":0.37213,"16.4":0},G:{"8":0.00932,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.06523,"8.1-8.4":0.10716,"9.0-9.2":0.31215,"9.3":0.14909,"10.0-10.2":0.02329,"10.3":0.09784,"11.0-11.2":0.09784,"11.3-11.4":0.03727,"12.0-12.1":0.05125,"12.2-12.5":0.49851,"13.0-13.1":0.05125,"13.2":0.02329,"13.3":0.06988,"13.4-13.7":0.20965,"14.0-14.4":0.70817,"14.5-14.8":1.7378,"15.0-15.1":0.35874,"15.2-15.3":0.51715,"15.4":0.71748,"15.5":1.1927,"15.6":4.62638,"16.0":3.033,"16.1":11.59623,"16.2":12.05281,"16.3":5.73056,"16.4":0.01398},P:{"4":0.0104,"20":0.37422,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.0104,"12.0":0.0104,"13.0":0.0104,"14.0":0.0104,"15.0":0,"16.0":0.02079,"17.0":0.02079,"18.0":0.02079,"19.0":0.49896},I:{"0":0,"3":0,"4":0.01027,"2.1":0,"2.2":0.01027,"2.3":0,"4.1":0.05135,"4.2-4.3":0.18487,"4.4":0,"4.4.3-4.4.4":0.28758},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.00716,"9":0.02147,"10":0,"11":0.37213,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.21375},H:{"0":0.10523},L:{"0":25.09788},R:{_:"0"},M:{"0":0.3591},Q:{"13.1":0.02138}};
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "yallist",
|
||||
"version": "4.0.0",
|
||||
"description": "Yet Another Linked List",
|
||||
"main": "yallist.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"yallist.js",
|
||||
"iterator.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "^12.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --100",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/yallist.git"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "node-domexception",
|
||||
"version": "1.0.0",
|
||||
"description": "An implementation of the DOMException class from NodeJS",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jimmywarting/node-domexception.git"
|
||||
},
|
||||
"author": "Jimmy Wärting",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jimmywarting/node-domexception/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jimmywarting/node-domexception#readme"
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { OperatorFunction, ObservableInput } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
import { noop } from '../util/noop';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
|
||||
/**
|
||||
* Buffers the source Observable values until `closingNotifier` emits.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when another Observable emits.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Buffers the incoming Observable values until the given `closingNotifier`
|
||||
* `ObservableInput` (that internally gets converted to an Observable)
|
||||
* emits a value, at which point it emits the buffer on the output
|
||||
* Observable and starts a new buffer internally, awaiting the next time
|
||||
* `closingNotifier` emits.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* On every click, emit array of most recent interval events
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, interval, buffer } from 'rxjs';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const intervalEvents = interval(1000);
|
||||
* const buffered = intervalEvents.pipe(buffer(clicks));
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link window}
|
||||
*
|
||||
* @param closingNotifier An `ObservableInput` that signals the
|
||||
* buffer to be emitted on the output Observable.
|
||||
* @return A function that returns an Observable of buffers, which are arrays
|
||||
* of values.
|
||||
*/
|
||||
export function buffer<T>(closingNotifier: ObservableInput<any>): OperatorFunction<T, T[]> {
|
||||
return operate((source, subscriber) => {
|
||||
// The current buffered values.
|
||||
let currentBuffer: T[] = [];
|
||||
|
||||
// Subscribe to our source.
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => currentBuffer.push(value),
|
||||
() => {
|
||||
subscriber.next(currentBuffer);
|
||||
subscriber.complete();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
// Subscribe to the closing notifier.
|
||||
innerFrom(closingNotifier).subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
() => {
|
||||
// Start a new buffer and emit the previous one.
|
||||
const b = currentBuffer;
|
||||
currentBuffer = [];
|
||||
subscriber.next(b);
|
||||
},
|
||||
noop
|
||||
)
|
||||
);
|
||||
|
||||
return () => {
|
||||
// Ensure buffered values are released on finalization.
|
||||
currentBuffer = null!;
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
|
||||
if (!globalThis.DOMException) {
|
||||
try {
|
||||
const { MessageChannel } = require('worker_threads'),
|
||||
port = new MessageChannel().port1,
|
||||
ab = new ArrayBuffer()
|
||||
port.postMessage(ab, [ab, ab])
|
||||
} catch (err) {
|
||||
err.constructor.name === 'DOMException' && (
|
||||
globalThis.DOMException = err.constructor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = globalThis.DOMException
|
||||
|
||||
|
||||
const { MessageChannel } = require('worker_threads')
|
||||
|
||||
async function hello() {
|
||||
const port = new MessageChannel().port1
|
||||
const ab = new ArrayBuffer()
|
||||
port.postMessage(ab, [ab, ab])
|
||||
}
|
||||
|
||||
hello().catch(err => {
|
||||
console.assert(err.name === 'DataCloneError')
|
||||
console.assert(err.code === 25)
|
||||
console.assert(err instanceof DOMException)
|
||||
})
|
||||
|
||||
const e1 = new DOMException('Something went wrong', 'BadThingsError')
|
||||
console.assert(e1.name === 'BadThingsError')
|
||||
console.assert(e1.code === 0)
|
||||
|
||||
const e2 = new DOMException('Another exciting error message', 'NoModificationAllowedError')
|
||||
console.assert(e2.name === 'NoModificationAllowedError')
|
||||
console.assert(e2.code === 7)
|
||||
|
||||
console.assert(DOMException.INUSE_ATTRIBUTE_ERR === 10)
|
||||
@@ -0,0 +1,4 @@
|
||||
export type DonorIdsNotMatchingError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
export default function cloneNodes(nodes, source = undefined, raws = undefined) {
|
||||
return nodes.map((node) => {
|
||||
let cloned = node.clone()
|
||||
|
||||
// We always want override the source map
|
||||
// except when explicitly told not to
|
||||
let shouldOverwriteSource = node.raws.tailwind?.preserveSource !== true || !cloned.source
|
||||
|
||||
if (source !== undefined && shouldOverwriteSource) {
|
||||
cloned.source = source
|
||||
|
||||
if ('walk' in cloned) {
|
||||
cloned.walk((child) => {
|
||||
child.source = source
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (raws !== undefined) {
|
||||
cloned.raws.tailwind = {
|
||||
...cloned.raws.tailwind,
|
||||
...raws,
|
||||
}
|
||||
}
|
||||
|
||||
return cloned
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isAsyncIterable.js","sourceRoot":"","sources":["../../../../src/internal/util/isAsyncIterable.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAE1C,SAAgB,eAAe,CAAI,GAAQ;IACzC,OAAO,MAAM,CAAC,aAAa,IAAI,uBAAU,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AACzE,CAAC;AAFD,0CAEC"}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
relative require
|
||||
*/'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var Module = require('module');
|
||||
|
||||
var modules = {};
|
||||
|
||||
var getModule = function(dir) {
|
||||
var rootPath = dir ? path.resolve(dir) : process.cwd();
|
||||
var rootName = path.join(rootPath, '@root');
|
||||
var root = modules[rootName];
|
||||
if (!root) {
|
||||
root = new Module(rootName);
|
||||
root.filename = rootName;
|
||||
root.paths = Module._nodeModulePaths(rootPath);
|
||||
modules[rootName] = root;
|
||||
}
|
||||
return root;
|
||||
};
|
||||
|
||||
var requireRelative = function(requested, relativeTo) {
|
||||
var root = getModule(relativeTo);
|
||||
return root.require(requested);
|
||||
};
|
||||
|
||||
requireRelative.resolve = function(requested, relativeTo) {
|
||||
var root = getModule(relativeTo);
|
||||
return Module._resolveFilename(requested, root);
|
||||
};
|
||||
|
||||
module.exports = requireRelative;
|
||||
@@ -0,0 +1,23 @@
|
||||
var naturalCompare = require('../../utils/natural-compare');
|
||||
|
||||
function naturalSorter(scope1, scope2) {
|
||||
return naturalCompare(scope1[1], scope2[1]);
|
||||
}
|
||||
|
||||
function standardSorter(scope1, scope2) {
|
||||
return scope1[1] > scope2[1] ? 1 : -1;
|
||||
}
|
||||
|
||||
function sortSelectors(selectors, method) {
|
||||
switch (method) {
|
||||
case 'natural':
|
||||
return selectors.sort(naturalSorter);
|
||||
case 'standard':
|
||||
return selectors.sort(standardSorter);
|
||||
case 'none':
|
||||
case false:
|
||||
return selectors;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = sortSelectors;
|
||||
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isMimeType;
|
||||
|
||||
var _assertString = _interopRequireDefault(require("./util/assertString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/*
|
||||
Checks if the provided string matches to a correct Media type format (MIME type)
|
||||
|
||||
This function only checks is the string format follows the
|
||||
etablished rules by the according RFC specifications.
|
||||
This function supports 'charset' in textual media types
|
||||
(https://tools.ietf.org/html/rfc6657).
|
||||
|
||||
This function does not check against all the media types listed
|
||||
by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml)
|
||||
because of lightness purposes : it would require to include
|
||||
all these MIME types in this librairy, which would weigh it
|
||||
significantly. This kind of effort maybe is not worth for the use that
|
||||
this function has in this entire librairy.
|
||||
|
||||
More informations in the RFC specifications :
|
||||
- https://tools.ietf.org/html/rfc2045
|
||||
- https://tools.ietf.org/html/rfc2046
|
||||
- https://tools.ietf.org/html/rfc7231#section-3.1.1.1
|
||||
- https://tools.ietf.org/html/rfc7231#section-3.1.1.5
|
||||
*/
|
||||
// Match simple MIME types
|
||||
// NB :
|
||||
// Subtype length must not exceed 100 characters.
|
||||
// This rule does not comply to the RFC specs (what is the max length ?).
|
||||
var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+_]{1,100}$/i; // eslint-disable-line max-len
|
||||
// Handle "charset" in "text/*"
|
||||
|
||||
var mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len
|
||||
// Handle "boundary" in "multipart/*"
|
||||
|
||||
var mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len
|
||||
|
||||
function isMimeType(str) {
|
||||
(0, _assertString.default)(str);
|
||||
return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,66 @@
|
||||
# array.prototype.map <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
An ES5 spec-compliant `Array.prototype.map` shim/polyfill/replacement that works as far down as ES3.
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://www.ecma-international.org/ecma-262/5.1/).
|
||||
|
||||
Because `Array.prototype.map` depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var map = require('array.prototype.map');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(map([1, 1, 1], function (x) { return x + 1; }), [2, 2, 2]);
|
||||
assert.deepEqual(map([1, 0, 1], function (x) { return x + 1; }), [2, 1, 2]);
|
||||
```
|
||||
|
||||
```js
|
||||
var map = require('array.prototype.map');
|
||||
var assert = require('assert');
|
||||
/* when Array#map is not present */
|
||||
delete Array.prototype.map;
|
||||
var shimmedMap = map.shim();
|
||||
assert.equal(shimmedMap, map.getPolyfill());
|
||||
var arr = [1, 2, 3];
|
||||
var add4 = function (x) { return x + 4; };
|
||||
assert.deepEqual(arr.map(add4), map(arr, add4));
|
||||
```
|
||||
|
||||
```js
|
||||
var map = require('array.prototype.map');
|
||||
var assert = require('assert');
|
||||
/* when Array#map is present */
|
||||
var shimmedMap = map.shim();
|
||||
assert.equal(shimmedMap, Array.prototype.map);
|
||||
assert.deepEqual(arr.map(add4), map(arr, add4));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/array.prototype.map
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/Array.prototype.map.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/Array.prototype.map.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/Array.prototype.map
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/Array.prototype.map/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/Array.prototype.map#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/array.prototype.map.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/array.prototype.map.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/array.prototype.map.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=array.prototype.map
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/Array.prototype.map/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/Array.prototype.map/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Array.prototype.map
|
||||
[actions-url]: https://github.com/es-shims/Array.prototype.map/actions
|
||||
@@ -0,0 +1,15 @@
|
||||
import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
|
||||
import { filter } from './filter';
|
||||
import { throwIfEmpty } from './throwIfEmpty';
|
||||
import { defaultIfEmpty } from './defaultIfEmpty';
|
||||
import { take } from './take';
|
||||
export function elementAt(index, defaultValue) {
|
||||
if (index < 0) {
|
||||
throw new ArgumentOutOfRangeError();
|
||||
}
|
||||
var hasDefaultValue = arguments.length >= 2;
|
||||
return function (source) {
|
||||
return source.pipe(filter(function (v, i) { return i === index; }), take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new ArgumentOutOfRangeError(); }));
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=elementAt.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"J D E F A CC","132":"B"},B:{"132":"C K L G M N O","260":"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 DC tB I v J D E F A B C K L G M N O w g x y z EC FC","516":"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 wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB"},D:{"1":"0 1 2 N O w g x y z","2":"I v J D E F A B C K L G M","132":"3 4 5 6 7 8 9 AB BB CB DB EB FB GB","260":"HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"J IC JC","2":"I v HC zB","2052":"D E F A B C K L G KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e PC QC RC SC qB AC TC rB"},G:{"2":"zB UC BC","1025":"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"},H:{"1025":"oC"},I:{"1":"tB I f pC qC rC sC BC tC uC"},J:{"1":"D A"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2052":"A B"},O:{"1025":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"260":"1B"},R:{"1":"9C"},S:{"516":"AD BD"}},B:1,C:"autocomplete attribute: on & off values"};
|
||||
@@ -0,0 +1,289 @@
|
||||
'use strict'
|
||||
|
||||
/* eslint-disable no-var */
|
||||
|
||||
var reusify = require('reusify')
|
||||
|
||||
function fastqueue (context, worker, concurrency) {
|
||||
if (typeof context === 'function') {
|
||||
concurrency = worker
|
||||
worker = context
|
||||
context = null
|
||||
}
|
||||
|
||||
if (concurrency < 1) {
|
||||
throw new Error('fastqueue concurrency must be greater than 1')
|
||||
}
|
||||
|
||||
var cache = reusify(Task)
|
||||
var queueHead = null
|
||||
var queueTail = null
|
||||
var _running = 0
|
||||
var errorHandler = null
|
||||
|
||||
var self = {
|
||||
push: push,
|
||||
drain: noop,
|
||||
saturated: noop,
|
||||
pause: pause,
|
||||
paused: false,
|
||||
concurrency: concurrency,
|
||||
running: running,
|
||||
resume: resume,
|
||||
idle: idle,
|
||||
length: length,
|
||||
getQueue: getQueue,
|
||||
unshift: unshift,
|
||||
empty: noop,
|
||||
kill: kill,
|
||||
killAndDrain: killAndDrain,
|
||||
error: error
|
||||
}
|
||||
|
||||
return self
|
||||
|
||||
function running () {
|
||||
return _running
|
||||
}
|
||||
|
||||
function pause () {
|
||||
self.paused = true
|
||||
}
|
||||
|
||||
function length () {
|
||||
var current = queueHead
|
||||
var counter = 0
|
||||
|
||||
while (current) {
|
||||
current = current.next
|
||||
counter++
|
||||
}
|
||||
|
||||
return counter
|
||||
}
|
||||
|
||||
function getQueue () {
|
||||
var current = queueHead
|
||||
var tasks = []
|
||||
|
||||
while (current) {
|
||||
tasks.push(current.value)
|
||||
current = current.next
|
||||
}
|
||||
|
||||
return tasks
|
||||
}
|
||||
|
||||
function resume () {
|
||||
if (!self.paused) return
|
||||
self.paused = false
|
||||
for (var i = 0; i < self.concurrency; i++) {
|
||||
_running++
|
||||
release()
|
||||
}
|
||||
}
|
||||
|
||||
function idle () {
|
||||
return _running === 0 && self.length() === 0
|
||||
}
|
||||
|
||||
function push (value, done) {
|
||||
var current = cache.get()
|
||||
|
||||
current.context = context
|
||||
current.release = release
|
||||
current.value = value
|
||||
current.callback = done || noop
|
||||
current.errorHandler = errorHandler
|
||||
|
||||
if (_running === self.concurrency || self.paused) {
|
||||
if (queueTail) {
|
||||
queueTail.next = current
|
||||
queueTail = current
|
||||
} else {
|
||||
queueHead = current
|
||||
queueTail = current
|
||||
self.saturated()
|
||||
}
|
||||
} else {
|
||||
_running++
|
||||
worker.call(context, current.value, current.worked)
|
||||
}
|
||||
}
|
||||
|
||||
function unshift (value, done) {
|
||||
var current = cache.get()
|
||||
|
||||
current.context = context
|
||||
current.release = release
|
||||
current.value = value
|
||||
current.callback = done || noop
|
||||
|
||||
if (_running === self.concurrency || self.paused) {
|
||||
if (queueHead) {
|
||||
current.next = queueHead
|
||||
queueHead = current
|
||||
} else {
|
||||
queueHead = current
|
||||
queueTail = current
|
||||
self.saturated()
|
||||
}
|
||||
} else {
|
||||
_running++
|
||||
worker.call(context, current.value, current.worked)
|
||||
}
|
||||
}
|
||||
|
||||
function release (holder) {
|
||||
if (holder) {
|
||||
cache.release(holder)
|
||||
}
|
||||
var next = queueHead
|
||||
if (next) {
|
||||
if (!self.paused) {
|
||||
if (queueTail === queueHead) {
|
||||
queueTail = null
|
||||
}
|
||||
queueHead = next.next
|
||||
next.next = null
|
||||
worker.call(context, next.value, next.worked)
|
||||
if (queueTail === null) {
|
||||
self.empty()
|
||||
}
|
||||
} else {
|
||||
_running--
|
||||
}
|
||||
} else if (--_running === 0) {
|
||||
self.drain()
|
||||
}
|
||||
}
|
||||
|
||||
function kill () {
|
||||
queueHead = null
|
||||
queueTail = null
|
||||
self.drain = noop
|
||||
}
|
||||
|
||||
function killAndDrain () {
|
||||
queueHead = null
|
||||
queueTail = null
|
||||
self.drain()
|
||||
self.drain = noop
|
||||
}
|
||||
|
||||
function error (handler) {
|
||||
errorHandler = handler
|
||||
}
|
||||
}
|
||||
|
||||
function noop () {}
|
||||
|
||||
function Task () {
|
||||
this.value = null
|
||||
this.callback = noop
|
||||
this.next = null
|
||||
this.release = noop
|
||||
this.context = null
|
||||
this.errorHandler = null
|
||||
|
||||
var self = this
|
||||
|
||||
this.worked = function worked (err, result) {
|
||||
var callback = self.callback
|
||||
var errorHandler = self.errorHandler
|
||||
var val = self.value
|
||||
self.value = null
|
||||
self.callback = noop
|
||||
if (self.errorHandler) {
|
||||
errorHandler(err, val)
|
||||
}
|
||||
callback.call(self.context, err, result)
|
||||
self.release(self)
|
||||
}
|
||||
}
|
||||
|
||||
function queueAsPromised (context, worker, concurrency) {
|
||||
if (typeof context === 'function') {
|
||||
concurrency = worker
|
||||
worker = context
|
||||
context = null
|
||||
}
|
||||
|
||||
function asyncWrapper (arg, cb) {
|
||||
worker.call(this, arg)
|
||||
.then(function (res) {
|
||||
cb(null, res)
|
||||
}, cb)
|
||||
}
|
||||
|
||||
var queue = fastqueue(context, asyncWrapper, concurrency)
|
||||
|
||||
var pushCb = queue.push
|
||||
var unshiftCb = queue.unshift
|
||||
|
||||
queue.push = push
|
||||
queue.unshift = unshift
|
||||
queue.drained = drained
|
||||
|
||||
return queue
|
||||
|
||||
function push (value) {
|
||||
var p = new Promise(function (resolve, reject) {
|
||||
pushCb(value, function (err, result) {
|
||||
if (err) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
resolve(result)
|
||||
})
|
||||
})
|
||||
|
||||
// Let's fork the promise chain to
|
||||
// make the error bubble up to the user but
|
||||
// not lead to a unhandledRejection
|
||||
p.catch(noop)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
function unshift (value) {
|
||||
var p = new Promise(function (resolve, reject) {
|
||||
unshiftCb(value, function (err, result) {
|
||||
if (err) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
resolve(result)
|
||||
})
|
||||
})
|
||||
|
||||
// Let's fork the promise chain to
|
||||
// make the error bubble up to the user but
|
||||
// not lead to a unhandledRejection
|
||||
p.catch(noop)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
function drained () {
|
||||
if (queue.idle()) {
|
||||
return new Promise(function (resolve) {
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
var previousDrain = queue.drain
|
||||
|
||||
var p = new Promise(function (resolve) {
|
||||
queue.drain = function () {
|
||||
previousDrain()
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
|
||||
return p
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = fastqueue
|
||||
module.exports.promise = queueAsPromised
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"partition.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/partition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,gHAAgH;AAChH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,EACzC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC,EAC3D,OAAO,EAAE,CAAC,GACT,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EACtC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAC1B,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC,GACjD,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9C,gHAAgH;AAChH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAC1B,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EACxD,OAAO,EAAE,CAAC,GACT,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
||||
Reference in New Issue
Block a user