new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import {RequestOptions} from 'http';
|
||||
import {FormData} from 'formdata-polyfill/esm.min.js';
|
||||
import {
|
||||
Blob,
|
||||
blobFrom,
|
||||
blobFromSync,
|
||||
File,
|
||||
fileFrom,
|
||||
fileFromSync
|
||||
} from 'fetch-blob/from.js';
|
||||
|
||||
type AbortSignal = {
|
||||
readonly aborted: boolean;
|
||||
|
||||
addEventListener: (type: 'abort', listener: (this: AbortSignal) => void) => void;
|
||||
removeEventListener: (type: 'abort', listener: (this: AbortSignal) => void) => void;
|
||||
};
|
||||
|
||||
export type HeadersInit = Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>>;
|
||||
|
||||
export {
|
||||
FormData,
|
||||
Blob,
|
||||
blobFrom,
|
||||
blobFromSync,
|
||||
File,
|
||||
fileFrom,
|
||||
fileFromSync
|
||||
};
|
||||
|
||||
/**
|
||||
* This Fetch API interface allows you to perform various actions on HTTP request and response headers.
|
||||
* These actions include retrieving, setting, adding to, and removing.
|
||||
* A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.
|
||||
* You can add to this using methods like append() (see Examples.)
|
||||
* In all methods of this interface, header names are matched by case-insensitive byte sequence.
|
||||
* */
|
||||
export class Headers {
|
||||
constructor(init?: HeadersInit);
|
||||
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): string | null;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
forEach(
|
||||
callbackfn: (value: string, key: string, parent: Headers) => void,
|
||||
thisArg?: any
|
||||
): void;
|
||||
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all key/value pairs contained in this object.
|
||||
*/
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
|
||||
*/
|
||||
keys(): IterableIterator<string>;
|
||||
/**
|
||||
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
|
||||
*/
|
||||
values(): IterableIterator<string>;
|
||||
|
||||
/** Node-fetch extension */
|
||||
raw(): Record<string, string[]>;
|
||||
}
|
||||
|
||||
export interface RequestInit {
|
||||
/**
|
||||
* A BodyInit object or null to set request's body.
|
||||
*/
|
||||
body?: BodyInit | null;
|
||||
/**
|
||||
* A Headers object, an object literal, or an array of two-item arrays to set request's headers.
|
||||
*/
|
||||
headers?: HeadersInit;
|
||||
/**
|
||||
* A string to set request's method.
|
||||
*/
|
||||
method?: string;
|
||||
/**
|
||||
* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.
|
||||
*/
|
||||
redirect?: RequestRedirect;
|
||||
/**
|
||||
* An AbortSignal to set request's signal.
|
||||
*/
|
||||
signal?: AbortSignal | null;
|
||||
/**
|
||||
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request’s referrer.
|
||||
*/
|
||||
referrer?: string;
|
||||
/**
|
||||
* A referrer policy to set request’s referrerPolicy.
|
||||
*/
|
||||
referrerPolicy?: ReferrerPolicy;
|
||||
|
||||
// Node-fetch extensions to the whatwg/fetch spec
|
||||
agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']);
|
||||
compress?: boolean;
|
||||
counter?: number;
|
||||
follow?: number;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
protocol?: string;
|
||||
size?: number;
|
||||
highWaterMark?: number;
|
||||
insecureHTTPParser?: boolean;
|
||||
}
|
||||
|
||||
export interface ResponseInit {
|
||||
headers?: HeadersInit;
|
||||
status?: number;
|
||||
statusText?: string;
|
||||
}
|
||||
|
||||
export type BodyInit =
|
||||
| Blob
|
||||
| Buffer
|
||||
| URLSearchParams
|
||||
| FormData
|
||||
| NodeJS.ReadableStream
|
||||
| string;
|
||||
declare class BodyMixin {
|
||||
constructor(body?: BodyInit, options?: {size?: number});
|
||||
|
||||
readonly body: NodeJS.ReadableStream | null;
|
||||
readonly bodyUsed: boolean;
|
||||
readonly size: number;
|
||||
|
||||
/** @deprecated Use `body.arrayBuffer()` instead. */
|
||||
buffer(): Promise<Buffer>;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
formData(): Promise<FormData>;
|
||||
blob(): Promise<Blob>;
|
||||
json(): Promise<unknown>;
|
||||
text(): Promise<string>;
|
||||
}
|
||||
|
||||
// `Body` must not be exported as a class since it's not exported from the JavaScript code.
|
||||
export interface Body extends Pick<BodyMixin, keyof BodyMixin> {}
|
||||
|
||||
export type RequestRedirect = 'error' | 'follow' | 'manual';
|
||||
export type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
||||
export type RequestInfo = string | Request;
|
||||
export class Request extends BodyMixin {
|
||||
constructor(input: RequestInfo, init?: RequestInit);
|
||||
|
||||
/**
|
||||
* Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.
|
||||
*/
|
||||
readonly headers: Headers;
|
||||
/**
|
||||
* Returns request's HTTP method, which is "GET" by default.
|
||||
*/
|
||||
readonly method: string;
|
||||
/**
|
||||
* Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.
|
||||
*/
|
||||
readonly redirect: RequestRedirect;
|
||||
/**
|
||||
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
||||
*/
|
||||
readonly signal: AbortSignal;
|
||||
/**
|
||||
* Returns the URL of request as a string.
|
||||
*/
|
||||
readonly url: string;
|
||||
/**
|
||||
* A string whose value is a same-origin URL, "about:client", or the empty string, to set request’s referrer.
|
||||
*/
|
||||
readonly referrer: string;
|
||||
/**
|
||||
* A referrer policy to set request’s referrerPolicy.
|
||||
*/
|
||||
readonly referrerPolicy: ReferrerPolicy;
|
||||
clone(): Request;
|
||||
}
|
||||
|
||||
type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
||||
|
||||
export class Response extends BodyMixin {
|
||||
constructor(body?: BodyInit | null, init?: ResponseInit);
|
||||
|
||||
readonly headers: Headers;
|
||||
readonly ok: boolean;
|
||||
readonly redirected: boolean;
|
||||
readonly status: number;
|
||||
readonly statusText: string;
|
||||
readonly type: ResponseType;
|
||||
readonly url: string;
|
||||
clone(): Response;
|
||||
|
||||
static error(): Response;
|
||||
static redirect(url: string, status?: number): Response;
|
||||
static json(data: any, init?: ResponseInit): Response;
|
||||
}
|
||||
|
||||
export class FetchError extends Error {
|
||||
constructor(message: string, type: string, systemError?: Record<string, unknown>);
|
||||
|
||||
name: 'FetchError';
|
||||
[Symbol.toStringTag]: 'FetchError';
|
||||
type: string;
|
||||
code?: string;
|
||||
errno?: string;
|
||||
}
|
||||
|
||||
export class AbortError extends Error {
|
||||
type: string;
|
||||
name: 'AbortError';
|
||||
[Symbol.toStringTag]: 'AbortError';
|
||||
}
|
||||
|
||||
export function isRedirect(code: number): boolean;
|
||||
export default function fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"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","2":"C K L G M N"},C:{"1":"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 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB EC FC"},D:{"1":"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 HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB"},E:{"1":"C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A B HC zB IC JC KC LC 0B"},F:{"1":"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 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB PC QC RC SC qB AC TC rB"},G:{"1":"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 ZC aC bC cC dC"},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":"g zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC xC yC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:6,C:"Promise.prototype.finally"};
|
||||
@@ -0,0 +1,445 @@
|
||||
var everyValuesPair = require('./every-values-pair');
|
||||
var hasInherit = require('./has-inherit');
|
||||
var populateComponents = require('./populate-components');
|
||||
|
||||
var compactable = require('../compactable');
|
||||
var deepClone = require('../clone').deep;
|
||||
var restoreWithComponents = require('../restore-with-components');
|
||||
|
||||
var restoreFromOptimizing = require('../../restore-from-optimizing');
|
||||
var wrapSingle = require('../../wrap-for-optimizing').single;
|
||||
|
||||
var serializeBody = require('../../../writer/one-time').body;
|
||||
var Token = require('../../../tokenizer/token');
|
||||
|
||||
function mergeIntoShorthands(properties, validator) {
|
||||
var candidates = {};
|
||||
var descriptor;
|
||||
var componentOf;
|
||||
var property;
|
||||
var i, l;
|
||||
var j, m;
|
||||
|
||||
// there is no shorthand property made up of less than 3 longhands
|
||||
if (properties.length < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0, l = properties.length; i < l; i++) {
|
||||
property = properties[i];
|
||||
descriptor = compactable[property.name];
|
||||
|
||||
if (property.unused) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.hack) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.block) {
|
||||
continue;
|
||||
}
|
||||
|
||||
invalidateOrCompact(properties, i, candidates, validator);
|
||||
|
||||
if (descriptor && descriptor.componentOf) {
|
||||
for (j = 0, m = descriptor.componentOf.length; j < m; j++) {
|
||||
componentOf = descriptor.componentOf[j];
|
||||
|
||||
candidates[componentOf] = candidates[componentOf] || {};
|
||||
candidates[componentOf][property.name] = property;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invalidateOrCompact(properties, i, candidates, validator);
|
||||
}
|
||||
|
||||
function invalidateOrCompact(properties, position, candidates, validator) {
|
||||
var invalidatedBy = properties[position];
|
||||
var shorthandName;
|
||||
var shorthandDescriptor;
|
||||
var candidateComponents;
|
||||
|
||||
for (shorthandName in candidates) {
|
||||
if (undefined !== invalidatedBy && shorthandName == invalidatedBy.name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
shorthandDescriptor = compactable[shorthandName];
|
||||
candidateComponents = candidates[shorthandName];
|
||||
if (invalidatedBy && invalidates(candidates, shorthandName, invalidatedBy)) {
|
||||
delete candidates[shorthandName];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shorthandDescriptor.components.length > Object.keys(candidateComponents).length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mixedImportance(candidateComponents)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!overridable(candidateComponents, shorthandName, validator)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mergeable(candidateComponents)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mixedInherit(candidateComponents)) {
|
||||
replaceWithInheritBestFit(properties, candidateComponents, shorthandName, validator);
|
||||
} else {
|
||||
replaceWithShorthand(properties, candidateComponents, shorthandName, validator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function invalidates(candidates, shorthandName, invalidatedBy) {
|
||||
var shorthandDescriptor = compactable[shorthandName];
|
||||
var invalidatedByDescriptor = compactable[invalidatedBy.name];
|
||||
var componentName;
|
||||
|
||||
if ('overridesShorthands' in shorthandDescriptor && shorthandDescriptor.overridesShorthands.indexOf(invalidatedBy.name) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (invalidatedByDescriptor && 'componentOf' in invalidatedByDescriptor) {
|
||||
for (componentName in candidates[shorthandName]) {
|
||||
if (invalidatedByDescriptor.componentOf.indexOf(componentName) > -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function mixedImportance(components) {
|
||||
var important;
|
||||
var componentName;
|
||||
|
||||
for (componentName in components) {
|
||||
if (undefined !== important && components[componentName].important != important) {
|
||||
return true;
|
||||
}
|
||||
|
||||
important = components[componentName].important;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function overridable(components, shorthandName, validator) {
|
||||
var descriptor = compactable[shorthandName];
|
||||
var newValuePlaceholder = [
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, shorthandName],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue]
|
||||
];
|
||||
var newProperty = wrapSingle(newValuePlaceholder);
|
||||
var component;
|
||||
var mayOverride;
|
||||
var i, l;
|
||||
|
||||
populateComponents([newProperty], validator, []);
|
||||
|
||||
for (i = 0, l = descriptor.components.length; i < l; i++) {
|
||||
component = components[descriptor.components[i]];
|
||||
mayOverride = compactable[component.name].canOverride;
|
||||
|
||||
if (!everyValuesPair(mayOverride.bind(null, validator), newProperty.components[i], component)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function mergeable(components) {
|
||||
var lastCount = null;
|
||||
var currentCount;
|
||||
var componentName;
|
||||
var component;
|
||||
var descriptor;
|
||||
var values;
|
||||
|
||||
for (componentName in components) {
|
||||
component = components[componentName];
|
||||
descriptor = compactable[componentName];
|
||||
|
||||
if (!('restore' in descriptor)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
restoreFromOptimizing([component.all[component.position]], restoreWithComponents);
|
||||
values = descriptor.restore(component, compactable);
|
||||
|
||||
currentCount = values.length;
|
||||
|
||||
if (lastCount !== null && currentCount !== lastCount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lastCount = currentCount;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function mixedInherit(components) {
|
||||
var componentName;
|
||||
var lastValue = null;
|
||||
var currentValue;
|
||||
|
||||
for (componentName in components) {
|
||||
currentValue = hasInherit(components[componentName]);
|
||||
|
||||
if (lastValue !== null && lastValue !== currentValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
lastValue = currentValue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function replaceWithInheritBestFit(properties, candidateComponents, shorthandName, validator) {
|
||||
var viaLonghands = buildSequenceWithInheritLonghands(candidateComponents, shorthandName, validator);
|
||||
var viaShorthand = buildSequenceWithInheritShorthand(candidateComponents, shorthandName, validator);
|
||||
var longhandTokensSequence = viaLonghands[0];
|
||||
var shorthandTokensSequence = viaShorthand[0];
|
||||
var isLonghandsShorter = serializeBody(longhandTokensSequence).length < serializeBody(shorthandTokensSequence).length;
|
||||
var newTokensSequence = isLonghandsShorter ? longhandTokensSequence : shorthandTokensSequence;
|
||||
var newProperty = isLonghandsShorter ? viaLonghands[1] : viaShorthand[1];
|
||||
var newComponents = isLonghandsShorter ? viaLonghands[2] : viaShorthand[2];
|
||||
var all = candidateComponents[Object.keys(candidateComponents)[0]].all;
|
||||
var componentName;
|
||||
var oldComponent;
|
||||
var newComponent;
|
||||
var newToken;
|
||||
|
||||
newProperty.position = all.length;
|
||||
newProperty.shorthand = true;
|
||||
newProperty.dirty = true;
|
||||
newProperty.all = all;
|
||||
newProperty.all.push(newTokensSequence[0]);
|
||||
|
||||
properties.push(newProperty);
|
||||
|
||||
for (componentName in candidateComponents) {
|
||||
oldComponent = candidateComponents[componentName];
|
||||
oldComponent.unused = true;
|
||||
|
||||
if (oldComponent.name in newComponents) {
|
||||
newComponent = newComponents[oldComponent.name];
|
||||
newToken = findTokenIn(newTokensSequence, componentName);
|
||||
|
||||
newComponent.position = all.length;
|
||||
newComponent.all = all;
|
||||
newComponent.all.push(newToken);
|
||||
|
||||
properties.push(newComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildSequenceWithInheritLonghands(components, shorthandName, validator) {
|
||||
var tokensSequence = [];
|
||||
var inheritComponents = {};
|
||||
var nonInheritComponents = {};
|
||||
var descriptor = compactable[shorthandName];
|
||||
var shorthandToken = [
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, shorthandName],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue]
|
||||
];
|
||||
var newProperty = wrapSingle(shorthandToken);
|
||||
var component;
|
||||
var longhandToken;
|
||||
var newComponent;
|
||||
var nameMetadata;
|
||||
var i, l;
|
||||
|
||||
populateComponents([newProperty], validator, []);
|
||||
|
||||
for (i = 0, l = descriptor.components.length; i < l; i++) {
|
||||
component = components[descriptor.components[i]];
|
||||
|
||||
if (hasInherit(component)) {
|
||||
longhandToken = component.all[component.position].slice(0, 2);
|
||||
Array.prototype.push.apply(longhandToken, component.value);
|
||||
tokensSequence.push(longhandToken);
|
||||
|
||||
newComponent = deepClone(component);
|
||||
newComponent.value = inferComponentValue(components, newComponent.name);
|
||||
|
||||
newProperty.components[i] = newComponent;
|
||||
inheritComponents[component.name] = deepClone(component);
|
||||
} else {
|
||||
newComponent = deepClone(component);
|
||||
newComponent.all = component.all;
|
||||
newProperty.components[i] = newComponent;
|
||||
|
||||
nonInheritComponents[component.name] = component;
|
||||
}
|
||||
}
|
||||
|
||||
nameMetadata = joinMetadata(nonInheritComponents, 1);
|
||||
shorthandToken[1].push(nameMetadata);
|
||||
|
||||
restoreFromOptimizing([newProperty], restoreWithComponents);
|
||||
|
||||
shorthandToken = shorthandToken.slice(0, 2);
|
||||
Array.prototype.push.apply(shorthandToken, newProperty.value);
|
||||
|
||||
tokensSequence.unshift(shorthandToken);
|
||||
|
||||
return [tokensSequence, newProperty, inheritComponents];
|
||||
}
|
||||
|
||||
function inferComponentValue(components, propertyName) {
|
||||
var descriptor = compactable[propertyName];
|
||||
|
||||
if ('oppositeTo' in descriptor) {
|
||||
return components[descriptor.oppositeTo].value;
|
||||
} else {
|
||||
return [[Token.PROPERTY_VALUE, descriptor.defaultValue]];
|
||||
}
|
||||
}
|
||||
|
||||
function joinMetadata(components, at) {
|
||||
var metadata = [];
|
||||
var component;
|
||||
var originalValue;
|
||||
var componentMetadata;
|
||||
var componentName;
|
||||
|
||||
for (componentName in components) {
|
||||
component = components[componentName];
|
||||
originalValue = component.all[component.position];
|
||||
componentMetadata = originalValue[at][originalValue[at].length - 1];
|
||||
|
||||
Array.prototype.push.apply(metadata, componentMetadata);
|
||||
}
|
||||
|
||||
return metadata.sort(metadataSorter);
|
||||
}
|
||||
|
||||
function metadataSorter(metadata1, metadata2) {
|
||||
var line1 = metadata1[0];
|
||||
var line2 = metadata2[0];
|
||||
var column1 = metadata1[1];
|
||||
var column2 = metadata2[1];
|
||||
|
||||
if (line1 < line2) {
|
||||
return -1;
|
||||
} else if (line1 === line2) {
|
||||
return column1 < column2 ? -1 : 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function buildSequenceWithInheritShorthand(components, shorthandName, validator) {
|
||||
var tokensSequence = [];
|
||||
var inheritComponents = {};
|
||||
var nonInheritComponents = {};
|
||||
var descriptor = compactable[shorthandName];
|
||||
var shorthandToken = [
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, shorthandName],
|
||||
[Token.PROPERTY_VALUE, 'inherit']
|
||||
];
|
||||
var newProperty = wrapSingle(shorthandToken);
|
||||
var component;
|
||||
var longhandToken;
|
||||
var nameMetadata;
|
||||
var valueMetadata;
|
||||
var i, l;
|
||||
|
||||
populateComponents([newProperty], validator, []);
|
||||
|
||||
for (i = 0, l = descriptor.components.length; i < l; i++) {
|
||||
component = components[descriptor.components[i]];
|
||||
|
||||
if (hasInherit(component)) {
|
||||
inheritComponents[component.name] = component;
|
||||
} else {
|
||||
longhandToken = component.all[component.position].slice(0, 2);
|
||||
Array.prototype.push.apply(longhandToken, component.value);
|
||||
tokensSequence.push(longhandToken);
|
||||
|
||||
nonInheritComponents[component.name] = deepClone(component);
|
||||
}
|
||||
}
|
||||
|
||||
nameMetadata = joinMetadata(inheritComponents, 1);
|
||||
shorthandToken[1].push(nameMetadata);
|
||||
|
||||
valueMetadata = joinMetadata(inheritComponents, 2);
|
||||
shorthandToken[2].push(valueMetadata);
|
||||
|
||||
tokensSequence.unshift(shorthandToken);
|
||||
|
||||
return [tokensSequence, newProperty, nonInheritComponents];
|
||||
}
|
||||
|
||||
function findTokenIn(tokens, componentName) {
|
||||
var i, l;
|
||||
|
||||
for (i = 0, l = tokens.length; i < l; i++) {
|
||||
if (tokens[i][1][1] == componentName) {
|
||||
return tokens[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function replaceWithShorthand(properties, candidateComponents, shorthandName, validator) {
|
||||
var descriptor = compactable[shorthandName];
|
||||
var nameMetadata;
|
||||
var valueMetadata;
|
||||
var newValuePlaceholder = [
|
||||
Token.PROPERTY,
|
||||
[Token.PROPERTY_NAME, shorthandName],
|
||||
[Token.PROPERTY_VALUE, descriptor.defaultValue]
|
||||
];
|
||||
var all;
|
||||
|
||||
var newProperty = wrapSingle(newValuePlaceholder);
|
||||
newProperty.shorthand = true;
|
||||
newProperty.dirty = true;
|
||||
|
||||
populateComponents([newProperty], validator, []);
|
||||
|
||||
for (var i = 0, l = descriptor.components.length; i < l; i++) {
|
||||
var component = candidateComponents[descriptor.components[i]];
|
||||
|
||||
newProperty.components[i] = deepClone(component);
|
||||
newProperty.important = component.important;
|
||||
|
||||
all = component.all;
|
||||
}
|
||||
|
||||
for (var componentName in candidateComponents) {
|
||||
candidateComponents[componentName].unused = true;
|
||||
}
|
||||
|
||||
nameMetadata = joinMetadata(candidateComponents, 1);
|
||||
newValuePlaceholder[1].push(nameMetadata);
|
||||
|
||||
valueMetadata = joinMetadata(candidateComponents, 2);
|
||||
newValuePlaceholder[2].push(valueMetadata);
|
||||
|
||||
newProperty.position = all.length;
|
||||
newProperty.all = all;
|
||||
newProperty.all.push(newValuePlaceholder);
|
||||
|
||||
properties.push(newProperty);
|
||||
}
|
||||
|
||||
module.exports = mergeIntoShorthands;
|
||||
@@ -0,0 +1,30 @@
|
||||
var createRelationalOperation = require('./_createRelationalOperation');
|
||||
|
||||
/**
|
||||
* Checks if `value` is less than or equal to `other`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.9.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if `value` is less than or equal to
|
||||
* `other`, else `false`.
|
||||
* @see _.gte
|
||||
* @example
|
||||
*
|
||||
* _.lte(1, 3);
|
||||
* // => true
|
||||
*
|
||||
* _.lte(3, 3);
|
||||
* // => true
|
||||
*
|
||||
* _.lte(3, 1);
|
||||
* // => false
|
||||
*/
|
||||
var lte = createRelationalOperation(function(value, other) {
|
||||
return value <= other;
|
||||
});
|
||||
|
||||
module.exports = lte;
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
Check if a value is an object.
|
||||
|
||||
Keep in mind that array, function, regexp, etc, are objects in JavaScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import isObject = require('is-obj');
|
||||
|
||||
isObject({foo: 'bar'});
|
||||
//=> true
|
||||
|
||||
isObject([1, 2, 3]);
|
||||
//=> true
|
||||
|
||||
isObject('foo');
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
declare function isObject(value: unknown): value is object;
|
||||
|
||||
export = isObject;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { Transformer, Options } from '../types';
|
||||
declare const transformer: Transformer<Options.Pug>;
|
||||
export { transformer };
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
import assertString from './util/assertString';
|
||||
import toFloat from './toFloat';
|
||||
export default function isDivisibleBy(str, num) {
|
||||
assertString(str);
|
||||
return toFloat(str) % parseInt(num, 10) === 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"J D E F A B","2":"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":"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 GB HB IB JB KB LB MB NB OB PB QB RB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB 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","16":"I v J D E F A B C K L"},E:{"1":"J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"I v HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB 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 PC QC RC SC","16":"B qB AC"},G:{"1":"E 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","2":"zB UC BC"},H:{"2":"oC"},I:{"1":"I f sC BC tC uC","2":"pC qC rC","16":"tB"},J:{"1":"D A"},K:{"1":"C h rB","2":"A","16":"B qB AC"},L:{"1":"H"},M:{"1":"H"},N:{"1":"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":"BD","2":"AD"}},B:5,C:"focusin & focusout events"};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
|
||||
|
||||
declare function ensureRegExp(value: any, options?: EnsureBaseOptions): RegExp;
|
||||
declare function ensureRegExp(value: any, options?: EnsureBaseOptions & EnsureIsOptional): RegExp | null;
|
||||
declare function ensureRegExp(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<RegExp>): RegExp;
|
||||
|
||||
export default ensureRegExp;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $Promise = GetIntrinsic('%Promise%', true);
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var CreateIterResultObject = require('./CreateIterResultObject');
|
||||
var IteratorComplete = require('./IteratorComplete');
|
||||
var IteratorValue = require('./IteratorValue');
|
||||
var PromiseResolve = require('./PromiseResolve');
|
||||
var Type = require('./Type');
|
||||
|
||||
var $then = callBound('Promise.prototype.then', true);
|
||||
|
||||
// https://262.ecma-international.org/10.0/#sec-asyncfromsynciteratorcontinuation
|
||||
|
||||
module.exports = function AsyncFromSyncIteratorContinuation(result) {
|
||||
if (Type(result) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
throw new $SyntaxError('although AsyncFromSyncIteratorContinuation should take a second argument, it is not used in this implementation');
|
||||
}
|
||||
|
||||
if (!$Promise) {
|
||||
throw new $SyntaxError('This environment does not support Promises.');
|
||||
}
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
var done = IteratorComplete(result); // step 2
|
||||
var value = IteratorValue(result); // step 4
|
||||
var valueWrapper = PromiseResolve($Promise, value); // step 6
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
var onFulfilled = function (value) { // steps 8-9
|
||||
return CreateIterResultObject(value, done); // step 8.a
|
||||
};
|
||||
resolve($then(valueWrapper, onFulfilled)); // step 11
|
||||
}); // step 12
|
||||
};
|
||||
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"name": "svelte",
|
||||
"version": "3.56.0",
|
||||
"description": "Cybernetically enhanced web apps",
|
||||
"module": "index.mjs",
|
||||
"main": "index",
|
||||
"files": [
|
||||
"types",
|
||||
"compiler.*",
|
||||
"register.js",
|
||||
"index.*",
|
||||
"ssr.*",
|
||||
"internal",
|
||||
"store",
|
||||
"animate",
|
||||
"transition",
|
||||
"easing",
|
||||
"motion",
|
||||
"action",
|
||||
"elements",
|
||||
"README.md"
|
||||
],
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"types": "./types/runtime/index.d.ts",
|
||||
"browser": {
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"node": {
|
||||
"import": "./ssr.mjs",
|
||||
"require": "./ssr.js"
|
||||
},
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./compiler": {
|
||||
"types": "./types/compiler/index.d.ts",
|
||||
"import": "./compiler.mjs",
|
||||
"require": "./compiler.js"
|
||||
},
|
||||
"./action": {
|
||||
"types": "./types/runtime/action/index.d.ts"
|
||||
},
|
||||
"./animate": {
|
||||
"types": "./types/runtime/animate/index.d.ts",
|
||||
"import": "./animate/index.mjs",
|
||||
"require": "./animate/index.js"
|
||||
},
|
||||
"./easing": {
|
||||
"types": "./types/runtime/easing/index.d.ts",
|
||||
"import": "./easing/index.mjs",
|
||||
"require": "./easing/index.js"
|
||||
},
|
||||
"./internal": {
|
||||
"types": "./types/runtime/internal/index.d.ts",
|
||||
"import": "./internal/index.mjs",
|
||||
"require": "./internal/index.js"
|
||||
},
|
||||
"./motion": {
|
||||
"types": "./types/runtime/motion/index.d.ts",
|
||||
"import": "./motion/index.mjs",
|
||||
"require": "./motion/index.js"
|
||||
},
|
||||
"./register": {
|
||||
"require": "./register.js"
|
||||
},
|
||||
"./store": {
|
||||
"types": "./types/runtime/store/index.d.ts",
|
||||
"import": "./store/index.mjs",
|
||||
"require": "./store/index.js"
|
||||
},
|
||||
"./transition": {
|
||||
"types": "./types/runtime/transition/index.d.ts",
|
||||
"import": "./transition/index.mjs",
|
||||
"require": "./transition/index.js"
|
||||
},
|
||||
"./elements": {
|
||||
"types": "./elements/index.d.ts"
|
||||
},
|
||||
"./ssr": {
|
||||
"types": "./types/runtime/index.d.ts",
|
||||
"import": "./ssr.mjs",
|
||||
"require": "./ssr.js"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
},
|
||||
"types": "types/runtime/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "npm run test:unit && npm run test:integration",
|
||||
"test:integration": "mocha --exit",
|
||||
"test:unit": "mocha --config .mocharc.unit.js --exit",
|
||||
"quicktest": "mocha --exit",
|
||||
"build": "rollup -c && npm run tsd",
|
||||
"prepare": "node scripts/skip_in_ci.js npm run build",
|
||||
"dev": "rollup -cw",
|
||||
"posttest": "agadoo internal/index.mjs",
|
||||
"prepublishOnly": "node check_publish_env.js && npm run lint && npm run build && npm test",
|
||||
"tsd": "node ./generate-type-definitions.js",
|
||||
"lint": "eslint \"{src,test}/**/*.{ts,js}\" --cache"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sveltejs/svelte.git"
|
||||
},
|
||||
"keywords": [
|
||||
"UI",
|
||||
"framework",
|
||||
"templates",
|
||||
"templating"
|
||||
],
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sveltejs/svelte/issues"
|
||||
},
|
||||
"homepage": "https://svelte.dev",
|
||||
"devDependencies": {
|
||||
"@ampproject/remapping": "^0.3.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14",
|
||||
"@rollup/plugin-commonjs": "^11.0.0",
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^5.0.2",
|
||||
"@rollup/plugin-sucrase": "^3.1.0",
|
||||
"@rollup/plugin-typescript": "^2.0.1",
|
||||
"@rollup/plugin-virtual": "^3.0.1",
|
||||
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.8.0",
|
||||
"@types/aria-query": "^5.0.1",
|
||||
"@types/mocha": "^7.0.0",
|
||||
"@types/node": "^8.10.53",
|
||||
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
||||
"@typescript-eslint/parser": "^5.29.0",
|
||||
"acorn": "^8.8.1",
|
||||
"agadoo": "^3.0.0",
|
||||
"aria-query": "^5.1.3",
|
||||
"axobject-query": "^3.1.1",
|
||||
"code-red": "^1.0.0",
|
||||
"css-tree": "^2.3.1",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-plugin-import": "^2.27.0",
|
||||
"eslint-plugin-svelte3": "^4.0.0",
|
||||
"estree-walker": "^3.0.3",
|
||||
"is-reference": "^3.0.1",
|
||||
"jsdom": "^15.2.1",
|
||||
"kleur": "^4.1.5",
|
||||
"locate-character": "^2.0.5",
|
||||
"magic-string": "^0.30.0",
|
||||
"mocha": "^7.0.0",
|
||||
"periscopic": "^3.1.0",
|
||||
"puppeteer": "^2.0.0",
|
||||
"rollup": "^1.27.14",
|
||||
"source-map": "^0.7.4",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tiny-glob": "^0.2.9",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^3.7.5",
|
||||
"util": "^0.12.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { GetOption } from '../GetOption';
|
||||
import { IsWellFormedCurrencyCode } from '../IsWellFormedCurrencyCode';
|
||||
import { IsWellFormedUnitIdentifier } from '../IsWellFormedUnitIdentifier';
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-setnumberformatunitoptions
|
||||
*/
|
||||
export function SetNumberFormatUnitOptions(nf, options, _a) {
|
||||
if (options === void 0) { options = Object.create(null); }
|
||||
var getInternalSlots = _a.getInternalSlots;
|
||||
var internalSlots = getInternalSlots(nf);
|
||||
var style = GetOption(options, 'style', 'string', ['decimal', 'percent', 'currency', 'unit'], 'decimal');
|
||||
internalSlots.style = style;
|
||||
var currency = GetOption(options, 'currency', 'string', undefined, undefined);
|
||||
if (currency !== undefined && !IsWellFormedCurrencyCode(currency)) {
|
||||
throw RangeError('Malformed currency code');
|
||||
}
|
||||
if (style === 'currency' && currency === undefined) {
|
||||
throw TypeError('currency cannot be undefined');
|
||||
}
|
||||
var currencyDisplay = GetOption(options, 'currencyDisplay', 'string', ['code', 'symbol', 'narrowSymbol', 'name'], 'symbol');
|
||||
var currencySign = GetOption(options, 'currencySign', 'string', ['standard', 'accounting'], 'standard');
|
||||
var unit = GetOption(options, 'unit', 'string', undefined, undefined);
|
||||
if (unit !== undefined && !IsWellFormedUnitIdentifier(unit)) {
|
||||
throw RangeError('Invalid unit argument for Intl.NumberFormat()');
|
||||
}
|
||||
if (style === 'unit' && unit === undefined) {
|
||||
throw TypeError('unit cannot be undefined');
|
||||
}
|
||||
var unitDisplay = GetOption(options, 'unitDisplay', 'string', ['short', 'narrow', 'long'], 'short');
|
||||
if (style === 'currency') {
|
||||
internalSlots.currency = currency.toUpperCase();
|
||||
internalSlots.currencyDisplay = currencyDisplay;
|
||||
internalSlots.currencySign = currencySign;
|
||||
}
|
||||
if (style === 'unit') {
|
||||
internalSlots.unit = unit;
|
||||
internalSlots.unitDisplay = unitDisplay;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plural-rules.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/types/plural-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAC,8BAA8B,EAAC,MAAM,UAAU,CAAA;AACvD,oBAAY,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;AAC9E,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE;QACV,QAAQ,EAAE,MAAM,EAAE,CAAA;QAClB,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,CAAA;IACD,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,cAAc,CAAA;CAC5D;AAED,oBAAY,qBAAqB,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;AAE/D,MAAM,WAAW,mBAAoB,SAAQ,8BAA8B;IACzE,sBAAsB,EAAE,OAAO,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,UAAU,GAAG,SAAS,CAAA;CAC7B"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E 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 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 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":"DC tB","33":"EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB 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":"I v J D E F"},E:{"1":"J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","33":"v","164":"I HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e RC SC qB AC TC rB","2":"F PC QC"},G:{"1":"E 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","33":"UC BC","164":"zB"},H:{"2":"oC"},I:{"1":"I f sC BC tC uC","164":"tB pC qC rC"},J:{"1":"A","33":"D"},K:{"1":"B C h qB AC rB","2":"A"},L:{"1":"H"},M:{"1":"H"},N:{"1":"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:4,C:"CSS3 Box-shadow"};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function skipWhile(predicate) {
|
||||
return operate(function (source, subscriber) {
|
||||
var taking = false;
|
||||
var index = 0;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) { return (taking || (taking = !predicate(value, index++))) && subscriber.next(value); }));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=skipWhile.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
export { TestScheduler } from '../internal/testing/TestScheduler';
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
import assertString from './util/assertString';
|
||||
var hexadecimal = /^(0x|0h)?[0-9A-F]+$/i;
|
||||
export default function isHexadecimal(str) {
|
||||
assertString(str);
|
||||
return hexadecimal.test(str);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core/getDelimiter.js</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../../index.html">All files</a> / <a href="index.html">csv2json/libs/core</a> getDelimiter.js
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/15</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/15</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a></td><td class="line-coverage quiet"><span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span></td><td class="text"><pre class="prettyprint lang-js">Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/getDelimiter.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/getDelimiter.js')
|
||||
Error: Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/getDelimiter.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/getDelimiter.js')
|
||||
at Context.defaultSourceLookup [as sourceFinder] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:15:15)
|
||||
at Context.getSource (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:74:17)
|
||||
at Object.annotateSourceCode (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:172:38)
|
||||
at HtmlReport.onDetail (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:237:39)
|
||||
at Visitor.(anonymous function) [as onDetail] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
|
||||
at /Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
|
||||
at Array.forEach (native)
|
||||
at visitChildren (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:126:5)</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../../sorter.js"></script>
|
||||
<script src="../../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,75 @@
|
||||
import { OperatorFunction, MonoTypeOperatorFunction, TruthyTypesOf } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export function filter<T, S extends T, A>(predicate: (this: A, value: T, index: number) => value is S, thisArg: A): OperatorFunction<T, S>;
|
||||
export function filter<T, S extends T>(predicate: (value: T, index: number) => value is S): OperatorFunction<T, S>;
|
||||
export function filter<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
|
||||
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
||||
export function filter<T, A>(predicate: (this: A, value: T, index: number) => boolean, thisArg: A): MonoTypeOperatorFunction<T>;
|
||||
export function filter<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T>;
|
||||
|
||||
/**
|
||||
* Filter items emitted by the source Observable by only emitting those that
|
||||
* satisfy a specified predicate.
|
||||
*
|
||||
* <span class="informal">Like
|
||||
* [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
|
||||
* it only emits a value from the source if it passes a criterion function.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Similar to the well-known `Array.prototype.filter` method, this operator
|
||||
* takes values from the source Observable, passes them through a `predicate`
|
||||
* function and only emits those values that yielded `true`.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Emit only click events whose target was a DIV element
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent, filter } from 'rxjs';
|
||||
*
|
||||
* const div = document.createElement('div');
|
||||
* div.style.cssText = 'width: 200px; height: 200px; background: #09c;';
|
||||
* document.body.appendChild(div);
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const clicksOnDivs = clicks.pipe(filter(ev => (<HTMLElement>ev.target).tagName === 'DIV'));
|
||||
* clicksOnDivs.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link distinct}
|
||||
* @see {@link distinctUntilChanged}
|
||||
* @see {@link distinctUntilKeyChanged}
|
||||
* @see {@link ignoreElements}
|
||||
* @see {@link partition}
|
||||
* @see {@link skip}
|
||||
*
|
||||
* @param predicate A function that
|
||||
* evaluates each value emitted by the source Observable. If it returns `true`,
|
||||
* the value is emitted, if `false` the value is not passed to the output
|
||||
* Observable. The `index` parameter is the number `i` for the i-th source
|
||||
* emission that has happened since the subscription, starting from the number
|
||||
* `0`.
|
||||
* @param thisArg An optional argument to determine the value of `this`
|
||||
* in the `predicate` function.
|
||||
* @return A function that returns an Observable that emits items from the
|
||||
* source Observable that satisfy the specified `predicate`.
|
||||
*/
|
||||
export function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T> {
|
||||
return operate((source, subscriber) => {
|
||||
// An index passed to our predicate function on each call.
|
||||
let index = 0;
|
||||
|
||||
// Subscribe to the source, all errors and completions are
|
||||
// forwarded to the consumer.
|
||||
source.subscribe(
|
||||
// Call the predicate with the appropriate `this` context,
|
||||
// if the predicate returns `true`, then send the value
|
||||
// to the consumer.
|
||||
createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value))
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import Renderer, { RenderOptions } from '../Renderer';
|
||||
import Head from '../../nodes/Head';
|
||||
export default function (node: Head, renderer: Renderer, options: RenderOptions): void;
|
||||
@@ -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.01118,"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.02235,"69":0.00373,"70":0,"71":0,"72":0.12293,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0.00373,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.00373,"91":0,"92":0,"93":0.00373,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00745,"100":0.00373,"101":0,"102":0,"103":0,"104":0,"105":0.00373,"106":0,"107":0.00373,"108":0,"109":0.49543,"110":0.4321,"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.00373,"57":0,"58":0,"59":0.0149,"60":0,"61":0,"62":0,"63":0.01118,"64":0,"65":0,"66":0,"67":0.00373,"68":0.00373,"69":0.06705,"70":0.00373,"71":0,"72":0.00745,"73":0,"74":0.03353,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0.00745,"81":0,"83":0.00373,"84":0.01863,"85":0,"86":0,"87":0.00373,"88":0.06333,"89":0,"90":0,"91":0.00373,"92":0,"93":0.01863,"94":0.00373,"95":0.01863,"96":0.0298,"97":0,"98":0,"99":0.00745,"100":0.00373,"101":0,"102":0.00745,"103":0.0894,"104":0.00745,"105":0.03353,"106":0.00373,"107":0.0298,"108":0.08195,"109":4.40668,"110":2.36538,"111":0.01118,"112":0.01118,"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.00373,"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.01863,"95":0.01863,"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.00373,"16":0,"17":0.01118,"18":0.01118,"79":0,"80":0,"81":0,"83":0,"84":0.00373,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0.01118,"91":0,"92":0.01118,"93":0,"94":0.00373,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00373,"101":0.01118,"102":0.00373,"103":0.00373,"104":0,"105":0.00373,"106":0.00745,"107":0.0149,"108":0.0149,"109":0.68913,"110":0.66305},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00373,"12":0,"13":0,"14":0,"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.00373,"12.1":0.00373,"13.1":0.30173,"14.1":0.0447,"15.1":0.03353,"15.2-15.3":0.03353,"15.4":0.01118,"15.5":0.02235,"15.6":0.04843,"16.0":0.01118,"16.1":0.02235,"16.2":0.05588,"16.3":0.05588,"16.4":0},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.07492,"9.3":0.02358,"10.0-10.2":0,"10.3":0.02705,"11.0-11.2":0,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0.1755,"13.0-13.1":0,"13.2":0,"13.3":0.00416,"13.4-13.7":0.02012,"14.0-14.4":0.13665,"14.5-14.8":0.60279,"15.0-15.1":0.10197,"15.2-15.3":0.5355,"15.4":0.15677,"15.5":0.13318,"15.6":0.43007,"16.0":0.40302,"16.1":1.26384,"16.2":1.25968,"16.3":1.03286,"16.4":0},P:{"4":0.22531,"20":0.64521,"5.0-5.4":0.01024,"6.2-6.4":0.01024,"7.2-7.4":0.21507,"8.2":0,"9.2":0.01024,"10.1":0,"11.1-11.2":0.04097,"12.0":0,"13.0":0.03072,"14.0":0.10241,"15.0":0.1229,"16.0":0.22531,"17.0":0.02048,"18.0":0.08193,"19.0":1.32115},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.255,"4.4":0,"4.4.3-4.4.4":0.255},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.00745,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.00628,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":1.22363},H:{"0":0.16634},L:{"0":76.1606},R:{_:"0"},M:{"0":0.06275},Q:{"13.1":0.01255}};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"J D E F A 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 O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB 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":"DC tB I v J D E F A B C K L G M N EC FC"},D:{"1":"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 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"},E:{"1":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB 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"},G:{"1":"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:{"1":"oC"},I:{"1":"tB I f pC qC rC sC BC tC uC"},J:{"1":"D A"},K:{"1":"C h rB","2":"A B qB AC"},L:{"1":"H"},M:{"1":"H"},N:{"1":"B","2":"A"},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:5,C:"Window.devicePixelRatio"};
|
||||
@@ -0,0 +1,16 @@
|
||||
var test = require('tape');
|
||||
var equal = require('../');
|
||||
|
||||
test('NaN and 0 values', function (t) {
|
||||
t.ok(equal(NaN, NaN));
|
||||
t.notOk(equal(0, NaN));
|
||||
t.ok(equal(0, 0));
|
||||
t.notOk(equal(0, 1));
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('nested NaN values', function (t) {
|
||||
t.ok(equal([ NaN, 1, NaN ], [ NaN, 1, NaN ]));
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import { AsyncAction } from './AsyncAction';
|
||||
import { AsyncScheduler } from './AsyncScheduler';
|
||||
export declare class AsapScheduler extends AsyncScheduler {
|
||||
flush(action?: AsyncAction<any>): void;
|
||||
}
|
||||
//# sourceMappingURL=AsapScheduler.d.ts.map
|
||||
@@ -0,0 +1,233 @@
|
||||
# ansi-escapes
|
||||
|
||||
> [ANSI escape codes](http://www.termsys.demon.co.uk/vtansi.htm) for manipulating the terminal
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install ansi-escapes
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import ansiEscapes from 'ansi-escapes';
|
||||
|
||||
// Moves the cursor two rows up and to the left
|
||||
process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
|
||||
//=> '\u001B[2A\u001B[1000D'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cursorTo(x, y?)
|
||||
|
||||
Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
|
||||
|
||||
### cursorMove(x, y?)
|
||||
|
||||
Set the position of the cursor relative to its current position.
|
||||
|
||||
### cursorUp(count)
|
||||
|
||||
Move cursor up a specific amount of rows. Default is `1`.
|
||||
|
||||
### cursorDown(count)
|
||||
|
||||
Move cursor down a specific amount of rows. Default is `1`.
|
||||
|
||||
### cursorForward(count)
|
||||
|
||||
Move cursor forward a specific amount of columns. Default is `1`.
|
||||
|
||||
### cursorBackward(count)
|
||||
|
||||
Move cursor backward a specific amount of columns. Default is `1`.
|
||||
|
||||
### cursorLeft
|
||||
|
||||
Move cursor to the left side.
|
||||
|
||||
### cursorSavePosition
|
||||
|
||||
Save cursor position.
|
||||
|
||||
### cursorRestorePosition
|
||||
|
||||
Restore saved cursor position.
|
||||
|
||||
### cursorGetPosition
|
||||
|
||||
Get cursor position.
|
||||
|
||||
### cursorNextLine
|
||||
|
||||
Move cursor to the next line.
|
||||
|
||||
### cursorPrevLine
|
||||
|
||||
Move cursor to the previous line.
|
||||
|
||||
### cursorHide
|
||||
|
||||
Hide cursor.
|
||||
|
||||
### cursorShow
|
||||
|
||||
Show cursor.
|
||||
|
||||
### eraseLines(count)
|
||||
|
||||
Erase from the current cursor position up the specified amount of rows.
|
||||
|
||||
### eraseEndLine
|
||||
|
||||
Erase from the current cursor position to the end of the current line.
|
||||
|
||||
### eraseStartLine
|
||||
|
||||
Erase from the current cursor position to the start of the current line.
|
||||
|
||||
### eraseLine
|
||||
|
||||
Erase the entire current line.
|
||||
|
||||
### eraseDown
|
||||
|
||||
Erase the screen from the current line down to the bottom of the screen.
|
||||
|
||||
### eraseUp
|
||||
|
||||
Erase the screen from the current line up to the top of the screen.
|
||||
|
||||
### eraseScreen
|
||||
|
||||
Erase the screen and move the cursor the top left position.
|
||||
|
||||
### scrollUp
|
||||
|
||||
Scroll display up one line.
|
||||
|
||||
### scrollDown
|
||||
|
||||
Scroll display down one line.
|
||||
|
||||
### clearScreen
|
||||
|
||||
Clear the terminal screen. (Viewport)
|
||||
|
||||
### clearTerminal
|
||||
|
||||
Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
|
||||
|
||||
### beep
|
||||
|
||||
Output a beeping sound.
|
||||
|
||||
### link(text, url)
|
||||
|
||||
Create a clickable link.
|
||||
|
||||
[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
|
||||
|
||||
### image(filePath, options?)
|
||||
|
||||
Display an image.
|
||||
|
||||
*Currently only supported on iTerm2 >=3*
|
||||
|
||||
See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
Buffer of an image. Usually read in with `fs.readFile()`.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### width
|
||||
##### height
|
||||
|
||||
Type: `string | number`
|
||||
|
||||
The width and height are given as a number followed by a unit, or the word "auto".
|
||||
|
||||
- `N`: N character cells.
|
||||
- `Npx`: N pixels.
|
||||
- `N%`: N percent of the session's width or height.
|
||||
- `auto`: The image's inherent size will be used to determine an appropriate dimension.
|
||||
|
||||
##### preserveAspectRatio
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
### iTerm.setCwd(path?)
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
|
||||
|
||||
### iTerm.annotation(message, options?)
|
||||
|
||||
Creates an escape code to display an "annotation" in iTerm2.
|
||||
|
||||
An annotation looks like this when shown:
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png" width="500">
|
||||
|
||||
See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
|
||||
|
||||
#### message
|
||||
|
||||
Type: `string`
|
||||
|
||||
The message to display within the annotation.
|
||||
|
||||
The `|` character is disallowed and will be stripped.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### length
|
||||
|
||||
Type: `number`\
|
||||
Default: The remainder of the line
|
||||
|
||||
Nonzero number of columns to annotate.
|
||||
|
||||
##### x
|
||||
|
||||
Type: `number`\
|
||||
Default: Cursor position
|
||||
|
||||
Starting X coordinate.
|
||||
|
||||
Must be used with `y` and `length`.
|
||||
|
||||
##### y
|
||||
|
||||
Type: `number`\
|
||||
Default: Cursor position
|
||||
|
||||
Starting Y coordinate.
|
||||
|
||||
Must be used with `x` and `length`.
|
||||
|
||||
##### isHidden
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Create a "hidden" annotation.
|
||||
|
||||
Annotations created this way can be shown using the "Show Annotations" iTerm command.
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
@@ -0,0 +1,20 @@
|
||||
var test = require('tap').test;
|
||||
var detective = require('../');
|
||||
var fs = require('fs');
|
||||
var src = fs.readFileSync(__dirname + '/files/isrequire.js');
|
||||
|
||||
test('word', function (t) {
|
||||
t.deepEqual(
|
||||
detective(src, { isRequire: function(node) {
|
||||
return (node.type === 'CallExpression' &&
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.object.type == 'Identifier' &&
|
||||
node.callee.object.name == 'require' &&
|
||||
node.callee.property.type == 'Identifier' &&
|
||||
node.callee.property.name == 'async')
|
||||
} }),
|
||||
[ 'a', 'b', 'c', 'events', 'doom', 'y', 'events2' ]
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('flag boolean true (default all --args to boolean)', function (t) {
|
||||
var argv = parse(['moo', '--honk', 'cow'], {
|
||||
boolean: true,
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
honk: true,
|
||||
_: ['moo', 'cow'],
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.honk, 'boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('flag boolean true only affects double hyphen arguments without equals signs', function (t) {
|
||||
var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
|
||||
boolean: true,
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
honk: true,
|
||||
tacos: 'good',
|
||||
p: 55,
|
||||
_: ['moo', 'cow'],
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.honk, 'boolean');
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').constant;
|
||||
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "6.2.3";
|
||||
@@ -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":"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":"DC tB I v J D E F A B C K L G M EC FC","129":"CB DB EB FB GB HB","420":"0 1 2 3 4 5 6 7 8 9 N O w g x y z AB BB"},D:{"1":"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":"I v J D E F A B C K L G M N O w g","420":"0 1 2 3 4 5 6 7 8 9 x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB"},E:{"1":"B C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A HC zB IC JC KC LC 0B"},F:{"1":"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":"F B G M N PC QC RC SC qB AC TC","420":"0 1 2 3 4 5 6 7 8 9 C O w g x y z AB BB CB DB EB FB rB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC","513":"kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","1537":"dC eC fC gC hC iC jC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D","420":"A"},K:{"1":"h","2":"A B qB AC","420":"C rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","420":"I wC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:4,C:"getUserMedia/Stream API"};
|
||||
@@ -0,0 +1,5 @@
|
||||
import assertString from './util/assertString';
|
||||
export default function whitelist(str, chars) {
|
||||
assertString(str);
|
||||
return str.replace(new RegExp("[^".concat(chars, "]+"), 'g'), '');
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* A specialized version of `_.filter` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {Array} Returns the new filtered array.
|
||||
*/
|
||||
function arrayFilter(array, predicate) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length,
|
||||
resIndex = 0,
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (predicate(value, index, array)) {
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = arrayFilter;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,304 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { ObservableInput, SchedulerLike, ObservedValueOf, ObservableInputTuple } from '../types';
|
||||
import { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { from } from './from';
|
||||
import { identity } from '../util/identity';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';
|
||||
import { popResultSelector, popScheduler } from '../util/args';
|
||||
import { createObject } from '../util/createObject';
|
||||
import { createOperatorSubscriber } from '../operators/OperatorSubscriber';
|
||||
import { AnyCatcher } from '../AnyCatcher';
|
||||
import { executeSchedule } from '../util/executeSchedule';
|
||||
|
||||
// combineLatest(any)
|
||||
// We put this first because we need to catch cases where the user has supplied
|
||||
// _exactly `any`_ as the argument. Since `any` literally matches _anything_,
|
||||
// we don't want it to randomly hit one of the other type signatures below,
|
||||
// as we have no idea at build-time what type we should be returning when given an any.
|
||||
|
||||
/**
|
||||
* You have passed `any` here, we can't figure out if it is
|
||||
* an array or an object, so you're getting `unknown`. Use better types.
|
||||
* @param arg Something typed as `any`
|
||||
*/
|
||||
export function combineLatest<T extends AnyCatcher>(arg: T): Observable<unknown>;
|
||||
|
||||
// combineLatest([a, b, c])
|
||||
export function combineLatest(sources: []): Observable<never>;
|
||||
export function combineLatest<A extends readonly unknown[]>(sources: readonly [...ObservableInputTuple<A>]): Observable<A>;
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export function combineLatest<A extends readonly unknown[], R>(
|
||||
sources: readonly [...ObservableInputTuple<A>],
|
||||
resultSelector: (...values: A) => R,
|
||||
scheduler: SchedulerLike
|
||||
): Observable<R>;
|
||||
export function combineLatest<A extends readonly unknown[], R>(
|
||||
sources: readonly [...ObservableInputTuple<A>],
|
||||
resultSelector: (...values: A) => R
|
||||
): Observable<R>;
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export function combineLatest<A extends readonly unknown[]>(
|
||||
sources: readonly [...ObservableInputTuple<A>],
|
||||
scheduler: SchedulerLike
|
||||
): Observable<A>;
|
||||
|
||||
// combineLatest(a, b, c)
|
||||
/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */
|
||||
export function combineLatest<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export function combineLatest<A extends readonly unknown[], R>(
|
||||
...sourcesAndResultSelectorAndScheduler: [...ObservableInputTuple<A>, (...values: A) => R, SchedulerLike]
|
||||
): Observable<R>;
|
||||
/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */
|
||||
export function combineLatest<A extends readonly unknown[], R>(
|
||||
...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]
|
||||
): Observable<R>;
|
||||
/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
|
||||
export function combineLatest<A extends readonly unknown[]>(
|
||||
...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike]
|
||||
): Observable<A>;
|
||||
|
||||
// combineLatest({a, b, c})
|
||||
export function combineLatest(sourcesObject: { [K in any]: never }): Observable<never>;
|
||||
export function combineLatest<T extends Record<string, ObservableInput<any>>>(
|
||||
sourcesObject: T
|
||||
): Observable<{ [K in keyof T]: ObservedValueOf<T[K]> }>;
|
||||
|
||||
/**
|
||||
* Combines multiple Observables to create an Observable whose values are
|
||||
* calculated from the latest values of each of its input Observables.
|
||||
*
|
||||
* <span class="informal">Whenever any input Observable emits a value, it
|
||||
* computes a formula using the latest values from all the inputs, then emits
|
||||
* the output of that formula.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `combineLatest` combines the values from all the Observables passed in the
|
||||
* observables array. This is done by subscribing to each Observable in order and,
|
||||
* whenever any Observable emits, collecting an array of the most recent
|
||||
* values from each Observable. So if you pass `n` Observables to this operator,
|
||||
* the returned Observable will always emit an array of `n` values, in an order
|
||||
* corresponding to the order of the passed Observables (the value from the first Observable
|
||||
* will be at index 0 of the array and so on).
|
||||
*
|
||||
* Static version of `combineLatest` accepts an array of Observables. Note that an array of
|
||||
* Observables is a good choice, if you don't know beforehand how many Observables
|
||||
* you will combine. Passing an empty array will result in an Observable that
|
||||
* completes immediately.
|
||||
*
|
||||
* To ensure the output array always has the same length, `combineLatest` will
|
||||
* actually wait for all input Observables to emit at least once,
|
||||
* before it starts emitting results. This means if some Observable emits
|
||||
* values before other Observables started emitting, all these values but the last
|
||||
* will be lost. On the other hand, if some Observable does not emit a value but
|
||||
* completes, resulting Observable will complete at the same moment without
|
||||
* emitting anything, since it will now be impossible to include a value from the
|
||||
* completed Observable in the resulting array. Also, if some input Observable does
|
||||
* not emit any value and never completes, `combineLatest` will also never emit
|
||||
* and never complete, since, again, it will wait for all streams to emit some
|
||||
* value.
|
||||
*
|
||||
* If at least one Observable was passed to `combineLatest` and all passed Observables
|
||||
* emitted something, the resulting Observable will complete when all combined
|
||||
* streams complete. So even if some Observable completes, the result of
|
||||
* `combineLatest` will still emit values when other Observables do. In case
|
||||
* of a completed Observable, its value from now on will always be the last
|
||||
* emitted value. On the other hand, if any Observable errors, `combineLatest`
|
||||
* will error immediately as well, and all other Observables will be unsubscribed.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Combine two timer Observables
|
||||
*
|
||||
* ```ts
|
||||
* import { timer, combineLatest } from 'rxjs';
|
||||
*
|
||||
* const firstTimer = timer(0, 1000); // emit 0, 1, 2... after every second, starting from now
|
||||
* const secondTimer = timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now
|
||||
* const combinedTimers = combineLatest([firstTimer, secondTimer]);
|
||||
* combinedTimers.subscribe(value => console.log(value));
|
||||
* // Logs
|
||||
* // [0, 0] after 0.5s
|
||||
* // [1, 0] after 1s
|
||||
* // [1, 1] after 1.5s
|
||||
* // [2, 1] after 2s
|
||||
* ```
|
||||
*
|
||||
* Combine a dictionary of Observables
|
||||
*
|
||||
* ```ts
|
||||
* import { of, delay, startWith, combineLatest } from 'rxjs';
|
||||
*
|
||||
* const observables = {
|
||||
* a: of(1).pipe(delay(1000), startWith(0)),
|
||||
* b: of(5).pipe(delay(5000), startWith(0)),
|
||||
* c: of(10).pipe(delay(10000), startWith(0))
|
||||
* };
|
||||
* const combined = combineLatest(observables);
|
||||
* combined.subscribe(value => console.log(value));
|
||||
* // Logs
|
||||
* // { a: 0, b: 0, c: 0 } immediately
|
||||
* // { a: 1, b: 0, c: 0 } after 1s
|
||||
* // { a: 1, b: 5, c: 0 } after 5s
|
||||
* // { a: 1, b: 5, c: 10 } after 10s
|
||||
* ```
|
||||
*
|
||||
* Combine an array of Observables
|
||||
*
|
||||
* ```ts
|
||||
* import { of, delay, startWith, combineLatest } from 'rxjs';
|
||||
*
|
||||
* const observables = [1, 5, 10].map(
|
||||
* n => of(n).pipe(
|
||||
* delay(n * 1000), // emit 0 and then emit n after n seconds
|
||||
* startWith(0)
|
||||
* )
|
||||
* );
|
||||
* const combined = combineLatest(observables);
|
||||
* combined.subscribe(value => console.log(value));
|
||||
* // Logs
|
||||
* // [0, 0, 0] immediately
|
||||
* // [1, 0, 0] after 1s
|
||||
* // [1, 5, 0] after 5s
|
||||
* // [1, 5, 10] after 10s
|
||||
* ```
|
||||
*
|
||||
* Use map operator to dynamically calculate the Body-Mass Index
|
||||
*
|
||||
* ```ts
|
||||
* import { of, combineLatest, map } from 'rxjs';
|
||||
*
|
||||
* const weight = of(70, 72, 76, 79, 75);
|
||||
* const height = of(1.76, 1.77, 1.78);
|
||||
* const bmi = combineLatest([weight, height]).pipe(
|
||||
* map(([w, h]) => w / (h * h)),
|
||||
* );
|
||||
* bmi.subscribe(x => console.log('BMI is ' + x));
|
||||
*
|
||||
* // With output to console:
|
||||
* // BMI is 24.212293388429753
|
||||
* // BMI is 23.93948099205209
|
||||
* // BMI is 23.671253629592222
|
||||
* ```
|
||||
*
|
||||
* @see {@link combineLatestAll}
|
||||
* @see {@link merge}
|
||||
* @see {@link withLatestFrom}
|
||||
*
|
||||
* @param {ObservableInput} [observables] An array of input Observables to combine with each other.
|
||||
* An array of Observables must be given as the first argument.
|
||||
* @param {function} [project] An optional function to project the values from
|
||||
* the combined latest values into a new value on the output Observable.
|
||||
* @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for subscribing to
|
||||
* each input Observable.
|
||||
* @return {Observable} An Observable of projected values from the most recent
|
||||
* values from each input Observable, or an array of the most recent values from
|
||||
* each input Observable.
|
||||
*/
|
||||
export function combineLatest<O extends ObservableInput<any>, R>(...args: any[]): Observable<R> | Observable<ObservedValueOf<O>[]> {
|
||||
const scheduler = popScheduler(args);
|
||||
const resultSelector = popResultSelector(args);
|
||||
|
||||
const { args: observables, keys } = argsArgArrayOrObject(args);
|
||||
|
||||
if (observables.length === 0) {
|
||||
// If no observables are passed, or someone has passed an empty array
|
||||
// of observables, or even an empty object POJO, we need to just
|
||||
// complete (EMPTY), but we have to honor the scheduler provided if any.
|
||||
return from([], scheduler as any);
|
||||
}
|
||||
|
||||
const result = new Observable<ObservedValueOf<O>[]>(
|
||||
combineLatestInit(
|
||||
observables as ObservableInput<ObservedValueOf<O>>[],
|
||||
scheduler,
|
||||
keys
|
||||
? // A handler for scrubbing the array of args into a dictionary.
|
||||
(values) => createObject(keys, values)
|
||||
: // A passthrough to just return the array
|
||||
identity
|
||||
)
|
||||
);
|
||||
|
||||
return resultSelector ? (result.pipe(mapOneOrManyArgs(resultSelector)) as Observable<R>) : result;
|
||||
}
|
||||
|
||||
export function combineLatestInit(
|
||||
observables: ObservableInput<any>[],
|
||||
scheduler?: SchedulerLike,
|
||||
valueTransform: (values: any[]) => any = identity
|
||||
) {
|
||||
return (subscriber: Subscriber<any>) => {
|
||||
// The outer subscription. We're capturing this in a function
|
||||
// because we may have to schedule it.
|
||||
maybeSchedule(
|
||||
scheduler,
|
||||
() => {
|
||||
const { length } = observables;
|
||||
// A store for the values each observable has emitted so far. We match observable to value on index.
|
||||
const values = new Array(length);
|
||||
// The number of currently active subscriptions, as they complete, we decrement this number to see if
|
||||
// we are all done combining values, so we can complete the result.
|
||||
let active = length;
|
||||
// The number of inner sources that still haven't emitted the first value
|
||||
// We need to track this because all sources need to emit one value in order
|
||||
// to start emitting values.
|
||||
let remainingFirstValues = length;
|
||||
// The loop to kick off subscription. We're keying everything on index `i` to relate the observables passed
|
||||
// in to the slot in the output array or the key in the array of keys in the output dictionary.
|
||||
for (let i = 0; i < length; i++) {
|
||||
maybeSchedule(
|
||||
scheduler,
|
||||
() => {
|
||||
const source = from(observables[i], scheduler as any);
|
||||
let hasFirstValue = false;
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => {
|
||||
// When we get a value, record it in our set of values.
|
||||
values[i] = value;
|
||||
if (!hasFirstValue) {
|
||||
// If this is our first value, record that.
|
||||
hasFirstValue = true;
|
||||
remainingFirstValues--;
|
||||
}
|
||||
if (!remainingFirstValues) {
|
||||
// We're not waiting for any more
|
||||
// first values, so we can emit!
|
||||
subscriber.next(valueTransform(values.slice()));
|
||||
}
|
||||
},
|
||||
() => {
|
||||
if (!--active) {
|
||||
// We only complete the result if we have no more active
|
||||
// inner observables.
|
||||
subscriber.complete();
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
},
|
||||
subscriber
|
||||
);
|
||||
}
|
||||
},
|
||||
subscriber
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A small utility to handle the couple of locations where we want to schedule if a scheduler was provided,
|
||||
* but we don't if there was no scheduler.
|
||||
*/
|
||||
function maybeSchedule(scheduler: SchedulerLike | undefined, execute: () => void, subscription: Subscription) {
|
||||
if (scheduler) {
|
||||
executeSchedule(subscription, scheduler, execute);
|
||||
} else {
|
||||
execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { config } from '../config';
|
||||
import { timeoutProvider } from '../scheduler/timeoutProvider';
|
||||
export function reportUnhandledError(err) {
|
||||
timeoutProvider.setTimeout(function () {
|
||||
var onUnhandledError = config.onUnhandledError;
|
||||
if (onUnhandledError) {
|
||||
onUnhandledError(err);
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=reportUnhandledError.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscribable } from '../types';
|
||||
|
||||
/**
|
||||
* Used to convert a subscribable to an observable.
|
||||
*
|
||||
* Currently, this is only used within internals.
|
||||
*
|
||||
* TODO: Discuss ObservableInput supporting "Subscribable".
|
||||
* https://github.com/ReactiveX/rxjs/issues/5909
|
||||
*
|
||||
* @param subscribable A subscribable
|
||||
*/
|
||||
export function fromSubscribable<T>(subscribable: Subscribable<T>) {
|
||||
return new Observable((subscriber: Subscriber<T>) => subscribable.subscribe(subscriber));
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
var fs = require('fs')
|
||||
var polyfills = require('./polyfills.js')
|
||||
var legacy = require('./legacy-streams.js')
|
||||
var clone = require('./clone.js')
|
||||
|
||||
var util = require('util')
|
||||
|
||||
/* istanbul ignore next - node 0.x polyfill */
|
||||
var gracefulQueue
|
||||
var previousSymbol
|
||||
|
||||
/* istanbul ignore else - node 0.x polyfill */
|
||||
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
||||
gracefulQueue = Symbol.for('graceful-fs.queue')
|
||||
// This is used in testing by future versions
|
||||
previousSymbol = Symbol.for('graceful-fs.previous')
|
||||
} else {
|
||||
gracefulQueue = '___graceful-fs.queue'
|
||||
previousSymbol = '___graceful-fs.previous'
|
||||
}
|
||||
|
||||
function noop () {}
|
||||
|
||||
function publishQueue(context, queue) {
|
||||
Object.defineProperty(context, gracefulQueue, {
|
||||
get: function() {
|
||||
return queue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var debug = noop
|
||||
if (util.debuglog)
|
||||
debug = util.debuglog('gfs4')
|
||||
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
||||
debug = function() {
|
||||
var m = util.format.apply(util, arguments)
|
||||
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
|
||||
console.error(m)
|
||||
}
|
||||
|
||||
// Once time initialization
|
||||
if (!fs[gracefulQueue]) {
|
||||
// This queue can be shared by multiple loaded instances
|
||||
var queue = global[gracefulQueue] || []
|
||||
publishQueue(fs, queue)
|
||||
|
||||
// Patch fs.close/closeSync to shared queue version, because we need
|
||||
// to retry() whenever a close happens *anywhere* in the program.
|
||||
// This is essential when multiple graceful-fs instances are
|
||||
// in play at the same time.
|
||||
fs.close = (function (fs$close) {
|
||||
function close (fd, cb) {
|
||||
return fs$close.call(fs, fd, function (err) {
|
||||
// This function uses the graceful-fs shared queue
|
||||
if (!err) {
|
||||
resetQueue()
|
||||
}
|
||||
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
})
|
||||
}
|
||||
|
||||
Object.defineProperty(close, previousSymbol, {
|
||||
value: fs$close
|
||||
})
|
||||
return close
|
||||
})(fs.close)
|
||||
|
||||
fs.closeSync = (function (fs$closeSync) {
|
||||
function closeSync (fd) {
|
||||
// This function uses the graceful-fs shared queue
|
||||
fs$closeSync.apply(fs, arguments)
|
||||
resetQueue()
|
||||
}
|
||||
|
||||
Object.defineProperty(closeSync, previousSymbol, {
|
||||
value: fs$closeSync
|
||||
})
|
||||
return closeSync
|
||||
})(fs.closeSync)
|
||||
|
||||
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
||||
process.on('exit', function() {
|
||||
debug(fs[gracefulQueue])
|
||||
require('assert').equal(fs[gracefulQueue].length, 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!global[gracefulQueue]) {
|
||||
publishQueue(global, fs[gracefulQueue]);
|
||||
}
|
||||
|
||||
module.exports = patch(clone(fs))
|
||||
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
||||
module.exports = patch(fs)
|
||||
fs.__patched = true;
|
||||
}
|
||||
|
||||
function patch (fs) {
|
||||
// Everything that references the open() function needs to be in here
|
||||
polyfills(fs)
|
||||
fs.gracefulify = patch
|
||||
|
||||
fs.createReadStream = createReadStream
|
||||
fs.createWriteStream = createWriteStream
|
||||
var fs$readFile = fs.readFile
|
||||
fs.readFile = readFile
|
||||
function readFile (path, options, cb) {
|
||||
if (typeof options === 'function')
|
||||
cb = options, options = null
|
||||
|
||||
return go$readFile(path, options, cb)
|
||||
|
||||
function go$readFile (path, options, cb, startTime) {
|
||||
return fs$readFile(path, options, function (err) {
|
||||
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
||||
enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])
|
||||
else {
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var fs$writeFile = fs.writeFile
|
||||
fs.writeFile = writeFile
|
||||
function writeFile (path, data, options, cb) {
|
||||
if (typeof options === 'function')
|
||||
cb = options, options = null
|
||||
|
||||
return go$writeFile(path, data, options, cb)
|
||||
|
||||
function go$writeFile (path, data, options, cb, startTime) {
|
||||
return fs$writeFile(path, data, options, function (err) {
|
||||
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
||||
enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
|
||||
else {
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var fs$appendFile = fs.appendFile
|
||||
if (fs$appendFile)
|
||||
fs.appendFile = appendFile
|
||||
function appendFile (path, data, options, cb) {
|
||||
if (typeof options === 'function')
|
||||
cb = options, options = null
|
||||
|
||||
return go$appendFile(path, data, options, cb)
|
||||
|
||||
function go$appendFile (path, data, options, cb, startTime) {
|
||||
return fs$appendFile(path, data, options, function (err) {
|
||||
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
||||
enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
|
||||
else {
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var fs$copyFile = fs.copyFile
|
||||
if (fs$copyFile)
|
||||
fs.copyFile = copyFile
|
||||
function copyFile (src, dest, flags, cb) {
|
||||
if (typeof flags === 'function') {
|
||||
cb = flags
|
||||
flags = 0
|
||||
}
|
||||
return go$copyFile(src, dest, flags, cb)
|
||||
|
||||
function go$copyFile (src, dest, flags, cb, startTime) {
|
||||
return fs$copyFile(src, dest, flags, function (err) {
|
||||
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
||||
enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
|
||||
else {
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var fs$readdir = fs.readdir
|
||||
fs.readdir = readdir
|
||||
var noReaddirOptionVersions = /^v[0-5]\./
|
||||
function readdir (path, options, cb) {
|
||||
if (typeof options === 'function')
|
||||
cb = options, options = null
|
||||
|
||||
var go$readdir = noReaddirOptionVersions.test(process.version)
|
||||
? function go$readdir (path, options, cb, startTime) {
|
||||
return fs$readdir(path, fs$readdirCallback(
|
||||
path, options, cb, startTime
|
||||
))
|
||||
}
|
||||
: function go$readdir (path, options, cb, startTime) {
|
||||
return fs$readdir(path, options, fs$readdirCallback(
|
||||
path, options, cb, startTime
|
||||
))
|
||||
}
|
||||
|
||||
return go$readdir(path, options, cb)
|
||||
|
||||
function fs$readdirCallback (path, options, cb, startTime) {
|
||||
return function (err, files) {
|
||||
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
||||
enqueue([
|
||||
go$readdir,
|
||||
[path, options, cb],
|
||||
err,
|
||||
startTime || Date.now(),
|
||||
Date.now()
|
||||
])
|
||||
else {
|
||||
if (files && files.sort)
|
||||
files.sort()
|
||||
|
||||
if (typeof cb === 'function')
|
||||
cb.call(this, err, files)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process.version.substr(0, 4) === 'v0.8') {
|
||||
var legStreams = legacy(fs)
|
||||
ReadStream = legStreams.ReadStream
|
||||
WriteStream = legStreams.WriteStream
|
||||
}
|
||||
|
||||
var fs$ReadStream = fs.ReadStream
|
||||
if (fs$ReadStream) {
|
||||
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
|
||||
ReadStream.prototype.open = ReadStream$open
|
||||
}
|
||||
|
||||
var fs$WriteStream = fs.WriteStream
|
||||
if (fs$WriteStream) {
|
||||
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
|
||||
WriteStream.prototype.open = WriteStream$open
|
||||
}
|
||||
|
||||
Object.defineProperty(fs, 'ReadStream', {
|
||||
get: function () {
|
||||
return ReadStream
|
||||
},
|
||||
set: function (val) {
|
||||
ReadStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
Object.defineProperty(fs, 'WriteStream', {
|
||||
get: function () {
|
||||
return WriteStream
|
||||
},
|
||||
set: function (val) {
|
||||
WriteStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
|
||||
// legacy names
|
||||
var FileReadStream = ReadStream
|
||||
Object.defineProperty(fs, 'FileReadStream', {
|
||||
get: function () {
|
||||
return FileReadStream
|
||||
},
|
||||
set: function (val) {
|
||||
FileReadStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
var FileWriteStream = WriteStream
|
||||
Object.defineProperty(fs, 'FileWriteStream', {
|
||||
get: function () {
|
||||
return FileWriteStream
|
||||
},
|
||||
set: function (val) {
|
||||
FileWriteStream = val
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
|
||||
function ReadStream (path, options) {
|
||||
if (this instanceof ReadStream)
|
||||
return fs$ReadStream.apply(this, arguments), this
|
||||
else
|
||||
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
|
||||
}
|
||||
|
||||
function ReadStream$open () {
|
||||
var that = this
|
||||
open(that.path, that.flags, that.mode, function (err, fd) {
|
||||
if (err) {
|
||||
if (that.autoClose)
|
||||
that.destroy()
|
||||
|
||||
that.emit('error', err)
|
||||
} else {
|
||||
that.fd = fd
|
||||
that.emit('open', fd)
|
||||
that.read()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function WriteStream (path, options) {
|
||||
if (this instanceof WriteStream)
|
||||
return fs$WriteStream.apply(this, arguments), this
|
||||
else
|
||||
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
|
||||
}
|
||||
|
||||
function WriteStream$open () {
|
||||
var that = this
|
||||
open(that.path, that.flags, that.mode, function (err, fd) {
|
||||
if (err) {
|
||||
that.destroy()
|
||||
that.emit('error', err)
|
||||
} else {
|
||||
that.fd = fd
|
||||
that.emit('open', fd)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function createReadStream (path, options) {
|
||||
return new fs.ReadStream(path, options)
|
||||
}
|
||||
|
||||
function createWriteStream (path, options) {
|
||||
return new fs.WriteStream(path, options)
|
||||
}
|
||||
|
||||
var fs$open = fs.open
|
||||
fs.open = open
|
||||
function open (path, flags, mode, cb) {
|
||||
if (typeof mode === 'function')
|
||||
cb = mode, mode = null
|
||||
|
||||
return go$open(path, flags, mode, cb)
|
||||
|
||||
function go$open (path, flags, mode, cb, startTime) {
|
||||
return fs$open(path, flags, mode, function (err, fd) {
|
||||
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
||||
enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])
|
||||
else {
|
||||
if (typeof cb === 'function')
|
||||
cb.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return fs
|
||||
}
|
||||
|
||||
function enqueue (elem) {
|
||||
debug('ENQUEUE', elem[0].name, elem[1])
|
||||
fs[gracefulQueue].push(elem)
|
||||
retry()
|
||||
}
|
||||
|
||||
// keep track of the timeout between retry() calls
|
||||
var retryTimer
|
||||
|
||||
// reset the startTime and lastTime to now
|
||||
// this resets the start of the 60 second overall timeout as well as the
|
||||
// delay between attempts so that we'll retry these jobs sooner
|
||||
function resetQueue () {
|
||||
var now = Date.now()
|
||||
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
|
||||
// entries that are only a length of 2 are from an older version, don't
|
||||
// bother modifying those since they'll be retried anyway.
|
||||
if (fs[gracefulQueue][i].length > 2) {
|
||||
fs[gracefulQueue][i][3] = now // startTime
|
||||
fs[gracefulQueue][i][4] = now // lastTime
|
||||
}
|
||||
}
|
||||
// call retry to make sure we're actively processing the queue
|
||||
retry()
|
||||
}
|
||||
|
||||
function retry () {
|
||||
// clear the timer and remove it to help prevent unintended concurrency
|
||||
clearTimeout(retryTimer)
|
||||
retryTimer = undefined
|
||||
|
||||
if (fs[gracefulQueue].length === 0)
|
||||
return
|
||||
|
||||
var elem = fs[gracefulQueue].shift()
|
||||
var fn = elem[0]
|
||||
var args = elem[1]
|
||||
// these items may be unset if they were added by an older graceful-fs
|
||||
var err = elem[2]
|
||||
var startTime = elem[3]
|
||||
var lastTime = elem[4]
|
||||
|
||||
// if we don't have a startTime we have no way of knowing if we've waited
|
||||
// long enough, so go ahead and retry this item now
|
||||
if (startTime === undefined) {
|
||||
debug('RETRY', fn.name, args)
|
||||
fn.apply(null, args)
|
||||
} else if (Date.now() - startTime >= 60000) {
|
||||
// it's been more than 60 seconds total, bail now
|
||||
debug('TIMEOUT', fn.name, args)
|
||||
var cb = args.pop()
|
||||
if (typeof cb === 'function')
|
||||
cb.call(null, err)
|
||||
} else {
|
||||
// the amount of time between the last attempt and right now
|
||||
var sinceAttempt = Date.now() - lastTime
|
||||
// the amount of time between when we first tried, and when we last tried
|
||||
// rounded up to at least 1
|
||||
var sinceStart = Math.max(lastTime - startTime, 1)
|
||||
// backoff. wait longer than the total time we've been retrying, but only
|
||||
// up to a maximum of 100ms
|
||||
var desiredDelay = Math.min(sinceStart * 1.2, 100)
|
||||
// it's been long enough since the last retry, do it again
|
||||
if (sinceAttempt >= desiredDelay) {
|
||||
debug('RETRY', fn.name, args)
|
||||
fn.apply(null, args.concat([startTime]))
|
||||
} else {
|
||||
// if we can't do this job yet, push it to the end of the queue
|
||||
// and let the next iteration check again
|
||||
fs[gracefulQueue].push(elem)
|
||||
}
|
||||
}
|
||||
|
||||
// schedule our next run if one isn't already scheduled
|
||||
if (retryTimer === undefined) {
|
||||
retryTimer = setTimeout(retry, 0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "string_decoder",
|
||||
"version": "0.10.31",
|
||||
"description": "The string_decoder module from Node core",
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "~0.4.8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/simple/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/rvagg/string_decoder.git"
|
||||
},
|
||||
"homepage": "https://github.com/rvagg/string_decoder",
|
||||
"keywords": [
|
||||
"string",
|
||||
"decoder",
|
||||
"browser",
|
||||
"browserify"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
'use strict';
|
||||
// See https://github.com/facebook/jest/issues/2549
|
||||
// eslint-disable-next-line node/prefer-global/url
|
||||
const {URL, urlToHttpOptions} = require('url');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const resolveALPN = require('resolve-alpn');
|
||||
const QuickLRU = require('quick-lru');
|
||||
const {Agent, globalAgent} = require('./agent.js');
|
||||
const Http2ClientRequest = require('./client-request.js');
|
||||
const calculateServerName = require('./utils/calculate-server-name.js');
|
||||
const delayAsyncDestroy = require('./utils/delay-async-destroy.js');
|
||||
|
||||
const cache = new QuickLRU({maxSize: 100});
|
||||
const queue = new Map();
|
||||
|
||||
const installSocket = (agent, socket, options) => {
|
||||
socket._httpMessage = {shouldKeepAlive: true};
|
||||
|
||||
const onFree = () => {
|
||||
agent.emit('free', socket, options);
|
||||
};
|
||||
|
||||
socket.on('free', onFree);
|
||||
|
||||
const onClose = () => {
|
||||
agent.removeSocket(socket, options);
|
||||
};
|
||||
|
||||
socket.on('close', onClose);
|
||||
|
||||
const onTimeout = () => {
|
||||
const {freeSockets} = agent;
|
||||
|
||||
for (const sockets of Object.values(freeSockets)) {
|
||||
if (sockets.includes(socket)) {
|
||||
socket.destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
socket.on('timeout', onTimeout);
|
||||
|
||||
const onRemove = () => {
|
||||
agent.removeSocket(socket, options);
|
||||
socket.off('close', onClose);
|
||||
socket.off('free', onFree);
|
||||
socket.off('timeout', onTimeout);
|
||||
socket.off('agentRemove', onRemove);
|
||||
};
|
||||
|
||||
socket.on('agentRemove', onRemove);
|
||||
|
||||
agent.emit('free', socket, options);
|
||||
};
|
||||
|
||||
const createResolveProtocol = (cache, queue = new Map(), connect = undefined) => {
|
||||
return async options => {
|
||||
const name = `${options.host}:${options.port}:${options.ALPNProtocols.sort()}`;
|
||||
|
||||
if (!cache.has(name)) {
|
||||
if (queue.has(name)) {
|
||||
const result = await queue.get(name);
|
||||
return {alpnProtocol: result.alpnProtocol};
|
||||
}
|
||||
|
||||
const {path} = options;
|
||||
options.path = options.socketPath;
|
||||
|
||||
const resultPromise = resolveALPN(options, connect);
|
||||
queue.set(name, resultPromise);
|
||||
|
||||
try {
|
||||
const result = await resultPromise;
|
||||
|
||||
cache.set(name, result.alpnProtocol);
|
||||
queue.delete(name);
|
||||
|
||||
options.path = path;
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
queue.delete(name);
|
||||
|
||||
options.path = path;
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return {alpnProtocol: cache.get(name)};
|
||||
};
|
||||
};
|
||||
|
||||
const defaultResolveProtocol = createResolveProtocol(cache, queue);
|
||||
|
||||
module.exports = async (input, options, callback) => {
|
||||
if (typeof input === 'string') {
|
||||
input = urlToHttpOptions(new URL(input));
|
||||
} else if (input instanceof URL) {
|
||||
input = urlToHttpOptions(input);
|
||||
} else {
|
||||
input = {...input};
|
||||
}
|
||||
|
||||
if (typeof options === 'function' || options === undefined) {
|
||||
// (options, callback)
|
||||
callback = options;
|
||||
options = input;
|
||||
} else {
|
||||
// (input, options, callback)
|
||||
options = Object.assign(input, options);
|
||||
}
|
||||
|
||||
options.ALPNProtocols = options.ALPNProtocols || ['h2', 'http/1.1'];
|
||||
|
||||
if (!Array.isArray(options.ALPNProtocols) || options.ALPNProtocols.length === 0) {
|
||||
throw new Error('The `ALPNProtocols` option must be an Array with at least one entry');
|
||||
}
|
||||
|
||||
options.protocol = options.protocol || 'https:';
|
||||
const isHttps = options.protocol === 'https:';
|
||||
|
||||
options.host = options.hostname || options.host || 'localhost';
|
||||
options.session = options.tlsSession;
|
||||
options.servername = options.servername || calculateServerName((options.headers && options.headers.host) || options.host);
|
||||
options.port = options.port || (isHttps ? 443 : 80);
|
||||
options._defaultAgent = isHttps ? https.globalAgent : http.globalAgent;
|
||||
|
||||
const resolveProtocol = options.resolveProtocol || defaultResolveProtocol;
|
||||
|
||||
// Note: We don't support `h2session` here
|
||||
|
||||
let {agent} = options;
|
||||
if (agent !== undefined && agent !== false && agent.constructor.name !== 'Object') {
|
||||
throw new Error('The `options.agent` can be only an object `http`, `https` or `http2` properties');
|
||||
}
|
||||
|
||||
if (isHttps) {
|
||||
options.resolveSocket = true;
|
||||
|
||||
let {socket, alpnProtocol, timeout} = await resolveProtocol(options);
|
||||
|
||||
if (timeout) {
|
||||
if (socket) {
|
||||
socket.destroy();
|
||||
}
|
||||
|
||||
const error = new Error(`Timed out resolving ALPN: ${options.timeout} ms`);
|
||||
error.code = 'ETIMEDOUT';
|
||||
error.ms = options.timeout;
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
// We can't accept custom `createConnection` because the API is different for HTTP/2
|
||||
if (socket && options.createConnection) {
|
||||
socket.destroy();
|
||||
socket = undefined;
|
||||
}
|
||||
|
||||
delete options.resolveSocket;
|
||||
|
||||
const isHttp2 = alpnProtocol === 'h2';
|
||||
|
||||
if (agent) {
|
||||
agent = isHttp2 ? agent.http2 : agent.https;
|
||||
options.agent = agent;
|
||||
}
|
||||
|
||||
if (agent === undefined) {
|
||||
agent = isHttp2 ? globalAgent : https.globalAgent;
|
||||
}
|
||||
|
||||
if (socket) {
|
||||
if (agent === false) {
|
||||
socket.destroy();
|
||||
} else {
|
||||
const defaultCreateConnection = (isHttp2 ? Agent : https.Agent).prototype.createConnection;
|
||||
|
||||
if (agent.createConnection === defaultCreateConnection) {
|
||||
if (isHttp2) {
|
||||
options._reuseSocket = socket;
|
||||
} else {
|
||||
installSocket(agent, socket, options);
|
||||
}
|
||||
} else {
|
||||
socket.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isHttp2) {
|
||||
return delayAsyncDestroy(new Http2ClientRequest(options, callback));
|
||||
}
|
||||
} else if (agent) {
|
||||
options.agent = agent.http;
|
||||
}
|
||||
|
||||
return delayAsyncDestroy(http.request(options, callback));
|
||||
};
|
||||
|
||||
module.exports.protocolCache = cache;
|
||||
module.exports.resolveProtocol = defaultResolveProtocol;
|
||||
module.exports.createResolveProtocol = createResolveProtocol;
|
||||
@@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
/***
|
||||
* Node External Editor
|
||||
*
|
||||
* Kevin Gravier <kevin@mrkmg.com>
|
||||
* MIT 2019
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var chardet_1 = require("chardet");
|
||||
var child_process_1 = require("child_process");
|
||||
var fs_1 = require("fs");
|
||||
var iconv_lite_1 = require("iconv-lite");
|
||||
var tmp_1 = require("tmp");
|
||||
var CreateFileError_1 = require("./errors/CreateFileError");
|
||||
exports.CreateFileError = CreateFileError_1.CreateFileError;
|
||||
var LaunchEditorError_1 = require("./errors/LaunchEditorError");
|
||||
exports.LaunchEditorError = LaunchEditorError_1.LaunchEditorError;
|
||||
var ReadFileError_1 = require("./errors/ReadFileError");
|
||||
exports.ReadFileError = ReadFileError_1.ReadFileError;
|
||||
var RemoveFileError_1 = require("./errors/RemoveFileError");
|
||||
exports.RemoveFileError = RemoveFileError_1.RemoveFileError;
|
||||
function edit(text, fileOptions) {
|
||||
if (text === void 0) { text = ""; }
|
||||
var editor = new ExternalEditor(text, fileOptions);
|
||||
editor.run();
|
||||
editor.cleanup();
|
||||
return editor.text;
|
||||
}
|
||||
exports.edit = edit;
|
||||
function editAsync(text, callback, fileOptions) {
|
||||
if (text === void 0) { text = ""; }
|
||||
var editor = new ExternalEditor(text, fileOptions);
|
||||
editor.runAsync(function (err, result) {
|
||||
if (err) {
|
||||
setImmediate(callback, err, null);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
editor.cleanup();
|
||||
setImmediate(callback, null, result);
|
||||
}
|
||||
catch (cleanupError) {
|
||||
setImmediate(callback, cleanupError, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.editAsync = editAsync;
|
||||
var ExternalEditor = /** @class */ (function () {
|
||||
function ExternalEditor(text, fileOptions) {
|
||||
if (text === void 0) { text = ""; }
|
||||
this.text = "";
|
||||
this.fileOptions = {};
|
||||
this.text = text;
|
||||
if (fileOptions) {
|
||||
this.fileOptions = fileOptions;
|
||||
}
|
||||
this.determineEditor();
|
||||
this.createTemporaryFile();
|
||||
}
|
||||
ExternalEditor.splitStringBySpace = function (str) {
|
||||
var pieces = [];
|
||||
var currentString = "";
|
||||
for (var strIndex = 0; strIndex < str.length; strIndex++) {
|
||||
var currentLetter = str[strIndex];
|
||||
if (strIndex > 0 && currentLetter === " " && str[strIndex - 1] !== "\\" && currentString.length > 0) {
|
||||
pieces.push(currentString);
|
||||
currentString = "";
|
||||
}
|
||||
else {
|
||||
currentString += currentLetter;
|
||||
}
|
||||
}
|
||||
if (currentString.length > 0) {
|
||||
pieces.push(currentString);
|
||||
}
|
||||
return pieces;
|
||||
};
|
||||
Object.defineProperty(ExternalEditor.prototype, "temp_file", {
|
||||
get: function () {
|
||||
console.log("DEPRECATED: temp_file. Use tempFile moving forward.");
|
||||
return this.tempFile;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ExternalEditor.prototype, "last_exit_status", {
|
||||
get: function () {
|
||||
console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward.");
|
||||
return this.lastExitStatus;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
ExternalEditor.prototype.run = function () {
|
||||
this.launchEditor();
|
||||
this.readTemporaryFile();
|
||||
return this.text;
|
||||
};
|
||||
ExternalEditor.prototype.runAsync = function (callback) {
|
||||
var _this = this;
|
||||
try {
|
||||
this.launchEditorAsync(function () {
|
||||
try {
|
||||
_this.readTemporaryFile();
|
||||
setImmediate(callback, null, _this.text);
|
||||
}
|
||||
catch (readError) {
|
||||
setImmediate(callback, readError, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (launchError) {
|
||||
setImmediate(callback, launchError, null);
|
||||
}
|
||||
};
|
||||
ExternalEditor.prototype.cleanup = function () {
|
||||
this.removeTemporaryFile();
|
||||
};
|
||||
ExternalEditor.prototype.determineEditor = function () {
|
||||
var editor = process.env.VISUAL ? process.env.VISUAL :
|
||||
process.env.EDITOR ? process.env.EDITOR :
|
||||
/^win/.test(process.platform) ? "notepad" :
|
||||
"vim";
|
||||
var editorOpts = ExternalEditor.splitStringBySpace(editor).map(function (piece) { return piece.replace("\\ ", " "); });
|
||||
var bin = editorOpts.shift();
|
||||
this.editor = { args: editorOpts, bin: bin };
|
||||
};
|
||||
ExternalEditor.prototype.createTemporaryFile = function () {
|
||||
try {
|
||||
this.tempFile = tmp_1.tmpNameSync(this.fileOptions);
|
||||
var opt = { encoding: "utf8" };
|
||||
if (this.fileOptions.hasOwnProperty("mode")) {
|
||||
opt.mode = this.fileOptions.mode;
|
||||
}
|
||||
fs_1.writeFileSync(this.tempFile, this.text, opt);
|
||||
}
|
||||
catch (createFileError) {
|
||||
throw new CreateFileError_1.CreateFileError(createFileError);
|
||||
}
|
||||
};
|
||||
ExternalEditor.prototype.readTemporaryFile = function () {
|
||||
try {
|
||||
var tempFileBuffer = fs_1.readFileSync(this.tempFile);
|
||||
if (tempFileBuffer.length === 0) {
|
||||
this.text = "";
|
||||
}
|
||||
else {
|
||||
var encoding = chardet_1.detect(tempFileBuffer).toString();
|
||||
if (!iconv_lite_1.encodingExists(encoding)) {
|
||||
// Probably a bad idea, but will at least prevent crashing
|
||||
encoding = "utf8";
|
||||
}
|
||||
this.text = iconv_lite_1.decode(tempFileBuffer, encoding);
|
||||
}
|
||||
}
|
||||
catch (readFileError) {
|
||||
throw new ReadFileError_1.ReadFileError(readFileError);
|
||||
}
|
||||
};
|
||||
ExternalEditor.prototype.removeTemporaryFile = function () {
|
||||
try {
|
||||
fs_1.unlinkSync(this.tempFile);
|
||||
}
|
||||
catch (removeFileError) {
|
||||
throw new RemoveFileError_1.RemoveFileError(removeFileError);
|
||||
}
|
||||
};
|
||||
ExternalEditor.prototype.launchEditor = function () {
|
||||
try {
|
||||
var editorProcess = child_process_1.spawnSync(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
|
||||
this.lastExitStatus = editorProcess.status;
|
||||
}
|
||||
catch (launchError) {
|
||||
throw new LaunchEditorError_1.LaunchEditorError(launchError);
|
||||
}
|
||||
};
|
||||
ExternalEditor.prototype.launchEditorAsync = function (callback) {
|
||||
var _this = this;
|
||||
try {
|
||||
var editorProcess = child_process_1.spawn(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
|
||||
editorProcess.on("exit", function (code) {
|
||||
_this.lastExitStatus = code;
|
||||
setImmediate(callback);
|
||||
});
|
||||
}
|
||||
catch (launchError) {
|
||||
throw new LaunchEditorError_1.LaunchEditorError(launchError);
|
||||
}
|
||||
};
|
||||
return ExternalEditor;
|
||||
}());
|
||||
exports.ExternalEditor = ExternalEditor;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../../src/internal/observable/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAEzE;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"object-keys","version":"1.1.1","files":{".editorconfig":{"checkedAt":1678883671537,"integrity":"sha512-p35O0lNr5b8Aha4N1dns/Zy3+rV1ZLx6ffSVcrlURzE+W3zbryu0BkQ6tiGeSgp248nP94ZxUa8iBmtp1ocZng==","mode":420,"size":276},".eslintrc":{"checkedAt":1678883671544,"integrity":"sha512-3QvgWJHSCGQBz9T/mAr+Zc6RttTiKupnJKwn+ZKIMRwv5p8MTa3BZhy/bAMQ/g/6R9aeGyZOmCHW7wCm9MLeWA==","mode":420,"size":426},"package.json":{"checkedAt":1678883671544,"integrity":"sha512-PyyEK/0lG1skWLTJ9CUOhTjjmKydtt9RvTvjp7/yfcSqntO+rHqrvr3bqyE8bbBtg3rHK4OQXSaW1CsVLwOHzQ==","mode":420,"size":1903},".travis.yml":{"checkedAt":1678883671544,"integrity":"sha512-DtFxjMHBO6Yjq9/7IUGBth+84nSlZ+fiUVFtD1ClKCoWpO7Gai32lD4ut/sMUSuybjs/eVAAYeJ6kOhVBKZYfA==","mode":420,"size":8330},"CHANGELOG.md":{"checkedAt":1678883671546,"integrity":"sha512-OCrwljwqj/81DWh8gBwtJLPftg3f9I4iX2QQyHNjCZLVjfllF+PnA7m5YLAyqvgIvWcuxYTWkQDnv+DAEPe13w==","mode":420,"size":7545},"implementation.js":{"checkedAt":1678883671546,"integrity":"sha512-eGSW4tbtyvnOQM199GBbV0IctuvxCpAI5gsMFbxduOrJjMRp7vZ+kgSuzlptZVq64ndRBzW4mfPR9VeW7XuRjw==","mode":420,"size":3218},"LICENSE":{"checkedAt":1678883671546,"integrity":"sha512-Tb9UDK0fYHx/iGd9zAIlV5lGIkZPN3ZjW1jRyM3hm5Ra8ppOY03fw/7GPj3dezhTAdpf4lT4AAuarBXqBJZVaA==","mode":420,"size":1080},"index.js":{"checkedAt":1678883671546,"integrity":"sha512-kKPPfUlWnoigMeeISTSxbHY6g2+k29jAeaBI/WaXtS0FCN5a/GrGq2ZDdYOtgRAYeldMn3R+WW2XwgS6v0SrCw==","mode":420,"size":823},"isArguments.js":{"checkedAt":1678883671546,"integrity":"sha512-N3ZAd4d3wM7btbUjImMEC6skpqeBDWKREGbWOoNcIQtpaOVxfY3ekxrdQ5o3eU2btKPsv24h6OxbcMEjPlCO2w==","mode":420,"size":422},"README.md":{"checkedAt":1678883671548,"integrity":"sha512-Y/jR4smG0HJKmhpclAf4PaEN+aQDvFsLvqiP/aJjmCfIbCIO+zCM7xptS2VRooJU3+xy8bQMQz9yA+YtFqFDyQ==","mode":420,"size":2460},"test/index.js":{"checkedAt":1678883671548,"integrity":"sha512-pQFiHgA2kJXo8ppmLULXN0j72YevI6zAablFl4txs+ye262A5Lsmos9KgDAnPp6q/gD5piObydtnMRkr9/lv2Q==","mode":420,"size":61}}}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
Create a type with the keys of the given type changed to `string` type.
|
||||
|
||||
Use-case: Changing interface values to strings in order to use them in a form model.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Stringified} from 'type-fest';
|
||||
|
||||
type Car {
|
||||
model: string;
|
||||
speed: number;
|
||||
}
|
||||
|
||||
const carForm: Stringified<Car> = {
|
||||
model: 'Foo',
|
||||
speed: '101'
|
||||
};
|
||||
```
|
||||
|
||||
@category Object
|
||||
*/
|
||||
export type Stringified<ObjectType> = {[KeyType in keyof ObjectType]: string};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"queue-microtask","version":"1.2.3","files":{"LICENSE":{"checkedAt":1678883670848,"integrity":"sha512-UOL/xGxwuTxsayJ0nO2SgwXC182o0nLZBOeagglDRd22rd1cJjlutgtlpdE8Sd463UDlKjR2VFYYD1GyHr7Xog==","mode":493,"size":1081},"index.d.ts":{"checkedAt":1678883670848,"integrity":"sha512-3MlEtabaGqiUand6XgJk6vLftmR7VkJAFFb5qN63tD0sLurbyEOcHysFj6o1uq2eQ6oVy/RzAA6VehzIxKlX9A==","mode":420,"size":79},"README.md":{"checkedAt":1678883670848,"integrity":"sha512-+uAP1mE5X9mtbLeOXLjDE5lRsqShPjVq90iy3EaRFxfzecBHot9cyGQAkNTZlKbsisG5qMpdDtAwvXfOJNtsAw==","mode":420,"size":5628},"index.js":{"checkedAt":1678883670848,"integrity":"sha512-9DiVFQgpk9swj8TGtI2Be2LNBn+AO+dTh9Sy6CfLn11n+xPFG0DHaIHR8DRJ1H7J+rjpvvOUAZUeBFsVWlm8Uw==","mode":420,"size":402},"package.json":{"checkedAt":1678883670848,"integrity":"sha512-xOV0tj571uMuJRKOcjLG1tlPPRdE27VcBQjre1UzfnWdgPseQxq5lObjYskr0oHJ2R/lbLvB6B2Ym69A2fPhIA==","mode":420,"size":1177}}}
|
||||
@@ -0,0 +1,61 @@
|
||||
For recent changelog see CHANGELOG.md
|
||||
|
||||
-----
|
||||
|
||||
v3.1.1 -- 2017.03.15
|
||||
* Improve documentation
|
||||
* Improve error messages
|
||||
* Update dependencies
|
||||
|
||||
v3.1.0 -- 2016.06.03
|
||||
* Fix internals of symbol detection
|
||||
* Ensure Symbol.prototype[Symbol.toPrimitive] in all cases returns primitive value
|
||||
(fixes Node v6 support)
|
||||
* Create native symbols whenver possible
|
||||
|
||||
v3.0.2 -- 2015.12.12
|
||||
* Fix definition flow, so uneven state of Symbol implementation doesn't crash initialization of
|
||||
polyfill. See #13
|
||||
|
||||
v3.0.1 -- 2015.10.22
|
||||
* Workaround for IE11 bug (reported in #12)
|
||||
|
||||
v3.0.0 -- 2015.10.02
|
||||
* Reuse native symbols (e.g. iterator, toStringTag etc.) in a polyfill if they're available
|
||||
Otherwise polyfill symbols may not be recognized by other functions
|
||||
* Improve documentation
|
||||
|
||||
v2.0.1 -- 2015.01.28
|
||||
* Fix Symbol.prototype[Symbol.isPrimitive] implementation
|
||||
* Improve validation within Symbol.prototype.toString and
|
||||
Symbol.prototype.valueOf
|
||||
|
||||
v2.0.0 -- 2015.01.28
|
||||
* Update up to changes in specification:
|
||||
* Implement `for` and `keyFor`
|
||||
* Remove `Symbol.create` and `Symbol.isRegExp`
|
||||
* Add `Symbol.match`, `Symbol.replace`, `Symbol.search`, `Symbol.species` and
|
||||
`Symbol.split`
|
||||
* Rename `validSymbol` to `validateSymbol`
|
||||
* Improve documentation
|
||||
* Remove dead test modules
|
||||
|
||||
v1.0.0 -- 2015.01.26
|
||||
* Fix enumerability for symbol properties set normally (e.g. obj[symbol] = value)
|
||||
* Introduce initialization via hidden constructor
|
||||
* Fix isSymbol handling of polyfill values when native Symbol is present
|
||||
* Fix spelling of LICENSE
|
||||
* Configure lint scripts
|
||||
|
||||
v0.1.1 -- 2014.10.07
|
||||
* Fix isImplemented, so it returns true in case of polyfill
|
||||
* Improve documentations
|
||||
|
||||
v0.1.0 -- 2014.04.28
|
||||
* Assure strictly npm dependencies
|
||||
* Update to use latest versions of dependencies
|
||||
* Fix implementation detection so it doesn't crash on `String(symbol)`
|
||||
* throw on `new Symbol()` (as decided by TC39)
|
||||
|
||||
v0.0.0 -- 2013.11.15
|
||||
* Initial (dev) version
|
||||
@@ -0,0 +1,27 @@
|
||||
# Set
|
||||
|
||||
_Set_ instance
|
||||
|
||||
## `set/is`
|
||||
|
||||
Confirms if given object is a native set\_
|
||||
|
||||
```javascript
|
||||
const isSet = require("type/set/is");
|
||||
|
||||
isSet(new Set()); // true
|
||||
isSet(new Map()); // false
|
||||
isSet({}); // false
|
||||
```
|
||||
|
||||
## `Set/ensure`
|
||||
|
||||
If given argument is a _set_, it is returned back. Otherwise `TypeError` is thrown.
|
||||
|
||||
```javascript
|
||||
const ensureSet = require("type/set/ensure");
|
||||
|
||||
const set = new Set();
|
||||
ensureSet(set); // set
|
||||
eensureSet({}); // Thrown TypeError: [object Object] is not a set
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
import { TCell, TColumn } from '../../types';
|
||||
import { JSX } from 'preact';
|
||||
import Row from '../../row';
|
||||
export interface TableEvents {
|
||||
cellClick: (
|
||||
e: JSX.TargetedMouseEvent<HTMLTableCellElement>,
|
||||
cell: TCell,
|
||||
column: TColumn,
|
||||
row: Row,
|
||||
) => void;
|
||||
rowClick: (e: JSX.TargetedMouseEvent<HTMLTableRowElement>, row: Row) => void;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('padChars', require('../pad'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,13 @@
|
||||
export type UpdateUser = {
|
||||
id: number;
|
||||
firstname: string;
|
||||
middlename?: string;
|
||||
lastname: string;
|
||||
username?: string;
|
||||
email: string;
|
||||
phone?: string;
|
||||
password?: string;
|
||||
enabled?: boolean;
|
||||
groups?: any;
|
||||
profilePic?: string;
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
function resolveYamlPairs(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var index, length, pair, keys, result,
|
||||
object = data;
|
||||
|
||||
result = new Array(object.length);
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
|
||||
if (_toString.call(pair) !== '[object Object]') return false;
|
||||
|
||||
keys = Object.keys(pair);
|
||||
|
||||
if (keys.length !== 1) return false;
|
||||
|
||||
result[index] = [ keys[0], pair[keys[0]] ];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlPairs(data) {
|
||||
if (data === null) return [];
|
||||
|
||||
var index, length, pair, keys, result,
|
||||
object = data;
|
||||
|
||||
result = new Array(object.length);
|
||||
|
||||
for (index = 0, length = object.length; index < length; index += 1) {
|
||||
pair = object[index];
|
||||
|
||||
keys = Object.keys(pair);
|
||||
|
||||
result[index] = [ keys[0], pair[keys[0]] ];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:pairs', {
|
||||
kind: 'sequence',
|
||||
resolve: resolveYamlPairs,
|
||||
construct: constructYamlPairs
|
||||
});
|
||||
Reference in New Issue
Block a user