new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { reduce } from './reduce';
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
|
||||
/**
|
||||
* The Max operator operates on an Observable that emits numbers (or items that can be compared with a provided function),
|
||||
* and when source Observable completes it emits a single item: the item with the largest value.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* ## Examples
|
||||
* Get the maximal value of a series of numbers
|
||||
* ```ts
|
||||
* import { of } from 'rxjs';
|
||||
* import { max } from 'rxjs/operators';
|
||||
*
|
||||
* of(5, 4, 7, 2, 8).pipe(
|
||||
* max(),
|
||||
* )
|
||||
* .subscribe(x => console.log(x)); // -> 8
|
||||
* ```
|
||||
*
|
||||
* Use a comparer function to get the maximal item
|
||||
* ```typescript
|
||||
* import { of } from 'rxjs';
|
||||
* import { max } from 'rxjs/operators';
|
||||
*
|
||||
* interface Person {
|
||||
* age: number,
|
||||
* name: string
|
||||
* }
|
||||
* of<Person>(
|
||||
* {age: 7, name: 'Foo'},
|
||||
* {age: 5, name: 'Bar'},
|
||||
* {age: 9, name: 'Beer'},
|
||||
* ).pipe(
|
||||
* max<Person>((a: Person, b: Person) => a.age < b.age ? -1 : 1),
|
||||
* )
|
||||
* .subscribe((x: Person) => console.log(x.name)); // -> 'Beer'
|
||||
* ```
|
||||
*
|
||||
* @see {@link min}
|
||||
*
|
||||
* @param {Function} [comparer] - Optional comparer function that it will use instead of its default to compare the
|
||||
* value of two items.
|
||||
* @return {Observable} An Observable that emits item with the largest value.
|
||||
* @method max
|
||||
* @owner Observable
|
||||
*/
|
||||
export function max<T>(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction<T> {
|
||||
const max: (x: T, y: T) => T = (typeof comparer === 'function')
|
||||
? (x, y) => comparer(x, y) > 0 ? x : y
|
||||
: (x, y) => x > y ? x : y;
|
||||
|
||||
return reduce(max);
|
||||
}
|
||||
@@ -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/util/isNumeric"));
|
||||
//# sourceMappingURL=isNumeric.js.map
|
||||
@@ -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/operator/sample"));
|
||||
//# sourceMappingURL=sample.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"take.js","sources":["../../src/internal/operators/take.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,4CAA2C;AAC3C,2EAA0E;AAC1E,6CAA4C;AAkD5C,SAAgB,IAAI,CAAI,KAAa;IACnC,OAAO,UAAC,MAAqB;QAC3B,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,aAAK,EAAE,CAAC;SAChB;aAAM;YACL,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7C;IACH,CAAC,CAAC;AACJ,CAAC;AARD,oBAQC;AAED;IACE,sBAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAC/B,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE;YAClB,MAAM,IAAI,iDAAuB,CAAC;SACnC;IACH,CAAC;IAED,2BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;IACH,mBAAC;AAAD,CAAC,AAVD,IAUC;AAOD;IAAgC,kCAAa;IAG3C,wBAAY,WAA0B,EAAU,KAAa;QAA7D,YACE,kBAAM,WAAW,CAAC,SACnB;QAF+C,WAAK,GAAL,KAAK,CAAQ;QAFrD,WAAK,GAAW,CAAC,CAAC;;IAI1B,CAAC;IAES,8BAAK,GAAf,UAAgB,KAAQ;QACtB,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,KAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;QAC3B,IAAI,KAAK,IAAI,KAAK,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,KAAK,KAAK,KAAK,EAAE;gBACnB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;gBAC5B,IAAI,CAAC,WAAW,EAAE,CAAC;aACpB;SACF;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAlBD,CAAgC,uBAAU,GAkBzC"}
|
||||
@@ -0,0 +1,108 @@
|
||||
const { EOL } = require('os');
|
||||
const { format, parseGitUrl } = require('../util');
|
||||
const Plugin = require('./Plugin');
|
||||
|
||||
const options = { write: false };
|
||||
const changelogFallback = 'git log --pretty=format:"* %s (%h)"';
|
||||
|
||||
class GitBase extends Plugin {
|
||||
getInitialOptions(options, namespace) {
|
||||
return Object.assign({}, options[namespace], { isUpdate: options.isUpdate });
|
||||
}
|
||||
async init() {
|
||||
this.remoteUrl = await this.getRemoteUrl();
|
||||
await this.fetch();
|
||||
const repo = parseGitUrl(this.remoteUrl);
|
||||
const latestTagName = await this.getLatestTagName(repo);
|
||||
const secondLatestTagName = this.options.isUpdate ? await this.getSecondLatestTagName(latestTagName) : null;
|
||||
const tagTemplate = this.options.tagName || ((latestTagName || '').match(/^v/) ? 'v${version}' : '${version}');
|
||||
this.setContext({ repo, tagTemplate, latestTagName, secondLatestTagName });
|
||||
this.config.setContext({ latestTag: latestTagName });
|
||||
}
|
||||
|
||||
getName() {
|
||||
return this.getContext('repo.project');
|
||||
}
|
||||
|
||||
getLatestVersion() {
|
||||
const latestTagName = this.getContext('latestTagName');
|
||||
return latestTagName ? latestTagName.replace(/^v/, '') : null;
|
||||
}
|
||||
|
||||
async getChangelog() {
|
||||
const { isUpdate, latestTagName, secondLatestTagName } = this.getContext();
|
||||
const context = { latestTag: latestTagName, from: latestTagName, to: 'HEAD' };
|
||||
const { changelog } = this.options;
|
||||
if (!changelog) return null;
|
||||
|
||||
if (latestTagName && isUpdate) {
|
||||
context.from = secondLatestTagName;
|
||||
context.to = `${latestTagName}^1`;
|
||||
}
|
||||
|
||||
if (!context.from && changelog.includes('${from}')) {
|
||||
return this.exec(changelogFallback);
|
||||
}
|
||||
|
||||
return this.exec(changelog, { context, options });
|
||||
}
|
||||
|
||||
bump(version) {
|
||||
const { tagTemplate } = this.getContext();
|
||||
const context = Object.assign(this.config.getContext(), { version });
|
||||
const tagName = format(tagTemplate, context) || version;
|
||||
this.setContext({ version, tagName });
|
||||
this.config.setContext({ tagName });
|
||||
}
|
||||
|
||||
isRemoteName(remoteUrlOrName) {
|
||||
return remoteUrlOrName && !remoteUrlOrName.includes('/');
|
||||
}
|
||||
|
||||
async getRemoteUrl() {
|
||||
const remoteNameOrUrl = this.options.pushRepo || (await this.getRemote()) || 'origin';
|
||||
return this.isRemoteName(remoteNameOrUrl)
|
||||
? this.exec(`git remote get-url ${remoteNameOrUrl}`, { options }).catch(() =>
|
||||
this.exec(`git config --get remote.${remoteNameOrUrl}.url`, { options }).catch(() => null)
|
||||
)
|
||||
: remoteNameOrUrl;
|
||||
}
|
||||
|
||||
async getRemote() {
|
||||
const branchName = await this.getBranchName();
|
||||
return branchName ? await this.getRemoteForBranch(branchName) : null;
|
||||
}
|
||||
|
||||
getBranchName() {
|
||||
return this.exec('git rev-parse --abbrev-ref HEAD', { options }).catch(() => null);
|
||||
}
|
||||
|
||||
getRemoteForBranch(branch) {
|
||||
return this.exec(`git config --get branch.${branch}.remote`, { options }).catch(() => null);
|
||||
}
|
||||
|
||||
fetch() {
|
||||
return this.exec('git fetch').catch(err => {
|
||||
this.debug(err);
|
||||
throw new Error(`Unable to fetch from ${this.remoteUrl}${EOL}${err.message}`);
|
||||
});
|
||||
}
|
||||
|
||||
getLatestTagName(repo) {
|
||||
const context = Object.assign({ repo }, this.getContext(), { version: '*' });
|
||||
const match = format(this.options.tagName || '${version}', context);
|
||||
return this.exec(`git describe --tags --match=${match} --abbrev=0`, { options }).then(
|
||||
stdout => stdout || null,
|
||||
() => null
|
||||
);
|
||||
}
|
||||
|
||||
async getSecondLatestTagName(latestTag) {
|
||||
const sha = await this.exec(`git rev-list ${latestTag || '--skip=1'} --tags --max-count=1`, {
|
||||
options
|
||||
});
|
||||
return this.exec(`git describe --tags --abbrev=0 ${sha}`, { options }).catch(() => null);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GitBase;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},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","2":"C K L H M N O"},C:{"1":"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 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 DC EC"},D:{"1":"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 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"},E:{"1":"NC","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"},F:{"1":"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 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 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:{"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":"yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I vC wC xC"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:6,C:"Lookbehind in JS regular expressions"};
|
||||
@@ -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/windowToggle"));
|
||||
//# sourceMappingURL=windowToggle.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operator/windowTime';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G BC","420":"A 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","420":"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":"I u J E F G A B C K L 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","36":"H M N O","66":"0 1 2 3 4 5 6 7 8 9 v w x y z AB"},E:{"2":"I u J C K L H GC zB HC qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","33":"E F G A B IC JC KC 0B"},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":"zB TC AC UC VC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","33":"F WC XC YC ZC aC bC cC"},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:{"420":"A 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:5,C:"CSS Regions"};
|
||||
@@ -0,0 +1,643 @@
|
||||
/* globals suite test */
|
||||
|
||||
const assert = require('assert')
|
||||
const path = require('path')
|
||||
const { exec } = require('child_process')
|
||||
const pkg = require('../package.json')
|
||||
const flat = require('../index')
|
||||
|
||||
const flatten = flat.flatten
|
||||
const unflatten = flat.unflatten
|
||||
|
||||
const primitives = {
|
||||
String: 'good morning',
|
||||
Number: 1234.99,
|
||||
Boolean: true,
|
||||
Date: new Date(),
|
||||
null: null,
|
||||
undefined: undefined
|
||||
}
|
||||
|
||||
suite('Flatten Primitives', function () {
|
||||
Object.keys(primitives).forEach(function (key) {
|
||||
const value = primitives[key]
|
||||
|
||||
test(key, function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
world: value
|
||||
}
|
||||
}), {
|
||||
'hello.world': value
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
suite('Unflatten Primitives', function () {
|
||||
Object.keys(primitives).forEach(function (key) {
|
||||
const value = primitives[key]
|
||||
|
||||
test(key, function () {
|
||||
assert.deepStrictEqual(unflatten({
|
||||
'hello.world': value
|
||||
}), {
|
||||
hello: {
|
||||
world: value
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
suite('Flatten', function () {
|
||||
test('Nested once', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
world: 'good morning'
|
||||
}
|
||||
}), {
|
||||
'hello.world': 'good morning'
|
||||
})
|
||||
})
|
||||
|
||||
test('Nested twice', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
}
|
||||
}), {
|
||||
'hello.world.again': 'good morning'
|
||||
})
|
||||
})
|
||||
|
||||
test('Multiple Keys', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
lorem: {
|
||||
ipsum: 'again',
|
||||
dolor: 'sit'
|
||||
}
|
||||
},
|
||||
world: {
|
||||
lorem: {
|
||||
ipsum: 'again',
|
||||
dolor: 'sit'
|
||||
}
|
||||
}
|
||||
}), {
|
||||
'hello.lorem.ipsum': 'again',
|
||||
'hello.lorem.dolor': 'sit',
|
||||
'world.lorem.ipsum': 'again',
|
||||
'world.lorem.dolor': 'sit'
|
||||
})
|
||||
})
|
||||
|
||||
test('Custom Delimiter', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
delimiter: ':'
|
||||
}), {
|
||||
'hello:world:again': 'good morning'
|
||||
})
|
||||
})
|
||||
|
||||
test('Empty Objects', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
empty: {
|
||||
nested: {}
|
||||
}
|
||||
}
|
||||
}), {
|
||||
'hello.empty.nested': {}
|
||||
})
|
||||
})
|
||||
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
test('Buffer', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
empty: {
|
||||
nested: Buffer.from('test')
|
||||
}
|
||||
}
|
||||
}), {
|
||||
'hello.empty.nested': Buffer.from('test')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
test('typed arrays', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
empty: {
|
||||
nested: new Uint8Array([1, 2, 3, 4])
|
||||
}
|
||||
}
|
||||
}), {
|
||||
'hello.empty.nested': new Uint8Array([1, 2, 3, 4])
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
test('Custom Depth', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
},
|
||||
lorem: {
|
||||
ipsum: {
|
||||
dolor: 'good evening'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
maxDepth: 2
|
||||
}), {
|
||||
'hello.world': {
|
||||
again: 'good morning'
|
||||
},
|
||||
'lorem.ipsum': {
|
||||
dolor: 'good evening'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
test('Transformed Keys', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
},
|
||||
lorem: {
|
||||
ipsum: {
|
||||
dolor: 'good evening'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
transformKey: function (key) {
|
||||
return '__' + key + '__'
|
||||
}
|
||||
}), {
|
||||
'__hello__.__world__.__again__': 'good morning',
|
||||
'__lorem__.__ipsum__.__dolor__': 'good evening'
|
||||
})
|
||||
})
|
||||
|
||||
test('Should keep number in the left when object', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: {
|
||||
'0200': 'world',
|
||||
'0500': 'darkness my old friend'
|
||||
}
|
||||
}), {
|
||||
'hello.0200': 'world',
|
||||
'hello.0500': 'darkness my old friend'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
suite('Unflatten', function () {
|
||||
test('Nested once', function () {
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
world: 'good morning'
|
||||
}
|
||||
}, unflatten({
|
||||
'hello.world': 'good morning'
|
||||
}))
|
||||
})
|
||||
|
||||
test('Nested twice', function () {
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
}
|
||||
}, unflatten({
|
||||
'hello.world.again': 'good morning'
|
||||
}))
|
||||
})
|
||||
|
||||
test('Multiple Keys', function () {
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
lorem: {
|
||||
ipsum: 'again',
|
||||
dolor: 'sit'
|
||||
}
|
||||
},
|
||||
world: {
|
||||
greet: 'hello',
|
||||
lorem: {
|
||||
ipsum: 'again',
|
||||
dolor: 'sit'
|
||||
}
|
||||
}
|
||||
}, unflatten({
|
||||
'hello.lorem.ipsum': 'again',
|
||||
'hello.lorem.dolor': 'sit',
|
||||
'world.lorem.ipsum': 'again',
|
||||
'world.lorem.dolor': 'sit',
|
||||
world: { greet: 'hello' }
|
||||
}))
|
||||
})
|
||||
|
||||
test('nested objects do not clobber each other when a.b inserted before a', function () {
|
||||
const x = {}
|
||||
x['foo.bar'] = { t: 123 }
|
||||
x.foo = { p: 333 }
|
||||
assert.deepStrictEqual(unflatten(x), {
|
||||
foo: {
|
||||
bar: {
|
||||
t: 123
|
||||
},
|
||||
p: 333
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
test('Custom Delimiter', function () {
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
}
|
||||
}, unflatten({
|
||||
'hello world again': 'good morning'
|
||||
}, {
|
||||
delimiter: ' '
|
||||
}))
|
||||
})
|
||||
|
||||
test('Overwrite', function () {
|
||||
assert.deepStrictEqual({
|
||||
travis: {
|
||||
build: {
|
||||
dir: '/home/travis/build/kvz/environmental'
|
||||
}
|
||||
}
|
||||
}, unflatten({
|
||||
travis: 'true',
|
||||
travis_build_dir: '/home/travis/build/kvz/environmental'
|
||||
}, {
|
||||
delimiter: '_',
|
||||
overwrite: true
|
||||
}))
|
||||
})
|
||||
|
||||
test('Transformed Keys', function () {
|
||||
assert.deepStrictEqual(unflatten({
|
||||
'__hello__.__world__.__again__': 'good morning',
|
||||
'__lorem__.__ipsum__.__dolor__': 'good evening'
|
||||
}, {
|
||||
transformKey: function (key) {
|
||||
return key.substring(2, key.length - 2)
|
||||
}
|
||||
}), {
|
||||
hello: {
|
||||
world: {
|
||||
again: 'good morning'
|
||||
}
|
||||
},
|
||||
lorem: {
|
||||
ipsum: {
|
||||
dolor: 'good evening'
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
test('Messy', function () {
|
||||
assert.deepStrictEqual({
|
||||
hello: { world: 'again' },
|
||||
lorem: { ipsum: 'another' },
|
||||
good: {
|
||||
morning: {
|
||||
hash: {
|
||||
key: {
|
||||
nested: {
|
||||
deep: {
|
||||
and: {
|
||||
even: {
|
||||
deeper: { still: 'hello' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
again: { testing: { this: 'out' } }
|
||||
}
|
||||
}
|
||||
}, unflatten({
|
||||
'hello.world': 'again',
|
||||
'lorem.ipsum': 'another',
|
||||
'good.morning': {
|
||||
'hash.key': {
|
||||
'nested.deep': {
|
||||
'and.even.deeper.still': 'hello'
|
||||
}
|
||||
}
|
||||
},
|
||||
'good.morning.again': {
|
||||
'testing.this': 'out'
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
suite('Overwrite + non-object values in key positions', function () {
|
||||
test('non-object keys + overwrite should be overwritten', function () {
|
||||
assert.deepStrictEqual(flat.unflatten({ a: null, 'a.b': 'c' }, { overwrite: true }), { a: { b: 'c' } })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: 0, 'a.b': 'c' }, { overwrite: true }), { a: { b: 'c' } })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: 1, 'a.b': 'c' }, { overwrite: true }), { a: { b: 'c' } })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: '', 'a.b': 'c' }, { overwrite: true }), { a: { b: 'c' } })
|
||||
})
|
||||
|
||||
test('overwrite value should not affect undefined keys', function () {
|
||||
assert.deepStrictEqual(flat.unflatten({ a: undefined, 'a.b': 'c' }, { overwrite: true }), { a: { b: 'c' } })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: undefined, 'a.b': 'c' }, { overwrite: false }), { a: { b: 'c' } })
|
||||
})
|
||||
|
||||
test('if no overwrite, should ignore nested values under non-object key', function () {
|
||||
assert.deepStrictEqual(flat.unflatten({ a: null, 'a.b': 'c' }), { a: null })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: 0, 'a.b': 'c' }), { a: 0 })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: 1, 'a.b': 'c' }), { a: 1 })
|
||||
assert.deepStrictEqual(flat.unflatten({ a: '', 'a.b': 'c' }), { a: '' })
|
||||
})
|
||||
})
|
||||
|
||||
suite('.safe', function () {
|
||||
test('Should protect arrays when true', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: [
|
||||
{ world: { again: 'foo' } },
|
||||
{ lorem: 'ipsum' }
|
||||
],
|
||||
another: {
|
||||
nested: [{ array: { too: 'deep' } }]
|
||||
},
|
||||
lorem: {
|
||||
ipsum: 'whoop'
|
||||
}
|
||||
}, {
|
||||
safe: true
|
||||
}), {
|
||||
hello: [
|
||||
{ world: { again: 'foo' } },
|
||||
{ lorem: 'ipsum' }
|
||||
],
|
||||
'lorem.ipsum': 'whoop',
|
||||
'another.nested': [{ array: { too: 'deep' } }]
|
||||
})
|
||||
})
|
||||
|
||||
test('Should not protect arrays when false', function () {
|
||||
assert.deepStrictEqual(flatten({
|
||||
hello: [
|
||||
{ world: { again: 'foo' } },
|
||||
{ lorem: 'ipsum' }
|
||||
]
|
||||
}, {
|
||||
safe: false
|
||||
}), {
|
||||
'hello.0.world.again': 'foo',
|
||||
'hello.1.lorem': 'ipsum'
|
||||
})
|
||||
})
|
||||
|
||||
test('Empty objects should not be removed', function () {
|
||||
assert.deepStrictEqual(unflatten({
|
||||
foo: [],
|
||||
bar: {}
|
||||
}), { foo: [], bar: {} })
|
||||
})
|
||||
})
|
||||
|
||||
suite('.object', function () {
|
||||
test('Should create object instead of array when true', function () {
|
||||
const unflattened = unflatten({
|
||||
'hello.you.0': 'ipsum',
|
||||
'hello.you.1': 'lorem',
|
||||
'hello.other.world': 'foo'
|
||||
}, {
|
||||
object: true
|
||||
})
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
you: {
|
||||
0: 'ipsum',
|
||||
1: 'lorem'
|
||||
},
|
||||
other: { world: 'foo' }
|
||||
}
|
||||
}, unflattened)
|
||||
assert(!Array.isArray(unflattened.hello.you))
|
||||
})
|
||||
|
||||
test('Should create object instead of array when nested', function () {
|
||||
const unflattened = unflatten({
|
||||
hello: {
|
||||
'you.0': 'ipsum',
|
||||
'you.1': 'lorem',
|
||||
'other.world': 'foo'
|
||||
}
|
||||
}, {
|
||||
object: true
|
||||
})
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
you: {
|
||||
0: 'ipsum',
|
||||
1: 'lorem'
|
||||
},
|
||||
other: { world: 'foo' }
|
||||
}
|
||||
}, unflattened)
|
||||
assert(!Array.isArray(unflattened.hello.you))
|
||||
})
|
||||
|
||||
test('Should keep the zero in the left when object is true', function () {
|
||||
const unflattened = unflatten({
|
||||
'hello.0200': 'world',
|
||||
'hello.0500': 'darkness my old friend'
|
||||
}, {
|
||||
object: true
|
||||
})
|
||||
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
'0200': 'world',
|
||||
'0500': 'darkness my old friend'
|
||||
}
|
||||
}, unflattened)
|
||||
})
|
||||
|
||||
test('Should not create object when false', function () {
|
||||
const unflattened = unflatten({
|
||||
'hello.you.0': 'ipsum',
|
||||
'hello.you.1': 'lorem',
|
||||
'hello.other.world': 'foo'
|
||||
}, {
|
||||
object: false
|
||||
})
|
||||
assert.deepStrictEqual({
|
||||
hello: {
|
||||
you: ['ipsum', 'lorem'],
|
||||
other: { world: 'foo' }
|
||||
}
|
||||
}, unflattened)
|
||||
assert(Array.isArray(unflattened.hello.you))
|
||||
})
|
||||
})
|
||||
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
test('Buffer', function () {
|
||||
assert.deepStrictEqual(unflatten({
|
||||
'hello.empty.nested': Buffer.from('test')
|
||||
}), {
|
||||
hello: {
|
||||
empty: {
|
||||
nested: Buffer.from('test')
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
test('typed arrays', function () {
|
||||
assert.deepStrictEqual(unflatten({
|
||||
'hello.empty.nested': new Uint8Array([1, 2, 3, 4])
|
||||
}), {
|
||||
hello: {
|
||||
empty: {
|
||||
nested: new Uint8Array([1, 2, 3, 4])
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
test('should not pollute prototype', function () {
|
||||
unflatten({
|
||||
'__proto__.polluted': true
|
||||
})
|
||||
unflatten({
|
||||
'prefix.__proto__.polluted': true
|
||||
})
|
||||
unflatten({
|
||||
'prefix.0.__proto__.polluted': true
|
||||
})
|
||||
|
||||
assert.notStrictEqual({}.polluted, true)
|
||||
})
|
||||
})
|
||||
|
||||
suite('Arrays', function () {
|
||||
test('Should be able to flatten arrays properly', function () {
|
||||
assert.deepStrictEqual({
|
||||
'a.0': 'foo',
|
||||
'a.1': 'bar'
|
||||
}, flatten({
|
||||
a: ['foo', 'bar']
|
||||
}))
|
||||
})
|
||||
|
||||
test('Should be able to revert and reverse array serialization via unflatten', function () {
|
||||
assert.deepStrictEqual({
|
||||
a: ['foo', 'bar']
|
||||
}, unflatten({
|
||||
'a.0': 'foo',
|
||||
'a.1': 'bar'
|
||||
}))
|
||||
})
|
||||
|
||||
test('Array typed objects should be restored by unflatten', function () {
|
||||
assert.strictEqual(
|
||||
Object.prototype.toString.call(['foo', 'bar'])
|
||||
, Object.prototype.toString.call(unflatten({
|
||||
'a.0': 'foo',
|
||||
'a.1': 'bar'
|
||||
}).a)
|
||||
)
|
||||
})
|
||||
|
||||
test('Do not include keys with numbers inside them', function () {
|
||||
assert.deepStrictEqual(unflatten({
|
||||
'1key.2_key': 'ok'
|
||||
}), {
|
||||
'1key': {
|
||||
'2_key': 'ok'
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
suite('Order of Keys', function () {
|
||||
test('Order of keys should not be changed after round trip flatten/unflatten', function () {
|
||||
const obj = {
|
||||
b: 1,
|
||||
abc: {
|
||||
c: [{
|
||||
d: 1,
|
||||
bca: 1,
|
||||
a: 1
|
||||
}]
|
||||
},
|
||||
a: 1
|
||||
}
|
||||
const result = unflatten(
|
||||
flatten(obj)
|
||||
)
|
||||
|
||||
assert.deepStrictEqual(Object.keys(obj), Object.keys(result))
|
||||
assert.deepStrictEqual(Object.keys(obj.abc), Object.keys(result.abc))
|
||||
assert.deepStrictEqual(Object.keys(obj.abc.c[0]), Object.keys(result.abc.c[0]))
|
||||
})
|
||||
})
|
||||
|
||||
suite('CLI', function () {
|
||||
test('can take filename', function (done) {
|
||||
const cli = path.resolve(__dirname, '..', pkg.bin)
|
||||
const pkgJSON = path.resolve(__dirname, '..', 'package.json')
|
||||
exec(`${cli} ${pkgJSON}`, (err, stdout, stderr) => {
|
||||
assert.ifError(err)
|
||||
assert.strictEqual(stdout.trim(), JSON.stringify(flatten(pkg), null, 2))
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
test('exits with usage if no file', function (done) {
|
||||
const cli = path.resolve(__dirname, '..', pkg.bin)
|
||||
const pkgJSON = path.resolve(__dirname, '..', 'package.json')
|
||||
exec(`${cli} ${pkgJSON}`, (err, stdout, stderr) => {
|
||||
assert.ifError(err)
|
||||
assert.strictEqual(stdout.trim(), JSON.stringify(flatten(pkg), null, 2))
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
test('can take piped file', function (done) {
|
||||
const cli = path.resolve(__dirname, '..', pkg.bin)
|
||||
const pkgJSON = path.resolve(__dirname, '..', 'package.json')
|
||||
exec(`cat ${pkgJSON} | ${cli}`, (err, stdout, stderr) => {
|
||||
assert.ifError(err)
|
||||
assert.strictEqual(stdout.trim(), JSON.stringify(flatten(pkg), null, 2))
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,109 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const fs = require('graceful-fs');
|
||||
const makeDir = require('make-dir');
|
||||
const xdgBasedir = require('xdg-basedir');
|
||||
const writeFileAtomic = require('write-file-atomic');
|
||||
const dotProp = require('dot-prop');
|
||||
const uniqueString = require('unique-string');
|
||||
|
||||
const configDirectory = xdgBasedir.config || path.join(os.tmpdir(), uniqueString());
|
||||
const permissionError = 'You don\'t have access to this file.';
|
||||
const makeDirOptions = {mode: 0o0700};
|
||||
const writeFileOptions = {mode: 0o0600};
|
||||
|
||||
class Configstore {
|
||||
constructor(id, defaults, options = {}) {
|
||||
const pathPrefix = options.globalConfigPath ?
|
||||
path.join(id, 'config.json') :
|
||||
path.join('configstore', `${id}.json`);
|
||||
|
||||
this.path = options.configPath || path.join(configDirectory, pathPrefix);
|
||||
|
||||
if (defaults) {
|
||||
this.all = {
|
||||
...defaults,
|
||||
...this.all
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
get all() {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(this.path, 'utf8'));
|
||||
} catch (error) {
|
||||
// Create directory if it doesn't exist
|
||||
if (error.code === 'ENOENT') {
|
||||
return {};
|
||||
}
|
||||
|
||||
// Improve the message of permission errors
|
||||
if (error.code === 'EACCES') {
|
||||
error.message = `${error.message}\n${permissionError}\n`;
|
||||
}
|
||||
|
||||
// Empty the file if it encounters invalid JSON
|
||||
if (error.name === 'SyntaxError') {
|
||||
writeFileAtomic.sync(this.path, '', writeFileOptions);
|
||||
return {};
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
set all(value) {
|
||||
try {
|
||||
// Make sure the folder exists as it could have been deleted in the meantime
|
||||
makeDir.sync(path.dirname(this.path), makeDirOptions);
|
||||
|
||||
writeFileAtomic.sync(this.path, JSON.stringify(value, undefined, '\t'), writeFileOptions);
|
||||
} catch (error) {
|
||||
// Improve the message of permission errors
|
||||
if (error.code === 'EACCES') {
|
||||
error.message = `${error.message}\n${permissionError}\n`;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
get size() {
|
||||
return Object.keys(this.all || {}).length;
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return dotProp.get(this.all, key);
|
||||
}
|
||||
|
||||
set(key, value) {
|
||||
const config = this.all;
|
||||
|
||||
if (arguments.length === 1) {
|
||||
for (const k of Object.keys(key)) {
|
||||
dotProp.set(config, k, key[k]);
|
||||
}
|
||||
} else {
|
||||
dotProp.set(config, key, value);
|
||||
}
|
||||
|
||||
this.all = config;
|
||||
}
|
||||
|
||||
has(key) {
|
||||
return dotProp.has(this.all, key);
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
const config = this.all;
|
||||
dotProp.delete(config, key);
|
||||
this.all = config;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.all = {};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Configstore;
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/timeInterval';
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var merge_1 = require("../observable/merge");
|
||||
function merge() {
|
||||
var observables = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
observables[_i] = arguments[_i];
|
||||
}
|
||||
return function (source) { return source.lift.call(merge_1.merge.apply(void 0, [source].concat(observables))); };
|
||||
}
|
||||
exports.merge = merge;
|
||||
//# sourceMappingURL=merge.js.map
|
||||
@@ -0,0 +1,53 @@
|
||||
let flexSpec = require('./flex-spec')
|
||||
let Declaration = require('../declaration')
|
||||
|
||||
class FlexFlow extends Declaration {
|
||||
/**
|
||||
* Use two properties for 2009 spec
|
||||
*/
|
||||
insert (decl, prefix, prefixes) {
|
||||
let spec
|
||||
;[spec, prefix] = flexSpec(prefix)
|
||||
if (spec !== 2009) {
|
||||
return super.insert(decl, prefix, prefixes)
|
||||
}
|
||||
let values = decl.value
|
||||
.split(/\s+/)
|
||||
.filter(i => i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse')
|
||||
if (values.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let already = decl.parent.some(
|
||||
i =>
|
||||
i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction'
|
||||
)
|
||||
if (already) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let value = values[0]
|
||||
let orient = value.includes('row') ? 'horizontal' : 'vertical'
|
||||
let dir = value.includes('reverse') ? 'reverse' : 'normal'
|
||||
|
||||
let cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-orient'
|
||||
cloned.value = orient
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
decl.parent.insertBefore(decl, cloned)
|
||||
|
||||
cloned = this.clone(decl)
|
||||
cloned.prop = prefix + 'box-direction'
|
||||
cloned.value = dir
|
||||
if (this.needCascade(decl)) {
|
||||
cloned.raws.before = this.calcBefore(prefixes, decl, prefix)
|
||||
}
|
||||
return decl.parent.insertBefore(decl, cloned)
|
||||
}
|
||||
}
|
||||
|
||||
FlexFlow.names = ['flex-flow', 'box-direction', 'box-orient']
|
||||
|
||||
module.exports = FlexFlow
|
||||
@@ -0,0 +1,11 @@
|
||||
export interface UnsubscriptionError extends Error {
|
||||
readonly errors: any[];
|
||||
}
|
||||
export interface UnsubscriptionErrorCtor {
|
||||
new (errors: any[]): UnsubscriptionError;
|
||||
}
|
||||
/**
|
||||
* An error thrown when one or more errors have occurred during the
|
||||
* `unsubscribe` of a {@link Subscription}.
|
||||
*/
|
||||
export declare const UnsubscriptionError: UnsubscriptionErrorCtor;
|
||||
@@ -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/operator/sampleTime"));
|
||||
//# sourceMappingURL=sampleTime.js.map
|
||||
@@ -0,0 +1,96 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { async } from '../scheduler/async';
|
||||
import { MonoTypeOperatorFunction, SchedulerAction, SchedulerLike, TeardownLogic } from '../types';
|
||||
|
||||
/**
|
||||
* Emits the most recently emitted value from the source Observable within
|
||||
* periodic time intervals.
|
||||
*
|
||||
* <span class="informal">Samples the source Observable at periodic time
|
||||
* intervals, emitting what it samples.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `sampleTime` periodically looks at the source Observable and emits whichever
|
||||
* value it has most recently emitted since the previous sampling, unless the
|
||||
* source has not emitted anything since the previous sampling. The sampling
|
||||
* happens periodically in time every `period` milliseconds (or the time unit
|
||||
* defined by the optional `scheduler` argument). The sampling starts as soon as
|
||||
* the output Observable is subscribed.
|
||||
*
|
||||
* ## Example
|
||||
* Every second, emit the most recent click at most once
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { sampleTime } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const result = clicks.pipe(sampleTime(1000));
|
||||
* result.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link auditTime}
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delay}
|
||||
* @see {@link sample}
|
||||
* @see {@link throttleTime}
|
||||
*
|
||||
* @param {number} period The sampling period expressed in milliseconds or the
|
||||
* time unit determined internally by the optional `scheduler`.
|
||||
* @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
|
||||
* managing the timers that handle the sampling.
|
||||
* @return {Observable<T>} An Observable that emits the results of sampling the
|
||||
* values emitted by the source Observable at the specified time interval.
|
||||
* @method sampleTime
|
||||
* @owner Observable
|
||||
*/
|
||||
export function sampleTime<T>(period: number, scheduler: SchedulerLike = async): MonoTypeOperatorFunction<T> {
|
||||
return (source: Observable<T>) => source.lift(new SampleTimeOperator(period, scheduler));
|
||||
}
|
||||
|
||||
class SampleTimeOperator<T> implements Operator<T, T> {
|
||||
constructor(private period: number,
|
||||
private scheduler: SchedulerLike) {
|
||||
}
|
||||
|
||||
call(subscriber: Subscriber<T>, source: any): TeardownLogic {
|
||||
return source.subscribe(new SampleTimeSubscriber(subscriber, this.period, this.scheduler));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class SampleTimeSubscriber<T> extends Subscriber<T> {
|
||||
lastValue: T;
|
||||
hasValue: boolean = false;
|
||||
|
||||
constructor(destination: Subscriber<T>,
|
||||
private period: number,
|
||||
private scheduler: SchedulerLike) {
|
||||
super(destination);
|
||||
this.add(scheduler.schedule(dispatchNotification, period, { subscriber: this, period }));
|
||||
}
|
||||
|
||||
protected _next(value: T) {
|
||||
this.lastValue = value;
|
||||
this.hasValue = true;
|
||||
}
|
||||
|
||||
notifyNext() {
|
||||
if (this.hasValue) {
|
||||
this.hasValue = false;
|
||||
this.destination.next(this.lastValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dispatchNotification<T>(this: SchedulerAction<any>, state: any) {
|
||||
let { subscriber, period } = state;
|
||||
subscriber.notifyNext();
|
||||
this.schedule(state, period);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { isArray } from '../util/isArray';
|
||||
import { CombineLatestOperator } from '../observable/combineLatest';
|
||||
import { from } from '../observable/from';
|
||||
const none = {};
|
||||
export function combineLatest(...observables) {
|
||||
let project = null;
|
||||
if (typeof observables[observables.length - 1] === 'function') {
|
||||
project = observables.pop();
|
||||
}
|
||||
if (observables.length === 1 && isArray(observables[0])) {
|
||||
observables = observables[0].slice();
|
||||
}
|
||||
return (source) => source.lift.call(from([source, ...observables]), new CombineLatestOperator(project));
|
||||
}
|
||||
//# sourceMappingURL=combineLatest.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/mergeScan';
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var async_1 = require("../scheduler/async");
|
||||
var TimeoutError_1 = require("../util/TimeoutError");
|
||||
var timeoutWith_1 = require("./timeoutWith");
|
||||
var throwError_1 = require("../observable/throwError");
|
||||
function timeout(due, scheduler) {
|
||||
if (scheduler === void 0) { scheduler = async_1.async; }
|
||||
return timeoutWith_1.timeoutWith(due, throwError_1.throwError(new TimeoutError_1.TimeoutError()), scheduler);
|
||||
}
|
||||
exports.timeout = timeout;
|
||||
//# sourceMappingURL=timeout.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var QueueAction_1 = require("./QueueAction");
|
||||
var QueueScheduler_1 = require("./QueueScheduler");
|
||||
exports.queueScheduler = new QueueScheduler_1.QueueScheduler(QueueAction_1.QueueAction);
|
||||
exports.queue = exports.queueScheduler;
|
||||
//# sourceMappingURL=queue.js.map
|
||||
@@ -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/operator/distinctUntilChanged"));
|
||||
//# sourceMappingURL=distinctUntilChanged.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/timer';
|
||||
Reference in New Issue
Block a user