new license file version [CI SKIP]
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/find';
|
||||
@@ -0,0 +1,51 @@
|
||||
function last (array) {
|
||||
return array[array.length - 1]
|
||||
}
|
||||
|
||||
let brackets = {
|
||||
/**
|
||||
* Parse string to nodes tree
|
||||
*/
|
||||
parse (str) {
|
||||
let current = ['']
|
||||
let stack = [current]
|
||||
|
||||
for (let sym of str) {
|
||||
if (sym === '(') {
|
||||
current = ['']
|
||||
last(stack).push(current)
|
||||
stack.push(current)
|
||||
continue
|
||||
}
|
||||
|
||||
if (sym === ')') {
|
||||
stack.pop()
|
||||
current = last(stack)
|
||||
current.push('')
|
||||
continue
|
||||
}
|
||||
|
||||
current[current.length - 1] += sym
|
||||
}
|
||||
|
||||
return stack[0]
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate output string by nodes tree
|
||||
*/
|
||||
stringify (ast) {
|
||||
let result = ''
|
||||
for (let i of ast) {
|
||||
if (typeof i === 'object') {
|
||||
result += `(${brackets.stringify(i)})`
|
||||
continue
|
||||
}
|
||||
|
||||
result += i
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = brackets
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"hooks": {},
|
||||
"git": {
|
||||
"changelog": "git log --pretty=format:\"* %s (%h)\" ${from}...${to}",
|
||||
"requireCleanWorkingDir": true,
|
||||
"requireBranch": false,
|
||||
"requireUpstream": true,
|
||||
"requireCommits": false,
|
||||
"addUntrackedFiles": false,
|
||||
"commit": true,
|
||||
"commitMessage": "Release ${version}",
|
||||
"commitArgs": [],
|
||||
"tag": true,
|
||||
"tagName": null,
|
||||
"tagAnnotation": "Release ${version}",
|
||||
"tagArgs": [],
|
||||
"push": true,
|
||||
"pushArgs": ["--follow-tags"],
|
||||
"pushRepo": ""
|
||||
},
|
||||
"npm": {
|
||||
"publish": true,
|
||||
"publishPath": ".",
|
||||
"publishArgs": [],
|
||||
"tag": null,
|
||||
"otp": null,
|
||||
"ignoreVersion": false,
|
||||
"skipChecks": false,
|
||||
"timeout": 10
|
||||
},
|
||||
"github": {
|
||||
"release": false,
|
||||
"releaseName": "Release ${version}",
|
||||
"releaseNotes": null,
|
||||
"preRelease": false,
|
||||
"draft": false,
|
||||
"tokenRef": "GITHUB_TOKEN",
|
||||
"assets": null,
|
||||
"host": null,
|
||||
"timeout": 0,
|
||||
"proxy": null,
|
||||
"skipChecks": false
|
||||
},
|
||||
"gitlab": {
|
||||
"release": false,
|
||||
"releaseName": "Release ${version}",
|
||||
"releaseNotes": null,
|
||||
"tokenRef": "GITLAB_TOKEN",
|
||||
"tokenHeader": "Private-Token",
|
||||
"assets": null,
|
||||
"origin": null,
|
||||
"skipChecks": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/scan';
|
||||
@@ -0,0 +1,9 @@
|
||||
// Filesystem API
|
||||
// dev.w3.org/2009/dap/file-system/file-dir-sys.html
|
||||
|
||||
// The API will be present in Chrome incognito, but will throw an exception.
|
||||
// See crbug.com/93417
|
||||
//
|
||||
// By Eric Bidelman (@ebidel)
|
||||
|
||||
Modernizr.addTest('filesystem', !!Modernizr.prefixed('requestFileSystem', window));
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "mimic-response",
|
||||
"version": "1.0.1",
|
||||
"description": "Mimic a Node.js HTTP response stream",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/mimic-response",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"mimic",
|
||||
"response",
|
||||
"stream",
|
||||
"http",
|
||||
"https",
|
||||
"request",
|
||||
"get",
|
||||
"core"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"create-test-server": "^0.1.0",
|
||||
"pify": "^3.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { ObservableInput, OperatorFunction } from '../types';
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, R>(project: (v1: T) => R): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, R>(v2: ObservableInput<T2>, project: (v1: T, v2: T2) => R): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, project: (v1: T, v2: T2, v3: T3) => R): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, T4, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, project: (v1: T, v2: T2, v3: T3, v4: T4) => R): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, T4, T5, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, T4, T5, T6, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2>(v2: ObservableInput<T2>): OperatorFunction<T, [T, T2]>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>): OperatorFunction<T, [T, T2, T3]>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>): OperatorFunction<T, [T, T2, T3, T4]>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>): OperatorFunction<T, [T, T2, T3, T4, T5]>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>): OperatorFunction<T, [T, T2, T3, T4, T5, T6]>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, R>(...observables: Array<ObservableInput<T> | ((...values: Array<T>) => R)>): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, R>(array: Array<ObservableInput<T>>): OperatorFunction<T, R>;
|
||||
/** @deprecated Deprecated in favor of static zip. */
|
||||
export declare function zip<T, TOther, R>(array: Array<ObservableInput<TOther>>, project: (v1: T, ...values: Array<TOther>) => R): OperatorFunction<T, R>;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"multicast.js","sources":["../src/operators/multicast.ts"],"names":[],"mappings":";;;;;AAAA,qDAAgD"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"mime-types","version":"2.1.30","files":{"LICENSE":{"checkedAt":1678887829687,"integrity":"sha512-oaKT6wCX/oeHXzv5CMwLDujxXplcaOmEtqJOJHsulUQH15QeqWq9f+ACob37cT/fsNODnZSKM0YD8F5kSCn2Bg==","mode":438,"size":1167},"index.js":{"checkedAt":1678887829687,"integrity":"sha512-wkid43nvph1ozqfx1M5AWTpIqG9iyL4doJmkRi3wcFwyTOImCxmY6b3klNKoFYxg11F76ESNJyUjedZ12Zrhvg==","mode":438,"size":3663},"package.json":{"checkedAt":1678887829683,"integrity":"sha512-xn/790PlkkvdtHe5og2fgzMbrRBhK1c0OkD6J+SAlBsoxO05D0qkXErQuu8zUEK/SvUISRYCUxep6g5alymZRw==","mode":438,"size":1149},"HISTORY.md":{"checkedAt":1678887829687,"integrity":"sha512-Uct/lZeS4re72HqV/v1clA71foGOmjsqIaYFvSlkyKTtIrRb0vj22k38WutL4yqo70RpPvoEiXflDAcxoKKYjA==","mode":438,"size":8058},"README.md":{"checkedAt":1678887829687,"integrity":"sha512-yypWJOs3R8XFtfF+KDmC6i6NVfZG4utSHUykllcpaSO2eoyLV1u7pgfSYw6RmC48Yq6XUZzuY7fIIPZtoN0XFg==","mode":438,"size":3484}}}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Got, HandlerFunction, InstanceDefaults } from './types';
|
||||
export declare const defaultHandler: HandlerFunction;
|
||||
declare const create: (defaults: InstanceDefaults) => Got;
|
||||
export default create;
|
||||
export * from './types';
|
||||
@@ -0,0 +1,368 @@
|
||||
let vendor = require('./vendor')
|
||||
let Declaration = require('./declaration')
|
||||
let Resolution = require('./resolution')
|
||||
let Transition = require('./transition')
|
||||
let Processor = require('./processor')
|
||||
let Supports = require('./supports')
|
||||
let Browsers = require('./browsers')
|
||||
let Selector = require('./selector')
|
||||
let AtRule = require('./at-rule')
|
||||
let Value = require('./value')
|
||||
let utils = require('./utils')
|
||||
Selector.hack(require('./hacks/fullscreen'))
|
||||
Selector.hack(require('./hacks/placeholder'))
|
||||
Selector.hack(require('./hacks/placeholder-shown'))
|
||||
Declaration.hack(require('./hacks/flex'))
|
||||
Declaration.hack(require('./hacks/order'))
|
||||
Declaration.hack(require('./hacks/filter'))
|
||||
Declaration.hack(require('./hacks/grid-end'))
|
||||
Declaration.hack(require('./hacks/animation'))
|
||||
Declaration.hack(require('./hacks/flex-flow'))
|
||||
Declaration.hack(require('./hacks/flex-grow'))
|
||||
Declaration.hack(require('./hacks/flex-wrap'))
|
||||
Declaration.hack(require('./hacks/grid-area'))
|
||||
Declaration.hack(require('./hacks/place-self'))
|
||||
Declaration.hack(require('./hacks/grid-start'))
|
||||
Declaration.hack(require('./hacks/align-self'))
|
||||
Declaration.hack(require('./hacks/appearance'))
|
||||
Declaration.hack(require('./hacks/flex-basis'))
|
||||
Declaration.hack(require('./hacks/mask-border'))
|
||||
Declaration.hack(require('./hacks/mask-composite'))
|
||||
Declaration.hack(require('./hacks/align-items'))
|
||||
Declaration.hack(require('./hacks/user-select'))
|
||||
Declaration.hack(require('./hacks/flex-shrink'))
|
||||
Declaration.hack(require('./hacks/break-props'))
|
||||
Declaration.hack(require('./hacks/color-adjust'))
|
||||
Declaration.hack(require('./hacks/writing-mode'))
|
||||
Declaration.hack(require('./hacks/border-image'))
|
||||
Declaration.hack(require('./hacks/align-content'))
|
||||
Declaration.hack(require('./hacks/border-radius'))
|
||||
Declaration.hack(require('./hacks/block-logical'))
|
||||
Declaration.hack(require('./hacks/grid-template'))
|
||||
Declaration.hack(require('./hacks/inline-logical'))
|
||||
Declaration.hack(require('./hacks/grid-row-align'))
|
||||
Declaration.hack(require('./hacks/transform-decl'))
|
||||
Declaration.hack(require('./hacks/flex-direction'))
|
||||
Declaration.hack(require('./hacks/image-rendering'))
|
||||
Declaration.hack(require('./hacks/backdrop-filter'))
|
||||
Declaration.hack(require('./hacks/background-clip'))
|
||||
Declaration.hack(require('./hacks/text-decoration'))
|
||||
Declaration.hack(require('./hacks/justify-content'))
|
||||
Declaration.hack(require('./hacks/background-size'))
|
||||
Declaration.hack(require('./hacks/grid-row-column'))
|
||||
Declaration.hack(require('./hacks/grid-rows-columns'))
|
||||
Declaration.hack(require('./hacks/grid-column-align'))
|
||||
Declaration.hack(require('./hacks/overscroll-behavior'))
|
||||
Declaration.hack(require('./hacks/grid-template-areas'))
|
||||
Declaration.hack(require('./hacks/text-emphasis-position'))
|
||||
Declaration.hack(require('./hacks/text-decoration-skip-ink'))
|
||||
Value.hack(require('./hacks/gradient'))
|
||||
Value.hack(require('./hacks/intrinsic'))
|
||||
Value.hack(require('./hacks/pixelated'))
|
||||
Value.hack(require('./hacks/image-set'))
|
||||
Value.hack(require('./hacks/cross-fade'))
|
||||
Value.hack(require('./hacks/display-flex'))
|
||||
Value.hack(require('./hacks/display-grid'))
|
||||
Value.hack(require('./hacks/filter-value'))
|
||||
|
||||
let declsCache = new Map()
|
||||
|
||||
class Prefixes {
|
||||
constructor (data, browsers, options = {}) {
|
||||
this.data = data
|
||||
this.browsers = browsers
|
||||
this.options = options
|
||||
;[this.add, this.remove] = this.preprocess(this.select(this.data))
|
||||
this.transition = new Transition(this)
|
||||
this.processor = new Processor(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clone instance to remove all prefixes
|
||||
*/
|
||||
cleaner () {
|
||||
if (this.cleanerCache) {
|
||||
return this.cleanerCache
|
||||
}
|
||||
|
||||
if (this.browsers.selected.length) {
|
||||
let empty = new Browsers(this.browsers.data, [])
|
||||
this.cleanerCache = new Prefixes(this.data, empty, this.options)
|
||||
} else {
|
||||
return this
|
||||
}
|
||||
|
||||
return this.cleanerCache
|
||||
}
|
||||
|
||||
/**
|
||||
* Select prefixes from data, which is necessary for selected browsers
|
||||
*/
|
||||
select (list) {
|
||||
let selected = { add: {}, remove: {} }
|
||||
|
||||
for (let name in list) {
|
||||
let data = list[name]
|
||||
let add = data.browsers.map(i => {
|
||||
let params = i.split(' ')
|
||||
return {
|
||||
browser: `${params[0]} ${params[1]}`,
|
||||
note: params[2]
|
||||
}
|
||||
})
|
||||
|
||||
let notes = add
|
||||
.filter(i => i.note)
|
||||
.map(i => `${this.browsers.prefix(i.browser)} ${i.note}`)
|
||||
notes = utils.uniq(notes)
|
||||
|
||||
add = add
|
||||
.filter(i => this.browsers.isSelected(i.browser))
|
||||
.map(i => {
|
||||
let prefix = this.browsers.prefix(i.browser)
|
||||
if (i.note) {
|
||||
return `${prefix} ${i.note}`
|
||||
} else {
|
||||
return prefix
|
||||
}
|
||||
})
|
||||
add = this.sort(utils.uniq(add))
|
||||
|
||||
if (this.options.flexbox === 'no-2009') {
|
||||
add = add.filter(i => !i.includes('2009'))
|
||||
}
|
||||
|
||||
let all = data.browsers.map(i => this.browsers.prefix(i))
|
||||
if (data.mistakes) {
|
||||
all = all.concat(data.mistakes)
|
||||
}
|
||||
all = all.concat(notes)
|
||||
all = utils.uniq(all)
|
||||
|
||||
if (add.length) {
|
||||
selected.add[name] = add
|
||||
if (add.length < all.length) {
|
||||
selected.remove[name] = all.filter(i => !add.includes(i))
|
||||
}
|
||||
} else {
|
||||
selected.remove[name] = all
|
||||
}
|
||||
}
|
||||
|
||||
return selected
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort vendor prefixes
|
||||
*/
|
||||
sort (prefixes) {
|
||||
return prefixes.sort((a, b) => {
|
||||
let aLength = utils.removeNote(a).length
|
||||
let bLength = utils.removeNote(b).length
|
||||
|
||||
if (aLength === bLength) {
|
||||
return b.length - a.length
|
||||
} else {
|
||||
return bLength - aLength
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache prefixes data to fast CSS processing
|
||||
*/
|
||||
preprocess (selected) {
|
||||
let add = {
|
||||
'selectors': [],
|
||||
'@supports': new Supports(Prefixes, this)
|
||||
}
|
||||
for (let name in selected.add) {
|
||||
let prefixes = selected.add[name]
|
||||
if (name === '@keyframes' || name === '@viewport') {
|
||||
add[name] = new AtRule(name, prefixes, this)
|
||||
} else if (name === '@resolution') {
|
||||
add[name] = new Resolution(name, prefixes, this)
|
||||
} else if (this.data[name].selector) {
|
||||
add.selectors.push(Selector.load(name, prefixes, this))
|
||||
} else {
|
||||
let props = this.data[name].props
|
||||
|
||||
if (props) {
|
||||
let value = Value.load(name, prefixes, this)
|
||||
for (let prop of props) {
|
||||
if (!add[prop]) {
|
||||
add[prop] = { values: [] }
|
||||
}
|
||||
add[prop].values.push(value)
|
||||
}
|
||||
} else {
|
||||
let values = (add[name] && add[name].values) || []
|
||||
add[name] = Declaration.load(name, prefixes, this)
|
||||
add[name].values = values
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let remove = { selectors: [] }
|
||||
for (let name in selected.remove) {
|
||||
let prefixes = selected.remove[name]
|
||||
if (this.data[name].selector) {
|
||||
let selector = Selector.load(name, prefixes)
|
||||
for (let prefix of prefixes) {
|
||||
remove.selectors.push(selector.old(prefix))
|
||||
}
|
||||
} else if (name === '@keyframes' || name === '@viewport') {
|
||||
for (let prefix of prefixes) {
|
||||
let prefixed = `@${prefix}${name.slice(1)}`
|
||||
remove[prefixed] = { remove: true }
|
||||
}
|
||||
} else if (name === '@resolution') {
|
||||
remove[name] = new Resolution(name, prefixes, this)
|
||||
} else {
|
||||
let props = this.data[name].props
|
||||
if (props) {
|
||||
let value = Value.load(name, [], this)
|
||||
for (let prefix of prefixes) {
|
||||
let old = value.old(prefix)
|
||||
if (old) {
|
||||
for (let prop of props) {
|
||||
if (!remove[prop]) {
|
||||
remove[prop] = {}
|
||||
}
|
||||
if (!remove[prop].values) {
|
||||
remove[prop].values = []
|
||||
}
|
||||
remove[prop].values.push(old)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let p of prefixes) {
|
||||
let olds = this.decl(name).old(name, p)
|
||||
if (name === 'align-self') {
|
||||
let a = add[name] && add[name].prefixes
|
||||
if (a) {
|
||||
if (p === '-webkit- 2009' && a.includes('-webkit-')) {
|
||||
continue
|
||||
} else if (p === '-webkit-' && a.includes('-webkit- 2009')) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let prefixed of olds) {
|
||||
if (!remove[prefixed]) {
|
||||
remove[prefixed] = {}
|
||||
}
|
||||
remove[prefixed].remove = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [add, remove]
|
||||
}
|
||||
|
||||
/**
|
||||
* Declaration loader with caching
|
||||
*/
|
||||
decl (prop) {
|
||||
if (!declsCache.has(prop)) {
|
||||
declsCache.set(prop, Declaration.load(prop))
|
||||
}
|
||||
|
||||
return declsCache.get(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unprefixed version of property
|
||||
*/
|
||||
unprefixed (prop) {
|
||||
let value = this.normalize(vendor.unprefixed(prop))
|
||||
if (value === 'flex-direction') {
|
||||
value = 'flex-flow'
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize prefix for remover
|
||||
*/
|
||||
normalize (prop) {
|
||||
return this.decl(prop).normalize(prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prefixed version of property
|
||||
*/
|
||||
prefixed (prop, prefix) {
|
||||
prop = vendor.unprefixed(prop)
|
||||
return this.decl(prop).prefixed(prop, prefix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return values, which must be prefixed in selected property
|
||||
*/
|
||||
values (type, prop) {
|
||||
let data = this[type]
|
||||
|
||||
let global = data['*'] && data['*'].values
|
||||
let values = data[prop] && data[prop].values
|
||||
|
||||
if (global && values) {
|
||||
return utils.uniq(global.concat(values))
|
||||
} else {
|
||||
return global || values || []
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Group declaration by unprefixed property to check them
|
||||
*/
|
||||
group (decl) {
|
||||
let rule = decl.parent
|
||||
let index = rule.index(decl)
|
||||
let { length } = rule.nodes
|
||||
let unprefixed = this.unprefixed(decl.prop)
|
||||
|
||||
let checker = (step, callback) => {
|
||||
index += step
|
||||
while (index >= 0 && index < length) {
|
||||
let other = rule.nodes[index]
|
||||
if (other.type === 'decl') {
|
||||
if (step === -1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (this.unprefixed(other.prop) !== unprefixed) {
|
||||
break
|
||||
} else if (callback(other) === true) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (step === +1 && other.prop === unprefixed) {
|
||||
if (!Browsers.withPrefix(other.value)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index += step
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
return {
|
||||
up (callback) {
|
||||
return checker(-1, callback)
|
||||
},
|
||||
down (callback) {
|
||||
return checker(+1, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Prefixes
|
||||
@@ -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/shareReplay"));
|
||||
//# sourceMappingURL=shareReplay.js.map
|
||||
@@ -0,0 +1,13 @@
|
||||
import { concat } from '../observable/concat';
|
||||
import { isScheduler } from '../util/isScheduler';
|
||||
export function startWith(...array) {
|
||||
const scheduler = array[array.length - 1];
|
||||
if (isScheduler(scheduler)) {
|
||||
array.pop();
|
||||
return (source) => concat(array, source, scheduler);
|
||||
}
|
||||
else {
|
||||
return (source) => concat(array, source);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=startWith.js.map
|
||||
@@ -0,0 +1,121 @@
|
||||
import { Operator } from '../Operator';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { OperatorFunction, MonoTypeOperatorFunction } from '../types';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export function scan<T, R>(accumulator: (acc: R, value: T, index: number) => R, seed: R): OperatorFunction<T, R>;
|
||||
export function scan<T>(accumulator: (acc: T, value: T, index: number) => T, seed?: T): MonoTypeOperatorFunction<T>;
|
||||
export function scan<T, R>(accumulator: (acc: R, value: T, index: number) => R): OperatorFunction<T, R>;
|
||||
/* tslint:enable:max-line-length */
|
||||
|
||||
/**
|
||||
* Applies an accumulator function over the source Observable, and returns each
|
||||
* intermediate result, with an optional seed value.
|
||||
*
|
||||
* <span class="informal">It's like {@link reduce}, but emits the current
|
||||
* accumulation whenever the source emits a value.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Combines together all values emitted on the source, using an accumulator
|
||||
* function that knows how to join a new source value into the accumulation from
|
||||
* the past. Is similar to {@link reduce}, but emits the intermediate
|
||||
* accumulations.
|
||||
*
|
||||
* Returns an Observable that applies a specified `accumulator` function to each
|
||||
* item emitted by the source Observable. If a `seed` value is specified, then
|
||||
* that value will be used as the initial value for the accumulator. If no seed
|
||||
* value is specified, the first item of the source is used as the seed.
|
||||
*
|
||||
* ## Example
|
||||
* Count the number of click events
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { scan, mapTo } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const ones = clicks.pipe(mapTo(1));
|
||||
* const seed = 0;
|
||||
* const count = ones.pipe(scan((acc, one) => acc + one, seed));
|
||||
* count.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link expand}
|
||||
* @see {@link mergeScan}
|
||||
* @see {@link reduce}
|
||||
*
|
||||
* @param {function(acc: R, value: T, index: number): R} accumulator
|
||||
* The accumulator function called on each source value.
|
||||
* @param {T|R} [seed] The initial accumulation value.
|
||||
* @return {Observable<R>} An observable of the accumulated values.
|
||||
* @method scan
|
||||
* @owner Observable
|
||||
*/
|
||||
export function scan<T, R>(accumulator: (acc: R, value: T, index: number) => R, seed?: T | R): OperatorFunction<T, R> {
|
||||
let hasSeed = false;
|
||||
// providing a seed of `undefined` *should* be valid and trigger
|
||||
// hasSeed! so don't use `seed !== undefined` checks!
|
||||
// For this reason, we have to check it here at the original call site
|
||||
// otherwise inside Operator/Subscriber we won't know if `undefined`
|
||||
// means they didn't provide anything or if they literally provided `undefined`
|
||||
if (arguments.length >= 2) {
|
||||
hasSeed = true;
|
||||
}
|
||||
|
||||
return function scanOperatorFunction(source: Observable<T>): Observable<R> {
|
||||
return source.lift(new ScanOperator(accumulator, seed, hasSeed));
|
||||
};
|
||||
}
|
||||
|
||||
class ScanOperator<T, R> implements Operator<T, R> {
|
||||
constructor(private accumulator: (acc: R, value: T, index: number) => R, private seed?: T | R, private hasSeed: boolean = false) {}
|
||||
|
||||
call(subscriber: Subscriber<R>, source: any): any {
|
||||
return source.subscribe(new ScanSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class ScanSubscriber<T, R> extends Subscriber<T> {
|
||||
private index: number = 0;
|
||||
|
||||
get seed(): T | R {
|
||||
return this._seed;
|
||||
}
|
||||
|
||||
set seed(value: T | R) {
|
||||
this.hasSeed = true;
|
||||
this._seed = value;
|
||||
}
|
||||
|
||||
constructor(destination: Subscriber<R>, private accumulator: (acc: R, value: T, index: number) => R, private _seed: T | R,
|
||||
private hasSeed: boolean) {
|
||||
super(destination);
|
||||
}
|
||||
|
||||
protected _next(value: T): void {
|
||||
if (!this.hasSeed) {
|
||||
this.seed = value;
|
||||
this.destination.next(value);
|
||||
} else {
|
||||
return this._tryNext(value);
|
||||
}
|
||||
}
|
||||
|
||||
private _tryNext(value: T): void {
|
||||
const index = this.index++;
|
||||
let result: any;
|
||||
try {
|
||||
result = this.accumulator(<R>this.seed, value, index);
|
||||
} catch (err) {
|
||||
this.destination.error(err);
|
||||
}
|
||||
this.seed = result;
|
||||
this.destination.next(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user