new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export default function bigSign(bigIntValue) {
|
||||
return (bigIntValue > 0n) - (bigIntValue < 0n)
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
'use strict';
|
||||
const isObj = require('is-obj');
|
||||
|
||||
const disallowedKeys = new Set([
|
||||
'__proto__',
|
||||
'prototype',
|
||||
'constructor'
|
||||
]);
|
||||
|
||||
const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.has(segment));
|
||||
|
||||
function getPathSegments(path) {
|
||||
const pathArray = path.split('.');
|
||||
const parts = [];
|
||||
|
||||
for (let i = 0; i < pathArray.length; i++) {
|
||||
let p = pathArray[i];
|
||||
|
||||
while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) {
|
||||
p = p.slice(0, -1) + '.';
|
||||
p += pathArray[++i];
|
||||
}
|
||||
|
||||
parts.push(p);
|
||||
}
|
||||
|
||||
if (!isValidPath(parts)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get(object, path, value) {
|
||||
if (!isObj(object) || typeof path !== 'string') {
|
||||
return value === undefined ? object : value;
|
||||
}
|
||||
|
||||
const pathArray = getPathSegments(path);
|
||||
if (pathArray.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < pathArray.length; i++) {
|
||||
object = object[pathArray[i]];
|
||||
|
||||
if (object === undefined || object === null) {
|
||||
// `object` is either `undefined` or `null` so we want to stop the loop, and
|
||||
// if this is not the last bit of the path, and
|
||||
// if it did't return `undefined`
|
||||
// it would return `null` if `object` is `null`
|
||||
// but we want `get({foo: null}, 'foo.bar')` to equal `undefined`, or the supplied value, not `null`
|
||||
if (i !== pathArray.length - 1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return object === undefined ? value : object;
|
||||
},
|
||||
|
||||
set(object, path, value) {
|
||||
if (!isObj(object) || typeof path !== 'string') {
|
||||
return object;
|
||||
}
|
||||
|
||||
const root = object;
|
||||
const pathArray = getPathSegments(path);
|
||||
|
||||
for (let i = 0; i < pathArray.length; i++) {
|
||||
const p = pathArray[i];
|
||||
|
||||
if (!isObj(object[p])) {
|
||||
object[p] = {};
|
||||
}
|
||||
|
||||
if (i === pathArray.length - 1) {
|
||||
object[p] = value;
|
||||
}
|
||||
|
||||
object = object[p];
|
||||
}
|
||||
|
||||
return root;
|
||||
},
|
||||
|
||||
delete(object, path) {
|
||||
if (!isObj(object) || typeof path !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const pathArray = getPathSegments(path);
|
||||
|
||||
for (let i = 0; i < pathArray.length; i++) {
|
||||
const p = pathArray[i];
|
||||
|
||||
if (i === pathArray.length - 1) {
|
||||
delete object[p];
|
||||
return true;
|
||||
}
|
||||
|
||||
object = object[p];
|
||||
|
||||
if (!isObj(object)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
has(object, path) {
|
||||
if (!isObj(object) || typeof path !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const pathArray = getPathSegments(path);
|
||||
if (pathArray.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line unicorn/no-for-loop
|
||||
for (let i = 0; i < pathArray.length; i++) {
|
||||
if (isObj(object)) {
|
||||
if (!(pathArray[i] in object)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
object = object[pathArray[i]];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[1146] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáãåçñ$.<(+|&éêëèíîïìß!£*);¬-/ÂÄÀÁÃÅÇѦ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæ¸Æ€µ¯stuvwxyz¡¿ÐÝÞ®¢[¥·©§¶¼½¾^]~¨´×{ABCDEFGHIôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,6 @@
|
||||
import { exhaustMap } from './exhaustMap';
|
||||
import { identity } from '../util/identity';
|
||||
export function exhaustAll() {
|
||||
return exhaustMap(identity);
|
||||
}
|
||||
//# sourceMappingURL=exhaustAll.js.map
|
||||
@@ -0,0 +1,47 @@
|
||||
Node.js is licensed for use as follows:
|
||||
|
||||
"""
|
||||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
This license applies to parts of Node.js originating from the
|
||||
https://github.com/joyent/node repository:
|
||||
|
||||
"""
|
||||
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
"""
|
||||
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.bindCallbackInternals = void 0;
|
||||
var isScheduler_1 = require("../util/isScheduler");
|
||||
var Observable_1 = require("../Observable");
|
||||
var subscribeOn_1 = require("../operators/subscribeOn");
|
||||
var mapOneOrManyArgs_1 = require("../util/mapOneOrManyArgs");
|
||||
var observeOn_1 = require("../operators/observeOn");
|
||||
var AsyncSubject_1 = require("../AsyncSubject");
|
||||
function bindCallbackInternals(isNodeStyle, callbackFunc, resultSelector, scheduler) {
|
||||
if (resultSelector) {
|
||||
if (isScheduler_1.isScheduler(resultSelector)) {
|
||||
scheduler = resultSelector;
|
||||
}
|
||||
else {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return bindCallbackInternals(isNodeStyle, callbackFunc, scheduler)
|
||||
.apply(this, args)
|
||||
.pipe(mapOneOrManyArgs_1.mapOneOrManyArgs(resultSelector));
|
||||
};
|
||||
}
|
||||
}
|
||||
if (scheduler) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return bindCallbackInternals(isNodeStyle, callbackFunc)
|
||||
.apply(this, args)
|
||||
.pipe(subscribeOn_1.subscribeOn(scheduler), observeOn_1.observeOn(scheduler));
|
||||
};
|
||||
}
|
||||
return function () {
|
||||
var _this = this;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var subject = new AsyncSubject_1.AsyncSubject();
|
||||
var uninitialized = true;
|
||||
return new Observable_1.Observable(function (subscriber) {
|
||||
var subs = subject.subscribe(subscriber);
|
||||
if (uninitialized) {
|
||||
uninitialized = false;
|
||||
var isAsync_1 = false;
|
||||
var isComplete_1 = false;
|
||||
callbackFunc.apply(_this, __spreadArray(__spreadArray([], __read(args)), [
|
||||
function () {
|
||||
var results = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
results[_i] = arguments[_i];
|
||||
}
|
||||
if (isNodeStyle) {
|
||||
var err = results.shift();
|
||||
if (err != null) {
|
||||
subject.error(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
subject.next(1 < results.length ? results : results[0]);
|
||||
isComplete_1 = true;
|
||||
if (isAsync_1) {
|
||||
subject.complete();
|
||||
}
|
||||
},
|
||||
]));
|
||||
if (isComplete_1) {
|
||||
subject.complete();
|
||||
}
|
||||
isAsync_1 = true;
|
||||
}
|
||||
return subs;
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.bindCallbackInternals = bindCallbackInternals;
|
||||
//# sourceMappingURL=bindCallbackInternals.js.map
|
||||
@@ -0,0 +1,14 @@
|
||||
import Node from './shared/Node';
|
||||
import Binding from './Binding';
|
||||
import EventHandler from './EventHandler';
|
||||
import Action from './Action';
|
||||
import Component from '../Component';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
export default class Window extends Node {
|
||||
type: 'Window';
|
||||
handlers: EventHandler[];
|
||||
bindings: Binding[];
|
||||
actions: Action[];
|
||||
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import AsyncReader from '../readers/async';
|
||||
import type Settings from '../settings';
|
||||
export default class StreamProvider {
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: AsyncReader;
|
||||
protected readonly _stream: Readable;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): Readable;
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === !!options.loose &&
|
||||
version.includePrerelease === !!options.includePrerelease) {
|
||||
return version
|
||||
} else {
|
||||
version = version.version
|
||||
}
|
||||
} else if (typeof version !== 'string') {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
throw new TypeError(
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
)
|
||||
}
|
||||
|
||||
debug('SemVer', version, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
// this isn't actually relevant for versions, but keep it so that we
|
||||
// don't run into trouble passing this.options around.
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
this.raw = version
|
||||
|
||||
// these are actually numbers
|
||||
this.major = +m[1]
|
||||
this.minor = +m[2]
|
||||
this.patch = +m[3]
|
||||
|
||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||
throw new TypeError('Invalid major version')
|
||||
}
|
||||
|
||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||
throw new TypeError('Invalid minor version')
|
||||
}
|
||||
|
||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||
throw new TypeError('Invalid patch version')
|
||||
}
|
||||
|
||||
// numberify any prerelease numeric ids
|
||||
if (!m[4]) {
|
||||
this.prerelease = []
|
||||
} else {
|
||||
this.prerelease = m[4].split('.').map((id) => {
|
||||
if (/^[0-9]+$/.test(id)) {
|
||||
const num = +id
|
||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||
return num
|
||||
}
|
||||
}
|
||||
return id
|
||||
})
|
||||
}
|
||||
|
||||
this.build = m[5] ? m[5].split('.') : []
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||
if (this.prerelease.length) {
|
||||
this.version += `-${this.prerelease.join('.')}`
|
||||
}
|
||||
return this.version
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.version
|
||||
}
|
||||
|
||||
compare (other) {
|
||||
debug('SemVer.compare', this.version, this.options, other)
|
||||
if (!(other instanceof SemVer)) {
|
||||
if (typeof other === 'string' && other === this.version) {
|
||||
return 0
|
||||
}
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (other.version === this.version) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other)
|
||||
}
|
||||
|
||||
compareMain (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
return (
|
||||
compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
compareIdentifiers(this.patch, other.patch)
|
||||
)
|
||||
}
|
||||
|
||||
comparePre (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length) {
|
||||
return -1
|
||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||
return 1
|
||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.prerelease[i]
|
||||
const b = other.prerelease[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
compareBuild (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.build[i]
|
||||
const b = other.build[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
inc (release, identifier) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor = 0
|
||||
this.major++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'preminor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0
|
||||
this.inc('patch', identifier)
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.inc('patch', identifier)
|
||||
}
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
|
||||
case 'major':
|
||||
// If this is a pre-major version, bump up to the same major version.
|
||||
// Otherwise increment major.
|
||||
// 1.0.0-5 bumps to 1.0.0
|
||||
// 1.1.0 bumps to 2.0.0
|
||||
if (
|
||||
this.minor !== 0 ||
|
||||
this.patch !== 0 ||
|
||||
this.prerelease.length === 0
|
||||
) {
|
||||
this.major++
|
||||
}
|
||||
this.minor = 0
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'minor':
|
||||
// If this is a pre-minor version, bump up to the same minor version.
|
||||
// Otherwise increment minor.
|
||||
// 1.2.0-5 bumps to 1.2.0
|
||||
// 1.2.1 bumps to 1.3.0
|
||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||
this.minor++
|
||||
}
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'patch':
|
||||
// If this is not a pre-release version, it will increment the patch.
|
||||
// If it is a pre-release it will bump up to the same patch version.
|
||||
// 1.2.0-5 patches to 1.2.0
|
||||
// 1.2.0 patches to 1.2.1
|
||||
if (this.prerelease.length === 0) {
|
||||
this.patch++
|
||||
}
|
||||
this.prerelease = []
|
||||
break
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.prerelease = [0]
|
||||
} else {
|
||||
let i = this.prerelease.length
|
||||
while (--i >= 0) {
|
||||
if (typeof this.prerelease[i] === 'number') {
|
||||
this.prerelease[i]++
|
||||
i = -2
|
||||
}
|
||||
}
|
||||
if (i === -1) {
|
||||
// didn't increment anything
|
||||
this.prerelease.push(0)
|
||||
}
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
if (this.prerelease[0] === identifier) {
|
||||
if (isNaN(this.prerelease[1])) {
|
||||
this.prerelease = [identifier, 0]
|
||||
}
|
||||
} else {
|
||||
this.prerelease = [identifier, 0]
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
throw new Error(`invalid increment argument: ${release}`)
|
||||
}
|
||||
this.format()
|
||||
this.raw = this.version
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SemVer
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Scope } from 'periscopic';
|
||||
import { Node } from 'estree';
|
||||
import Renderer from './Renderer';
|
||||
export declare function invalidate(renderer: Renderer, scope: Scope, node: Node, names: Set<string>, main_execution_context?: boolean): any;
|
||||
export declare function renderer_invalidate(renderer: Renderer, name: string, value?: unknown, main_execution_context?: boolean): unknown;
|
||||
@@ -0,0 +1,86 @@
|
||||
import { SHA2 } from './_sha2.js';
|
||||
import { wrapConstructor } from './utils.js';
|
||||
|
||||
// SHA1 was cryptographically broken.
|
||||
// It is still widely used in legacy apps. Don't use it for a new protocol.
|
||||
|
||||
// RFC 3174
|
||||
const rotl = (word: number, shift: number) => (word << shift) | ((word >>> (32 - shift)) >>> 0);
|
||||
// Choice: a ? b : c
|
||||
const Chi = (a: number, b: number, c: number) => (a & b) ^ (~a & c);
|
||||
// Majority function, true if any two inpust is true
|
||||
const Maj = (a: number, b: number, c: number) => (a & b) ^ (a & c) ^ (b & c);
|
||||
|
||||
// Initial state
|
||||
const IV = new Uint32Array([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]);
|
||||
|
||||
// Temporary buffer, not used to store anything between runs
|
||||
// Named this way because it matches specification.
|
||||
const SHA1_W = new Uint32Array(80);
|
||||
class SHA1 extends SHA2<SHA1> {
|
||||
private A = IV[0] | 0;
|
||||
private B = IV[1] | 0;
|
||||
private C = IV[2] | 0;
|
||||
private D = IV[3] | 0;
|
||||
private E = IV[4] | 0;
|
||||
|
||||
constructor() {
|
||||
super(64, 20, 8, false);
|
||||
}
|
||||
protected get(): [number, number, number, number, number] {
|
||||
const { A, B, C, D, E } = this;
|
||||
return [A, B, C, D, E];
|
||||
}
|
||||
protected set(A: number, B: number, C: number, D: number, E: number) {
|
||||
this.A = A | 0;
|
||||
this.B = B | 0;
|
||||
this.C = C | 0;
|
||||
this.D = D | 0;
|
||||
this.E = E | 0;
|
||||
}
|
||||
protected process(view: DataView, offset: number): void {
|
||||
for (let i = 0; i < 16; i++, offset += 4) SHA1_W[i] = view.getUint32(offset, false);
|
||||
for (let i = 16; i < 80; i++)
|
||||
SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
|
||||
// Compression function main loop, 80 rounds
|
||||
let { A, B, C, D, E } = this;
|
||||
for (let i = 0; i < 80; i++) {
|
||||
let F, K;
|
||||
if (i < 20) {
|
||||
F = Chi(B, C, D);
|
||||
K = 0x5a827999;
|
||||
} else if (i < 40) {
|
||||
F = B ^ C ^ D;
|
||||
K = 0x6ed9eba1;
|
||||
} else if (i < 60) {
|
||||
F = Maj(B, C, D);
|
||||
K = 0x8f1bbcdc;
|
||||
} else {
|
||||
F = B ^ C ^ D;
|
||||
K = 0xca62c1d6;
|
||||
}
|
||||
const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;
|
||||
E = D;
|
||||
D = C;
|
||||
C = rotl(B, 30);
|
||||
B = A;
|
||||
A = T;
|
||||
}
|
||||
// Add the compressed chunk to the current hash value
|
||||
A = (A + this.A) | 0;
|
||||
B = (B + this.B) | 0;
|
||||
C = (C + this.C) | 0;
|
||||
D = (D + this.D) | 0;
|
||||
E = (E + this.E) | 0;
|
||||
this.set(A, B, C, D, E);
|
||||
}
|
||||
protected roundClean() {
|
||||
SHA1_W.fill(0);
|
||||
}
|
||||
destroy() {
|
||||
this.set(0, 0, 0, 0, 0);
|
||||
this.buffer.fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
export const sha1 = wrapConstructor(() => new SHA1());
|
||||
@@ -0,0 +1,15 @@
|
||||
# Prototype
|
||||
|
||||
Some constructor's `prototype` property
|
||||
|
||||
## `prototype/is`
|
||||
|
||||
Confirms if given object serves as a _prototype_ property
|
||||
|
||||
```javascript
|
||||
const isPrototype = require("type/prototype/is");
|
||||
|
||||
isPrototype({}); // false
|
||||
isPrototype(Object.prototype); // true
|
||||
isPrototype(Array.prototype); // true
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"run-parallel","version":"1.2.0","files":{"LICENSE":{"checkedAt":1678883670844,"integrity":"sha512-UOL/xGxwuTxsayJ0nO2SgwXC182o0nLZBOeagglDRd22rd1cJjlutgtlpdE8Sd463UDlKjR2VFYYD1GyHr7Xog==","mode":420,"size":1081},"package.json":{"checkedAt":1678883670844,"integrity":"sha512-56xaki+SFvCUavZLKew7/IjfFWai1nDck5f1hTxdV88+OxW6RGnUxFddWb+TIh1UuiOi2FIe4CGPSzfmzyVWSA==","mode":420,"size":1291},"index.js":{"checkedAt":1678883670844,"integrity":"sha512-/wZPeJkGsdswZL09gi/HENtDpRyPXN1IkSV9ZmEFaj4BKLHCai3/nL5Lyw+yVP7b0kKBja8A+4e5biijegnFaQ==","mode":420,"size":1034},"README.md":{"checkedAt":1678883670844,"integrity":"sha512-JbMQ5fPgwlVHkMEne4CXv/Q5c3vDm7Jf7ISdGVtqEI8d+5WUOE8c4GtmqYAbjLqVnJQl9JPUgb2ELi4YPEs6yg==","mode":420,"size":3157}}}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { Octokit } from "@octokit/core";
|
||||
import { MapFunction, PaginationResults, RequestParameters, Route, RequestInterface } from "./types";
|
||||
export declare function paginate(octokit: Octokit, route: Route | RequestInterface, parameters?: RequestParameters, mapFn?: MapFunction): Promise<PaginationResults<unknown>>;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
|
||||
|
||||
declare function ensureMap<K, V>(value: any, options?: EnsureBaseOptions): Map<K, V>;
|
||||
declare function ensureMap<K, V>(value: any, options?: EnsureBaseOptions & EnsureIsOptional): Map<K, V> | null;
|
||||
declare function ensureMap<K, V>(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<Map<K, V>>): Map<K, V>;
|
||||
|
||||
export default ensureMap;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-getoptionsobject
|
||||
* @param options
|
||||
* @returns
|
||||
*/
|
||||
export declare function GetOptionsObject<T extends object>(options?: T): T;
|
||||
//# sourceMappingURL=GetOptionsObject.d.ts.map
|
||||
@@ -0,0 +1,42 @@
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
/**
|
||||
* Waits for the source to complete, then emits the last N values from the source,
|
||||
* as specified by the `count` argument.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `takeLast` results in an observable that will hold values up to `count` values in memory,
|
||||
* until the source completes. It then pushes all values in memory to the consumer, in the
|
||||
* order they were received from the source, then notifies the consumer that it is
|
||||
* complete.
|
||||
*
|
||||
* If for some reason the source completes before the `count` supplied to `takeLast` is reached,
|
||||
* all values received until that point are emitted, and then completion is notified.
|
||||
*
|
||||
* **Warning**: Using `takeLast` with an observable that never completes will result
|
||||
* in an observable that never emits a value.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Take the last 3 values of an Observable with many values
|
||||
*
|
||||
* ```ts
|
||||
* import { range, takeLast } from 'rxjs';
|
||||
*
|
||||
* const many = range(1, 100);
|
||||
* const lastThree = many.pipe(takeLast(3));
|
||||
* lastThree.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link take}
|
||||
* @see {@link takeUntil}
|
||||
* @see {@link takeWhile}
|
||||
* @see {@link skip}
|
||||
*
|
||||
* @param count The maximum number of values to emit from the end of
|
||||
* the sequence of values emitted by the source Observable.
|
||||
* @return A function that returns an Observable that emits at most the last
|
||||
* `count` values emitted by the source Observable.
|
||||
*/
|
||||
export declare function takeLast<T>(count: number): MonoTypeOperatorFunction<T>;
|
||||
//# sourceMappingURL=takeLast.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"arrRemove.js","sourceRoot":"","sources":["../../../../src/internal/util/arrRemove.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,SAAS,CAAI,GAA2B,EAAE,IAAO;IAC/D,IAAI,GAAG,EAAE;QACP,IAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACpC;AACH,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"marked","version":"2.0.3","files":{"bin/marked":{"checkedAt":1678883668043,"integrity":"sha512-OuP6HQsu3JMWPu0UuuJq4kKDeAe3mxCJxpCSVdkpYLINWo1/GosfR/MUVWkplyiPNymSILp6BLJ+ZWRUqRv2Kg==","mode":493,"size":4260},"man/marked.1":{"checkedAt":1678883668048,"integrity":"sha512-x1mjBXfqC3dPjOm16j2xtHuQL/66cgtjLCRG2hTOzKEOAWQjtkqpl6CtD6KkXnqbqKjNdqEzsEX3qyIeN4I3Sw==","mode":420,"size":2274},"src/defaults.js":{"checkedAt":1678883668048,"integrity":"sha512-sprE9clIAtc/GyDE7e9PyvZvM0WRLpfPfJ9clUtxhCkg1sksYEXJisT5K78jZSsPO5OdpQBmlxvcfMDluIDtaA==","mode":420,"size":581},"src/helpers.js":{"checkedAt":1678883668059,"integrity":"sha512-8JNkAoXdsDfYXyuH9aO3B3/+In0W+28uLmhWt6Nscc6riTEZHOKjA1YnCVZfJuaCWrYjugQe1VlhHadjPkc/Kw==","mode":420,"size":6165},"src/Lexer.js":{"checkedAt":1678883668054,"integrity":"sha512-w6pmbkHAFNM3GNizIzq92t6ADJoj2kDjWRpQ2EobI5gRHHWsoiSLfhH+005zrNrFnl+SFlKt2NEtrCPqbbnMEw==","mode":420,"size":12657},"lib/marked.esm.js":{"checkedAt":1678883668063,"integrity":"sha512-1iZA8aArBRGhlkYMlSgntPL54raMG2wvAsmfn7EeyP9Du1iFmHdBBYStnUgHIbbqXM9l6khaDGO8RDn3mjza1A==","mode":420,"size":68967},"lib/marked.js":{"checkedAt":1678883668092,"integrity":"sha512-8RGLzK/eq+SeKjoMXVJOSw109HhjB0DreXCozKDCySc4K9f8PyhDSGuFwyGiifxDHvvuBomkHRJW8CB50islsw==","mode":420,"size":87878},"src/marked.js":{"checkedAt":1678883668080,"integrity":"sha512-4dF4vx3YRHiv0sS47JgBE0DLF/Oi27I9fEnviKToNxM/PLeXBf27t+yzuNQYq/HcCXg7IByvYi4QIeWmUhtsbg==","mode":420,"size":6029},"src/Parser.js":{"checkedAt":1678883668114,"integrity":"sha512-0fV1oXaB8l5kCEtgeBoe2kTC+TzgK1a/zwOAOLeTV1UXP5bjpNS2kfs6Xkf//nXhi45qg85ZkWMJzoZGAmXdBA==","mode":420,"size":7000},"marked.min.js":{"checkedAt":1678883668114,"integrity":"sha512-hPgl/fVqpbmz29WvZddGCcPDS8rUd4GT2DfRGIQ3+7rGYFQN8BYp3Bl39Ogx93MRYIVN+uYX4IgxDP45o9ecTQ==","mode":420,"size":44194},"src/Slugger.js":{"checkedAt":1678883668120,"integrity":"sha512-8aMIi4pzyMnukENF4GiMYywf0zGtTB4Z2JxEuDTh231FLX8cgmc8V2R1HkE/RRuFcOPjZwCOnqdEh6fkNnRCaA==","mode":420,"size":1263},"src/Renderer.js":{"checkedAt":1678883668120,"integrity":"sha512-Y6TTXDgGQbpsXIl/uDa5JQxK+JRnBAaoQwArrnfE4IvdbPYr8XYWvPExlJyAVUqwEqLXOVjYR4WW0CqU9lxYSA==","mode":420,"size":3458},"src/rules.js":{"checkedAt":1678883668120,"integrity":"sha512-0WAjKCeEJ66JF/v5PtvPG65C+xJw520zdGJpe77nb9328f5xCLqOMVYl/Bba6rlvLFaNszps1WDNweKq6JOeRw==","mode":420,"size":11916},"src/TextRenderer.js":{"checkedAt":1678883668127,"integrity":"sha512-bxS2kh82D5SjKxBRpwyZFPWwl2f2ZKTFRt4zPdaXzzzX+iiqtA9fnq+SnmquwNycGz3CSbFALO2aOqpSF3eqAg==","mode":420,"size":514},"src/Tokenizer.js":{"checkedAt":1678883668132,"integrity":"sha512-blW5usC80BhK+jeeyNdsgBRU/dyxLMA2S30+M1gxBIdIZo2L9o9BfxsMvawazQ5ouIxZM7hQSlapjWCYdDPlCg==","mode":420,"size":19024},"package.json":{"checkedAt":1678883668132,"integrity":"sha512-MJlFC5f33R//Idu9/n+I/B6v0aBSFGRalDkuUmKXKGtQSlm69iiffFmlzzVWmC3/Sdu1H3ZFZZC+xCMFXfZYQw==","mode":420,"size":2714},"README.md":{"checkedAt":1678883668138,"integrity":"sha512-wPMLjmgaS23XBmvzvJOazky5Nml3yFW/+Vj1OiAy1EaUdp3/PVWExB2c+QpDXg4OffZ56/Tm0WtWVslP9X1cZw==","mode":420,"size":2438},"man/marked.1.txt":{"checkedAt":1678883668138,"integrity":"sha512-OJDrJBB+u/bOsBptLWcwJqmyLNbVA6oukip2FBLie1cyyfGnvQIU/2A8op2qDgni6qXvfaHBEShctE29D2i1gQ==","mode":420,"size":2478},"LICENSE.md":{"checkedAt":1678883668143,"integrity":"sha512-Pmh8fLubxyn5WUD4IOzq7jucNkqg8aRGKQMG00wOlfg9bl30R0FOu7HZvpVUiwRzdxB/hiOV8hpM0Jx9588KXw==","mode":420,"size":2942}}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","33":"DC tB I v J D E F A B C K L G M N O w g x y z EC FC"},D:{"1":"DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","33":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB"},E:{"1":"F A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","33":"I v J D E HC zB IC JC KC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e TC rB","2":"F B PC QC RC SC qB AC","33":"G M N O w g x y z"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"33":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"2":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:2,C:"CSS3 Cursors: zoom-in & zoom-out"};
|
||||
@@ -0,0 +1,21 @@
|
||||
function ruleSorter(s1, s2) {
|
||||
return s1[1] > s2[1] ? 1 : -1;
|
||||
}
|
||||
|
||||
function tidyRuleDuplicates(rules) {
|
||||
var list = [];
|
||||
var repeated = [];
|
||||
|
||||
for (var i = 0, l = rules.length; i < l; i++) {
|
||||
var rule = rules[i];
|
||||
|
||||
if (repeated.indexOf(rule[1]) == -1) {
|
||||
repeated.push(rule[1]);
|
||||
list.push(rule);
|
||||
}
|
||||
}
|
||||
|
||||
return list.sort(ruleSorter);
|
||||
}
|
||||
|
||||
module.exports = tidyRuleDuplicates;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('value', require('../value'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,345 @@
|
||||
import net from 'net';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import { Duplex } from 'stream';
|
||||
import { EventEmitter } from 'events';
|
||||
import createDebug from 'debug';
|
||||
import promisify from './promisify';
|
||||
|
||||
const debug = createDebug('agent-base');
|
||||
|
||||
function isAgent(v: any): v is createAgent.AgentLike {
|
||||
return Boolean(v) && typeof v.addRequest === 'function';
|
||||
}
|
||||
|
||||
function isSecureEndpoint(): boolean {
|
||||
const { stack } = new Error();
|
||||
if (typeof stack !== 'string') return false;
|
||||
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
|
||||
}
|
||||
|
||||
function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
|
||||
function createAgent(
|
||||
callback: createAgent.AgentCallback,
|
||||
opts?: createAgent.AgentOptions
|
||||
): createAgent.Agent;
|
||||
function createAgent(
|
||||
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
|
||||
opts?: createAgent.AgentOptions
|
||||
) {
|
||||
return new createAgent.Agent(callback, opts);
|
||||
}
|
||||
|
||||
namespace createAgent {
|
||||
export interface ClientRequest extends http.ClientRequest {
|
||||
_last?: boolean;
|
||||
_hadError?: boolean;
|
||||
method: string;
|
||||
}
|
||||
|
||||
export interface AgentRequestOptions {
|
||||
host?: string;
|
||||
path?: string;
|
||||
// `port` on `http.RequestOptions` can be a string or undefined,
|
||||
// but `net.TcpNetConnectOpts` expects only a number
|
||||
port: number;
|
||||
}
|
||||
|
||||
export interface HttpRequestOptions
|
||||
extends AgentRequestOptions,
|
||||
Omit<http.RequestOptions, keyof AgentRequestOptions> {
|
||||
secureEndpoint: false;
|
||||
}
|
||||
|
||||
export interface HttpsRequestOptions
|
||||
extends AgentRequestOptions,
|
||||
Omit<https.RequestOptions, keyof AgentRequestOptions> {
|
||||
secureEndpoint: true;
|
||||
}
|
||||
|
||||
export type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
|
||||
|
||||
export type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
|
||||
|
||||
export type AgentCallbackReturn = Duplex | AgentLike;
|
||||
|
||||
export type AgentCallbackCallback = (
|
||||
err?: Error | null,
|
||||
socket?: createAgent.AgentCallbackReturn
|
||||
) => void;
|
||||
|
||||
export type AgentCallbackPromise = (
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.RequestOptions
|
||||
) =>
|
||||
| createAgent.AgentCallbackReturn
|
||||
| Promise<createAgent.AgentCallbackReturn>;
|
||||
|
||||
export type AgentCallback = typeof Agent.prototype.callback;
|
||||
|
||||
export type AgentOptions = {
|
||||
timeout?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Base `http.Agent` implementation.
|
||||
* No pooling/keep-alive is implemented by default.
|
||||
*
|
||||
* @param {Function} callback
|
||||
* @api public
|
||||
*/
|
||||
export class Agent extends EventEmitter {
|
||||
public timeout: number | null;
|
||||
public maxFreeSockets: number;
|
||||
public maxTotalSockets: number;
|
||||
public maxSockets: number;
|
||||
public sockets: {
|
||||
[key: string]: net.Socket[];
|
||||
};
|
||||
public freeSockets: {
|
||||
[key: string]: net.Socket[];
|
||||
};
|
||||
public requests: {
|
||||
[key: string]: http.IncomingMessage[];
|
||||
};
|
||||
public options: https.AgentOptions;
|
||||
private promisifiedCallback?: createAgent.AgentCallbackPromise;
|
||||
private explicitDefaultPort?: number;
|
||||
private explicitProtocol?: string;
|
||||
|
||||
constructor(
|
||||
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
|
||||
_opts?: createAgent.AgentOptions
|
||||
) {
|
||||
super();
|
||||
|
||||
let opts = _opts;
|
||||
if (typeof callback === 'function') {
|
||||
this.callback = callback;
|
||||
} else if (callback) {
|
||||
opts = callback;
|
||||
}
|
||||
|
||||
// Timeout for the socket to be returned from the callback
|
||||
this.timeout = null;
|
||||
if (opts && typeof opts.timeout === 'number') {
|
||||
this.timeout = opts.timeout;
|
||||
}
|
||||
|
||||
// These aren't actually used by `agent-base`, but are required
|
||||
// for the TypeScript definition files in `@types/node` :/
|
||||
this.maxFreeSockets = 1;
|
||||
this.maxSockets = 1;
|
||||
this.maxTotalSockets = Infinity;
|
||||
this.sockets = {};
|
||||
this.freeSockets = {};
|
||||
this.requests = {};
|
||||
this.options = {};
|
||||
}
|
||||
|
||||
get defaultPort(): number {
|
||||
if (typeof this.explicitDefaultPort === 'number') {
|
||||
return this.explicitDefaultPort;
|
||||
}
|
||||
return isSecureEndpoint() ? 443 : 80;
|
||||
}
|
||||
|
||||
set defaultPort(v: number) {
|
||||
this.explicitDefaultPort = v;
|
||||
}
|
||||
|
||||
get protocol(): string {
|
||||
if (typeof this.explicitProtocol === 'string') {
|
||||
return this.explicitProtocol;
|
||||
}
|
||||
return isSecureEndpoint() ? 'https:' : 'http:';
|
||||
}
|
||||
|
||||
set protocol(v: string) {
|
||||
this.explicitProtocol = v;
|
||||
}
|
||||
|
||||
callback(
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.RequestOptions,
|
||||
fn: createAgent.AgentCallbackCallback
|
||||
): void;
|
||||
callback(
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.RequestOptions
|
||||
):
|
||||
| createAgent.AgentCallbackReturn
|
||||
| Promise<createAgent.AgentCallbackReturn>;
|
||||
callback(
|
||||
req: createAgent.ClientRequest,
|
||||
opts: createAgent.AgentOptions,
|
||||
fn?: createAgent.AgentCallbackCallback
|
||||
):
|
||||
| createAgent.AgentCallbackReturn
|
||||
| Promise<createAgent.AgentCallbackReturn>
|
||||
| void {
|
||||
throw new Error(
|
||||
'"agent-base" has no default implementation, you must subclass and override `callback()`'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by node-core's "_http_client.js" module when creating
|
||||
* a new HTTP request with this Agent instance.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
addRequest(req: ClientRequest, _opts: RequestOptions): void {
|
||||
const opts: RequestOptions = { ..._opts };
|
||||
|
||||
if (typeof opts.secureEndpoint !== 'boolean') {
|
||||
opts.secureEndpoint = isSecureEndpoint();
|
||||
}
|
||||
|
||||
if (opts.host == null) {
|
||||
opts.host = 'localhost';
|
||||
}
|
||||
|
||||
if (opts.port == null) {
|
||||
opts.port = opts.secureEndpoint ? 443 : 80;
|
||||
}
|
||||
|
||||
if (opts.protocol == null) {
|
||||
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
|
||||
}
|
||||
|
||||
if (opts.host && opts.path) {
|
||||
// If both a `host` and `path` are specified then it's most
|
||||
// likely the result of a `url.parse()` call... we need to
|
||||
// remove the `path` portion so that `net.connect()` doesn't
|
||||
// attempt to open that as a unix socket file.
|
||||
delete opts.path;
|
||||
}
|
||||
|
||||
delete opts.agent;
|
||||
delete opts.hostname;
|
||||
delete opts._defaultAgent;
|
||||
delete opts.defaultPort;
|
||||
delete opts.createConnection;
|
||||
|
||||
// Hint to use "Connection: close"
|
||||
// XXX: non-documented `http` module API :(
|
||||
req._last = true;
|
||||
req.shouldKeepAlive = false;
|
||||
|
||||
let timedOut = false;
|
||||
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
||||
const timeoutMs = opts.timeout || this.timeout;
|
||||
|
||||
const onerror = (err: NodeJS.ErrnoException) => {
|
||||
if (req._hadError) return;
|
||||
req.emit('error', err);
|
||||
// For Safety. Some additional errors might fire later on
|
||||
// and we need to make sure we don't double-fire the error event.
|
||||
req._hadError = true;
|
||||
};
|
||||
|
||||
const ontimeout = () => {
|
||||
timeoutId = null;
|
||||
timedOut = true;
|
||||
const err: NodeJS.ErrnoException = new Error(
|
||||
`A "socket" was not created for HTTP request before ${timeoutMs}ms`
|
||||
);
|
||||
err.code = 'ETIMEOUT';
|
||||
onerror(err);
|
||||
};
|
||||
|
||||
const callbackError = (err: NodeJS.ErrnoException) => {
|
||||
if (timedOut) return;
|
||||
if (timeoutId !== null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
onerror(err);
|
||||
};
|
||||
|
||||
const onsocket = (socket: AgentCallbackReturn) => {
|
||||
if (timedOut) return;
|
||||
if (timeoutId != null) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
|
||||
if (isAgent(socket)) {
|
||||
// `socket` is actually an `http.Agent` instance, so
|
||||
// relinquish responsibility for this `req` to the Agent
|
||||
// from here on
|
||||
debug(
|
||||
'Callback returned another Agent instance %o',
|
||||
socket.constructor.name
|
||||
);
|
||||
(socket as createAgent.Agent).addRequest(req, opts);
|
||||
return;
|
||||
}
|
||||
|
||||
if (socket) {
|
||||
socket.once('free', () => {
|
||||
this.freeSocket(socket as net.Socket, opts);
|
||||
});
|
||||
req.onSocket(socket as net.Socket);
|
||||
return;
|
||||
}
|
||||
|
||||
const err = new Error(
|
||||
`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``
|
||||
);
|
||||
onerror(err);
|
||||
};
|
||||
|
||||
if (typeof this.callback !== 'function') {
|
||||
onerror(new Error('`callback` is not defined'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.promisifiedCallback) {
|
||||
if (this.callback.length >= 3) {
|
||||
debug('Converting legacy callback function to promise');
|
||||
this.promisifiedCallback = promisify(this.callback);
|
||||
} else {
|
||||
this.promisifiedCallback = this.callback;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
|
||||
timeoutId = setTimeout(ontimeout, timeoutMs);
|
||||
}
|
||||
|
||||
if ('port' in opts && typeof opts.port !== 'number') {
|
||||
opts.port = Number(opts.port);
|
||||
}
|
||||
|
||||
try {
|
||||
debug(
|
||||
'Resolving socket for %o request: %o',
|
||||
opts.protocol,
|
||||
`${req.method} ${req.path}`
|
||||
);
|
||||
Promise.resolve(this.promisifiedCallback(req, opts)).then(
|
||||
onsocket,
|
||||
callbackError
|
||||
);
|
||||
} catch (err) {
|
||||
Promise.reject(err).catch(callbackError);
|
||||
}
|
||||
}
|
||||
|
||||
freeSocket(socket: net.Socket, opts: AgentOptions) {
|
||||
debug('Freeing socket %o %o', socket.constructor.name, opts);
|
||||
socket.destroy();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
debug('Destroying agent %o', this.constructor.name);
|
||||
}
|
||||
}
|
||||
|
||||
// So that `instanceof` works correctly
|
||||
createAgent.prototype = createAgent.Agent.prototype;
|
||||
}
|
||||
|
||||
export = createAgent;
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "mime-types",
|
||||
"description": "The ultimate javascript content-type utility.",
|
||||
"version": "2.1.35",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"mime",
|
||||
"types"
|
||||
],
|
||||
"repository": "jshttp/mime-types",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "5.2.0",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.2",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec test/test.js",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB EC FC"},D:{"1":"HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB"},E:{"1":"F A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E HC zB IC JC KC"},F:{"1":"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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 F B C G M N O w g x y z PC QC RC SC qB AC TC rB"},G:{"1":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:6,C:"String.prototype.includes"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0.00535,"3":0.00535,"4":0,"5":0.00535,"6":0.00535,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0.00535,"16":0.00535,"17":0,"18":0,"19":0,"20":0.01606,"21":0.00535,"22":0.00535,"23":0.00535,"24":0.00535,"25":0,"26":0,"27":0.00535,"28":0,"29":0.00535,"30":0,"31":0.01071,"32":0.00535,"33":0,"34":0.00535,"35":0.00535,"36":0,"37":0.01071,"38":0.00535,"39":0.01071,"40":0.02141,"41":0.01071,"42":0.00535,"43":0.01071,"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,"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,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01606,"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,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0.00535,"102":0.01071,"103":0.02677,"104":0.00535,"105":0.01606,"106":0.02141,"107":0,"108":0.01071,"109":0.62095,"110":0.27836,"111":0.01071,"112":0,"3.5":0.00535,"3.6":0.03212},D:{"4":0,"5":0,"6":0.00535,"7":0.00535,"8":0.00535,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0.00535,"18":0.00535,"19":0.00535,"20":0,"21":0.00535,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00535,"29":0.00535,"30":0,"31":0.00535,"32":0,"33":0.01606,"34":0,"35":0,"36":0.00535,"37":0.01606,"38":0.02141,"39":0.01071,"40":0.02677,"41":0.01606,"42":0,"43":0.04818,"44":0.05353,"45":0.06424,"46":0.02677,"47":0.03212,"48":0,"49":0,"50":0,"51":0.00535,"52":0,"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,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00535,"79":0.01071,"80":0.00535,"81":0.08565,"83":0,"84":0,"85":0,"86":0,"87":0.02141,"88":0.03212,"89":0.01071,"90":0,"91":0,"92":0,"93":0.01071,"94":0,"95":0,"96":0.00535,"97":0,"98":0.00535,"99":0.01071,"100":0.00535,"101":0.00535,"102":0.02677,"103":0.09635,"104":0.03212,"105":1.41319,"106":0.01606,"107":0.24089,"108":0.42289,"109":6.02748,"110":3.97193,"111":0.01071,"112":0,"113":0},F:{"9":0,"11":0,"12":0.00535,"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.00535,"30":0.01606,"31":0.01606,"32":0.01071,"33":0.00535,"34":0,"35":0,"36":0.00535,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.04818,"44":0,"45":0,"46":0.00535,"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.04818,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00535,"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.01071,"94":0.72801,"95":3.22251,"9.5-9.6":0,"10.0-10.1":0.00535,"10.5":0,"10.6":0,"11.1":0,"11.5":0.01071,"11.6":0,"12.1":0.00535},B:{"12":0.01071,"13":0,"14":0,"15":0,"16":0,"17":0.01071,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0.00535,"97":0.00535,"98":0,"99":0.00535,"100":0,"101":0.02141,"102":0,"103":0,"104":0,"105":0.0803,"106":0.02141,"107":0.03212,"108":0.06424,"109":1.46137,"110":1.89496},E:{"4":0,"5":0,"6":0,"7":0.01606,"8":0.01071,"9":0.01071,"10":0,"11":0,"12":0,"13":0,"14":0.36936,"15":0,_:"0","3.1":0.00535,"3.2":0,"5.1":0.01071,"6.1":0,"7.1":0.00535,"9.1":0.00535,"10.1":0,"11.1":0.00535,"12.1":0.01071,"13.1":0.10706,"14.1":0.22483,"15.1":0.01606,"15.2-15.3":0.02677,"15.4":0.03747,"15.5":0.16059,"15.6":1.33825,"16.0":0.07494,"16.1":0.23553,"16.2":0.48712,"16.3":1.65943,"16.4":0.00535},G:{"8":0,"3.2":0,"4.0-4.1":0.01301,"4.2-4.3":0.01301,"5.0-5.1":0.03251,"6.0-6.1":0.02926,"7.0-7.1":0.11055,"8.1-8.4":0.19508,"9.0-9.2":0.03251,"9.3":0,"10.0-10.2":0,"10.3":0.04227,"11.0-11.2":0.05527,"11.3-11.4":0.0065,"12.0-12.1":0.02601,"12.2-12.5":0.29912,"13.0-13.1":0,"13.2":0,"13.3":0.01626,"13.4-13.7":0.0065,"14.0-14.4":0.14306,"14.5-14.8":0.41292,"15.0-15.1":0.05852,"15.2-15.3":0.28287,"15.4":0.14631,"15.5":0.2536,"15.6":1.83376,"16.0":6.46692,"16.1":6.46692,"16.2":9.20131,"16.3":4.81524,"16.4":0.03251},P:{"4":0.21616,"20":1.53369,"5.0-5.4":0,"6.2-6.4":0.01029,"7.2-7.4":0.01029,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0,"14.0":0,"15.0":0,"16.0":0.01029,"17.0":0.02059,"18.0":0.01029,"19.0":2.16158},I:{"0":0,"3":0.00662,"4":0.04967,"2.1":0.03145,"2.2":0.03477,"2.3":0.05132,"4.1":0.13906,"4.2-4.3":0.10926,"4.4":0,"4.4.3-4.4.4":0.40726},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0.01651,"7":0.02752,"8":0.36332,"9":0.06606,"10":0.06606,"11":0.22019,"5.5":0},N:{"10":0.02788,"11":0.04182},S:{"2.5":0.00465,_:"3.0-3.1"},J:{"7":0,"10":0.02324},O:{"0":0.26023},H:{"0":0.59833},L:{"0":31.87921},R:{_:"0"},M:{"0":0.10688},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,644 @@
|
||||
var InvalidPropertyError = require('./invalid-property-error');
|
||||
|
||||
var wrapSingle = require('../wrap-for-optimizing').single;
|
||||
|
||||
var Token = require('../../tokenizer/token');
|
||||
var Marker = require('../../tokenizer/marker');
|
||||
|
||||
var formatPosition = require('../../utils/format-position');
|
||||
|
||||
function _anyIsInherit(values) {
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
if (values[i][1] == 'inherit') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _colorFilter(validator) {
|
||||
return function (value) {
|
||||
return value[1] == 'invert' || validator.isColor(value[1]) || validator.isPrefixed(value[1]);
|
||||
};
|
||||
}
|
||||
|
||||
function _styleFilter(validator) {
|
||||
return function (value) {
|
||||
return value[1] != 'inherit' && validator.isStyleKeyword(value[1]) && !validator.isColorFunction(value[1]);
|
||||
};
|
||||
}
|
||||
|
||||
function _wrapDefault(name, property, compactable) {
|
||||
var descriptor = compactable[name];
|
||||
if (descriptor.doubleValues && descriptor.defaultValue.length == 2) {
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, name],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue[0]],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue[1]]
|
||||
]);
|
||||
} else if (descriptor.doubleValues && descriptor.defaultValue.length == 1) {
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, name],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue[0]]
|
||||
]);
|
||||
} else {
|
||||
return wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, name],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function _widthFilter(validator) {
|
||||
return function (value) {
|
||||
return value[1] != 'inherit' &&
|
||||
(validator.isWidth(value[1]) || validator.isUnit(value[1]) && !validator.isDynamicUnit(value[1])) &&
|
||||
!validator.isStyleKeyword(value[1]) &&
|
||||
!validator.isColorFunction(value[1]);
|
||||
};
|
||||
}
|
||||
|
||||
function animation(property, compactable, validator) {
|
||||
var duration = _wrapDefault(property.name + '-duration', property, compactable);
|
||||
var timing = _wrapDefault(property.name + '-timing-function', property, compactable);
|
||||
var delay = _wrapDefault(property.name + '-delay', property, compactable);
|
||||
var iteration = _wrapDefault(property.name + '-iteration-count', property, compactable);
|
||||
var direction = _wrapDefault(property.name + '-direction', property, compactable);
|
||||
var fill = _wrapDefault(property.name + '-fill-mode', property, compactable);
|
||||
var play = _wrapDefault(property.name + '-play-state', property, compactable);
|
||||
var name = _wrapDefault(property.name + '-name', property, compactable);
|
||||
var components = [duration, timing, delay, iteration, direction, fill, play, name];
|
||||
var values = property.value;
|
||||
var value;
|
||||
var durationSet = false;
|
||||
var timingSet = false;
|
||||
var delaySet = false;
|
||||
var iterationSet = false;
|
||||
var directionSet = false;
|
||||
var fillSet = false;
|
||||
var playSet = false;
|
||||
var nameSet = false;
|
||||
var i;
|
||||
var l;
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
duration.value = timing.value = delay.value = iteration.value = direction.value = fill.value = play.value = name.value = property.value;
|
||||
return components;
|
||||
}
|
||||
|
||||
if (values.length > 1 && _anyIsInherit(values)) {
|
||||
throw new InvalidPropertyError('Invalid animation values at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
value = values[i];
|
||||
|
||||
if (validator.isTime(value[1]) && !durationSet) {
|
||||
duration.value = [value];
|
||||
durationSet = true;
|
||||
} else if (validator.isTime(value[1]) && !delaySet) {
|
||||
delay.value = [value];
|
||||
delaySet = true;
|
||||
} else if ((validator.isGlobal(value[1]) || validator.isTimingFunction(value[1])) && !timingSet) {
|
||||
timing.value = [value];
|
||||
timingSet = true;
|
||||
} else if ((validator.isAnimationIterationCountKeyword(value[1]) || validator.isPositiveNumber(value[1])) && !iterationSet) {
|
||||
iteration.value = [value];
|
||||
iterationSet = true;
|
||||
} else if (validator.isAnimationDirectionKeyword(value[1]) && !directionSet) {
|
||||
direction.value = [value];
|
||||
directionSet = true;
|
||||
} else if (validator.isAnimationFillModeKeyword(value[1]) && !fillSet) {
|
||||
fill.value = [value];
|
||||
fillSet = true;
|
||||
} else if (validator.isAnimationPlayStateKeyword(value[1]) && !playSet) {
|
||||
play.value = [value];
|
||||
playSet = true;
|
||||
} else if ((validator.isAnimationNameKeyword(value[1]) || validator.isIdentifier(value[1])) && !nameSet) {
|
||||
name.value = [value];
|
||||
nameSet = true;
|
||||
} else {
|
||||
throw new InvalidPropertyError('Invalid animation value at ' + formatPosition(value[2][0]) + '. Ignoring.');
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function background(property, compactable, validator) {
|
||||
var image = _wrapDefault('background-image', property, compactable);
|
||||
var position = _wrapDefault('background-position', property, compactable);
|
||||
var size = _wrapDefault('background-size', property, compactable);
|
||||
var repeat = _wrapDefault('background-repeat', property, compactable);
|
||||
var attachment = _wrapDefault('background-attachment', property, compactable);
|
||||
var origin = _wrapDefault('background-origin', property, compactable);
|
||||
var clip = _wrapDefault('background-clip', property, compactable);
|
||||
var color = _wrapDefault('background-color', property, compactable);
|
||||
var components = [image, position, size, repeat, attachment, origin, clip, color];
|
||||
var values = property.value;
|
||||
|
||||
var positionSet = false;
|
||||
var clipSet = false;
|
||||
var originSet = false;
|
||||
var repeatSet = false;
|
||||
|
||||
var anyValueSet = false;
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
// NOTE: 'inherit' is not a valid value for background-attachment
|
||||
color.value = image.value = repeat.value = position.value = size.value = origin.value = clip.value = property.value;
|
||||
return components;
|
||||
}
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == '0 0') {
|
||||
return components;
|
||||
}
|
||||
|
||||
for (var i = values.length - 1; i >= 0; i--) {
|
||||
var value = values[i];
|
||||
|
||||
if (validator.isBackgroundAttachmentKeyword(value[1])) {
|
||||
attachment.value = [value];
|
||||
anyValueSet = true;
|
||||
} else if (validator.isBackgroundClipKeyword(value[1]) || validator.isBackgroundOriginKeyword(value[1])) {
|
||||
if (clipSet) {
|
||||
origin.value = [value];
|
||||
originSet = true;
|
||||
} else {
|
||||
clip.value = [value];
|
||||
clipSet = true;
|
||||
}
|
||||
anyValueSet = true;
|
||||
} else if (validator.isBackgroundRepeatKeyword(value[1])) {
|
||||
if (repeatSet) {
|
||||
repeat.value.unshift(value);
|
||||
} else {
|
||||
repeat.value = [value];
|
||||
repeatSet = true;
|
||||
}
|
||||
anyValueSet = true;
|
||||
} else if (validator.isBackgroundPositionKeyword(value[1]) || validator.isBackgroundSizeKeyword(value[1]) || validator.isUnit(value[1]) || validator.isDynamicUnit(value[1])) {
|
||||
if (i > 0) {
|
||||
var previousValue = values[i - 1];
|
||||
|
||||
if (previousValue[1] == Marker.FORWARD_SLASH) {
|
||||
size.value = [value];
|
||||
} else if (i > 1 && values[i - 2][1] == Marker.FORWARD_SLASH) {
|
||||
size.value = [previousValue, value];
|
||||
i -= 2;
|
||||
} else {
|
||||
if (!positionSet)
|
||||
position.value = [];
|
||||
|
||||
position.value.unshift(value);
|
||||
positionSet = true;
|
||||
}
|
||||
} else {
|
||||
if (!positionSet)
|
||||
position.value = [];
|
||||
|
||||
position.value.unshift(value);
|
||||
positionSet = true;
|
||||
}
|
||||
anyValueSet = true;
|
||||
} else if ((color.value[0][1] == compactable[color.name].defaultValue || color.value[0][1] == 'none') && (validator.isColor(value[1]) || validator.isPrefixed(value[1]))) {
|
||||
color.value = [value];
|
||||
anyValueSet = true;
|
||||
} else if (validator.isUrl(value[1]) || validator.isFunction(value[1])) {
|
||||
image.value = [value];
|
||||
anyValueSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (clipSet && !originSet)
|
||||
origin.value = clip.value.slice(0);
|
||||
|
||||
if (!anyValueSet) {
|
||||
throw new InvalidPropertyError('Invalid background value at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function borderRadius(property, compactable) {
|
||||
var values = property.value;
|
||||
var splitAt = -1;
|
||||
|
||||
for (var i = 0, l = values.length; i < l; i++) {
|
||||
if (values[i][1] == Marker.FORWARD_SLASH) {
|
||||
splitAt = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitAt === 0 || splitAt === values.length - 1) {
|
||||
throw new InvalidPropertyError('Invalid border-radius value at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
var target = _wrapDefault(property.name, property, compactable);
|
||||
target.value = splitAt > -1 ?
|
||||
values.slice(0, splitAt) :
|
||||
values.slice(0);
|
||||
target.components = fourValues(target, compactable);
|
||||
|
||||
var remainder = _wrapDefault(property.name, property, compactable);
|
||||
remainder.value = splitAt > -1 ?
|
||||
values.slice(splitAt + 1) :
|
||||
values.slice(0);
|
||||
remainder.components = fourValues(remainder, compactable);
|
||||
|
||||
for (var j = 0; j < 4; j++) {
|
||||
target.components[j].multiplex = true;
|
||||
target.components[j].value = target.components[j].value.concat(remainder.components[j].value);
|
||||
}
|
||||
|
||||
return target.components;
|
||||
}
|
||||
|
||||
function font(property, compactable, validator) {
|
||||
var style = _wrapDefault('font-style', property, compactable);
|
||||
var variant = _wrapDefault('font-variant', property, compactable);
|
||||
var weight = _wrapDefault('font-weight', property, compactable);
|
||||
var stretch = _wrapDefault('font-stretch', property, compactable);
|
||||
var size = _wrapDefault('font-size', property, compactable);
|
||||
var height = _wrapDefault('line-height', property, compactable);
|
||||
var family = _wrapDefault('font-family', property, compactable);
|
||||
var components = [style, variant, weight, stretch, size, height, family];
|
||||
var values = property.value;
|
||||
var fuzzyMatched = 4; // style, variant, weight, and stretch
|
||||
var index = 0;
|
||||
var isStretchSet = false;
|
||||
var isStretchValid;
|
||||
var isStyleSet = false;
|
||||
var isStyleValid;
|
||||
var isVariantSet = false;
|
||||
var isVariantValid;
|
||||
var isWeightSet = false;
|
||||
var isWeightValid;
|
||||
var isSizeSet = false;
|
||||
var appendableFamilyName = false;
|
||||
|
||||
if (!values[index]) {
|
||||
throw new InvalidPropertyError('Missing font values at ' + formatPosition(property.all[property.position][1][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'inherit') {
|
||||
style.value = variant.value = weight.value = stretch.value = size.value = height.value = family.value = values;
|
||||
return components;
|
||||
}
|
||||
|
||||
if (values.length == 1 && (validator.isFontKeyword(values[0][1]) || validator.isGlobal(values[0][1]) || validator.isPrefixed(values[0][1]))) {
|
||||
values[0][1] = Marker.INTERNAL + values[0][1];
|
||||
style.value = variant.value = weight.value = stretch.value = size.value = height.value = family.value = values;
|
||||
return components;
|
||||
}
|
||||
|
||||
if (values.length < 2 || !_anyIsFontSize(values, validator) || !_anyIsFontFamily(values, validator)) {
|
||||
throw new InvalidPropertyError('Invalid font values at ' + formatPosition(property.all[property.position][1][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
if (values.length > 1 && _anyIsInherit(values)) {
|
||||
throw new InvalidPropertyError('Invalid font values at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
// fuzzy match style, variant, weight, and stretch on first elements
|
||||
while (index < fuzzyMatched) {
|
||||
isStretchValid = validator.isFontStretchKeyword(values[index][1]) || validator.isGlobal(values[index][1]);
|
||||
isStyleValid = validator.isFontStyleKeyword(values[index][1]) || validator.isGlobal(values[index][1]);
|
||||
isVariantValid = validator.isFontVariantKeyword(values[index][1]) || validator.isGlobal(values[index][1]);
|
||||
isWeightValid = validator.isFontWeightKeyword(values[index][1]) || validator.isGlobal(values[index][1]);
|
||||
|
||||
if (isStyleValid && !isStyleSet) {
|
||||
style.value = [values[index]];
|
||||
isStyleSet = true;
|
||||
} else if (isVariantValid && !isVariantSet) {
|
||||
variant.value = [values[index]];
|
||||
isVariantSet = true;
|
||||
} else if (isWeightValid && !isWeightSet) {
|
||||
weight.value = [values[index]];
|
||||
isWeightSet = true;
|
||||
} else if (isStretchValid && !isStretchSet) {
|
||||
stretch.value = [values[index]];
|
||||
isStretchSet = true;
|
||||
} else if (isStyleValid && isStyleSet || isVariantValid && isVariantSet || isWeightValid && isWeightSet || isStretchValid && isStretchSet) {
|
||||
throw new InvalidPropertyError('Invalid font style / variant / weight / stretch value at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
// now comes font-size ...
|
||||
if (validator.isFontSizeKeyword(values[index][1]) || validator.isUnit(values[index][1]) && !validator.isDynamicUnit(values[index][1])) {
|
||||
size.value = [values[index]];
|
||||
isSizeSet = true;
|
||||
index++;
|
||||
} else {
|
||||
throw new InvalidPropertyError('Missing font size at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
if (!values[index]) {
|
||||
throw new InvalidPropertyError('Missing font family at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
// ... and perhaps line-height
|
||||
if (isSizeSet && values[index] && values[index][1] == Marker.FORWARD_SLASH && values[index + 1] && (validator.isLineHeightKeyword(values[index + 1][1]) || validator.isUnit(values[index + 1][1]) || validator.isNumber(values[index + 1][1]))) {
|
||||
height.value = [values[index + 1]];
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
|
||||
// ... and whatever comes next is font-family
|
||||
family.value = [];
|
||||
|
||||
while (values[index]) {
|
||||
if (values[index][1] == Marker.COMMA) {
|
||||
appendableFamilyName = false;
|
||||
} else {
|
||||
if (appendableFamilyName) {
|
||||
family.value[family.value.length - 1][1] += Marker.SPACE + values[index][1];
|
||||
} else {
|
||||
family.value.push(values[index]);
|
||||
}
|
||||
|
||||
appendableFamilyName = true;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (family.value.length === 0) {
|
||||
throw new InvalidPropertyError('Missing font family at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function _anyIsFontSize(values, validator) {
|
||||
var value;
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
value = values[i];
|
||||
|
||||
if (validator.isFontSizeKeyword(value[1]) || validator.isUnit(value[1]) && !validator.isDynamicUnit(value[1]) || validator.isFunction(value[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _anyIsFontFamily(values, validator) {
|
||||
var value;
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
value = values[i];
|
||||
|
||||
if (validator.isIdentifier(value[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function fourValues(property, compactable) {
|
||||
var componentNames = compactable[property.name].components;
|
||||
var components = [];
|
||||
var value = property.value;
|
||||
|
||||
if (value.length < 1)
|
||||
return [];
|
||||
|
||||
if (value.length < 2)
|
||||
value[1] = value[0].slice(0);
|
||||
if (value.length < 3)
|
||||
value[2] = value[0].slice(0);
|
||||
if (value.length < 4)
|
||||
value[3] = value[1].slice(0);
|
||||
|
||||
for (var i = componentNames.length - 1; i >= 0; i--) {
|
||||
var component = wrapSingle([
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, componentNames[i]]
|
||||
]);
|
||||
component.value = [value[i]];
|
||||
components.unshift(component);
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function multiplex(splitWith) {
|
||||
return function (property, compactable, validator) {
|
||||
var splitsAt = [];
|
||||
var values = property.value;
|
||||
var i, j, l, m;
|
||||
|
||||
// find split commas
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
if (values[i][1] == ',')
|
||||
splitsAt.push(i);
|
||||
}
|
||||
|
||||
if (splitsAt.length === 0)
|
||||
return splitWith(property, compactable, validator);
|
||||
|
||||
var splitComponents = [];
|
||||
|
||||
// split over commas, and into components
|
||||
for (i = 0, l = splitsAt.length; i <= l; i++) {
|
||||
var from = i === 0 ? 0 : splitsAt[i - 1] + 1;
|
||||
var to = i < l ? splitsAt[i] : values.length;
|
||||
|
||||
var _property = _wrapDefault(property.name, property, compactable);
|
||||
_property.value = values.slice(from, to);
|
||||
|
||||
splitComponents.push(splitWith(_property, compactable, validator));
|
||||
}
|
||||
|
||||
var components = splitComponents[0];
|
||||
|
||||
// group component values from each split
|
||||
for (i = 0, l = components.length; i < l; i++) {
|
||||
components[i].multiplex = true;
|
||||
|
||||
for (j = 1, m = splitComponents.length; j < m; j++) {
|
||||
components[i].value.push([Token.PROPERTY_VALUE, Marker.COMMA]);
|
||||
Array.prototype.push.apply(components[i].value, splitComponents[j][i].value);
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
};
|
||||
}
|
||||
|
||||
function listStyle(property, compactable, validator) {
|
||||
var type = _wrapDefault('list-style-type', property, compactable);
|
||||
var position = _wrapDefault('list-style-position', property, compactable);
|
||||
var image = _wrapDefault('list-style-image', property, compactable);
|
||||
var components = [type, position, image];
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
type.value = position.value = image.value = [property.value[0]];
|
||||
return components;
|
||||
}
|
||||
|
||||
var values = property.value.slice(0);
|
||||
var total = values.length;
|
||||
var index = 0;
|
||||
|
||||
// `image` first...
|
||||
for (index = 0, total = values.length; index < total; index++) {
|
||||
if (validator.isUrl(values[index][1]) || values[index][1] == '0') {
|
||||
image.value = [values[index]];
|
||||
values.splice(index, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ... then `position`
|
||||
for (index = 0, total = values.length; index < total; index++) {
|
||||
if (validator.isListStylePositionKeyword(values[index][1])) {
|
||||
position.value = [values[index]];
|
||||
values.splice(index, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ... and what's left is a `type`
|
||||
if (values.length > 0 && (validator.isListStyleTypeKeyword(values[0][1]) || validator.isIdentifier(values[0][1]))) {
|
||||
type.value = [values[0]];
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function transition(property, compactable, validator) {
|
||||
var prop = _wrapDefault(property.name + '-property', property, compactable);
|
||||
var duration = _wrapDefault(property.name + '-duration', property, compactable);
|
||||
var timing = _wrapDefault(property.name + '-timing-function', property, compactable);
|
||||
var delay = _wrapDefault(property.name + '-delay', property, compactable);
|
||||
var components = [prop, duration, timing, delay];
|
||||
var values = property.value;
|
||||
var value;
|
||||
var durationSet = false;
|
||||
var delaySet = false;
|
||||
var propSet = false;
|
||||
var timingSet = false;
|
||||
var i;
|
||||
var l;
|
||||
|
||||
if (property.value.length == 1 && property.value[0][1] == 'inherit') {
|
||||
prop.value = duration.value = timing.value = delay.value = property.value;
|
||||
return components;
|
||||
}
|
||||
|
||||
if (values.length > 1 && _anyIsInherit(values)) {
|
||||
throw new InvalidPropertyError('Invalid animation values at ' + formatPosition(values[0][2][0]) + '. Ignoring.');
|
||||
}
|
||||
|
||||
for (i = 0, l = values.length; i < l; i++) {
|
||||
value = values[i];
|
||||
|
||||
if (validator.isTime(value[1]) && !durationSet) {
|
||||
duration.value = [value];
|
||||
durationSet = true;
|
||||
} else if (validator.isTime(value[1]) && !delaySet) {
|
||||
delay.value = [value];
|
||||
delaySet = true;
|
||||
} else if ((validator.isGlobal(value[1]) || validator.isTimingFunction(value[1])) && !timingSet) {
|
||||
timing.value = [value];
|
||||
timingSet = true;
|
||||
} else if (validator.isIdentifier(value[1]) && !propSet) {
|
||||
prop.value = [value];
|
||||
propSet = true;
|
||||
} else {
|
||||
throw new InvalidPropertyError('Invalid animation value at ' + formatPosition(value[2][0]) + '. Ignoring.');
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function widthStyleColor(property, compactable, validator) {
|
||||
var descriptor = compactable[property.name];
|
||||
var components = [
|
||||
_wrapDefault(descriptor.components[0], property, compactable),
|
||||
_wrapDefault(descriptor.components[1], property, compactable),
|
||||
_wrapDefault(descriptor.components[2], property, compactable)
|
||||
];
|
||||
var color, style, width;
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
var component = components[i];
|
||||
|
||||
if (component.name.indexOf('color') > 0)
|
||||
color = component;
|
||||
else if (component.name.indexOf('style') > 0)
|
||||
style = component;
|
||||
else
|
||||
width = component;
|
||||
}
|
||||
|
||||
if ((property.value.length == 1 && property.value[0][1] == 'inherit') ||
|
||||
(property.value.length == 3 && property.value[0][1] == 'inherit' && property.value[1][1] == 'inherit' && property.value[2][1] == 'inherit')) {
|
||||
color.value = style.value = width.value = [property.value[0]];
|
||||
return components;
|
||||
}
|
||||
|
||||
var values = property.value.slice(0);
|
||||
var match, matches;
|
||||
|
||||
// NOTE: usually users don't follow the required order of parts in this shorthand,
|
||||
// so we'll try to parse it caring as little about order as possible
|
||||
|
||||
if (values.length > 0) {
|
||||
matches = values.filter(_widthFilter(validator));
|
||||
match = matches.length > 1 && (matches[0][1] == 'none' || matches[0][1] == 'auto') ? matches[1] : matches[0];
|
||||
if (match) {
|
||||
width.value = [match];
|
||||
values.splice(values.indexOf(match), 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (values.length > 0) {
|
||||
match = values.filter(_styleFilter(validator))[0];
|
||||
if (match) {
|
||||
style.value = [match];
|
||||
values.splice(values.indexOf(match), 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (values.length > 0) {
|
||||
match = values.filter(_colorFilter(validator))[0];
|
||||
if (match) {
|
||||
color.value = [match];
|
||||
values.splice(values.indexOf(match), 1);
|
||||
}
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
animation: animation,
|
||||
background: background,
|
||||
border: widthStyleColor,
|
||||
borderRadius: borderRadius,
|
||||
font: font,
|
||||
fourValues: fourValues,
|
||||
listStyle: listStyle,
|
||||
multiplex: multiplex,
|
||||
outline: widthStyleColor,
|
||||
transition: transition
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
import { distinctUntilChanged } from './distinctUntilChanged';
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export function distinctUntilKeyChanged<T>(key: keyof T): MonoTypeOperatorFunction<T>;
|
||||
export function distinctUntilKeyChanged<T, K extends keyof T>(key: K, compare: (x: T[K], y: T[K]) => boolean): MonoTypeOperatorFunction<T>;
|
||||
/* tslint:enable:max-line-length */
|
||||
|
||||
/**
|
||||
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item,
|
||||
* using a property accessed by using the key provided to check if the two items are distinct.
|
||||
*
|
||||
* If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted.
|
||||
*
|
||||
* If a comparator function is not provided, an equality check is used by default.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* An example comparing the name of persons
|
||||
*
|
||||
* ```ts
|
||||
* import { of, distinctUntilKeyChanged } from 'rxjs';
|
||||
*
|
||||
* of(
|
||||
* { age: 4, name: 'Foo' },
|
||||
* { age: 7, name: 'Bar' },
|
||||
* { age: 5, name: 'Foo' },
|
||||
* { age: 6, name: 'Foo' }
|
||||
* ).pipe(
|
||||
* distinctUntilKeyChanged('name')
|
||||
* )
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
* // { age: 5, name: 'Foo' }
|
||||
* ```
|
||||
*
|
||||
* An example comparing the first letters of the name
|
||||
*
|
||||
* ```ts
|
||||
* import { of, distinctUntilKeyChanged } from 'rxjs';
|
||||
*
|
||||
* of(
|
||||
* { age: 4, name: 'Foo1' },
|
||||
* { age: 7, name: 'Bar' },
|
||||
* { age: 5, name: 'Foo2' },
|
||||
* { age: 6, name: 'Foo3' }
|
||||
* ).pipe(
|
||||
* distinctUntilKeyChanged('name', (x, y) => x.substring(0, 3) === y.substring(0, 3))
|
||||
* )
|
||||
* .subscribe(x => console.log(x));
|
||||
*
|
||||
* // displays:
|
||||
* // { age: 4, name: 'Foo1' }
|
||||
* // { age: 7, name: 'Bar' }
|
||||
* // { age: 5, name: 'Foo2' }
|
||||
* ```
|
||||
*
|
||||
* @see {@link distinct}
|
||||
* @see {@link distinctUntilChanged}
|
||||
*
|
||||
* @param {string} key String key for object property lookup on each item.
|
||||
* @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source.
|
||||
* @return A function that returns an Observable that emits items from the
|
||||
* source Observable with distinct values based on the key specified.
|
||||
*/
|
||||
export function distinctUntilKeyChanged<T, K extends keyof T>(key: K, compare?: (x: T[K], y: T[K]) => boolean): MonoTypeOperatorFunction<T> {
|
||||
return distinctUntilChanged((x: T, y: T) => compare ? compare(x[key], y[key]) : x[key] === y[key]);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"throwIfEmpty.js","sourceRoot":"","sources":["../../../../src/internal/operators/throwIfEmpty.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAEhD,qCAAuC;AACvC,2DAAgE;AAsChE,SAAgB,YAAY,CAAI,YAA6C;IAA7C,6BAAA,EAAA,kCAA6C;IAC3E,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAK;YACJ,QAAQ,GAAG,IAAI,CAAC;YAChB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,EACD,cAAM,OAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,EAArE,CAAqE,CAC5E,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,oCAcC;AAED,SAAS,mBAAmB;IAC1B,OAAO,IAAI,uBAAU,EAAE,CAAC;AAC1B,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,WAAW,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAmBjG"}
|
||||
@@ -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,"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,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00308,"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,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0.04,"110":0.01846,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"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,"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,"72":0,"73":0,"74":0,"75":0,"76":0.00308,"77":0.00308,"78":0,"79":0,"80":0,"81":0,"83":0.00308,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0.00308,"97":0,"98":0,"99":0,"100":0.00308,"101":0,"102":0,"103":0.00923,"104":0,"105":0.00308,"106":0.00308,"107":0.02154,"108":0.09846,"109":1.04926,"110":0.58463,"111":0,"112":0,"113":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,"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,"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,"94":0.03385,"95":0.00615,"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,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.00615,"108":0.00615,"109":0.17539,"110":0.31078},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00308,"15":0,_:"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.00308,"13.1":0.11385,"14.1":0.08616,"15.1":0.02154,"15.2-15.3":0.04308,"15.4":0.11077,"15.5":0.24308,"15.6":1.79389,"16.0":0.08,"16.1":0.40616,"16.2":1.9939,"16.3":1.79697,"16.4":0.00615},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00904,"10.0-10.2":0,"10.3":0.00904,"11.0-11.2":0,"11.3-11.4":0,"12.0-12.1":0.00904,"12.2-12.5":0.15365,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0.01808,"14.0-14.4":0.02711,"14.5-14.8":0.10846,"15.0-15.1":0.16268,"15.2-15.3":0.39767,"15.4":0.65073,"15.5":2.36794,"15.6":10.70998,"16.0":8.57702,"16.1":24.08615,"16.2":25.39666,"16.3":13.76481,"16.4":0.06327},P:{"4":0.0629,"20":0.22015,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0,"12.0":0,"13.0":0.01048,"14.0":0,"15.0":0.01048,"16.0":0,"17.0":0,"18.0":0,"19.0":0.42982},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.08616},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00308,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0},H:{"0":0},L:{"0":3.10076},R:{_:"0"},M:{"0":0.04154},Q:{"13.1":0}};
|
||||
Reference in New Issue
Block a user