new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Object.setPrototypeOf : require("./shim");
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('maxBy', require('../maxBy'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,12 @@
|
||||
export default function(elem) {
|
||||
const bounding = elem.getBoundingClientRect();
|
||||
const out = {};
|
||||
|
||||
out.top = bounding.top < 0;
|
||||
out.left = bounding.left < 0;
|
||||
out.bottom = bounding.bottom > (window.innerHeight || document.documentElement.clientHeight);
|
||||
out.right = bounding.right > (window.innerWidth || document.documentElement.clientWidth);
|
||||
out.any = out.top || out.left || out.bottom || out.right;
|
||||
|
||||
return out;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
function executeTwoCallbacks(promise, callback, errorCallback) {
|
||||
if (typeof callback === 'function') {
|
||||
promise.then(callback);
|
||||
}
|
||||
|
||||
if (typeof errorCallback === 'function') {
|
||||
promise.catch(errorCallback);
|
||||
}
|
||||
}
|
||||
|
||||
export default executeTwoCallbacks;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatestAll.js","sourceRoot":"","sources":["../../../../src/internal/operators/combineLatestAll.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAE5D,uDAAsD;AA6CtD,SAAgB,gBAAgB,CAAI,OAAsC;IACxE,OAAO,mCAAgB,CAAC,6BAAa,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC;AAFD,4CAEC"}
|
||||
@@ -0,0 +1,60 @@
|
||||
var baseGetTag = require('./_baseGetTag'),
|
||||
isLength = require('./isLength'),
|
||||
isObjectLike = require('./isObjectLike');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var argsTag = '[object Arguments]',
|
||||
arrayTag = '[object Array]',
|
||||
boolTag = '[object Boolean]',
|
||||
dateTag = '[object Date]',
|
||||
errorTag = '[object Error]',
|
||||
funcTag = '[object Function]',
|
||||
mapTag = '[object Map]',
|
||||
numberTag = '[object Number]',
|
||||
objectTag = '[object Object]',
|
||||
regexpTag = '[object RegExp]',
|
||||
setTag = '[object Set]',
|
||||
stringTag = '[object String]',
|
||||
weakMapTag = '[object WeakMap]';
|
||||
|
||||
var arrayBufferTag = '[object ArrayBuffer]',
|
||||
dataViewTag = '[object DataView]',
|
||||
float32Tag = '[object Float32Array]',
|
||||
float64Tag = '[object Float64Array]',
|
||||
int8Tag = '[object Int8Array]',
|
||||
int16Tag = '[object Int16Array]',
|
||||
int32Tag = '[object Int32Array]',
|
||||
uint8Tag = '[object Uint8Array]',
|
||||
uint8ClampedTag = '[object Uint8ClampedArray]',
|
||||
uint16Tag = '[object Uint16Array]',
|
||||
uint32Tag = '[object Uint32Array]';
|
||||
|
||||
/** Used to identify `toStringTag` values of typed arrays. */
|
||||
var typedArrayTags = {};
|
||||
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
||||
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
||||
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
||||
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
||||
typedArrayTags[uint32Tag] = true;
|
||||
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
||||
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
||||
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
||||
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
||||
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
||||
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
||||
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
||||
typedArrayTags[weakMapTag] = false;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
||||
*/
|
||||
function baseIsTypedArray(value) {
|
||||
return isObjectLike(value) &&
|
||||
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
||||
}
|
||||
|
||||
module.exports = baseIsTypedArray;
|
||||
@@ -0,0 +1,29 @@
|
||||
import { createErrorClass } from './createErrorClass';
|
||||
|
||||
export interface EmptyError extends Error {}
|
||||
|
||||
export interface EmptyErrorCtor {
|
||||
/**
|
||||
* @deprecated Internal implementation detail. Do not construct error instances.
|
||||
* Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
|
||||
*/
|
||||
new (): EmptyError;
|
||||
}
|
||||
|
||||
/**
|
||||
* An error thrown when an Observable or a sequence was queried but has no
|
||||
* elements.
|
||||
*
|
||||
* @see {@link first}
|
||||
* @see {@link last}
|
||||
* @see {@link single}
|
||||
* @see {@link firstValueFrom}
|
||||
* @see {@link lastValueFrom}
|
||||
*
|
||||
* @class EmptyError
|
||||
*/
|
||||
export const EmptyError: EmptyErrorCtor = createErrorClass((_super) => function EmptyErrorImpl(this: any) {
|
||||
_super(this);
|
||||
this.name = 'EmptyError';
|
||||
this.message = 'no elements in sequence';
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"readFile.js","names":["fsReadFileAsync","pathname","encoding","Promise","resolve","reject","fs","readFile","error","contents","filepath","options","throwNotFound","content","code","readFileSync"],"sources":["../src/readFile.ts"],"sourcesContent":["import fs from 'fs';\n\nasync function fsReadFileAsync(\n pathname: string,\n encoding: BufferEncoding,\n): Promise<string> {\n return new Promise((resolve, reject): void => {\n fs.readFile(pathname, encoding, (error, contents): void => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve(contents);\n });\n });\n}\n\ninterface Options {\n throwNotFound?: boolean;\n}\n\nasync function readFile(\n filepath: string,\n options: Options = {},\n): Promise<string | null> {\n const throwNotFound = options.throwNotFound === true;\n\n try {\n const content = await fsReadFileAsync(filepath, 'utf8');\n\n return content;\n } catch (error) {\n if (\n throwNotFound === false &&\n (error.code === 'ENOENT' || error.code === 'EISDIR')\n ) {\n return null;\n }\n\n throw error;\n }\n}\n\nfunction readFileSync(filepath: string, options: Options = {}): string | null {\n const throwNotFound = options.throwNotFound === true;\n\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n\n return content;\n } catch (error) {\n if (\n throwNotFound === false &&\n (error.code === 'ENOENT' || error.code === 'EISDIR')\n ) {\n return null;\n }\n\n throw error;\n }\n}\n\nexport { readFile, readFileSync };\n"],"mappings":";;;;;;;;AAAA;;;;AAEA,eAAeA,eAAf,CACEC,QADF,EAEEC,QAFF,EAGmB;EACjB,OAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAA2B;IAC5CC,WAAA,CAAGC,QAAH,CAAYN,QAAZ,EAAsBC,QAAtB,EAAgC,CAACM,KAAD,EAAQC,QAAR,KAA2B;MACzD,IAAID,KAAJ,EAAW;QACTH,MAAM,CAACG,KAAD,CAAN;QACA;MACD;;MAEDJ,OAAO,CAACK,QAAD,CAAP;IACD,CAPD;EAQD,CATM,CAAP;AAUD;;AAMD,eAAeF,QAAf,CACEG,QADF,EAEEC,OAAgB,GAAG,EAFrB,EAG0B;EACxB,MAAMC,aAAa,GAAGD,OAAO,CAACC,aAAR,KAA0B,IAAhD;;EAEA,IAAI;IACF,MAAMC,OAAO,GAAG,MAAMb,eAAe,CAACU,QAAD,EAAW,MAAX,CAArC;IAEA,OAAOG,OAAP;EACD,CAJD,CAIE,OAAOL,KAAP,EAAc;IACd,IACEI,aAAa,KAAK,KAAlB,KACCJ,KAAK,CAACM,IAAN,KAAe,QAAf,IAA2BN,KAAK,CAACM,IAAN,KAAe,QAD3C,CADF,EAGE;MACA,OAAO,IAAP;IACD;;IAED,MAAMN,KAAN;EACD;AACF;;AAED,SAASO,YAAT,CAAsBL,QAAtB,EAAwCC,OAAgB,GAAG,EAA3D,EAA8E;EAC5E,MAAMC,aAAa,GAAGD,OAAO,CAACC,aAAR,KAA0B,IAAhD;;EAEA,IAAI;IACF,MAAMC,OAAO,GAAGP,WAAA,CAAGS,YAAH,CAAgBL,QAAhB,EAA0B,MAA1B,CAAhB;;IAEA,OAAOG,OAAP;EACD,CAJD,CAIE,OAAOL,KAAP,EAAc;IACd,IACEI,aAAa,KAAK,KAAlB,KACCJ,KAAK,CAACM,IAAN,KAAe,QAAf,IAA2BN,KAAK,CAACM,IAAN,KAAe,QAD3C,CADF,EAGE;MACA,OAAO,IAAP;IACD;;IAED,MAAMN,KAAN;EACD;AACF"}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*!
|
||||
* toidentifier
|
||||
* Copyright(c) 2016 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = toIdentifier
|
||||
|
||||
/**
|
||||
* Trasform the given string into a JavaScript identifier
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns {string}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function toIdentifier (str) {
|
||||
return str
|
||||
.split(' ')
|
||||
.map(function (token) {
|
||||
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
||||
})
|
||||
.join('')
|
||||
.replace(/[^ _0-9a-z]/gi, '')
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"2":"C K L G M N O","33":"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:{"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 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 EC FC"},D:{"2":"I v J D E F A B C K L G M","33":"0 1 2 3 4 5 6 7 8 9 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":"A B C K L G 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v HC zB","33":"J D E F IC JC KC LC"},F:{"2":"F B C PC QC RC SC qB AC TC rB","33":"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 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"},G:{"1":"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","33":"E VC WC XC YC ZC aC"},H:{"2":"oC"},I:{"2":"tB I pC qC rC sC BC","33":"f tC uC"},J:{"2":"D A"},K:{"2":"A B C qB AC rB","33":"h"},L:{"33":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"33":"vC"},P:{"33":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"33":"1B"},R:{"33":"9C"},S:{"2":"AD BD"}},B:4,C:"CSS Cross-Fade Function"};
|
||||
@@ -0,0 +1,54 @@
|
||||
const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
||||
|
||||
let loggedTypeFailures = {};
|
||||
|
||||
/**
|
||||
* Reset the history of which prop type warnings have been logged.
|
||||
*/
|
||||
export function resetPropWarnings() {
|
||||
loggedTypeFailures = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the values match with the type specs.
|
||||
* Error messages are memorized and will only be shown once.
|
||||
*
|
||||
* Adapted from https://github.com/facebook/prop-types/blob/master/checkPropTypes.js
|
||||
*
|
||||
* @param {object} typeSpecs Map of name to a ReactPropType
|
||||
* @param {object} values Runtime values that need to be type-checked
|
||||
* @param {string} location e.g. "prop", "context", "child context"
|
||||
* @param {string} componentName Name of the component for error messages.
|
||||
* @param {?Function} getStack Returns the component stack.
|
||||
*/
|
||||
export function checkPropTypes(
|
||||
typeSpecs,
|
||||
values,
|
||||
location,
|
||||
componentName,
|
||||
getStack
|
||||
) {
|
||||
Object.keys(typeSpecs).forEach(typeSpecName => {
|
||||
let error;
|
||||
try {
|
||||
error = typeSpecs[typeSpecName](
|
||||
values,
|
||||
typeSpecName,
|
||||
componentName,
|
||||
location,
|
||||
null,
|
||||
ReactPropTypesSecret
|
||||
);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
if (error && !(error.message in loggedTypeFailures)) {
|
||||
loggedTypeFailures[error.message] = true;
|
||||
console.error(
|
||||
`Failed ${location} type: ${error.message}${(getStack &&
|
||||
`\n${getStack()}`) ||
|
||||
''}`
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
// Declare "static" methods in Error
|
||||
interface ErrorConstructor {
|
||||
/** Create .stack property on a target object */
|
||||
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
||||
|
||||
/**
|
||||
* Optional override for formatting stack traces
|
||||
*
|
||||
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
||||
*/
|
||||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
||||
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------*
|
||||
* *
|
||||
* GLOBAL *
|
||||
* *
|
||||
------------------------------------------------*/
|
||||
|
||||
// For backwards compability
|
||||
interface NodeRequire extends NodeJS.Require { }
|
||||
interface RequireResolve extends NodeJS.RequireResolve { }
|
||||
interface NodeModule extends NodeJS.Module { }
|
||||
|
||||
declare var process: NodeJS.Process;
|
||||
declare var console: Console;
|
||||
|
||||
declare var __filename: string;
|
||||
declare var __dirname: string;
|
||||
|
||||
declare var require: NodeRequire;
|
||||
declare var module: NodeModule;
|
||||
|
||||
// Same as module.exports
|
||||
declare var exports: any;
|
||||
|
||||
/**
|
||||
* Only available if `--expose-gc` is passed to the process.
|
||||
*/
|
||||
declare var gc: undefined | (() => void);
|
||||
|
||||
//#region borrowed
|
||||
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
|
||||
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
||||
interface AbortController {
|
||||
/**
|
||||
* Returns the AbortSignal object associated with this object.
|
||||
*/
|
||||
|
||||
readonly signal: AbortSignal;
|
||||
/**
|
||||
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
||||
*/
|
||||
abort(): void;
|
||||
}
|
||||
|
||||
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
|
||||
interface AbortSignal extends EventTarget {
|
||||
/**
|
||||
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
|
||||
*/
|
||||
readonly aborted: boolean;
|
||||
}
|
||||
|
||||
declare var AbortController: typeof globalThis extends {onmessage: any; AbortController: infer T}
|
||||
? T
|
||||
: {
|
||||
prototype: AbortController;
|
||||
new(): AbortController;
|
||||
};
|
||||
|
||||
declare var AbortSignal: typeof globalThis extends {onmessage: any; AbortSignal: infer T}
|
||||
? T
|
||||
: {
|
||||
prototype: AbortSignal;
|
||||
new(): AbortSignal;
|
||||
abort(reason?: any): AbortSignal;
|
||||
timeout(milliseconds: number): AbortSignal;
|
||||
};
|
||||
//#endregion borrowed
|
||||
|
||||
//#region ArrayLike.at()
|
||||
interface RelativeIndexable<T> {
|
||||
/**
|
||||
* Takes an integer value and returns the item at that index,
|
||||
* allowing for positive and negative integers.
|
||||
* Negative integers count back from the last item in the array.
|
||||
*/
|
||||
at(index: number): T | undefined;
|
||||
}
|
||||
interface String extends RelativeIndexable<string> {}
|
||||
interface Array<T> extends RelativeIndexable<T> {}
|
||||
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
|
||||
interface Int8Array extends RelativeIndexable<number> {}
|
||||
interface Uint8Array extends RelativeIndexable<number> {}
|
||||
interface Uint8ClampedArray extends RelativeIndexable<number> {}
|
||||
interface Int16Array extends RelativeIndexable<number> {}
|
||||
interface Uint16Array extends RelativeIndexable<number> {}
|
||||
interface Int32Array extends RelativeIndexable<number> {}
|
||||
interface Uint32Array extends RelativeIndexable<number> {}
|
||||
interface Float32Array extends RelativeIndexable<number> {}
|
||||
interface Float64Array extends RelativeIndexable<number> {}
|
||||
interface BigInt64Array extends RelativeIndexable<bigint> {}
|
||||
interface BigUint64Array extends RelativeIndexable<bigint> {}
|
||||
//#endregion ArrayLike.at() end
|
||||
|
||||
/**
|
||||
* @since v17.0.0
|
||||
*
|
||||
* Creates a deep clone of an object.
|
||||
*/
|
||||
declare function structuredClone<T>(
|
||||
value: T,
|
||||
transfer?: { transfer: ReadonlyArray<import('worker_threads').TransferListItem> },
|
||||
): T;
|
||||
|
||||
/*----------------------------------------------*
|
||||
* *
|
||||
* GLOBAL INTERFACES *
|
||||
* *
|
||||
*-----------------------------------------------*/
|
||||
declare namespace NodeJS {
|
||||
interface CallSite {
|
||||
/**
|
||||
* Value of "this"
|
||||
*/
|
||||
getThis(): unknown;
|
||||
|
||||
/**
|
||||
* Type of "this" as a string.
|
||||
* This is the name of the function stored in the constructor field of
|
||||
* "this", if available. Otherwise the object's [[Class]] internal
|
||||
* property.
|
||||
*/
|
||||
getTypeName(): string | null;
|
||||
|
||||
/**
|
||||
* Current function
|
||||
*/
|
||||
getFunction(): Function | undefined;
|
||||
|
||||
/**
|
||||
* Name of the current function, typically its name property.
|
||||
* If a name property is not available an attempt will be made to try
|
||||
* to infer a name from the function's context.
|
||||
*/
|
||||
getFunctionName(): string | null;
|
||||
|
||||
/**
|
||||
* Name of the property [of "this" or one of its prototypes] that holds
|
||||
* the current function
|
||||
*/
|
||||
getMethodName(): string | null;
|
||||
|
||||
/**
|
||||
* Name of the script [if this function was defined in a script]
|
||||
*/
|
||||
getFileName(): string | null;
|
||||
|
||||
/**
|
||||
* Current line number [if this function was defined in a script]
|
||||
*/
|
||||
getLineNumber(): number | null;
|
||||
|
||||
/**
|
||||
* Current column number [if this function was defined in a script]
|
||||
*/
|
||||
getColumnNumber(): number | null;
|
||||
|
||||
/**
|
||||
* A call site object representing the location where eval was called
|
||||
* [if this function was created using a call to eval]
|
||||
*/
|
||||
getEvalOrigin(): string | undefined;
|
||||
|
||||
/**
|
||||
* Is this a toplevel invocation, that is, is "this" the global object?
|
||||
*/
|
||||
isToplevel(): boolean;
|
||||
|
||||
/**
|
||||
* Does this call take place in code defined by a call to eval?
|
||||
*/
|
||||
isEval(): boolean;
|
||||
|
||||
/**
|
||||
* Is this call in native V8 code?
|
||||
*/
|
||||
isNative(): boolean;
|
||||
|
||||
/**
|
||||
* Is this a constructor call?
|
||||
*/
|
||||
isConstructor(): boolean;
|
||||
}
|
||||
|
||||
interface ErrnoException extends Error {
|
||||
errno?: number | undefined;
|
||||
code?: string | undefined;
|
||||
path?: string | undefined;
|
||||
syscall?: string | undefined;
|
||||
}
|
||||
|
||||
interface ReadableStream extends EventEmitter {
|
||||
readable: boolean;
|
||||
read(size?: number): string | Buffer;
|
||||
setEncoding(encoding: BufferEncoding): this;
|
||||
pause(): this;
|
||||
resume(): this;
|
||||
isPaused(): boolean;
|
||||
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
|
||||
unpipe(destination?: WritableStream): this;
|
||||
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
||||
wrap(oldStream: ReadableStream): this;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
||||
}
|
||||
|
||||
interface WritableStream extends EventEmitter {
|
||||
writable: boolean;
|
||||
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
||||
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
||||
end(cb?: () => void): this;
|
||||
end(data: string | Uint8Array, cb?: () => void): this;
|
||||
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
|
||||
}
|
||||
|
||||
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
||||
|
||||
interface RefCounted {
|
||||
ref(): this;
|
||||
unref(): this;
|
||||
}
|
||||
|
||||
type TypedArray =
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Uint16Array
|
||||
| Uint32Array
|
||||
| Int8Array
|
||||
| Int16Array
|
||||
| Int32Array
|
||||
| BigUint64Array
|
||||
| BigInt64Array
|
||||
| Float32Array
|
||||
| Float64Array;
|
||||
type ArrayBufferView = TypedArray | DataView;
|
||||
|
||||
interface Require {
|
||||
(id: string): any;
|
||||
resolve: RequireResolve;
|
||||
cache: Dict<NodeModule>;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
extensions: RequireExtensions;
|
||||
main: Module | undefined;
|
||||
}
|
||||
|
||||
interface RequireResolve {
|
||||
(id: string, options?: { paths?: string[] | undefined; }): string;
|
||||
paths(request: string): string[] | null;
|
||||
}
|
||||
|
||||
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
|
||||
'.js': (m: Module, filename: string) => any;
|
||||
'.json': (m: Module, filename: string) => any;
|
||||
'.node': (m: Module, filename: string) => any;
|
||||
}
|
||||
interface Module {
|
||||
/**
|
||||
* `true` if the module is running during the Node.js preload
|
||||
*/
|
||||
isPreloading: boolean;
|
||||
exports: any;
|
||||
require: Require;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
|
||||
parent: Module | null | undefined;
|
||||
children: Module[];
|
||||
/**
|
||||
* @since v11.14.0
|
||||
*
|
||||
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
||||
*/
|
||||
path: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
interface Dict<T> {
|
||||
[key: string]: T | undefined;
|
||||
}
|
||||
|
||||
interface ReadOnlyDict<T> {
|
||||
readonly [key: string]: T | undefined;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
var resolveException = require("../lib/resolve-exception")
|
||||
, coerce = require("./coerce");
|
||||
|
||||
module.exports = function (value/*, options*/) {
|
||||
var coerced = coerce(value);
|
||||
if (coerced !== null) return coerced;
|
||||
var options = arguments[1];
|
||||
var errorMessage =
|
||||
options && options.name
|
||||
? "Expected a finite number for %n, received %v"
|
||||
: "%v is not a finite number";
|
||||
return resolveException(value, errorMessage, options);
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
Join an array of strings and/or numbers using the given string as a delimiter.
|
||||
|
||||
Use-case: Defining key paths in a nested object. For example, for dot-notation fields in MongoDB queries.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {Join} from 'type-fest';
|
||||
|
||||
// Mixed (strings & numbers) items; result is: 'foo.0.baz'
|
||||
const path: Join<['foo', 0, 'baz'], '.'> = ['foo', 0, 'baz'].join('.');
|
||||
|
||||
// Only string items; result is: 'foo.bar.baz'
|
||||
const path: Join<['foo', 'bar', 'baz'], '.'> = ['foo', 'bar', 'baz'].join('.');
|
||||
|
||||
// Only number items; result is: '1.2.3'
|
||||
const path: Join<[1, 2, 3], '.'> = [1, 2, 3].join('.');
|
||||
```
|
||||
|
||||
@category Array
|
||||
@category Template literal
|
||||
*/
|
||||
export type Join<
|
||||
Strings extends ReadonlyArray<string | number>,
|
||||
Delimiter extends string,
|
||||
> = Strings extends []
|
||||
? ''
|
||||
: Strings extends readonly [string | number]
|
||||
? `${Strings[0]}`
|
||||
: Strings extends readonly [
|
||||
string | number,
|
||||
...infer Rest extends ReadonlyArray<string | number>,
|
||||
]
|
||||
? `${Strings[0]}${Delimiter}${Join<Rest, Delimiter>}`
|
||||
: string;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"http-error.js","sourceRoot":"","sources":["../src/http-error.ts"],"names":[],"mappings":";;AAAA,+BAAoC;AAEpC;;GAEG;AACH,MAAqB,SAAU,SAAQ,KAAK;IAI3C,YAAY,UAAkB,EAAE,OAAO,GAAG,mBAAY,CAAC,UAAU,CAAC;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;aAC7B,WAAW,EAAE;aACb,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;CACD;AAZD,4BAYC"}
|
||||
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.iso7064Check = iso7064Check;
|
||||
exports.luhnCheck = luhnCheck;
|
||||
exports.reverseMultiplyAndSum = reverseMultiplyAndSum;
|
||||
exports.verhoeffCheck = verhoeffCheck;
|
||||
|
||||
/**
|
||||
* Algorithmic validation functions
|
||||
* May be used as is or implemented in the workflow of other validators.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ISO 7064 validation function
|
||||
* Called with a string of numbers (incl. check digit)
|
||||
* to validate according to ISO 7064 (MOD 11, 10).
|
||||
*/
|
||||
function iso7064Check(str) {
|
||||
var checkvalue = 10;
|
||||
|
||||
for (var i = 0; i < str.length - 1; i++) {
|
||||
checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? 10 * 2 % 11 : (parseInt(str[i], 10) + checkvalue) % 10 * 2 % 11;
|
||||
}
|
||||
|
||||
checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue;
|
||||
return checkvalue === parseInt(str[10], 10);
|
||||
}
|
||||
/*
|
||||
* Luhn (mod 10) validation function
|
||||
* Called with a string of numbers (incl. check digit)
|
||||
* to validate according to the Luhn algorithm.
|
||||
*/
|
||||
|
||||
|
||||
function luhnCheck(str) {
|
||||
var checksum = 0;
|
||||
var second = false;
|
||||
|
||||
for (var i = str.length - 1; i >= 0; i--) {
|
||||
if (second) {
|
||||
var product = parseInt(str[i], 10) * 2;
|
||||
|
||||
if (product > 9) {
|
||||
// sum digits of product and add to checksum
|
||||
checksum += product.toString().split('').map(function (a) {
|
||||
return parseInt(a, 10);
|
||||
}).reduce(function (a, b) {
|
||||
return a + b;
|
||||
}, 0);
|
||||
} else {
|
||||
checksum += product;
|
||||
}
|
||||
} else {
|
||||
checksum += parseInt(str[i], 10);
|
||||
}
|
||||
|
||||
second = !second;
|
||||
}
|
||||
|
||||
return checksum % 10 === 0;
|
||||
}
|
||||
/*
|
||||
* Reverse TIN multiplication and summation helper function
|
||||
* Called with an array of single-digit integers and a base multiplier
|
||||
* to calculate the sum of the digits multiplied in reverse.
|
||||
* Normally used in variations of MOD 11 algorithmic checks.
|
||||
*/
|
||||
|
||||
|
||||
function reverseMultiplyAndSum(digits, base) {
|
||||
var total = 0;
|
||||
|
||||
for (var i = 0; i < digits.length; i++) {
|
||||
total += digits[i] * (base - i);
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
/*
|
||||
* Verhoeff validation helper function
|
||||
* Called with a string of numbers
|
||||
* to validate according to the Verhoeff algorithm.
|
||||
*/
|
||||
|
||||
|
||||
function verhoeffCheck(str) {
|
||||
var d_table = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]];
|
||||
var p_table = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]]; // Copy (to prevent replacement) and reverse
|
||||
|
||||
var str_copy = str.split('').reverse().join('');
|
||||
var checksum = 0;
|
||||
|
||||
for (var i = 0; i < str_copy.length; i++) {
|
||||
checksum = d_table[checksum][p_table[i % 8][parseInt(str_copy[i], 10)]];
|
||||
}
|
||||
|
||||
return checksum === 0;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').applyEachSeries;
|
||||
@@ -0,0 +1,53 @@
|
||||
# WebIDL Type Conversions on JavaScript Values
|
||||
|
||||
This package implements, in JavaScript, the algorithms to convert a given JavaScript value according to a given [WebIDL](http://heycam.github.io/webidl/) [type](http://heycam.github.io/webidl/#idl-types).
|
||||
|
||||
The goal is that you should be able to write code like
|
||||
|
||||
```js
|
||||
const conversions = require("webidl-conversions");
|
||||
|
||||
function doStuff(x, y) {
|
||||
x = conversions["boolean"](x);
|
||||
y = conversions["unsigned long"](y);
|
||||
// actual algorithm code here
|
||||
}
|
||||
```
|
||||
|
||||
and your function `doStuff` will behave the same as a WebIDL operation declared as
|
||||
|
||||
```webidl
|
||||
void doStuff(boolean x, unsigned long y);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package's main module's default export is an object with a variety of methods, each corresponding to a different WebIDL type. Each method, when invoked on a JavaScript value, will give back the new JavaScript value that results after passing through the WebIDL conversion rules. (See below for more details on what that means.) Alternately, the method could throw an error, if the WebIDL algorithm is specified to do so: for example `conversions["float"](NaN)` [will throw a `TypeError`](http://heycam.github.io/webidl/#es-float).
|
||||
|
||||
## Status
|
||||
|
||||
All of the numeric types are implemented (float being implemented as double) and some others are as well - check the source for all of them. This list will grow over time in service of the [HTML as Custom Elements](https://github.com/dglazkov/html-as-custom-elements) project, but in the meantime, pull requests welcome!
|
||||
|
||||
I'm not sure yet what the strategy will be for modifiers, e.g. [`[Clamp]`](http://heycam.github.io/webidl/#Clamp). Maybe something like `conversions["unsigned long"](x, { clamp: true })`? We'll see.
|
||||
|
||||
We might also want to extend the API to give better error messages, e.g. "Argument 1 of HTMLMediaElement.fastSeek is not a finite floating-point value" instead of "Argument is not a finite floating-point value." This would require passing in more information to the conversion functions than we currently do.
|
||||
|
||||
## Background
|
||||
|
||||
What's actually going on here, conceptually, is pretty weird. Let's try to explain.
|
||||
|
||||
WebIDL, as part of its madness-inducing design, has its own type system. When people write algorithms in web platform specs, they usually operate on WebIDL values, i.e. instances of WebIDL types. For example, if they were specifying the algorithm for our `doStuff` operation above, they would treat `x` as a WebIDL value of [WebIDL type `boolean`](http://heycam.github.io/webidl/#idl-boolean). Crucially, they would _not_ treat `x` as a JavaScript variable whose value is either the JavaScript `true` or `false`. They're instead working in a different type system altogether, with its own rules.
|
||||
|
||||
Separately from its type system, WebIDL defines a ["binding"](http://heycam.github.io/webidl/#ecmascript-binding) of the type system into JavaScript. This contains rules like: when you pass a JavaScript value to the JavaScript method that manifests a given WebIDL operation, how does that get converted into a WebIDL value? For example, a JavaScript `true` passed in the position of a WebIDL `boolean` argument becomes a WebIDL `true`. But, a JavaScript `true` passed in the position of a [WebIDL `unsigned long`](http://heycam.github.io/webidl/#idl-unsigned-long) becomes a WebIDL `1`. And so on.
|
||||
|
||||
Finally, we have the actual implementation code. This is usually C++, although these days [some smart people are using Rust](https://github.com/servo/servo). The implementation, of course, has its own type system. So when they implement the WebIDL algorithms, they don't actually use WebIDL values, since those aren't "real" outside of specs. Instead, implementations apply the WebIDL binding rules in such a way as to convert incoming JavaScript values into C++ values. For example, if code in the browser called `doStuff(true, true)`, then the implementation code would eventually receive a C++ `bool` containing `true` and a C++ `uint32_t` containing `1`.
|
||||
|
||||
The upside of all this is that implementations can abstract all the conversion logic away, letting WebIDL handle it, and focus on implementing the relevant methods in C++ with values of the correct type already provided. That is payoff of WebIDL, in a nutshell.
|
||||
|
||||
And getting to that payoff is the goal of _this_ project—but for JavaScript implementations, instead of C++ ones. That is, this library is designed to make it easier for JavaScript developers to write functions that behave like a given WebIDL operation. So conceptually, the conversion pipeline, which in its general form is JavaScript values ↦ WebIDL values ↦ implementation-language values, in this case becomes JavaScript values ↦ WebIDL values ↦ JavaScript values. And that intermediate step is where all the logic is performed: a JavaScript `true` becomes a WebIDL `1` in an unsigned long context, which then becomes a JavaScript `1`.
|
||||
|
||||
## Don't Use This
|
||||
|
||||
Seriously, why would you ever use this? You really shouldn't. WebIDL is … not great, and you shouldn't be emulating its semantics. If you're looking for a generic argument-processing library, you should find one with better rules than those from WebIDL. In general, your JavaScript should not be trying to become more like WebIDL; if anything, we should fix WebIDL to make it more like JavaScript.
|
||||
|
||||
The _only_ people who should use this are those trying to create faithful implementations (or polyfills) of web platform interfaces defined in WebIDL.
|
||||
@@ -0,0 +1,247 @@
|
||||
import assertString from './util/assertString';
|
||||
import * as algorithms from './util/algorithms';
|
||||
|
||||
var PT = function PT(str) {
|
||||
var match = str.match(/^(PT)?(\d{9})$/);
|
||||
|
||||
if (!match) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var tin = match[2];
|
||||
var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) {
|
||||
return parseInt(a, 10);
|
||||
}), 9) % 11;
|
||||
|
||||
if (checksum > 9) {
|
||||
return parseInt(tin[8], 10) === 0;
|
||||
}
|
||||
|
||||
return checksum === parseInt(tin[8], 10);
|
||||
};
|
||||
|
||||
export var vatMatchers = {
|
||||
/**
|
||||
* European Union VAT identification numbers
|
||||
*/
|
||||
AT: function AT(str) {
|
||||
return /^(AT)?U\d{8}$/.test(str);
|
||||
},
|
||||
BE: function BE(str) {
|
||||
return /^(BE)?\d{10}$/.test(str);
|
||||
},
|
||||
BG: function BG(str) {
|
||||
return /^(BG)?\d{9,10}$/.test(str);
|
||||
},
|
||||
HR: function HR(str) {
|
||||
return /^(HR)?\d{11}$/.test(str);
|
||||
},
|
||||
CY: function CY(str) {
|
||||
return /^(CY)?\w{9}$/.test(str);
|
||||
},
|
||||
CZ: function CZ(str) {
|
||||
return /^(CZ)?\d{8,10}$/.test(str);
|
||||
},
|
||||
DK: function DK(str) {
|
||||
return /^(DK)?\d{8}$/.test(str);
|
||||
},
|
||||
EE: function EE(str) {
|
||||
return /^(EE)?\d{9}$/.test(str);
|
||||
},
|
||||
FI: function FI(str) {
|
||||
return /^(FI)?\d{8}$/.test(str);
|
||||
},
|
||||
FR: function FR(str) {
|
||||
return /^(FR)?\w{2}\d{9}$/.test(str);
|
||||
},
|
||||
DE: function DE(str) {
|
||||
return /^(DE)?\d{9}$/.test(str);
|
||||
},
|
||||
EL: function EL(str) {
|
||||
return /^(EL)?\d{9}$/.test(str);
|
||||
},
|
||||
HU: function HU(str) {
|
||||
return /^(HU)?\d{8}$/.test(str);
|
||||
},
|
||||
IE: function IE(str) {
|
||||
return /^(IE)?\d{7}\w{1}(W)?$/.test(str);
|
||||
},
|
||||
IT: function IT(str) {
|
||||
return /^(IT)?\d{11}$/.test(str);
|
||||
},
|
||||
LV: function LV(str) {
|
||||
return /^(LV)?\d{11}$/.test(str);
|
||||
},
|
||||
LT: function LT(str) {
|
||||
return /^(LT)?\d{9,12}$/.test(str);
|
||||
},
|
||||
LU: function LU(str) {
|
||||
return /^(LU)?\d{8}$/.test(str);
|
||||
},
|
||||
MT: function MT(str) {
|
||||
return /^(MT)?\d{8}$/.test(str);
|
||||
},
|
||||
NL: function NL(str) {
|
||||
return /^(NL)?\d{9}B\d{2}$/.test(str);
|
||||
},
|
||||
PL: function PL(str) {
|
||||
return /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test(str);
|
||||
},
|
||||
PT: PT,
|
||||
RO: function RO(str) {
|
||||
return /^(RO)?\d{2,10}$/.test(str);
|
||||
},
|
||||
SK: function SK(str) {
|
||||
return /^(SK)?\d{10}$/.test(str);
|
||||
},
|
||||
SI: function SI(str) {
|
||||
return /^(SI)?\d{8}$/.test(str);
|
||||
},
|
||||
ES: function ES(str) {
|
||||
return /^(ES)?\w\d{7}[A-Z]$/.test(str);
|
||||
},
|
||||
SE: function SE(str) {
|
||||
return /^(SE)?\d{12}$/.test(str);
|
||||
},
|
||||
|
||||
/**
|
||||
* VAT numbers of non-EU countries
|
||||
*/
|
||||
AL: function AL(str) {
|
||||
return /^(AL)?\w{9}[A-Z]$/.test(str);
|
||||
},
|
||||
MK: function MK(str) {
|
||||
return /^(MK)?\d{13}$/.test(str);
|
||||
},
|
||||
AU: function AU(str) {
|
||||
return /^(AU)?\d{11}$/.test(str);
|
||||
},
|
||||
BY: function BY(str) {
|
||||
return /^(УНП )?\d{9}$/.test(str);
|
||||
},
|
||||
CA: function CA(str) {
|
||||
return /^(CA)?\d{9}$/.test(str);
|
||||
},
|
||||
IS: function IS(str) {
|
||||
return /^(IS)?\d{5,6}$/.test(str);
|
||||
},
|
||||
IN: function IN(str) {
|
||||
return /^(IN)?\d{15}$/.test(str);
|
||||
},
|
||||
ID: function ID(str) {
|
||||
return /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str);
|
||||
},
|
||||
IL: function IL(str) {
|
||||
return /^(IL)?\d{9}$/.test(str);
|
||||
},
|
||||
KZ: function KZ(str) {
|
||||
return /^(KZ)?\d{9}$/.test(str);
|
||||
},
|
||||
NZ: function NZ(str) {
|
||||
return /^(NZ)?\d{9}$/.test(str);
|
||||
},
|
||||
NG: function NG(str) {
|
||||
return /^(NG)?(\d{12}|(\d{8}-\d{4}))$/.test(str);
|
||||
},
|
||||
NO: function NO(str) {
|
||||
return /^(NO)?\d{9}MVA$/.test(str);
|
||||
},
|
||||
PH: function PH(str) {
|
||||
return /^(PH)?(\d{12}|\d{3} \d{3} \d{3} \d{3})$/.test(str);
|
||||
},
|
||||
RU: function RU(str) {
|
||||
return /^(RU)?(\d{10}|\d{12})$/.test(str);
|
||||
},
|
||||
SM: function SM(str) {
|
||||
return /^(SM)?\d{5}$/.test(str);
|
||||
},
|
||||
SA: function SA(str) {
|
||||
return /^(SA)?\d{15}$/.test(str);
|
||||
},
|
||||
RS: function RS(str) {
|
||||
return /^(RS)?\d{9}$/.test(str);
|
||||
},
|
||||
CH: function CH(str) {
|
||||
return /^(CH)?(\d{6}|\d{9}|(\d{3}.\d{3})|(\d{3}.\d{3}.\d{3}))(TVA|MWST|IVA)$/.test(str);
|
||||
},
|
||||
TR: function TR(str) {
|
||||
return /^(TR)?\d{10}$/.test(str);
|
||||
},
|
||||
UA: function UA(str) {
|
||||
return /^(UA)?\d{12}$/.test(str);
|
||||
},
|
||||
GB: function GB(str) {
|
||||
return /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/.test(str);
|
||||
},
|
||||
UZ: function UZ(str) {
|
||||
return /^(UZ)?\d{9}$/.test(str);
|
||||
},
|
||||
|
||||
/**
|
||||
* VAT numbers of Latin American countries
|
||||
*/
|
||||
AR: function AR(str) {
|
||||
return /^(AR)?\d{11}$/.test(str);
|
||||
},
|
||||
BO: function BO(str) {
|
||||
return /^(BO)?\d{7}$/.test(str);
|
||||
},
|
||||
BR: function BR(str) {
|
||||
return /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test(str);
|
||||
},
|
||||
CL: function CL(str) {
|
||||
return /^(CL)?\d{8}-\d{1}$/.test(str);
|
||||
},
|
||||
CO: function CO(str) {
|
||||
return /^(CO)?\d{10}$/.test(str);
|
||||
},
|
||||
CR: function CR(str) {
|
||||
return /^(CR)?\d{9,12}$/.test(str);
|
||||
},
|
||||
EC: function EC(str) {
|
||||
return /^(EC)?\d{13}$/.test(str);
|
||||
},
|
||||
SV: function SV(str) {
|
||||
return /^(SV)?\d{4}-\d{6}-\d{3}-\d{1}$/.test(str);
|
||||
},
|
||||
GT: function GT(str) {
|
||||
return /^(GT)?\d{7}-\d{1}$/.test(str);
|
||||
},
|
||||
HN: function HN(str) {
|
||||
return /^(HN)?$/.test(str);
|
||||
},
|
||||
MX: function MX(str) {
|
||||
return /^(MX)?\w{3,4}\d{6}\w{3}$/.test(str);
|
||||
},
|
||||
NI: function NI(str) {
|
||||
return /^(NI)?\d{3}-\d{6}-\d{4}\w{1}$/.test(str);
|
||||
},
|
||||
PA: function PA(str) {
|
||||
return /^(PA)?$/.test(str);
|
||||
},
|
||||
PY: function PY(str) {
|
||||
return /^(PY)?\d{6,8}-\d{1}$/.test(str);
|
||||
},
|
||||
PE: function PE(str) {
|
||||
return /^(PE)?\d{11}$/.test(str);
|
||||
},
|
||||
DO: function DO(str) {
|
||||
return /^(DO)?(\d{11}|(\d{3}-\d{7}-\d{1})|[1,4,5]{1}\d{8}|([1,4,5]{1})-\d{2}-\d{5}-\d{1})$/.test(str);
|
||||
},
|
||||
UY: function UY(str) {
|
||||
return /^(UY)?\d{12}$/.test(str);
|
||||
},
|
||||
VE: function VE(str) {
|
||||
return /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str);
|
||||
}
|
||||
};
|
||||
export default function isVAT(str, countryCode) {
|
||||
assertString(str);
|
||||
assertString(countryCode);
|
||||
|
||||
if (countryCode in vatMatchers) {
|
||||
return vatMatchers[countryCode](str);
|
||||
}
|
||||
|
||||
throw new Error("Invalid country code: '".concat(countryCode, "'"));
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
function resolveYamlMerge(data) {
|
||||
return data === '<<' || data === null;
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:merge', {
|
||||
kind: 'scalar',
|
||||
resolve: resolveYamlMerge
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
import type {CamelCase} from './camel-case';
|
||||
|
||||
/**
|
||||
Converts a string literal to pascal-case.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {PascalCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: PascalCase<'foo-bar'> = 'FooBar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type PascalCaseProps<T> = {
|
||||
[K in keyof T as PascalCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface RawOptions {
|
||||
'dry-run': boolean;
|
||||
'full_family_name': string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const dbResult: CamelCasedProperties<ModelProps> = {
|
||||
DryRun: true,
|
||||
FullFamilyName: 'bar.js',
|
||||
Foo: 123
|
||||
};
|
||||
```
|
||||
|
||||
@category Change case
|
||||
@category Template literal
|
||||
*/
|
||||
export type PascalCase<Value> = CamelCase<Value> extends string
|
||||
? Capitalize<CamelCase<Value>>
|
||||
: CamelCase<Value>;
|
||||
@@ -0,0 +1,152 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { Duplex } from 'stream';
|
||||
import { Socket, SocketConnectOpts } from 'net';
|
||||
import { RequireOnlyOne } from './util';
|
||||
declare const DEFAULT_TIMEOUT = 30000;
|
||||
declare type SocksProxyType = 4 | 5;
|
||||
declare const ERRORS: {
|
||||
InvalidSocksCommand: string;
|
||||
InvalidSocksCommandForOperation: string;
|
||||
InvalidSocksCommandChain: string;
|
||||
InvalidSocksClientOptionsDestination: string;
|
||||
InvalidSocksClientOptionsExistingSocket: string;
|
||||
InvalidSocksClientOptionsProxy: string;
|
||||
InvalidSocksClientOptionsTimeout: string;
|
||||
InvalidSocksClientOptionsProxiesLength: string;
|
||||
InvalidSocksClientOptionsCustomAuthRange: string;
|
||||
InvalidSocksClientOptionsCustomAuthOptions: string;
|
||||
NegotiationError: string;
|
||||
SocketClosed: string;
|
||||
ProxyConnectionTimedOut: string;
|
||||
InternalError: string;
|
||||
InvalidSocks4HandshakeResponse: string;
|
||||
Socks4ProxyRejectedConnection: string;
|
||||
InvalidSocks4IncomingConnectionResponse: string;
|
||||
Socks4ProxyRejectedIncomingBoundConnection: string;
|
||||
InvalidSocks5InitialHandshakeResponse: string;
|
||||
InvalidSocks5IntiailHandshakeSocksVersion: string;
|
||||
InvalidSocks5InitialHandshakeNoAcceptedAuthType: string;
|
||||
InvalidSocks5InitialHandshakeUnknownAuthType: string;
|
||||
Socks5AuthenticationFailed: string;
|
||||
InvalidSocks5FinalHandshake: string;
|
||||
InvalidSocks5FinalHandshakeRejected: string;
|
||||
InvalidSocks5IncomingConnectionResponse: string;
|
||||
Socks5ProxyRejectedIncomingBoundConnection: string;
|
||||
};
|
||||
declare const SOCKS_INCOMING_PACKET_SIZES: {
|
||||
Socks5InitialHandshakeResponse: number;
|
||||
Socks5UserPassAuthenticationResponse: number;
|
||||
Socks5ResponseHeader: number;
|
||||
Socks5ResponseIPv4: number;
|
||||
Socks5ResponseIPv6: number;
|
||||
Socks5ResponseHostname: (hostNameLength: number) => number;
|
||||
Socks4Response: number;
|
||||
};
|
||||
declare type SocksCommandOption = 'connect' | 'bind' | 'associate';
|
||||
declare enum SocksCommand {
|
||||
connect = 1,
|
||||
bind = 2,
|
||||
associate = 3
|
||||
}
|
||||
declare enum Socks4Response {
|
||||
Granted = 90,
|
||||
Failed = 91,
|
||||
Rejected = 92,
|
||||
RejectedIdent = 93
|
||||
}
|
||||
declare enum Socks5Auth {
|
||||
NoAuth = 0,
|
||||
GSSApi = 1,
|
||||
UserPass = 2
|
||||
}
|
||||
declare const SOCKS5_CUSTOM_AUTH_START = 128;
|
||||
declare const SOCKS5_CUSTOM_AUTH_END = 254;
|
||||
declare const SOCKS5_NO_ACCEPTABLE_AUTH = 255;
|
||||
declare enum Socks5Response {
|
||||
Granted = 0,
|
||||
Failure = 1,
|
||||
NotAllowed = 2,
|
||||
NetworkUnreachable = 3,
|
||||
HostUnreachable = 4,
|
||||
ConnectionRefused = 5,
|
||||
TTLExpired = 6,
|
||||
CommandNotSupported = 7,
|
||||
AddressNotSupported = 8
|
||||
}
|
||||
declare enum Socks5HostType {
|
||||
IPv4 = 1,
|
||||
Hostname = 3,
|
||||
IPv6 = 4
|
||||
}
|
||||
declare enum SocksClientState {
|
||||
Created = 0,
|
||||
Connecting = 1,
|
||||
Connected = 2,
|
||||
SentInitialHandshake = 3,
|
||||
ReceivedInitialHandshakeResponse = 4,
|
||||
SentAuthentication = 5,
|
||||
ReceivedAuthenticationResponse = 6,
|
||||
SentFinalHandshake = 7,
|
||||
ReceivedFinalResponse = 8,
|
||||
BoundWaitingForConnection = 9,
|
||||
Established = 10,
|
||||
Disconnected = 11,
|
||||
Error = 99
|
||||
}
|
||||
/**
|
||||
* Represents a SocksProxy
|
||||
*/
|
||||
declare type SocksProxy = RequireOnlyOne<{
|
||||
ipaddress?: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: SocksProxyType;
|
||||
userId?: string;
|
||||
password?: string;
|
||||
custom_auth_method?: number;
|
||||
custom_auth_request_handler?: () => Promise<Buffer>;
|
||||
custom_auth_response_size?: number;
|
||||
custom_auth_response_handler?: (data: Buffer) => Promise<boolean>;
|
||||
}, 'host' | 'ipaddress'>;
|
||||
/**
|
||||
* Represents a remote host
|
||||
*/
|
||||
interface SocksRemoteHost {
|
||||
host: string;
|
||||
port: number;
|
||||
}
|
||||
/**
|
||||
* SocksClient connection options.
|
||||
*/
|
||||
interface SocksClientOptions {
|
||||
command: SocksCommandOption;
|
||||
destination: SocksRemoteHost;
|
||||
proxy: SocksProxy;
|
||||
timeout?: number;
|
||||
existing_socket?: Duplex;
|
||||
set_tcp_nodelay?: boolean;
|
||||
socket_options?: SocketConnectOpts;
|
||||
}
|
||||
/**
|
||||
* SocksClient chain connection options.
|
||||
*/
|
||||
interface SocksClientChainOptions {
|
||||
command: 'connect';
|
||||
destination: SocksRemoteHost;
|
||||
proxies: SocksProxy[];
|
||||
timeout?: number;
|
||||
randomizeChain?: false;
|
||||
}
|
||||
interface SocksClientEstablishedEvent {
|
||||
socket: Socket;
|
||||
remoteHost?: SocksRemoteHost;
|
||||
}
|
||||
declare type SocksClientBoundEvent = SocksClientEstablishedEvent;
|
||||
interface SocksUDPFrameDetails {
|
||||
frameNumber?: number;
|
||||
remoteHost: SocksRemoteHost;
|
||||
data: Buffer;
|
||||
}
|
||||
export { DEFAULT_TIMEOUT, ERRORS, SocksProxyType, SocksCommand, Socks4Response, Socks5Auth, Socks5HostType, Socks5Response, SocksClientState, SocksProxy, SocksRemoteHost, SocksCommandOption, SocksClientOptions, SocksClientChainOptions, SocksClientEstablishedEvent, SocksClientBoundEvent, SocksUDPFrameDetails, SOCKS_INCOMING_PACKET_SIZES, SOCKS5_CUSTOM_AUTH_START, SOCKS5_CUSTOM_AUTH_END, SOCKS5_NO_ACCEPTABLE_AUTH, };
|
||||
@@ -0,0 +1,76 @@
|
||||
var common = require('./common');
|
||||
var fs = require('fs');
|
||||
|
||||
common.register('cat', _cat, {
|
||||
canReceivePipe: true,
|
||||
cmdOptions: {
|
||||
'n': 'number',
|
||||
},
|
||||
});
|
||||
|
||||
//@
|
||||
//@ ### cat([options,] file [, file ...])
|
||||
//@ ### cat([options,] file_array)
|
||||
//@
|
||||
//@ Available options:
|
||||
//@
|
||||
//@ + `-n`: number all output lines
|
||||
//@
|
||||
//@ Examples:
|
||||
//@
|
||||
//@ ```javascript
|
||||
//@ var str = cat('file*.txt');
|
||||
//@ var str = cat('file1', 'file2');
|
||||
//@ var str = cat(['file1', 'file2']); // same as above
|
||||
//@ ```
|
||||
//@
|
||||
//@ Returns a string containing the given file, or a concatenated string
|
||||
//@ containing the files if more than one file is given (a new line character is
|
||||
//@ introduced between each file).
|
||||
function _cat(options, files) {
|
||||
var cat = common.readFromPipe();
|
||||
|
||||
if (!files && !cat) common.error('no paths given');
|
||||
|
||||
files = [].slice.call(arguments, 1);
|
||||
|
||||
files.forEach(function (file) {
|
||||
if (!fs.existsSync(file)) {
|
||||
common.error('no such file or directory: ' + file);
|
||||
} else if (common.statFollowLinks(file).isDirectory()) {
|
||||
common.error(file + ': Is a directory');
|
||||
}
|
||||
|
||||
cat += fs.readFileSync(file, 'utf8');
|
||||
});
|
||||
|
||||
if (options.number) {
|
||||
cat = addNumbers(cat);
|
||||
}
|
||||
|
||||
return cat;
|
||||
}
|
||||
module.exports = _cat;
|
||||
|
||||
function addNumbers(cat) {
|
||||
var lines = cat.split('\n');
|
||||
var lastLine = lines.pop();
|
||||
|
||||
lines = lines.map(function (line, i) {
|
||||
return numberedLine(i + 1, line);
|
||||
});
|
||||
|
||||
if (lastLine.length) {
|
||||
lastLine = numberedLine(lines.length + 1, lastLine);
|
||||
}
|
||||
lines.push(lastLine);
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function numberedLine(n, line) {
|
||||
// GNU cat use six pad start number + tab. See http://lingrok.org/xref/coreutils/src/cat.c#57
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
|
||||
var number = (' ' + n).slice(-6) + '\t';
|
||||
return number + line;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "function.prototype.name",
|
||||
"version": "1.1.5",
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"description": "An ES2015 spec-compliant `Function.prototype.name` shim",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"prelint": "npm run eccheck",
|
||||
"lint": "eslint .",
|
||||
"postlint": "es-shim-api --bound",
|
||||
"eccheck": "eclint check '*.js' '**/*.js'"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/es-shims/Function.prototype.name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Function.prototype.name",
|
||||
"function",
|
||||
"name",
|
||||
"ES6",
|
||||
"ES2015",
|
||||
"shim",
|
||||
"polyfill",
|
||||
"es-shim API"
|
||||
],
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.19.0",
|
||||
"functions-have-names": "^1.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.2.1",
|
||||
"@ljharb/eslint-config": "^18.0.0",
|
||||
"aud": "^1.1.5",
|
||||
"eclint": "^2.8.1",
|
||||
"eslint": "^7.32.0",
|
||||
"for-each": "^0.3.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"make-arrow-function": "^1.2.0",
|
||||
"make-async-function": "^1.0.0",
|
||||
"make-generator-function": "^2.0.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.3.1",
|
||||
"uglify-register": "^1.0.1"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/9.0..latest",
|
||||
"firefox/4.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/11.6..latest",
|
||||
"opera/next",
|
||||
"safari/5.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
var WeakMap = require('./_WeakMap');
|
||||
|
||||
/** Used to store function metadata. */
|
||||
var metaMap = WeakMap && new WeakMap;
|
||||
|
||||
module.exports = metaMap;
|
||||
@@ -0,0 +1,161 @@
|
||||
# About this CHANGELOG
|
||||
|
||||
This file will include all API breakage, new features, and upgrade info in
|
||||
localForage's lifetime.
|
||||
|
||||
### [1.10.0](https://github.com/localForage/localForage/releases/tag/1.10.0)
|
||||
|
||||
* Avoid uncaught error in `dropInstance`. You can now catch errors thrown by `dropInstance`, see #807.
|
||||
|
||||
### [1.9.0](https://github.com/mozilla/localForage/releases/tag/1.9.0)
|
||||
|
||||
* Fixed TypeScript definition for `getItem`. It now notes that `getItem` can return `null`, so this change may cause TypeScript code that didn't account for `null` values to fail. See #980.
|
||||
|
||||
### [1.8.1](https://github.com/mozilla/localForage/releases/tag/1.8.1)
|
||||
|
||||
* Reverted the ESM/`module` field change in #940, which broke many builds. See: #979. Sorry about that! 😓
|
||||
|
||||
### [1.8.0](https://github.com/mozilla/localForage/releases/tag/1.8.0)
|
||||
|
||||
* No changes to code, but added a `module` field in `package.json` for better ESM support. See: #940.
|
||||
|
||||
### [1.7.4](https://github.com/mozilla/localForage/releases/tag/1.7.4)
|
||||
|
||||
* Use `openKeyCursor` instead of `openCursor` for `key()` retrieval. Props to @MeMark2 for the fix, and thanks to @lincolnthree and @f for additional testing!
|
||||
|
||||
### [1.7.3](https://github.com/mozilla/localForage/releases/tag/1.7.3)
|
||||
|
||||
* Add `.npmignore` file to reduce package size when installed via npm.
|
||||
|
||||
### [1.6](https://github.com/mozilla/localForage/releases/tag/1.6.0)
|
||||
|
||||
* Add `dropInstance()` method to localforage.
|
||||
* Improve IDB driver reliability when a connection gets closed.
|
||||
|
||||
### [1.5.7]
|
||||
|
||||
* Fix IE8 localStorage support detection.
|
||||
|
||||
### [1.5.6]
|
||||
|
||||
* Upgrade lie to 3.1.1 to work with yarn.
|
||||
|
||||
### [1.5.5]
|
||||
|
||||
* Roll back dropInstance breaking change.
|
||||
|
||||
### [1.5.4]
|
||||
|
||||
* Set `null` as `undefined` (for Edge).
|
||||
|
||||
### [1.5.3]
|
||||
|
||||
* Check whether localStorage is actually usable.
|
||||
|
||||
### [1.5.2]
|
||||
|
||||
* Prevent some unnecessary logs when calling `createInstance()`.
|
||||
|
||||
### [1.5.1]
|
||||
|
||||
* Try to re-establish IDB connection after an InvalidStateError.
|
||||
* Added Generics to `iterate()` TS Typings.
|
||||
* Define custom drivers syncronously when `_support` isn't a function.
|
||||
* Use the custom driver API for internal drivers, which makes possible to override parts of their implementation.
|
||||
|
||||
### [1.5](https://github.com/mozilla/localForage/releases/tag/1.5.0)
|
||||
* **Major storage engine change for Safari**: We now use IndexedDB as the storage engine for Safari v10.1 (and above). This means that **pre-existing Safari** `>= 10.1` users will experience "data loss" **after upgrading your site from a previous version of localForage to v1.5**. In fact no data is lost but the engine will change so localForage will seem empty.
|
||||
* You can use the [localForage 1.4 compatibility plugin](https://github.com/localForage/localForage-compatibility-1-4) after the upgrade so that all your Safari users (both old & new) continue to use the WebSQL driver.
|
||||
* Alternativelly you can force a connection to WebSQL using [localForage's config](https://localforage.github.io/localForage/#settings-api-setdriver) to either keep using your existing WebSQL database or migrate to IndexedDB.
|
||||
|
||||
### [1.4.2](https://github.com/mozilla/localForage/releases/tag/1.4.2)
|
||||
* Fixes #562.
|
||||
|
||||
### [1.4.1](https://github.com/mozilla/localForage/releases/tag/1.4.1)
|
||||
* Fixes #520; browserify builds work properly
|
||||
|
||||
### [1.4](https://github.com/mozilla/localForage/releases/tag/1.4.0)
|
||||
* Fixes #516; this version should always load the correct driver without that bug.
|
||||
|
||||
### [1.3](https://github.com/mozilla/localForage/releases/tag/1.3.0)
|
||||
* We now use ES6 for our source code and `webpack` to bundle the `dist/` files.
|
||||
|
||||
### [1.2](https://github.com/mozilla/localForage/releases/tag/1.2.0)
|
||||
* Iterate through the entire database using `iterate()`. ([#283](https://github.com/mozilla/localForage/pull/283); fixes [#186](https://github.com/mozilla/localForage/pull/186))
|
||||
|
||||
### [1.1](https://github.com/mozilla/localForage/releases/tag/1.1.0)
|
||||
* Custom drivers can be created using `defineDriver()`. ([#282](https://github.com/mozilla/localForage/pull/282); fixes [#267](https://github.com/mozilla/localForage/pull/267))
|
||||
|
||||
### [1.0.3](https://github.com/mozilla/localForage/releases/tag/1.0.3)
|
||||
* `config()` accepts a new option: `driver`, so users can set the driver during config rather than using `setDriver()`. ([#273](https://github.com/mozilla/localForage/pull/273); fixes [#168](https://github.com/mozilla/localForage/pull/168))
|
||||
|
||||
### [1.0](https://github.com/mozilla/localForage/releases/tag/1.0.0)
|
||||
|
||||
* It is no longer necessary to queue commands using `ready()` when using RequireJS. ([723cc94e06](https://github.com/mozilla/localForage/commit/723cc94e06af4f5ba4c53fa65524ccd5f6c4432e))
|
||||
* `setDriver` now accepts an array of drivers to be used, in order of preference, instead of simply a string. The string option is still supported. (eg. now one can use `setDriver(['WebSQL', 'localStorage'])` instead of `setDriver('WebSQL')`)
|
||||
* node-style, error-first argument method signatures are used for callbacks. Promises don't use error-first method signatures; instead they supply an error to the promise's `reject()` function.
|
||||
|
||||
### [0.9](https://github.com/mozilla/localForage/releases/tag/0.9.1)
|
||||
|
||||
This release drops support for some legacy browsers, though not actually the
|
||||
ones you might think. localForage's new policy is to support the current
|
||||
version of all major browsers plus up to three versions back.
|
||||
|
||||
* Add built versions without the Promises polyfill to `dist/` directory. ([#172](https://github.com/mozilla/localForage/pull/172))
|
||||
* **Drop support for Firefox 3.5. Minimum version is now Firefox 25.** (Technically, Firefox 4+ seems to work.)
|
||||
* **Drop support for Chrome 31 and below. Minimum version is now Chrome 32.**
|
||||
* Fix a **lot** of bugs. Especially in Internet Exploder.
|
||||
* Switch to Mocha tests and test on [Sauce Labs](https://saucelabs.com/).
|
||||
* Add a `keys()` method. ([#180](https://github.com/mozilla/localForage/pull/180))
|
||||
* Check for localStorage instead of assuming it's available. ([#183](https://github.com/mozilla/localForage/pull/183))
|
||||
|
||||
### [Version 0.8](https://github.com/mozilla/localForage/releases/tag/0.8.1)
|
||||
|
||||
* Add support for web workers. ([#144](https://github.com/mozilla/localForage/pull/144), [#147](https://github.com/mozilla/localForage/pull/147)).
|
||||
|
||||
### [Version 0.6.1](https://github.com/mozilla/localForage/releases/tag/0.6.1)
|
||||
|
||||
* Put built versions back in `dist/` directory.
|
||||
|
||||
### [Version 0.6.0](https://github.com/mozilla/localForage/releases/tag/0.6.0)
|
||||
|
||||
* Add `localforage.config`. ([#40](https://github.com/mozilla/localForage/pull/140))
|
||||
* Fix iFrame bug in WebKit. ([#78](https://github.com/mozilla/localForage/issues/78))
|
||||
* Improve error handling. ([#60](https://github.com/mozilla/localForage/issues/60))
|
||||
* Remove support for `window.localForageConfig`. ([#135](https://github.com/mozilla/localForage/issues/135))
|
||||
|
||||
### [Version 0.4](https://github.com/mozilla/localForage/releases/tag/0.4.0)
|
||||
|
||||
* Built versions of localForage are now in the top-level directory. ([2d11c90](https://github.com/mozilla/localForage/commit/2d11c90))
|
||||
|
||||
### [Version 0.3](https://github.com/mozilla/localForage/releases/tag/0.3.0)
|
||||
|
||||
* Check code quality in test suite ([#124](https://github.com/mozilla/localForage/pull/124))
|
||||
* `_initDriver()` is called after first public API call ([#119](https://github.com/mozilla/localForage/pull/119))
|
||||
|
||||
### [Version 0.2.1](https://github.com/mozilla/localForage/releases/tag/0.2.1)
|
||||
|
||||
* Allow configuration of WebSQL DB size ([commit](https://github.com/mozilla/localForage/commit/6e78fff51a23e729206a03e5b750e959d8610f8c))
|
||||
* Use bower for JS dependencies instead of `vendor/` folder ([#109](https://github.com/mozilla/localForage/pull/109))
|
||||
|
||||
### [Version 0.2.0](https://github.com/mozilla/localForage/releases/tag/0.2.0)
|
||||
|
||||
* Add support for ArrayBuffer, Blob, and TypedArrays ([#54](https://github.com/mozilla/localForage/pull/54), [#73](https://github.com/mozilla/localForage/pull/73))
|
||||
|
||||
### [Version 0.1.1](https://github.com/mozilla/localForage/releases/tag/0.1.1)
|
||||
|
||||
* Added config options to allow users to set their own database names, etc. ([#100](https://github.com/mozilla/localForage/pull/100))
|
||||
|
||||
---
|
||||
|
||||
### March 16th, 2014
|
||||
|
||||
* Moved Backbone adapter to its own repository ([b7987b3091855379d4908376b668b4b51a6fedfe](https://github.com/mozilla/localForage/commit/b7987b3091855379d4908376b668b4b51a6fedfe))
|
||||
|
||||
### March 13th, 2014
|
||||
|
||||
* Changed `localforage.driver` to a function instead of the string directly ([49415145021b0029d2521182de6e338e048fe5b1](https://github.com/mozilla/localForage/commit/49415145021b0029d2521182de6e338e048fe5b1))
|
||||
|
||||
### March 4th, 2014
|
||||
|
||||
* Changed the IndexedDB database name from `asyncStorage` to `localforage` ([f4e0156a29969a79005ac27b303d7e321a720fc6](https://github.com/mozilla/localForage/commit/f4e0156a29969a79005ac27b303d7e321a720fc6))
|
||||
@@ -0,0 +1,134 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var forEach = require('for-each');
|
||||
var debug = require('object-inspect');
|
||||
var getIterator = require('es-get-iterator');
|
||||
var iterate = require('..');
|
||||
|
||||
var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false
|
||||
|
||||
function testIteration(t, iterable, expected, message) {
|
||||
t.deepEqual(iterate(getIterator(iterable)), expected, 'no callback: ' + message);
|
||||
var values = [];
|
||||
iterate(getIterator(iterable), function (x) { values.push(x); });
|
||||
t.deepEqual(values, expected, 'callback: ' + message);
|
||||
return values;
|
||||
}
|
||||
|
||||
function getArguments() {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
test('strings', function (t) {
|
||||
testIteration(t, '', [], 'empty string');
|
||||
testIteration(t, 'abc', ['a', 'b', 'c'], debug('abc'));
|
||||
testIteration(t, 'a💩c', ['a', '💩', 'c'], debug('a💩c'));
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrays', function (t) {
|
||||
forEach([
|
||||
[],
|
||||
[1, 2, 3]
|
||||
], function (arr) {
|
||||
testIteration(t, arr, arr, debug(arr));
|
||||
});
|
||||
t.test('sparse arrays', { skip: !canDistinguishSparseFromUndefined }, function (st) {
|
||||
var sparse = [1, , 3]; // eslint-disable-line no-sparse-arrays
|
||||
var actual = testIteration(st, sparse, [1, undefined, 3], debug(sparse));
|
||||
st.ok(1 in actual, 'actual is not sparse');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arguments', function (t) {
|
||||
var empty = getArguments();
|
||||
testIteration(t, empty, [], debug(empty));
|
||||
|
||||
var args = getArguments(1, 2, 3);
|
||||
testIteration(t, args, [1, 2, 3], debug(args));
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Maps', { skip: typeof Map !== 'function' }, function (t) {
|
||||
var empty = new Map();
|
||||
testIteration(t, empty, [], debug(empty));
|
||||
|
||||
var m = new Map();
|
||||
m.set(1, 2);
|
||||
m.set(3, 4);
|
||||
testIteration(t, m, [[1, 2], [3, 4]], debug(m));
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Sets', { skip: typeof Set !== 'function' }, function (t) {
|
||||
var empty = new Set();
|
||||
testIteration(t, empty, [], debug(empty));
|
||||
|
||||
var s = new Set();
|
||||
s.add(1);
|
||||
s.add(2);
|
||||
testIteration(t, s, [1, 2], debug(s));
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('non-function callbacks', function (t) {
|
||||
forEach([
|
||||
null,
|
||||
undefined,
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
-0,
|
||||
NaN,
|
||||
42,
|
||||
Infinity,
|
||||
'',
|
||||
'abc',
|
||||
/a/g,
|
||||
[],
|
||||
{}
|
||||
], function (nonFunction) {
|
||||
t['throws'](
|
||||
function () { iterate(getIterator([]), nonFunction); },
|
||||
TypeError,
|
||||
debug(nonFunction) + ' is not a Function'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('non-iterators', function (t) {
|
||||
forEach([
|
||||
null,
|
||||
undefined,
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
-0,
|
||||
NaN,
|
||||
42,
|
||||
Infinity,
|
||||
'',
|
||||
'abc',
|
||||
/a/g,
|
||||
[],
|
||||
{}
|
||||
], function (nonIterator) {
|
||||
t['throws'](
|
||||
function () { iterate(nonIterator); },
|
||||
TypeError,
|
||||
debug(nonIterator) + ' is not an iterator'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
// Types that are compatible with all supported TypeScript versions.
|
||||
// It's shared between all TypeScript version-specific definitions.
|
||||
|
||||
// Basic
|
||||
export * from './source/primitive';
|
||||
export * from './source/typed-array';
|
||||
export * from './source/basic';
|
||||
export * from './source/observable-like';
|
||||
|
||||
// Utilities
|
||||
export {Except} from './source/except';
|
||||
export {Mutable} from './source/mutable';
|
||||
export {Merge} from './source/merge';
|
||||
export {MergeExclusive} from './source/merge-exclusive';
|
||||
export {RequireAtLeastOne} from './source/require-at-least-one';
|
||||
export {RequireExactlyOne} from './source/require-exactly-one';
|
||||
export {PartialDeep} from './source/partial-deep';
|
||||
export {ReadonlyDeep} from './source/readonly-deep';
|
||||
export {LiteralUnion} from './source/literal-union';
|
||||
export {Promisable} from './source/promisable';
|
||||
export {Opaque} from './source/opaque';
|
||||
export {SetOptional} from './source/set-optional';
|
||||
export {SetRequired} from './source/set-required';
|
||||
export {ValueOf} from './source/value-of';
|
||||
export {PromiseValue} from './source/promise-value';
|
||||
export {AsyncReturnType} from './source/async-return-type';
|
||||
export {ConditionalExcept} from './source/conditional-except';
|
||||
export {ConditionalKeys} from './source/conditional-keys';
|
||||
export {ConditionalPick} from './source/conditional-pick';
|
||||
export {UnionToIntersection} from './source/union-to-intersection';
|
||||
export {Stringified} from './source/stringified';
|
||||
export {FixedLengthArray} from './source/fixed-length-array';
|
||||
export {IterableElement} from './source/iterable-element';
|
||||
export {Entry} from './source/entry';
|
||||
export {Entries} from './source/entries';
|
||||
export {SetReturnType} from './source/set-return-type';
|
||||
export {Asyncify} from './source/asyncify';
|
||||
export {Simplify} from './source/simplify';
|
||||
|
||||
// Miscellaneous
|
||||
export {PackageJson} from './source/package-json';
|
||||
export {TsConfigJson} from './source/tsconfig-json';
|
||||
@@ -0,0 +1,25 @@
|
||||
import Node from './shared/Node';
|
||||
import Attribute from './Attribute';
|
||||
import Binding from './Binding';
|
||||
import EventHandler from './EventHandler';
|
||||
import Expression from './shared/Expression';
|
||||
import Component from '../Component';
|
||||
import Let from './Let';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
import { INode } from './interfaces';
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
export default class InlineComponent extends Node {
|
||||
type: 'InlineComponent';
|
||||
name: string;
|
||||
expression: Expression;
|
||||
attributes: Attribute[];
|
||||
bindings: Binding[];
|
||||
handlers: EventHandler[];
|
||||
lets: Let[];
|
||||
css_custom_properties: Attribute[];
|
||||
children: INode[];
|
||||
scope: TemplateScope;
|
||||
namespace: string;
|
||||
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
|
||||
get slot_template_name(): string;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
Import a module lazily.
|
||||
|
||||
@example
|
||||
```
|
||||
// Pass in `require` or a custom import function
|
||||
import importLazy = require('import-lazy');
|
||||
const _ = importLazy(require)('lodash');
|
||||
|
||||
// Instead of referring to its exported properties directly…
|
||||
_.isNumber(2);
|
||||
|
||||
// …it's cached on consecutive calls
|
||||
_.isNumber('unicorn');
|
||||
|
||||
// Works out of the box for functions and regular properties
|
||||
const stuff = importLazy(require)('./math-lib');
|
||||
console.log(stuff.sum(1, 2)); // => 3
|
||||
console.log(stuff.PHI); // => 1.618033
|
||||
```
|
||||
*/
|
||||
declare function importLazy<T = unknown>(
|
||||
importFn: (moduleId: string) => T
|
||||
): (moduleId: string) => T;
|
||||
|
||||
export = importLazy;
|
||||
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (!String.prototype.trimStart && !String.prototype.trimLeft) {
|
||||
return implementation;
|
||||
}
|
||||
var zeroWidthSpace = '\u200b';
|
||||
var trimmed = zeroWidthSpace.trimStart ? zeroWidthSpace.trimStart() : zeroWidthSpace.trimLeft();
|
||||
if (trimmed !== zeroWidthSpace) {
|
||||
return implementation;
|
||||
}
|
||||
return String.prototype.trimStart || String.prototype.trimLeft;
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
import assertString from './util/assertString';
|
||||
var validators = {
|
||||
'cs-CZ': function csCZ(str) {
|
||||
return /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str);
|
||||
},
|
||||
'de-DE': function deDE(str) {
|
||||
return /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|SMÜ|SOB|SOG|SOK|SÖM|SON|SPB|SPN|SRB|SRO|STA|STB|STD|STE|STL|SUL|SÜW|SWA|SZB|TBB|TDO|TET|TIR|TÖL|TUT|UEM|UER|UFF|USI|VAI|VEC|VER|VIB|VIE|VIT|VOH|WAF|WAK|WAN|WAR|WAT|WBS|WDA|WEL|WEN|WER|WES|WHV|WIL|WIS|WIT|WIZ|WLG|WMS|WND|WOB|WOH|WOL|WOR|WOS|WRN|WSF|WST|WSW|WTL|WTM|WUG|WÜM|WUN|WUR|WZL|ZEL|ZIG)[- ]?(([A-Z][- ]?\d{1,4})|([A-Z]{2}[- ]?\d{1,3})))[- ]?(E|H)?$/.test(str);
|
||||
},
|
||||
'de-LI': function deLI(str) {
|
||||
return /^FL[- ]?\d{1,5}[UZ]?$/.test(str);
|
||||
},
|
||||
'en-IN': function enIN(str) {
|
||||
return /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str);
|
||||
},
|
||||
'es-AR': function esAR(str) {
|
||||
return /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str);
|
||||
},
|
||||
'fi-FI': function fiFI(str) {
|
||||
return /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str);
|
||||
},
|
||||
'hu-HU': function huHU(str) {
|
||||
return /^((((?!AAA)(([A-NPRSTVZWXY]{1})([A-PR-Z]{1})([A-HJ-NPR-Z]))|(A[ABC]I)|A[ABC]O|A[A-W]Q|BPI|BPO|UCO|UDO|XAO)-(?!000)\d{3})|(M\d{6})|((CK|DT|CD|HC|H[ABEFIKLMNPRSTVX]|MA|OT|R[A-Z]) \d{2}-\d{2})|(CD \d{3}-\d{3})|(C-(C|X) \d{4})|(X-(A|B|C) \d{4})|(([EPVZ]-\d{5}))|(S A[A-Z]{2} \d{2})|(SP \d{2}-\d{2}))$/.test(str);
|
||||
},
|
||||
'pt-BR': function ptBR(str) {
|
||||
return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str);
|
||||
},
|
||||
'pt-PT': function ptPT(str) {
|
||||
return /^([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})[ -·]?([A-Z]{2}|[0-9]{2})$/.test(str);
|
||||
},
|
||||
'sq-AL': function sqAL(str) {
|
||||
return /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str);
|
||||
},
|
||||
'sv-SE': function svSE(str) {
|
||||
return /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(str.trim());
|
||||
}
|
||||
};
|
||||
export default function isLicensePlate(str, locale) {
|
||||
assertString(str);
|
||||
|
||||
if (locale in validators) {
|
||||
return validators[locale](str);
|
||||
} else if (locale === 'any') {
|
||||
for (var key in validators) {
|
||||
/* eslint guard-for-in: 0 */
|
||||
var validator = validators[key];
|
||||
|
||||
if (validator(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new Error("Invalid locale '".concat(locale, "'"));
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ObjectUnsubscribedError.js","sourceRoot":"","sources":["../../../../src/internal/util/ObjectUnsubscribedError.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAqBzC,QAAA,uBAAuB,GAAgC,mCAAgB,CAClF,UAAC,MAAM;IACL,OAAA,SAAS,2BAA2B;QAClC,MAAM,CAAC,IAAI,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,qBAAqB,CAAC;IACvC,CAAC;AAJD,CAIC,CACJ,CAAC"}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var modulo = require('./modulo');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-15.9.1.3
|
||||
|
||||
module.exports = function DaysInYear(y) {
|
||||
if (modulo(y, 4) !== 0) {
|
||||
return 365;
|
||||
}
|
||||
if (modulo(y, 100) !== 0) {
|
||||
return 366;
|
||||
}
|
||||
if (modulo(y, 400) !== 0) {
|
||||
return 365;
|
||||
}
|
||||
return 366;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dnsDomainIs.js","sourceRoot":"","sources":["../src/dnsDomainIs.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAwB,WAAW,CAAC,IAAY,EAAE,MAAc;IAC/D,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;AACnD,CAAC;AAJD,8BAIC"}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016, Jon Schlinkert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var value = require("../../object/valid-value");
|
||||
|
||||
module.exports = function (search, replace) {
|
||||
var index, pos = 0, str = String(value(this)), sl, rl;
|
||||
search = String(search);
|
||||
replace = String(replace);
|
||||
sl = search.length;
|
||||
rl = replace.length;
|
||||
while ((index = str.indexOf(search, pos)) !== -1) {
|
||||
str = str.slice(0, index) + replace + str.slice(index + sl);
|
||||
pos = index + rl;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Toastify JS - Pure JavaScript Toast Notificaton Library</title>
|
||||
<meta name="description" content="Toastify is a pure JavaScript library that lets you create notifications toasts/messages.">
|
||||
<meta name="keywords" content="Javascript,Library,Toastify">
|
||||
<meta name="author" content="apvarun">
|
||||
<link rel="stylesheet" type="text/css" href="example/script.css">
|
||||
<link rel="stylesheet" type="text/css" href="src/toastify.css">
|
||||
</head>
|
||||
|
||||
<body id="root">
|
||||
<div class="container">
|
||||
<div class="lead">
|
||||
<h1>Toastify JS</h1>
|
||||
</div>
|
||||
<p>Better notification messages</p>
|
||||
<div class="buttons">
|
||||
<a href="#" id="new-toast" class="button">Try</a>
|
||||
<a href="https://github.com/apvarun/toastify-js/blob/master/README.md" target="_blank" class="button">Docs</a>
|
||||
<a href="https://twitter.com/intent/tweet?text=Pure+JavaScript+library+for+better+notification+messages&url=https://apvarun.github.io/toastify-js/&hashtags=JavaScript,toast&via=apvarun"
|
||||
target="_blank" class="button">Tweet</a>
|
||||
</div>
|
||||
<div class="docs">
|
||||
<h2>Usage</h2>
|
||||
<code>
|
||||
<p>Toastify({</p>
|
||||
<p class="pad-left">text: "This is a toast",</p>
|
||||
<p class="pad-left">duration: 3000</p>
|
||||
<p>}).showToast();</p>
|
||||
</code>
|
||||
</div>
|
||||
<div class="repo">
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=apvarun&repo=toastify-js&type=star&count=true&size=large" frameborder="0"
|
||||
scrolling="0" width="160px" height="30px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript" src="src/toastify.js"></script>
|
||||
<script type="text/javascript" src="example/script.js"></script>
|
||||
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date(); a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', 'UA-105870436-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,427 @@
|
||||
<h1 align="center">
|
||||
<img width="250" src="https://jaredwray.com/images/keyv.svg" alt="keyv">
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Simple key-value storage with support for multiple backends
|
||||
|
||||
[](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
|
||||
[](https://codecov.io/gh/jaredwray/keyv)
|
||||
[](https://www.npmjs.com/package/keyv)
|
||||
[](https://www.npmjs.com/package/keyv)
|
||||
|
||||
Keyv provides a consistent interface for key-value storage across multiple backends via storage adapters. It supports TTL based expiry, making it suitable as a cache or a persistent key-value store.
|
||||
|
||||
## Features
|
||||
|
||||
There are a few existing modules similar to Keyv, however Keyv is different because it:
|
||||
|
||||
- Isn't bloated
|
||||
- Has a simple Promise based API
|
||||
- Suitable as a TTL based cache or persistent key-value store
|
||||
- [Easily embeddable](#add-cache-support-to-your-module) inside another module
|
||||
- Works with any storage that implements the [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) API
|
||||
- Handles all JSON types plus `Buffer`
|
||||
- Supports namespaces
|
||||
- Wide range of [**efficient, well tested**](#official-storage-adapters) storage adapters
|
||||
- Connection errors are passed through (db failures won't kill your app)
|
||||
- Supports the current active LTS version of Node.js or higher
|
||||
|
||||
## Usage
|
||||
|
||||
Install Keyv.
|
||||
|
||||
```
|
||||
npm install --save keyv
|
||||
```
|
||||
|
||||
By default everything is stored in memory, you can optionally also install a storage adapter.
|
||||
|
||||
```
|
||||
npm install --save @keyv/redis
|
||||
npm install --save @keyv/mongo
|
||||
npm install --save @keyv/sqlite
|
||||
npm install --save @keyv/postgres
|
||||
npm install --save @keyv/mysql
|
||||
npm install --save @keyv/etcd
|
||||
```
|
||||
|
||||
Create a new Keyv instance, passing your connection string if applicable. Keyv will automatically load the correct storage adapter.
|
||||
|
||||
```js
|
||||
const Keyv = require('keyv');
|
||||
|
||||
// One of the following
|
||||
const keyv = new Keyv();
|
||||
const keyv = new Keyv('redis://user:pass@localhost:6379');
|
||||
const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname');
|
||||
const keyv = new Keyv('sqlite://path/to/database.sqlite');
|
||||
const keyv = new Keyv('postgresql://user:pass@localhost:5432/dbname');
|
||||
const keyv = new Keyv('mysql://user:pass@localhost:3306/dbname');
|
||||
const keyv = new Keyv('etcd://localhost:2379');
|
||||
|
||||
// Handle DB connection errors
|
||||
keyv.on('error', err => console.log('Connection Error', err));
|
||||
|
||||
await keyv.set('foo', 'expires in 1 second', 1000); // true
|
||||
await keyv.set('foo', 'never expires'); // true
|
||||
await keyv.get('foo'); // 'never expires'
|
||||
await keyv.delete('foo'); // true
|
||||
await keyv.clear(); // undefined
|
||||
```
|
||||
|
||||
### Namespaces
|
||||
|
||||
You can namespace your Keyv instance to avoid key collisions and allow you to clear only a certain namespace while using the same database.
|
||||
|
||||
```js
|
||||
const users = new Keyv('redis://user:pass@localhost:6379', { namespace: 'users' });
|
||||
const cache = new Keyv('redis://user:pass@localhost:6379', { namespace: 'cache' });
|
||||
|
||||
await users.set('foo', 'users'); // true
|
||||
await cache.set('foo', 'cache'); // true
|
||||
await users.get('foo'); // 'users'
|
||||
await cache.get('foo'); // 'cache'
|
||||
await users.clear(); // undefined
|
||||
await users.get('foo'); // undefined
|
||||
await cache.get('foo'); // 'cache'
|
||||
```
|
||||
|
||||
### Custom Serializers
|
||||
|
||||
Keyv uses [`json-buffer`](https://github.com/dominictarr/json-buffer) for data serialization to ensure consistency across different backends.
|
||||
|
||||
You can optionally provide your own serialization functions to support extra data types or to serialize to something other than JSON.
|
||||
|
||||
```js
|
||||
const keyv = new Keyv({ serialize: JSON.stringify, deserialize: JSON.parse });
|
||||
```
|
||||
|
||||
**Warning:** Using custom serializers means you lose any guarantee of data consistency. You should do extensive testing with your serialisation functions and chosen storage engine.
|
||||
|
||||
## Official Storage Adapters
|
||||
|
||||
The official storage adapters are covered by [over 150 integration tests](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml) to guarantee consistent behaviour. They are lightweight, efficient wrappers over the DB clients making use of indexes and native TTLs where available.
|
||||
|
||||
Database | Adapter | Native TTL
|
||||
---|---|---
|
||||
Redis | [@keyv/redis](https://github.com/jaredwray/keyv/tree/master/packages/redis) | Yes
|
||||
MongoDB | [@keyv/mongo](https://github.com/jaredwray/keyv/tree/master/packages/mongo) | Yes
|
||||
SQLite | [@keyv/sqlite](https://github.com/jaredwray/keyv/tree/master/packages/sqlite) | No
|
||||
PostgreSQL | [@keyv/postgres](https://github.com/jaredwray/keyv/tree/master/packages/postgres) | No
|
||||
MySQL | [@keyv/mysql](https://github.com/jaredwray/keyv/tree/master/packages/mysql) | No
|
||||
Etcd | [@keyv/etcd](https://github.com/jaredwray/keyv/tree/master/packages/etcd) | Yes
|
||||
Memcache | [@keyv/memcache](https://github.com/jaredwray/keyv/tree/master/packages/memcache) | Yes
|
||||
|
||||
## Third-party Storage Adapters
|
||||
|
||||
You can also use third-party storage adapters or build your own. Keyv will wrap these storage adapters in TTL functionality and handle complex types internally.
|
||||
|
||||
```js
|
||||
const Keyv = require('keyv');
|
||||
const myAdapter = require('./my-storage-adapter');
|
||||
|
||||
const keyv = new Keyv({ store: myAdapter });
|
||||
```
|
||||
|
||||
Any store that follows the [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) api will work.
|
||||
|
||||
```js
|
||||
new Keyv({ store: new Map() });
|
||||
```
|
||||
|
||||
For example, [`quick-lru`](https://github.com/sindresorhus/quick-lru) is a completely unrelated module that implements the Map API.
|
||||
|
||||
```js
|
||||
const Keyv = require('keyv');
|
||||
const QuickLRU = require('quick-lru');
|
||||
|
||||
const lru = new QuickLRU({ maxSize: 1000 });
|
||||
const keyv = new Keyv({ store: lru });
|
||||
```
|
||||
|
||||
The following are third-party storage adapters compatible with Keyv:
|
||||
|
||||
- [quick-lru](https://github.com/sindresorhus/quick-lru) - Simple "Least Recently Used" (LRU) cache
|
||||
- [keyv-file](https://github.com/zaaack/keyv-file) - File system storage adapter for Keyv
|
||||
- [keyv-dynamodb](https://www.npmjs.com/package/keyv-dynamodb) - DynamoDB storage adapter for Keyv
|
||||
- [keyv-lru](https://www.npmjs.com/package/keyv-lru) - LRU storage adapter for Keyv
|
||||
- [keyv-null](https://www.npmjs.com/package/keyv-null) - Null storage adapter for Keyv
|
||||
- [keyv-firestore ](https://github.com/goto-bus-stop/keyv-firestore) – Firebase Cloud Firestore adapter for Keyv
|
||||
- [keyv-mssql](https://github.com/pmorgan3/keyv-mssql) - Microsoft Sql Server adapter for Keyv
|
||||
- [keyv-azuretable](https://github.com/howlowck/keyv-azuretable) - Azure Table Storage/API adapter for Keyv
|
||||
|
||||
## Add Cache Support to your Module
|
||||
|
||||
Keyv is designed to be easily embedded into other modules to add cache support. The recommended pattern is to expose a `cache` option in your modules options which is passed through to Keyv. Caching will work in memory by default and users have the option to also install a Keyv storage adapter and pass in a connection string, or any other storage that implements the `Map` API.
|
||||
|
||||
You should also set a namespace for your module so you can safely call `.clear()` without clearing unrelated app data.
|
||||
|
||||
Inside your module:
|
||||
|
||||
```js
|
||||
class AwesomeModule {
|
||||
constructor(opts) {
|
||||
this.cache = new Keyv({
|
||||
uri: typeof opts.cache === 'string' && opts.cache,
|
||||
store: typeof opts.cache !== 'string' && opts.cache,
|
||||
namespace: 'awesome-module'
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now it can be consumed like this:
|
||||
|
||||
```js
|
||||
const AwesomeModule = require('awesome-module');
|
||||
|
||||
// Caches stuff in memory by default
|
||||
const awesomeModule = new AwesomeModule();
|
||||
|
||||
// After npm install --save keyv-redis
|
||||
const awesomeModule = new AwesomeModule({ cache: 'redis://localhost' });
|
||||
|
||||
// Some third-party module that implements the Map API
|
||||
const awesomeModule = new AwesomeModule({ cache: some3rdPartyStore });
|
||||
```
|
||||
|
||||
## Compression
|
||||
|
||||
Keyv supports `gzip` and `brotli` compression. To enable compression, pass the `compress` option to the constructor.
|
||||
|
||||
```js
|
||||
const KeyvGzip = require('@keyv/compress-gzip');
|
||||
const Keyv = require('keyv');
|
||||
|
||||
const keyvGzip = new KeyvGzip();
|
||||
const keyv = new Keyv({ compression: KeyvGzip });
|
||||
```
|
||||
|
||||
You can also pass a custom compression function to the `compression` option. Following the pattern of the official compression adapters.
|
||||
|
||||
### Want to build your own?
|
||||
|
||||
Great! Keyv is designed to be easily extended. You can build your own compression adapter by following the pattern of the official compression adapters based on this interface:
|
||||
|
||||
```typescript
|
||||
interface CompressionAdapter {
|
||||
async compress(value: any, options?: any);
|
||||
async decompress(value: any, options?: any);
|
||||
async serialize(value: any);
|
||||
async deserialize(value: any);
|
||||
}
|
||||
```
|
||||
|
||||
In addition to the interface, you can test it with our compression test suite using @keyv/test-suite:
|
||||
|
||||
```js
|
||||
const {keyvCompresstionTests} = require('@keyv/test-suite');
|
||||
const KeyvGzip = require('@keyv/compress-gzip');
|
||||
|
||||
keyvCompresstionTests(test, new KeyvGzip());
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### new Keyv([uri], [options])
|
||||
|
||||
Returns a new Keyv instance.
|
||||
|
||||
The Keyv instance is also an `EventEmitter` that will emit an `'error'` event if the storage adapter connection fails.
|
||||
|
||||
### uri
|
||||
|
||||
Type: `String`<br>
|
||||
Default: `undefined`
|
||||
|
||||
The connection string URI.
|
||||
|
||||
Merged into the options object as options.uri.
|
||||
|
||||
### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
The options object is also passed through to the storage adapter. Check your storage adapter docs for any extra options.
|
||||
|
||||
#### options.namespace
|
||||
|
||||
Type: `String`<br>
|
||||
Default: `'keyv'`
|
||||
|
||||
Namespace for the current instance.
|
||||
|
||||
#### options.ttl
|
||||
|
||||
Type: `Number`<br>
|
||||
Default: `undefined`
|
||||
|
||||
Default TTL. Can be overridden by specififying a TTL on `.set()`.
|
||||
|
||||
#### options.compression
|
||||
|
||||
Type: `@keyv/compress-<compression_package_name>`<br>
|
||||
Default: `undefined`
|
||||
|
||||
Compression package to use. See [Compression](#compression) for more details.
|
||||
|
||||
#### options.serialize
|
||||
|
||||
Type: `Function`<br>
|
||||
Default: `JSONB.stringify`
|
||||
|
||||
A custom serialization function.
|
||||
|
||||
#### options.deserialize
|
||||
|
||||
Type: `Function`<br>
|
||||
Default: `JSONB.parse`
|
||||
|
||||
A custom deserialization function.
|
||||
|
||||
#### options.store
|
||||
|
||||
Type: `Storage adapter instance`<br>
|
||||
Default: `new Map()`
|
||||
|
||||
The storage adapter instance to be used by Keyv.
|
||||
|
||||
#### options.adapter
|
||||
|
||||
Type: `String`<br>
|
||||
Default: `undefined`
|
||||
|
||||
Specify an adapter to use. e.g `'redis'` or `'mongodb'`.
|
||||
|
||||
### Instance
|
||||
|
||||
Keys must always be strings. Values can be of any type.
|
||||
|
||||
#### .set(key, value, [ttl])
|
||||
|
||||
Set a value.
|
||||
|
||||
By default keys are persistent. You can set an expiry TTL in milliseconds.
|
||||
|
||||
Returns a promise which resolves to `true`.
|
||||
|
||||
#### .get(key, [options])
|
||||
|
||||
Returns a promise which resolves to the retrieved value.
|
||||
|
||||
##### options.raw
|
||||
|
||||
Type: `Boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
If set to true the raw DB object Keyv stores internally will be returned instead of just the value.
|
||||
|
||||
This contains the TTL timestamp.
|
||||
|
||||
#### .delete(key)
|
||||
|
||||
Deletes an entry.
|
||||
|
||||
Returns a promise which resolves to `true` if the key existed, `false` if not.
|
||||
|
||||
#### .clear()
|
||||
|
||||
Delete all entries in the current namespace.
|
||||
|
||||
Returns a promise which is resolved when the entries have been cleared.
|
||||
|
||||
#### .iterator()
|
||||
|
||||
Iterate over all entries of the current namespace.
|
||||
|
||||
Returns a iterable that can be iterated by for-of loops. For example:
|
||||
|
||||
```js
|
||||
// please note that the "await" keyword should be used here
|
||||
for await (const [key, value] of this.keyv.iterator()) {
|
||||
console.log(key, value);
|
||||
};
|
||||
```
|
||||
|
||||
# How to Contribute
|
||||
|
||||
In this section of the documentation we will cover:
|
||||
|
||||
1) How to set up this repository locally
|
||||
2) How to get started with running commands
|
||||
3) How to contribute changes using Pull Requests
|
||||
|
||||
## Dependencies
|
||||
|
||||
This package requires the following dependencies to run:
|
||||
|
||||
1) [Yarn V1](https://yarnpkg.com/getting-started/install)
|
||||
3) [Docker](https://docs.docker.com/get-docker/)
|
||||
|
||||
## Setting up your workspace
|
||||
|
||||
To contribute to this repository, start by setting up this project locally:
|
||||
|
||||
1) Fork this repository into your Git account
|
||||
2) Clone the forked repository to your local directory using `git clone`
|
||||
3) Install any of the above missing dependencies
|
||||
|
||||
## Launching the project
|
||||
|
||||
Once the project is installed locally, you are ready to start up its services:
|
||||
|
||||
1) Ensure that your Docker service is running.
|
||||
2) From the root directory of your project, run the `yarn` command in the command prompt to install yarn.
|
||||
3) Run the `yarn bootstrap` command to install any necessary dependencies.
|
||||
4) Run `yarn test:services:start` to start up this project's Docker container. The container will launch all services within your workspace.
|
||||
|
||||
## Available Commands
|
||||
|
||||
Once the project is running, you can execute a variety of commands. The root workspace and each subpackage contain a `package.json` file with a `scripts` field listing all the commands that can be executed from that directory. This project also supports native `yarn`, and `docker` commands.
|
||||
|
||||
Here, we'll cover the primary commands that can be executed from the root directory. Unless otherwise noted, these commands can also be executed from a subpackage. If executed from a subpackage, they will only affect that subpackage, rather than the entire workspace.
|
||||
|
||||
### `yarn`
|
||||
|
||||
The `yarn` command installs yarn in the workspace.
|
||||
|
||||
### `yarn bootstrap`
|
||||
|
||||
The `yarn bootstrap` command installs all dependencies in the workspace.
|
||||
|
||||
### `yarn test:services:start`
|
||||
|
||||
The `yarn test:services:start` command starts up the project's Docker container, launching all services in the workspace. This command must be executed from the root directory.
|
||||
|
||||
### `yarn test:services:stop`
|
||||
|
||||
The `yarn test:services:stop` command brings down the project's Docker container, halting all services. This command must be executed from the root directory.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
The `yarn test` command runs all tests in the workspace.
|
||||
|
||||
### `yarn clean`
|
||||
|
||||
The `yarn clean` command removes yarn and all dependencies installed by yarn. After executing this command, you must repeat the steps in *Setting up your workspace* to rebuild your workspace.
|
||||
|
||||
## Contributing Changes
|
||||
|
||||
Now that you've set up your workspace, you're ready to contribute changes to the `keyv` repository.
|
||||
|
||||
1) Make any changes that you would like to contribute in your local workspace.
|
||||
2) After making these changes, ensure that the project's tests still pass by executing the `yarn test` command in the root directory.
|
||||
3) Commit your changes and push them to your forked repository.
|
||||
4) Navigate to the original `keyv` repository and go the *Pull Requests* tab.
|
||||
5) Click the *New pull request* button, and open a pull request for the branch in your repository that contains your changes.
|
||||
6) Once your pull request is created, ensure that all checks have passed and that your branch has no conflicts with the base branch. If there are any issues, resolve these changes in your local repository, and then commit and push them to git.
|
||||
7) Similarly, respond to any reviewer comments or requests for changes by making edits to your local repository and pushing them to Git.
|
||||
8) Once the pull request has been reviewed, those with write access to the branch will be able to merge your changes into the `keyv` repository.
|
||||
|
||||
If you need more information on the steps to create a pull request, you can find a detailed walkthrough in the [Github documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
|
||||
|
||||
## License
|
||||
|
||||
MIT © Jared Wray
|
||||
@@ -0,0 +1,71 @@
|
||||
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
||||
// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
|
||||
// `Function#prototype` is non-writable and non-configurable so can never be modified.
|
||||
if (property === 'length' || property === 'prototype') {
|
||||
return;
|
||||
}
|
||||
|
||||
// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
|
||||
if (property === 'arguments' || property === 'caller') {
|
||||
return;
|
||||
}
|
||||
|
||||
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
||||
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
||||
|
||||
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.defineProperty(to, property, fromDescriptor);
|
||||
};
|
||||
|
||||
// `Object.defineProperty()` throws if the property exists, is not configurable and either:
|
||||
// - one its descriptors is changed
|
||||
// - it is non-writable and its value is changed
|
||||
const canCopyProperty = function (toDescriptor, fromDescriptor) {
|
||||
return toDescriptor === undefined || toDescriptor.configurable || (
|
||||
toDescriptor.writable === fromDescriptor.writable &&
|
||||
toDescriptor.enumerable === fromDescriptor.enumerable &&
|
||||
toDescriptor.configurable === fromDescriptor.configurable &&
|
||||
(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)
|
||||
);
|
||||
};
|
||||
|
||||
const changePrototype = (to, from) => {
|
||||
const fromPrototype = Object.getPrototypeOf(from);
|
||||
if (fromPrototype === Object.getPrototypeOf(to)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(to, fromPrototype);
|
||||
};
|
||||
|
||||
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
||||
|
||||
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
|
||||
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
|
||||
|
||||
// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
|
||||
// We use `bind()` instead of a closure for the same reason.
|
||||
// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
|
||||
const changeToString = (to, from, name) => {
|
||||
const withName = name === '' ? '' : `with ${name.trim()}() `;
|
||||
const newToString = wrappedToString.bind(null, withName, from.toString());
|
||||
// Ensure `to.toString.toString` is non-enumerable and has the same `same`
|
||||
Object.defineProperty(newToString, 'name', toStringName);
|
||||
Object.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});
|
||||
};
|
||||
|
||||
export default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {
|
||||
const {name} = to;
|
||||
|
||||
for (const property of Reflect.ownKeys(from)) {
|
||||
copyProperty(to, from, property, ignoreNonConfigurable);
|
||||
}
|
||||
|
||||
changePrototype(to, from);
|
||||
changeToString(to, from, name);
|
||||
|
||||
return to;
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
/***********************************************************************
|
||||
|
||||
A JavaScript tokenizer / parser / beautifier / compressor.
|
||||
https://github.com/mishoo/UglifyJS
|
||||
|
||||
-------------------------------- (C) ---------------------------------
|
||||
|
||||
Author: Mihai Bazon
|
||||
<mihai.bazon@gmail.com>
|
||||
http://mihai.bazon.net/blog
|
||||
|
||||
Distributed under the BSD license:
|
||||
|
||||
Copyright 2012 (c) Mihai Bazon <mihai.bazon@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
"use strict";
|
||||
|
||||
function characters(str) {
|
||||
return str.split("");
|
||||
}
|
||||
|
||||
function member(name, array) {
|
||||
return array.indexOf(name) >= 0;
|
||||
}
|
||||
|
||||
function find_if(func, array) {
|
||||
for (var i = array.length; --i >= 0;) if (func(array[i])) return array[i];
|
||||
}
|
||||
|
||||
function configure_error_stack(fn) {
|
||||
Object.defineProperty(fn.prototype, "stack", {
|
||||
get: function() {
|
||||
var err = new Error(this.message);
|
||||
err.name = this.name;
|
||||
try {
|
||||
throw err;
|
||||
} catch (e) {
|
||||
return e.stack;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function DefaultsError(msg, defs) {
|
||||
this.message = msg;
|
||||
this.defs = defs;
|
||||
}
|
||||
DefaultsError.prototype = Object.create(Error.prototype);
|
||||
DefaultsError.prototype.constructor = DefaultsError;
|
||||
DefaultsError.prototype.name = "DefaultsError";
|
||||
configure_error_stack(DefaultsError);
|
||||
|
||||
function defaults(args, defs, croak) {
|
||||
if (croak) for (var i in args) {
|
||||
if (HOP(args, i) && !HOP(defs, i)) throw new DefaultsError("`" + i + "` is not a supported option", defs);
|
||||
}
|
||||
for (var i in args) {
|
||||
if (HOP(args, i)) defs[i] = args[i];
|
||||
}
|
||||
return defs;
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
function return_false() { return false; }
|
||||
function return_true() { return true; }
|
||||
function return_this() { return this; }
|
||||
function return_null() { return null; }
|
||||
|
||||
var List = (function() {
|
||||
function List(a, f) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
var val = f(a[i], i);
|
||||
if (val === skip) continue;
|
||||
if (val instanceof Splice) {
|
||||
ret.push.apply(ret, val.v);
|
||||
} else {
|
||||
ret.push(val);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
List.is_op = function(val) {
|
||||
return val === skip || val instanceof Splice;
|
||||
};
|
||||
List.splice = function(val) {
|
||||
return new Splice(val);
|
||||
};
|
||||
var skip = List.skip = {};
|
||||
function Splice(val) {
|
||||
this.v = val;
|
||||
}
|
||||
return List;
|
||||
})();
|
||||
|
||||
function push_uniq(array, el) {
|
||||
if (array.indexOf(el) < 0) return array.push(el);
|
||||
}
|
||||
|
||||
function string_template(text, props) {
|
||||
return text.replace(/\{([^{}]+)\}/g, function(str, p) {
|
||||
var value = p == "this" ? props : props[p];
|
||||
if (value instanceof AST_Node) return value.print_to_string();
|
||||
if (value instanceof AST_Token) return value.file + ":" + value.line + "," + value.col;
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
function remove(array, el) {
|
||||
var index = array.indexOf(el);
|
||||
if (index >= 0) array.splice(index, 1);
|
||||
}
|
||||
|
||||
function makePredicate(words) {
|
||||
if (!Array.isArray(words)) words = words.split(" ");
|
||||
var map = Object.create(null);
|
||||
words.forEach(function(word) {
|
||||
map[word] = true;
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
function all(array, predicate) {
|
||||
for (var i = array.length; --i >= 0;)
|
||||
if (!predicate(array[i], i))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function Dictionary() {
|
||||
this.values = Object.create(null);
|
||||
}
|
||||
Dictionary.prototype = {
|
||||
set: function(key, val) {
|
||||
if (key == "__proto__") {
|
||||
this.proto_value = val;
|
||||
} else {
|
||||
this.values[key] = val;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
add: function(key, val) {
|
||||
var list = this.get(key);
|
||||
if (list) {
|
||||
list.push(val);
|
||||
} else {
|
||||
this.set(key, [ val ]);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
get: function(key) {
|
||||
return key == "__proto__" ? this.proto_value : this.values[key];
|
||||
},
|
||||
del: function(key) {
|
||||
if (key == "__proto__") {
|
||||
delete this.proto_value;
|
||||
} else {
|
||||
delete this.values[key];
|
||||
}
|
||||
return this;
|
||||
},
|
||||
has: function(key) {
|
||||
return key == "__proto__" ? "proto_value" in this : key in this.values;
|
||||
},
|
||||
all: function(predicate) {
|
||||
for (var i in this.values)
|
||||
if (!predicate(this.values[i], i)) return false;
|
||||
if ("proto_value" in this && !predicate(this.proto_value, "__proto__")) return false;
|
||||
return true;
|
||||
},
|
||||
each: function(f) {
|
||||
for (var i in this.values)
|
||||
f(this.values[i], i);
|
||||
if ("proto_value" in this) f(this.proto_value, "__proto__");
|
||||
},
|
||||
size: function() {
|
||||
return Object.keys(this.values).length + ("proto_value" in this);
|
||||
},
|
||||
map: function(f) {
|
||||
var ret = [];
|
||||
for (var i in this.values)
|
||||
ret.push(f(this.values[i], i));
|
||||
if ("proto_value" in this) ret.push(f(this.proto_value, "__proto__"));
|
||||
return ret;
|
||||
},
|
||||
clone: function() {
|
||||
var ret = new Dictionary();
|
||||
this.each(function(value, i) {
|
||||
ret.set(i, value);
|
||||
});
|
||||
return ret;
|
||||
},
|
||||
toObject: function() {
|
||||
var obj = {};
|
||||
this.each(function(value, i) {
|
||||
obj["$" + i] = value;
|
||||
});
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
Dictionary.fromObject = function(obj) {
|
||||
var dict = new Dictionary();
|
||||
for (var i in obj)
|
||||
if (HOP(obj, i)) dict.set(i.slice(1), obj[i]);
|
||||
return dict;
|
||||
};
|
||||
|
||||
function HOP(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
|
||||
// return true if the node at the top of the stack (that means the
|
||||
// innermost node in the current output) is lexically the first in
|
||||
// a statement.
|
||||
function first_in_statement(stack, arrow, export_default) {
|
||||
var node = stack.parent(-1);
|
||||
for (var i = 0, p; p = stack.parent(i++); node = p) {
|
||||
if (is_arrow(p)) {
|
||||
return arrow && p.value === node;
|
||||
} else if (p instanceof AST_Binary) {
|
||||
if (p.left === node) continue;
|
||||
} else if (p.TYPE == "Call") {
|
||||
if (p.expression === node) continue;
|
||||
} else if (p instanceof AST_Conditional) {
|
||||
if (p.condition === node) continue;
|
||||
} else if (p instanceof AST_ExportDefault) {
|
||||
return export_default;
|
||||
} else if (p instanceof AST_PropAccess) {
|
||||
if (p.expression === node) continue;
|
||||
} else if (p instanceof AST_Sequence) {
|
||||
if (p.expressions[0] === node) continue;
|
||||
} else if (p instanceof AST_SimpleStatement) {
|
||||
return true;
|
||||
} else if (p instanceof AST_Template) {
|
||||
if (p.tag === node) continue;
|
||||
} else if (p instanceof AST_UnaryPostfix) {
|
||||
if (p.expression === node) continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function DEF_BITPROPS(ctor, props) {
|
||||
if (props.length > 31) throw new Error("Too many properties: " + props.length + "\n" + props.join(", "));
|
||||
props.forEach(function(name, pos) {
|
||||
var mask = 1 << pos;
|
||||
Object.defineProperty(ctor.prototype, name, {
|
||||
get: function() {
|
||||
return !!(this._bits & mask);
|
||||
},
|
||||
set: function(val) {
|
||||
if (val)
|
||||
this._bits |= mask;
|
||||
else
|
||||
this._bits &= ~mask;
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -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 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 I v J D E EC FC"},D:{"1":"OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB"},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":"BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB PC QC RC SC qB AC TC rB"},G:{"1":"cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC"},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:{"1":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:2,C:"CSS font-stretch"};
|
||||
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var Promise = getNative(root, 'Promise');
|
||||
|
||||
module.exports = Promise;
|
||||
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var isBoolean = require('../');
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
|
||||
test('not Booleans', function (t) {
|
||||
t.test('primitives', function (st) {
|
||||
st.notOk(isBoolean(), 'undefined is not Boolean');
|
||||
st.notOk(isBoolean(null), 'null is not Boolean');
|
||||
st.notOk(isBoolean(0), '0 is not Boolean');
|
||||
st.notOk(isBoolean(NaN), 'NaN is not Boolean');
|
||||
st.notOk(isBoolean(Infinity), 'Infinity is not Boolean');
|
||||
st.notOk(isBoolean('foo'), 'string is not Boolean');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('objects', function (st) {
|
||||
st.notOk(isBoolean(Object(42)), 'number object is not Boolean');
|
||||
st.notOk(isBoolean([]), 'array is not Boolean');
|
||||
st.notOk(isBoolean({}), 'object is not Boolean');
|
||||
st.notOk(isBoolean(function () {}), 'function is not Boolean');
|
||||
st.notOk(isBoolean(/a/g), 'regex literal is not Boolean');
|
||||
st.notOk(isBoolean(new RegExp('a', 'g')), 'regex object is not Boolean');
|
||||
st.notOk(isBoolean(new Date()), 'new Date() is not Boolean');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
|
||||
var fakeBoolean = {
|
||||
toString: function () { return 'true'; },
|
||||
valueOf: function () { return true; }
|
||||
};
|
||||
fakeBoolean[Symbol.toStringTag] = 'Boolean';
|
||||
t.notOk(isBoolean(fakeBoolean), 'fake Boolean with @@toStringTag "Boolean" is not Boolean');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Booleans', function (t) {
|
||||
t.ok(isBoolean(true), 'true is Boolean');
|
||||
t.ok(isBoolean(false), 'false is Boolean');
|
||||
t.ok(isBoolean(Object(true)), 'Object(true) is Boolean');
|
||||
t.ok(isBoolean(Object(false)), 'Object(false) is Boolean');
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
|
||||
|
||||
declare function ensureSafeInteger(value: any, options?: EnsureBaseOptions): number;
|
||||
declare function ensureSafeInteger(value: any, options?: EnsureBaseOptions & EnsureIsOptional): number | null;
|
||||
declare function ensureSafeInteger(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<number>): number;
|
||||
|
||||
export default ensureSafeInteger;
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toFloat;
|
||||
|
||||
var _isFloat = _interopRequireDefault(require("./isFloat"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toFloat(str) {
|
||||
if (!(0, _isFloat.default)(str)) return NaN;
|
||||
return parseFloat(str);
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,22 @@
|
||||
// JS-YAML's default schema for `safeLoad` function.
|
||||
// It is not described in the YAML specification.
|
||||
//
|
||||
// This schema is based on standard YAML's Core schema and includes most of
|
||||
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = require('./core').extend({
|
||||
implicit: [
|
||||
require('../type/timestamp'),
|
||||
require('../type/merge')
|
||||
],
|
||||
explicit: [
|
||||
require('../type/binary'),
|
||||
require('../type/omap'),
|
||||
require('../type/pairs'),
|
||||
require('../type/set')
|
||||
]
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
define(['exports', 'module', '../utils', '../exception'], function (exports, module, _utils, _exception) {
|
||||
'use strict';
|
||||
|
||||
// istanbul ignore next
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _Exception = _interopRequireDefault(_exception);
|
||||
|
||||
module.exports = function (instance) {
|
||||
instance.registerHelper('if', function (conditional, options) {
|
||||
if (arguments.length != 2) {
|
||||
throw new _Exception['default']('#if requires exactly one argument');
|
||||
}
|
||||
if (_utils.isFunction(conditional)) {
|
||||
conditional = conditional.call(this);
|
||||
}
|
||||
|
||||
// Default behavior is to render the positive path if the value is truthy and not empty.
|
||||
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
|
||||
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
|
||||
if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
|
||||
return options.inverse(this);
|
||||
} else {
|
||||
return options.fn(this);
|
||||
}
|
||||
});
|
||||
|
||||
instance.registerHelper('unless', function (conditional, options) {
|
||||
if (arguments.length != 2) {
|
||||
throw new _Exception['default']('#unless requires exactly one argument');
|
||||
}
|
||||
return instance.helpers['if'].call(this, conditional, {
|
||||
fn: options.inverse,
|
||||
inverse: options.fn,
|
||||
hash: options.hash
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2hlbHBlcnMvaWYuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O21CQUdlLFVBQVMsUUFBUSxFQUFFO0FBQ2hDLFlBQVEsQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLFVBQVMsV0FBVyxFQUFFLE9BQU8sRUFBRTtBQUMzRCxVQUFJLFNBQVMsQ0FBQyxNQUFNLElBQUksQ0FBQyxFQUFFO0FBQ3pCLGNBQU0sMEJBQWMsbUNBQW1DLENBQUMsQ0FBQztPQUMxRDtBQUNELFVBQUksT0FSVSxVQUFVLENBUVQsV0FBVyxDQUFDLEVBQUU7QUFDM0IsbUJBQVcsR0FBRyxXQUFXLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO09BQ3RDOzs7OztBQUtELFVBQUksQUFBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsV0FBVyxJQUFJLENBQUMsV0FBVyxJQUFLLE9BZjlDLE9BQU8sQ0FlK0MsV0FBVyxDQUFDLEVBQUU7QUFDdkUsZUFBTyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO09BQzlCLE1BQU07QUFDTCxlQUFPLE9BQU8sQ0FBQyxFQUFFLENBQUMsSUFBSSxDQUFDLENBQUM7T0FDekI7S0FDRixDQUFDLENBQUM7O0FBRUgsWUFBUSxDQUFDLGNBQWMsQ0FBQyxRQUFRLEVBQUUsVUFBUyxXQUFXLEVBQUUsT0FBTyxFQUFFO0FBQy9ELFVBQUksU0FBUyxDQUFDLE1BQU0sSUFBSSxDQUFDLEVBQUU7QUFDekIsY0FBTSwwQkFBYyx1Q0FBdUMsQ0FBQyxDQUFDO09BQzlEO0FBQ0QsYUFBTyxRQUFRLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsV0FBVyxFQUFFO0FBQ3BELFVBQUUsRUFBRSxPQUFPLENBQUMsT0FBTztBQUNuQixlQUFPLEVBQUUsT0FBTyxDQUFDLEVBQUU7QUFDbkIsWUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO09BQ25CLENBQUMsQ0FBQztLQUNKLENBQUMsQ0FBQztHQUNKIiwiZmlsZSI6ImlmLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgaXNFbXB0eSwgaXNGdW5jdGlvbiB9IGZyb20gJy4uL3V0aWxzJztcbmltcG9ydCBFeGNlcHRpb24gZnJvbSAnLi4vZXhjZXB0aW9uJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oaW5zdGFuY2UpIHtcbiAgaW5zdGFuY2UucmVnaXN0ZXJIZWxwZXIoJ2lmJywgZnVuY3Rpb24oY29uZGl0aW9uYWwsIG9wdGlvbnMpIHtcbiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCAhPSAyKSB7XG4gICAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCcjaWYgcmVxdWlyZXMgZXhhY3RseSBvbmUgYXJndW1lbnQnKTtcbiAgICB9XG4gICAgaWYgKGlzRnVuY3Rpb24oY29uZGl0aW9uYWwpKSB7XG4gICAgICBjb25kaXRpb25hbCA9IGNvbmRpdGlvbmFsLmNhbGwodGhpcyk7XG4gICAgfVxuXG4gICAgLy8gRGVmYXVsdCBiZWhhdmlvciBpcyB0byByZW5kZXIgdGhlIHBvc2l0aXZlIHBhdGggaWYgdGhlIHZhbHVlIGlzIHRydXRoeSBhbmQgbm90IGVtcHR5LlxuICAgIC8vIFRoZSBgaW5jbHVkZVplcm9gIG9wdGlvbiBtYXkgYmUgc2V0IHRvIHRyZWF0IHRoZSBjb25kdGlvbmFsIGFzIHB1cmVseSBub3QgZW1wdHkgYmFzZWQgb24gdGhlXG4gICAgLy8gYmVoYXZpb3Igb2YgaXNFbXB0eS4gRWZmZWN0aXZlbHkgdGhpcyBkZXRlcm1pbmVzIGlmIDAgaXMgaGFuZGxlZCBieSB0aGUgcG9zaXRpdmUgcGF0aCBvciBuZWdhdGl2ZS5cbiAgICBpZiAoKCFvcHRpb25zLmhhc2guaW5jbHVkZVplcm8gJiYgIWNvbmRpdGlvbmFsKSB8fCBpc0VtcHR5KGNvbmRpdGlvbmFsKSkge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuaW52ZXJzZSh0aGlzKTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIG9wdGlvbnMuZm4odGhpcyk7XG4gICAgfVxuICB9KTtcblxuICBpbnN0YW5jZS5yZWdpc3RlckhlbHBlcigndW5sZXNzJywgZnVuY3Rpb24oY29uZGl0aW9uYWwsIG9wdGlvbnMpIHtcbiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCAhPSAyKSB7XG4gICAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCcjdW5sZXNzIHJlcXVpcmVzIGV4YWN0bHkgb25lIGFyZ3VtZW50Jyk7XG4gICAgfVxuICAgIHJldHVybiBpbnN0YW5jZS5oZWxwZXJzWydpZiddLmNhbGwodGhpcywgY29uZGl0aW9uYWwsIHtcbiAgICAgIGZuOiBvcHRpb25zLmludmVyc2UsXG4gICAgICBpbnZlcnNlOiBvcHRpb25zLmZuLFxuICAgICAgaGFzaDogb3B0aW9ucy5oYXNoXG4gICAgfSk7XG4gIH0pO1xufVxuIl19
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0.00434,"49":0,"50":0,"51":0.00434,"52":0.05646,"53":0,"54":0,"55":0,"56":0.00434,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0.02172,"67":0,"68":0.0304,"69":0,"70":0,"71":0,"72":0.00434,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00869,"79":0,"80":0.01737,"81":0.00434,"82":0.00434,"83":0.00869,"84":0.00869,"85":0.00434,"86":0,"87":0,"88":0.00869,"89":0.00434,"90":0.00434,"91":0.00869,"92":0,"93":0.00434,"94":0,"95":0.00434,"96":0.00434,"97":0.00434,"98":0.00434,"99":0.00869,"100":0.00434,"101":0.00434,"102":0.07817,"103":0.01303,"104":0.00869,"105":0.00869,"106":0.01737,"107":0.02172,"108":0.0608,"109":1.43753,"110":0.87729,"111":0.00434,"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.00434,"34":0,"35":0,"36":0,"37":0,"38":0.00434,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.05646,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.00434,"59":0,"60":0,"61":0,"62":0,"63":0.00434,"64":0,"65":0,"66":0,"67":0.00434,"68":0,"69":0,"70":0.00434,"71":0.00434,"72":0,"73":0.00434,"74":0.00434,"75":0.00434,"76":0.00434,"77":0.00869,"78":0.00434,"79":0.0304,"80":0.00434,"81":0.02172,"83":0.00434,"84":0.00434,"85":0.00869,"86":0.00434,"87":0.01303,"88":0.00869,"89":0.00869,"90":0.00434,"91":0.00869,"92":0.01303,"93":0.0304,"94":0.00434,"95":0.01303,"96":0.00434,"97":0.01303,"98":0.00869,"99":0.00434,"100":0.01303,"101":0.00434,"102":0.01737,"103":0.03474,"104":0.01737,"105":0.0304,"106":0.03474,"107":0.0608,"108":0.3127,"109":7.89123,"110":4.02596,"111":0.00434,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0.00869,"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.00434,"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.00434,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.00434,"74":0.00434,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0.00869,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.0304,"94":0.3735,"95":0.25624,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0.00434,"17":0,"18":0.00869,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.00434,"104":0,"105":0,"106":0,"107":0.00869,"108":0.02172,"109":0.57328,"110":0.73831},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00434,"14":0.01303,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00434,"13.1":0.01737,"14.1":0.02172,"15.1":0.00434,"15.2-15.3":0.00434,"15.4":0.00869,"15.5":0.00869,"15.6":0.06949,"16.0":0.01303,"16.1":0.03474,"16.2":0.08686,"16.3":0.08252,"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.00561,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.01822,"10.0-10.2":0.0014,"10.3":0.04624,"11.0-11.2":0.01541,"11.3-11.4":0.0042,"12.0-12.1":0.00981,"12.2-12.5":0.21721,"13.0-13.1":0.00981,"13.2":0.0028,"13.3":0.01541,"13.4-13.7":0.05746,"14.0-14.4":0.15135,"14.5-14.8":0.39238,"15.0-15.1":0.07287,"15.2-15.3":0.1023,"15.4":0.13873,"15.5":0.29008,"15.6":0.95713,"16.0":1.655,"16.1":3.34924,"16.2":3.43192,"16.3":2.22115,"16.4":0.01401},P:{"4":0.08204,"20":0.85113,"5.0-5.4":0.01025,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.02051,"12.0":0.01025,"13.0":0.03076,"14.0":0.04102,"15.0":0.02051,"16.0":0.05127,"17.0":0.05127,"18.0":0.08204,"19.0":1.65098},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.01029,"4.2-4.3":0.02572,"4.4":0,"4.4.3-4.4.4":0.18005},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.00434,"9":0,"10":0,"11":0.08686,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.02263},H:{"0":0.25172},L:{"0":63.3669},R:{_:"0"},M:{"0":0.17537},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var indexOf = require("./e-index-of")
|
||||
, every = Array.prototype.every
|
||||
, isFirst;
|
||||
|
||||
isFirst = function (value, index) { return indexOf.call(this, value) === index; };
|
||||
|
||||
module.exports = function () { return every.call(this, isFirst, this); };
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"switchScan.js","sourceRoot":"","sources":["../../../../src/internal/operators/switchScan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqBvC,MAAM,UAAU,UAAU,CACxB,WAAmD,EACnD,IAAO;IAEP,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QAGpC,IAAI,KAAK,GAAG,IAAI,CAAC;QAKjB,SAAS,CAGP,CAAC,KAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAGrD,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,UAAU,CAAC,CACtD,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAEhC,OAAO,GAAG,EAAE;YAEV,KAAK,GAAG,IAAK,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
Reference in New Issue
Block a user