new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"delayWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/delayWhen.ts"],"names":[],"mappings":";;;AAEA,+CAA8C;AAC9C,+BAA8B;AAC9B,mDAAkD;AAClD,iCAAgC;AAChC,uCAAsC;AACtC,qDAAoD;AAoFpD,SAAgB,SAAS,CACvB,qBAAwE,EACxE,iBAAmC;IAEnC,IAAI,iBAAiB,EAAE;QAErB,OAAO,UAAC,MAAqB;YAC3B,OAAA,eAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAI,CAAC,CAAC,CAAC,EAAE,+BAAc,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAAxG,CAAwG,CAAC;KAC5G;IAED,OAAO,mBAAQ,CAAC,UAAC,KAAK,EAAE,KAAK,IAAK,OAAA,qBAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAI,CAAC,CAAC,CAAC,EAAE,aAAK,CAAC,KAAK,CAAC,CAAC,EAA1E,CAA0E,CAAC,CAAC;AAChH,CAAC;AAXD,8BAWC"}
|
||||
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var isNumber = require('../');
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
|
||||
test('not Numbers', function (t) {
|
||||
t.notOk(isNumber(), 'undefined is not Number');
|
||||
t.notOk(isNumber(null), 'null is not Number');
|
||||
t.notOk(isNumber(false), 'false is not Number');
|
||||
t.notOk(isNumber(true), 'true is not Number');
|
||||
t.notOk(isNumber('foo'), 'string is not Number');
|
||||
t.notOk(isNumber([]), 'array is not Number');
|
||||
t.notOk(isNumber({}), 'object is not Number');
|
||||
t.notOk(isNumber(function () {}), 'function is not Number');
|
||||
t.notOk(isNumber(/a/g), 'regex literal is not Number');
|
||||
t.notOk(isNumber(new RegExp('a', 'g')), 'regex object is not Number');
|
||||
t.notOk(isNumber(new Date()), 'new Date() is not Number');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
|
||||
var fakeNumber = {
|
||||
toString: function () { return '7'; },
|
||||
valueOf: function () { return 42; }
|
||||
};
|
||||
fakeNumber[Symbol.toStringTag] = 'Number';
|
||||
t.notOk(isNumber(fakeNumber), 'fake Number with @@toStringTag "Number" is not Number');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Numbers', function (t) {
|
||||
t.ok(isNumber(42), 'number is Number');
|
||||
t.ok(isNumber(Object(42)), 'number object is Number');
|
||||
t.ok(isNumber(NaN), 'NaN is Number');
|
||||
t.ok(isNumber(Infinity), 'Infinity is Number');
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var Set = getNative(root, 'Set');
|
||||
|
||||
module.exports = Set;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shareReplay.js","sourceRoot":"","sources":["../../../../src/internal/operators/shareReplay.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AAEjD,iCAAgC;AAwJhC,SAAgB,WAAW,CACzB,kBAA+C,EAC/C,UAAmB,EACnB,SAAyB;;IAEzB,IAAI,UAAkB,CAAC;IACvB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,kBAAkB,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;QAChE,CAAG,KAA8E,kBAAkB,WAA3E,EAArB,UAAU,mBAAG,QAAQ,KAAA,EAAE,KAAuD,kBAAkB,WAApD,EAArB,UAAU,mBAAG,QAAQ,KAAA,EAAE,KAAgC,kBAAkB,SAAlC,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAAE,SAAS,GAAK,kBAAkB,UAAvB,CAAwB,CAAC;KACtG;SAAM;QACL,UAAU,GAAG,CAAC,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,QAAQ,CAAW,CAAC;KACzD;IACD,OAAO,aAAK,CAAI;QACd,SAAS,EAAE,cAAM,OAAA,IAAI,6BAAa,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAApD,CAAoD;QACrE,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,mBAAmB,EAAE,QAAQ;KAC9B,CAAC,CAAC;AACL,CAAC;AAlBD,kCAkBC"}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Wrapper from './Wrapper';
|
||||
import Renderer from '../../Renderer';
|
||||
import Block from '../../Block';
|
||||
import MustacheTag from '../../../nodes/MustacheTag';
|
||||
import RawMustacheTag from '../../../nodes/RawMustacheTag';
|
||||
import { Node } from 'estree';
|
||||
export default class Tag extends Wrapper {
|
||||
node: MustacheTag | RawMustacheTag;
|
||||
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
|
||||
is_dependencies_static(): boolean;
|
||||
rename_this_method(block: Block, update: ((value: Node) => (Node | Node[]))): {
|
||||
init: import("estree").Property | import("estree").CatchClause | import("estree").ClassDeclaration | import("estree").ClassExpression | import("estree").ClassBody | import("estree").ArrayExpression | import("estree").ArrowFunctionExpression | import("estree").AssignmentExpression | import("estree").AwaitExpression | import("estree").BinaryExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").ChainExpression | import("estree").ConditionalExpression | import("estree").FunctionExpression | import("estree").Identifier | import("estree").ImportExpression | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").BigIntLiteral | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").MetaProperty | import("estree").ObjectExpression | import("estree").SequenceExpression | import("estree").TaggedTemplateExpression | import("estree").TemplateLiteral | import("estree").ThisExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").YieldExpression | import("estree").FunctionDeclaration | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").PrivateIdentifier | import("estree").Program | import("estree").PropertyDefinition | import("estree").SpreadElement | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").StaticBlock | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").Super | import("estree").SwitchCase | import("estree").TemplateElement | import("estree").VariableDeclarator;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isTrailingSurrogate(charCode) {
|
||||
return typeof charCode === 'number' && charCode >= 0xDC00 && charCode <= 0xDFFF;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./xor');
|
||||
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const substringLength = substring.length;
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||
endIndex = index + substringLength;
|
||||
index = string.indexOf(substring, endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
const gotCR = string[index - 1] === '\r';
|
||||
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||
endIndex = index + 1;
|
||||
index = string.indexOf('\n', endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
# mute-stream
|
||||
|
||||
Bytes go in, but they don't come out (when muted).
|
||||
|
||||
This is a basic pass-through stream, but when muted, the bytes are
|
||||
silently dropped, rather than being passed through.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var MuteStream = require('mute-stream')
|
||||
|
||||
var ms = new MuteStream(options)
|
||||
|
||||
ms.pipe(process.stdout)
|
||||
ms.write('foo') // writes 'foo' to stdout
|
||||
ms.mute()
|
||||
ms.write('bar') // does not write 'bar'
|
||||
ms.unmute()
|
||||
ms.write('baz') // writes 'baz' to stdout
|
||||
|
||||
// can also be used to mute incoming data
|
||||
var ms = new MuteStream
|
||||
input.pipe(ms)
|
||||
|
||||
ms.on('data', function (c) {
|
||||
console.log('data: ' + c)
|
||||
})
|
||||
|
||||
input.emit('data', 'foo') // logs 'foo'
|
||||
ms.mute()
|
||||
input.emit('data', 'bar') // does not log 'bar'
|
||||
ms.unmute()
|
||||
input.emit('data', 'baz') // logs 'baz'
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
All options are optional.
|
||||
|
||||
* `replace` Set to a string to replace each character with the
|
||||
specified string when muted. (So you can show `****` instead of the
|
||||
password, for example.)
|
||||
|
||||
* `prompt` If you are using a replacement char, and also using a
|
||||
prompt with a readline stream (as for a `Password: *****` input),
|
||||
then specify what the prompt is so that backspace will work
|
||||
properly. Otherwise, pressing backspace will overwrite the prompt
|
||||
with the replacement character, which is weird.
|
||||
|
||||
## ms.mute()
|
||||
|
||||
Set `muted` to `true`. Turns `.write()` into a no-op.
|
||||
|
||||
## ms.unmute()
|
||||
|
||||
Set `muted` to `false`
|
||||
|
||||
## ms.isTTY
|
||||
|
||||
True if the pipe destination is a TTY, or if the incoming pipe source is
|
||||
a TTY.
|
||||
|
||||
## Other stream methods...
|
||||
|
||||
The other standard readable and writable stream methods are all
|
||||
available. The MuteStream object acts as a facade to its pipe source
|
||||
and destination.
|
||||
@@ -0,0 +1,6 @@
|
||||
import assertString from './util/assertString';
|
||||
var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
||||
export default function isSurrogatePair(str) {
|
||||
assertString(str);
|
||||
return surrogatePair.test(str);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(String.prototype, "startsWith", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dateRange.js","sourceRoot":"","sources":["../src/dateRange.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;;AAEH,SAAwB,SAAS;IAChC,sBAAsB;IACtB,OAAO,KAAK,CAAC;AACd,CAAC;AAHD,4BAGC"}
|
||||
@@ -0,0 +1,267 @@
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { Subject } from '../Subject';
|
||||
import { SafeSubscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { MonoTypeOperatorFunction, SubjectLike, ObservableInput } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
|
||||
export interface ShareConfig<T> {
|
||||
/**
|
||||
* The factory used to create the subject that will connect the source observable to
|
||||
* multicast consumers.
|
||||
*/
|
||||
connector?: () => SubjectLike<T>;
|
||||
/**
|
||||
* If `true`, the resulting observable will reset internal state on error from source and return to a "cold" state. This
|
||||
* allows the resulting observable to be "retried" in the event of an error.
|
||||
* If `false`, when an error comes from the source it will push the error into the connecting subject, and the subject
|
||||
* will remain the connecting subject, meaning the resulting observable will not go "cold" again, and subsequent retries
|
||||
* or resubscriptions will resubscribe to that same subject. In all cases, RxJS subjects will emit the same error again, however
|
||||
* {@link ReplaySubject} will also push its buffered values before pushing the error.
|
||||
* It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
|
||||
* control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
|
||||
*/
|
||||
resetOnError?: boolean | ((error: any) => ObservableInput<any>);
|
||||
/**
|
||||
* If `true`, the resulting observable will reset internal state on completion from source and return to a "cold" state. This
|
||||
* allows the resulting observable to be "repeated" after it is done.
|
||||
* If `false`, when the source completes, it will push the completion through the connecting subject, and the subject
|
||||
* will remain the connecting subject, meaning the resulting observable will not go "cold" again, and subsequent repeats
|
||||
* or resubscriptions will resubscribe to that same subject.
|
||||
* It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
|
||||
* control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
|
||||
*/
|
||||
resetOnComplete?: boolean | (() => ObservableInput<any>);
|
||||
/**
|
||||
* If `true`, when the number of subscribers to the resulting observable reaches zero due to those subscribers unsubscribing, the
|
||||
* internal state will be reset and the resulting observable will return to a "cold" state. This means that the next
|
||||
* time the resulting observable is subscribed to, a new subject will be created and the source will be subscribed to
|
||||
* again.
|
||||
* If `false`, when the number of subscribers to the resulting observable reaches zero due to unsubscription, the subject
|
||||
* will remain connected to the source, and new subscriptions to the result will be connected through that same subject.
|
||||
* It is also possible to pass a notifier factory returning an `ObservableInput` instead which grants more fine-grained
|
||||
* control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.
|
||||
*/
|
||||
resetOnRefCountZero?: boolean | (() => ObservableInput<any>);
|
||||
}
|
||||
|
||||
export function share<T>(): MonoTypeOperatorFunction<T>;
|
||||
|
||||
export function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;
|
||||
|
||||
/**
|
||||
* Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
|
||||
* Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
|
||||
* unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
|
||||
* This is an alias for `multicast(() => new Subject()), refCount()`.
|
||||
*
|
||||
* The subscription to the underlying source Observable can be reset (unsubscribe and resubscribe for new subscribers),
|
||||
* if the subscriber count to the shared observable drops to 0, or if the source Observable errors or completes. It is
|
||||
* possible to use notifier factories for the resets to allow for behaviors like conditional or delayed resets. Please
|
||||
* note that resetting on error or complete of the source Observable does not behave like a transparent retry or restart
|
||||
* of the source because the error or complete will be forwarded to all subscribers and their subscription will be
|
||||
* closed. Only new subscribers after a reset on error or complete happened will cause a fresh subscription to the
|
||||
* source. To achieve transparent retries or restarts pipe the source through appropriate operators before sharing.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Generate new multicast Observable from the `source` Observable value
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, tap, map, take, share } from 'rxjs';
|
||||
*
|
||||
* const source = interval(1000).pipe(
|
||||
* tap(x => console.log('Processing: ', x)),
|
||||
* map(x => x * x),
|
||||
* take(6),
|
||||
* share()
|
||||
* );
|
||||
*
|
||||
* source.subscribe(x => console.log('subscription 1: ', x));
|
||||
* source.subscribe(x => console.log('subscription 2: ', x));
|
||||
*
|
||||
* // Logs:
|
||||
* // Processing: 0
|
||||
* // subscription 1: 0
|
||||
* // subscription 2: 0
|
||||
* // Processing: 1
|
||||
* // subscription 1: 1
|
||||
* // subscription 2: 1
|
||||
* // Processing: 2
|
||||
* // subscription 1: 4
|
||||
* // subscription 2: 4
|
||||
* // Processing: 3
|
||||
* // subscription 1: 9
|
||||
* // subscription 2: 9
|
||||
* // Processing: 4
|
||||
* // subscription 1: 16
|
||||
* // subscription 2: 16
|
||||
* // Processing: 5
|
||||
* // subscription 1: 25
|
||||
* // subscription 2: 25
|
||||
* ```
|
||||
*
|
||||
* ## Example with notifier factory: Delayed reset
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, take, share, timer } from 'rxjs';
|
||||
*
|
||||
* const source = interval(1000).pipe(
|
||||
* take(3),
|
||||
* share({
|
||||
* resetOnRefCountZero: () => timer(1000)
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* const subscriptionOne = source.subscribe(x => console.log('subscription 1: ', x));
|
||||
* setTimeout(() => subscriptionOne.unsubscribe(), 1300);
|
||||
*
|
||||
* setTimeout(() => source.subscribe(x => console.log('subscription 2: ', x)), 1700);
|
||||
*
|
||||
* setTimeout(() => source.subscribe(x => console.log('subscription 3: ', x)), 5000);
|
||||
*
|
||||
* // Logs:
|
||||
* // subscription 1: 0
|
||||
* // (subscription 1 unsubscribes here)
|
||||
* // (subscription 2 subscribes here ~400ms later, source was not reset)
|
||||
* // subscription 2: 1
|
||||
* // subscription 2: 2
|
||||
* // (subscription 2 unsubscribes here)
|
||||
* // (subscription 3 subscribes here ~2000ms later, source did reset before)
|
||||
* // subscription 3: 0
|
||||
* // subscription 3: 1
|
||||
* // subscription 3: 2
|
||||
* ```
|
||||
*
|
||||
* @see {@link shareReplay}
|
||||
*
|
||||
* @return A function that returns an Observable that mirrors the source.
|
||||
*/
|
||||
export function share<T>(options: ShareConfig<T> = {}): MonoTypeOperatorFunction<T> {
|
||||
const { connector = () => new Subject<T>(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options;
|
||||
// It's necessary to use a wrapper here, as the _operator_ must be
|
||||
// referentially transparent. Otherwise, it cannot be used in calls to the
|
||||
// static `pipe` function - to create a partial pipeline.
|
||||
//
|
||||
// The _operator function_ - the function returned by the _operator_ - will
|
||||
// not be referentially transparent - as it shares its source - but the
|
||||
// _operator function_ is called when the complete pipeline is composed via a
|
||||
// call to a source observable's `pipe` method - not when the static `pipe`
|
||||
// function is called.
|
||||
return (wrapperSource) => {
|
||||
let connection: SafeSubscriber<T> | undefined;
|
||||
let resetConnection: Subscription | undefined;
|
||||
let subject: SubjectLike<T> | undefined;
|
||||
let refCount = 0;
|
||||
let hasCompleted = false;
|
||||
let hasErrored = false;
|
||||
|
||||
const cancelReset = () => {
|
||||
resetConnection?.unsubscribe();
|
||||
resetConnection = undefined;
|
||||
};
|
||||
// Used to reset the internal state to a "cold"
|
||||
// state, as though it had never been subscribed to.
|
||||
const reset = () => {
|
||||
cancelReset();
|
||||
connection = subject = undefined;
|
||||
hasCompleted = hasErrored = false;
|
||||
};
|
||||
const resetAndUnsubscribe = () => {
|
||||
// We need to capture the connection before
|
||||
// we reset (if we need to reset).
|
||||
const conn = connection;
|
||||
reset();
|
||||
conn?.unsubscribe();
|
||||
};
|
||||
|
||||
return operate<T, T>((source, subscriber) => {
|
||||
refCount++;
|
||||
if (!hasErrored && !hasCompleted) {
|
||||
cancelReset();
|
||||
}
|
||||
|
||||
// Create the subject if we don't have one yet. Grab a local reference to
|
||||
// it as well, which avoids non-null assertions when using it and, if we
|
||||
// connect to it now, then error/complete need a reference after it was
|
||||
// reset.
|
||||
const dest = (subject = subject ?? connector());
|
||||
|
||||
// Add the finalization directly to the subscriber - instead of returning it -
|
||||
// so that the handling of the subscriber's unsubscription will be wired
|
||||
// up _before_ the subscription to the source occurs. This is done so that
|
||||
// the assignment to the source connection's `closed` property will be seen
|
||||
// by synchronous firehose sources.
|
||||
subscriber.add(() => {
|
||||
refCount--;
|
||||
|
||||
// If we're resetting on refCount === 0, and it's 0, we only want to do
|
||||
// that on "unsubscribe", really. Resetting on error or completion is a different
|
||||
// configuration.
|
||||
if (refCount === 0 && !hasErrored && !hasCompleted) {
|
||||
resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
|
||||
}
|
||||
});
|
||||
|
||||
// The following line adds the subscription to the subscriber passed.
|
||||
// Basically, `subscriber === dest.subscribe(subscriber)` is `true`.
|
||||
dest.subscribe(subscriber);
|
||||
|
||||
if (
|
||||
!connection &&
|
||||
// Check this shareReplay is still activate - it can be reset to 0
|
||||
// and be "unsubscribed" _before_ it actually subscribes.
|
||||
// If we were to subscribe then, it'd leak and get stuck.
|
||||
refCount > 0
|
||||
) {
|
||||
// We need to create a subscriber here - rather than pass an observer and
|
||||
// assign the returned subscription to connection - because it's possible
|
||||
// for reentrant subscriptions to the shared observable to occur and in
|
||||
// those situations we want connection to be already-assigned so that we
|
||||
// don't create another connection to the source.
|
||||
connection = new SafeSubscriber({
|
||||
next: (value) => dest.next(value),
|
||||
error: (err) => {
|
||||
hasErrored = true;
|
||||
cancelReset();
|
||||
resetConnection = handleReset(reset, resetOnError, err);
|
||||
dest.error(err);
|
||||
},
|
||||
complete: () => {
|
||||
hasCompleted = true;
|
||||
cancelReset();
|
||||
resetConnection = handleReset(reset, resetOnComplete);
|
||||
dest.complete();
|
||||
},
|
||||
});
|
||||
innerFrom(source).subscribe(connection);
|
||||
}
|
||||
})(wrapperSource);
|
||||
};
|
||||
}
|
||||
|
||||
function handleReset<T extends unknown[] = never[]>(
|
||||
reset: () => void,
|
||||
on: boolean | ((...args: T) => ObservableInput<any>),
|
||||
...args: T
|
||||
): Subscription | undefined {
|
||||
if (on === true) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (on === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
const onSubscriber = new SafeSubscriber({
|
||||
next: () => {
|
||||
onSubscriber.unsubscribe();
|
||||
reset();
|
||||
},
|
||||
});
|
||||
|
||||
return innerFrom(on(...args)).subscribe(onSubscriber);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const babylon = require('babylon');
|
||||
const generate = require('babel-generator').default;
|
||||
const traverse = require('babel-traverse').default;
|
||||
|
||||
const INDENT_REGEXP = /^((?: )+)/gmu;
|
||||
/** @param {string} match */
|
||||
const INDENT_REPLACER = match => {
|
||||
return '\t'.repeat(match.length >>> 1);
|
||||
};
|
||||
|
||||
/** @param {string} body */
|
||||
const defaultsTemplate = body => `\
|
||||
// Generated with \`lib/make.js\`
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const temp = os.tmpdir();
|
||||
const uidOrPid = process.getuid ? process.getuid() : process.pid;
|
||||
const hasUnicode = () => true;
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
const osenv = {
|
||||
editor: () => process.env.EDITOR || process.env.VISUAL || (isWindows ? 'notepad.exe' : 'vi'),
|
||||
shell: () => isWindows ? (process.env.COMSPEC || 'cmd.exe') : (process.env.SHELL || '/bin/bash')
|
||||
};
|
||||
|
||||
const umask = {
|
||||
fromString: () => process.umask()
|
||||
};
|
||||
|
||||
let home = os.homedir();
|
||||
|
||||
if (home) {
|
||||
process.env.HOME = home;
|
||||
} else {
|
||||
home = path.resolve(temp, 'npm-' + uidOrPid);
|
||||
}
|
||||
|
||||
const cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm';
|
||||
const cacheRoot = process.platform === 'win32' ? process.env.APPDATA : home;
|
||||
const cache = path.resolve(cacheRoot, cacheExtra);
|
||||
|
||||
let defaults;
|
||||
let globalPrefix;
|
||||
|
||||
${body.replace(INDENT_REGEXP, INDENT_REPLACER).replace("'node-version': process.version,", '// We remove node-version to fix the issue described here: https://github.com/pnpm/pnpm/issues/4203#issuecomment-1133872769')};
|
||||
`;
|
||||
|
||||
/** @param {string} body */
|
||||
const typesTemplate = body => `\
|
||||
// Generated with \`lib/make.js\`
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const Stream = require('stream').Stream;
|
||||
const url = require('url');
|
||||
|
||||
const Umask = () => {};
|
||||
const getLocalAddresses = () => [];
|
||||
const semver = () => {};
|
||||
|
||||
${body.replace(INDENT_REGEXP, INDENT_REPLACER)};
|
||||
`;
|
||||
|
||||
const defaults = require.resolve('npm/lib/config/defaults');
|
||||
const ast = babylon.parse(fs.readFileSync(defaults, 'utf8'));
|
||||
|
||||
const isDefaults = node =>
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.object.name === 'Object' &&
|
||||
node.callee.property.name === 'defineProperty' &&
|
||||
node.arguments.some(x => x.name === 'exports');
|
||||
|
||||
const isTypes = node =>
|
||||
node.type === 'MemberExpression' &&
|
||||
node.object.name === 'exports' &&
|
||||
node.property.name === 'types';
|
||||
|
||||
let defs;
|
||||
let types;
|
||||
|
||||
traverse(ast, {
|
||||
CallExpression(path) {
|
||||
if (isDefaults(path.node)) {
|
||||
defs = path.node;
|
||||
}
|
||||
},
|
||||
AssignmentExpression(path) {
|
||||
if (path.node.left && isTypes(path.node.left)) {
|
||||
types = path.node;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, 'defaults.js'), defaultsTemplate(generate(defs).code));
|
||||
fs.writeFileSync(path.join(__dirname, 'types.js'), typesTemplate(generate(types).code));
|
||||
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, ensureDate = require("../../date/ensure");
|
||||
|
||||
describe("date/ensure", function () {
|
||||
it("Should return input value", function () {
|
||||
var value = new Date();
|
||||
assert.equal(ensureDate(value), value);
|
||||
});
|
||||
it("Should crash on invalid value", function () {
|
||||
try {
|
||||
ensureDate(null);
|
||||
throw new Error("Unexpected");
|
||||
} catch (error) {
|
||||
assert.equal(error.name, "TypeError");
|
||||
assert(error.message.includes("is not a date object"));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import type {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {RequireAtLeastOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text?: () => string;
|
||||
json?: () => string;
|
||||
|
||||
secure?: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
|
||||
@category Object
|
||||
*/
|
||||
export type RequireAtLeastOne<
|
||||
ObjectType,
|
||||
KeysType extends keyof ObjectType = keyof ObjectType,
|
||||
> = {
|
||||
// For each `Key` in `KeysType` make a mapped type:
|
||||
[Key in KeysType]-?: Required<Pick<ObjectType, Key>> & // 1. Make `Key`'s type required
|
||||
// 2. Make all other keys in `KeysType` optional
|
||||
Partial<Pick<ObjectType, Exclude<KeysType, Key>>>;
|
||||
}[KeysType] &
|
||||
// 3. Add the remaining keys not in `KeysType`
|
||||
Except<ObjectType, KeysType>;
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[1250] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚<EFBFBD>„…†‡<E280A0>‰Š‹ŚŤŽŹ<C5BD>‘’“”•–—<E28093>™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,384 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { identity } from '../util/identity';
|
||||
import { ObservableInput, SchedulerLike } from '../types';
|
||||
import { isScheduler } from '../util/isScheduler';
|
||||
import { defer } from './defer';
|
||||
import { scheduleIterable } from '../scheduled/scheduleIterable';
|
||||
|
||||
type ConditionFunc<S> = (state: S) => boolean;
|
||||
type IterateFunc<S> = (state: S) => S;
|
||||
type ResultFunc<S, T> = (state: S) => T;
|
||||
|
||||
export interface GenerateBaseOptions<S> {
|
||||
/**
|
||||
* Initial state.
|
||||
*/
|
||||
initialState: S;
|
||||
/**
|
||||
* Condition function that accepts state and returns boolean.
|
||||
* When it returns false, the generator stops.
|
||||
* If not specified, a generator never stops.
|
||||
*/
|
||||
condition?: ConditionFunc<S>;
|
||||
/**
|
||||
* Iterate function that accepts state and returns new state.
|
||||
*/
|
||||
iterate: IterateFunc<S>;
|
||||
/**
|
||||
* SchedulerLike to use for generation process.
|
||||
* By default, a generator starts immediately.
|
||||
*/
|
||||
scheduler?: SchedulerLike;
|
||||
}
|
||||
|
||||
export interface GenerateOptions<T, S> extends GenerateBaseOptions<S> {
|
||||
/**
|
||||
* Result selection function that accepts state and returns a value to emit.
|
||||
*/
|
||||
resultSelector: ResultFunc<S, T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Produces sequence of numbers
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate(0, x => x < 3, x => x + 1, x => x);
|
||||
*
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1
|
||||
* // 2
|
||||
* ```
|
||||
*
|
||||
* Use `asapScheduler`
|
||||
*
|
||||
* ```ts
|
||||
* import { generate, asapScheduler } from 'rxjs';
|
||||
*
|
||||
* const result = generate(1, x => x < 5, x => x * 2, x => x + 1, asapScheduler);
|
||||
*
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Logs:
|
||||
* // 2
|
||||
* // 3
|
||||
* // 5
|
||||
* ```
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link Observable}
|
||||
*
|
||||
* @param {S} initialState Initial state.
|
||||
* @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).
|
||||
* @param {function (state: S): S} iterate Iteration step function.
|
||||
* @param {function (state: S): T} resultSelector Selector function for results produced in the sequence. (deprecated)
|
||||
* @param {SchedulerLike} [scheduler] A {@link SchedulerLike} on which to run the generator loop. If not provided, defaults to emit immediately.
|
||||
* @returns {Observable<T>} The generated sequence.
|
||||
* @deprecated Instead of passing separate arguments, use the options argument. Signatures taking separate arguments will be removed in v8.
|
||||
*/
|
||||
export function generate<T, S>(
|
||||
initialState: S,
|
||||
condition: ConditionFunc<S>,
|
||||
iterate: IterateFunc<S>,
|
||||
resultSelector: ResultFunc<S, T>,
|
||||
scheduler?: SchedulerLike
|
||||
): Observable<T>;
|
||||
|
||||
/**
|
||||
* Generates an Observable by running a state-driven loop
|
||||
* that emits an element on each iteration.
|
||||
*
|
||||
* <span class="informal">Use it instead of nexting values in a for loop.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `generate` allows you to create a stream of values generated with a loop very similar to
|
||||
* a traditional for loop. The first argument of `generate` is a beginning value. The second argument
|
||||
* is a function that accepts this value and tests if some condition still holds. If it does,
|
||||
* then the loop continues, if not, it stops. The third value is a function which takes the
|
||||
* previously defined value and modifies it in some way on each iteration. Note how these three parameters
|
||||
* are direct equivalents of three expressions in a traditional for loop: the first expression
|
||||
* initializes some state (for example, a numeric index), the second tests if the loop can perform the next
|
||||
* iteration (for example, if the index is lower than 10) and the third states how the defined value
|
||||
* will be modified on every step (for example, the index will be incremented by one).
|
||||
*
|
||||
* Return value of a `generate` operator is an Observable that on each loop iteration
|
||||
* emits a value. First of all, the condition function is ran. If it returns true, then the Observable
|
||||
* emits the currently stored value (initial value at the first iteration) and finally updates
|
||||
* that value with iterate function. If at some point the condition returns false, then the Observable
|
||||
* completes at that moment.
|
||||
*
|
||||
* Optionally you can pass a fourth parameter to `generate` - a result selector function which allows you
|
||||
* to immediately map the value that would normally be emitted by an Observable.
|
||||
*
|
||||
* If you find three anonymous functions in `generate` call hard to read, you can provide
|
||||
* a single object to the operator instead where the object has the properties: `initialState`,
|
||||
* `condition`, `iterate` and `resultSelector`, which should have respective values that you
|
||||
* would normally pass to `generate`. `resultSelector` is still optional, but that form
|
||||
* of calling `generate` allows you to omit `condition` as well. If you omit it, that means
|
||||
* condition always holds, or in other words the resulting Observable will never complete.
|
||||
*
|
||||
* Both forms of `generate` can optionally accept a scheduler. In case of a multi-parameter call,
|
||||
* scheduler simply comes as a last argument (no matter if there is a `resultSelector`
|
||||
* function or not). In case of a single-parameter call, you can provide it as a
|
||||
* `scheduler` property on the object passed to the operator. In both cases, a scheduler decides when
|
||||
* the next iteration of the loop will happen and therefore when the next value will be emitted
|
||||
* by the Observable. For example, to ensure that each value is pushed to the Observer
|
||||
* on a separate task in the event loop, you could use the `async` scheduler. Note that
|
||||
* by default (when no scheduler is passed) values are simply emitted synchronously.
|
||||
*
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Use with condition and iterate functions
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate(0, x => x < 3, x => x + 1);
|
||||
*
|
||||
* result.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('Complete!')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1
|
||||
* // 2
|
||||
* // 'Complete!'
|
||||
* ```
|
||||
*
|
||||
* Use with condition, iterate and resultSelector functions
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate(0, x => x < 3, x => x + 1, x => x * 1000);
|
||||
*
|
||||
* result.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('Complete!')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1000
|
||||
* // 2000
|
||||
* // 'Complete!'
|
||||
* ```
|
||||
*
|
||||
* Use with options object
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate({
|
||||
* initialState: 0,
|
||||
* condition(value) { return value < 3; },
|
||||
* iterate(value) { return value + 1; },
|
||||
* resultSelector(value) { return value * 1000; }
|
||||
* });
|
||||
*
|
||||
* result.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('Complete!')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1000
|
||||
* // 2000
|
||||
* // 'Complete!'
|
||||
* ```
|
||||
*
|
||||
* Use options object without condition function
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate({
|
||||
* initialState: 0,
|
||||
* iterate(value) { return value + 1; },
|
||||
* resultSelector(value) { return value * 1000; }
|
||||
* });
|
||||
*
|
||||
* result.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('Complete!') // This will never run
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1000
|
||||
* // 2000
|
||||
* // 3000
|
||||
* // ...and never stops.
|
||||
* ```
|
||||
*
|
||||
* @see {@link from}
|
||||
*
|
||||
* @param {S} initialState Initial state.
|
||||
* @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).
|
||||
* @param {function (state: S): S} iterate Iteration step function.
|
||||
* @param {function (state: S): T} [resultSelector] Selector function for results produced in the sequence.
|
||||
* @param {Scheduler} [scheduler] A {@link Scheduler} on which to run the generator loop. If not provided, defaults to emitting immediately.
|
||||
* @return {Observable<T>} The generated sequence.
|
||||
* @deprecated Instead of passing separate arguments, use the options argument. Signatures taking separate arguments will be removed in v8.
|
||||
*/
|
||||
export function generate<S>(
|
||||
initialState: S,
|
||||
condition: ConditionFunc<S>,
|
||||
iterate: IterateFunc<S>,
|
||||
scheduler?: SchedulerLike
|
||||
): Observable<S>;
|
||||
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload accepts options object that might contain initial state, iterate,
|
||||
* condition and scheduler.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Use options object with condition function
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate({
|
||||
* initialState: 0,
|
||||
* condition: x => x < 3,
|
||||
* iterate: x => x + 1
|
||||
* });
|
||||
*
|
||||
* result.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('Complete!')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1
|
||||
* // 2
|
||||
* // 'Complete!'
|
||||
* ```
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link Observable}
|
||||
*
|
||||
* @param {GenerateBaseOptions<S>} options Object that must contain initialState, iterate and might contain condition and scheduler.
|
||||
* @returns {Observable<S>} The generated sequence.
|
||||
*/
|
||||
export function generate<S>(options: GenerateBaseOptions<S>): Observable<S>;
|
||||
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload accepts options object that might contain initial state, iterate,
|
||||
* condition, result selector and scheduler.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Use options object with condition and iterate function
|
||||
*
|
||||
* ```ts
|
||||
* import { generate } from 'rxjs';
|
||||
*
|
||||
* const result = generate({
|
||||
* initialState: 0,
|
||||
* condition: x => x < 3,
|
||||
* iterate: x => x + 1,
|
||||
* resultSelector: x => x
|
||||
* });
|
||||
*
|
||||
* result.subscribe({
|
||||
* next: value => console.log(value),
|
||||
* complete: () => console.log('Complete!')
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // 0
|
||||
* // 1
|
||||
* // 2
|
||||
* // 'Complete!'
|
||||
* ```
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link Observable}
|
||||
*
|
||||
* @param {GenerateOptions<T, S>} options Object that must contain initialState, iterate, resultSelector and might contain condition and scheduler.
|
||||
* @returns {Observable<T>} The generated sequence.
|
||||
*/
|
||||
export function generate<T, S>(options: GenerateOptions<T, S>): Observable<T>;
|
||||
|
||||
export function generate<T, S>(
|
||||
initialStateOrOptions: S | GenerateOptions<T, S>,
|
||||
condition?: ConditionFunc<S>,
|
||||
iterate?: IterateFunc<S>,
|
||||
resultSelectorOrScheduler?: ResultFunc<S, T> | SchedulerLike,
|
||||
scheduler?: SchedulerLike
|
||||
): Observable<T> {
|
||||
let resultSelector: ResultFunc<S, T>;
|
||||
let initialState: S;
|
||||
|
||||
// TODO: Remove this as we move away from deprecated signatures
|
||||
// and move towards a configuration object argument.
|
||||
if (arguments.length === 1) {
|
||||
// If we only have one argument, we can assume it is a configuration object.
|
||||
// Note that folks not using TypeScript may trip over this.
|
||||
({
|
||||
initialState,
|
||||
condition,
|
||||
iterate,
|
||||
resultSelector = identity as ResultFunc<S, T>,
|
||||
scheduler,
|
||||
} = initialStateOrOptions as GenerateOptions<T, S>);
|
||||
} else {
|
||||
// Deprecated arguments path. Figure out what the user
|
||||
// passed and set it here.
|
||||
initialState = initialStateOrOptions as S;
|
||||
if (!resultSelectorOrScheduler || isScheduler(resultSelectorOrScheduler)) {
|
||||
resultSelector = identity as ResultFunc<S, T>;
|
||||
scheduler = resultSelectorOrScheduler as SchedulerLike;
|
||||
} else {
|
||||
resultSelector = resultSelectorOrScheduler as ResultFunc<S, T>;
|
||||
}
|
||||
}
|
||||
|
||||
// The actual generator used to "generate" values.
|
||||
function* gen() {
|
||||
for (let state = initialState; !condition || condition(state); state = iterate!(state)) {
|
||||
yield resultSelector(state);
|
||||
}
|
||||
}
|
||||
|
||||
// We use `defer` because we want to defer the creation of the iterator from the iterable.
|
||||
return defer(
|
||||
(scheduler
|
||||
? // If a scheduler was provided, use `scheduleIterable` to ensure that iteration/generation
|
||||
// happens on the scheduler.
|
||||
() => scheduleIterable(gen(), scheduler!)
|
||||
: // Otherwise, if there's no scheduler, we can just use the generator function directly in
|
||||
// `defer` and executing it will return the generator (which is iterable).
|
||||
gen) as () => ObservableInput<T>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
var numExp = /^[0-9]+$/;
|
||||
module.exports = function (params) {
|
||||
var _param = {
|
||||
constructResult: true, //set to false to not construct result in memory. suitable for big csv data
|
||||
delimiter: ',', // change the delimiter of csv columns. It is able to use an array to specify potencial delimiters. e.g. [",","|",";"]
|
||||
ignoreColumns: [], // columns to ignore upon input.
|
||||
includeColumns: [], // columns to include upon input.
|
||||
quote: '"', //quote for a column containing delimiter.
|
||||
trim: true, //trim column's space charcters
|
||||
checkType: false, //whether check column type
|
||||
toArrayString: false, //stream down stringified json array instead of string of json. (useful if downstream is file writer etc)
|
||||
ignoreEmpty: false, //Ignore empty value while parsing. if a value of the column is empty, it will be skipped parsing.
|
||||
workerNum: getEnv("CSV_WORKER", 1), //number of parallel workers. If multi-core CPU available, increase the number will get better performance for large csv data.
|
||||
fork: false, //use another CPU core to convert the csv stream
|
||||
noheader: false, //indicate if first line of CSV file is header or not.
|
||||
headers: null, //an array of header strings. If noheader is false and headers is array, csv header will be ignored.
|
||||
flatKeys: false, // Don't interpret dots and square brackets in header fields as nested object or array identifiers at all.
|
||||
maxRowLength: 0, //the max character a csv row could have. 0 means infinite. If max number exceeded, parser will emit "error" of "row_exceed". if a possibly corrupted csv data provided, give it a number like 65535 so the parser wont consume memory. default: 0
|
||||
checkColumn: false, //whether check column number of a row is the same as headers. If column number mismatched headers number, an error of "mismatched_column" will be emitted.. default: false
|
||||
escape: '"', //escape char for quoted column
|
||||
colParser:{}, //flags on columns to alter field processing.
|
||||
|
||||
/**below are internal params */
|
||||
_columnConv:[],
|
||||
_headerType: [],
|
||||
_headerTitle: [],
|
||||
_headerFlag: [],
|
||||
_headers: null,
|
||||
_needFilterRow: false
|
||||
};
|
||||
if (!params) {
|
||||
params = {};
|
||||
}
|
||||
for (var key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
_param[key] = [].concat(params[key]);
|
||||
} else {
|
||||
_param[key] = params[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_param.ignoreColumns.length > 0 && !numExp.test(_param.ignoreColumns.join(""))) {
|
||||
_param._postIgnoreColumns = true;
|
||||
}
|
||||
if (_param.includeColumns.length > 0 && !numExp.test(_param.includeColumns.join(""))) {
|
||||
_param._postIncludeColumns = true;
|
||||
}
|
||||
|
||||
if (_param.ignoreColumns.length || _param.includeColumns.length) {
|
||||
_param._needFilterRow = true;
|
||||
if (!_param._postIgnoreColumns){
|
||||
_param.ignoreColumns.sort(function (a, b) { return b-a;});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return _param;
|
||||
};
|
||||
|
||||
function getEnv(key, def) {
|
||||
if (process.env[key]) {
|
||||
return process.env[key];
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('attempt', require('../attempt'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* This method returns the first argument it receives.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Util
|
||||
* @param {*} value Any value.
|
||||
* @returns {*} Returns `value`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1 };
|
||||
*
|
||||
* console.log(_.identity(object) === object);
|
||||
* // => true
|
||||
*/
|
||||
function identity(value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = identity;
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var coerceToInteger = require("../integer/coerce");
|
||||
|
||||
module.exports = function (value) {
|
||||
value = coerceToInteger(value);
|
||||
if (!value) return value;
|
||||
if (value < 0) return null;
|
||||
return value;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export { b as binary, f as floatTime, i as intTime, o as omap, p as pairs, s as set, t as timestamp, c as warnFileDeprecation } from './warnings-df54cb69.js';
|
||||
import './PlainValue-b8036b75.js';
|
||||
import './resolveSeq-492ab440.js';
|
||||
@@ -0,0 +1,70 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('$NODE_PATH', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var isDir = function (dir, cb) {
|
||||
if (dir === '/node_path' || dir === 'node_path/x') {
|
||||
return cb(null, true);
|
||||
}
|
||||
fs.stat(dir, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isDirectory());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
resolve('aaa', {
|
||||
paths: [
|
||||
path.join(__dirname, '/node_path/x'),
|
||||
path.join(__dirname, '/node_path/y')
|
||||
],
|
||||
basedir: __dirname,
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
t.error(err);
|
||||
t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves');
|
||||
});
|
||||
|
||||
resolve('bbb', {
|
||||
paths: [
|
||||
path.join(__dirname, '/node_path/x'),
|
||||
path.join(__dirname, '/node_path/y')
|
||||
],
|
||||
basedir: __dirname,
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
t.error(err);
|
||||
t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves');
|
||||
});
|
||||
|
||||
resolve('ccc', {
|
||||
paths: [
|
||||
path.join(__dirname, '/node_path/x'),
|
||||
path.join(__dirname, '/node_path/y')
|
||||
],
|
||||
basedir: __dirname,
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
t.error(err);
|
||||
t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves');
|
||||
});
|
||||
|
||||
// ensure that relative paths still resolve against the regular `node_modules` correctly
|
||||
resolve('tap', {
|
||||
paths: [
|
||||
'node_path'
|
||||
],
|
||||
basedir: path.join(__dirname, 'node_path/x'),
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
var root = require('tap/package.json').main; // eslint-disable-line global-require
|
||||
t.error(err);
|
||||
t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,141 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for util.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> util.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">75% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>3/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">25% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>1/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">66.67% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>2/3</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 medium'></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></td><td class="line-coverage quiet"><span class="cline-any cline-yes">322x</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-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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">25x</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">export function bufFromString(str: string): Buffer {
|
||||
const length = Buffer.byteLength(str);
|
||||
<span class="branch-1 cbranch-no" title="branch not covered" > const buffer = Buffer.a</span>llocUnsafe
|
||||
? Buffer.allocUnsafe(length)
|
||||
: new Buffer(length);
|
||||
buffer.write(str);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
<span class="cstat-no" title="statement not covered" >export function emptyBuffer(): Buffer{</span>
|
||||
const buffer = Buffer.allocUnsafe
|
||||
? Buffer.allocUnsafe(0)
|
||||
: new Buffer(0);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
export function filterArray(arr: any[], filter: number[]): any[] {
|
||||
const rtn: any[] = [];
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (filter.indexOf(i) > -1) {
|
||||
rtn.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu May 17 2018 01:25:26 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,29 @@
|
||||
var basePullAll = require('./_basePullAll');
|
||||
|
||||
/**
|
||||
* This method is like `_.pull` except that it accepts an array of values to remove.
|
||||
*
|
||||
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {Array} values The values to remove.
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
||||
*
|
||||
* _.pullAll(array, ['a', 'c']);
|
||||
* console.log(array);
|
||||
* // => ['b', 'b']
|
||||
*/
|
||||
function pullAll(array, values) {
|
||||
return (array && array.length && values && values.length)
|
||||
? basePullAll(array, values)
|
||||
: array;
|
||||
}
|
||||
|
||||
module.exports = pullAll;
|
||||
@@ -0,0 +1,216 @@
|
||||
/// <reference lib="dom" />
|
||||
|
||||
interface ImportMeta {
|
||||
url: string
|
||||
|
||||
readonly hot?: {
|
||||
readonly data: any
|
||||
|
||||
accept(): void
|
||||
accept(cb: (mod: any) => void): void
|
||||
accept(dep: string, cb: (mod: any) => void): void
|
||||
accept(deps: readonly string[], cb: (mods: any[]) => void): void
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
acceptDeps(): never
|
||||
|
||||
dispose(cb: (data: any) => void): void
|
||||
decline(): void
|
||||
invalidate(): void
|
||||
|
||||
on(event: string, cb: (...args: any[]) => void): void
|
||||
}
|
||||
|
||||
readonly env: ImportMetaEnv
|
||||
|
||||
glob(
|
||||
pattern: string
|
||||
): Record<
|
||||
string,
|
||||
() => Promise<{
|
||||
[key: string]: any
|
||||
}>
|
||||
>
|
||||
|
||||
globEager(
|
||||
pattern: string
|
||||
): Record<
|
||||
string,
|
||||
{
|
||||
[key: string]: any
|
||||
}
|
||||
>
|
||||
}
|
||||
interface ImportMetaEnv {
|
||||
[key: string]: string | boolean | undefined
|
||||
BASE_URL: string
|
||||
MODE: string
|
||||
DEV: boolean
|
||||
PROD: boolean
|
||||
}
|
||||
|
||||
// CSS modules
|
||||
type CSSModuleClasses = { readonly [key: string]: string }
|
||||
|
||||
declare module '*.module.css' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.scss' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.sass' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.less' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.styl' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.stylus' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
|
||||
// CSS
|
||||
declare module '*.css' {
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.scss' {
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.sass' {
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.less' {
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.styl' {
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.stylus' {
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
|
||||
// Built-in asset types
|
||||
// see `src/constants.ts`
|
||||
|
||||
// images
|
||||
declare module '*.jpg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.jpeg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.png' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.gif' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.svg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.ico' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.webp' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// media
|
||||
declare module '*.mp4' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.webm' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.ogg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.mp3' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.wav' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.flac' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.aac' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// fonts
|
||||
declare module '*.woff' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.woff2' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.eot' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.ttf' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.otf' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// web worker
|
||||
declare module '*?worker' {
|
||||
const workerConstructor: {
|
||||
new (): Worker
|
||||
}
|
||||
export default workerConstructor
|
||||
}
|
||||
|
||||
declare module '*?worker&inline' {
|
||||
const workerConstructor: {
|
||||
new (): Worker
|
||||
}
|
||||
export default workerConstructor
|
||||
}
|
||||
|
||||
declare module '*?raw' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module '*?url' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
vows = require 'vows'
|
||||
assert = require 'assert'
|
||||
util = require 'util'
|
||||
Netmask = require('../lib/netmask').Netmask
|
||||
|
||||
fixtures =
|
||||
[
|
||||
# addr mask base newmask bitmask
|
||||
['209.157.68.22/255.255.224.0', null, '209.157.64.0', '255.255.224.0', 19]
|
||||
['209.157.68.22', '255.255.224.0', '209.157.64.0', '255.255.224.0', 19]
|
||||
['209.157.70.33/19', null, '209.157.64.0', '255.255.224.0', 19]
|
||||
['209.157.70.33', null, '209.157.70.33', '255.255.255.255', 32]
|
||||
['140.174.82', null, '140.174.0.82', '255.255.255.255', 32]
|
||||
['140.174', null, '140.0.0.174', '255.255.255.255', 32]
|
||||
['10', null, '0.0.0.10', '255.255.255.255', 32]
|
||||
['10/8', null, '0.0.0.0', '255.0.0.0', 8]
|
||||
['209.157.64/19', null, '209.157.0.0', '255.255.224.0', 19]
|
||||
['216.140.48.16/32', null, '216.140.48.16', '255.255.255.255', 32]
|
||||
['209.157/17', null, '209.0.0.0', '255.255.128.0', 17]
|
||||
['0.0.0.0/0', null, '0.0.0.0', '0.0.0.0', 0]
|
||||
['0xffffffff', null, '255.255.255.255', '255.255.255.255', 32]
|
||||
['1.1', null, '1.0.0.1', '255.255.255.255', 32]
|
||||
['1.0xffffff', null, '1.255.255.255', '255.255.255.255', 32]
|
||||
['1.2.3', null, '1.2.0.3', '255.255.255.255', 32]
|
||||
['1.2.0xffff', null, '1.2.255.255', '255.255.255.255', 32]
|
||||
]
|
||||
|
||||
contexts = []
|
||||
|
||||
fixtures.forEach (fixture) ->
|
||||
[addr, mask, base, newmask, bitmask] = fixture
|
||||
context = topic: -> new Netmask(addr, mask)
|
||||
context["base is `#{base}'"] = (block) -> assert.equal block.base, base
|
||||
context["mask is `#{newmask}'"] = (block) -> assert.equal block.mask, newmask
|
||||
context["bitmask is `#{bitmask}'"] = (block) -> assert.equal block.bitmask, bitmask
|
||||
context["toString is `#{base}/`#{bitmask}'"] = (block) -> assert.equal block.toString(), block.base + "/" + block.bitmask
|
||||
contexts["for #{addr}" + (if mask then " with #{mask}" else '')] = context
|
||||
|
||||
vows.describe('Netmaks parsing').addBatch(contexts).export(module)
|
||||
|
||||
vows.describe('Netmask contains IP')
|
||||
.addBatch
|
||||
'block 192.168.1.0/24':
|
||||
topic: -> new Netmask('192.168.1.0/24')
|
||||
'contains IP 192.168.1.0': (block) -> assert.ok block.contains('192.168.1.0')
|
||||
'contains IP 192.168.1.255': (block) -> assert.ok block.contains('192.168.1.255')
|
||||
'contains IP 192.168.1.63': (block) -> assert.ok block.contains('192.168.1.63')
|
||||
'does not contain IP 192.168.0.255': (block) -> assert.ok not block.contains('192.168.0.255')
|
||||
'does not contain IP 192.168.2.0': (block) -> assert.ok not block.contains('192.168.2.0')
|
||||
'does not contain IP 10.168.2.0': (block) -> assert.ok not block.contains('10.168.2.0')
|
||||
'does not contain IP 209.168.2.0': (block) -> assert.ok not block.contains('209.168.2.0')
|
||||
'contains block 192.168.1.0/24': (block) -> assert.ok block.contains('192.168.1.0/24')
|
||||
'contains block 192.168.1 (0.192.168.10)': (block) -> assert.ok not block.contains('192.168.1')
|
||||
'does not contains block 192.168.1.128/25': (block) -> assert.ok block.contains('192.168.1.128/25')
|
||||
'does not contain block 192.168.1.0/23': (block) -> assert.ok not block.contains('192.168.1.0/23')
|
||||
'does not contain block 192.168.2.0/24': (block) -> assert.ok not block.contains('192.168.2.0/24')
|
||||
'toString equals 192.168.1.0/24': (block) -> assert.equal block.toString(), '192.168.1.0/24'
|
||||
'block 192.168.0.0/24':
|
||||
topic: -> new Netmask('192.168.0.0/24')
|
||||
'does not contain block 192.168 (0.0.192.168)': (block) -> assert.ok not block.contains('192.168')
|
||||
'does not contain block 192.168.0.0/16': (block) -> assert.ok not block.contains('192.168.0.0/16')
|
||||
'block 31.0.0.0/8':
|
||||
topic: -> new Netmask('31.0.0.0/8')
|
||||
'contains IP 31.5.5.5': (block) -> assert.ok block.contains('31.5.5.5')
|
||||
'does not contain IP 031.5.5.5 (25.5.5.5)': (block) -> assert.ok not block.contains('031.5.5.5')
|
||||
'does not contain IP 0x31.5.5.5 (49.5.5.5)': (block) -> assert.ok not block.contains('0x31.5.5.5')
|
||||
'does not contain IP 0X31.5.5.5 (49.5.5.5)': (block) -> assert.ok not block.contains('0X31.5.5.5')
|
||||
'block 127.0.0.0/8':
|
||||
topic: -> new Netmask('127.0.0.0/8')
|
||||
'contains IP 127.0.0.2': (block) -> assert.ok block.contains('127.0.0.2')
|
||||
'contains IP 0177.0.0.2 (127.0.0.2)': (block) -> assert.ok block.contains('0177.0.0.2')
|
||||
'contains IP 0x7f.0.0.2 (127.0.0.2)': (block) -> assert.ok block.contains('0x7f.0.0.2')
|
||||
'does not contains IP 127 (0.0.0.127)': (block) -> assert.ok not block.contains('127')
|
||||
'does not contains IP 0177 (0.0.0.127)': (block) -> assert.ok not block.contains('0177')
|
||||
'block 0.0.0.0/24':
|
||||
topic: -> new Netmask('0.0.0.0/0')
|
||||
'contains IP 0.0.0.0': (block) -> assert.ok block.contains('0.0.0.0')
|
||||
'contains IP 0': (block) -> assert.ok block.contains('0')
|
||||
'contains IP 10 (0.0.0.10)': (block) -> assert.ok block.contains('10')
|
||||
'contains IP 010 (0.0.0.8)': (block) -> assert.ok block.contains('010')
|
||||
'contains IP 0x10 (0.0.0.16)': (block) -> assert.ok block.contains('0x10')
|
||||
|
||||
.export(module)
|
||||
|
||||
vows.describe('Netmask forEach')
|
||||
.addBatch
|
||||
'block 192.168.1.0/24':
|
||||
topic: -> new Netmask('192.168.1.0/24')
|
||||
'should loop through all ip addresses': (block) ->
|
||||
called = 0
|
||||
block.forEach (ip, long, index) ->
|
||||
called = index
|
||||
assert.equal (called + 1), 254
|
||||
'block 192.168.1.0/23':
|
||||
topic: -> new Netmask('192.168.1.0/23')
|
||||
'should loop through all ip addresses': (block) ->
|
||||
called = 0
|
||||
block.forEach (ip, long, index) ->
|
||||
called = index
|
||||
assert.equal (called + 1), 510
|
||||
.export(module)
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"mute-stream","version":"0.0.8","files":{"LICENSE":{"checkedAt":1678883670198,"integrity":"sha512-P6dI5Z+zrwxSk1MIRPqpYG2ScYNkidLIATQXd50QzBgBh/XmcEd/nsd9NB4O9k6rfc+4dsY5DwJ7xvhpoS0PRg==","mode":420,"size":765},"mute.js":{"checkedAt":1678883671209,"integrity":"sha512-/pucUhtNFWvqq7js/ZCNyJEsMiCTEdAW/dDCSfoB4eYrDH/gV6S54zZxXIV3WrATzfB82n8W2lGt5zIOLKepVw==","mode":420,"size":3536},"package.json":{"checkedAt":1678883671209,"integrity":"sha512-UHuOwLYDiBpw3/doVV+xbvf0ehAvUQFhkV57cAIgHVfrU9CExZcXGvveZC6VmTFJBocnu1DFuqhOMoD7p7tG3Q==","mode":420,"size":556},"README.md":{"checkedAt":1678883671209,"integrity":"sha512-niR+YGyQVtXg7i+aRlk3tmm3TkWaXlOETG1fgYxj/mQQM42pJh0EG7mWFm2DrU0JJIcAhryC5dzwUdTIRzWqFg==","mode":420,"size":1653}}}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@pnpm/config.env-replace",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/index.js",
|
||||
"componentId": {
|
||||
"scope": "pnpm.config",
|
||||
"name": "env-replace",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "7.20.0",
|
||||
"@types/node": "12.20.4",
|
||||
"@types/jest": "26.0.20"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"license": "MIT",
|
||||
"private": false,
|
||||
"engines": {
|
||||
"node": ">=12.22.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pnpm/components"
|
||||
},
|
||||
"keywords": [],
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
# require-directory
|
||||
|
||||
Recursively iterates over specified directory, `require()`'ing each file, and returning a nested hash structure containing those modules.
|
||||
|
||||
**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)**
|
||||
|
||||
[](https://nodei.co/npm/require-directory/)
|
||||
|
||||
[](http://travis-ci.org/troygoode/node-require-directory)
|
||||
|
||||
## How To Use
|
||||
|
||||
### Installation (via [npm](https://npmjs.org/package/require-directory))
|
||||
|
||||
```bash
|
||||
$ npm install require-directory
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
A common pattern in node.js is to include an index file which creates a hash of the files in its current directory. Given a directory structure like so:
|
||||
|
||||
* app.js
|
||||
* routes/
|
||||
* index.js
|
||||
* home.js
|
||||
* auth/
|
||||
* login.js
|
||||
* logout.js
|
||||
* register.js
|
||||
|
||||
`routes/index.js` uses `require-directory` to build the hash (rather than doing so manually) like so:
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory');
|
||||
module.exports = requireDirectory(module);
|
||||
```
|
||||
|
||||
`app.js` references `routes/index.js` like any other module, but it now has a hash/tree of the exports from the `./routes/` directory:
|
||||
|
||||
```javascript
|
||||
var routes = require('./routes');
|
||||
|
||||
// snip
|
||||
|
||||
app.get('/', routes.home);
|
||||
app.get('/register', routes.auth.register);
|
||||
app.get('/login', routes.auth.login);
|
||||
app.get('/logout', routes.auth.logout);
|
||||
```
|
||||
|
||||
The `routes` variable above is the equivalent of this:
|
||||
|
||||
```javascript
|
||||
var routes = {
|
||||
home: require('routes/home.js'),
|
||||
auth: {
|
||||
login: require('routes/auth/login.js'),
|
||||
logout: require('routes/auth/logout.js'),
|
||||
register: require('routes/auth/register.js')
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
*Note that `routes.index` will be `undefined` as you would hope.*
|
||||
|
||||
### Specifying Another Directory
|
||||
|
||||
You can specify which directory you want to build a tree of (if it isn't the current directory for whatever reason) by passing it as the second parameter. Not specifying the path (`requireDirectory(module)`) is the equivelant of `requireDirectory(module, __dirname)`:
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory');
|
||||
module.exports = requireDirectory(module, './some/subdirectory');
|
||||
```
|
||||
|
||||
For example, in the [example in the Usage section](#usage) we could have avoided creating `routes/index.js` and instead changed the first lines of `app.js` to:
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory');
|
||||
var routes = requireDirectory(module, './routes');
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
You can pass an options hash to `require-directory` as the 2nd parameter (or 3rd if you're passing the path to another directory as the 2nd parameter already). Here are the available options:
|
||||
|
||||
### Whitelisting
|
||||
|
||||
Whitelisting (either via RegExp or function) allows you to specify that only certain files be loaded.
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
whitelist = /onlyinclude.js$/,
|
||||
hash = requireDirectory(module, {include: whitelist});
|
||||
```
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
check = function(path){
|
||||
if(/onlyinclude.js$/.test(path)){
|
||||
return true; // don't include
|
||||
}else{
|
||||
return false; // go ahead and include
|
||||
}
|
||||
},
|
||||
hash = requireDirectory(module, {include: check});
|
||||
```
|
||||
|
||||
### Blacklisting
|
||||
|
||||
Blacklisting (either via RegExp or function) allows you to specify that all but certain files should be loaded.
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
blacklist = /dontinclude\.js$/,
|
||||
hash = requireDirectory(module, {exclude: blacklist});
|
||||
```
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
check = function(path){
|
||||
if(/dontinclude\.js$/.test(path)){
|
||||
return false; // don't include
|
||||
}else{
|
||||
return true; // go ahead and include
|
||||
}
|
||||
},
|
||||
hash = requireDirectory(module, {exclude: check});
|
||||
```
|
||||
|
||||
### Visiting Objects As They're Loaded
|
||||
|
||||
`require-directory` takes a function as the `visit` option that will be called for each module that is added to module.exports.
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
visitor = function(obj) {
|
||||
console.log(obj); // will be called for every module that is loaded
|
||||
},
|
||||
hash = requireDirectory(module, {visit: visitor});
|
||||
```
|
||||
|
||||
The visitor can also transform the objects by returning a value:
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
visitor = function(obj) {
|
||||
return obj(new Date());
|
||||
},
|
||||
hash = requireDirectory(module, {visit: visitor});
|
||||
```
|
||||
|
||||
### Renaming Keys
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
renamer = function(name) {
|
||||
return name.toUpperCase();
|
||||
},
|
||||
hash = requireDirectory(module, {rename: renamer});
|
||||
```
|
||||
|
||||
### No Recursion
|
||||
|
||||
```javascript
|
||||
var requireDirectory = require('require-directory'),
|
||||
hash = requireDirectory(module, {recurse: false});
|
||||
```
|
||||
|
||||
## Run Unit Tests
|
||||
|
||||
```bash
|
||||
$ npm run lint
|
||||
$ npm test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
## Author
|
||||
|
||||
[Troy Goode](https://github.com/TroyGoode) ([troygoode@gmail.com](mailto:troygoode@gmail.com))
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AsyncScheduler.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/AsyncScheduler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAAyC;AAKzC;IAAoC,kCAAS;IAkB3C,wBAAY,eAA8B,EAAE,GAAiC;QAAjC,oBAAA,EAAA,MAAoB,qBAAS,CAAC,GAAG;QAA7E,YACE,kBAAM,eAAe,EAAE,GAAG,CAAC,SAC5B;QAnBM,aAAO,GAA4B,EAAE,CAAC;QAOtC,aAAO,GAAY,KAAK,CAAC;;IAYhC,CAAC;IAEM,8BAAK,GAAZ,UAAa,MAAwB;QAC3B,IAAA,OAAO,GAAK,IAAI,QAAT,CAAU;QAEzB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO;SACR;QAED,IAAI,KAAU,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,GAAG;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACxD,MAAM;aACP;SACF,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,EAAG,CAAC,EAAE;QAEtC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,EAAG,CAAC,EAAE;gBAClC,MAAM,CAAC,WAAW,EAAE,CAAC;aACtB;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAhDD,CAAoC,qBAAS,GAgD5C;AAhDY,wCAAc"}
|
||||
@@ -0,0 +1,6 @@
|
||||
module.exports = constructor;
|
||||
module.exports.Converter = require("./Converter.js");
|
||||
|
||||
function constructor(param,options) {
|
||||
return new module.exports.Converter(param, options);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
|
||||
/** @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)` */
|
||||
export declare function concatMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;
|
||||
/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */
|
||||
export declare function concatMapTo<O extends ObservableInput<unknown>>(observable: O, resultSelector: undefined): OperatorFunction<unknown, ObservedValueOf<O>>;
|
||||
/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */
|
||||
export declare function concatMapTo<T, R, O extends ObservableInput<unknown>>(observable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R): OperatorFunction<T, R>;
|
||||
//# sourceMappingURL=concatMapTo.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E CC","132":"F A B"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC","2":"DC tB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e QC RC SC qB AC TC rB","2":"F PC"},G:{"1":"E 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","2":"zB UC"},H:{"2":"oC"},I:{"1":"tB I f qC rC sC BC tC uC","2":"pC"},J:{"1":"D A"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"132":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:6,C:"TTF/OTF - TrueType and OpenType font support"};
|
||||
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("chai").assert
|
||||
, isArray = require("../../array/is");
|
||||
|
||||
describe("array/is", function () {
|
||||
it("Should return true on array", function () { assert.equal(isArray([]), true); });
|
||||
|
||||
it("Should return false on array with no common API exposed", function () {
|
||||
var value = [];
|
||||
value.push = null;
|
||||
assert.equal(isArray(value), false);
|
||||
});
|
||||
it("Should return false on Array.prototype", function () {
|
||||
assert.equal(isArray(Array.prototype), false);
|
||||
});
|
||||
|
||||
it("Should return false on plain object", function () { assert.equal(isArray({}), false); });
|
||||
it("Should return false on function", function () {
|
||||
assert.equal(isArray(function () { return true; }), false);
|
||||
});
|
||||
|
||||
if (typeof Object.create === "function") {
|
||||
it("Should return false on object with no prototype", function () {
|
||||
assert.equal(isArray(Object.create(null)), false);
|
||||
});
|
||||
}
|
||||
it("Should return false on string", function () { assert.equal(isArray("foo"), false); });
|
||||
it("Should return false on empty string", function () { assert.equal(isArray(""), false); });
|
||||
it("Should return false on number", function () { assert.equal(isArray(123), false); });
|
||||
it("Should return false on NaN", function () { assert.equal(isArray(NaN), false); });
|
||||
it("Should return false on boolean", function () { assert.equal(isArray(true), false); });
|
||||
if (typeof Symbol === "function") {
|
||||
it("Should return false on symbol", function () {
|
||||
assert.equal(isArray(Symbol("foo")), false);
|
||||
});
|
||||
}
|
||||
|
||||
it("Should return false on null", function () { assert.equal(isArray(null), false); });
|
||||
it("Should return false on undefined", function () { assert.equal(isArray(void 0), false); });
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var ToObject = require('./ToObject');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-getv
|
||||
|
||||
module.exports = function GetV(V, P) {
|
||||
// 7.3.2.1
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
||||
}
|
||||
|
||||
// 7.3.2.2-3
|
||||
var O = ToObject(V);
|
||||
|
||||
// 7.3.2.4
|
||||
return O[P];
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const util_1 = require("./util");
|
||||
/**
|
||||
* Resolves the given DNS hostname into an IP address, and returns it in the dot
|
||||
* separated format as a string.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ``` js
|
||||
* dnsResolve("home.netscape.com")
|
||||
* // returns the string "198.95.249.79".
|
||||
* ```
|
||||
*
|
||||
* @param {String} host hostname to resolve
|
||||
* @return {String} resolved IP address
|
||||
*/
|
||||
function dnsResolve(host) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const family = 4;
|
||||
try {
|
||||
const r = yield (0, util_1.dnsLookup)(host, { family });
|
||||
if (typeof r === 'string') {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// @ignore
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
exports.default = dnsResolve;
|
||||
//# sourceMappingURL=dnsResolve.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isFunction = void 0;
|
||||
function isFunction(value) {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
//# sourceMappingURL=isFunction.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","132":"J D E CC"},B:{"1":"L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","260":"C K"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","4":"DC tB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","4":"I"},E:{"1":"v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","4":"I HC zB"},F:{"1":"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 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","260":"F B C 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","16":"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:{"2":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:2,C:"CSS3 Cursors (original values)"};
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Hash, Input } from './utils.js';
|
||||
export declare abstract class SHA2<T extends SHA2<T>> extends Hash<T> {
|
||||
readonly blockLen: number;
|
||||
outputLen: number;
|
||||
readonly padOffset: number;
|
||||
readonly isLE: boolean;
|
||||
protected abstract process(buf: DataView, offset: number): void;
|
||||
protected abstract get(): number[];
|
||||
protected abstract set(...args: number[]): void;
|
||||
abstract destroy(): void;
|
||||
protected abstract roundClean(): void;
|
||||
protected buffer: Uint8Array;
|
||||
protected view: DataView;
|
||||
protected finished: boolean;
|
||||
protected length: number;
|
||||
protected pos: number;
|
||||
protected destroyed: boolean;
|
||||
constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean);
|
||||
update(data: Input): this;
|
||||
digestInto(out: Uint8Array): void;
|
||||
digest(): Uint8Array;
|
||||
_cloneInto(to?: T): T;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"name": "handlebars",
|
||||
"barename": "handlebars",
|
||||
"version": "4.7.7",
|
||||
"description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration",
|
||||
"homepage": "http://www.handlebarsjs.com/",
|
||||
"keywords": [
|
||||
"handlebars",
|
||||
"mustache",
|
||||
"template",
|
||||
"html"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wycats/handlebars.js.git"
|
||||
},
|
||||
"author": "Yehuda Katz",
|
||||
"license": "MIT",
|
||||
"readmeFilename": "README.md",
|
||||
"engines": {
|
||||
"node": ">=0.4.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5",
|
||||
"neo-async": "^2.6.0",
|
||||
"source-map": "^0.6.1",
|
||||
"wordwrap": "^1.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"uglify-js": "^3.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@knappi/grunt-saucelabs": "^9.0.2",
|
||||
"aws-sdk": "^2.1.49",
|
||||
"babel-loader": "^5.0.0",
|
||||
"babel-runtime": "^5.1.10",
|
||||
"benchmark": "~1.0",
|
||||
"chai": "^4.2.0",
|
||||
"chai-diff": "^1.0.1",
|
||||
"concurrently": "^5.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"dtslint": "^0.5.5",
|
||||
"dustjs-linkedin": "^2.0.2",
|
||||
"eco": "~1.1.0-rc-3",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-config-prettier": "^6.7.0",
|
||||
"eslint-plugin-compat": "^3.3.0",
|
||||
"eslint-plugin-es5": "^1.4.1",
|
||||
"fs-extra": "^8.1.0",
|
||||
"grunt": "^1.0.4",
|
||||
"grunt-babel": "^5.0.0",
|
||||
"grunt-bg-shell": "^2.3.3",
|
||||
"grunt-cli": "^1",
|
||||
"grunt-contrib-clean": "^1",
|
||||
"grunt-contrib-concat": "^1",
|
||||
"grunt-contrib-connect": "^1",
|
||||
"grunt-contrib-copy": "^1",
|
||||
"grunt-contrib-requirejs": "^1",
|
||||
"grunt-contrib-uglify": "^1",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-webpack": "^1.0.8",
|
||||
"husky": "^3.1.0",
|
||||
"jison": "~0.3.0",
|
||||
"lint-staged": "^9.5.0",
|
||||
"mocha": "^5",
|
||||
"mock-stdin": "^0.3.0",
|
||||
"mustache": "^2.1.3",
|
||||
"nyc": "^14.1.1",
|
||||
"prettier": "^1.19.1",
|
||||
"semver": "^5.0.1",
|
||||
"sinon": "^7.5.0",
|
||||
"typescript": "^3.4.3",
|
||||
"underscore": "^1.5.1",
|
||||
"webpack": "^1.12.6",
|
||||
"webpack-dev-server": "^1.12.1"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"types": "types/index.d.ts",
|
||||
"browser": {
|
||||
".": "./dist/cjs/handlebars.js",
|
||||
"./runtime": "./dist/cjs/handlebars.runtime.js"
|
||||
},
|
||||
"bin": {
|
||||
"handlebars": "bin/handlebars"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "prettier --write '**/*.js' && eslint --fix .",
|
||||
"check-format": "prettier --check '**/*.js'",
|
||||
"lint": "eslint --max-warnings 0 .",
|
||||
"dtslint": "dtslint types",
|
||||
"test": "grunt",
|
||||
"extensive-tests-and-publish-to-aws": "npx mocha tasks/task-tests/ && grunt --stack extensive-tests-and-publish-to-aws",
|
||||
"integration-test": "grunt integration-tests",
|
||||
"--- combined tasks ---": "",
|
||||
"check-before-pull-request": "concurrently --kill-others-on-fail npm:lint npm:dtslint npm:check-format npm:test"
|
||||
},
|
||||
"jspm": {
|
||||
"main": "handlebars",
|
||||
"directories": {
|
||||
"lib": "dist/amd"
|
||||
},
|
||||
"buildConfig": {
|
||||
"minify": true
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"dist/*.js",
|
||||
"dist/amd/**/*.js",
|
||||
"dist/cjs/**/*.js",
|
||||
"lib",
|
||||
"print-script",
|
||||
"release-notes.md",
|
||||
"runtime.js",
|
||||
"types/*.d.ts",
|
||||
"runtime.d.ts"
|
||||
],
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,css,json,md}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
],
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F CC","129":"A B"},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","129":"C K L G M N O"},C:{"2":"DC tB EC FC","129":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB"},D:{"1":"2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","16":"0 1 I v J D E F A B C K L x y z","129":"G M N O w g"},E:{"1":"J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"I v HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e TC rB","2":"F PC QC RC SC","16":"B qB AC"},G:{"1":"E VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB UC BC"},H:{"129":"oC"},I:{"1":"f tC uC","16":"pC qC","129":"tB I rC sC BC"},J:{"1":"D","129":"A"},K:{"1":"C h","2":"A","16":"B qB AC","129":"rB"},L:{"1":"H"},M:{"129":"H"},N:{"129":"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:{"129":"AD BD"}},B:1,C:"Search input type"};
|
||||
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
|
||||
test('has native Symbol support', function (t) {
|
||||
t.equal(typeof Symbol, 'function');
|
||||
t.equal(typeof Symbol(), 'symbol');
|
||||
t.end();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var hasSymbols = require('../../shams');
|
||||
|
||||
test('polyfilled Symbols', function (t) {
|
||||
/* eslint-disable global-require */
|
||||
t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling');
|
||||
require('core-js/fn/symbol');
|
||||
require('core-js/fn/symbol/to-string-tag');
|
||||
|
||||
require('../tests')(t);
|
||||
|
||||
var hasSymbolsAfter = hasSymbols();
|
||||
t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling');
|
||||
/* eslint-enable global-require */
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[1047] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\n\b\u0018\u0019\u001c\u001d\u001e\u001f
\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ¢.<(+|&éêëèíîïìß!$*);^-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ¤µ~stuvwxyz¡¿Ð[Þ®¬£¥·©§¶¼½¾Ý¨¯]´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
var assign = require("../object/assign")
|
||||
, isObject = require("../object/is-object")
|
||||
, isValue = require("../object/is-value")
|
||||
, captureStackTrace = Error.captureStackTrace;
|
||||
|
||||
module.exports = function (message /*, code, ext*/) {
|
||||
var err = new Error(message), code = arguments[1], ext = arguments[2];
|
||||
if (!isValue(ext)) {
|
||||
if (isObject(code)) {
|
||||
ext = code;
|
||||
code = null;
|
||||
}
|
||||
}
|
||||
if (isValue(ext)) assign(err, ext);
|
||||
if (isValue(code)) err.code = code;
|
||||
if (captureStackTrace) captureStackTrace(err, module.exports);
|
||||
return err;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('isMatch', require('../isMatch'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,58 @@
|
||||
import { ComponentChild } from 'preact';
|
||||
import Row from './row';
|
||||
import { SortConfig } from './view/plugin/sort/sort';
|
||||
import { JSXInternal } from 'preact/src/jsx';
|
||||
import { Plugin } from './plugin';
|
||||
export declare type ProtoExtends<T, U> = U & Omit<T, keyof U>;
|
||||
export declare type OneDArray<T> = T[];
|
||||
export declare type TwoDArray<T> = T[][];
|
||||
/**
|
||||
* Table cell types
|
||||
*/
|
||||
export declare type TCell =
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| ComponentChild
|
||||
| HTMLElement;
|
||||
export declare type TDataArrayRow = OneDArray<TCell>;
|
||||
export declare type TDataArray = OneDArray<TDataArrayRow>;
|
||||
export declare type TDataObjectRow = {
|
||||
[key: string]: TCell;
|
||||
};
|
||||
export declare type TDataObject = OneDArray<TDataObjectRow>;
|
||||
export declare type TData = TDataArray | TDataObject;
|
||||
export interface TColumn {
|
||||
id?: string;
|
||||
data?: ((row: TDataArrayRow | TDataObjectRow) => TCell) | TCell;
|
||||
name?: string | ComponentChild;
|
||||
plugin?: Plugin<any>;
|
||||
width?: string;
|
||||
sort?: SortConfig;
|
||||
columns?: OneDArray<TColumn>;
|
||||
fixedHeader?: boolean;
|
||||
hidden?: boolean;
|
||||
formatter?: (cell: TCell, row: Row, column: TColumn) => ComponentChild;
|
||||
attributes?:
|
||||
| ((
|
||||
cell: TCell | null,
|
||||
row: Row | null,
|
||||
column: TColumn,
|
||||
) => JSXInternal.HTMLAttributes<HTMLTableCellElement>)
|
||||
| JSXInternal.HTMLAttributes<HTMLTableCellElement>;
|
||||
}
|
||||
export declare type Comparator<T> = (a: T, b: T) => number;
|
||||
export interface TColumnSort {
|
||||
index: number;
|
||||
direction?: 1 | -1;
|
||||
}
|
||||
export declare enum Status {
|
||||
Init = 0,
|
||||
Loading = 1,
|
||||
Loaded = 2,
|
||||
Rendered = 3,
|
||||
Error = 4,
|
||||
}
|
||||
export declare type CSSDeclaration = {
|
||||
[key: string]: string | number;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export default function fuzzymatch(name: string, names: string[]): any;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').parallelLimit;
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, is = require("./is");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
if (is(value)) return value;
|
||||
return resolveException(value, "%v is not an error object", arguments[1]);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scheduleAsyncIterable.js","sourceRoot":"","sources":["../../../../src/internal/scheduled/scheduleAsyncIterable.ts"],"names":[],"mappings":";;;AACA,4CAA2C;AAC3C,2DAA0D;AAE1D,SAAgB,qBAAqB,CAAI,KAAuB,EAAE,SAAwB;IACxF,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;IACD,OAAO,IAAI,uBAAU,CAAI,UAAC,UAAU;QAClC,iCAAe,CAAC,UAAU,EAAE,SAAS,EAAE;YACrC,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/C,iCAAe,CACb,UAAU,EACV,SAAS,EACT;gBACE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,UAAC,MAAM;oBAC1B,IAAI,MAAM,CAAC,IAAI,EAAE;wBAGf,UAAU,CAAC,QAAQ,EAAE,CAAC;qBACvB;yBAAM;wBACL,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;qBAC/B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,EACD,CAAC,EACD,IAAI,CACL,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA1BD,sDA0BC"}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
||||
*
|
||||
* Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
module.exports = function(path, stripTrailing) {
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('expected path to be a string');
|
||||
}
|
||||
|
||||
if (path === '\\' || path === '/') return '/';
|
||||
|
||||
var len = path.length;
|
||||
if (len <= 1) return path;
|
||||
|
||||
// ensure that win32 namespaces has two leading slashes, so that the path is
|
||||
// handled properly by the win32 version of path.parse() after being normalized
|
||||
// https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
|
||||
var prefix = '';
|
||||
if (len > 4 && path[3] === '\\') {
|
||||
var ch = path[2];
|
||||
if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
|
||||
path = path.slice(2);
|
||||
prefix = '//';
|
||||
}
|
||||
}
|
||||
|
||||
var segs = path.split(/[/\\]+/);
|
||||
if (stripTrailing !== false && segs[segs.length - 1] === '') {
|
||||
segs.pop();
|
||||
}
|
||||
return prefix + segs.join('/');
|
||||
};
|
||||
Reference in New Issue
Block a user