new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction } from '../../internal/types';
|
||||
export declare function first<T, D = T>(predicate?: null, defaultValue?: D): OperatorFunction<T, T | D>;
|
||||
export declare function first<T, S extends T>(predicate: (value: T, index: number, source: Observable<T>) => value is S, defaultValue?: S): OperatorFunction<T, S>;
|
||||
export declare function first<T, D = T>(predicate: (value: T, index: number, source: Observable<T>) => boolean, defaultValue?: D): OperatorFunction<T, T | D>;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"zipAll.js","sources":["../../../src/internal/operators/zipAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD,MAAM,UAAU,MAAM,CAAO,OAAsC;IACjE,OAAO,CAAC,MAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.00558,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00558,"67":0,"68":0.00558,"69":0,"70":0,"71":0,"72":0,"73":0.00558,"74":0,"75":0,"76":0,"77":0,"78":0.01117,"79":0,"80":0,"81":0,"82":0,"83":0.00558,"84":0,"85":0,"86":0,"87":0,"88":0.00558,"89":0,"90":0,"91":0.00558,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00558,"101":0,"102":0.01117,"103":0,"104":0.01117,"105":0.00558,"106":0.00558,"107":0.01675,"108":0.4523,"109":0.28478,"110":0,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00558,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.02234,"50":0,"51":0,"52":0.00558,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00558,"66":0.01117,"67":0.00558,"68":0.00558,"69":0.00558,"70":0.00558,"71":0.00558,"72":0.00558,"73":0.00558,"74":0.01117,"75":0.00558,"76":0.01117,"77":0.01117,"78":0.00558,"79":0.03909,"80":0.01675,"81":0.01675,"83":0.01117,"84":0.01117,"85":0.01675,"86":0.01675,"87":0.03909,"88":0.01675,"89":0.02792,"90":0.0335,"91":0.06701,"92":0.05584,"93":0.04467,"94":0.02792,"95":0.00558,"96":0.01117,"97":0.02234,"98":0.0335,"99":0.01675,"100":0.02234,"101":0.01675,"102":0.02234,"103":0.1061,"104":0.03909,"105":0.03909,"106":0.05026,"107":0.15077,"108":10.69894,"109":13.6473,"110":0.00558,"111":0,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00558,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00558,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00558,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00558,"93":0.28478,"94":0.33504,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0.01117,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.00558,"79":0,"80":0,"81":0,"83":0,"84":0.00558,"85":0,"86":0.00558,"87":0,"88":0,"89":0.00558,"90":0.00558,"91":0,"92":0.00558,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.00558,"103":0.00558,"104":0.00558,"105":0.00558,"106":0.00558,"107":0.08376,"108":0.85994,"109":0.85435},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00558,"14":0.02234,"15":0.00558,_:"0","3.1":0,"3.2":0,"5.1":0.00558,"6.1":0,"7.1":0,"9.1":0.0335,"10.1":0,"11.1":0,"12.1":0.01117,"13.1":0.05026,"14.1":0.06701,"15.1":0.01117,"15.2-15.3":0.01117,"15.4":0.02792,"15.5":0.05026,"15.6":0.27362,"16.0":0.02792,"16.1":0.12843,"16.2":0.21778,"16.3":0.01675},G:{"8":0.00302,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00454,"6.0-6.1":0,"7.0-7.1":0.01058,"8.1-8.4":0.00151,"9.0-9.2":0.01209,"9.3":0.07256,"10.0-10.2":0,"10.3":0.05896,"11.0-11.2":0.01209,"11.3-11.4":0.02721,"12.0-12.1":0.01361,"12.2-12.5":0.38247,"13.0-13.1":0.00907,"13.2":0.00605,"13.3":0.01814,"13.4-13.7":0.05291,"14.0-14.4":0.14362,"14.5-14.8":0.4112,"15.0-15.1":0.08919,"15.2-15.3":0.13757,"15.4":0.1542,"15.5":0.3855,"15.6":1.65537,"16.0":2.1089,"16.1":4.70761,"16.2":3.42715,"16.3":0.27967},P:{"4":0.12383,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.0516,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01032,"12.0":0,"13.0":0.01032,"14.0":0.01032,"15.0":0.01032,"16.0":0.02064,"17.0":0.04128,"18.0":0.03096,"19.0":0.67077},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00484,"4.2-4.3":0.00968,"4.4":0,"4.4.3-4.4.4":0.11132},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.05026,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.15456},Q:{"13.1":0},O:{"0":0.03533},H:{"0":0.16305},L:{"0":53.16968},S:{"2.5":0.00442}};
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { FindValueOperator } from '../operators/find';
|
||||
import { OperatorFunction } from '../types';
|
||||
/**
|
||||
* Emits only the index of the first value emitted by the source Observable that
|
||||
* meets some condition.
|
||||
*
|
||||
* <span class="informal">It's like {@link find}, but emits the index of the
|
||||
* found value, not the value itself.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `findIndex` searches for the first item in the source Observable that matches
|
||||
* the specified condition embodied by the `predicate`, and returns the
|
||||
* (zero-based) index of the first occurrence in the source. Unlike
|
||||
* {@link first}, the `predicate` is required in `findIndex`, and does not emit
|
||||
* an error if a valid value is not found.
|
||||
*
|
||||
* ## Example
|
||||
* Emit the index of first click that happens on a DIV element
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { findIndex } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const result = clicks.pipe(findIndex(ev => ev.target.tagName === 'DIV'));
|
||||
* result.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link filter}
|
||||
* @see {@link find}
|
||||
* @see {@link first}
|
||||
* @see {@link take}
|
||||
*
|
||||
* @param {function(value: T, index: number, source: Observable<T>): boolean} predicate
|
||||
* A function called with each item to test for condition matching.
|
||||
* @param {any} [thisArg] An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return {Observable} An Observable of the index of the first item that
|
||||
* matches the condition.
|
||||
* @method find
|
||||
* @owner Observable
|
||||
*/
|
||||
export function findIndex<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean,
|
||||
thisArg?: any): OperatorFunction<T, number> {
|
||||
return (source: Observable<T>) => source.lift(new FindValueOperator(predicate, source, true, thisArg)) as Observable<any>;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pairwise.js","sources":["../../src/add/operator/pairwise.ts"],"names":[],"mappings":";;AAAA,6CAA2C"}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { QueueScheduler } from './QueueScheduler';
|
||||
/**
|
||||
*
|
||||
* Queue Scheduler
|
||||
*
|
||||
* <span class="informal">Put every next task on a queue, instead of executing it immediately</span>
|
||||
*
|
||||
* `queue` scheduler, when used with delay, behaves the same as {@link asyncScheduler} scheduler.
|
||||
*
|
||||
* When used without delay, it schedules given task synchronously - executes it right when
|
||||
* it is scheduled. However when called recursively, that is when inside the scheduled task,
|
||||
* another task is scheduled with queue scheduler, instead of executing immediately as well,
|
||||
* that task will be put on a queue and wait for current one to finish.
|
||||
*
|
||||
* This means that when you execute task with `queue` scheduler, you are sure it will end
|
||||
* before any other task scheduled with that scheduler will start.
|
||||
*
|
||||
* ## Examples
|
||||
* Schedule recursively first, then do something
|
||||
* ```ts
|
||||
* import { queueScheduler } from 'rxjs';
|
||||
*
|
||||
* queueScheduler.schedule(() => {
|
||||
* queueScheduler.schedule(() => console.log('second')); // will not happen now, but will be put on a queue
|
||||
*
|
||||
* console.log('first');
|
||||
* });
|
||||
*
|
||||
* // Logs:
|
||||
* // "first"
|
||||
* // "second"
|
||||
* ```
|
||||
*
|
||||
* Reschedule itself recursively
|
||||
* ```ts
|
||||
* import { queueScheduler } from 'rxjs';
|
||||
*
|
||||
* queueScheduler.schedule(function(state) {
|
||||
* if (state !== 0) {
|
||||
* console.log('before', state);
|
||||
* this.schedule(state - 1); // `this` references currently executing Action,
|
||||
* // which we reschedule with new state
|
||||
* console.log('after', state);
|
||||
* }
|
||||
* }, 0, 3);
|
||||
*
|
||||
* // In scheduler that runs recursively, you would expect:
|
||||
* // "before", 3
|
||||
* // "before", 2
|
||||
* // "before", 1
|
||||
* // "after", 1
|
||||
* // "after", 2
|
||||
* // "after", 3
|
||||
*
|
||||
* // But with queue it logs:
|
||||
* // "before", 3
|
||||
* // "after", 3
|
||||
* // "before", 2
|
||||
* // "after", 2
|
||||
* // "before", 1
|
||||
* // "after", 1
|
||||
* ```
|
||||
*/
|
||||
export declare const queueScheduler: QueueScheduler;
|
||||
/**
|
||||
* @deprecated renamed. Use {@link queueScheduler}
|
||||
*/
|
||||
export declare const queue: QueueScheduler;
|
||||
@@ -0,0 +1,31 @@
|
||||
/** PURE_IMPORTS_START _subscribeToArray,_subscribeToPromise,_subscribeToIterable,_subscribeToObservable,_isArrayLike,_isPromise,_isObject,_symbol_iterator,_symbol_observable PURE_IMPORTS_END */
|
||||
import { subscribeToArray } from './subscribeToArray';
|
||||
import { subscribeToPromise } from './subscribeToPromise';
|
||||
import { subscribeToIterable } from './subscribeToIterable';
|
||||
import { subscribeToObservable } from './subscribeToObservable';
|
||||
import { isArrayLike } from './isArrayLike';
|
||||
import { isPromise } from './isPromise';
|
||||
import { isObject } from './isObject';
|
||||
import { iterator as Symbol_iterator } from '../symbol/iterator';
|
||||
import { observable as Symbol_observable } from '../symbol/observable';
|
||||
export var subscribeTo = function (result) {
|
||||
if (!!result && typeof result[Symbol_observable] === 'function') {
|
||||
return subscribeToObservable(result);
|
||||
}
|
||||
else if (isArrayLike(result)) {
|
||||
return subscribeToArray(result);
|
||||
}
|
||||
else if (isPromise(result)) {
|
||||
return subscribeToPromise(result);
|
||||
}
|
||||
else if (!!result && typeof result[Symbol_iterator] === 'function') {
|
||||
return subscribeToIterable(result);
|
||||
}
|
||||
else {
|
||||
var value = isObject(result) ? 'an invalid object' : "'" + result + "'";
|
||||
var msg = "You provided " + value + " where a stream was expected."
|
||||
+ ' You can provide an Observable, Promise, Array, or Iterable.';
|
||||
throw new TypeError(msg);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=subscribeTo.js.map
|
||||
@@ -0,0 +1,113 @@
|
||||
'use strict';
|
||||
/**
|
||||
* `input` type prompt
|
||||
*/
|
||||
|
||||
var chalk = require('chalk');
|
||||
var { map, takeUntil } = require('rxjs/operators');
|
||||
var Base = require('./base');
|
||||
var observe = require('../utils/events');
|
||||
|
||||
class InputPrompt extends Base {
|
||||
/**
|
||||
* Start the Inquiry session
|
||||
* @param {Function} cb Callback when prompt is done
|
||||
* @return {this}
|
||||
*/
|
||||
|
||||
_run(cb) {
|
||||
this.done = cb;
|
||||
|
||||
// Once user confirm (enter key)
|
||||
var events = observe(this.rl);
|
||||
var submit = events.line.pipe(map(this.filterInput.bind(this)));
|
||||
|
||||
var validation = this.handleSubmitEvents(submit);
|
||||
validation.success.forEach(this.onEnd.bind(this));
|
||||
validation.error.forEach(this.onError.bind(this));
|
||||
|
||||
events.keypress
|
||||
.pipe(takeUntil(validation.success))
|
||||
.forEach(this.onKeypress.bind(this));
|
||||
|
||||
// Init
|
||||
this.render();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the prompt to screen
|
||||
* @return {InputPrompt} self
|
||||
*/
|
||||
|
||||
render(error) {
|
||||
var bottomContent = '';
|
||||
var appendContent = '';
|
||||
var message = this.getQuestion();
|
||||
var transformer = this.opt.transformer;
|
||||
var isFinal = this.status === 'answered';
|
||||
|
||||
if (isFinal) {
|
||||
appendContent = this.answer;
|
||||
} else {
|
||||
appendContent = this.rl.line;
|
||||
}
|
||||
|
||||
if (transformer) {
|
||||
message += transformer(appendContent, this.answers, { isFinal });
|
||||
} else {
|
||||
message += isFinal ? chalk.cyan(appendContent) : appendContent;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
bottomContent = chalk.red('>> ') + error;
|
||||
}
|
||||
|
||||
this.screen.render(message, bottomContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* When user press `enter` key
|
||||
*/
|
||||
|
||||
filterInput(input) {
|
||||
if (!input) {
|
||||
return this.opt.default == null ? '' : this.opt.default;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
onEnd(state) {
|
||||
this.answer = state.value;
|
||||
this.status = 'answered';
|
||||
|
||||
// Re-render prompt
|
||||
this.render();
|
||||
|
||||
this.screen.done();
|
||||
this.done(state.value);
|
||||
}
|
||||
|
||||
onError({ value = '', isValid }) {
|
||||
this.rl.line += value;
|
||||
this.rl.cursor += value.length;
|
||||
this.render(isValid);
|
||||
}
|
||||
|
||||
/**
|
||||
* When user press a key
|
||||
*/
|
||||
|
||||
onKeypress() {
|
||||
// If user press a key, just clear the default value
|
||||
if (this.opt.default) {
|
||||
this.opt.default = undefined;
|
||||
}
|
||||
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InputPrompt;
|
||||
@@ -0,0 +1,21 @@
|
||||
declare const widestLine: {
|
||||
/**
|
||||
Get the visual width of the widest line in a string - the number of columns required to display it.
|
||||
|
||||
@example
|
||||
```
|
||||
import widestLine = require('widest-line');
|
||||
|
||||
widestLine('古\n\u001B[1m@\u001B[22m');
|
||||
//=> 2
|
||||
```
|
||||
*/
|
||||
(input: string): number;
|
||||
|
||||
// TODO: remove this in the next major version, refactor definition to:
|
||||
// declare function widestLine(input: string): number;
|
||||
// export = widestLine;
|
||||
default: typeof widestLine;
|
||||
};
|
||||
|
||||
export = widestLine;
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operator/findIndex';
|
||||
@@ -0,0 +1,2 @@
|
||||
export const errorObject = { e: {} };
|
||||
//# sourceMappingURL=errorObject.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"animationFrame.js","sources":["../../../src/internal/scheduler/animationFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAiCpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;AAKzF,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC"}
|
||||
@@ -0,0 +1,95 @@
|
||||
/** PURE_IMPORTS_START tslib,_Action PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { Action } from './Action';
|
||||
var AsyncAction = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(AsyncAction, _super);
|
||||
function AsyncAction(scheduler, work) {
|
||||
var _this = _super.call(this, scheduler, work) || this;
|
||||
_this.scheduler = scheduler;
|
||||
_this.work = work;
|
||||
_this.pending = false;
|
||||
return _this;
|
||||
}
|
||||
AsyncAction.prototype.schedule = function (state, delay) {
|
||||
if (delay === void 0) {
|
||||
delay = 0;
|
||||
}
|
||||
if (this.closed) {
|
||||
return this;
|
||||
}
|
||||
this.state = state;
|
||||
var id = this.id;
|
||||
var scheduler = this.scheduler;
|
||||
if (id != null) {
|
||||
this.id = this.recycleAsyncId(scheduler, id, delay);
|
||||
}
|
||||
this.pending = true;
|
||||
this.delay = delay;
|
||||
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
|
||||
return this;
|
||||
};
|
||||
AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {
|
||||
if (delay === void 0) {
|
||||
delay = 0;
|
||||
}
|
||||
return setInterval(scheduler.flush.bind(scheduler, this), delay);
|
||||
};
|
||||
AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
|
||||
if (delay === void 0) {
|
||||
delay = 0;
|
||||
}
|
||||
if (delay !== null && this.delay === delay && this.pending === false) {
|
||||
return id;
|
||||
}
|
||||
clearInterval(id);
|
||||
return undefined;
|
||||
};
|
||||
AsyncAction.prototype.execute = function (state, delay) {
|
||||
if (this.closed) {
|
||||
return new Error('executing a cancelled action');
|
||||
}
|
||||
this.pending = false;
|
||||
var error = this._execute(state, delay);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
else if (this.pending === false && this.id != null) {
|
||||
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
||||
}
|
||||
};
|
||||
AsyncAction.prototype._execute = function (state, delay) {
|
||||
var errored = false;
|
||||
var errorValue = undefined;
|
||||
try {
|
||||
this.work(state);
|
||||
}
|
||||
catch (e) {
|
||||
errored = true;
|
||||
errorValue = !!e && e || new Error(e);
|
||||
}
|
||||
if (errored) {
|
||||
this.unsubscribe();
|
||||
return errorValue;
|
||||
}
|
||||
};
|
||||
AsyncAction.prototype._unsubscribe = function () {
|
||||
var id = this.id;
|
||||
var scheduler = this.scheduler;
|
||||
var actions = scheduler.actions;
|
||||
var index = actions.indexOf(this);
|
||||
this.work = null;
|
||||
this.state = null;
|
||||
this.pending = false;
|
||||
this.scheduler = null;
|
||||
if (index !== -1) {
|
||||
actions.splice(index, 1);
|
||||
}
|
||||
if (id != null) {
|
||||
this.id = this.recycleAsyncId(scheduler, id, null);
|
||||
}
|
||||
this.delay = null;
|
||||
};
|
||||
return AsyncAction;
|
||||
}(Action));
|
||||
export { AsyncAction };
|
||||
//# sourceMappingURL=AsyncAction.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"J E F G A B","16":"BC"},B:{"1":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"1":"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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"1":"I u J E F G A B C K L H zB HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","16":"GC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d OC PC QC RC qB 9B SC rB","16":"G"},G:{"1":"F TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","16":"zB"},H:{"1":"nC"},I:{"1":"tB I D qC rC AC sC tC","16":"oC pC"},J:{"1":"E A"},K:{"1":"A B C e qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"1":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:1,C:"HTMLElement.innerText"};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"ansi-escapes","version":"4.3.2","files":{"license":{"checkedAt":1678887829613,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678887829997,"integrity":"sha512-ybAcVccbyYULQ2jSqmzZMcADVse8cSLKlsIUbvAro9MsdAfZA3hH5JUqKysxh8Js0GKpcjFoS35uTMUpKm3XGQ==","mode":420,"size":3750},"package.json":{"checkedAt":1678887829997,"integrity":"sha512-skD6+9G0onAaKWOWtMUwdA4oo9QlxgX4i3nsIQNjSfFaLiDeuhVIQTWkuhQRg1/riue9wKnK0TN1y5hZX+MxDQ==","mode":420,"size":929},"readme.md":{"checkedAt":1678887829997,"integrity":"sha512-G0VZHuDbCWMrABHLcqxYmhtFd+t64p8ff/mw2A6qiHqflgYnFc3/TD8b8RtA+zxKz3tPGKAmHihMiMhSTw/7tA==","mode":420,"size":5011},"index.d.ts":{"checkedAt":1678887830006,"integrity":"sha512-McpxESU83NkdB8vFkxyarH+bgjuhbiNV5WNO/JHDqkW9FcitqbgEr1fHEyiTbD0I18jaWZfeocyw06A9/3ffhw==","mode":420,"size":5573}}}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,164 @@
|
||||
import assertString from './util/assertString';
|
||||
/* eslint-disable max-len */
|
||||
|
||||
var phones = {
|
||||
'am-AM': /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,
|
||||
'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/,
|
||||
'ar-BH': /^(\+?973)?(3|6)\d{7}$/,
|
||||
'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/,
|
||||
'ar-LB': /^(\+?961)?((3|81)\d{6}|7\d{7})$/,
|
||||
'ar-EG': /^((\+?20)|0)?1[0125]\d{8}$/,
|
||||
'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/,
|
||||
'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
|
||||
'ar-KW': /^(\+?965)[569]\d{7}$/,
|
||||
'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
|
||||
'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/,
|
||||
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
|
||||
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
|
||||
'ar-TN': /^(\+?216)?[2459]\d{7}$/,
|
||||
'az-AZ': /^(\+994|0)(5[015]|7[07]|99)\d{7}$/,
|
||||
'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,
|
||||
'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,
|
||||
'bg-BG': /^(\+?359|0)?8[789]\d{7}$/,
|
||||
'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/,
|
||||
'ca-AD': /^(\+376)?[346]\d{5}$/,
|
||||
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
|
||||
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
||||
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
|
||||
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
|
||||
'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/,
|
||||
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
|
||||
'el-GR': /^(\+?30|0)?(69\d{8})$/,
|
||||
'en-AU': /^(\+?61|0)4\d{8}$/,
|
||||
'en-GB': /^(\+?44|0)7\d{9}$/,
|
||||
'en-GG': /^(\+?44|0)1481\d{6}$/,
|
||||
'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,
|
||||
'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,
|
||||
'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,
|
||||
'en-IE': /^(\+?353|0)8[356789]\d{7}$/,
|
||||
'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
|
||||
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
|
||||
'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,
|
||||
'en-MU': /^(\+?230|0)?\d{8}$/,
|
||||
'en-NG': /^(\+?234|0)?[789]\d{9}$/,
|
||||
'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
|
||||
'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,
|
||||
'en-PH': /^(09|\+639)\d{9}$/,
|
||||
'en-RW': /^(\+?250|0)?[7]\d{8}$/,
|
||||
'en-SG': /^(\+65)?[689]\d{7}$/,
|
||||
'en-SL': /^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/,
|
||||
'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
|
||||
'en-UG': /^(\+?256|0)?[7]\d{8}$/,
|
||||
'en-US': /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,
|
||||
'en-ZA': /^(\+?27|0)\d{9}$/,
|
||||
'en-ZM': /^(\+?26)?09[567]\d{7}$/,
|
||||
'en-ZW': /^(\+263)[0-9]{9}$/,
|
||||
'es-AR': /^\+?549(11|[2368]\d)\d{8}$/,
|
||||
'es-BO': /^(\+?591)?(6|7)\d{7}$/,
|
||||
'es-CO': /^(\+?57)?([1-8]{1}|3[0-9]{2})?[2-9]{1}\d{6}$/,
|
||||
'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/,
|
||||
'es-CR': /^(\+506)?[2-8]\d{7}$/,
|
||||
'es-DO': /^(\+?1)?8[024]9\d{7}$/,
|
||||
'es-HN': /^(\+?504)?[9|8]\d{7}$/,
|
||||
'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,
|
||||
'es-ES': /^(\+?34)?[6|7]\d{8}$/,
|
||||
'es-PE': /^(\+?51)?9\d{8}$/,
|
||||
'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
|
||||
'es-PA': /^(\+?507)\d{7,8}$/,
|
||||
'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
|
||||
'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
|
||||
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
|
||||
'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,
|
||||
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
|
||||
'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
|
||||
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
||||
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
|
||||
'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,
|
||||
'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/,
|
||||
'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/,
|
||||
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
|
||||
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
|
||||
'hu-HU': /^(\+?36)(20|30|70)\d{7}$/,
|
||||
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
|
||||
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
|
||||
'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,
|
||||
'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,
|
||||
'ka-GE': /^(\+?995)?(5|79)\d{7}$/,
|
||||
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
|
||||
'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
|
||||
'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
|
||||
'lt-LT': /^(\+370|8)\d{8}$/,
|
||||
'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
|
||||
'nb-NO': /^(\+?47)?[49]\d{7}$/,
|
||||
'ne-NP': /^(\+?977)?9[78]\d{8}$/,
|
||||
'nl-BE': /^(\+?32|0)4?\d{8}$/,
|
||||
'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,
|
||||
'nn-NO': /^(\+?47)?[49]\d{7}$/,
|
||||
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
|
||||
'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/,
|
||||
'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
|
||||
'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
|
||||
'ru-RU': /^(\+?7|8)?9\d{9}$/,
|
||||
'sl-SI': /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/,
|
||||
'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
|
||||
'sq-AL': /^(\+355|0)6[789]\d{6}$/,
|
||||
'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,
|
||||
'sv-SE': /^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/,
|
||||
'th-TH': /^(\+66|66|0)\d{9}$/,
|
||||
'tr-TR': /^(\+?90|0)?5\d{9}$/,
|
||||
'uk-UA': /^(\+?38|8)?0\d{9}$/,
|
||||
'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
|
||||
'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/,
|
||||
'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/,
|
||||
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/
|
||||
};
|
||||
/* eslint-enable max-len */
|
||||
// aliases
|
||||
|
||||
phones['en-CA'] = phones['en-US'];
|
||||
phones['fr-CA'] = phones['en-CA'];
|
||||
phones['fr-BE'] = phones['nl-BE'];
|
||||
phones['zh-HK'] = phones['en-HK'];
|
||||
phones['zh-MO'] = phones['en-MO'];
|
||||
phones['ga-IE'] = phones['en-IE'];
|
||||
export default function isMobilePhone(str, locale, options) {
|
||||
assertString(str);
|
||||
|
||||
if (options && options.strictMode && !str.startsWith('+')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Array.isArray(locale)) {
|
||||
return locale.some(function (key) {
|
||||
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
|
||||
// istanbul ignore else
|
||||
if (phones.hasOwnProperty(key)) {
|
||||
var phone = phones[key];
|
||||
|
||||
if (phone.test(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
} else if (locale in phones) {
|
||||
return phones[locale].test(str); // alias falsey locale as 'any'
|
||||
} else if (!locale || locale === 'any') {
|
||||
for (var key in phones) {
|
||||
// istanbul ignore else
|
||||
if (phones.hasOwnProperty(key)) {
|
||||
var phone = phones[key];
|
||||
|
||||
if (phone.test(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new Error("Invalid locale '".concat(locale, "'"));
|
||||
}
|
||||
export var locales = Object.keys(phones);
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "inquirer",
|
||||
"version": "8.0.0",
|
||||
"description": "A collection of common interactive command line user interfaces.",
|
||||
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md"
|
||||
],
|
||||
"main": "lib/inquirer.js",
|
||||
"keywords": [
|
||||
"command",
|
||||
"prompt",
|
||||
"stdin",
|
||||
"cli",
|
||||
"tty",
|
||||
"menu"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.0",
|
||||
"chalk-pipe": "^5.0.0",
|
||||
"cmdify": "^0.0.4",
|
||||
"mocha": "^8.3.0",
|
||||
"mockery": "^2.1.0",
|
||||
"nyc": "^15.0.0",
|
||||
"sinon": "^9.2.4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nyc mocha test/**/* -r ./test/before",
|
||||
"posttest": "nyc report --reporter=text-lcov > ../../coverage/nyc-report.lcov",
|
||||
"prepublishOnly": "cp ../../README.md .",
|
||||
"postpublish": "rm -f README.md"
|
||||
},
|
||||
"repository": "SBoudrias/Inquirer.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-escapes": "^4.2.1",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-cursor": "^3.1.0",
|
||||
"cli-width": "^3.0.0",
|
||||
"external-editor": "^3.0.3",
|
||||
"figures": "^3.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mute-stream": "0.0.8",
|
||||
"run-async": "^2.4.0",
|
||||
"rxjs": "^6.6.6",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"through": "^2.3.6"
|
||||
},
|
||||
"gitHead": "6bc00c0ff2e63835b3096c5d82ca96dded632f3d"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A BC","161":"B"},B:{"2":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","161":"C K L H M N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"2":"I u J E F G A B C K L H GC zB HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC"},F:{"2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d OC PC QC RC qB 9B SC rB"},G:{"2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"2":"tB I D oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"2":"A B C e qB 9B rB"},L:{"2":"D"},M:{"2":"D"},N:{"2":"A","161":"B"},O:{"2":"uC"},P:{"2":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"2":"1B"},R:{"2":"8C"},S:{"2":"9C"}},B:7,C:"Input Method Editor API"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C"},C:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z DC EC","578":"AB BB CB DB"},D:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB","194":"DB"},E:{"1":"A B C K L H KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G GC zB HC IC JC"},F:{"1":"1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"G B C H M N O v w x y z OC PC QC RC qB 9B SC rB","322":"0"},G:{"1":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:1,C:"Picture element"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"644":"J E BC","2049":"G A B","2692":"F"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2049":"C K L H M N O"},C:{"1":"0 1 2 3 4 5 6 7 8 9 C K L H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC","260":"I u J E F G A B","1156":"tB","1284":"DC","1796":"EC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"1":"I u J E F G A B C K L H HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","16":"GC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d RC qB 9B SC rB","16":"G OC","132":"PC QC"},G:{"1":"F TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","16":"zB"},H:{"1":"nC"},I:{"1":"tB I D qC rC AC sC tC","16":"oC pC"},J:{"1":"E A"},K:{"1":"B C e qB 9B rB","132":"A"},L:{"1":"D"},M:{"1":"D"},N:{"2049":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"1":"9C"}},B:5,C:"Element.getBoundingClientRect()"};
|
||||
@@ -0,0 +1,161 @@
|
||||
import { async } from '../scheduler/async';
|
||||
import { isDate } from '../util/isDate';
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { Notification } from '../Notification';
|
||||
import { Observable } from '../Observable';
|
||||
import { MonoTypeOperatorFunction, PartialObserver, SchedulerAction, SchedulerLike, TeardownLogic } from '../types';
|
||||
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given timeout or
|
||||
* until a given Date.
|
||||
*
|
||||
* <span class="informal">Time shifts each item by some specified amount of
|
||||
* milliseconds.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* If the delay argument is a Number, this operator time shifts the source
|
||||
* Observable by that amount of time expressed in milliseconds. The relative
|
||||
* time intervals between the values are preserved.
|
||||
*
|
||||
* If the delay argument is a Date, this operator time shifts the start of the
|
||||
* Observable execution until the given date occurs.
|
||||
*
|
||||
* ## Examples
|
||||
* Delay each click by one second
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { delay } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* Delay all clicks until a future date happens
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { delay } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const date = new Date('March 15, 2050 12:00:00'); // in the future
|
||||
* const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delayWhen}
|
||||
*
|
||||
* @param {number|Date} delay The delay duration in milliseconds (a `number`) or
|
||||
* a `Date` until which the emission of the source items is delayed.
|
||||
* @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
|
||||
* managing the timers that handle the time-shift for each item.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified timeout or Date.
|
||||
* @method delay
|
||||
* @owner Observable
|
||||
*/
|
||||
export function delay<T>(delay: number|Date,
|
||||
scheduler: SchedulerLike = async): MonoTypeOperatorFunction<T> {
|
||||
const absoluteDelay = isDate(delay);
|
||||
const delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(<number>delay);
|
||||
return (source: Observable<T>) => source.lift(new DelayOperator(delayFor, scheduler));
|
||||
}
|
||||
|
||||
class DelayOperator<T> implements Operator<T, T> {
|
||||
constructor(private delay: number,
|
||||
private scheduler: SchedulerLike) {
|
||||
}
|
||||
|
||||
call(subscriber: Subscriber<T>, source: any): TeardownLogic {
|
||||
return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));
|
||||
}
|
||||
}
|
||||
|
||||
interface DelayState<T> {
|
||||
source: DelaySubscriber<T>;
|
||||
destination: PartialObserver<T>;
|
||||
scheduler: SchedulerLike;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class DelaySubscriber<T> extends Subscriber<T> {
|
||||
private queue: Array<DelayMessage<T>> = [];
|
||||
private active: boolean = false;
|
||||
private errored: boolean = false;
|
||||
|
||||
private static dispatch<T>(this: SchedulerAction<DelayState<T>>, state: DelayState<T>): void {
|
||||
const source = state.source;
|
||||
const queue = source.queue;
|
||||
const scheduler = state.scheduler;
|
||||
const destination = state.destination;
|
||||
|
||||
while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
|
||||
queue.shift().notification.observe(destination);
|
||||
}
|
||||
|
||||
if (queue.length > 0) {
|
||||
const delay = Math.max(0, queue[0].time - scheduler.now());
|
||||
this.schedule(state, delay);
|
||||
} else {
|
||||
this.unsubscribe();
|
||||
source.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(destination: Subscriber<T>,
|
||||
private delay: number,
|
||||
private scheduler: SchedulerLike) {
|
||||
super(destination);
|
||||
}
|
||||
|
||||
private _schedule(scheduler: SchedulerLike): void {
|
||||
this.active = true;
|
||||
const destination = this.destination as Subscription;
|
||||
destination.add(scheduler.schedule<DelayState<T>>(DelaySubscriber.dispatch, this.delay, {
|
||||
source: this, destination: this.destination, scheduler: scheduler
|
||||
}));
|
||||
}
|
||||
|
||||
private scheduleNotification(notification: Notification<T>): void {
|
||||
if (this.errored === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
const scheduler = this.scheduler;
|
||||
const message = new DelayMessage(scheduler.now() + this.delay, notification);
|
||||
this.queue.push(message);
|
||||
|
||||
if (this.active === false) {
|
||||
this._schedule(scheduler);
|
||||
}
|
||||
}
|
||||
|
||||
protected _next(value: T) {
|
||||
this.scheduleNotification(Notification.createNext(value));
|
||||
}
|
||||
|
||||
protected _error(err: any) {
|
||||
this.errored = true;
|
||||
this.queue = [];
|
||||
this.destination.error(err);
|
||||
this.unsubscribe();
|
||||
}
|
||||
|
||||
protected _complete() {
|
||||
this.scheduleNotification(Notification.createComplete());
|
||||
this.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
class DelayMessage<T> {
|
||||
constructor(public readonly time: number,
|
||||
public readonly notification: Notification<T>) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operators/publishLast"));
|
||||
//# sourceMappingURL=publishLast.js.map
|
||||
Reference in New Issue
Block a user