new license file version [CI SKIP]

This commit is contained in:
2023-03-15 13:43:57 +00:00
parent d8a3063735
commit 00359d25c1
5600 changed files with 523898 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
{
"name": "localforage",
"main": ["dist/localforage.js"],
"ignore": [
".travis.yml",
"CONTRIBUTING.md",
"config.rb",
"Gemfile",
"Gemfile.lock",
"Rakefile",
"LICENSE",
"docs*",
"examples*",
"test*",
"site*"
],
"dependencies": {},
"devDependencies": {
"es6-promise": "~1.0.0",
"requirejs": "~2.1.10",
"mocha": "~3.4.2",
"expect": "~0.3.1",
"assert": "~0.1.0",
"modernizr": "~2.8.1"
},
"version": "1.9.0"
}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"BC","8":"J E F","129":"A B","161":"G"},B:{"1":"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","129":"C K L H M"},C:{"1":"0 1 2 3 4 5 6 7 8 9 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 tB","33":"I u J E F G A B C K L H DC EC"},D:{"1":"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","33":"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"},E:{"1":"G A B C K L H KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","33":"I u J E F GC zB HC IC JC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 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 rB","2":"G OC PC","33":"B C H M N O v w x y QC RC qB 9B SC"},G:{"1":"YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","33":"F zB TC AC UC VC WC XC"},H:{"2":"nC"},I:{"1":"D","33":"tB I oC pC qC rC AC sC tC"},J:{"33":"E A"},K:{"1":"B C e qB 9B rB","2":"A"},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:4,C:"CSS3 2D Transforms"};

View File

@@ -0,0 +1,97 @@
const test = require('ava');
const sinon = require('sinon');
const Prompt = require('../lib/prompt');
const Config = require('../lib/config');
const git = require('../lib/plugin/git/prompts');
const github = require('../lib/plugin/github/prompts');
const gitlab = require('../lib/plugin/gitlab/prompts');
const npm = require('../lib/plugin/npm/prompts');
const { factory } = require('./util');
const prompts = { git, github, gitlab, npm };
const yes = ([options]) => Promise.resolve({ [options.name]: true });
const no = ([options]) => Promise.resolve({ [options.name]: false });
test.beforeEach(t => {
t.context.getInquirer = stub => ({
prompt: stub
});
});
test('should not create prompt if disabled', async t => {
const task = sinon.spy();
const stub = sinon.stub().callsFake(yes);
const inquirer = t.context.getInquirer(stub);
const prompt = factory(Prompt, { container: { inquirer } });
prompt.register(prompts.git);
await prompt.show({ enabled: false, prompt: 'push', task });
t.is(stub.callCount, 0);
t.is(task.callCount, 0);
});
test('should create prompt', async t => {
const stub = sinon.stub().callsFake(yes);
const inquirer = t.context.getInquirer(stub);
const prompt = factory(Prompt, { container: { inquirer } });
prompt.register(prompts.git);
await prompt.show({ prompt: 'push' });
t.is(stub.callCount, 1);
t.deepEqual(stub.firstCall.args[0][0], {
type: 'confirm',
message: 'Push?',
name: 'push',
choices: false,
transformer: false,
default: true
});
});
[
['git', 'commit', 'Commit (Release 1.0.0)?'],
['git', 'tag', 'Tag (1.0.0)?'],
['git', 'push', 'Push?'],
['github', 'release', 'Create a pre-release on GitHub (Release 1.0.0)?'],
['gitlab', 'release', 'Create a release on GitLab (Release 1.0.0)?'],
['npm', 'publish', 'Publish my-pkg@next to npm?'],
['npm', 'otp', 'Please enter OTP for npm:']
].map(async ([namespace, prompt, message]) => {
test(`should create prompt and render template message (${namespace}.${prompt})`, async t => {
const stub = sinon.stub().callsFake(yes);
const config = new Config({
isPreRelease: true,
git: { tagName: 'v${version}' },
npm: { name: 'my-pkg', tag: 'next' }
});
config.setContext({ version: '1.0.0', git: { tagName: '1.0.0' } });
const inquirer = t.context.getInquirer(stub);
const p = factory(Prompt, { container: { inquirer } });
p.register(prompts[namespace], namespace);
await p.show({ namespace, prompt, context: config.getContext() });
t.is(stub.callCount, 1);
t.is(stub.firstCall.args[0][0].message, message);
});
});
test('should execute task after positive answer', async t => {
const task = sinon.spy();
const stub = sinon.stub().callsFake(yes);
const inquirer = t.context.getInquirer(stub);
const prompt = factory(Prompt, { container: { inquirer } });
prompt.register(prompts.git);
await prompt.show({ prompt: 'push', task });
t.is(stub.callCount, 1);
t.is(task.callCount, 1);
t.is(task.firstCall.args[0], true);
});
test('should not execute task after negative answer', async t => {
const task = sinon.spy();
const stub = sinon.stub().callsFake(no);
const inquirer = t.context.getInquirer(stub);
const prompt = factory(Prompt, { container: { inquirer } });
prompt.register(prompts.git);
await prompt.show({ prompt: 'push', task });
t.is(stub.callCount, 1);
t.is(task.callCount, 0);
});

View File

@@ -0,0 +1,45 @@
{
"name": "dot-prop",
"version": "5.3.0",
"description": "Get, set, or delete a property from a nested object using a dot path",
"license": "MIT",
"repository": "sindresorhus/dot-prop",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
"bench": "node bench.js"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"object",
"prop",
"property",
"dot",
"path",
"get",
"set",
"delete",
"access",
"notation",
"dotty"
],
"dependencies": {
"is-obj": "^2.0.0"
},
"devDependencies": {
"ava": "^2.1.0",
"benchmark": "^2.1.4",
"tsd": "^0.7.2",
"xo": "^0.25.3"
}
}

View File

@@ -0,0 +1,87 @@
import { Operator } from '../Operator';
import { Observable } from '../Observable';
import { Subscriber } from '../Subscriber';
import { Observer, OperatorFunction } from '../types';
/**
* Compares all values of two observables in sequence using an optional comparator function
* and returns an observable of a single boolean value representing whether or not the two sequences
* are equal.
*
* <span class="informal">Checks to see of all values emitted by both observables are equal, in order.</span>
*
* ![](sequenceEqual.png)
*
* `sequenceEqual` subscribes to two observables and buffers incoming values from each observable. Whenever either
* observable emits a value, the value is buffered and the buffers are shifted and compared from the bottom
* up; If any value pair doesn't match, the returned observable will emit `false` and complete. If one of the
* observables completes, the operator will wait for the other observable to complete; If the other
* observable emits before completing, the returned observable will emit `false` and complete. If one observable never
* completes or emits after the other complets, the returned observable will never complete.
*
* ## Example
* figure out if the Konami code matches
* ```ts
* import { from, fromEvent } from 'rxjs';
* import { sequenceEqual, bufferCount, mergeMap, map } from 'rxjs/operators';
*
* const codes = from([
* 'ArrowUp',
* 'ArrowUp',
* 'ArrowDown',
* 'ArrowDown',
* 'ArrowLeft',
* 'ArrowRight',
* 'ArrowLeft',
* 'ArrowRight',
* 'KeyB',
* 'KeyA',
* 'Enter', // no start key, clearly.
* ]);
*
* const keys = fromEvent(document, 'keyup').pipe(map(e => e.code));
* const matches = keys.pipe(
* bufferCount(11, 1),
* mergeMap(
* last11 => from(last11).pipe(sequenceEqual(codes)),
* ),
* );
* matches.subscribe(matched => console.log('Successful cheat at Contra? ', matched));
* ```
*
* @see {@link combineLatest}
* @see {@link zip}
* @see {@link withLatestFrom}
*
* @param {Observable} compareTo The observable sequence to compare the source sequence to.
* @param {function} [comparator] An optional function to compare each value pair
* @return {Observable} An Observable of a single boolean value representing whether or not
* the values emitted by both observables were equal in sequence.
* @method sequenceEqual
* @owner Observable
*/
export declare function sequenceEqual<T>(compareTo: Observable<T>, comparator?: (a: T, b: T) => boolean): OperatorFunction<T, boolean>;
export declare class SequenceEqualOperator<T> implements Operator<T, boolean> {
private compareTo;
private comparator;
constructor(compareTo: Observable<T>, comparator: (a: T, b: T) => boolean);
call(subscriber: Subscriber<boolean>, source: any): any;
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
export declare class SequenceEqualSubscriber<T, R> extends Subscriber<T> {
private compareTo;
private comparator;
private _a;
private _b;
private _oneComplete;
constructor(destination: Observer<R>, compareTo: Observable<T>, comparator: (a: T, b: T) => boolean);
protected _next(value: T): void;
_complete(): void;
checkValues(): void;
emit(value: boolean): void;
nextB(value: T): void;
completeB(): void;
}

View File

@@ -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.00378,"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,"67":0,"68":0,"69":0,"70":0,"71":0.00378,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.00378,"90":0,"91":0.00378,"92":0,"93":0,"94":0,"95":0,"96":0.00378,"97":0,"98":0.00756,"99":0,"100":0.00378,"101":0,"102":0.00378,"103":0.00756,"104":0.00756,"105":0.00378,"106":0.00756,"107":0.0189,"108":0.40446,"109":0.25326,"110":0.00378,"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.00378,"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.00378,"39":0,"40":0.00756,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00756,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.00378,"61":0,"62":0.00378,"63":0,"64":0,"65":0.00378,"66":0.00378,"67":0,"68":0.00378,"69":0.00378,"70":0.00378,"71":0,"72":0.00378,"73":0.00378,"74":0,"75":0.00756,"76":0.00378,"77":0.00756,"78":0,"79":0.04158,"80":0.00756,"81":0.01512,"83":0.0189,"84":0.00378,"85":0.00378,"86":0.00378,"87":0.01512,"88":0.00756,"89":0.00378,"90":0.00378,"91":0.04536,"92":0.00756,"93":0.00378,"94":0.00378,"95":0.00378,"96":0.01134,"97":0.01512,"98":0.01134,"99":0.0189,"100":0.03402,"101":0.01134,"102":0.0189,"103":0.06426,"104":0.02646,"105":0.02268,"106":0.03024,"107":0.13608,"108":4.7817,"109":4.44528,"110":0.00756,"111":0.00378,"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,"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.00378,"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.04914,"64":0.00378,"65":0,"66":0.00378,"67":0,"68":0,"69":0,"70":0.00378,"71":0,"72":0,"73":0.01134,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.2268,"94":0.40824,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0.00378,"16":0,"17":0,"18":0.00378,"79":0,"80":0,"81":0,"83":0,"84":0.00378,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00756,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.00756,"104":0.00378,"105":0.00756,"106":0.00378,"107":0.03024,"108":0.55566,"109":0.63504},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00756,"15":0.00378,_:"0","3.1":0,"3.2":0,"5.1":0.00378,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.01134,"14.1":0.0378,"15.1":0.00378,"15.2-15.3":0.00378,"15.4":0.00756,"15.5":0.0189,"15.6":0.0945,"16.0":0.00756,"16.1":0.0378,"16.2":0.0567,"16.3":0.00378},G:{"8":0,"3.2":0,"4.0-4.1":0.00215,"4.2-4.3":0,"5.0-5.1":0.00646,"6.0-6.1":0,"7.0-7.1":0.04522,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.06998,"10.0-10.2":0,"10.3":0.02584,"11.0-11.2":0.01723,"11.3-11.4":0.00431,"12.0-12.1":0.00323,"12.2-12.5":0.32943,"13.0-13.1":0.00861,"13.2":0.00323,"13.3":0.01723,"13.4-13.7":0.03014,"14.0-14.4":0.14426,"14.5-14.8":0.29928,"15.0-15.1":0.11196,"15.2-15.3":0.13672,"15.4":0.17656,"15.5":0.27452,"15.6":1.07441,"16.0":1.54917,"16.1":3.13926,"16.2":2.1542,"16.3":0.17979},P:{"4":0.23572,"5.0-5.4":0,"6.2-6.4":0.01025,"7.2-7.4":0.44069,"8.2":0,"9.2":0.0205,"10.1":0.01025,"11.1-11.2":0.13323,"12.0":0.0205,"13.0":0.07174,"14.0":0.07174,"15.0":0.06149,"16.0":0.20497,"17.0":0.18447,"18.0":0.23572,"19.0":2.25467},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.01526,"4.2-4.3":0.02543,"4.4":0,"4.4.3-4.4.4":0.16272},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.0189,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.14306},Q:{"13.1":0},O:{"0":0.1866},H:{"0":0.41221},L:{"0":70.37006},S:{"2.5":0.00622}};

View File

@@ -0,0 +1,118 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ExplorerSync = void 0;
var _path = _interopRequireDefault(require("path"));
var _ExplorerBase = require("./ExplorerBase");
var _readFile = require("./readFile");
var _cacheWrapper = require("./cacheWrapper");
var _getDirectory = require("./getDirectory");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class ExplorerSync extends _ExplorerBase.ExplorerBase {
constructor(options) {
super(options);
}
searchSync(searchFrom = process.cwd()) {
const startDirectory = (0, _getDirectory.getDirectorySync)(searchFrom);
const result = this.searchFromDirectorySync(startDirectory);
return result;
}
searchFromDirectorySync(dir) {
const absoluteDir = _path.default.resolve(process.cwd(), dir);
const run = () => {
const result = this.searchDirectorySync(absoluteDir);
const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
if (nextDir) {
return this.searchFromDirectorySync(nextDir);
}
const transformResult = this.config.transform(result);
return transformResult;
};
if (this.searchCache) {
return (0, _cacheWrapper.cacheWrapperSync)(this.searchCache, absoluteDir, run);
}
return run();
}
searchDirectorySync(dir) {
for (const place of this.config.searchPlaces) {
const placeResult = this.loadSearchPlaceSync(dir, place);
if (this.shouldSearchStopWithResult(placeResult) === true) {
return placeResult;
}
} // config not found
return null;
}
loadSearchPlaceSync(dir, place) {
const filepath = _path.default.join(dir, place);
const content = (0, _readFile.readFileSync)(filepath);
const result = this.createCosmiconfigResultSync(filepath, content);
return result;
}
loadFileContentSync(filepath, content) {
if (content === null) {
return null;
}
if (content.trim() === '') {
return undefined;
}
const loader = this.getLoaderEntryForFile(filepath);
const loaderResult = loader(filepath, content);
return loaderResult;
}
createCosmiconfigResultSync(filepath, content) {
const fileContent = this.loadFileContentSync(filepath, content);
const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
return result;
}
loadSync(filepath) {
this.validateFilePath(filepath);
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
const runLoadSync = () => {
const content = (0, _readFile.readFileSync)(absoluteFilePath, {
throwNotFound: true
});
const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
const transformResult = this.config.transform(cosmiconfigResult);
return transformResult;
};
if (this.loadCache) {
return (0, _cacheWrapper.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
}
return runLoadSync();
}
}
exports.ExplorerSync = ExplorerSync;
//# sourceMappingURL=ExplorerSync.js.map

View File

@@ -0,0 +1,245 @@
import { Observable } from '../Observable';
import { isArray } from '../util/isArray';
import { isFunction } from '../util/isFunction';
import { Subscriber } from '../Subscriber';
import { map } from '../operators/map';
const toString: Function = (() => Object.prototype.toString)();
export interface NodeStyleEventEmitter {
addListener: (eventName: string | symbol, handler: NodeEventHandler) => this;
removeListener: (eventName: string | symbol, handler: NodeEventHandler) => this;
}
export type NodeEventHandler = (...args: any[]) => void;
// For APIs that implement `addListener` and `removeListener` methods that may
// not use the same arguments or return EventEmitter values
// such as React Native
export interface NodeCompatibleEventEmitter {
addListener: (eventName: string, handler: NodeEventHandler) => void | {};
removeListener: (eventName: string, handler: NodeEventHandler) => void | {};
}
export interface JQueryStyleEventEmitter {
on: (eventName: string, handler: Function) => void;
off: (eventName: string, handler: Function) => void;
}
export interface HasEventTargetAddRemove<E> {
addEventListener(type: string, listener: ((evt: E) => void) | null, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: string, listener?: ((evt: E) => void) | null, options?: EventListenerOptions | boolean): void;
}
export type EventTargetLike<T> = HasEventTargetAddRemove<T> | NodeStyleEventEmitter | NodeCompatibleEventEmitter | JQueryStyleEventEmitter;
export type FromEventTarget<T> = EventTargetLike<T> | ArrayLike<EventTargetLike<T>>;
export interface EventListenerOptions {
capture?: boolean;
passive?: boolean;
once?: boolean;
}
export interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
passive?: boolean;
}
/* tslint:disable:max-line-length */
export function fromEvent<T>(target: FromEventTarget<T>, eventName: string): Observable<T>;
/** @deprecated resultSelector no longer supported, pipe to map instead */
export function fromEvent<T>(target: FromEventTarget<T>, eventName: string, resultSelector: (...args: any[]) => T): Observable<T>;
export function fromEvent<T>(target: FromEventTarget<T>, eventName: string, options: EventListenerOptions): Observable<T>;
/** @deprecated resultSelector no longer supported, pipe to map instead */
export function fromEvent<T>(target: FromEventTarget<T>, eventName: string, options: EventListenerOptions, resultSelector: (...args: any[]) => T): Observable<T>;
/* tslint:enable:max-line-length */
/**
* Creates an Observable that emits events of a specific type coming from the
* given event target.
*
* <span class="informal">Creates an Observable from DOM events, or Node.js
* EventEmitter events or others.</span>
*
* ![](fromEvent.png)
*
* `fromEvent` accepts as a first argument event target, which is an object with methods
* for registering event handler functions. As a second argument it takes string that indicates
* type of event we want to listen for. `fromEvent` supports selected types of event targets,
* which are described in detail below. If your event target does not match any of the ones listed,
* you should use {@link fromEventPattern}, which can be used on arbitrary APIs.
* When it comes to APIs supported by `fromEvent`, their methods for adding and removing event
* handler functions have different names, but they all accept a string describing event type
* and function itself, which will be called whenever said event happens.
*
* Every time resulting Observable is subscribed, event handler function will be registered
* to event target on given event type. When that event fires, value
* passed as a first argument to registered function will be emitted by output Observable.
* When Observable is unsubscribed, function will be unregistered from event target.
*
* Note that if event target calls registered function with more than one argument, second
* and following arguments will not appear in resulting stream. In order to get access to them,
* you can pass to `fromEvent` optional project function, which will be called with all arguments
* passed to event handler. Output Observable will then emit value returned by project function,
* instead of the usual value.
*
* Remember that event targets listed below are checked via duck typing. It means that
* no matter what kind of object you have and no matter what environment you work in,
* you can safely use `fromEvent` on that object if it exposes described methods (provided
* of course they behave as was described above). So for example if Node.js library exposes
* event target which has the same method names as DOM EventTarget, `fromEvent` is still
* a good choice.
*
* If the API you use is more callback then event handler oriented (subscribed
* callback function fires only once and thus there is no need to manually
* unregister it), you should use {@link bindCallback} or {@link bindNodeCallback}
* instead.
*
* `fromEvent` supports following types of event targets:
*
* **DOM EventTarget**
*
* This is an object with `addEventListener` and `removeEventListener` methods.
*
* In the browser, `addEventListener` accepts - apart from event type string and event
* handler function arguments - optional third parameter, which is either an object or boolean,
* both used for additional configuration how and when passed function will be called. When
* `fromEvent` is used with event target of that type, you can provide this values
* as third parameter as well.
*
* **Node.js EventEmitter**
*
* An object with `addListener` and `removeListener` methods.
*
* **JQuery-style event target**
*
* An object with `on` and `off` methods
*
* **DOM NodeList**
*
* List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`.
*
* Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes
* it contains and install event handler function in every of them. When returned Observable
* is unsubscribed, function will be removed from all Nodes.
*
* **DOM HtmlCollection**
*
* Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is
* installed and removed in each of elements.
*
*
* ## Examples
* ### Emits clicks happening on the DOM document
* ```ts
* import { fromEvent } from 'rxjs';
*
* const clicks = fromEvent(document, 'click');
* clicks.subscribe(x => console.log(x));
*
* // Results in:
* // MouseEvent object logged to console every time a click
* // occurs on the document.
* ```
*
* ### Use addEventListener with capture option
* ```ts
* import { fromEvent } from 'rxjs';
*
* const clicksInDocument = fromEvent(document, 'click', true); // note optional configuration parameter
* // which will be passed to addEventListener
* const clicksInDiv = fromEvent(someDivInDocument, 'click');
*
* clicksInDocument.subscribe(() => console.log('document'));
* clicksInDiv.subscribe(() => console.log('div'));
*
* // By default events bubble UP in DOM tree, so normally
* // when we would click on div in document
* // "div" would be logged first and then "document".
* // Since we specified optional `capture` option, document
* // will catch event when it goes DOWN DOM tree, so console
* // will log "document" and then "div".
* ```
*
* @see {@link bindCallback}
* @see {@link bindNodeCallback}
* @see {@link fromEventPattern}
*
* @param {FromEventTarget<T>} target The DOM EventTarget, Node.js
* EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to.
* @param {string} eventName The event name of interest, being emitted by the
* `target`.
* @param {EventListenerOptions} [options] Options to pass through to addEventListener
* @return {Observable<T>}
* @name fromEvent
*/
export function fromEvent<T>(
target: FromEventTarget<T>,
eventName: string,
options?: EventListenerOptions | ((...args: any[]) => T),
resultSelector?: ((...args: any[]) => T)
): Observable<T> {
if (isFunction(options)) {
// DEPRECATED PATH
resultSelector = options;
options = undefined;
}
if (resultSelector) {
// DEPRECATED PATH
return fromEvent<T>(target, eventName, <EventListenerOptions | undefined>options).pipe(
map(args => isArray(args) ? resultSelector(...args) : resultSelector(args))
);
}
return new Observable<T>(subscriber => {
function handler(e: T) {
if (arguments.length > 1) {
subscriber.next(Array.prototype.slice.call(arguments));
} else {
subscriber.next(e);
}
}
setupSubscription(target, eventName, handler, subscriber, options as EventListenerOptions);
});
}
function setupSubscription<T>(sourceObj: FromEventTarget<T>, eventName: string,
handler: (...args: any[]) => void, subscriber: Subscriber<T>,
options?: EventListenerOptions) {
let unsubscribe: () => void;
if (isEventTarget(sourceObj)) {
const source = sourceObj;
sourceObj.addEventListener(eventName, handler, options);
unsubscribe = () => source.removeEventListener(eventName, handler, options);
} else if (isJQueryStyleEventEmitter(sourceObj)) {
const source = sourceObj;
sourceObj.on(eventName, handler);
unsubscribe = () => source.off(eventName, handler);
} else if (isNodeStyleEventEmitter(sourceObj)) {
const source = sourceObj;
sourceObj.addListener(eventName, handler as NodeEventHandler);
unsubscribe = () => source.removeListener(eventName, handler as NodeEventHandler);
} else if (sourceObj && (sourceObj as any).length) {
for (let i = 0, len = (sourceObj as any).length; i < len; i++) {
setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
}
} else {
throw new TypeError('Invalid event target');
}
subscriber.add(unsubscribe);
}
function isNodeStyleEventEmitter(sourceObj: any): sourceObj is NodeStyleEventEmitter {
return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
}
function isJQueryStyleEventEmitter(sourceObj: any): sourceObj is JQueryStyleEventEmitter {
return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
}
function isEventTarget(sourceObj: any): sourceObj is HasEventTargetAddRemove<any> {
return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
}

View File

@@ -0,0 +1,21 @@
import { Observable } from '../Observable';
import { SchedulerLike } from '../types';
import { Subscription } from '../Subscription';
export function schedulePromise<T>(input: PromiseLike<T>, scheduler: SchedulerLike) {
return new Observable<T>(subscriber => {
const sub = new Subscription();
sub.add(scheduler.schedule(() => input.then(
value => {
sub.add(scheduler.schedule(() => {
subscriber.next(value);
sub.add(scheduler.schedule(() => subscriber.complete()));
}));
},
err => {
sub.add(scheduler.schedule(() => subscriber.error(err)));
}
)));
return sub;
});
}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"1":"G A B","2":"J E F 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":"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 tB I u J E F G A B C K L H M N O v w DC EC","4":"0 1 2 3 4 5 6 7 8 9 x y z AB"},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","2":"GC"},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":"0 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB"},G:{"1":"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:{"1":"D sC tC","4":"tB I oC pC rC AC","132":"qC"},J:{"1":"E A"},K:{"1":"B C e qB 9B rB","2":"A"},L:{"1":"D"},M:{"260":"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:6,C:"MPEG-4/H.264 video format"};

View File

@@ -0,0 +1,91 @@
import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OperatorFunction } from '../types';
/**
* Applies a given `project` function to each value emitted by the source
* Observable, and emits the resulting values as an Observable.
*
* <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),
* it passes each source value through a transformation function to get
* corresponding output values.</span>
*
* ![](map.png)
*
* Similar to the well known `Array.prototype.map` function, this operator
* applies a projection to each value and emits that projection in the output
* Observable.
*
* ## Example
* Map every click to the clientX position of that click
* ```ts
* import { fromEvent } from 'rxjs';
* import { map } from 'rxjs/operators';
*
* const clicks = fromEvent(document, 'click');
* const positions = clicks.pipe(map(ev => ev.clientX));
* positions.subscribe(x => console.log(x));
* ```
*
* @see {@link mapTo}
* @see {@link pluck}
*
* @param {function(value: T, index: number): R} project The function to apply
* to each `value` emitted by the source Observable. The `index` parameter is
* the number `i` for the i-th emission that has happened since the
* subscription, starting from the number `0`.
* @param {any} [thisArg] An optional argument to define what `this` is in the
* `project` function.
* @return {Observable<R>} An Observable that emits the values from the source
* Observable transformed by the given `project` function.
* @method map
* @owner Observable
*/
export function map<T, R>(project: (value: T, index: number) => R, thisArg?: any): OperatorFunction<T, R> {
return function mapOperation(source: Observable<T>): Observable<R> {
if (typeof project !== 'function') {
throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
}
return source.lift(new MapOperator(project, thisArg));
};
}
export class MapOperator<T, R> implements Operator<T, R> {
constructor(private project: (value: T, index: number) => R, private thisArg: any) {
}
call(subscriber: Subscriber<R>, source: any): any {
return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
}
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
class MapSubscriber<T, R> extends Subscriber<T> {
count: number = 0;
private thisArg: any;
constructor(destination: Subscriber<R>,
private project: (value: T, index: number) => R,
thisArg: any) {
super(destination);
this.thisArg = thisArg || this;
}
// NOTE: This looks unoptimized, but it's actually purposefully NOT
// using try/catch optimizations.
protected _next(value: T) {
let result: R;
try {
result = this.project.call(this.thisArg, value, this.count++);
} catch (err) {
this.destination.error(err);
return;
}
this.destination.next(result);
}
}

View File

@@ -0,0 +1,72 @@
import { Scheduler } from '../Scheduler';
import { Action } from './Action';
import { AsyncAction } from './AsyncAction';
import { SchedulerAction } from '../types';
import { Subscription } from '../Subscription';
export class AsyncScheduler extends Scheduler {
public static delegate?: Scheduler;
public actions: Array<AsyncAction<any>> = [];
/**
* A flag to indicate whether the Scheduler is currently executing a batch of
* queued actions.
* @type {boolean}
* @deprecated internal use only
*/
public active: boolean = false;
/**
* An internal ID used to track the latest asynchronous task such as those
* coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and
* others.
* @type {any}
* @deprecated internal use only
*/
public scheduled: any = undefined;
constructor(SchedulerAction: typeof Action,
now: () => number = Scheduler.now) {
super(SchedulerAction, () => {
if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
return AsyncScheduler.delegate.now();
} else {
return now();
}
});
}
public schedule<T>(work: (this: SchedulerAction<T>, state?: T) => void, delay: number = 0, state?: T): Subscription {
if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
return AsyncScheduler.delegate.schedule(work, delay, state);
} else {
return super.schedule(work, delay, state);
}
}
public flush(action: AsyncAction<any>): void {
const {actions} = this;
if (this.active) {
actions.push(action);
return;
}
let error: any;
this.active = true;
do {
if (error = action.execute(action.state, action.delay)) {
break;
}
} while (action = actions.shift()); // exhaust the scheduler queue
this.active = false;
if (error) {
while (action = actions.shift()) {
action.unsubscribe();
}
throw error;
}
}
}

View File

@@ -0,0 +1,35 @@
{
"name": "lowercase-keys",
"version": "1.0.1",
"description": "Lowercase the keys of an object",
"license": "MIT",
"repository": "sindresorhus/lowercase-keys",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "ava"
},
"files": [
"index.js"
],
"keywords": [
"object",
"assign",
"extend",
"properties",
"lowercase",
"lower-case",
"case",
"keys",
"key"
],
"devDependencies": {
"ava": "*"
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"buffer.js","sources":["../../src/add/operator/buffer.ts"],"names":[],"mappings":";;AAAA,2CAAyC"}

View File

@@ -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.00384,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0.0192,"53":0,"54":0,"55":0,"56":0,"57":0.00384,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.00768,"67":0,"68":0.00384,"69":0,"70":0,"71":0,"72":0,"73":0.0192,"74":0,"75":0,"76":0,"77":0.00384,"78":0.00384,"79":0,"80":0,"81":0,"82":0,"83":0.00384,"84":0,"85":0,"86":0.00768,"87":0,"88":0.00384,"89":0,"90":0,"91":0.00384,"92":0,"93":0,"94":0,"95":0.00384,"96":0,"97":0,"98":0.00384,"99":0.00768,"100":0.01152,"101":0,"102":0.02688,"103":0.00384,"104":0.02304,"105":0.00384,"106":0.00768,"107":0.01152,"108":0.39552,"109":0.26496,"110":0.00384,"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.00384,"37":0,"38":0.01536,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.03456,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.00384,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0.00768,"63":0,"64":0,"65":0.00768,"66":0,"67":0,"68":0.00384,"69":0.00384,"70":0,"71":0.00384,"72":0,"73":0.00768,"74":0.00768,"75":0.00384,"76":0,"77":0.00384,"78":0.00384,"79":0.01536,"80":0.02688,"81":0.01152,"83":0.00384,"84":0.00384,"85":0.00768,"86":0.1344,"87":0.00768,"88":0.00384,"89":0.00384,"90":0.00768,"91":0.01152,"92":0.00768,"93":0.00768,"94":0.0192,"95":0.01152,"96":0.02304,"97":0.00768,"98":0.00768,"99":0.00768,"100":0.01536,"101":0.01536,"102":0.0192,"103":0.0576,"104":0.01536,"105":0.03072,"106":0.0576,"107":0.09984,"108":4.89984,"109":4.82304,"110":0.00384,"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.00384,"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.02304,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.75648,"94":0.48,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0.00384,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0.00384,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00384,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0.00384,"99":0,"100":0,"101":0.00384,"102":0,"103":0,"104":0,"105":0.00384,"106":0,"107":0.0384,"108":0.44928,"109":0.47232},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.01152,"15":0.00768,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00384,"13.1":0.01536,"14.1":0.02304,"15.1":0.01536,"15.2-15.3":0.00768,"15.4":0.01152,"15.5":0.02688,"15.6":0.08832,"16.0":0.01152,"16.1":0.0576,"16.2":0.06144,"16.3":0.00768},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.02477,"6.0-6.1":0,"7.0-7.1":0.02477,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.04954,"10.0-10.2":0,"10.3":0.01748,"11.0-11.2":0.00437,"11.3-11.4":0.00874,"12.0-12.1":0.01311,"12.2-12.5":0.389,"13.0-13.1":0.00437,"13.2":0.00291,"13.3":0.01894,"13.4-13.7":0.06993,"14.0-14.4":0.15735,"14.5-14.8":0.53178,"15.0-15.1":0.10781,"15.2-15.3":0.15589,"15.4":0.16755,"15.5":0.44145,"15.6":1.80661,"16.0":1.86051,"16.1":4.46989,"16.2":2.67931,"16.3":0.19086},P:{"4":0.1016,"5.0-5.4":0,"6.2-6.4":0.01016,"7.2-7.4":0.24383,"8.2":0,"9.2":0.01016,"10.1":0,"11.1-11.2":0.03048,"12.0":0,"13.0":0.04064,"14.0":0.02032,"15.0":0.01016,"16.0":0.0508,"17.0":0.1016,"18.0":0.09144,"19.0":1.43251},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.03635,"4.4":0,"4.4.3-4.4.4":0.11813},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.02688,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},S:{"2.5":0.00616},R:{_:"0"},M:{"0":0.25872},Q:{"13.1":0},O:{"0":0.01232},H:{"0":0.24494},L:{"0":68.76904}};