new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
import { mergeMap } from './mergeMap';
|
||||
export const flatMap = mergeMap;
|
||||
//# sourceMappingURL=flatMap.js.map
|
||||
@@ -0,0 +1,221 @@
|
||||
import { __assign, __extends } from "tslib";
|
||||
import { Subject, AnonymousSubject } from '../../Subject';
|
||||
import { Subscriber } from '../../Subscriber';
|
||||
import { Observable } from '../../Observable';
|
||||
import { Subscription } from '../../Subscription';
|
||||
import { ReplaySubject } from '../../ReplaySubject';
|
||||
var DEFAULT_WEBSOCKET_CONFIG = {
|
||||
url: '',
|
||||
deserializer: function (e) { return JSON.parse(e.data); },
|
||||
serializer: function (value) { return JSON.stringify(value); },
|
||||
};
|
||||
var WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT = 'WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }';
|
||||
var WebSocketSubject = (function (_super) {
|
||||
__extends(WebSocketSubject, _super);
|
||||
function WebSocketSubject(urlConfigOrSource, destination) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this._socket = null;
|
||||
if (urlConfigOrSource instanceof Observable) {
|
||||
_this.destination = destination;
|
||||
_this.source = urlConfigOrSource;
|
||||
}
|
||||
else {
|
||||
var config = (_this._config = __assign({}, DEFAULT_WEBSOCKET_CONFIG));
|
||||
_this._output = new Subject();
|
||||
if (typeof urlConfigOrSource === 'string') {
|
||||
config.url = urlConfigOrSource;
|
||||
}
|
||||
else {
|
||||
for (var key in urlConfigOrSource) {
|
||||
if (urlConfigOrSource.hasOwnProperty(key)) {
|
||||
config[key] = urlConfigOrSource[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!config.WebSocketCtor && WebSocket) {
|
||||
config.WebSocketCtor = WebSocket;
|
||||
}
|
||||
else if (!config.WebSocketCtor) {
|
||||
throw new Error('no WebSocket constructor can be found');
|
||||
}
|
||||
_this.destination = new ReplaySubject();
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
WebSocketSubject.prototype.lift = function (operator) {
|
||||
var sock = new WebSocketSubject(this._config, this.destination);
|
||||
sock.operator = operator;
|
||||
sock.source = this;
|
||||
return sock;
|
||||
};
|
||||
WebSocketSubject.prototype._resetState = function () {
|
||||
this._socket = null;
|
||||
if (!this.source) {
|
||||
this.destination = new ReplaySubject();
|
||||
}
|
||||
this._output = new Subject();
|
||||
};
|
||||
WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) {
|
||||
var self = this;
|
||||
return new Observable(function (observer) {
|
||||
try {
|
||||
self.next(subMsg());
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
var subscription = self.subscribe({
|
||||
next: function (x) {
|
||||
try {
|
||||
if (messageFilter(x)) {
|
||||
observer.next(x);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
},
|
||||
error: function (err) { return observer.error(err); },
|
||||
complete: function () { return observer.complete(); },
|
||||
});
|
||||
return function () {
|
||||
try {
|
||||
self.next(unsubMsg());
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
};
|
||||
WebSocketSubject.prototype._connectSocket = function () {
|
||||
var _this = this;
|
||||
var _a = this._config, WebSocketCtor = _a.WebSocketCtor, protocol = _a.protocol, url = _a.url, binaryType = _a.binaryType;
|
||||
var observer = this._output;
|
||||
var socket = null;
|
||||
try {
|
||||
socket = protocol ? new WebSocketCtor(url, protocol) : new WebSocketCtor(url);
|
||||
this._socket = socket;
|
||||
if (binaryType) {
|
||||
this._socket.binaryType = binaryType;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
observer.error(e);
|
||||
return;
|
||||
}
|
||||
var subscription = new Subscription(function () {
|
||||
_this._socket = null;
|
||||
if (socket && socket.readyState === 1) {
|
||||
socket.close();
|
||||
}
|
||||
});
|
||||
socket.onopen = function (evt) {
|
||||
var _socket = _this._socket;
|
||||
if (!_socket) {
|
||||
socket.close();
|
||||
_this._resetState();
|
||||
return;
|
||||
}
|
||||
var openObserver = _this._config.openObserver;
|
||||
if (openObserver) {
|
||||
openObserver.next(evt);
|
||||
}
|
||||
var queue = _this.destination;
|
||||
_this.destination = Subscriber.create(function (x) {
|
||||
if (socket.readyState === 1) {
|
||||
try {
|
||||
var serializer = _this._config.serializer;
|
||||
socket.send(serializer(x));
|
||||
}
|
||||
catch (e) {
|
||||
_this.destination.error(e);
|
||||
}
|
||||
}
|
||||
}, function (err) {
|
||||
var closingObserver = _this._config.closingObserver;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
if (err && err.code) {
|
||||
socket.close(err.code, err.reason);
|
||||
}
|
||||
else {
|
||||
observer.error(new TypeError(WEBSOCKETSUBJECT_INVALID_ERROR_OBJECT));
|
||||
}
|
||||
_this._resetState();
|
||||
}, function () {
|
||||
var closingObserver = _this._config.closingObserver;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
socket.close();
|
||||
_this._resetState();
|
||||
});
|
||||
if (queue && queue instanceof ReplaySubject) {
|
||||
subscription.add(queue.subscribe(_this.destination));
|
||||
}
|
||||
};
|
||||
socket.onerror = function (e) {
|
||||
_this._resetState();
|
||||
observer.error(e);
|
||||
};
|
||||
socket.onclose = function (e) {
|
||||
if (socket === _this._socket) {
|
||||
_this._resetState();
|
||||
}
|
||||
var closeObserver = _this._config.closeObserver;
|
||||
if (closeObserver) {
|
||||
closeObserver.next(e);
|
||||
}
|
||||
if (e.wasClean) {
|
||||
observer.complete();
|
||||
}
|
||||
else {
|
||||
observer.error(e);
|
||||
}
|
||||
};
|
||||
socket.onmessage = function (e) {
|
||||
try {
|
||||
var deserializer = _this._config.deserializer;
|
||||
observer.next(deserializer(e));
|
||||
}
|
||||
catch (err) {
|
||||
observer.error(err);
|
||||
}
|
||||
};
|
||||
};
|
||||
WebSocketSubject.prototype._subscribe = function (subscriber) {
|
||||
var _this = this;
|
||||
var source = this.source;
|
||||
if (source) {
|
||||
return source.subscribe(subscriber);
|
||||
}
|
||||
if (!this._socket) {
|
||||
this._connectSocket();
|
||||
}
|
||||
this._output.subscribe(subscriber);
|
||||
subscriber.add(function () {
|
||||
var _socket = _this._socket;
|
||||
if (_this._output.observers.length === 0) {
|
||||
if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
|
||||
_socket.close();
|
||||
}
|
||||
_this._resetState();
|
||||
}
|
||||
});
|
||||
return subscriber;
|
||||
};
|
||||
WebSocketSubject.prototype.unsubscribe = function () {
|
||||
var _socket = this._socket;
|
||||
if (_socket && (_socket.readyState === 1 || _socket.readyState === 0)) {
|
||||
_socket.close();
|
||||
}
|
||||
this._resetState();
|
||||
_super.prototype.unsubscribe.call(this);
|
||||
};
|
||||
return WebSocketSubject;
|
||||
}(AnonymousSubject));
|
||||
export { WebSocketSubject };
|
||||
//# sourceMappingURL=WebSocketSubject.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"empty.js","sourceRoot":"","sources":["../../../../src/internal/observable/empty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiE3C,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;AAOlF,MAAM,UAAU,KAAK,CAAC,SAAyB;IAC7C,OAAO,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACvD,CAAC;AAED,SAAS,cAAc,CAAC,SAAwB;IAC9C,OAAO,IAAI,UAAU,CAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAChG,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../../../src/internal/Scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,SAAU,YAAW,aAAa;IAGjC,OAAO,CAAC,mBAAmB;IAFvC,OAAc,GAAG,EAAE,MAAM,MAAM,CAA6B;gBAExC,mBAAmB,EAAE,OAAO,MAAM,EAAE,GAAG,GAAE,MAAM,MAAsB;IAIzF;;;;;;;OAOG;IACI,GAAG,EAAE,MAAM,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;OAgBG;IACI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,KAAK,GAAE,MAAU,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,YAAY;CAGpH"}
|
||||
@@ -0,0 +1,65 @@
|
||||
type MapKey<BaseType> = BaseType extends Map<infer KeyType, unknown> ? KeyType : never;
|
||||
type MapValue<BaseType> = BaseType extends Map<unknown, infer ValueType> ? ValueType : never;
|
||||
|
||||
export type ArrayEntry<BaseType extends readonly unknown[]> = [number, BaseType[number]];
|
||||
export type MapEntry<BaseType> = [MapKey<BaseType>, MapValue<BaseType>];
|
||||
export type ObjectEntry<BaseType> = [keyof BaseType, BaseType[keyof BaseType]];
|
||||
export type SetEntry<BaseType> = BaseType extends Set<infer ItemType> ? [ItemType, ItemType] : never;
|
||||
|
||||
/**
|
||||
Many collections have an `entries` method which returns an array of a given object's own enumerable string-keyed property [key, value] pairs. The `Entry` type will return the type of that collection's entry.
|
||||
|
||||
For example the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`}, {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`}, and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`} collections all have this method. Note that `WeakMap` and `WeakSet` do not have this method since their entries are not enumerable.
|
||||
|
||||
@see `Entries` if you want to just access the type of the array of entries (which is the return of the `.entries()` method).
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Entry} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
someKey: number;
|
||||
}
|
||||
|
||||
const manipulatesEntry = (example: Entry<Example>) => [
|
||||
// Does some arbitrary processing on the key (with type information available)
|
||||
example[0].toUpperCase(),
|
||||
|
||||
// Does some arbitrary processing on the value (with type information available)
|
||||
example[1].toFixed(),
|
||||
];
|
||||
|
||||
const example: Example = {someKey: 1};
|
||||
const entry = Object.entries(example)[0] as Entry<Example>;
|
||||
const output = manipulatesEntry(entry);
|
||||
|
||||
// Objects
|
||||
const objectExample = {a: 1};
|
||||
const objectEntry: Entry<typeof objectExample> = ['a', 1];
|
||||
|
||||
// Arrays
|
||||
const arrayExample = ['a', 1];
|
||||
const arrayEntryString: Entry<typeof arrayExample> = [0, 'a'];
|
||||
const arrayEntryNumber: Entry<typeof arrayExample> = [1, 1];
|
||||
|
||||
// Maps
|
||||
const mapExample = new Map([['a', 1]]);
|
||||
const mapEntry: Entry<typeof mapExample> = ['a', 1];
|
||||
|
||||
// Sets
|
||||
const setExample = new Set(['a', 1]);
|
||||
const setEntryString: Entry<typeof setExample> = ['a', 'a'];
|
||||
const setEntryNumber: Entry<typeof setExample> = [1, 1];
|
||||
```
|
||||
|
||||
@category Object
|
||||
@category Map
|
||||
@category Array
|
||||
@category Set
|
||||
*/
|
||||
export type Entry<BaseType> =
|
||||
BaseType extends Map<unknown, unknown> ? MapEntry<BaseType>
|
||||
: BaseType extends Set<unknown> ? SetEntry<BaseType>
|
||||
: BaseType extends readonly unknown[] ? ArrayEntry<BaseType>
|
||||
: BaseType extends object ? ObjectEntry<BaseType>
|
||||
: never;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "ip",
|
||||
"version": "1.1.8",
|
||||
"author": "Fedor Indutny <fedor@indutny.com>",
|
||||
"homepage": "https://github.com/indutny/node-ip",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/indutny/node-ip.git"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md"
|
||||
],
|
||||
"main": "lib/ip",
|
||||
"devDependencies": {
|
||||
"eslint": "^8.15.0",
|
||||
"mocha": "^10.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib/*.js test/*.js",
|
||||
"test": "npm run lint && mocha --reporter spec test/*-test.js",
|
||||
"fix": "npm run lint -- --fix"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name" : "isarray",
|
||||
"description" : "Array#isArray for older browsers",
|
||||
"version" : "0.0.1",
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url" : "git://github.com/juliangruber/isarray.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main" : "index.js",
|
||||
"scripts" : {
|
||||
"test" : "tap test/*.js"
|
||||
},
|
||||
"dependencies" : {},
|
||||
"devDependencies" : {
|
||||
"tap" : "*"
|
||||
},
|
||||
"keywords": ["browser","isarray","array"],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
'use strict';
|
||||
|
||||
var undefined;
|
||||
|
||||
var $SyntaxError = SyntaxError;
|
||||
var $Function = Function;
|
||||
var $TypeError = TypeError;
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
var getEvalledConstructor = function (expressionSyntax) {
|
||||
try {
|
||||
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
var $gOPD = Object.getOwnPropertyDescriptor;
|
||||
if ($gOPD) {
|
||||
try {
|
||||
$gOPD({}, '');
|
||||
} catch (e) {
|
||||
$gOPD = null; // this is IE 8, which has a broken gOPD
|
||||
}
|
||||
}
|
||||
|
||||
var throwTypeError = function () {
|
||||
throw new $TypeError();
|
||||
};
|
||||
var ThrowTypeError = $gOPD
|
||||
? (function () {
|
||||
try {
|
||||
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
||||
arguments.callee; // IE 8 does not throw here
|
||||
return throwTypeError;
|
||||
} catch (calleeThrows) {
|
||||
try {
|
||||
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
||||
return $gOPD(arguments, 'callee').get;
|
||||
} catch (gOPDthrows) {
|
||||
return throwTypeError;
|
||||
}
|
||||
}
|
||||
}())
|
||||
: throwTypeError;
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
|
||||
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
|
||||
|
||||
var needsEval = {};
|
||||
|
||||
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
||||
|
||||
var INTRINSICS = {
|
||||
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
||||
'%Array%': Array,
|
||||
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
||||
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
||||
'%AsyncFromSyncIteratorPrototype%': undefined,
|
||||
'%AsyncFunction%': needsEval,
|
||||
'%AsyncGenerator%': needsEval,
|
||||
'%AsyncGeneratorFunction%': needsEval,
|
||||
'%AsyncIteratorPrototype%': needsEval,
|
||||
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
||||
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
||||
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
|
||||
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
|
||||
'%Boolean%': Boolean,
|
||||
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
||||
'%Date%': Date,
|
||||
'%decodeURI%': decodeURI,
|
||||
'%decodeURIComponent%': decodeURIComponent,
|
||||
'%encodeURI%': encodeURI,
|
||||
'%encodeURIComponent%': encodeURIComponent,
|
||||
'%Error%': Error,
|
||||
'%eval%': eval, // eslint-disable-line no-eval
|
||||
'%EvalError%': EvalError,
|
||||
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
||||
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
||||
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
||||
'%Function%': $Function,
|
||||
'%GeneratorFunction%': needsEval,
|
||||
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
||||
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
||||
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
||||
'%isFinite%': isFinite,
|
||||
'%isNaN%': isNaN,
|
||||
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
||||
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
||||
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
||||
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
||||
'%Math%': Math,
|
||||
'%Number%': Number,
|
||||
'%Object%': Object,
|
||||
'%parseFloat%': parseFloat,
|
||||
'%parseInt%': parseInt,
|
||||
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
||||
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
||||
'%RangeError%': RangeError,
|
||||
'%ReferenceError%': ReferenceError,
|
||||
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
||||
'%RegExp%': RegExp,
|
||||
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
||||
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
||||
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
||||
'%String%': String,
|
||||
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
||||
'%Symbol%': hasSymbols ? Symbol : undefined,
|
||||
'%SyntaxError%': $SyntaxError,
|
||||
'%ThrowTypeError%': ThrowTypeError,
|
||||
'%TypedArray%': TypedArray,
|
||||
'%TypeError%': $TypeError,
|
||||
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
||||
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
||||
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
||||
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
||||
'%URIError%': URIError,
|
||||
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
||||
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
||||
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
||||
};
|
||||
|
||||
try {
|
||||
null.error; // eslint-disable-line no-unused-expressions
|
||||
} catch (e) {
|
||||
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
||||
var errorProto = getProto(getProto(e));
|
||||
INTRINSICS['%Error.prototype%'] = errorProto;
|
||||
}
|
||||
|
||||
var doEval = function doEval(name) {
|
||||
var value;
|
||||
if (name === '%AsyncFunction%') {
|
||||
value = getEvalledConstructor('async function () {}');
|
||||
} else if (name === '%GeneratorFunction%') {
|
||||
value = getEvalledConstructor('function* () {}');
|
||||
} else if (name === '%AsyncGeneratorFunction%') {
|
||||
value = getEvalledConstructor('async function* () {}');
|
||||
} else if (name === '%AsyncGenerator%') {
|
||||
var fn = doEval('%AsyncGeneratorFunction%');
|
||||
if (fn) {
|
||||
value = fn.prototype;
|
||||
}
|
||||
} else if (name === '%AsyncIteratorPrototype%') {
|
||||
var gen = doEval('%AsyncGenerator%');
|
||||
if (gen) {
|
||||
value = getProto(gen.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
INTRINSICS[name] = value;
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
var LEGACY_ALIASES = {
|
||||
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
||||
'%ArrayPrototype%': ['Array', 'prototype'],
|
||||
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
||||
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
||||
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
||||
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
||||
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
||||
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
||||
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
||||
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
||||
'%DataViewPrototype%': ['DataView', 'prototype'],
|
||||
'%DatePrototype%': ['Date', 'prototype'],
|
||||
'%ErrorPrototype%': ['Error', 'prototype'],
|
||||
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
||||
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
||||
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
||||
'%FunctionPrototype%': ['Function', 'prototype'],
|
||||
'%Generator%': ['GeneratorFunction', 'prototype'],
|
||||
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
||||
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
||||
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
||||
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
||||
'%JSONParse%': ['JSON', 'parse'],
|
||||
'%JSONStringify%': ['JSON', 'stringify'],
|
||||
'%MapPrototype%': ['Map', 'prototype'],
|
||||
'%NumberPrototype%': ['Number', 'prototype'],
|
||||
'%ObjectPrototype%': ['Object', 'prototype'],
|
||||
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
||||
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
||||
'%PromisePrototype%': ['Promise', 'prototype'],
|
||||
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
||||
'%Promise_all%': ['Promise', 'all'],
|
||||
'%Promise_reject%': ['Promise', 'reject'],
|
||||
'%Promise_resolve%': ['Promise', 'resolve'],
|
||||
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
||||
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
||||
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
||||
'%SetPrototype%': ['Set', 'prototype'],
|
||||
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
||||
'%StringPrototype%': ['String', 'prototype'],
|
||||
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
||||
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
||||
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
||||
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
||||
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
||||
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
||||
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
||||
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
||||
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
||||
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
||||
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
||||
};
|
||||
|
||||
var bind = require('function-bind');
|
||||
var hasOwn = require('has');
|
||||
var $concat = bind.call(Function.call, Array.prototype.concat);
|
||||
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
||||
var $replace = bind.call(Function.call, String.prototype.replace);
|
||||
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
||||
var $exec = bind.call(Function.call, RegExp.prototype.exec);
|
||||
|
||||
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
||||
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
||||
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
||||
var stringToPath = function stringToPath(string) {
|
||||
var first = $strSlice(string, 0, 1);
|
||||
var last = $strSlice(string, -1);
|
||||
if (first === '%' && last !== '%') {
|
||||
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
||||
} else if (last === '%' && first !== '%') {
|
||||
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
||||
}
|
||||
var result = [];
|
||||
$replace(string, rePropName, function (match, number, quote, subString) {
|
||||
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
/* end adaptation */
|
||||
|
||||
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
||||
var intrinsicName = name;
|
||||
var alias;
|
||||
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
||||
alias = LEGACY_ALIASES[intrinsicName];
|
||||
intrinsicName = '%' + alias[0] + '%';
|
||||
}
|
||||
|
||||
if (hasOwn(INTRINSICS, intrinsicName)) {
|
||||
var value = INTRINSICS[intrinsicName];
|
||||
if (value === needsEval) {
|
||||
value = doEval(intrinsicName);
|
||||
}
|
||||
if (typeof value === 'undefined' && !allowMissing) {
|
||||
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
||||
}
|
||||
|
||||
return {
|
||||
alias: alias,
|
||||
name: intrinsicName,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
|
||||
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
||||
};
|
||||
|
||||
module.exports = function GetIntrinsic(name, allowMissing) {
|
||||
if (typeof name !== 'string' || name.length === 0) {
|
||||
throw new $TypeError('intrinsic name must be a non-empty string');
|
||||
}
|
||||
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
||||
throw new $TypeError('"allowMissing" argument must be a boolean');
|
||||
}
|
||||
|
||||
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
||||
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
||||
}
|
||||
var parts = stringToPath(name);
|
||||
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
||||
|
||||
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
||||
var intrinsicRealName = intrinsic.name;
|
||||
var value = intrinsic.value;
|
||||
var skipFurtherCaching = false;
|
||||
|
||||
var alias = intrinsic.alias;
|
||||
if (alias) {
|
||||
intrinsicBaseName = alias[0];
|
||||
$spliceApply(parts, $concat([0, 1], alias));
|
||||
}
|
||||
|
||||
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
||||
var part = parts[i];
|
||||
var first = $strSlice(part, 0, 1);
|
||||
var last = $strSlice(part, -1);
|
||||
if (
|
||||
(
|
||||
(first === '"' || first === "'" || first === '`')
|
||||
|| (last === '"' || last === "'" || last === '`')
|
||||
)
|
||||
&& first !== last
|
||||
) {
|
||||
throw new $SyntaxError('property names with quotes must have matching quotes');
|
||||
}
|
||||
if (part === 'constructor' || !isOwn) {
|
||||
skipFurtherCaching = true;
|
||||
}
|
||||
|
||||
intrinsicBaseName += '.' + part;
|
||||
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
||||
|
||||
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
||||
value = INTRINSICS[intrinsicRealName];
|
||||
} else if (value != null) {
|
||||
if (!(part in value)) {
|
||||
if (!allowMissing) {
|
||||
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
||||
}
|
||||
return void undefined;
|
||||
}
|
||||
if ($gOPD && (i + 1) >= parts.length) {
|
||||
var desc = $gOPD(value, part);
|
||||
isOwn = !!desc;
|
||||
|
||||
// By convention, when a data property is converted to an accessor
|
||||
// property to emulate a data property that does not suffer from
|
||||
// the override mistake, that accessor's getter is marked with
|
||||
// an `originalValue` property. Here, when we detect this, we
|
||||
// uphold the illusion by pretending to see that original data
|
||||
// property, i.e., returning the value rather than the getter
|
||||
// itself.
|
||||
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
||||
value = desc.get;
|
||||
} else {
|
||||
value = value[part];
|
||||
}
|
||||
} else {
|
||||
isOwn = hasOwn(value, part);
|
||||
value = value[part];
|
||||
}
|
||||
|
||||
if (isOwn && !skipFurtherCaching) {
|
||||
INTRINSICS[intrinsicRealName] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
# `Math.round10` _(ext/math/round-10)_
|
||||
|
||||
Decimal round
|
||||
|
||||
```javascript
|
||||
const round10 = require("ext/math/round-10");
|
||||
|
||||
round10(55.549, -1); // 55.5
|
||||
round10(1.005, -2); // 1.01
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"displaynames.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/types/displaynames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AAEjC,aAAK,WAAW,GAAG,MAAM,CAAA;AACzB,aAAK,UAAU,GAAG,MAAM,CAAA;AACxB,aAAK,UAAU,GAAG,MAAM,CAAA;AACxB,aAAK,YAAY,GAAG,MAAM,CAAA;AAE1B,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,EAAE;QACL;;WAEG;QACH,QAAQ,EAAE;YACR,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;YACnC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;YAClC,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;SAClC,CAAA;QACD,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;YAClC,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;YACjC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;SACjC,CAAA;QACD,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;YAClC,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;YACjC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;SACjC,CAAA;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;YACpC,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;YACnC,IAAI,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;SACnC,CAAA;KACF,CAAA;IACD;;;;OAIG;IACH,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED,oBAAY,sBAAsB,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA"}
|
||||
@@ -0,0 +1,2 @@
|
||||
let createPlugin = require('./lib/public/create-plugin')
|
||||
module.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default
|
||||
@@ -0,0 +1,284 @@
|
||||
[XRegExp](http://xregexp.com/)
|
||||
==============================
|
||||
|
||||
XRegExp provides augmented, extensible, cross-browser JavaScript regular expressions. You get new syntax and flags beyond what browsers support natively, along with a collection of utils to make your client-side grepping and parsing easier. XRegExp also frees you from worrying about pesky inconsistencies in cross-browser regex handling and the dubious `lastIndex` property.
|
||||
|
||||
XRegExp supports all native ES5 regular expression syntax. It's about 3.5 KB when minified and gzipped. It works with Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 9.5+.
|
||||
|
||||
|
||||
## Performance
|
||||
|
||||
XRegExp regular expressions compile to native RegExp objects, thus there is no performance difference when using XRegExp objects with native methods. There is a small performance cost when *compiling* XRegExps. If you want, however, you can use `XRegExp.cache` to avoid ever incurring the compilation cost for a given pattern more than once. Doing so can even lead to XRegExp being faster than native regexes in synthetic tests that repeatedly compile the same regex.
|
||||
|
||||
|
||||
## Usage examples
|
||||
|
||||
~~~ js
|
||||
// Using named capture and flag x (free-spacing and line comments)
|
||||
var date = XRegExp('(?<year> [0-9]{4}) -? # year \n\
|
||||
(?<month> [0-9]{2}) -? # month \n\
|
||||
(?<day> [0-9]{2}) # day ', 'x');
|
||||
|
||||
// XRegExp.exec gives you named backreferences on the match result
|
||||
var match = XRegExp.exec('2012-02-22', date);
|
||||
match.day; // -> '22'
|
||||
|
||||
// It also includes optional pos and sticky arguments
|
||||
var pos = 3, result = [];
|
||||
while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d+)>/, pos, 'sticky')) {
|
||||
result.push(match[1]);
|
||||
pos = match.index + match[0].length;
|
||||
} // result -> ['2', '3', '4']
|
||||
|
||||
// XRegExp.replace allows named backreferences in replacements
|
||||
XRegExp.replace('2012-02-22', date, '${month}/${day}/${year}'); // -> '02/22/2012'
|
||||
XRegExp.replace('2012-02-22', date, function (match) {
|
||||
return match.month + '/' + match.day + '/' + match.year;
|
||||
}); // -> '02/22/2012'
|
||||
|
||||
// In fact, all XRegExps are RegExps and work perfectly with native methods
|
||||
date.test('2012-02-22'); // -> true
|
||||
|
||||
// The *only* caveat is that named captures must be referred to using numbered backreferences
|
||||
'2012-02-22'.replace(date, '$2/$3/$1'); // -> '02/22/2012'
|
||||
|
||||
// If you want, you can extend native methods so you don't have to worry about this
|
||||
// Doing so also fixes numerous browser bugs in the native methods
|
||||
XRegExp.install('natives');
|
||||
'2012-02-22'.replace(date, '${month}/${day}/${year}'); // -> '02/22/2012'
|
||||
'2012-02-22'.replace(date, function (match) {
|
||||
return match.month + '/' + match.day + '/' + match.year;
|
||||
}); // -> '02/22/2012'
|
||||
date.exec('2012-02-22').day; // -> '22'
|
||||
|
||||
// Extract every other digit from a string using XRegExp.forEach
|
||||
XRegExp.forEach('1a2345', /\d/, function (match, i) {
|
||||
if (i % 2) this.push(+match[0]);
|
||||
}, []); // -> [2, 4]
|
||||
|
||||
// Get numbers within <b> tags using XRegExp.matchChain
|
||||
XRegExp.matchChain('1 <b>2</b> 3 <b>4 a 56</b>', [
|
||||
XRegExp('(?is)<b>.*?</b>'),
|
||||
/\d+/
|
||||
]); // -> ['2', '4', '56']
|
||||
|
||||
// You can also pass forward and return specific backreferences
|
||||
var html = '<a href="http://xregexp.com/">XRegExp</a>\
|
||||
<a href="http://www.google.com/">Google</a>';
|
||||
XRegExp.matchChain(html, [
|
||||
{regex: /<a href="([^"]+)">/i, backref: 1},
|
||||
{regex: XRegExp('(?i)^https?://(?<domain>[^/?#]+)'), backref: 'domain'}
|
||||
]); // -> ['xregexp.com', 'www.google.com']
|
||||
|
||||
// XRegExp.union safely merges strings and regexes into a single pattern
|
||||
XRegExp.union(['a+b*c', /(dogs)\1/, /(cats)\1/], 'i');
|
||||
// -> /a\+b\*c|(dogs)\1|(cats)\2/i
|
||||
~~~
|
||||
|
||||
These examples should give you the flavor of what's possible, but XRegExp has more syntax, flags, utils, options, and browser fixes that aren't shown here. You can even augment XRegExp's regular expression syntax with addons (see below) or write your own. See [xregexp.com](http://xregexp.com/) for more details.
|
||||
|
||||
|
||||
## Addons
|
||||
|
||||
In browsers, you can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm](http://npmjs.org/) package uses `xregexp-all.js`, which means that the addons are always available when XRegExp is installed on the server using npm.
|
||||
|
||||
|
||||
### XRegExp Unicode Base
|
||||
|
||||
In browsers, first include the Unicode Base script:
|
||||
|
||||
~~~ html
|
||||
<script src="xregexp.js"></script>
|
||||
<script src="addons/unicode/unicode-base.js"></script>
|
||||
~~~
|
||||
|
||||
Then you can do this:
|
||||
|
||||
~~~ js
|
||||
var unicodeWord = XRegExp('^\\p{L}+$');
|
||||
unicodeWord.test('Русский'); // -> true
|
||||
unicodeWord.test('日本語'); // -> true
|
||||
unicodeWord.test('العربية'); // -> true
|
||||
~~~
|
||||
|
||||
The base script adds `\p{Letter}` and its alias `\p{L}`, but other Unicode categories, scripts, blocks, and properties require addon packages. Try these next examples after additionally including `unicode-scripts.js`:
|
||||
|
||||
~~~ js
|
||||
XRegExp('^\\p{Hiragana}+$').test('ひらがな'); // -> true
|
||||
XRegExp('^[\\p{Latin}\\p{Common}]+$').test('Über Café.'); // -> true
|
||||
~~~
|
||||
|
||||
XRegExp uses the Unicode 6.1 Basic Multilingual Plane.
|
||||
|
||||
|
||||
### XRegExp.build
|
||||
|
||||
In browsers, first include the script:
|
||||
|
||||
~~~ html
|
||||
<script src="xregexp.js"></script>
|
||||
<script src="addons/build.js"></script>
|
||||
~~~
|
||||
|
||||
You can then build regular expressions using named subpatterns, for readability and pattern reuse:
|
||||
|
||||
~~~ js
|
||||
var time = XRegExp.build('(?x)^ {{hours}} ({{minutes}}) $', {
|
||||
hours: XRegExp.build('{{h12}} : | {{h24}}', {
|
||||
h12: /1[0-2]|0?[1-9]/,
|
||||
h24: /2[0-3]|[01][0-9]/
|
||||
}, 'x'),
|
||||
minutes: /^[0-5][0-9]$/
|
||||
});
|
||||
|
||||
time.test('10:59'); // -> true
|
||||
XRegExp.exec('10:59', time).minutes; // -> '59'
|
||||
~~~
|
||||
|
||||
Named subpatterns can be provided as strings or regex objects. A leading `^` and trailing unescaped `$` are stripped from subpatterns if both are present, which allows embedding independently useful anchored patterns. `{{…}}` tokens can be quantified as a single unit. Backreferences in the outer pattern and provided subpatterns are automatically renumbered to work correctly within the larger combined pattern. The syntax `({{name}})` works as shorthand for named capture via `(?<name>{{name}})`. Named subpatterns cannot be embedded within character classes.
|
||||
|
||||
See also: *[Creating Grammatical Regexes Using XRegExp.build](http://blog.stevenlevithan.com/archives/grammatical-patterns-xregexp-build)*.
|
||||
|
||||
|
||||
### XRegExp.matchRecursive
|
||||
|
||||
In browsers, first include the script:
|
||||
|
||||
~~~ html
|
||||
<script src="xregexp.js"></script>
|
||||
<script src="addons/matchrecursive.js"></script>
|
||||
~~~
|
||||
|
||||
You can then match recursive constructs using XRegExp pattern strings as left and right delimiters:
|
||||
|
||||
~~~ js
|
||||
var str = '(t((e))s)t()(ing)';
|
||||
XRegExp.matchRecursive(str, '\\(', '\\)', 'g');
|
||||
// -> ['t((e))s', '', 'ing']
|
||||
|
||||
// Extended information mode with valueNames
|
||||
str = 'Here is <div> <div>an</div></div> example';
|
||||
XRegExp.matchRecursive(str, '<div\\s*>', '</div>', 'gi', {
|
||||
valueNames: ['between', 'left', 'match', 'right']
|
||||
});
|
||||
/* -> [
|
||||
{name: 'between', value: 'Here is ', start: 0, end: 8},
|
||||
{name: 'left', value: '<div>', start: 8, end: 13},
|
||||
{name: 'match', value: ' <div>an</div>', start: 13, end: 27},
|
||||
{name: 'right', value: '</div>', start: 27, end: 33},
|
||||
{name: 'between', value: ' example', start: 33, end: 41}
|
||||
] */
|
||||
|
||||
// Omitting unneeded parts with null valueNames, and using escapeChar
|
||||
str = '...{1}\\{{function(x,y){return y+x;}}';
|
||||
XRegExp.matchRecursive(str, '{', '}', 'g', {
|
||||
valueNames: ['literal', null, 'value', null],
|
||||
escapeChar: '\\'
|
||||
});
|
||||
/* -> [
|
||||
{name: 'literal', value: '...', start: 0, end: 3},
|
||||
{name: 'value', value: '1', start: 4, end: 5},
|
||||
{name: 'literal', value: '\\{', start: 6, end: 8},
|
||||
{name: 'value', value: 'function(x,y){return y+x;}', start: 9, end: 35}
|
||||
] */
|
||||
|
||||
// Sticky mode via flag y
|
||||
str = '<1><<<2>>><3>4<5>';
|
||||
XRegExp.matchRecursive(str, '<', '>', 'gy');
|
||||
// -> ['1', '<<2>>', '3']
|
||||
~~~
|
||||
|
||||
`XRegExp.matchRecursive` throws an error if it sees an unbalanced delimiter in the target string.
|
||||
|
||||
|
||||
### XRegExp Prototype Methods
|
||||
|
||||
In browsers, first include the script:
|
||||
|
||||
~~~ html
|
||||
<script src="xregexp.js"></script>
|
||||
<script src="addons/prototypes.js"></script>
|
||||
~~~
|
||||
|
||||
New XRegExp regexes then gain a collection of useful methods: `apply`, `call`, `forEach`, `globalize`, `xexec`, and `xtest`.
|
||||
|
||||
~~~ js
|
||||
// To demonstrate the call method, let's first create the function we'll be using...
|
||||
function filter(array, fn) {
|
||||
var res = [];
|
||||
array.forEach(function (el) {if (fn.call(null, el)) res.push(el);});
|
||||
return res;
|
||||
}
|
||||
// Now we can filter arrays using functions and regexes
|
||||
filter(['a', 'ba', 'ab', 'b'], XRegExp('^a')); // -> ['a', 'ab']
|
||||
~~~
|
||||
|
||||
Native `RegExp` objects copied by `XRegExp` are augmented with any `XRegExp.prototype` methods. The following lines therefore work equivalently:
|
||||
|
||||
~~~ js
|
||||
XRegExp('[a-z]', 'ig').xexec('abc');
|
||||
XRegExp(/[a-z]/ig).xexec('abc');
|
||||
XRegExp.globalize(/[a-z]/i).xexec('abc');
|
||||
~~~
|
||||
|
||||
|
||||
## Installation and usage
|
||||
|
||||
In browsers:
|
||||
|
||||
~~~ html
|
||||
<script src="xregexp-min.js"></script>
|
||||
~~~
|
||||
|
||||
Or, to bundle XRegExp with all of its addons:
|
||||
|
||||
~~~ html
|
||||
<script src="xregexp-all-min.js"></script>
|
||||
~~~
|
||||
|
||||
Using [npm](http://npmjs.org/):
|
||||
|
||||
~~~ bash
|
||||
npm install xregexp
|
||||
~~~
|
||||
|
||||
In [Node.js](http://nodejs.org/) and [CommonJS module](http://wiki.commonjs.org/wiki/Modules) loaders:
|
||||
|
||||
~~~ js
|
||||
var XRegExp = require('xregexp').XRegExp;
|
||||
~~~
|
||||
|
||||
|
||||
### Running tests on the server with npm
|
||||
|
||||
~~~ bash
|
||||
npm install -g qunit # needed to run the tests
|
||||
npm test # in the xregexp root
|
||||
~~~
|
||||
|
||||
If XRegExp was not installed using npm, just open `tests/index.html` in your browser.
|
||||
|
||||
|
||||
## &c
|
||||
|
||||
**Lookbehind:** A [collection of short functions](https://gist.github.com/2387872) is available that makes it easy to simulate infinite-length leading lookbehind.
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
* Releases: [Version history](http://xregexp.com/history/).
|
||||
* Upcoming: [Milestones](https://github.com/slevithan/XRegExp/issues/milestones), [Roadmap](https://github.com/slevithan/XRegExp/wiki/Roadmap).
|
||||
|
||||
|
||||
## About
|
||||
|
||||
XRegExp and addons copyright 2007-2012 by [Steven Levithan](http://stevenlevithan.com/).
|
||||
|
||||
Tools: Unicode range generators by [Mathias Bynens](http://mathiasbynens.be/). Source file concatenator by [Bjarke Walling](http://twitter.com/walling).
|
||||
|
||||
Prior art: `XRegExp.build` inspired by [Lea Verou](http://lea.verou.me/)'s [RegExp.create](http://lea.verou.me/2011/03/create-complex-regexps-more-easily/). `XRegExp.union` inspired by [Ruby](http://www.ruby-lang.org/). XRegExp's syntax extensions come from Perl, .NET, etc.
|
||||
|
||||
All code released under the [MIT License](http://mit-license.org/).
|
||||
|
||||
Fork me to show support, fix, and extend.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "strip-ansi",
|
||||
"version": "6.0.1",
|
||||
"description": "Strip ANSI escape codes from a string",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/strip-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"strip",
|
||||
"trim",
|
||||
"remove",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.10.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"switchMap.js","sourceRoot":"","sources":["../../../../src/internal/operators/switchMap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAiFhE,MAAM,UAAU,SAAS,CACvB,OAAuC,EACvC,cAA6G;IAE7G,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,eAAe,GAA0C,IAAI,CAAC;QAClE,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,IAAI,UAAU,GAAG,KAAK,CAAC;QAIvB,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,UAAU,IAAI,CAAC,eAAe,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QAEpF,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EACV,CAAC,KAAK,EAAE,EAAE;YAER,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,EAAE,CAAC;YAC/B,IAAI,UAAU,GAAG,CAAC,CAAC;YACnB,MAAM,UAAU,GAAG,KAAK,EAAE,CAAC;YAE3B,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAC7C,CAAC,eAAe,GAAG,wBAAwB,CACzC,UAAU,EAIV,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC1H,GAAG,EAAE;gBAIH,eAAe,GAAG,IAAK,CAAC;gBACxB,aAAa,EAAE,CAAC;YAClB,CAAC,CACF,CAAC,CACH,CAAC;QACJ,CAAC,EACD,GAAG,EAAE;YACH,UAAU,GAAG,IAAI,CAAC;YAClB,aAAa,EAAE,CAAC;QAClB,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,26 @@
|
||||
var createFlow = require('./_createFlow');
|
||||
|
||||
/**
|
||||
* This method is like `_.flow` except that it creates a function that
|
||||
* invokes the given functions from right to left.
|
||||
*
|
||||
* @static
|
||||
* @since 3.0.0
|
||||
* @memberOf _
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} [funcs] The functions to invoke.
|
||||
* @returns {Function} Returns the new composite function.
|
||||
* @see _.flow
|
||||
* @example
|
||||
*
|
||||
* function square(n) {
|
||||
* return n * n;
|
||||
* }
|
||||
*
|
||||
* var addSquare = _.flowRight([square, _.add]);
|
||||
* addSquare(1, 2);
|
||||
* // => 9
|
||||
*/
|
||||
var flowRight = createFlow(true);
|
||||
|
||||
module.exports = flowRight;
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Converts an ASCII `string` to an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function asciiToArray(string) {
|
||||
return string.split('');
|
||||
}
|
||||
|
||||
module.exports = asciiToArray;
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare const timeData: Record<string, string[]>;
|
||||
//# sourceMappingURL=time-data.generated.d.ts.map
|
||||
@@ -0,0 +1,60 @@
|
||||
# `resolve-alpn`
|
||||
|
||||
[](https://github.com/szmarczak/resolve-alpn/actions)
|
||||
[](https://codecov.io/gh/szmarczak/resolve-alpn)
|
||||
|
||||
## API
|
||||
|
||||
### resolveALPN(options, connect = tls.connect)
|
||||
|
||||
Returns an object with an `alpnProtocol` property. The `socket` property may be also present.
|
||||
|
||||
```js
|
||||
const result = await resolveALPN({
|
||||
host: 'nghttp2.org',
|
||||
port: 443,
|
||||
ALPNProtocols: ['h2', 'http/1.1'],
|
||||
servername: 'nghttp2.org'
|
||||
});
|
||||
|
||||
console.log(result); // {alpnProtocol: 'h2'}
|
||||
```
|
||||
|
||||
**Note:** While the `servername` option is not required in this case, many other servers do. It's best practice to set it anyway.
|
||||
|
||||
**Note:** If the socket times out, the promise will resolve and `result.timeout` will be set to `true`.
|
||||
|
||||
#### options
|
||||
|
||||
Same as [TLS options](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).
|
||||
|
||||
##### options.resolveSocket
|
||||
|
||||
By default, the socket gets destroyed and the promise resolves.<br>
|
||||
If you set this to true, it will return the socket in a `socket` property.
|
||||
|
||||
```js
|
||||
const result = await resolveALPN({
|
||||
host: 'nghttp2.org',
|
||||
port: 443,
|
||||
ALPNProtocols: ['h2', 'http/1.1'],
|
||||
servername: 'nghttp2.org',
|
||||
resolveSocket: true
|
||||
});
|
||||
|
||||
console.log(result); // {alpnProtocol: 'h2', socket: tls.TLSSocket}
|
||||
|
||||
// Remember to destroy the socket if you don't use it!
|
||||
result.socket.destroy();
|
||||
```
|
||||
|
||||
#### connect
|
||||
|
||||
Type: `Function<TLSSocket> | AsyncFunction<TLSSocket>`\
|
||||
Default: [`tls.connect`](https://nodejs.org/dist/latest-v16.x/docs/api/tls.html#tls_tls_connect_options_callback)
|
||||
|
||||
**Note:** No matter which function is used (synchronous or asynchronous), it **must** accept a `callback` function as a second argument. The `callback` function gets executed when the socket has successfully connected.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function isNegativeZero(number) {
|
||||
return number === 0 && (1 / number) === -Infinity;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
var baseFunctions = require('./_baseFunctions'),
|
||||
keys = require('./keys');
|
||||
|
||||
/**
|
||||
* Creates an array of function property names from own enumerable properties
|
||||
* of `object`.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to inspect.
|
||||
* @returns {Array} Returns the function names.
|
||||
* @see _.functionsIn
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
* this.a = _.constant('a');
|
||||
* this.b = _.constant('b');
|
||||
* }
|
||||
*
|
||||
* Foo.prototype.c = _.constant('c');
|
||||
*
|
||||
* _.functions(new Foo);
|
||||
* // => ['a', 'b']
|
||||
*/
|
||||
function functions(object) {
|
||||
return object == null ? [] : baseFunctions(object, keys(object));
|
||||
}
|
||||
|
||||
module.exports = functions;
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "ansi-regex",
|
||||
"version": "6.0.1",
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-regex",
|
||||
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# Record
|
||||
|
||||
This extension lets you use Mousetrap to record keyboard sequences and play them back:
|
||||
|
||||
```html
|
||||
<button onclick="recordSequence()">Record</button>
|
||||
|
||||
<script>
|
||||
function recordSequence() {
|
||||
Mousetrap.record(function(sequence) {
|
||||
// sequence is an array like ['ctrl+k', 'c']
|
||||
alert('You pressed: ' + sequence.join(' '));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","16":"DC tB EC FC"},D:{"1":"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":"I v J D E F A B C K L","132":"0 1 2 3 4 5 G M N O w g x y z"},E:{"1":"A B C K L G 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"I v J HC zB","132":"D E F JC KC LC","260":"IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C 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","16":"F B PC QC RC SC qB AC","132":"G M"},G:{"1":"bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB","132":"E UC BC VC WC XC YC ZC aC"},H:{"1":"oC"},I:{"1":"f tC uC","16":"pC qC","132":"tB I rC sC BC"},J:{"132":"D A"},K:{"1":"C h rB","16":"A B qB AC"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"Node.compareDocumentPosition()"};
|
||||
@@ -0,0 +1,139 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [8.0.1](https://github.com/yargs/cliui/compare/v8.0.0...v8.0.1) (2022-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** move rollup-plugin-ts to dev deps ([#124](https://github.com/yargs/cliui/issues/124)) ([7c8bd6b](https://github.com/yargs/cliui/commit/7c8bd6ba024d61e4eeae310c7959ab8ab6829081))
|
||||
|
||||
## [8.0.0](https://github.com/yargs/cliui/compare/v7.0.4...v8.0.0) (2022-09-30)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **deps:** drop Node 10 to release CVE-2021-3807 patch (#122)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** drop Node 10 to release CVE-2021-3807 patch ([#122](https://github.com/yargs/cliui/issues/122)) ([f156571](https://github.com/yargs/cliui/commit/f156571ce4f2ebf313335e3a53ad905589da5a30))
|
||||
|
||||
### [7.0.4](https://www.github.com/yargs/cliui/compare/v7.0.3...v7.0.4) (2020-11-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deno:** import UIOptions from definitions ([#97](https://www.github.com/yargs/cliui/issues/97)) ([f04f343](https://www.github.com/yargs/cliui/commit/f04f3439bc78114c7e90f82ff56f5acf16268ea8))
|
||||
|
||||
### [7.0.3](https://www.github.com/yargs/cliui/compare/v7.0.2...v7.0.3) (2020-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#93](https://www.github.com/yargs/cliui/issues/93)) ([eca16fc](https://www.github.com/yargs/cliui/commit/eca16fc05d26255df3280906c36d7f0e5b05c6e9))
|
||||
|
||||
### [7.0.2](https://www.github.com/yargs/cliui/compare/v7.0.1...v7.0.2) (2020-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **exports:** node 13.0-13.6 require a string fallback ([#91](https://www.github.com/yargs/cliui/issues/91)) ([b529d7e](https://www.github.com/yargs/cliui/commit/b529d7e432901af1af7848b23ed6cf634497d961))
|
||||
|
||||
### [7.0.1](https://www.github.com/yargs/cliui/compare/v7.0.0...v7.0.1) (2020-08-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **build:** main should be build/index.cjs ([dc29a3c](https://www.github.com/yargs/cliui/commit/dc29a3cc617a410aa850e06337b5954b04f2cb4d))
|
||||
|
||||
## [7.0.0](https://www.github.com/yargs/cliui/compare/v6.0.0...v7.0.0) (2020-08-16)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* tsc/ESM/Deno support (#82)
|
||||
* modernize deps and build (#80)
|
||||
|
||||
### Build System
|
||||
|
||||
* modernize deps and build ([#80](https://www.github.com/yargs/cliui/issues/80)) ([339d08d](https://www.github.com/yargs/cliui/commit/339d08dc71b15a3928aeab09042af94db2f43743))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* tsc/ESM/Deno support ([#82](https://www.github.com/yargs/cliui/issues/82)) ([4b777a5](https://www.github.com/yargs/cliui/commit/4b777a5fe01c5d8958c6708695d6aab7dbe5706c))
|
||||
|
||||
## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* update deps, drop Node 6
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df))
|
||||
|
||||
## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drop support for node < 6.
|
||||
|
||||
|
||||
|
||||
<a name="4.1.0"></a>
|
||||
## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
|
||||
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* officially drop support for Node < 4
|
||||
|
||||
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
|
||||
|
||||
### Features
|
||||
|
||||
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "parse-github-url",
|
||||
"description": "Parse a github URL into an object.",
|
||||
"version": "1.0.2",
|
||||
"homepage": "https://github.com/jonschlinkert/parse-github-url",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Ben Meiri (https://github.com/bmeiri)",
|
||||
"Brian Woodward (https://twitter.com/doowb)",
|
||||
"Javier Mendiara (http://twitter.com/jmendiara)",
|
||||
"Jeremy Ruppel (jeremyruppel.github.io)",
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"Pete Cook (cookpete.com)",
|
||||
"Philipp Alferov (https://github.com/alferov)",
|
||||
"William Bartholomew (https://willbar.com)"
|
||||
],
|
||||
"repository": "jonschlinkert/parse-github-url",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/parse-github-url/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"cli.js",
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"parse-github-url": "./cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.2.0",
|
||||
"verb-generate-readme": "^0.6.0"
|
||||
},
|
||||
"keywords": [
|
||||
"branch",
|
||||
"git",
|
||||
"github",
|
||||
"match",
|
||||
"parse",
|
||||
"regex",
|
||||
"repo",
|
||||
"test",
|
||||
"url",
|
||||
"user",
|
||||
"username"
|
||||
],
|
||||
"verb": {
|
||||
"run": true,
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"git-add-remote",
|
||||
"git-branch",
|
||||
"git-repo-name",
|
||||
"git-username",
|
||||
"is-git-url"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').whilst;
|
||||
@@ -0,0 +1,47 @@
|
||||
declare const cliCursor: {
|
||||
/**
|
||||
Show cursor.
|
||||
|
||||
@param stream - Default: `process.stderr`.
|
||||
|
||||
@example
|
||||
```
|
||||
import cliCursor from 'cli-cursor';
|
||||
|
||||
cliCursor.show();
|
||||
```
|
||||
*/
|
||||
show(stream?: NodeJS.WritableStream): void;
|
||||
|
||||
/**
|
||||
Hide cursor.
|
||||
|
||||
@param stream - Default: `process.stderr`.
|
||||
|
||||
@example
|
||||
```
|
||||
import cliCursor from 'cli-cursor';
|
||||
|
||||
cliCursor.hide();
|
||||
```
|
||||
*/
|
||||
hide(stream?: NodeJS.WritableStream): void;
|
||||
|
||||
/**
|
||||
Toggle cursor visibility.
|
||||
|
||||
@param force - Is useful to show or hide the cursor based on a boolean.
|
||||
@param stream - Default: `process.stderr`.
|
||||
|
||||
@example
|
||||
```
|
||||
import cliCursor from 'cli-cursor';
|
||||
|
||||
const unicornsAreAwesome = true;
|
||||
cliCursor.toggle(unicornsAreAwesome);
|
||||
```
|
||||
*/
|
||||
toggle(force?: boolean, stream?: NodeJS.WritableStream): void;
|
||||
};
|
||||
|
||||
export default cliCursor;
|
||||
@@ -0,0 +1,37 @@
|
||||
import {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert a string literal to snake-case.
|
||||
|
||||
This can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SnakeCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: SnakeCase<'fooBar'> = 'foo_bar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type SnakeCasedProperties<T> = {
|
||||
[K in keyof T as SnakeCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface ModelProps {
|
||||
isHappy: boolean;
|
||||
fullFamilyName: string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const dbResult: SnakeCasedProperties<ModelProps> = {
|
||||
'is_happy': true,
|
||||
'full_family_name': 'Carla Smith',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
|
||||
@category Template Literals
|
||||
*/
|
||||
export type SnakeCase<Value> = DelimiterCase<Value, '_'>;
|
||||
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
var forEach = require('for-each');
|
||||
var availableTypedArrays = require('available-typed-arrays');
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $toString = callBound('Object.prototype.toString');
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
var gOPD = require('gopd');
|
||||
|
||||
var g = typeof globalThis === 'undefined' ? global : globalThis;
|
||||
var typedArrays = availableTypedArrays();
|
||||
|
||||
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
|
||||
for (var i = 0; i < array.length; i += 1) {
|
||||
if (array[i] === value) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
var $slice = callBound('String.prototype.slice');
|
||||
var toStrTags = {};
|
||||
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
|
||||
if (hasToStringTag && gOPD && getPrototypeOf) {
|
||||
forEach(typedArrays, function (typedArray) {
|
||||
var arr = new g[typedArray]();
|
||||
if (Symbol.toStringTag in arr) {
|
||||
var proto = getPrototypeOf(arr);
|
||||
var descriptor = gOPD(proto, Symbol.toStringTag);
|
||||
if (!descriptor) {
|
||||
var superProto = getPrototypeOf(proto);
|
||||
descriptor = gOPD(superProto, Symbol.toStringTag);
|
||||
}
|
||||
toStrTags[typedArray] = descriptor.get;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var tryTypedArrays = function tryAllTypedArrays(value) {
|
||||
var anyTrue = false;
|
||||
forEach(toStrTags, function (getter, typedArray) {
|
||||
if (!anyTrue) {
|
||||
try {
|
||||
anyTrue = getter.call(value) === typedArray;
|
||||
} catch (e) { /**/ }
|
||||
}
|
||||
});
|
||||
return anyTrue;
|
||||
};
|
||||
|
||||
module.exports = function isTypedArray(value) {
|
||||
if (!value || typeof value !== 'object') { return false; }
|
||||
if (!hasToStringTag || !(Symbol.toStringTag in value)) {
|
||||
var tag = $slice($toString(value), 8, -1);
|
||||
return $indexOf(typedArrays, tag) > -1;
|
||||
}
|
||||
if (!gOPD) { return false; }
|
||||
return tryTypedArrays(value);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? RegExp.prototype.match : require("./shim");
|
||||
@@ -0,0 +1,22 @@
|
||||
module.exports = getDelimiter;
|
||||
var defaulDelimiters = [",", "|", "\t", ";", ":"];
|
||||
function getDelimiter(rowStr,param) {
|
||||
var checker;
|
||||
if (param.delimiter === "auto"){
|
||||
checker = defaulDelimiters;
|
||||
} else if (param.delimiter instanceof Array) {
|
||||
checker = param.delimiter;
|
||||
} else {
|
||||
return param.delimiter;
|
||||
}
|
||||
var count = 0;
|
||||
var rtn = ",";
|
||||
checker.forEach(function(delim) {
|
||||
var delimCount = rowStr.split(delim).length;
|
||||
if (delimCount > count) {
|
||||
rtn = delim;
|
||||
count = delimCount;
|
||||
}
|
||||
});
|
||||
return rtn;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"EmptyError.js","sourceRoot":"","sources":["../../../../src/internal/util/EmptyError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAwBtD,MAAM,CAAC,IAAM,UAAU,GAAmB,gBAAgB,CAAC,UAAC,MAAM,IAAK,OAAA,SAAS,cAAc;IAC5F,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IACzB,IAAI,CAAC,OAAO,GAAG,yBAAyB,CAAC;AAC3C,CAAC,EAJsE,CAItE,CAAC,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"@octokit/request-error","version":"3.0.3","files":{"LICENSE":{"checkedAt":1678883670372,"integrity":"sha512-EHJOahlMp1lwtBt4Za3avDrfUOnQEDTeZ9T/SbhQwf90Vo/Mr5DW3QqyL+0w2phUaGj/PoEizqq/4IOQcYBr4w==","mode":420,"size":1081},"dist-src/types.js":{"checkedAt":1678883669320,"integrity":"sha512-TuHIj4w/TkzTTLbAAzm/nW0Db/St469J6HHMiWa4THKdi3VJKsxkE8mmZKwApXlYIjrBPEIp2oxi6+alPk94Pw==","mode":420,"size":11},"dist-node/index.js":{"checkedAt":1678883670445,"integrity":"sha512-3z4To1RpB/jJfzLhMkR4dmiOb+qRd2bAADylCdJY1OhuxN2+M8SdRuTPNusIv7XWn93JPS4fz4pFsjB7aWZTLw==","mode":420,"size":2583},"dist-src/index.js":{"checkedAt":1678883670445,"integrity":"sha512-w7cEsMReMxQU1J9kKxNZWg9b+Ftk7vXb6FYUYhpmuXf6nOPGPFF8nJe8ZmGi1ohJhBgOx4eqvmE+2+c66rKAwQ==","mode":420,"size":2530},"dist-web/index.js":{"checkedAt":1678883670446,"integrity":"sha512-R1E+CWZfvi6ATb5CkzPVeSvsPRfi2DY3asqg0hedQT6JSqdUSsv0obeXlWhxn1z5XC2KgjKm1exPyTjoDXu2xA==","mode":420,"size":2584},"package.json":{"checkedAt":1678883670446,"integrity":"sha512-Z06v3fHL5eI7bW26SP0C0W0DXZzv37BBuGTeQkLhHHAmcqasy9hAp69eHcP39bgC9x19s/xGG0KEWPl2o4H8iQ==","mode":420,"size":1133},"dist-node/index.js.map":{"checkedAt":1678883670447,"integrity":"sha512-ZtiAYFpKaZnz/EL53Bxol0tYt7aIWMKsZ9DrKgYDRhR3fIZ7rIYTsgsE/RCAOhL1dNe4uEb+8Ta2RJeD5su/BQ==","mode":420,"size":4525},"dist-web/index.js.map":{"checkedAt":1678883670447,"integrity":"sha512-smqNlqlt1FebTbqiv8votmzQUIdlCTOZ5dKhJsrrjmASbDEFLYQIWRkO7rRusphJFww1m/s2VJOUfV8svbotPg==","mode":420,"size":4511},"README.md":{"checkedAt":1678883670447,"integrity":"sha512-a/Iv4iNulNBgwu9TRxkg1VRaj6CcTRtfWaUI6YoTkeRgT+rWTwhG7nFqcoHbVhbmzhhgm2jDJtrRm+rsXSzsCw==","mode":420,"size":1520},"dist-types/index.d.ts":{"checkedAt":1678883670447,"integrity":"sha512-qzKZjOnhnlLDGogvC70a86T2nJrVyC9SCTmqS4WUNgM+MzgwZ6oy2FQFojxiloixldZuwEaIL1PzwE2Dp6yMQA==","mode":420,"size":917},"dist-types/types.d.ts":{"checkedAt":1678883670447,"integrity":"sha512-gqysYyAb/VehsMHvsKPXQ6GNJqhZ0ekJ9FewPz+rS0bkBAZeOJQ601gZ4/pLSwHamxr26/G17SWH/DWn9tvAGA==","mode":420,"size":303}}}
|
||||
@@ -0,0 +1,396 @@
|
||||
/**
|
||||
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
|
||||
*
|
||||
* ```js
|
||||
* const v8 = require('v8');
|
||||
* ```
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/v8.js)
|
||||
*/
|
||||
declare module 'v8' {
|
||||
import { Readable } from 'node:stream';
|
||||
interface HeapSpaceInfo {
|
||||
space_name: string;
|
||||
space_size: number;
|
||||
space_used_size: number;
|
||||
space_available_size: number;
|
||||
physical_space_size: number;
|
||||
}
|
||||
// ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */
|
||||
type DoesZapCodeSpaceFlag = 0 | 1;
|
||||
interface HeapInfo {
|
||||
total_heap_size: number;
|
||||
total_heap_size_executable: number;
|
||||
total_physical_size: number;
|
||||
total_available_size: number;
|
||||
used_heap_size: number;
|
||||
heap_size_limit: number;
|
||||
malloced_memory: number;
|
||||
peak_malloced_memory: number;
|
||||
does_zap_garbage: DoesZapCodeSpaceFlag;
|
||||
number_of_native_contexts: number;
|
||||
number_of_detached_contexts: number;
|
||||
}
|
||||
interface HeapCodeStatistics {
|
||||
code_and_metadata_size: number;
|
||||
bytecode_and_metadata_size: number;
|
||||
external_script_source_size: number;
|
||||
}
|
||||
/**
|
||||
* Returns an integer representing a version tag derived from the V8 version,
|
||||
* command-line flags, and detected CPU features. This is useful for determining
|
||||
* whether a `vm.Script` `cachedData` buffer is compatible with this instance
|
||||
* of V8.
|
||||
*
|
||||
* ```js
|
||||
* console.log(v8.cachedDataVersionTag()); // 3947234607
|
||||
* // The value returned by v8.cachedDataVersionTag() is derived from the V8
|
||||
* // version, command-line flags, and detected CPU features. Test that the value
|
||||
* // does indeed update when flags are toggled.
|
||||
* v8.setFlagsFromString('--allow_natives_syntax');
|
||||
* console.log(v8.cachedDataVersionTag()); // 183726201
|
||||
* ```
|
||||
* @since v8.0.0
|
||||
*/
|
||||
function cachedDataVersionTag(): number;
|
||||
/**
|
||||
* Returns an object with the following properties:
|
||||
*
|
||||
* `does_zap_garbage` is a 0/1 boolean, which signifies whether the`--zap_code_space` option is enabled or not. This makes V8 overwrite heap
|
||||
* garbage with a bit pattern. The RSS footprint (resident set size) gets bigger
|
||||
* because it continuously touches all heap pages and that makes them less likely
|
||||
* to get swapped out by the operating system.
|
||||
*
|
||||
* `number_of_native_contexts` The value of native\_context is the number of the
|
||||
* top-level contexts currently active. Increase of this number over time indicates
|
||||
* a memory leak.
|
||||
*
|
||||
* `number_of_detached_contexts` The value of detached\_context is the number
|
||||
* of contexts that were detached and not yet garbage collected. This number
|
||||
* being non-zero indicates a potential memory leak.
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* total_heap_size: 7326976,
|
||||
* total_heap_size_executable: 4194304,
|
||||
* total_physical_size: 7326976,
|
||||
* total_available_size: 1152656,
|
||||
* used_heap_size: 3476208,
|
||||
* heap_size_limit: 1535115264,
|
||||
* malloced_memory: 16384,
|
||||
* peak_malloced_memory: 1127496,
|
||||
* does_zap_garbage: 0,
|
||||
* number_of_native_contexts: 1,
|
||||
* number_of_detached_contexts: 0
|
||||
* }
|
||||
* ```
|
||||
* @since v1.0.0
|
||||
*/
|
||||
function getHeapStatistics(): HeapInfo;
|
||||
/**
|
||||
* Returns statistics about the V8 heap spaces, i.e. the segments which make up
|
||||
* the V8 heap. Neither the ordering of heap spaces, nor the availability of a
|
||||
* heap space can be guaranteed as the statistics are provided via the
|
||||
* V8[`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the
|
||||
* next.
|
||||
*
|
||||
* The value returned is an array of objects containing the following properties:
|
||||
*
|
||||
* ```json
|
||||
* [
|
||||
* {
|
||||
* "space_name": "new_space",
|
||||
* "space_size": 2063872,
|
||||
* "space_used_size": 951112,
|
||||
* "space_available_size": 80824,
|
||||
* "physical_space_size": 2063872
|
||||
* },
|
||||
* {
|
||||
* "space_name": "old_space",
|
||||
* "space_size": 3090560,
|
||||
* "space_used_size": 2493792,
|
||||
* "space_available_size": 0,
|
||||
* "physical_space_size": 3090560
|
||||
* },
|
||||
* {
|
||||
* "space_name": "code_space",
|
||||
* "space_size": 1260160,
|
||||
* "space_used_size": 644256,
|
||||
* "space_available_size": 960,
|
||||
* "physical_space_size": 1260160
|
||||
* },
|
||||
* {
|
||||
* "space_name": "map_space",
|
||||
* "space_size": 1094160,
|
||||
* "space_used_size": 201608,
|
||||
* "space_available_size": 0,
|
||||
* "physical_space_size": 1094160
|
||||
* },
|
||||
* {
|
||||
* "space_name": "large_object_space",
|
||||
* "space_size": 0,
|
||||
* "space_used_size": 0,
|
||||
* "space_available_size": 1490980608,
|
||||
* "physical_space_size": 0
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @since v6.0.0
|
||||
*/
|
||||
function getHeapSpaceStatistics(): HeapSpaceInfo[];
|
||||
/**
|
||||
* The `v8.setFlagsFromString()` method can be used to programmatically set
|
||||
* V8 command-line flags. This method should be used with care. Changing settings
|
||||
* after the VM has started may result in unpredictable behavior, including
|
||||
* crashes and data loss; or it may simply do nothing.
|
||||
*
|
||||
* The V8 options available for a version of Node.js may be determined by running`node --v8-options`.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* ```js
|
||||
* // Print GC events to stdout for one minute.
|
||||
* const v8 = require('v8');
|
||||
* v8.setFlagsFromString('--trace_gc');
|
||||
* setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
||||
* ```
|
||||
* @since v1.0.0
|
||||
*/
|
||||
function setFlagsFromString(flags: string): void;
|
||||
/**
|
||||
* Generates a snapshot of the current V8 heap and returns a Readable
|
||||
* Stream that may be used to read the JSON serialized representation.
|
||||
* This JSON stream format is intended to be used with tools such as
|
||||
* Chrome DevTools. The JSON schema is undocumented and specific to the
|
||||
* V8 engine. Therefore, the schema may change from one version of V8 to the next.
|
||||
*
|
||||
* Creating a heap snapshot requires memory about twice the size of the heap at
|
||||
* the time the snapshot is created. This results in the risk of OOM killers
|
||||
* terminating the process.
|
||||
*
|
||||
* Generating a snapshot is a synchronous operation which blocks the event loop
|
||||
* for a duration depending on the heap size.
|
||||
*
|
||||
* ```js
|
||||
* // Print heap snapshot to the console
|
||||
* const v8 = require('v8');
|
||||
* const stream = v8.getHeapSnapshot();
|
||||
* stream.pipe(process.stdout);
|
||||
* ```
|
||||
* @since v11.13.0
|
||||
* @return A Readable Stream containing the V8 heap snapshot
|
||||
*/
|
||||
function getHeapSnapshot(): Readable;
|
||||
/**
|
||||
* Generates a snapshot of the current V8 heap and writes it to a JSON
|
||||
* file. This file is intended to be used with tools such as Chrome
|
||||
* DevTools. The JSON schema is undocumented and specific to the V8
|
||||
* engine, and may change from one version of V8 to the next.
|
||||
*
|
||||
* A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will
|
||||
* not contain any information about the workers, and vice versa.
|
||||
*
|
||||
* Creating a heap snapshot requires memory about twice the size of the heap at
|
||||
* the time the snapshot is created. This results in the risk of OOM killers
|
||||
* terminating the process.
|
||||
*
|
||||
* Generating a snapshot is a synchronous operation which blocks the event loop
|
||||
* for a duration depending on the heap size.
|
||||
*
|
||||
* ```js
|
||||
* const { writeHeapSnapshot } = require('v8');
|
||||
* const {
|
||||
* Worker,
|
||||
* isMainThread,
|
||||
* parentPort
|
||||
* } = require('worker_threads');
|
||||
*
|
||||
* if (isMainThread) {
|
||||
* const worker = new Worker(__filename);
|
||||
*
|
||||
* worker.once('message', (filename) => {
|
||||
* console.log(`worker heapdump: ${filename}`);
|
||||
* // Now get a heapdump for the main thread.
|
||||
* console.log(`main thread heapdump: ${writeHeapSnapshot()}`);
|
||||
* });
|
||||
*
|
||||
* // Tell the worker to create a heapdump.
|
||||
* worker.postMessage('heapdump');
|
||||
* } else {
|
||||
* parentPort.once('message', (message) => {
|
||||
* if (message === 'heapdump') {
|
||||
* // Generate a heapdump for the worker
|
||||
* // and return the filename to the parent.
|
||||
* parentPort.postMessage(writeHeapSnapshot());
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* ```
|
||||
* @since v11.13.0
|
||||
* @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be
|
||||
* generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a
|
||||
* worker thread.
|
||||
* @return The filename where the snapshot was saved.
|
||||
*/
|
||||
function writeHeapSnapshot(filename?: string): string;
|
||||
/**
|
||||
* Returns an object with the following properties:
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* code_and_metadata_size: 212208,
|
||||
* bytecode_and_metadata_size: 161368,
|
||||
* external_script_source_size: 1410794
|
||||
* }
|
||||
* ```
|
||||
* @since v12.8.0
|
||||
*/
|
||||
function getHeapCodeStatistics(): HeapCodeStatistics;
|
||||
/**
|
||||
* @since v8.0.0
|
||||
*/
|
||||
class Serializer {
|
||||
/**
|
||||
* Writes out a header, which includes the serialization format version.
|
||||
*/
|
||||
writeHeader(): void;
|
||||
/**
|
||||
* Serializes a JavaScript value and adds the serialized representation to the
|
||||
* internal buffer.
|
||||
*
|
||||
* This throws an error if `value` cannot be serialized.
|
||||
*/
|
||||
writeValue(val: any): boolean;
|
||||
/**
|
||||
* Returns the stored internal buffer. This serializer should not be used once
|
||||
* the buffer is released. Calling this method results in undefined behavior
|
||||
* if a previous write has failed.
|
||||
*/
|
||||
releaseBuffer(): Buffer;
|
||||
/**
|
||||
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
||||
* Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`.
|
||||
* @param id A 32-bit unsigned integer.
|
||||
* @param arrayBuffer An `ArrayBuffer` instance.
|
||||
*/
|
||||
transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
|
||||
/**
|
||||
* Write a raw 32-bit unsigned integer.
|
||||
* For use inside of a custom `serializer._writeHostObject()`.
|
||||
*/
|
||||
writeUint32(value: number): void;
|
||||
/**
|
||||
* Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.
|
||||
* For use inside of a custom `serializer._writeHostObject()`.
|
||||
*/
|
||||
writeUint64(hi: number, lo: number): void;
|
||||
/**
|
||||
* Write a JS `number` value.
|
||||
* For use inside of a custom `serializer._writeHostObject()`.
|
||||
*/
|
||||
writeDouble(value: number): void;
|
||||
/**
|
||||
* Write raw bytes into the serializer’s internal buffer. The deserializer
|
||||
* will require a way to compute the length of the buffer.
|
||||
* For use inside of a custom `serializer._writeHostObject()`.
|
||||
*/
|
||||
writeRawBytes(buffer: NodeJS.TypedArray): void;
|
||||
}
|
||||
/**
|
||||
* A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only
|
||||
* stores the part of their underlying `ArrayBuffer`s that they are referring to.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
class DefaultSerializer extends Serializer {}
|
||||
/**
|
||||
* @since v8.0.0
|
||||
*/
|
||||
class Deserializer {
|
||||
constructor(data: NodeJS.TypedArray);
|
||||
/**
|
||||
* Reads and validates a header (including the format version).
|
||||
* May, for example, reject an invalid or unsupported wire format. In that case,
|
||||
* an `Error` is thrown.
|
||||
*/
|
||||
readHeader(): boolean;
|
||||
/**
|
||||
* Deserializes a JavaScript value from the buffer and returns it.
|
||||
*/
|
||||
readValue(): any;
|
||||
/**
|
||||
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
||||
* Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of
|
||||
* `SharedArrayBuffer`s).
|
||||
* @param id A 32-bit unsigned integer.
|
||||
* @param arrayBuffer An `ArrayBuffer` instance.
|
||||
*/
|
||||
transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
|
||||
/**
|
||||
* Reads the underlying wire format version. Likely mostly to be useful to
|
||||
* legacy code reading old wire format versions. May not be called before`.readHeader()`.
|
||||
*/
|
||||
getWireFormatVersion(): number;
|
||||
/**
|
||||
* Read a raw 32-bit unsigned integer and return it.
|
||||
* For use inside of a custom `deserializer._readHostObject()`.
|
||||
*/
|
||||
readUint32(): number;
|
||||
/**
|
||||
* Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`with two 32-bit unsigned integer entries.
|
||||
* For use inside of a custom `deserializer._readHostObject()`.
|
||||
*/
|
||||
readUint64(): [number, number];
|
||||
/**
|
||||
* Read a JS `number` value.
|
||||
* For use inside of a custom `deserializer._readHostObject()`.
|
||||
*/
|
||||
readDouble(): number;
|
||||
/**
|
||||
* Read raw bytes from the deserializer’s internal buffer. The `length` parameter
|
||||
* must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`.
|
||||
* For use inside of a custom `deserializer._readHostObject()`.
|
||||
*/
|
||||
readRawBytes(length: number): Buffer;
|
||||
}
|
||||
/**
|
||||
* A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
class DefaultDeserializer extends Deserializer {}
|
||||
/**
|
||||
* Uses a `DefaultSerializer` to serialize `value` into a buffer.
|
||||
*
|
||||
* `ERR_BUFFER_TOO_LARGE` will be thrown when trying to
|
||||
* serialize a huge object which requires buffer
|
||||
* larger than `buffer.constants.MAX_LENGTH`.
|
||||
* @since v8.0.0
|
||||
*/
|
||||
function serialize(value: any): Buffer;
|
||||
/**
|
||||
* Uses a `DefaultDeserializer` with default options to read a JS value
|
||||
* from a buffer.
|
||||
* @since v8.0.0
|
||||
* @param buffer A buffer returned by {@link serialize}.
|
||||
*/
|
||||
function deserialize(buffer: NodeJS.TypedArray): any;
|
||||
/**
|
||||
* The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple
|
||||
* times during the lifetime of the process. Each time the execution counter will
|
||||
* be reset and a new coverage report will be written to the directory specified
|
||||
* by `NODE_V8_COVERAGE`.
|
||||
*
|
||||
* When the process is about to exit, one last coverage will still be written to
|
||||
* disk unless {@link stopCoverage} is invoked before the process exits.
|
||||
* @since v15.1.0, v14.18.0, v12.22.0
|
||||
*/
|
||||
function takeCoverage(): void;
|
||||
/**
|
||||
* The `v8.stopCoverage()` method allows the user to stop the coverage collection
|
||||
* started by `NODE_V8_COVERAGE`, so that V8 can release the execution count
|
||||
* records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand.
|
||||
* @since v15.1.0, v14.18.0, v12.22.0
|
||||
*/
|
||||
function stopCoverage(): void;
|
||||
}
|
||||
declare module 'node:v8' {
|
||||
export * from 'v8';
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
'use strict'
|
||||
const ParserEND = 0x110000
|
||||
class ParserError extends Error {
|
||||
/* istanbul ignore next */
|
||||
constructor (msg, filename, linenumber) {
|
||||
super('[ParserError] ' + msg, filename, linenumber)
|
||||
this.name = 'ParserError'
|
||||
this.code = 'ParserError'
|
||||
if (Error.captureStackTrace) Error.captureStackTrace(this, ParserError)
|
||||
}
|
||||
}
|
||||
class State {
|
||||
constructor (parser) {
|
||||
this.parser = parser
|
||||
this.buf = ''
|
||||
this.returned = null
|
||||
this.result = null
|
||||
this.resultTable = null
|
||||
this.resultArr = null
|
||||
}
|
||||
}
|
||||
class Parser {
|
||||
constructor () {
|
||||
this.pos = 0
|
||||
this.col = 0
|
||||
this.line = 0
|
||||
this.obj = {}
|
||||
this.ctx = this.obj
|
||||
this.stack = []
|
||||
this._buf = ''
|
||||
this.char = null
|
||||
this.ii = 0
|
||||
this.state = new State(this.parseStart)
|
||||
}
|
||||
|
||||
parse (str) {
|
||||
/* istanbul ignore next */
|
||||
if (str.length === 0 || str.length == null) return
|
||||
|
||||
this._buf = String(str)
|
||||
this.ii = -1
|
||||
this.char = -1
|
||||
let getNext
|
||||
while (getNext === false || this.nextChar()) {
|
||||
getNext = this.runOne()
|
||||
}
|
||||
this._buf = null
|
||||
}
|
||||
nextChar () {
|
||||
if (this.char === 0x0A) {
|
||||
++this.line
|
||||
this.col = -1
|
||||
}
|
||||
++this.ii
|
||||
this.char = this._buf.codePointAt(this.ii)
|
||||
++this.pos
|
||||
++this.col
|
||||
return this.haveBuffer()
|
||||
}
|
||||
haveBuffer () {
|
||||
return this.ii < this._buf.length
|
||||
}
|
||||
runOne () {
|
||||
return this.state.parser.call(this, this.state.returned)
|
||||
}
|
||||
finish () {
|
||||
this.char = ParserEND
|
||||
let last
|
||||
do {
|
||||
last = this.state.parser
|
||||
this.runOne()
|
||||
} while (this.state.parser !== last)
|
||||
|
||||
this.ctx = null
|
||||
this.state = null
|
||||
this._buf = null
|
||||
|
||||
return this.obj
|
||||
}
|
||||
next (fn) {
|
||||
/* istanbul ignore next */
|
||||
if (typeof fn !== 'function') throw new ParserError('Tried to set state to non-existent state: ' + JSON.stringify(fn))
|
||||
this.state.parser = fn
|
||||
}
|
||||
goto (fn) {
|
||||
this.next(fn)
|
||||
return this.runOne()
|
||||
}
|
||||
call (fn, returnWith) {
|
||||
if (returnWith) this.next(returnWith)
|
||||
this.stack.push(this.state)
|
||||
this.state = new State(fn)
|
||||
}
|
||||
callNow (fn, returnWith) {
|
||||
this.call(fn, returnWith)
|
||||
return this.runOne()
|
||||
}
|
||||
return (value) {
|
||||
/* istanbul ignore next */
|
||||
if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow'))
|
||||
if (value === undefined) value = this.state.buf
|
||||
this.state = this.stack.pop()
|
||||
this.state.returned = value
|
||||
}
|
||||
returnNow (value) {
|
||||
this.return(value)
|
||||
return this.runOne()
|
||||
}
|
||||
consume () {
|
||||
/* istanbul ignore next */
|
||||
if (this.char === ParserEND) throw this.error(new ParserError('Unexpected end-of-buffer'))
|
||||
this.state.buf += this._buf[this.ii]
|
||||
}
|
||||
error (err) {
|
||||
err.line = this.line
|
||||
err.col = this.col
|
||||
err.pos = this.pos
|
||||
return err
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
parseStart () {
|
||||
throw new ParserError('Must declare a parseStart method')
|
||||
}
|
||||
}
|
||||
Parser.END = ParserEND
|
||||
Parser.Error = ParserError
|
||||
module.exports = Parser
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"name": "has-tostringtag",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"description": "Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./shams": "./shams.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"pretest": "npm run --silent lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "npm run test:stock && npm run test:staging && npm run test:shams",
|
||||
"test:stock": "nyc node test",
|
||||
"test:staging": "nyc node --harmony --es-staging test",
|
||||
"test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs",
|
||||
"test:shams:corejs": "nyc node test/shams/core-js.js",
|
||||
"test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/has-tostringtag.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/has-tostringtag/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/has-tostringtag#readme",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"ecmascript",
|
||||
"symbol",
|
||||
"symbols",
|
||||
"tostringtag",
|
||||
"Symbol.toStringTag"
|
||||
],
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^17.6.0",
|
||||
"aud": "^1.1.5",
|
||||
"auto-changelog": "^2.3.0",
|
||||
"core-js": "^2.6.12",
|
||||
"eslint": "^7.32.0",
|
||||
"get-own-property-symbols": "^0.9.5",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iterator.d.ts","sourceRoot":"","sources":["../../../../src/internal/symbol/iterator.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED,eAAO,MAAM,QAAQ,QAAsB,CAAC"}
|
||||
@@ -0,0 +1,7 @@
|
||||
var loadRemoteResource = require('../reader/load-remote-resource');
|
||||
|
||||
function fetchFrom(callback) {
|
||||
return callback || loadRemoteResource;
|
||||
}
|
||||
|
||||
module.exports = fetchFrom;
|
||||
@@ -0,0 +1,150 @@
|
||||
'use strict'
|
||||
|
||||
exports.byteLength = byteLength
|
||||
exports.toByteArray = toByteArray
|
||||
exports.fromByteArray = fromByteArray
|
||||
|
||||
var lookup = []
|
||||
var revLookup = []
|
||||
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
||||
|
||||
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
for (var i = 0, len = code.length; i < len; ++i) {
|
||||
lookup[i] = code[i]
|
||||
revLookup[code.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
revLookup['-'.charCodeAt(0)] = 62
|
||||
revLookup['_'.charCodeAt(0)] = 63
|
||||
|
||||
function getLens (b64) {
|
||||
var len = b64.length
|
||||
|
||||
if (len % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// Trim off extra bytes after placeholder bytes are found
|
||||
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||
var validLen = b64.indexOf('=')
|
||||
if (validLen === -1) validLen = len
|
||||
|
||||
var placeHoldersLen = validLen === len
|
||||
? 0
|
||||
: 4 - (validLen % 4)
|
||||
|
||||
return [validLen, placeHoldersLen]
|
||||
}
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
function byteLength (b64) {
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function toByteArray (b64) {
|
||||
var tmp
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
|
||||
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||
|
||||
var curByte = 0
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
var len = placeHoldersLen > 0
|
||||
? validLen - 4
|
||||
: validLen
|
||||
|
||||
var i
|
||||
for (i = 0; i < len; i += 4) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||
revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 2) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 1) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return lookup[num >> 18 & 0x3F] +
|
||||
lookup[num >> 12 & 0x3F] +
|
||||
lookup[num >> 6 & 0x3F] +
|
||||
lookup[num & 0x3F]
|
||||
}
|
||||
|
||||
function encodeChunk (uint8, start, end) {
|
||||
var tmp
|
||||
var output = []
|
||||
for (var i = start; i < end; i += 3) {
|
||||
tmp =
|
||||
((uint8[i] << 16) & 0xFF0000) +
|
||||
((uint8[i + 1] << 8) & 0xFF00) +
|
||||
(uint8[i + 2] & 0xFF)
|
||||
output.push(tripletToBase64(tmp))
|
||||
}
|
||||
return output.join('')
|
||||
}
|
||||
|
||||
function fromByteArray (uint8) {
|
||||
var tmp
|
||||
var len = uint8.length
|
||||
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||
var parts = []
|
||||
var maxChunkLength = 16383 // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1) {
|
||||
tmp = uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 2] +
|
||||
lookup[(tmp << 4) & 0x3F] +
|
||||
'=='
|
||||
)
|
||||
} else if (extraBytes === 2) {
|
||||
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 10] +
|
||||
lookup[(tmp >> 4) & 0x3F] +
|
||||
lookup[(tmp << 2) & 0x3F] +
|
||||
'='
|
||||
)
|
||||
}
|
||||
|
||||
return parts.join('')
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/internal/ajax/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAsD5D,MAAM,CAAC,MAAM,SAAS,GAAkB,gBAAgB,CACtD,CAAC,MAAM,EAAE,EAAE,CACT,SAAS,aAAa,CAAY,OAAe,EAAE,GAAmB,EAAE,OAAoB;IAC1F,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACzB,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IACrC,IAAI,QAAa,CAAC;IAClB,IAAI;QAGF,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;KAChC;IAAC,OAAO,GAAG,EAAE;QACZ,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC;KAC7B;IACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,CAAC,CACJ,CAAC;AAsBF,MAAM,CAAC,MAAM,gBAAgB,GAAyB,CAAC,GAAG,EAAE;IAC1D,SAAS,oBAAoB,CAAY,GAAmB,EAAE,OAAoB;QAChF,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,oBAAoB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACpE,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC,EAAS,CAAC"}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').createLogger;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"48":0.00481,"52":0.06258,"59":0.01444,"60":0.00481,"68":0.01444,"72":0.00481,"78":0.04814,"79":0.00481,"80":0.00963,"81":0.00963,"82":0.00481,"83":0.00963,"86":0.00963,"87":0.01444,"88":0.00963,"89":0.00481,"90":0.00481,"91":0.02407,"93":0.00481,"94":0.01444,"95":0.00481,"96":0.00481,"99":0.00963,"100":0.00481,"101":0.00481,"102":0.16849,"103":0.17812,"104":0.01444,"105":0.02407,"106":0.01926,"107":0.02407,"108":0.13479,"109":2.39737,"110":1.59343,"111":0.00481,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50 51 53 54 55 56 57 58 61 62 63 64 65 66 67 69 70 71 73 74 75 76 77 84 85 92 97 98 112 3.5 3.6"},D:{"38":0.00963,"40":0.04333,"43":0.00481,"47":0.00963,"48":0.00481,"49":0.05295,"51":0.00481,"52":0.01926,"56":0.03851,"60":0.03851,"63":0.01444,"64":0.00481,"65":0.00481,"66":0.0674,"67":0.00481,"68":0.00963,"69":0.00963,"70":0.00963,"71":0.01444,"72":0.01444,"73":0.00481,"74":0.01926,"75":0.15405,"76":0.01926,"77":0.01444,"78":0.03851,"79":0.13479,"80":0.0337,"81":0.0337,"83":0.05295,"84":0.06258,"85":0.17812,"86":0.09147,"87":0.10109,"88":0.02407,"89":0.0337,"90":0.05777,"91":0.10591,"92":0.06258,"93":0.07702,"94":0.08184,"95":0.01926,"96":0.04333,"97":0.0337,"98":0.02888,"99":0.03851,"100":0.07702,"101":0.07221,"102":0.0674,"103":0.23107,"104":0.10109,"105":0.12516,"106":0.13479,"107":0.20219,"108":1.00613,"109":14.78861,"110":9.03106,"111":0.00963,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 41 42 44 45 46 50 53 54 55 57 58 59 61 62 112 113"},F:{"31":0.01926,"36":0.00481,"40":0.01444,"46":0.01444,"85":0.01444,"89":0.00963,"92":0.00481,"93":0.16368,"94":1.50678,"95":0.81838,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 90 91 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{"15":0.00481,"17":0.00963,"18":0.01926,"84":0.00481,"85":0.00481,"86":0.00481,"92":0.00963,"97":0.00481,"101":0.00481,"103":0.01444,"104":0.00963,"105":0.00963,"106":0.01444,"107":0.05777,"108":0.13961,"109":2.45033,"110":3.14836,_:"12 13 14 16 79 80 81 83 87 88 89 90 91 93 94 95 96 98 99 100 102"},E:{"4":0,"13":0.01926,"14":0.10591,"15":0.02407,_:"0 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 10.1","9.1":0.04814,"11.1":0.01444,"12.1":0.03851,"13.1":0.14923,"14.1":0.27921,"15.1":0.04814,"15.2-15.3":0.04333,"15.4":0.09628,"15.5":0.17812,"15.6":0.90503,"16.0":0.10591,"16.1":0.34661,"16.2":1.06871,"16.3":0.77505,"16.4":0.00481},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00349,"6.0-6.1":0,"7.0-7.1":0.0122,"8.1-8.4":0.00174,"9.0-9.2":0.01394,"9.3":0.08192,"10.0-10.2":0.00174,"10.3":0.07843,"11.0-11.2":0.01917,"11.3-11.4":0.03486,"12.0-12.1":0.01394,"12.2-12.5":0.37125,"13.0-13.1":0.00871,"13.2":0.00697,"13.3":0.02092,"13.4-13.7":0.08366,"14.0-14.4":0.19347,"14.5-14.8":0.47408,"15.0-15.1":0.10981,"15.2-15.3":0.16035,"15.4":0.17778,"15.5":0.38171,"15.6":1.4484,"16.0":1.81965,"16.1":4.27548,"16.2":4.2319,"16.3":2.40702,"16.4":0.0122},P:{"4":0.0844,"20":1.16053,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.01055,"8.2":0,"9.2":0.01048,"10.1":0,"11.1-11.2":0.0211,"12.0":0.01048,"13.0":0.0211,"14.0":0.0211,"15.0":0.01055,"16.0":0.0422,"17.0":0.05275,"18.0":0.07385,"19.0":1.87795},I:{"0":0,"3":0,"4":0.01443,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00361,"4.2-4.3":0.01443,"4.4":0,"4.4.3-4.4.4":0.05051},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"8":0.0152,"9":0.02027,"10":0.00507,"11":0.15202,_:"6 7 5.5"},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.11928},H:{"0":0.52044},L:{"0":31.68195},R:{_:"0"},M:{"0":0.43044},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function () {
|
||||
var hypot = Math.hypot;
|
||||
if (typeof hypot !== "function") return false;
|
||||
return hypot(3, 4) === 5;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"zipWith.js","sourceRoot":"","sources":["../../../../src/internal/operators/zipWith.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAyB5B,MAAM,UAAU,OAAO;IAAkC,qBAA4C;SAA5C,UAA4C,EAA5C,qBAA4C,EAA5C,IAA4C;QAA5C,gCAA4C;;IACnG,OAAO,GAAG,wCAAI,WAAW,IAAE;AAC7B,CAAC"}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { operate } from '../util/lift';
|
||||
export function finalize(callback) {
|
||||
return operate((source, subscriber) => {
|
||||
try {
|
||||
source.subscribe(subscriber);
|
||||
}
|
||||
finally {
|
||||
subscriber.add(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=finalize.js.map
|
||||
@@ -0,0 +1,170 @@
|
||||
type Numeric = number | bigint;
|
||||
|
||||
type Zero = 0 | 0n;
|
||||
|
||||
/**
|
||||
Matches the hidden `Infinity` type.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@see NegativeInfinity
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
// See https://github.com/microsoft/TypeScript/issues/31752
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
||||
export type PositiveInfinity = 1e999;
|
||||
|
||||
/**
|
||||
Matches the hidden `-Infinity` type.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@see PositiveInfinity
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
// See https://github.com/microsoft/TypeScript/issues/31752
|
||||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
||||
export type NegativeInfinity = -1e999;
|
||||
|
||||
/**
|
||||
A finite `number`.
|
||||
You can't pass a `bigint` as they are already guaranteed to be finite.
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
Note: This can't detect `NaN`, please upvote [this issue](https://github.com/microsoft/TypeScript/issues/28682) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Finite} from 'type-fest';
|
||||
|
||||
declare function setScore<T extends number>(length: Finite<T>): void;
|
||||
```
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type Finite<T extends number> = T extends PositiveInfinity | NegativeInfinity ? never : T;
|
||||
|
||||
/**
|
||||
A `number` that is an integer.
|
||||
You can't pass a `bigint` as they are already guaranteed to be integers.
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Integer} from 'type-fest';
|
||||
|
||||
declare function setYear<T extends number>(length: Integer<T>): void;
|
||||
```
|
||||
|
||||
@see NegativeInteger
|
||||
@see NonNegativeInteger
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
// `${bigint}` is a type that matches a valid bigint literal without the `n` (ex. 1, 0b1, 0o1, 0x1)
|
||||
// Because T is a number and not a string we can effectively use this to filter out any numbers containing decimal points
|
||||
export type Integer<T extends number> = `${T}` extends `${bigint}` ? T : never;
|
||||
|
||||
/**
|
||||
A `number` that is not an integer.
|
||||
You can't pass a `bigint` as they are already guaranteed to be integers.
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Float} from 'type-fest';
|
||||
|
||||
declare function setPercentage<T extends number>(length: Float<T>): void;
|
||||
```
|
||||
|
||||
@see Integer
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type Float<T extends number> = T extends Integer<T> ? never : T;
|
||||
|
||||
/**
|
||||
A negative (`-∞ < x < 0`) `number` that is not an integer.
|
||||
Equivalent to `Negative<Float<T>>`.
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@see Negative
|
||||
@see Float
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type NegativeFloat<T extends number> = Negative<Float<T>>;
|
||||
|
||||
/**
|
||||
A negative `number`/`bigint` (`-∞ < x < 0`)
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@see NegativeInteger
|
||||
@see NonNegative
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never;
|
||||
|
||||
/**
|
||||
A negative (`-∞ < x < 0`) `number` that is an integer.
|
||||
Equivalent to `Negative<Integer<T>>`.
|
||||
|
||||
You can't pass a `bigint` as they are already guaranteed to be integers, instead use `Negative<T>`.
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@see Negative
|
||||
@see Integer
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type NegativeInteger<T extends number> = Negative<Integer<T>>;
|
||||
|
||||
/**
|
||||
A non-negative `number`/`bigint` (`0 <= x < ∞`).
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@see NonNegativeInteger
|
||||
@see Negative
|
||||
|
||||
@example
|
||||
```
|
||||
import type {NonNegative} from 'type-fest';
|
||||
|
||||
declare function setLength<T extends number>(length: NonNegative<T>): void;
|
||||
```
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : never;
|
||||
|
||||
/**
|
||||
A non-negative (`0 <= x < ∞`) `number` that is an integer.
|
||||
Equivalent to `NonNegative<Integer<T>>`.
|
||||
|
||||
You can't pass a `bigint` as they are already guaranteed to be integers, instead use `NonNegative<T>`.
|
||||
|
||||
Use-case: Validating and documenting parameters.
|
||||
|
||||
@see NonNegative
|
||||
@see Integer
|
||||
|
||||
@example
|
||||
```
|
||||
import type {NonNegativeInteger} from 'type-fest';
|
||||
|
||||
declare function setLength<T extends number>(length: NonNegativeInteger<T>): void;
|
||||
```
|
||||
|
||||
@category Numeric
|
||||
*/
|
||||
export type NonNegativeInteger<T extends number> = NonNegative<Integer<T>>;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"644":"J D CC","2049":"F A B","2692":"E"},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","2049":"C K L G M N O"},C:{"1":"0 1 2 3 4 5 6 7 8 9 C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC","260":"I v J D E F A B","1156":"tB","1284":"EC","1796":"FC"},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 IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"HC zB"},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 SC qB AC TC rB","16":"F PC","132":"QC RC"},G:{"1":"E 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","16":"zB"},H:{"1":"oC"},I:{"1":"tB I f rC sC BC tC uC","16":"pC qC"},J:{"1":"D A"},K:{"1":"B C h qB AC rB","132":"A"},L:{"1":"H"},M:{"1":"H"},N:{"2049":"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:5,C:"Element.getBoundingClientRect()"};
|
||||
@@ -0,0 +1,30 @@
|
||||
var isPrototype = require('./_isPrototype'),
|
||||
nativeKeys = require('./_nativeKeys');
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function baseKeys(object) {
|
||||
if (!isPrototype(object)) {
|
||||
return nativeKeys(object);
|
||||
}
|
||||
var result = [];
|
||||
for (var key in Object(object)) {
|
||||
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseKeys;
|
||||
@@ -0,0 +1,267 @@
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
import { Observable } from './Observable';
|
||||
import { Subscription } from './Subscription';
|
||||
/**
|
||||
* Note: This will add Symbol.observable globally for all TypeScript users,
|
||||
* however, we are no longer polyfilling Symbol.observable
|
||||
*/
|
||||
declare global {
|
||||
interface SymbolConstructor {
|
||||
readonly observable: symbol;
|
||||
}
|
||||
}
|
||||
/** OPERATOR INTERFACES */
|
||||
export interface UnaryFunction<T, R> {
|
||||
(source: T): R;
|
||||
}
|
||||
export interface OperatorFunction<T, R> extends UnaryFunction<Observable<T>, Observable<R>> {
|
||||
}
|
||||
export declare type FactoryOrValue<T> = T | (() => T);
|
||||
export interface MonoTypeOperatorFunction<T> extends OperatorFunction<T, T> {
|
||||
}
|
||||
/**
|
||||
* A value and the time at which it was emitted.
|
||||
*
|
||||
* Emitted by the `timestamp` operator
|
||||
*
|
||||
* @see {@link timestamp}
|
||||
*/
|
||||
export interface Timestamp<T> {
|
||||
value: T;
|
||||
/**
|
||||
* The timestamp. By default, this is in epoch milliseconds.
|
||||
* Could vary based on the timestamp provider passed to the operator.
|
||||
*/
|
||||
timestamp: number;
|
||||
}
|
||||
/**
|
||||
* A value emitted and the amount of time since the last value was emitted.
|
||||
*
|
||||
* Emitted by the `timeInterval` operator.
|
||||
*
|
||||
* @see {@link timeInterval}
|
||||
*/
|
||||
export interface TimeInterval<T> {
|
||||
value: T;
|
||||
/**
|
||||
* The amount of time between this value's emission and the previous value's emission.
|
||||
* If this is the first emitted value, then it will be the amount of time since subscription
|
||||
* started.
|
||||
*/
|
||||
interval: number;
|
||||
}
|
||||
/** SUBSCRIPTION INTERFACES */
|
||||
export interface Unsubscribable {
|
||||
unsubscribe(): void;
|
||||
}
|
||||
export declare type TeardownLogic = Subscription | Unsubscribable | (() => void) | void;
|
||||
export interface SubscriptionLike extends Unsubscribable {
|
||||
unsubscribe(): void;
|
||||
readonly closed: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Do not use. Most likely you want to use `ObservableInput`. Will be removed in v8.
|
||||
*/
|
||||
export declare type SubscribableOrPromise<T> = Subscribable<T> | Subscribable<never> | PromiseLike<T> | InteropObservable<T>;
|
||||
/** OBSERVABLE INTERFACES */
|
||||
export interface Subscribable<T> {
|
||||
subscribe(observer: Partial<Observer<T>>): Unsubscribable;
|
||||
}
|
||||
/**
|
||||
* Valid types that can be converted to observables.
|
||||
*/
|
||||
export declare type ObservableInput<T> = Observable<T> | InteropObservable<T> | AsyncIterable<T> | PromiseLike<T> | ArrayLike<T> | Iterable<T> | ReadableStreamLike<T>;
|
||||
/**
|
||||
* @deprecated Renamed to {@link InteropObservable }. Will be removed in v8.
|
||||
*/
|
||||
export declare type ObservableLike<T> = InteropObservable<T>;
|
||||
/**
|
||||
* An object that implements the `Symbol.observable` interface.
|
||||
*/
|
||||
export interface InteropObservable<T> {
|
||||
[Symbol.observable]: () => Subscribable<T>;
|
||||
}
|
||||
/** NOTIFICATIONS */
|
||||
/**
|
||||
* A notification representing a "next" from an observable.
|
||||
* Can be used with {@link dematerialize}.
|
||||
*/
|
||||
export interface NextNotification<T> {
|
||||
/** The kind of notification. Always "N" */
|
||||
kind: 'N';
|
||||
/** The value of the notification. */
|
||||
value: T;
|
||||
}
|
||||
/**
|
||||
* A notification representing an "error" from an observable.
|
||||
* Can be used with {@link dematerialize}.
|
||||
*/
|
||||
export interface ErrorNotification {
|
||||
/** The kind of notification. Always "E" */
|
||||
kind: 'E';
|
||||
error: any;
|
||||
}
|
||||
/**
|
||||
* A notification representing a "completion" from an observable.
|
||||
* Can be used with {@link dematerialize}.
|
||||
*/
|
||||
export interface CompleteNotification {
|
||||
kind: 'C';
|
||||
}
|
||||
/**
|
||||
* Valid observable notification types.
|
||||
*/
|
||||
export declare type ObservableNotification<T> = NextNotification<T> | ErrorNotification | CompleteNotification;
|
||||
/** OBSERVER INTERFACES */
|
||||
export interface NextObserver<T> {
|
||||
closed?: boolean;
|
||||
next: (value: T) => void;
|
||||
error?: (err: any) => void;
|
||||
complete?: () => void;
|
||||
}
|
||||
export interface ErrorObserver<T> {
|
||||
closed?: boolean;
|
||||
next?: (value: T) => void;
|
||||
error: (err: any) => void;
|
||||
complete?: () => void;
|
||||
}
|
||||
export interface CompletionObserver<T> {
|
||||
closed?: boolean;
|
||||
next?: (value: T) => void;
|
||||
error?: (err: any) => void;
|
||||
complete: () => void;
|
||||
}
|
||||
export declare type PartialObserver<T> = NextObserver<T> | ErrorObserver<T> | CompletionObserver<T>;
|
||||
export interface Observer<T> {
|
||||
next: (value: T) => void;
|
||||
error: (err: any) => void;
|
||||
complete: () => void;
|
||||
}
|
||||
export interface SubjectLike<T> extends Observer<T>, Subscribable<T> {
|
||||
}
|
||||
/** SCHEDULER INTERFACES */
|
||||
export interface SchedulerLike extends TimestampProvider {
|
||||
schedule<T>(work: (this: SchedulerAction<T>, state: T) => void, delay: number, state: T): Subscription;
|
||||
schedule<T>(work: (this: SchedulerAction<T>, state?: T) => void, delay: number, state?: T): Subscription;
|
||||
schedule<T>(work: (this: SchedulerAction<T>, state?: T) => void, delay?: number, state?: T): Subscription;
|
||||
}
|
||||
export interface SchedulerAction<T> extends Subscription {
|
||||
schedule(state?: T, delay?: number): Subscription;
|
||||
}
|
||||
/**
|
||||
* This is a type that provides a method to allow RxJS to create a numeric timestamp
|
||||
*/
|
||||
export interface TimestampProvider {
|
||||
/**
|
||||
* Returns a timestamp as a number.
|
||||
*
|
||||
* This is used by types like `ReplaySubject` or operators like `timestamp` to calculate
|
||||
* the amount of time passed between events.
|
||||
*/
|
||||
now(): number;
|
||||
}
|
||||
/**
|
||||
* Extracts the type from an `ObservableInput<any>`. If you have
|
||||
* `O extends ObservableInput<any>` and you pass in `Observable<number>`, or
|
||||
* `Promise<number>`, etc, it will type as `number`.
|
||||
*/
|
||||
export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
|
||||
/**
|
||||
* Extracts a union of element types from an `ObservableInput<any>[]`.
|
||||
* If you have `O extends ObservableInput<any>[]` and you pass in
|
||||
* `Observable<string>[]` or `Promise<string>[]` you would get
|
||||
* back a type of `string`.
|
||||
* If you pass in `[Observable<string>, Observable<number>]` you would
|
||||
* get back a type of `string | number`.
|
||||
*/
|
||||
export declare type ObservedValueUnionFromArray<X> = X extends Array<ObservableInput<infer T>> ? T : never;
|
||||
/**
|
||||
* @deprecated Renamed to {@link ObservedValueUnionFromArray}. Will be removed in v8.
|
||||
*/
|
||||
export declare type ObservedValuesFromArray<X> = ObservedValueUnionFromArray<X>;
|
||||
/**
|
||||
* Extracts a tuple of element types from an `ObservableInput<any>[]`.
|
||||
* If you have `O extends ObservableInput<any>[]` and you pass in
|
||||
* `[Observable<string>, Observable<number>]` you would get back a type
|
||||
* of `[string, number]`.
|
||||
*/
|
||||
export declare type ObservedValueTupleFromArray<X> = {
|
||||
[K in keyof X]: ObservedValueOf<X[K]>;
|
||||
};
|
||||
/**
|
||||
* Used to infer types from arguments to functions like {@link forkJoin}.
|
||||
* So that you can have `forkJoin([Observable<A>, PromiseLike<B>]): Observable<[A, B]>`
|
||||
* et al.
|
||||
*/
|
||||
export declare type ObservableInputTuple<T> = {
|
||||
[K in keyof T]: ObservableInput<T[K]>;
|
||||
};
|
||||
/**
|
||||
* Constructs a new tuple with the specified type at the head.
|
||||
* If you declare `Cons<A, [B, C]>` you will get back `[A, B, C]`.
|
||||
*/
|
||||
export declare type Cons<X, Y extends readonly any[]> = ((arg: X, ...rest: Y) => any) extends (...args: infer U) => any ? U : never;
|
||||
/**
|
||||
* Extracts the head of a tuple.
|
||||
* If you declare `Head<[A, B, C]>` you will get back `A`.
|
||||
*/
|
||||
export declare type Head<X extends readonly any[]> = ((...args: X) => any) extends (arg: infer U, ...rest: any[]) => any ? U : never;
|
||||
/**
|
||||
* Extracts the tail of a tuple.
|
||||
* If you declare `Tail<[A, B, C]>` you will get back `[B, C]`.
|
||||
*/
|
||||
export declare type Tail<X extends readonly any[]> = ((...args: X) => any) extends (arg: any, ...rest: infer U) => any ? U : never;
|
||||
/**
|
||||
* Extracts the generic value from an Array type.
|
||||
* If you have `T extends Array<any>`, and pass a `string[]` to it,
|
||||
* `ValueFromArray<T>` will return the actual type of `string`.
|
||||
*/
|
||||
export declare type ValueFromArray<A extends readonly unknown[]> = A extends Array<infer T> ? T : never;
|
||||
/**
|
||||
* Gets the value type from an {@link ObservableNotification}, if possible.
|
||||
*/
|
||||
export declare type ValueFromNotification<T> = T extends {
|
||||
kind: 'N' | 'E' | 'C';
|
||||
} ? T extends NextNotification<any> ? T extends {
|
||||
value: infer V;
|
||||
} ? V : undefined : never : never;
|
||||
/**
|
||||
* A simple type to represent a gamut of "falsy" values... with a notable exception:
|
||||
* `NaN` is "falsy" however, it is not and cannot be typed via TypeScript. See
|
||||
* comments here: https://github.com/microsoft/TypeScript/issues/28682#issuecomment-707142417
|
||||
*/
|
||||
export declare type Falsy = null | undefined | false | 0 | -0 | 0n | '';
|
||||
export declare type TruthyTypesOf<T> = T extends Falsy ? never : T;
|
||||
interface ReadableStreamDefaultReaderLike<T> {
|
||||
read(): PromiseLike<{
|
||||
done: false;
|
||||
value: T;
|
||||
} | {
|
||||
done: true;
|
||||
value?: undefined;
|
||||
}>;
|
||||
releaseLock(): void;
|
||||
}
|
||||
/**
|
||||
* The base signature RxJS will look for to identify and use
|
||||
* a [ReadableStream](https://streams.spec.whatwg.org/#rs-class)
|
||||
* as an {@link ObservableInput} source.
|
||||
*/
|
||||
export interface ReadableStreamLike<T> {
|
||||
getReader(): ReadableStreamDefaultReaderLike<T>;
|
||||
}
|
||||
/**
|
||||
* An observable with a `connect` method that is used to create a subscription
|
||||
* to an underlying source, connecting it with all consumers via a multicast.
|
||||
*/
|
||||
export interface Connectable<T> extends Observable<T> {
|
||||
/**
|
||||
* (Idempotent) Calling this method will connect the underlying source observable to all subscribed consumers
|
||||
* through an underlying {@link Subject}.
|
||||
* @returns A subscription, that when unsubscribed, will "disconnect" the source from the connector subject,
|
||||
* severing notifications to all consumers.
|
||||
*/
|
||||
connect(): Subscription;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
Reference in New Issue
Block a user