new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bindNodeCallback.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/bindNodeCallback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EACtC,cAAc,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACvC,SAAS,CAAC,EAAE,aAAa,GACxB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC;AAGvC,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,EACzF,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,EACtE,aAAa,CAAC,EAAE,aAAa,GAC5B,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,SAAS,EAAE,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./forEachRight');
|
||||
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core/worker.js</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/libs/core</a> worker.js
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/45</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/13</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/45</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>
|
||||
<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></td><td class="line-coverage quiet"><span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span></td><td class="text"><pre class="prettyprint lang-js">Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/worker.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/worker.js')
|
||||
Error: Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/worker.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/worker.js')
|
||||
at Context.defaultSourceLookup [as sourceFinder] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:15:15)
|
||||
at Context.getSource (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:74:17)
|
||||
at Object.annotateSourceCode (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:172:38)
|
||||
at HtmlReport.onDetail (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:237:39)
|
||||
at Visitor.(anonymous function) [as onDetail] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
|
||||
at /Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
|
||||
at Array.forEach (native)
|
||||
at visitChildren (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:126:5)</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../../sorter.js"></script>
|
||||
<script src="../../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { ObservableInput, SchedulerLike } from '../types';
|
||||
/**
|
||||
* A process embodying the general "merge" strategy. This is used in
|
||||
* `mergeMap` and `mergeScan` because the logic is otherwise nearly identical.
|
||||
* @param source The original source observable
|
||||
* @param subscriber The consumer subscriber
|
||||
* @param project The projection function to get our inner sources
|
||||
* @param concurrent The number of concurrent inner subscriptions
|
||||
* @param onBeforeNext Additional logic to apply before nexting to our consumer
|
||||
* @param expand If `true` this will perform an "expand" strategy, which differs only
|
||||
* in that it recurses, and the inner subscription must be schedule-able.
|
||||
* @param innerSubScheduler A scheduler to use to schedule inner subscriptions,
|
||||
* this is to support the expand strategy, mostly, and should be deprecated
|
||||
*/
|
||||
export declare function mergeInternals<T, R>(source: Observable<T>, subscriber: Subscriber<R>, project: (value: T, index: number) => ObservableInput<R>, concurrent: number, onBeforeNext?: (innerValue: R) => void, expand?: boolean, innerSubScheduler?: SchedulerLike, additionalFinalizer?: () => void): () => void;
|
||||
//# sourceMappingURL=mergeInternals.d.ts.map
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('isNull', require('../isNull'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('lastIndexOfFrom', require('../lastIndexOf'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,90 @@
|
||||
import { CSVParseParam, CellParser } from "./Parameters";
|
||||
import { Converter, PreRawDataCallback, PreFileLineCallback } from "./Converter";
|
||||
import { ChildProcess } from "child_process";
|
||||
import CSVError from "./CSVError";
|
||||
|
||||
export interface ParseRuntime {
|
||||
/**
|
||||
* If need convert ignoreColumn from column name(string) to column index (number). Parser needs column index.
|
||||
*/
|
||||
needProcessIgnoreColumn: boolean;
|
||||
/**
|
||||
* If need convert includeColumn from column name(string) to column index (number). Parser needs column index.
|
||||
*/
|
||||
needProcessIncludeColumn: boolean;
|
||||
/**
|
||||
* the indexes of columns to reserve, undefined means reserve all, [] means hide all
|
||||
*/
|
||||
selectedColumns?: number[];
|
||||
ended: boolean;
|
||||
hasError: boolean;
|
||||
error?: Error;
|
||||
/**
|
||||
* Inferred delimiter
|
||||
*/
|
||||
delimiter: string | string[];
|
||||
/**
|
||||
* Inferred eol
|
||||
*/
|
||||
eol?: string;
|
||||
/**
|
||||
* Converter function for a column. Populated at runtime.
|
||||
*/
|
||||
columnConv: (CellParser | null)[],
|
||||
headerType: any[],
|
||||
headerTitle: string[],
|
||||
headerFlag: any[],
|
||||
/**
|
||||
* Inferred headers
|
||||
*/
|
||||
headers?: any[],
|
||||
csvLineBuffer?: Buffer,
|
||||
|
||||
/**
|
||||
* after first chunk of data being processed and emitted, started will become true.
|
||||
*/
|
||||
started: boolean,
|
||||
preRawDataHook?: PreRawDataCallback,
|
||||
preFileLineHook?: PreFileLineCallback,
|
||||
parsedLineNumber: number,
|
||||
|
||||
columnValueSetter: Function[];
|
||||
subscribe?: {
|
||||
onNext?: (data: any, lineNumber:number) => void | PromiseLike<void>;
|
||||
onError?: (err: CSVError) => void;
|
||||
onCompleted?: () => void;
|
||||
};
|
||||
then?: {
|
||||
onfulfilled: (value: any[]) => any;
|
||||
onrejected: (err: Error) => any;
|
||||
}
|
||||
|
||||
}
|
||||
export function initParseRuntime(converter: Converter): ParseRuntime {
|
||||
const params = converter.parseParam;
|
||||
const rtn: ParseRuntime = {
|
||||
needProcessIgnoreColumn: false,
|
||||
needProcessIncludeColumn: false,
|
||||
selectedColumns: undefined,
|
||||
ended: false,
|
||||
hasError: false,
|
||||
error: undefined,
|
||||
delimiter: converter.parseParam.delimiter,
|
||||
eol: converter.parseParam.eol,
|
||||
columnConv: [],
|
||||
headerType: [],
|
||||
headerTitle: [],
|
||||
headerFlag: [],
|
||||
headers: undefined,
|
||||
started: false,
|
||||
parsedLineNumber: 0,
|
||||
columnValueSetter: [],
|
||||
}
|
||||
if (params.ignoreColumns) {
|
||||
rtn.needProcessIgnoreColumn = true;
|
||||
}
|
||||
if (params.includeColumns) {
|
||||
rtn.needProcessIncludeColumn = true;
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('toFinite', require('../toFinite'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,209 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
// a transform stream is a readable/writable stream where you do
|
||||
// something with the data. Sometimes it's called a "filter",
|
||||
// but that's not a great name for it, since that implies a thing where
|
||||
// some bits pass through, and others are simply ignored. (That would
|
||||
// be a valid example of a transform, of course.)
|
||||
//
|
||||
// While the output is causally related to the input, it's not a
|
||||
// necessarily symmetric or synchronous transformation. For example,
|
||||
// a zlib stream might take multiple plain-text writes(), and then
|
||||
// emit a single compressed chunk some time in the future.
|
||||
//
|
||||
// Here's how this works:
|
||||
//
|
||||
// The Transform stream has all the aspects of the readable and writable
|
||||
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
||||
// internally, and returns false if there's a lot of pending writes
|
||||
// buffered up. When you call read(), that calls _read(n) until
|
||||
// there's enough pending readable data buffered up.
|
||||
//
|
||||
// In a transform stream, the written data is placed in a buffer. When
|
||||
// _read(n) is called, it transforms the queued up data, calling the
|
||||
// buffered _write cb's as it consumes chunks. If consuming a single
|
||||
// written chunk would result in multiple output chunks, then the first
|
||||
// outputted bit calls the readcb, and subsequent chunks just go into
|
||||
// the read buffer, and will cause it to emit 'readable' if necessary.
|
||||
//
|
||||
// This way, back-pressure is actually determined by the reading side,
|
||||
// since _read has to be called to start processing a new chunk. However,
|
||||
// a pathological inflate type of transform can cause excessive buffering
|
||||
// here. For example, imagine a stream where every byte of input is
|
||||
// interpreted as an integer from 0-255, and then results in that many
|
||||
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
||||
// 1kb of data being output. In this case, you could write a very small
|
||||
// amount of input, and end up with a very large amount of output. In
|
||||
// such a pathological inflating mechanism, there'd be no way to tell
|
||||
// the system to stop doing the transform. A single 4MB write could
|
||||
// cause the system to run out of memory.
|
||||
//
|
||||
// However, even in such a pathological case, only a single written chunk
|
||||
// would be consumed, and then the rest would wait (un-transformed) until
|
||||
// the results of the previous transformed chunk were consumed.
|
||||
|
||||
module.exports = Transform;
|
||||
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
util.inherits(Transform, Duplex);
|
||||
|
||||
|
||||
function TransformState(options, stream) {
|
||||
this.afterTransform = function(er, data) {
|
||||
return afterTransform(stream, er, data);
|
||||
};
|
||||
|
||||
this.needTransform = false;
|
||||
this.transforming = false;
|
||||
this.writecb = null;
|
||||
this.writechunk = null;
|
||||
}
|
||||
|
||||
function afterTransform(stream, er, data) {
|
||||
var ts = stream._transformState;
|
||||
ts.transforming = false;
|
||||
|
||||
var cb = ts.writecb;
|
||||
|
||||
if (!cb)
|
||||
return stream.emit('error', new Error('no writecb in Transform class'));
|
||||
|
||||
ts.writechunk = null;
|
||||
ts.writecb = null;
|
||||
|
||||
if (!util.isNullOrUndefined(data))
|
||||
stream.push(data);
|
||||
|
||||
if (cb)
|
||||
cb(er);
|
||||
|
||||
var rs = stream._readableState;
|
||||
rs.reading = false;
|
||||
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
||||
stream._read(rs.highWaterMark);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Transform(options) {
|
||||
if (!(this instanceof Transform))
|
||||
return new Transform(options);
|
||||
|
||||
Duplex.call(this, options);
|
||||
|
||||
this._transformState = new TransformState(options, this);
|
||||
|
||||
// when the writable side finishes, then flush out anything remaining.
|
||||
var stream = this;
|
||||
|
||||
// start out asking for a readable event once data is transformed.
|
||||
this._readableState.needReadable = true;
|
||||
|
||||
// we have implemented the _read method, and done the other things
|
||||
// that Readable wants before the first _read call, so unset the
|
||||
// sync guard flag.
|
||||
this._readableState.sync = false;
|
||||
|
||||
this.once('prefinish', function() {
|
||||
if (util.isFunction(this._flush))
|
||||
this._flush(function(er) {
|
||||
done(stream, er);
|
||||
});
|
||||
else
|
||||
done(stream);
|
||||
});
|
||||
}
|
||||
|
||||
Transform.prototype.push = function(chunk, encoding) {
|
||||
this._transformState.needTransform = false;
|
||||
return Duplex.prototype.push.call(this, chunk, encoding);
|
||||
};
|
||||
|
||||
// This is the part where you do stuff!
|
||||
// override this function in implementation classes.
|
||||
// 'chunk' is an input chunk.
|
||||
//
|
||||
// Call `push(newChunk)` to pass along transformed output
|
||||
// to the readable side. You may call 'push' zero or more times.
|
||||
//
|
||||
// Call `cb(err)` when you are done with this chunk. If you pass
|
||||
// an error, then that'll put the hurt on the whole operation. If you
|
||||
// never call cb(), then you'll never get another chunk.
|
||||
Transform.prototype._transform = function(chunk, encoding, cb) {
|
||||
throw new Error('not implemented');
|
||||
};
|
||||
|
||||
Transform.prototype._write = function(chunk, encoding, cb) {
|
||||
var ts = this._transformState;
|
||||
ts.writecb = cb;
|
||||
ts.writechunk = chunk;
|
||||
ts.writeencoding = encoding;
|
||||
if (!ts.transforming) {
|
||||
var rs = this._readableState;
|
||||
if (ts.needTransform ||
|
||||
rs.needReadable ||
|
||||
rs.length < rs.highWaterMark)
|
||||
this._read(rs.highWaterMark);
|
||||
}
|
||||
};
|
||||
|
||||
// Doesn't matter what the args are here.
|
||||
// _transform does all the work.
|
||||
// That we got here means that the readable side wants more data.
|
||||
Transform.prototype._read = function(n) {
|
||||
var ts = this._transformState;
|
||||
|
||||
if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
|
||||
ts.transforming = true;
|
||||
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
||||
} else {
|
||||
// mark that we need a transform, so that any data that comes in
|
||||
// will get processed, now that we've asked for it.
|
||||
ts.needTransform = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function done(stream, er) {
|
||||
if (er)
|
||||
return stream.emit('error', er);
|
||||
|
||||
// if there's nothing in the write buffer, then that means
|
||||
// that nothing more will ever be provided
|
||||
var ws = stream._writableState;
|
||||
var ts = stream._transformState;
|
||||
|
||||
if (ws.length)
|
||||
throw new Error('calling transform done when ws.length != 0');
|
||||
|
||||
if (ts.transforming)
|
||||
throw new Error('calling transform done when still transforming');
|
||||
|
||||
return stream.push(null);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
var baseGetTag = require('./_baseGetTag'),
|
||||
isObjectLike = require('./isObjectLike');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var symbolTag = '[object Symbol]';
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSymbol(Symbol.iterator);
|
||||
* // => true
|
||||
*
|
||||
* _.isSymbol('abc');
|
||||
* // => false
|
||||
*/
|
||||
function isSymbol(value) {
|
||||
return typeof value == 'symbol' ||
|
||||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
||||
}
|
||||
|
||||
module.exports = isSymbol;
|
||||
@@ -0,0 +1,15 @@
|
||||
var inspect = require('../../');
|
||||
var test = require('tape');
|
||||
|
||||
test('dom element', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var d = document.createElement('div');
|
||||
d.setAttribute('id', 'beep');
|
||||
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
||||
|
||||
t.equal(
|
||||
inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }]),
|
||||
'[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]'
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"JB KB LB MB NB OB PB QB RB","2":"DC tB I v J D E F SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC","132":"0 1 2 3 4 5 6 7 8 9 M N O w g x y z AB BB CB DB EB FB GB HB IB","164":"A B C K L G"},D:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB","66":"DB"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"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 ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 F B C G M N O w g x y z PC QC RC SC qB AC TC rB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD","2":"BD"}},B:4,C:"Battery Status API"};
|
||||
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/es-array-method-boxes-properly
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow
|
||||
|
||||
module.exports = function CreateNonEnumerableDataPropertyOrThrow(O, P, V) {
|
||||
if (Type(O) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
||||
}
|
||||
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
||||
}
|
||||
|
||||
var newDesc = {
|
||||
'[[Configurable]]': true,
|
||||
'[[Enumerable]]': false,
|
||||
'[[Value]]': V,
|
||||
'[[Writable]]': true
|
||||
};
|
||||
return DefinePropertyOrThrow(O, P, newDesc);
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.last = void 0;
|
||||
var EmptyError_1 = require("../util/EmptyError");
|
||||
var filter_1 = require("./filter");
|
||||
var takeLast_1 = require("./takeLast");
|
||||
var throwIfEmpty_1 = require("./throwIfEmpty");
|
||||
var defaultIfEmpty_1 = require("./defaultIfEmpty");
|
||||
var identity_1 = require("../util/identity");
|
||||
function last(predicate, defaultValue) {
|
||||
var hasDefaultValue = arguments.length >= 2;
|
||||
return function (source) {
|
||||
return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, takeLast_1.takeLast(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); }));
|
||||
};
|
||||
}
|
||||
exports.last = last;
|
||||
//# sourceMappingURL=last.js.map
|
||||
@@ -0,0 +1,670 @@
|
||||
/*
|
||||
@license
|
||||
Rollup.js v2.79.1
|
||||
Thu, 22 Sep 2022 04:55:29 GMT - commit 69ff4181e701a0fe0026d0ba147f31bc86beffa8
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
Released under the MIT License.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const require$$0 = require('path');
|
||||
const process$1 = require('process');
|
||||
const url = require('url');
|
||||
const tty = require('tty');
|
||||
const rollup = require('./rollup.js');
|
||||
const mergeOptions = require('./mergeOptions.js');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
||||
if (e) {
|
||||
for (const k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n.default = e;
|
||||
return n;
|
||||
}
|
||||
|
||||
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
||||
|
||||
const {
|
||||
env = {},
|
||||
argv = [],
|
||||
platform = "",
|
||||
} = typeof process === "undefined" ? {} : process;
|
||||
|
||||
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
||||
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
||||
const isWindows = platform === "win32";
|
||||
const isDumbTerminal = env.TERM === "dumb";
|
||||
|
||||
const isCompatibleTerminal =
|
||||
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
|
||||
|
||||
const isCI =
|
||||
"CI" in env &&
|
||||
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
||||
|
||||
const isColorSupported =
|
||||
!isDisabled &&
|
||||
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
|
||||
|
||||
const replaceClose = (
|
||||
index,
|
||||
string,
|
||||
close,
|
||||
replace,
|
||||
head = string.substring(0, index) + replace,
|
||||
tail = string.substring(index + close.length),
|
||||
next = tail.indexOf(close)
|
||||
) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
||||
|
||||
const clearBleed = (index, string, open, close, replace) =>
|
||||
index < 0
|
||||
? open + string + close
|
||||
: open + replaceClose(index, string, close, replace) + close;
|
||||
|
||||
const filterEmpty =
|
||||
(open, close, replace = open, at = open.length + 1) =>
|
||||
(string) =>
|
||||
string || !(string === "" || string === undefined)
|
||||
? clearBleed(
|
||||
("" + string).indexOf(close, at),
|
||||
string,
|
||||
open,
|
||||
close,
|
||||
replace
|
||||
)
|
||||
: "";
|
||||
|
||||
const init = (open, close, replace) =>
|
||||
filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
||||
|
||||
const colors = {
|
||||
reset: init(0, 0),
|
||||
bold: init(1, 22, "\x1b[22m\x1b[1m"),
|
||||
dim: init(2, 22, "\x1b[22m\x1b[2m"),
|
||||
italic: init(3, 23),
|
||||
underline: init(4, 24),
|
||||
inverse: init(7, 27),
|
||||
hidden: init(8, 28),
|
||||
strikethrough: init(9, 29),
|
||||
black: init(30, 39),
|
||||
red: init(31, 39),
|
||||
green: init(32, 39),
|
||||
yellow: init(33, 39),
|
||||
blue: init(34, 39),
|
||||
magenta: init(35, 39),
|
||||
cyan: init(36, 39),
|
||||
white: init(37, 39),
|
||||
gray: init(90, 39),
|
||||
bgBlack: init(40, 49),
|
||||
bgRed: init(41, 49),
|
||||
bgGreen: init(42, 49),
|
||||
bgYellow: init(43, 49),
|
||||
bgBlue: init(44, 49),
|
||||
bgMagenta: init(45, 49),
|
||||
bgCyan: init(46, 49),
|
||||
bgWhite: init(47, 49),
|
||||
blackBright: init(90, 39),
|
||||
redBright: init(91, 39),
|
||||
greenBright: init(92, 39),
|
||||
yellowBright: init(93, 39),
|
||||
blueBright: init(94, 39),
|
||||
magentaBright: init(95, 39),
|
||||
cyanBright: init(96, 39),
|
||||
whiteBright: init(97, 39),
|
||||
bgBlackBright: init(100, 49),
|
||||
bgRedBright: init(101, 49),
|
||||
bgGreenBright: init(102, 49),
|
||||
bgYellowBright: init(103, 49),
|
||||
bgBlueBright: init(104, 49),
|
||||
bgMagentaBright: init(105, 49),
|
||||
bgCyanBright: init(106, 49),
|
||||
bgWhiteBright: init(107, 49),
|
||||
};
|
||||
|
||||
const createColors = ({ useColor = isColorSupported } = {}) =>
|
||||
useColor
|
||||
? colors
|
||||
: Object.keys(colors).reduce(
|
||||
(colors, key) => ({ ...colors, [key]: String }),
|
||||
{}
|
||||
);
|
||||
|
||||
createColors();
|
||||
|
||||
// @see https://no-color.org
|
||||
// @see https://www.npmjs.com/package/chalk
|
||||
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
|
||||
useColor: process$1.env.FORCE_COLOR !== '0' && !process$1.env.NO_COLOR
|
||||
});
|
||||
|
||||
// log to stderr to keep `rollup main.js > bundle.js` from breaking
|
||||
const stderr = (...args) => process$1.stderr.write(`${args.join('')}\n`);
|
||||
function handleError(err, recover = false) {
|
||||
let description = err.message || err;
|
||||
if (err.name)
|
||||
description = `${err.name}: ${description}`;
|
||||
const message = (err.plugin ? `(plugin ${err.plugin}) ${description}` : description) || err;
|
||||
stderr(bold(red(`[!] ${bold(message.toString())}`)));
|
||||
if (err.url) {
|
||||
stderr(cyan(err.url));
|
||||
}
|
||||
if (err.loc) {
|
||||
stderr(`${rollup.relativeId((err.loc.file || err.id))} (${err.loc.line}:${err.loc.column})`);
|
||||
}
|
||||
else if (err.id) {
|
||||
stderr(rollup.relativeId(err.id));
|
||||
}
|
||||
if (err.frame) {
|
||||
stderr(dim(err.frame));
|
||||
}
|
||||
if (err.stack) {
|
||||
stderr(dim(err.stack));
|
||||
}
|
||||
stderr('');
|
||||
if (!recover)
|
||||
process$1.exit(1);
|
||||
}
|
||||
|
||||
function batchWarnings() {
|
||||
let count = 0;
|
||||
const deferredWarnings = new Map();
|
||||
let warningOccurred = false;
|
||||
return {
|
||||
add(warning) {
|
||||
count += 1;
|
||||
warningOccurred = true;
|
||||
if (warning.code in deferredHandlers) {
|
||||
rollup.getOrCreate(deferredWarnings, warning.code, () => []).push(warning);
|
||||
}
|
||||
else if (warning.code in immediateHandlers) {
|
||||
immediateHandlers[warning.code](warning);
|
||||
}
|
||||
else {
|
||||
title(warning.message);
|
||||
if (warning.url)
|
||||
info(warning.url);
|
||||
const id = (warning.loc && warning.loc.file) || warning.id;
|
||||
if (id) {
|
||||
const loc = warning.loc
|
||||
? `${rollup.relativeId(id)} (${warning.loc.line}:${warning.loc.column})`
|
||||
: rollup.relativeId(id);
|
||||
stderr(bold(rollup.relativeId(loc)));
|
||||
}
|
||||
if (warning.frame)
|
||||
info(warning.frame);
|
||||
}
|
||||
},
|
||||
get count() {
|
||||
return count;
|
||||
},
|
||||
flush() {
|
||||
if (count === 0)
|
||||
return;
|
||||
const codes = Array.from(deferredWarnings.keys()).sort((a, b) => deferredWarnings.get(b).length - deferredWarnings.get(a).length);
|
||||
for (const code of codes) {
|
||||
deferredHandlers[code](deferredWarnings.get(code));
|
||||
}
|
||||
deferredWarnings.clear();
|
||||
count = 0;
|
||||
},
|
||||
get warningOccurred() {
|
||||
return warningOccurred;
|
||||
}
|
||||
};
|
||||
}
|
||||
const immediateHandlers = {
|
||||
MISSING_NODE_BUILTINS(warning) {
|
||||
title(`Missing shims for Node.js built-ins`);
|
||||
stderr(`Creating a browser bundle that depends on ${rollup.printQuotedStringList(warning.modules)}. You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`);
|
||||
},
|
||||
UNKNOWN_OPTION(warning) {
|
||||
title(`You have passed an unrecognized option`);
|
||||
stderr(warning.message);
|
||||
}
|
||||
};
|
||||
const deferredHandlers = {
|
||||
CIRCULAR_DEPENDENCY(warnings) {
|
||||
title(`Circular dependenc${warnings.length > 1 ? 'ies' : 'y'}`);
|
||||
const displayed = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
|
||||
for (const warning of displayed) {
|
||||
stderr(warning.cycle.join(' -> '));
|
||||
}
|
||||
if (warnings.length > displayed.length) {
|
||||
stderr(`...and ${warnings.length - displayed.length} more`);
|
||||
}
|
||||
},
|
||||
EMPTY_BUNDLE(warnings) {
|
||||
title(`Generated${warnings.length === 1 ? ' an' : ''} empty ${warnings.length > 1 ? 'chunks' : 'chunk'}`);
|
||||
stderr(warnings.map(warning => warning.chunkName).join(', '));
|
||||
},
|
||||
EVAL(warnings) {
|
||||
title('Use of eval is strongly discouraged');
|
||||
info('https://rollupjs.org/guide/en/#avoiding-eval');
|
||||
showTruncatedWarnings(warnings);
|
||||
},
|
||||
MISSING_EXPORT(warnings) {
|
||||
title('Missing exports');
|
||||
info('https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module');
|
||||
for (const warning of warnings) {
|
||||
stderr(bold(warning.importer));
|
||||
stderr(`${warning.missing} is not exported by ${warning.exporter}`);
|
||||
stderr(gray(warning.frame));
|
||||
}
|
||||
},
|
||||
MISSING_GLOBAL_NAME(warnings) {
|
||||
title(`Missing global variable ${warnings.length > 1 ? 'names' : 'name'}`);
|
||||
stderr(`Use output.globals to specify browser global variable names corresponding to external modules`);
|
||||
for (const warning of warnings) {
|
||||
stderr(`${bold(warning.source)} (guessing '${warning.guess}')`);
|
||||
}
|
||||
},
|
||||
MIXED_EXPORTS(warnings) {
|
||||
title('Mixing named and default exports');
|
||||
info(`https://rollupjs.org/guide/en/#outputexports`);
|
||||
stderr(bold('The following entry modules are using named and default exports together:'));
|
||||
warnings.sort((a, b) => (a.id < b.id ? -1 : 1));
|
||||
const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
|
||||
for (const warning of displayedWarnings) {
|
||||
stderr(rollup.relativeId(warning.id));
|
||||
}
|
||||
if (displayedWarnings.length < warnings.length) {
|
||||
stderr(`...and ${warnings.length - displayedWarnings.length} other entry modules`);
|
||||
}
|
||||
stderr(`\nConsumers of your bundle will have to use chunk['default'] to access their default export, which may not be what you want. Use \`output.exports: 'named'\` to disable this warning`);
|
||||
},
|
||||
NAMESPACE_CONFLICT(warnings) {
|
||||
title(`Conflicting re-exports`);
|
||||
for (const warning of warnings) {
|
||||
stderr(`"${bold(rollup.relativeId(warning.reexporter))}" re-exports "${warning.name}" from both "${rollup.relativeId(warning.sources[0])}" and "${rollup.relativeId(warning.sources[1])}" (will be ignored)`);
|
||||
}
|
||||
},
|
||||
NON_EXISTENT_EXPORT(warnings) {
|
||||
title(`Import of non-existent ${warnings.length > 1 ? 'exports' : 'export'}`);
|
||||
showTruncatedWarnings(warnings);
|
||||
},
|
||||
PLUGIN_WARNING(warnings) {
|
||||
var _a;
|
||||
const nestedByPlugin = nest(warnings, 'plugin');
|
||||
for (const { key: plugin, items } of nestedByPlugin) {
|
||||
const nestedByMessage = nest(items, 'message');
|
||||
let lastUrl = '';
|
||||
for (const { key: message, items } of nestedByMessage) {
|
||||
title(`Plugin ${plugin}: ${message}`);
|
||||
for (const warning of items) {
|
||||
if (warning.url && warning.url !== lastUrl)
|
||||
info((lastUrl = warning.url));
|
||||
const id = warning.id || ((_a = warning.loc) === null || _a === void 0 ? void 0 : _a.file);
|
||||
if (id) {
|
||||
let loc = rollup.relativeId(id);
|
||||
if (warning.loc) {
|
||||
loc += `: (${warning.loc.line}:${warning.loc.column})`;
|
||||
}
|
||||
stderr(bold(loc));
|
||||
}
|
||||
if (warning.frame)
|
||||
info(warning.frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
SOURCEMAP_BROKEN(warnings) {
|
||||
title(`Broken sourcemap`);
|
||||
info('https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect');
|
||||
const plugins = [...new Set(warnings.map(({ plugin }) => plugin).filter(Boolean))];
|
||||
stderr(`Plugins that transform code (such as ${rollup.printQuotedStringList(plugins)}) should generate accompanying sourcemaps`);
|
||||
},
|
||||
THIS_IS_UNDEFINED(warnings) {
|
||||
title('`this` has been rewritten to `undefined`');
|
||||
info('https://rollupjs.org/guide/en/#error-this-is-undefined');
|
||||
showTruncatedWarnings(warnings);
|
||||
},
|
||||
UNRESOLVED_IMPORT(warnings) {
|
||||
title('Unresolved dependencies');
|
||||
info('https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency');
|
||||
const dependencies = new Map();
|
||||
for (const warning of warnings) {
|
||||
rollup.getOrCreate(dependencies, warning.source, () => []).push(warning.importer);
|
||||
}
|
||||
for (const [dependency, importers] of dependencies) {
|
||||
stderr(`${bold(dependency)} (imported by ${importers.join(', ')})`);
|
||||
}
|
||||
},
|
||||
UNUSED_EXTERNAL_IMPORT(warnings) {
|
||||
title('Unused external imports');
|
||||
for (const warning of warnings) {
|
||||
stderr(warning.names +
|
||||
' imported from external module "' +
|
||||
warning.source +
|
||||
'" but never used in ' +
|
||||
rollup.printQuotedStringList(warning.sources.map(id => rollup.relativeId(id))));
|
||||
}
|
||||
}
|
||||
};
|
||||
function title(str) {
|
||||
stderr(bold(yellow(`(!) ${str}`)));
|
||||
}
|
||||
function info(url) {
|
||||
stderr(gray(url));
|
||||
}
|
||||
function nest(array, prop) {
|
||||
const nested = [];
|
||||
const lookup = new Map();
|
||||
for (const item of array) {
|
||||
const key = item[prop];
|
||||
rollup.getOrCreate(lookup, key, () => {
|
||||
const items = {
|
||||
items: [],
|
||||
key
|
||||
};
|
||||
nested.push(items);
|
||||
return items;
|
||||
}).items.push(item);
|
||||
}
|
||||
return nested;
|
||||
}
|
||||
function showTruncatedWarnings(warnings) {
|
||||
const nestedByModule = nest(warnings, 'id');
|
||||
const displayedByModule = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
|
||||
for (const { key: id, items } of displayedByModule) {
|
||||
stderr(bold(rollup.relativeId(id)));
|
||||
stderr(gray(items[0].frame));
|
||||
if (items.length > 1) {
|
||||
stderr(`...and ${items.length - 1} other ${items.length > 2 ? 'occurrences' : 'occurrence'}`);
|
||||
}
|
||||
}
|
||||
if (nestedByModule.length > displayedByModule.length) {
|
||||
stderr(`\n...and ${nestedByModule.length - displayedByModule.length} other files`);
|
||||
}
|
||||
}
|
||||
|
||||
const stdinName = '-';
|
||||
let stdinResult = null;
|
||||
function stdinPlugin(arg) {
|
||||
const suffix = typeof arg == 'string' && arg.length ? '.' + arg : '';
|
||||
return {
|
||||
load(id) {
|
||||
if (id === stdinName || id.startsWith(stdinName + '.')) {
|
||||
return stdinResult || (stdinResult = readStdin());
|
||||
}
|
||||
},
|
||||
name: 'stdin',
|
||||
resolveId(id) {
|
||||
if (id === stdinName) {
|
||||
return id + suffix;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function readStdin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
process$1.stdin.setEncoding('utf8');
|
||||
process$1.stdin
|
||||
.on('data', chunk => chunks.push(chunk))
|
||||
.on('end', () => {
|
||||
const result = chunks.join('');
|
||||
resolve(result);
|
||||
})
|
||||
.on('error', err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function waitForInputPlugin() {
|
||||
return {
|
||||
async buildStart(options) {
|
||||
const inputSpecifiers = Array.isArray(options.input)
|
||||
? options.input
|
||||
: Object.keys(options.input);
|
||||
let lastAwaitedSpecifier = null;
|
||||
checkSpecifiers: while (true) {
|
||||
for (const specifier of inputSpecifiers) {
|
||||
if ((await this.resolve(specifier)) === null) {
|
||||
if (lastAwaitedSpecifier !== specifier) {
|
||||
stderr(`waiting for input ${bold(specifier)}...`);
|
||||
lastAwaitedSpecifier = specifier;
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
continue checkSpecifiers;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
name: 'wait-for-input'
|
||||
};
|
||||
}
|
||||
|
||||
async function addCommandPluginsToInputOptions(inputOptions, command) {
|
||||
if (command.stdin !== false) {
|
||||
inputOptions.plugins.push(stdinPlugin(command.stdin));
|
||||
}
|
||||
if (command.waitForBundleInput === true) {
|
||||
inputOptions.plugins.push(waitForInputPlugin());
|
||||
}
|
||||
await addPluginsFromCommandOption(command.plugin, inputOptions);
|
||||
}
|
||||
async function addPluginsFromCommandOption(commandPlugin, inputOptions) {
|
||||
if (commandPlugin) {
|
||||
const plugins = Array.isArray(commandPlugin) ? commandPlugin : [commandPlugin];
|
||||
for (const plugin of plugins) {
|
||||
if (/[={}]/.test(plugin)) {
|
||||
// -p plugin=value
|
||||
// -p "{transform(c,i){...}}"
|
||||
await loadAndRegisterPlugin(inputOptions, plugin);
|
||||
}
|
||||
else {
|
||||
// split out plugins joined by commas
|
||||
// -p node-resolve,commonjs,buble
|
||||
for (const p of plugin.split(',')) {
|
||||
await loadAndRegisterPlugin(inputOptions, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
||||
let plugin = null;
|
||||
let pluginArg = undefined;
|
||||
if (pluginText[0] === '{') {
|
||||
// -p "{transform(c,i){...}}"
|
||||
plugin = new Function('return ' + pluginText);
|
||||
}
|
||||
else {
|
||||
const match = pluginText.match(/^([@.:/\\\w|^{}-]+)(=(.*))?$/);
|
||||
if (match) {
|
||||
// -p plugin
|
||||
// -p plugin=arg
|
||||
pluginText = match[1];
|
||||
pluginArg = new Function('return ' + match[3])();
|
||||
}
|
||||
else {
|
||||
throw new Error(`Invalid --plugin argument format: ${JSON.stringify(pluginText)}`);
|
||||
}
|
||||
if (!/^\.|^rollup-plugin-|[@/\\]/.test(pluginText)) {
|
||||
// Try using plugin prefix variations first if applicable.
|
||||
// Prefix order is significant - left has higher precedence.
|
||||
for (const prefix of ['@rollup/plugin-', 'rollup-plugin-']) {
|
||||
try {
|
||||
plugin = await requireOrImport(prefix + pluginText);
|
||||
break;
|
||||
}
|
||||
catch (_a) {
|
||||
// if this does not work, we try requiring the actual name below
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!plugin) {
|
||||
try {
|
||||
if (pluginText[0] == '.')
|
||||
pluginText = require$$0.resolve(pluginText);
|
||||
// Windows absolute paths must be specified as file:// protocol URL
|
||||
// Note that we do not have coverage for Windows-only code paths
|
||||
else if (pluginText.match(/^[A-Za-z]:\\/)) {
|
||||
pluginText = url.pathToFileURL(require$$0.resolve(pluginText)).href;
|
||||
}
|
||||
plugin = await requireOrImport(pluginText);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Cannot load plugin "${pluginText}": ${err.message}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// some plugins do not use `module.exports` for their entry point,
|
||||
// in which case we try the named default export and the plugin name
|
||||
if (typeof plugin === 'object') {
|
||||
plugin = plugin.default || plugin[getCamelizedPluginBaseName(pluginText)];
|
||||
}
|
||||
if (!plugin) {
|
||||
throw new Error(`Cannot find entry for plugin "${pluginText}". The plugin needs to export a function either as "default" or "${getCamelizedPluginBaseName(pluginText)}" for Rollup to recognize it.`);
|
||||
}
|
||||
inputOptions.plugins.push(typeof plugin === 'function' ? plugin.call(plugin, pluginArg) : plugin);
|
||||
}
|
||||
function getCamelizedPluginBaseName(pluginText) {
|
||||
var _a;
|
||||
return (((_a = pluginText.match(/(@rollup\/plugin-|rollup-plugin-)(.+)$/)) === null || _a === void 0 ? void 0 : _a[2]) || pluginText)
|
||||
.split(/[\\/]/)
|
||||
.slice(-1)[0]
|
||||
.split('.')[0]
|
||||
.split('-')
|
||||
.map((part, index) => (index === 0 || !part ? part : part[0].toUpperCase() + part.slice(1)))
|
||||
.join('');
|
||||
}
|
||||
async function requireOrImport(pluginPath) {
|
||||
try {
|
||||
return require(pluginPath);
|
||||
}
|
||||
catch (_a) {
|
||||
return import(pluginPath);
|
||||
}
|
||||
}
|
||||
|
||||
function supportsNativeESM() {
|
||||
return Number(/^v(\d+)/.exec(process$1.version)[1]) >= 13;
|
||||
}
|
||||
async function loadAndParseConfigFile(fileName, commandOptions = {}) {
|
||||
const configs = await loadConfigFile(fileName, commandOptions);
|
||||
const warnings = batchWarnings();
|
||||
try {
|
||||
const normalizedConfigs = [];
|
||||
for (const config of configs) {
|
||||
const options = mergeOptions.mergeOptions(config, commandOptions, warnings.add);
|
||||
await addCommandPluginsToInputOptions(options, commandOptions);
|
||||
normalizedConfigs.push(options);
|
||||
}
|
||||
return { options: normalizedConfigs, warnings };
|
||||
}
|
||||
catch (err) {
|
||||
warnings.flush();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
async function loadConfigFile(fileName, commandOptions) {
|
||||
const extension = require$$0.extname(fileName);
|
||||
const configFileExport = commandOptions.configPlugin ||
|
||||
!(extension === '.cjs' || (extension === '.mjs' && supportsNativeESM()))
|
||||
? await getDefaultFromTranspiledConfigFile(fileName, commandOptions)
|
||||
: extension === '.cjs'
|
||||
? getDefaultFromCjs(require(fileName))
|
||||
: (await import(url.pathToFileURL(fileName).href)).default;
|
||||
return getConfigList(configFileExport, commandOptions);
|
||||
}
|
||||
function getDefaultFromCjs(namespace) {
|
||||
return namespace.__esModule ? namespace.default : namespace;
|
||||
}
|
||||
async function getDefaultFromTranspiledConfigFile(fileName, commandOptions) {
|
||||
const warnings = batchWarnings();
|
||||
const inputOptions = {
|
||||
external: (id) => (id[0] !== '.' && !require$$0.isAbsolute(id)) || id.slice(-5, id.length) === '.json',
|
||||
input: fileName,
|
||||
onwarn: warnings.add,
|
||||
plugins: [],
|
||||
treeshake: false
|
||||
};
|
||||
await addPluginsFromCommandOption(commandOptions.configPlugin, inputOptions);
|
||||
const bundle = await rollup.rollup(inputOptions);
|
||||
if (!commandOptions.silent && warnings.count > 0) {
|
||||
stderr(bold(`loaded ${rollup.relativeId(fileName)} with warnings`));
|
||||
warnings.flush();
|
||||
}
|
||||
const { output: [{ code }] } = await bundle.generate({
|
||||
exports: 'named',
|
||||
format: 'cjs',
|
||||
plugins: [
|
||||
{
|
||||
name: 'transpile-import-meta',
|
||||
resolveImportMeta(property, { moduleId }) {
|
||||
if (property === 'url') {
|
||||
return `'${url.pathToFileURL(moduleId).href}'`;
|
||||
}
|
||||
if (property == null) {
|
||||
return `{url:'${url.pathToFileURL(moduleId).href}'}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
return loadConfigFromBundledFile(fileName, code);
|
||||
}
|
||||
function loadConfigFromBundledFile(fileName, bundledCode) {
|
||||
const resolvedFileName = require.resolve(fileName);
|
||||
const extension = require$$0.extname(resolvedFileName);
|
||||
const defaultLoader = require.extensions[extension];
|
||||
require.extensions[extension] = (module, requiredFileName) => {
|
||||
if (requiredFileName === resolvedFileName) {
|
||||
module._compile(bundledCode, requiredFileName);
|
||||
}
|
||||
else {
|
||||
if (defaultLoader) {
|
||||
defaultLoader(module, requiredFileName);
|
||||
}
|
||||
}
|
||||
};
|
||||
delete require.cache[resolvedFileName];
|
||||
try {
|
||||
const config = getDefaultFromCjs(require(fileName));
|
||||
require.extensions[extension] = defaultLoader;
|
||||
return config;
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code === 'ERR_REQUIRE_ESM') {
|
||||
return rollup.error({
|
||||
code: 'TRANSPILED_ESM_CONFIG',
|
||||
message: `While loading the Rollup configuration from "${rollup.relativeId(fileName)}", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.`,
|
||||
url: 'https://rollupjs.org/guide/en/#using-untranspiled-config-files'
|
||||
});
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
async function getConfigList(configFileExport, commandOptions) {
|
||||
const config = await (typeof configFileExport === 'function'
|
||||
? configFileExport(commandOptions)
|
||||
: configFileExport);
|
||||
if (Object.keys(config).length === 0) {
|
||||
return rollup.error({
|
||||
code: 'MISSING_CONFIG',
|
||||
message: 'Config file must export an options object, or an array of options objects',
|
||||
url: 'https://rollupjs.org/guide/en/#configuration-files'
|
||||
});
|
||||
}
|
||||
return Array.isArray(config) ? config : [config];
|
||||
}
|
||||
|
||||
exports.addCommandPluginsToInputOptions = addCommandPluginsToInputOptions;
|
||||
exports.batchWarnings = batchWarnings;
|
||||
exports.bold = bold;
|
||||
exports.cyan = cyan;
|
||||
exports.green = green;
|
||||
exports.handleError = handleError;
|
||||
exports.loadAndParseConfigFile = loadAndParseConfigFile;
|
||||
exports.stderr = stderr;
|
||||
exports.stdinName = stdinName;
|
||||
exports.underline = underline;
|
||||
//# sourceMappingURL=loadConfigFile.js.map
|
||||
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var $isNaN = require('../helpers/isNaN');
|
||||
|
||||
// http://262.ecma-international.org/5.1/#sec-9.12
|
||||
|
||||
module.exports = function SameValue(x, y) {
|
||||
if (x === y) { // 0 === -0, but they are not identical.
|
||||
if (x === 0) { return 1 / x === 1 / y; }
|
||||
return true;
|
||||
}
|
||||
return $isNaN(x) && $isNaN(y);
|
||||
};
|
||||
@@ -0,0 +1,636 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/Converter.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> Converter.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">94% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>94/100</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">84.62% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>22/26</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96.43% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>27/28</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">93.62% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>88/94</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></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</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">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-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-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-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">37x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-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-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</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-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">165734x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">436312x</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">217x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-neutral"> </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-yes">73x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">124x</span>
|
||||
<span class="cline-any cline-yes">124x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">122x</span>
|
||||
<span class="cline-any cline-yes">70x</span>
|
||||
<span class="cline-any cline-yes">70x</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">122x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65x</span>
|
||||
<span class="cline-any cline-yes">65x</span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">24x</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">28x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">24x</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-no"> </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-yes">37x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">61x</span>
|
||||
<span class="cline-any cline-yes">61x</span>
|
||||
<span class="cline-any cline-yes">61x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { Transform, TransformOptions, Readable } from "stream";
|
||||
import { CSVParseParam, mergeParams } from "./Parameters";
|
||||
import { ParseRuntime, initParseRuntime } from "./ParseRuntime";
|
||||
import P from "bluebird";
|
||||
import { Worker } from "./Worker";
|
||||
import { stringToLines } from "./fileline";
|
||||
import { map } from "lodash/map";
|
||||
import { RowSplit, RowSplitResult } from "./rowSplit";
|
||||
import getEol from "./getEol";
|
||||
import lineToJson, { JSONResult } from "./lineToJson";
|
||||
import { Processor, ProcessLineResult } from "./Processor";
|
||||
import { ProcessorFork } from "./ProcessFork";
|
||||
import { ProcessorLocal } from "./ProcessorLocal";
|
||||
import { Result } from "./Result";
|
||||
import CSVError from "./CSVError";
|
||||
import { bufFromString } from "./util";
|
||||
export class Converter extends Transform {
|
||||
preRawData(onRawData: PreRawDataCallback) {
|
||||
this.runtime.preRawDataHook = onRawData;
|
||||
}
|
||||
preFileLine(onFileLine: PreFileLineCallback) {
|
||||
this.runtime.preFileLineHook = onFileLine;
|
||||
}
|
||||
subscribe(
|
||||
onNext?: (data: any, lineNumber: number) => void | PromiseLike<void>,
|
||||
onError?: (err: CSVError) => void,
|
||||
onCompleted?: () => void): Converter {
|
||||
this.parseRuntime.subscribe = {
|
||||
onNext,
|
||||
onError,
|
||||
onCompleted
|
||||
}
|
||||
return this;
|
||||
}
|
||||
fromFile(filePath: string, options?: string | CreateReadStreamOption | undefined): Converter {
|
||||
const fs = require("fs");
|
||||
// var rs = null;
|
||||
// this.wrapCallback(cb, function () {
|
||||
// if (rs && rs.destroy) {
|
||||
// rs.destroy();
|
||||
// }
|
||||
// });
|
||||
fs.exists(filePath, (exist) => {
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (exist) {
|
||||
const rs = fs.createReadStream(filePath, options);
|
||||
rs.pipe(this);
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));</span>
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
fromStream(readStream: Readable): Converter {
|
||||
readStream.pipe(this);
|
||||
return this;
|
||||
}
|
||||
fromString(csvString: string): Converter {
|
||||
const csv = csvString.toString();
|
||||
const read = new Readable();
|
||||
let idx = 0;
|
||||
read._read = function (size) {
|
||||
if (idx >= csvString.length) {
|
||||
this.push(null);
|
||||
} else {
|
||||
const str = csvString.substr(idx, size);
|
||||
this.push(str);
|
||||
idx += size;
|
||||
}
|
||||
}
|
||||
return this.fromStream(read);
|
||||
}
|
||||
then<TResult1 = any[], TResult2 = never>(onfulfilled?: (value: any[]) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2> {
|
||||
return new P((resolve, reject) => {
|
||||
this.parseRuntime.then = {
|
||||
onfulfilled: (value: any[]) => {
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (onfulfilled) {
|
||||
resolve(onfulfilled(value));
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > resolve(value as any);</span>
|
||||
}
|
||||
},
|
||||
onrejected: (err: Error) => {
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (onrejected) {
|
||||
resolve(onrejected(err));
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > reject(err);</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public get parseParam(): CSVParseParam {
|
||||
return this.params;
|
||||
}
|
||||
public get parseRuntime(): ParseRuntime {
|
||||
return this.runtime;
|
||||
}
|
||||
private params: CSVParseParam;
|
||||
private runtime: ParseRuntime;
|
||||
private processor: Processor;
|
||||
private result: Result;
|
||||
constructor(param?: Partial<CSVParseParam>, public options: TransformOptions = {}) {
|
||||
super(options);
|
||||
this.params = mergeParams(param);
|
||||
this.runtime = initParseRuntime(this);
|
||||
this.result = new Result(this);
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.params.fork) {
|
||||
<span class="cstat-no" title="statement not covered" > this.processor = new ProcessorFork(this);</span>
|
||||
} else {
|
||||
this.processor = new ProcessorLocal(this);
|
||||
}
|
||||
this.once("error", (err: any) => {
|
||||
// console.log("BBB");
|
||||
this.result.processError(err);
|
||||
setTimeout(() => {
|
||||
this.emit("done", err);
|
||||
},0);
|
||||
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
_transform(chunk: any, encoding: string, cb: Function) {
|
||||
this.processor.process(chunk)
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
this.runtime.started = true;
|
||||
return this.result.processResult(result);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
cb();
|
||||
}, (error) => {
|
||||
this.runtime.hasError = true;
|
||||
this.runtime.error = error;
|
||||
this.emit("error", error);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
_flush(cb: Function) {
|
||||
if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) {
|
||||
const buf = this.runtime.csvLineBuffer;
|
||||
this.runtime.csvLineBuffer = undefined;
|
||||
this.processor.process(buf, true)
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
return this.result.processResult(result);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) {
|
||||
this.emit("error", CSVError.unclosed_quote(this.parsedLineNumber, this.runtime.csvLineBuffer.toString()));
|
||||
} else {
|
||||
this.processEnd(cb);
|
||||
}
|
||||
// cb();
|
||||
|
||||
}, <span class="fstat-no" title="function not covered" >(</span>err) => {
|
||||
<span class="cstat-no" title="statement not covered" > this.emit("error", err);</span>
|
||||
<span class="cstat-no" title="statement not covered" > cb();</span>
|
||||
})
|
||||
} else {
|
||||
this.processEnd(cb);
|
||||
}
|
||||
}
|
||||
private processEnd(cb) {
|
||||
this.result.endProcess();
|
||||
this.emit("done");
|
||||
cb();
|
||||
}
|
||||
get parsedLineNumber(): number {
|
||||
return this.runtime.parsedLineNumber;
|
||||
}
|
||||
}
|
||||
export interface CreateReadStreamOption {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
autoClose?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
export type CallBack = (err: Error, data: Array<any>) => void;
|
||||
|
||||
|
||||
export type PreFileLineCallback = (line: string, lineNumber: number) => string | PromiseLike<string>;
|
||||
export type PreRawDataCallback = (csvString: string) => string | PromiseLike<string>;
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at 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,10 @@
|
||||
import SyncReader from '../readers/sync';
|
||||
import type Settings from '../settings';
|
||||
import type { Entry } from '../types';
|
||||
export default class SyncProvider {
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: SyncReader;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): Entry[];
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import assertString from './util/assertString';
|
||||
var imeiRegexWithoutHypens = /^[0-9]{15}$/;
|
||||
var imeiRegexWithHypens = /^\d{2}-\d{6}-\d{6}-\d{1}$/;
|
||||
export default function isIMEI(str, options) {
|
||||
assertString(str);
|
||||
options = options || {}; // default regex for checking imei is the one without hyphens
|
||||
|
||||
var imeiRegex = imeiRegexWithoutHypens;
|
||||
|
||||
if (options.allow_hyphens) {
|
||||
imeiRegex = imeiRegexWithHypens;
|
||||
}
|
||||
|
||||
if (!imeiRegex.test(str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
str = str.replace(/-/g, '');
|
||||
var sum = 0,
|
||||
mul = 2,
|
||||
l = 14;
|
||||
|
||||
for (var i = 0; i < l; i++) {
|
||||
var digit = str.substring(l - i - 1, l - i);
|
||||
var tp = parseInt(digit, 10) * mul;
|
||||
|
||||
if (tp >= 10) {
|
||||
sum += tp % 10 + 1;
|
||||
} else {
|
||||
sum += tp;
|
||||
}
|
||||
|
||||
if (mul === 1) {
|
||||
mul += 1;
|
||||
} else {
|
||||
mul -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
var chk = (10 - sum % 10) % 10;
|
||||
|
||||
if (chk !== parseInt(str.substring(14, 15), 10)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { h } from 'preact';
|
||||
import { TCell } from '../../../types';
|
||||
import { PluginBaseComponent, PluginBaseProps } from '../../../plugin';
|
||||
export interface SearchConfig {
|
||||
keyword?: string;
|
||||
enabled?: boolean;
|
||||
debounceTimeout?: number;
|
||||
selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string;
|
||||
server?: {
|
||||
url?: (prevUrl: string, keyword: string) => string;
|
||||
body?: (prevBody: BodyInit, keyword: string) => BodyInit;
|
||||
};
|
||||
}
|
||||
export declare class Search extends PluginBaseComponent<
|
||||
SearchConfig & PluginBaseProps<Search>
|
||||
> {
|
||||
private readonly searchProcessor;
|
||||
private readonly actions;
|
||||
private readonly store;
|
||||
private readonly storeUpdatedFn;
|
||||
static defaultProps: {
|
||||
debounceTimeout: number;
|
||||
};
|
||||
constructor(props: any, context: any);
|
||||
componentWillUnmount(): void;
|
||||
private storeUpdated;
|
||||
private onChange;
|
||||
render(): h.JSX.Element;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeatWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/repeatWhen.ts"],"names":[],"mappings":";;;AACA,qDAAoD;AACpD,sCAAqC;AAIrC,qCAAuC;AACvC,2DAAgE;AAoChE,SAAgB,UAAU,CAAI,QAAmE;IAC/F,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,QAA6B,CAAC;QAClC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,YAA2B,CAAC;QAChC,IAAI,kBAAkB,GAAG,KAAK,CAAC;QAC/B,IAAI,cAAc,GAAG,KAAK,CAAC;QAK3B,IAAM,aAAa,GAAG,cAAM,OAAA,cAAc,IAAI,kBAAkB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAArE,CAAqE,CAAC;QAKlG,IAAM,oBAAoB,GAAG;YAC3B,IAAI,CAAC,YAAY,EAAE;gBACjB,YAAY,GAAG,IAAI,iBAAO,EAAE,CAAC;gBAI7B,qBAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CACzC,6CAAwB,CACtB,UAAU,EACV;oBACE,IAAI,QAAQ,EAAE;wBACZ,sBAAsB,EAAE,CAAC;qBAC1B;yBAAM;wBAKL,SAAS,GAAG,IAAI,CAAC;qBAClB;gBACH,CAAC,EACD;oBACE,kBAAkB,GAAG,IAAI,CAAC;oBAC1B,aAAa,EAAE,CAAC;gBAClB,CAAC,CACF,CACF,CAAC;aACH;YACD,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC;QAEF,IAAM,sBAAsB,GAAG;YAC7B,cAAc,GAAG,KAAK,CAAC;YAEvB,QAAQ,GAAG,MAAM,CAAC,SAAS,CACzB,6CAAwB,CAAC,UAAU,EAAE,SAAS,EAAE;gBAC9C,cAAc,GAAG,IAAI,CAAC;gBAMtB,CAAC,aAAa,EAAE,IAAI,oBAAoB,EAAE,CAAC,IAAI,EAAE,CAAC;YACpD,CAAC,CAAC,CACH,CAAC;YAEF,IAAI,SAAS,EAAE;gBAKb,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAIvB,QAAQ,GAAG,IAAI,CAAC;gBAEhB,SAAS,GAAG,KAAK,CAAC;gBAElB,sBAAsB,EAAE,CAAC;aAC1B;QACH,CAAC,CAAC;QAGF,sBAAsB,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC;AAjFD,gCAiFC"}
|
||||
@@ -0,0 +1,4 @@
|
||||
export type RunnerTeamIdsNotMatchingError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
export default function pathKey(options = {}) {
|
||||
const {
|
||||
env = process.env,
|
||||
platform = process.platform
|
||||
} = options;
|
||||
|
||||
if (platform !== 'win32') {
|
||||
return 'PATH';
|
||||
}
|
||||
|
||||
return Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
var forEach = require('../helpers/forEach');
|
||||
var every = require('../helpers/every');
|
||||
var OwnPropertyKeys = require('../helpers/OwnPropertyKeys');
|
||||
|
||||
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
||||
|
||||
var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow');
|
||||
var Get = require('./Get');
|
||||
var IsArray = require('./IsArray');
|
||||
var IsInteger = require('./IsInteger');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var SameValue = require('./SameValue');
|
||||
var ToNumber = require('./ToNumber');
|
||||
var ToObject = require('./ToObject');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/11.0/#sec-copydataproperties
|
||||
|
||||
module.exports = function CopyDataProperties(target, source, excludedItems) {
|
||||
if (Type(target) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: "target" must be an Object');
|
||||
}
|
||||
|
||||
if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) {
|
||||
throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys');
|
||||
}
|
||||
|
||||
if (typeof source === 'undefined' || source === null) {
|
||||
return target;
|
||||
}
|
||||
|
||||
var from = ToObject(source);
|
||||
|
||||
var sourceKeys = OwnPropertyKeys(from);
|
||||
forEach(sourceKeys, function (nextKey) {
|
||||
var excluded = false;
|
||||
|
||||
forEach(excludedItems, function (e) {
|
||||
if (SameValue(e, nextKey) === true) {
|
||||
excluded = true;
|
||||
}
|
||||
});
|
||||
|
||||
var enumerable = $isEnumerable(from, nextKey) || (
|
||||
// this is to handle string keys being non-enumerable in older engines
|
||||
typeof source === 'string'
|
||||
&& nextKey >= 0
|
||||
&& IsInteger(ToNumber(nextKey))
|
||||
);
|
||||
if (excluded === false && enumerable) {
|
||||
var propValue = Get(from, nextKey);
|
||||
CreateDataPropertyOrThrow(target, nextKey, propValue);
|
||||
}
|
||||
});
|
||||
|
||||
return target;
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
import { __extends } from "tslib";
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { SubscriptionLoggable } from './SubscriptionLoggable';
|
||||
import { applyMixins } from '../util/applyMixins';
|
||||
import { observeNotification } from '../Notification';
|
||||
var ColdObservable = (function (_super) {
|
||||
__extends(ColdObservable, _super);
|
||||
function ColdObservable(messages, scheduler) {
|
||||
var _this = _super.call(this, function (subscriber) {
|
||||
var observable = this;
|
||||
var index = observable.logSubscribedFrame();
|
||||
var subscription = new Subscription();
|
||||
subscription.add(new Subscription(function () {
|
||||
observable.logUnsubscribedFrame(index);
|
||||
}));
|
||||
observable.scheduleMessages(subscriber);
|
||||
return subscription;
|
||||
}) || this;
|
||||
_this.messages = messages;
|
||||
_this.subscriptions = [];
|
||||
_this.scheduler = scheduler;
|
||||
return _this;
|
||||
}
|
||||
ColdObservable.prototype.scheduleMessages = function (subscriber) {
|
||||
var messagesLength = this.messages.length;
|
||||
for (var i = 0; i < messagesLength; i++) {
|
||||
var message = this.messages[i];
|
||||
subscriber.add(this.scheduler.schedule(function (state) {
|
||||
var _a = state, notification = _a.message.notification, destination = _a.subscriber;
|
||||
observeNotification(notification, destination);
|
||||
}, message.frame, { message: message, subscriber: subscriber }));
|
||||
}
|
||||
};
|
||||
return ColdObservable;
|
||||
}(Observable));
|
||||
export { ColdObservable };
|
||||
applyMixins(ColdObservable, [SubscriptionLoggable]);
|
||||
//# sourceMappingURL=ColdObservable.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatest.js","sourceRoot":"","sources":["../../../../src/internal/operators/combineLatest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAoBjD,MAAM,UAAU,aAAa,CAAO,GAAG,IAA0D;IAC/F,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,cAAc;QACnB,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,GAAI,IAAoC,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACjG,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;YAC7B,iBAAiB,CAAC,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;AACT,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB EC FC"},D:{"1":"WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"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 PC QC RC SC qB AC TC rB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:5,C:"CSS overflow-anchor (Scroll Anchoring)"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C","260":"K L G M N O"},C:{"1":"QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 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":"5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB"},D:{"1":"TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"I","16":"v J D E F A B C K L","260":"SB","772":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB"},E:{"1":"B C K L G 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB","16":"v","772":"J D E F A IC JC KC LC"},F:{"1":"GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","16":"F PC","260":"B C FB QC RC SC qB AC TC rB","772":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB"},G:{"1":"cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC","772":"E VC WC XC YC ZC aC bC"},H:{"132":"oC"},I:{"1":"f","2":"tB pC qC rC","260":"I sC BC tC uC"},J:{"2":"D","260":"A"},K:{"1":"h","260":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","260":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","516":"AD"}},B:5,C:":in-range and :out-of-range CSS pseudo-classes"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NotFoundError.js","sourceRoot":"","sources":["../../../../src/internal/util/NotFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAoBtD,MAAM,CAAC,MAAM,aAAa,GAAsB,gBAAgB,CAC9D,CAAC,MAAM,EAAE,EAAE,CACT,SAAS,iBAAiB,CAAY,OAAe;IACnD,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACzB,CAAC,CACJ,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
export declare function applyMixins(derivedCtor: any, baseCtors: any[]): void;
|
||||
//# sourceMappingURL=applyMixins.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"of.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,wBAAgB,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AAClD,wBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAE5D,8IAA8I;AAC9I,wBAAgB,EAAE,CAAC,SAAS,EAAE,aAAa,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAChE,8IAA8I;AAC9I,wBAAgB,EAAE,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,GAAG,kBAAkB,EAAE,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9H,wBAAgB,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AACxC,0IAA0I;AAC1I,wBAAgB,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AACvC,wBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAC/C,wBAAgB,EAAE,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
||||
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
// Benchmark comparing performance of event emit for single listener
|
||||
// To run it, do following in memoizee package path:
|
||||
//
|
||||
// $ npm install eventemitter2 signals
|
||||
// $ node benchmark/single-on.js
|
||||
|
||||
var forEach = require('es5-ext/object/for-each')
|
||||
, pad = require('es5-ext/string/#/pad')
|
||||
|
||||
, now = Date.now
|
||||
|
||||
, time, count = 1000000, i, data = {}
|
||||
, ee, native, ee2, signals, a = {}, b = {};
|
||||
|
||||
ee = (function () {
|
||||
var ee = require('../');
|
||||
return ee().on('test', function () { return arguments; });
|
||||
}());
|
||||
|
||||
native = (function () {
|
||||
var ee = require('events');
|
||||
return (new ee.EventEmitter()).on('test', function () { return arguments; });
|
||||
}());
|
||||
|
||||
ee2 = (function () {
|
||||
var ee = require('eventemitter2');
|
||||
return (new ee.EventEmitter2()).on('test', function () { return arguments; });
|
||||
}());
|
||||
|
||||
signals = (function () {
|
||||
var Signal = require('signals')
|
||||
, ee = { test: new Signal() };
|
||||
ee.test.add(function () { return arguments; });
|
||||
return ee;
|
||||
}());
|
||||
|
||||
console.log("Emit for single listener", "x" + count + ":\n");
|
||||
|
||||
i = count;
|
||||
time = now();
|
||||
while (i--) {
|
||||
ee.emit('test', a, b);
|
||||
}
|
||||
data["event-emitter (this implementation)"] = now() - time;
|
||||
|
||||
i = count;
|
||||
time = now();
|
||||
while (i--) {
|
||||
native.emit('test', a, b);
|
||||
}
|
||||
data["EventEmitter (Node.js native)"] = now() - time;
|
||||
|
||||
i = count;
|
||||
time = now();
|
||||
while (i--) {
|
||||
ee2.emit('test', a, b);
|
||||
}
|
||||
data.EventEmitter2 = now() - time;
|
||||
|
||||
i = count;
|
||||
time = now();
|
||||
while (i--) {
|
||||
signals.test.dispatch(a, b);
|
||||
}
|
||||
data.Signals = now() - time;
|
||||
|
||||
forEach(data, function (value, name, obj, index) {
|
||||
console.log(index + 1 + ":", pad.call(value, " ", 5), name);
|
||||
}, null, function (a, b) {
|
||||
return this[a] - this[b];
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
var resolve = require('../');
|
||||
resolve('tap', { basedir: __dirname }, function (err, res) {
|
||||
if (err) console.error(err);
|
||||
else console.log(res);
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
/** @prettier */
|
||||
import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
|
||||
import { executeSchedule } from '../util/executeSchedule';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
|
||||
/**
|
||||
* Re-emits all notifications from source Observable with specified scheduler.
|
||||
*
|
||||
* <span class="informal">Ensure a specific scheduler is used, from outside of an Observable.</span>
|
||||
*
|
||||
* `observeOn` is an operator that accepts a scheduler as a first parameter, which will be used to reschedule
|
||||
* notifications emitted by the source Observable. It might be useful, if you do not have control over
|
||||
* internal scheduler of a given Observable, but want to control when its values are emitted nevertheless.
|
||||
*
|
||||
* Returned Observable emits the same notifications (nexted values, complete and error events) as the source Observable,
|
||||
* but rescheduled with provided scheduler. Note that this doesn't mean that source Observables internal
|
||||
* scheduler will be replaced in any way. Original scheduler still will be used, but when the source Observable emits
|
||||
* notification, it will be immediately scheduled again - this time with scheduler passed to `observeOn`.
|
||||
* An anti-pattern would be calling `observeOn` on Observable that emits lots of values synchronously, to split
|
||||
* that emissions into asynchronous chunks. For this to happen, scheduler would have to be passed into the source
|
||||
* Observable directly (usually into the operator that creates it). `observeOn` simply delays notifications a
|
||||
* little bit more, to ensure that they are emitted at expected moments.
|
||||
*
|
||||
* As a matter of fact, `observeOn` accepts second parameter, which specifies in milliseconds with what delay notifications
|
||||
* will be emitted. The main difference between {@link delay} operator and `observeOn` is that `observeOn`
|
||||
* will delay all notifications - including error notifications - while `delay` will pass through error
|
||||
* from source Observable immediately when it is emitted. In general it is highly recommended to use `delay` operator
|
||||
* for any kind of delaying of values in the stream, while using `observeOn` to specify which scheduler should be used
|
||||
* for notification emissions in general.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Ensure values in subscribe are called just before browser repaint
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, observeOn, animationFrameScheduler } from 'rxjs';
|
||||
*
|
||||
* const someDiv = document.createElement('div');
|
||||
* someDiv.style.cssText = 'width: 200px;background: #09c';
|
||||
* document.body.appendChild(someDiv);
|
||||
* const intervals = interval(10); // Intervals are scheduled
|
||||
* // with async scheduler by default...
|
||||
* intervals.pipe(
|
||||
* observeOn(animationFrameScheduler) // ...but we will observe on animationFrame
|
||||
* ) // scheduler to ensure smooth animation.
|
||||
* .subscribe(val => {
|
||||
* someDiv.style.height = val + 'px';
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param scheduler Scheduler that will be used to reschedule notifications from source Observable.
|
||||
* @param delay Number of milliseconds that states with what delay every notification should be rescheduled.
|
||||
* @return A function that returns an Observable that emits the same
|
||||
* notifications as the source Observable, but with provided scheduler.
|
||||
*/
|
||||
export function observeOn<T>(scheduler: SchedulerLike, delay = 0): MonoTypeOperatorFunction<T> {
|
||||
return operate((source, subscriber) => {
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay),
|
||||
() => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay),
|
||||
(err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('forOwnRight', require('../forOwnRight'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,422 @@
|
||||
const ip = exports;
|
||||
const { Buffer } = require('buffer');
|
||||
const os = require('os');
|
||||
|
||||
ip.toBuffer = function (ip, buff, offset) {
|
||||
offset = ~~offset;
|
||||
|
||||
let result;
|
||||
|
||||
if (this.isV4Format(ip)) {
|
||||
result = buff || Buffer.alloc(offset + 4);
|
||||
ip.split(/\./g).map((byte) => {
|
||||
result[offset++] = parseInt(byte, 10) & 0xff;
|
||||
});
|
||||
} else if (this.isV6Format(ip)) {
|
||||
const sections = ip.split(':', 8);
|
||||
|
||||
let i;
|
||||
for (i = 0; i < sections.length; i++) {
|
||||
const isv4 = this.isV4Format(sections[i]);
|
||||
let v4Buffer;
|
||||
|
||||
if (isv4) {
|
||||
v4Buffer = this.toBuffer(sections[i]);
|
||||
sections[i] = v4Buffer.slice(0, 2).toString('hex');
|
||||
}
|
||||
|
||||
if (v4Buffer && ++i < 8) {
|
||||
sections.splice(i, 0, v4Buffer.slice(2, 4).toString('hex'));
|
||||
}
|
||||
}
|
||||
|
||||
if (sections[0] === '') {
|
||||
while (sections.length < 8) sections.unshift('0');
|
||||
} else if (sections[sections.length - 1] === '') {
|
||||
while (sections.length < 8) sections.push('0');
|
||||
} else if (sections.length < 8) {
|
||||
for (i = 0; i < sections.length && sections[i] !== ''; i++);
|
||||
const argv = [i, 1];
|
||||
for (i = 9 - sections.length; i > 0; i--) {
|
||||
argv.push('0');
|
||||
}
|
||||
sections.splice(...argv);
|
||||
}
|
||||
|
||||
result = buff || Buffer.alloc(offset + 16);
|
||||
for (i = 0; i < sections.length; i++) {
|
||||
const word = parseInt(sections[i], 16);
|
||||
result[offset++] = (word >> 8) & 0xff;
|
||||
result[offset++] = word & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
throw Error(`Invalid ip address: ${ip}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
ip.toString = function (buff, offset, length) {
|
||||
offset = ~~offset;
|
||||
length = length || (buff.length - offset);
|
||||
|
||||
let result = [];
|
||||
if (length === 4) {
|
||||
// IPv4
|
||||
for (let i = 0; i < length; i++) {
|
||||
result.push(buff[offset + i]);
|
||||
}
|
||||
result = result.join('.');
|
||||
} else if (length === 16) {
|
||||
// IPv6
|
||||
for (let i = 0; i < length; i += 2) {
|
||||
result.push(buff.readUInt16BE(offset + i).toString(16));
|
||||
}
|
||||
result = result.join(':');
|
||||
result = result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3');
|
||||
result = result.replace(/:{3,4}/, '::');
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/;
|
||||
const ipv6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;
|
||||
|
||||
ip.isV4Format = function (ip) {
|
||||
return ipv4Regex.test(ip);
|
||||
};
|
||||
|
||||
ip.isV6Format = function (ip) {
|
||||
return ipv6Regex.test(ip);
|
||||
};
|
||||
|
||||
function _normalizeFamily(family) {
|
||||
if (family === 4) {
|
||||
return 'ipv4';
|
||||
}
|
||||
if (family === 6) {
|
||||
return 'ipv6';
|
||||
}
|
||||
return family ? family.toLowerCase() : 'ipv4';
|
||||
}
|
||||
|
||||
ip.fromPrefixLen = function (prefixlen, family) {
|
||||
if (prefixlen > 32) {
|
||||
family = 'ipv6';
|
||||
} else {
|
||||
family = _normalizeFamily(family);
|
||||
}
|
||||
|
||||
let len = 4;
|
||||
if (family === 'ipv6') {
|
||||
len = 16;
|
||||
}
|
||||
const buff = Buffer.alloc(len);
|
||||
|
||||
for (let i = 0, n = buff.length; i < n; ++i) {
|
||||
let bits = 8;
|
||||
if (prefixlen < 8) {
|
||||
bits = prefixlen;
|
||||
}
|
||||
prefixlen -= bits;
|
||||
|
||||
buff[i] = ~(0xff >> bits) & 0xff;
|
||||
}
|
||||
|
||||
return ip.toString(buff);
|
||||
};
|
||||
|
||||
ip.mask = function (addr, mask) {
|
||||
addr = ip.toBuffer(addr);
|
||||
mask = ip.toBuffer(mask);
|
||||
|
||||
const result = Buffer.alloc(Math.max(addr.length, mask.length));
|
||||
|
||||
// Same protocol - do bitwise and
|
||||
let i;
|
||||
if (addr.length === mask.length) {
|
||||
for (i = 0; i < addr.length; i++) {
|
||||
result[i] = addr[i] & mask[i];
|
||||
}
|
||||
} else if (mask.length === 4) {
|
||||
// IPv6 address and IPv4 mask
|
||||
// (Mask low bits)
|
||||
for (i = 0; i < mask.length; i++) {
|
||||
result[i] = addr[addr.length - 4 + i] & mask[i];
|
||||
}
|
||||
} else {
|
||||
// IPv6 mask and IPv4 addr
|
||||
for (i = 0; i < result.length - 6; i++) {
|
||||
result[i] = 0;
|
||||
}
|
||||
|
||||
// ::ffff:ipv4
|
||||
result[10] = 0xff;
|
||||
result[11] = 0xff;
|
||||
for (i = 0; i < addr.length; i++) {
|
||||
result[i + 12] = addr[i] & mask[i + 12];
|
||||
}
|
||||
i += 12;
|
||||
}
|
||||
for (; i < result.length; i++) {
|
||||
result[i] = 0;
|
||||
}
|
||||
|
||||
return ip.toString(result);
|
||||
};
|
||||
|
||||
ip.cidr = function (cidrString) {
|
||||
const cidrParts = cidrString.split('/');
|
||||
|
||||
const addr = cidrParts[0];
|
||||
if (cidrParts.length !== 2) {
|
||||
throw new Error(`invalid CIDR subnet: ${addr}`);
|
||||
}
|
||||
|
||||
const mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10));
|
||||
|
||||
return ip.mask(addr, mask);
|
||||
};
|
||||
|
||||
ip.subnet = function (addr, mask) {
|
||||
const networkAddress = ip.toLong(ip.mask(addr, mask));
|
||||
|
||||
// Calculate the mask's length.
|
||||
const maskBuffer = ip.toBuffer(mask);
|
||||
let maskLength = 0;
|
||||
|
||||
for (let i = 0; i < maskBuffer.length; i++) {
|
||||
if (maskBuffer[i] === 0xff) {
|
||||
maskLength += 8;
|
||||
} else {
|
||||
let octet = maskBuffer[i] & 0xff;
|
||||
while (octet) {
|
||||
octet = (octet << 1) & 0xff;
|
||||
maskLength++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const numberOfAddresses = 2 ** (32 - maskLength);
|
||||
|
||||
return {
|
||||
networkAddress: ip.fromLong(networkAddress),
|
||||
firstAddress: numberOfAddresses <= 2
|
||||
? ip.fromLong(networkAddress)
|
||||
: ip.fromLong(networkAddress + 1),
|
||||
lastAddress: numberOfAddresses <= 2
|
||||
? ip.fromLong(networkAddress + numberOfAddresses - 1)
|
||||
: ip.fromLong(networkAddress + numberOfAddresses - 2),
|
||||
broadcastAddress: ip.fromLong(networkAddress + numberOfAddresses - 1),
|
||||
subnetMask: mask,
|
||||
subnetMaskLength: maskLength,
|
||||
numHosts: numberOfAddresses <= 2
|
||||
? numberOfAddresses : numberOfAddresses - 2,
|
||||
length: numberOfAddresses,
|
||||
contains(other) {
|
||||
return networkAddress === ip.toLong(ip.mask(other, mask));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
ip.cidrSubnet = function (cidrString) {
|
||||
const cidrParts = cidrString.split('/');
|
||||
|
||||
const addr = cidrParts[0];
|
||||
if (cidrParts.length !== 2) {
|
||||
throw new Error(`invalid CIDR subnet: ${addr}`);
|
||||
}
|
||||
|
||||
const mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10));
|
||||
|
||||
return ip.subnet(addr, mask);
|
||||
};
|
||||
|
||||
ip.not = function (addr) {
|
||||
const buff = ip.toBuffer(addr);
|
||||
for (let i = 0; i < buff.length; i++) {
|
||||
buff[i] = 0xff ^ buff[i];
|
||||
}
|
||||
return ip.toString(buff);
|
||||
};
|
||||
|
||||
ip.or = function (a, b) {
|
||||
a = ip.toBuffer(a);
|
||||
b = ip.toBuffer(b);
|
||||
|
||||
// same protocol
|
||||
if (a.length === b.length) {
|
||||
for (let i = 0; i < a.length; ++i) {
|
||||
a[i] |= b[i];
|
||||
}
|
||||
return ip.toString(a);
|
||||
|
||||
// mixed protocols
|
||||
}
|
||||
let buff = a;
|
||||
let other = b;
|
||||
if (b.length > a.length) {
|
||||
buff = b;
|
||||
other = a;
|
||||
}
|
||||
|
||||
const offset = buff.length - other.length;
|
||||
for (let i = offset; i < buff.length; ++i) {
|
||||
buff[i] |= other[i - offset];
|
||||
}
|
||||
|
||||
return ip.toString(buff);
|
||||
};
|
||||
|
||||
ip.isEqual = function (a, b) {
|
||||
a = ip.toBuffer(a);
|
||||
b = ip.toBuffer(b);
|
||||
|
||||
// Same protocol
|
||||
if (a.length === b.length) {
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
if (a[i] !== b[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Swap
|
||||
if (b.length === 4) {
|
||||
const t = b;
|
||||
b = a;
|
||||
a = t;
|
||||
}
|
||||
|
||||
// a - IPv4, b - IPv6
|
||||
for (let i = 0; i < 10; i++) {
|
||||
if (b[i] !== 0) return false;
|
||||
}
|
||||
|
||||
const word = b.readUInt16BE(10);
|
||||
if (word !== 0 && word !== 0xffff) return false;
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (a[i] !== b[i + 12]) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
ip.isPrivate = function (addr) {
|
||||
return /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i
|
||||
.test(addr)
|
||||
|| /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr)
|
||||
|| /^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i
|
||||
.test(addr)
|
||||
|| /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr)
|
||||
|| /^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr)
|
||||
|| /^f[cd][0-9a-f]{2}:/i.test(addr)
|
||||
|| /^fe80:/i.test(addr)
|
||||
|| /^::1$/.test(addr)
|
||||
|| /^::$/.test(addr);
|
||||
};
|
||||
|
||||
ip.isPublic = function (addr) {
|
||||
return !ip.isPrivate(addr);
|
||||
};
|
||||
|
||||
ip.isLoopback = function (addr) {
|
||||
return /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/
|
||||
.test(addr)
|
||||
|| /^fe80::1$/.test(addr)
|
||||
|| /^::1$/.test(addr)
|
||||
|| /^::$/.test(addr);
|
||||
};
|
||||
|
||||
ip.loopback = function (family) {
|
||||
//
|
||||
// Default to `ipv4`
|
||||
//
|
||||
family = _normalizeFamily(family);
|
||||
|
||||
if (family !== 'ipv4' && family !== 'ipv6') {
|
||||
throw new Error('family must be ipv4 or ipv6');
|
||||
}
|
||||
|
||||
return family === 'ipv4' ? '127.0.0.1' : 'fe80::1';
|
||||
};
|
||||
|
||||
//
|
||||
// ### function address (name, family)
|
||||
// #### @name {string|'public'|'private'} **Optional** Name or security
|
||||
// of the network interface.
|
||||
// #### @family {ipv4|ipv6} **Optional** IP family of the address (defaults
|
||||
// to ipv4).
|
||||
//
|
||||
// Returns the address for the network interface on the current system with
|
||||
// the specified `name`:
|
||||
// * String: First `family` address of the interface.
|
||||
// If not found see `undefined`.
|
||||
// * 'public': the first public ip address of family.
|
||||
// * 'private': the first private ip address of family.
|
||||
// * undefined: First address with `ipv4` or loopback address `127.0.0.1`.
|
||||
//
|
||||
ip.address = function (name, family) {
|
||||
const interfaces = os.networkInterfaces();
|
||||
|
||||
//
|
||||
// Default to `ipv4`
|
||||
//
|
||||
family = _normalizeFamily(family);
|
||||
|
||||
//
|
||||
// If a specific network interface has been named,
|
||||
// return the address.
|
||||
//
|
||||
if (name && name !== 'private' && name !== 'public') {
|
||||
const res = interfaces[name].filter((details) => {
|
||||
const itemFamily = _normalizeFamily(details.family);
|
||||
return itemFamily === family;
|
||||
});
|
||||
if (res.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return res[0].address;
|
||||
}
|
||||
|
||||
const all = Object.keys(interfaces).map((nic) => {
|
||||
//
|
||||
// Note: name will only be `public` or `private`
|
||||
// when this is called.
|
||||
//
|
||||
const addresses = interfaces[nic].filter((details) => {
|
||||
details.family = _normalizeFamily(details.family);
|
||||
if (details.family !== family || ip.isLoopback(details.address)) {
|
||||
return false;
|
||||
} if (!name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return name === 'public' ? ip.isPrivate(details.address)
|
||||
: ip.isPublic(details.address);
|
||||
});
|
||||
|
||||
return addresses.length ? addresses[0].address : undefined;
|
||||
}).filter(Boolean);
|
||||
|
||||
return !all.length ? ip.loopback(family) : all[0];
|
||||
};
|
||||
|
||||
ip.toLong = function (ip) {
|
||||
let ipl = 0;
|
||||
ip.split('.').forEach((octet) => {
|
||||
ipl <<= 8;
|
||||
ipl += parseInt(octet);
|
||||
});
|
||||
return (ipl >>> 0);
|
||||
};
|
||||
|
||||
ip.fromLong = function (ipl) {
|
||||
return (`${ipl >>> 24}.${
|
||||
ipl >> 16 & 255}.${
|
||||
ipl >> 8 & 255}.${
|
||||
ipl & 255}`);
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import {PascalCase} from './pascal-case';
|
||||
|
||||
/**
|
||||
Convert object properties to pascal case but not recursively.
|
||||
|
||||
This can be useful when, for example, converting some API types from a different style.
|
||||
|
||||
@see PascalCase
|
||||
@see PascalCasedPropertiesDeep
|
||||
|
||||
@example
|
||||
```
|
||||
interface User {
|
||||
userId: number;
|
||||
userName: string;
|
||||
}
|
||||
|
||||
const result: PascalCasedProperties<User> = {
|
||||
UserId: 1,
|
||||
UserName: 'Tom',
|
||||
};
|
||||
```
|
||||
|
||||
@category Template Literals
|
||||
*/
|
||||
export type PascalCasedProperties<Value> = Value extends Function
|
||||
? Value
|
||||
: Value extends Array<infer U>
|
||||
? Value
|
||||
: { [K in keyof Value as PascalCase<K>]: Value[K] };
|
||||
@@ -0,0 +1,6 @@
|
||||
export type UpdateTrack = {
|
||||
id: number;
|
||||
name: string;
|
||||
distance: number;
|
||||
minimumLapTime?: number;
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
# has-symbols <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Determine if the JS environment has Symbol support. Supports spec, or shams.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var hasSymbols = require('has-symbols');
|
||||
|
||||
hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable.
|
||||
|
||||
var hasSymbolsKinda = require('has-symbols/shams');
|
||||
hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec.
|
||||
```
|
||||
|
||||
## Supported Symbol shams
|
||||
- get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols)
|
||||
- core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js)
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/has-symbols
|
||||
[2]: https://versionbadg.es/inspect-js/has-symbols.svg
|
||||
[5]: https://david-dm.org/inspect-js/has-symbols.svg
|
||||
[6]: https://david-dm.org/inspect-js/has-symbols
|
||||
[7]: https://david-dm.org/inspect-js/has-symbols/dev-status.svg
|
||||
[8]: https://david-dm.org/inspect-js/has-symbols#info=devDependencies
|
||||
[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/has-symbols.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/has-symbols.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=has-symbols
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/has-symbols/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/has-symbols/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-symbols
|
||||
[actions-url]: https://github.com/inspect-js/has-symbols/actions
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB EC FC","578":"mB nB oB pB P Q R wB"},D:{"1":"hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB","194":"uB ZB vB aB bB cB dB eB fB gB"},E:{"1":"K L G rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A B C HC zB IC JC KC LC 0B qB"},F:{"1":"cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"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 PC QC RC SC qB AC TC rB","194":"MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB"},G:{"1":"gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC xC yC zC 0C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:5,C:"CSS Conical Gradients"};
|
||||
@@ -0,0 +1,94 @@
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { ObservableInput, OperatorFunction } 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, using a factory function of closing
|
||||
* Observables to determine when to close, emit, and reset the buffer.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array. When it
|
||||
* starts collecting values, it calls a function that returns an Observable that
|
||||
* tells when to close the buffer and restart collecting.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Opens a buffer immediately, then closes the buffer when the observable
|
||||
* returned by calling `closingSelector` function emits a value. When it closes
|
||||
* the buffer, it immediately opens a new buffer and repeats the process.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Emit an array of the last clicks every [1-5] random seconds
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, bufferWhen, interval } from 'rxjs';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const buffered = clicks.pipe(
|
||||
* bufferWhen(() => interval(1000 + Math.random() * 4000))
|
||||
* );
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferCount}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link windowWhen}
|
||||
*
|
||||
* @param {function(): Observable} closingSelector A function that takes no
|
||||
* arguments and returns an Observable that signals buffer closure.
|
||||
* @return A function that returns an Observable of arrays of buffered values.
|
||||
*/
|
||||
export function bufferWhen<T>(closingSelector: () => ObservableInput<any>): OperatorFunction<T, T[]> {
|
||||
return operate((source, subscriber) => {
|
||||
// The buffer we keep and emit.
|
||||
let buffer: T[] | null = null;
|
||||
// A reference to the subscriber used to subscribe to
|
||||
// the closing notifier. We need to hold this so we can
|
||||
// end the subscription after the first notification.
|
||||
let closingSubscriber: Subscriber<T> | null = null;
|
||||
|
||||
// Ends the previous closing notifier subscription, so it
|
||||
// terminates after the first emission, then emits
|
||||
// the current buffer if there is one, starts a new buffer, and starts a
|
||||
// new closing notifier.
|
||||
const openBuffer = () => {
|
||||
// Make sure to finalize the closing subscription, we only cared
|
||||
// about one notification.
|
||||
closingSubscriber?.unsubscribe();
|
||||
// emit the buffer if we have one, and start a new buffer.
|
||||
const b = buffer;
|
||||
buffer = [];
|
||||
b && subscriber.next(b);
|
||||
|
||||
// Get a new closing notifier and subscribe to it.
|
||||
innerFrom(closingSelector()).subscribe((closingSubscriber = createOperatorSubscriber(subscriber, openBuffer, noop)));
|
||||
};
|
||||
|
||||
// Start the first buffer.
|
||||
openBuffer();
|
||||
|
||||
// Subscribe to our source.
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
// Add every new value to the current buffer.
|
||||
(value) => buffer?.push(value),
|
||||
// When we complete, emit the buffer if we have one,
|
||||
// then complete the result.
|
||||
() => {
|
||||
buffer && subscriber.next(buffer);
|
||||
subscriber.complete();
|
||||
},
|
||||
// Pass all errors through to consumer.
|
||||
undefined,
|
||||
// Release memory on finalization
|
||||
() => (buffer = closingSubscriber = null!)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../../src/internal/operators/connect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAgBlE,IAAM,cAAc,GAA2B;IAC7C,SAAS,EAAE,cAAM,OAAA,IAAI,OAAO,EAAW,EAAtB,CAAsB;CACxC,CAAC;AA2EF,MAAM,UAAU,OAAO,CACrB,QAAsC,EACtC,MAAyC;IAAzC,uBAAA,EAAA,uBAAyC;IAEjC,IAAA,SAAS,GAAK,MAAM,UAAX,CAAY;IAC7B,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAM,OAAO,GAAG,SAAS,EAAE,CAAC;QAC5B,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACrE,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "monorepo-symlink-test",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"postinstall": "lerna bootstrap",
|
||||
"test": "node packages/package-a"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jquery": "^3.3.1",
|
||||
"resolve": "../../../"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lerna": "^3.4.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { SHA2 } from './_sha2.js';
|
||||
declare class SHA1 extends SHA2<SHA1> {
|
||||
private A;
|
||||
private B;
|
||||
private C;
|
||||
private D;
|
||||
private E;
|
||||
constructor();
|
||||
protected get(): [number, number, number, number, number];
|
||||
protected set(A: number, B: number, C: number, D: number, E: number): void;
|
||||
protected process(view: DataView, offset: number): void;
|
||||
protected roundClean(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
export declare const sha1: {
|
||||
(message: import("./utils.js").Input): Uint8Array;
|
||||
outputLen: number;
|
||||
blockLen: number;
|
||||
create(): import("./utils.js").Hash<SHA1>;
|
||||
};
|
||||
export {};
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"env": {
|
||||
"es6": true,
|
||||
"es2017": true,
|
||||
"es2020": true,
|
||||
"es2021": true,
|
||||
"es2022": true,
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"complexity": 0,
|
||||
"eqeqeq": [2, "allow-null"],
|
||||
"func-name-matching": 0,
|
||||
"id-length": 0,
|
||||
"max-lines": 0,
|
||||
"max-lines-per-function": [2, 90],
|
||||
"max-params": [2, 4],
|
||||
"max-statements": 0,
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"multiline-comment-style": 0,
|
||||
"no-magic-numbers": 0,
|
||||
"sort-keys": 0,
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"new-cap": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,39 @@
|
||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
|
||||
const escape = (str, filename) =>
|
||||
(filename ? str : str.replace(/\r?\n|\r/g, '\r\n'))
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/"/g, '%22')
|
||||
|
||||
/**
|
||||
* pure function to convert any formData instance to a Blob
|
||||
* instances synchronous without reading all of the files
|
||||
*
|
||||
* @param {FormData|*} formData an instance of a formData Class
|
||||
* @param {Blob|*} [BlobClass=Blob] the Blob class to use when constructing it
|
||||
*/
|
||||
export function formDataToBlob (formData, BlobClass = Blob) {
|
||||
const boundary = ('----formdata-polyfill-' + Math.random())
|
||||
const chunks = []
|
||||
const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`
|
||||
|
||||
for (let [name, value] of formData) {
|
||||
if (typeof value === 'string') {
|
||||
chunks.push(prefix + escape(name) + `"\r\n\r\n${value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`)
|
||||
} else {
|
||||
chunks.push(
|
||||
prefix + escape(name) + `"; filename="${escape(value.name, 1)}"\r\n` +
|
||||
`Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,
|
||||
value,
|
||||
'\r\n'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
chunks.push(`--${boundary}--`)
|
||||
|
||||
return new BlobClass(chunks, {
|
||||
type: 'multipart/form-data; boundary=' + boundary
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
var clear = require("es5-ext/array/#/clear")
|
||||
, assign = require("es5-ext/object/assign")
|
||||
, callable = require("es5-ext/object/valid-callable")
|
||||
, value = require("es5-ext/object/valid-value")
|
||||
, d = require("d")
|
||||
, autoBind = require("d/auto-bind")
|
||||
, Symbol = require("es6-symbol");
|
||||
|
||||
var defineProperty = Object.defineProperty, defineProperties = Object.defineProperties, Iterator;
|
||||
|
||||
module.exports = Iterator = function (list, context) {
|
||||
if (!(this instanceof Iterator)) throw new TypeError("Constructor requires 'new'");
|
||||
defineProperties(this, {
|
||||
__list__: d("w", value(list)),
|
||||
__context__: d("w", context),
|
||||
__nextIndex__: d("w", 0)
|
||||
});
|
||||
if (!context) return;
|
||||
callable(context.on);
|
||||
context.on("_add", this._onAdd);
|
||||
context.on("_delete", this._onDelete);
|
||||
context.on("_clear", this._onClear);
|
||||
};
|
||||
|
||||
// Internal %IteratorPrototype% doesn't expose its constructor
|
||||
delete Iterator.prototype.constructor;
|
||||
|
||||
defineProperties(
|
||||
Iterator.prototype,
|
||||
assign(
|
||||
{
|
||||
_next: d(function () {
|
||||
var i;
|
||||
if (!this.__list__) return undefined;
|
||||
if (this.__redo__) {
|
||||
i = this.__redo__.shift();
|
||||
if (i !== undefined) return i;
|
||||
}
|
||||
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
|
||||
this._unBind();
|
||||
return undefined;
|
||||
}),
|
||||
next: d(function () {
|
||||
return this._createResult(this._next());
|
||||
}),
|
||||
_createResult: d(function (i) {
|
||||
if (i === undefined) return { done: true, value: undefined };
|
||||
return { done: false, value: this._resolve(i) };
|
||||
}),
|
||||
_resolve: d(function (i) {
|
||||
return this.__list__[i];
|
||||
}),
|
||||
_unBind: d(function () {
|
||||
this.__list__ = null;
|
||||
delete this.__redo__;
|
||||
if (!this.__context__) return;
|
||||
this.__context__.off("_add", this._onAdd);
|
||||
this.__context__.off("_delete", this._onDelete);
|
||||
this.__context__.off("_clear", this._onClear);
|
||||
this.__context__ = null;
|
||||
}),
|
||||
toString: d(function () {
|
||||
return "[object " + (this[Symbol.toStringTag] || "Object") + "]";
|
||||
})
|
||||
},
|
||||
autoBind({
|
||||
_onAdd: d(function (index) {
|
||||
if (index >= this.__nextIndex__) return;
|
||||
++this.__nextIndex__;
|
||||
if (!this.__redo__) {
|
||||
defineProperty(this, "__redo__", d("c", [index]));
|
||||
return;
|
||||
}
|
||||
this.__redo__.forEach(function (redo, i) {
|
||||
if (redo >= index) this.__redo__[i] = ++redo;
|
||||
}, this);
|
||||
this.__redo__.push(index);
|
||||
}),
|
||||
_onDelete: d(function (index) {
|
||||
var i;
|
||||
if (index >= this.__nextIndex__) return;
|
||||
--this.__nextIndex__;
|
||||
if (!this.__redo__) return;
|
||||
i = this.__redo__.indexOf(index);
|
||||
if (i !== -1) this.__redo__.splice(i, 1);
|
||||
this.__redo__.forEach(function (redo, j) {
|
||||
if (redo > index) this.__redo__[j] = --redo;
|
||||
}, this);
|
||||
}),
|
||||
_onClear: d(function () {
|
||||
if (this.__redo__) clear.call(this.__redo__);
|
||||
this.__nextIndex__ = 0;
|
||||
})
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
defineProperty(
|
||||
Iterator.prototype,
|
||||
Symbol.iterator,
|
||||
d(function () {
|
||||
return this;
|
||||
})
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "1.0.4";
|
||||
Reference in New Issue
Block a user