mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 12:16:38 +08:00
[adone] refactoring, fixes (#23321)
* refactoring, fixes * add sprintf * [assertion] replace assert properties with methods * [assertion] is* -> * * [data.json] add newline opt for encode * [data.mpak] add tryDecode, add constructor opt for Serializer, add registerCommonTypesFor function * [data.base64] add encoding param for decode * [stream] make core a namespace, stream.core() -> core.create(), stream.CoreStream -> stream.core.Stream * [fs] add readlinkSync, utimes, utimesSync, utimesMillis, readdirp, appendFIleSync, rmEmpty * [fs] remove fd namespace, put everything into fs * [fs] add mkdirSync, mkdirp, mkdirpSync * [fs] fix copy, add copyTo * [fs] pos options for tail * [is] add type guards * [promise] add props, retry * [shani] add todo for it/describe * [utils] remove mapArguments, functionParams, by, stripBom, GlobExp, sqlstring.(arrayToList, bufferToString objectToValues), buffer.(concat, mask, unmask), userid * [utils] fix toposort, class ReInterval -> function reinterval, move throttle into its own namespace and add options, move RateLimiter to throttle * [utils] add buffer.toArrayBuffer, buffer.xor, arrayDiff, fillRange, inflection, merge, omit, parseTime, pick, querystring, regexNot, repeat, signalNameToCode, splitBuffer, splitString, toRegex, xorDistance, braces, match * event.EventEmitter -> event.Emitter
This commit is contained in:
2
types/adone/adone.d.ts
vendored
2
types/adone/adone.d.ts
vendored
@@ -110,6 +110,8 @@ declare namespace adone {
|
||||
export function require(path: string): object;
|
||||
export const package: object;
|
||||
|
||||
export function sprintf(format: string, ...args: any[]): string;
|
||||
|
||||
namespace I {
|
||||
interface Runtime {
|
||||
term: object; // TODO
|
||||
|
||||
2
types/adone/glosses/archives.d.ts
vendored
2
types/adone/glosses/archives.d.ts
vendored
@@ -448,7 +448,7 @@ declare namespace adone {
|
||||
isCompressed(): boolean;
|
||||
}
|
||||
|
||||
interface ZipFile<StringType> extends event.EventEmitter {
|
||||
interface ZipFile<StringType> extends event.Emitter {
|
||||
/**
|
||||
* true until close() is called; then it's false
|
||||
*/
|
||||
|
||||
130
types/adone/glosses/assertion.d.ts
vendored
130
types/adone/glosses/assertion.d.ts
vendored
@@ -53,18 +53,10 @@ declare namespace adone {
|
||||
* Throws an AssertionError, like node.js
|
||||
*/
|
||||
fail(actual?: any, expected?: any, message?: string, operator?: any): void;
|
||||
/**
|
||||
* Asserts that value is truthy
|
||||
*/
|
||||
isOk(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is truthy
|
||||
*/
|
||||
ok(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is falsy
|
||||
*/
|
||||
isNotOk(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is falsy
|
||||
*/
|
||||
@@ -104,51 +96,51 @@ declare namespace adone {
|
||||
/**
|
||||
* Asserts that value > above
|
||||
*/
|
||||
isAbove(value: any, above: any, message?: string): void;
|
||||
above(value: any, above: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value >= atLeast
|
||||
*/
|
||||
isAtLeast(value: any, atLeast: any, message?: string): void;
|
||||
atLeast(value: any, atLeast: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value < below
|
||||
*/
|
||||
isBelow(value: any, below: any, message?: string): void;
|
||||
below(value: any, below: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value <= atMost
|
||||
*/
|
||||
isAtMost(value: any, atMost: any, message?: string): void;
|
||||
atMost(value: any, atMost: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is true
|
||||
*/
|
||||
isTrue(value: any, message?: string): void;
|
||||
true(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not true
|
||||
*/
|
||||
isNotTrue(value: any, message?: string): void;
|
||||
notTrue(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is false
|
||||
*/
|
||||
isFalse(value: any, message?: string): void;
|
||||
false(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not false
|
||||
*/
|
||||
isNotFalse(value: any, message?: string): void;
|
||||
notFalse(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is null
|
||||
*/
|
||||
isNull(value: any, message?: string): void;
|
||||
null(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that valus is not null
|
||||
*/
|
||||
isNotNull(value: any, message?: string): void;
|
||||
notNull(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is NaN
|
||||
*/
|
||||
isNaN(value: any, message?: string): void;
|
||||
NaN(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not NaN
|
||||
*/
|
||||
isNotNaN(value: any, message?: string): void;
|
||||
NotNaN(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is neither null nor undefined
|
||||
*/
|
||||
@@ -160,63 +152,63 @@ declare namespace adone {
|
||||
/**
|
||||
* Asserts that value is undefined
|
||||
*/
|
||||
isUndefined(value: any, message?: string): void;
|
||||
undefined(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not undefined
|
||||
*/
|
||||
isDefined(value: any, message?: string): void;
|
||||
defined(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is a function
|
||||
*/
|
||||
isFunction(value: any, message?: string): void;
|
||||
function(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not a function
|
||||
*/
|
||||
isNotFunction(value: any, message?: string): void;
|
||||
notFunction(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is an object of type Object
|
||||
*/
|
||||
isObject(value: any, message?: string): void;
|
||||
object(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not an object of type Object
|
||||
*/
|
||||
isNotObject(value: any, message?: string): void;
|
||||
notObject(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is an array
|
||||
*/
|
||||
isArray(value: any, message?: string): void;
|
||||
array(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not an array
|
||||
*/
|
||||
isNotArray(value: any, message?: string): void;
|
||||
notArray(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is a string
|
||||
*/
|
||||
isString(value: any, message?: string): void;
|
||||
string(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not a string
|
||||
*/
|
||||
isNotString(value: any, message?: string): void;
|
||||
notString(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is a number
|
||||
*/
|
||||
isNumber(value: any, message?: string): void;
|
||||
number(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not a number
|
||||
*/
|
||||
isNotNumber(value: any, message?: string): void;
|
||||
notNumber(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is a finite number
|
||||
*/
|
||||
isFinite(value: any, message?: string): void;
|
||||
finite(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is a boolean
|
||||
*/
|
||||
isBoolean(value: any, message?: string): void;
|
||||
boolean(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not a boolean
|
||||
*/
|
||||
isNotBoolean(value: any, message?: string): void;
|
||||
notBoolean(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value's type is `type`
|
||||
*/
|
||||
@@ -562,66 +554,34 @@ declare namespace adone {
|
||||
* Throws an error if value is truthy
|
||||
*/
|
||||
ifError(value: any): void;
|
||||
/**
|
||||
* Asserts that object is extensible
|
||||
*/
|
||||
isExtensible(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is extensible
|
||||
*/
|
||||
extensible(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is not extensible
|
||||
*/
|
||||
isNotExtensible(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is not extensible
|
||||
*/
|
||||
notExtensible(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is sealed
|
||||
*/
|
||||
isSealed(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is sealed
|
||||
*/
|
||||
sealed(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is not sealed
|
||||
*/
|
||||
isNotSealed(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is not sealed
|
||||
*/
|
||||
notSealed(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is frozen
|
||||
*/
|
||||
isFrozen(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is frozen
|
||||
*/
|
||||
frozen(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is not frozen
|
||||
*/
|
||||
isNotFrozen(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that object is not frozen
|
||||
*/
|
||||
notFrozen(object: object, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is empty
|
||||
*/
|
||||
isEmpty(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is empty
|
||||
*/
|
||||
empty(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not empty
|
||||
*/
|
||||
isNotEmpty(value: any, message?: string): void;
|
||||
/**
|
||||
* Asserts that value is not empty
|
||||
*/
|
||||
@@ -710,43 +670,43 @@ declare namespace adone {
|
||||
/**
|
||||
* Asserts that the target is non-strictly equal to true
|
||||
*/
|
||||
ok: this;
|
||||
ok(): this;
|
||||
/**
|
||||
* Asserts that the target is true
|
||||
*/
|
||||
true: this;
|
||||
true(): this;
|
||||
/**
|
||||
* Asserts that the target is false
|
||||
*/
|
||||
false: this;
|
||||
false(): this;
|
||||
/**
|
||||
* Asserts that the target is null
|
||||
*/
|
||||
null: this;
|
||||
null(): this;
|
||||
/**
|
||||
* Asserts that the target is undefined
|
||||
*/
|
||||
undefined: this;
|
||||
undefined(): this;
|
||||
/**
|
||||
* Asserts that the target is NaN
|
||||
*/
|
||||
NaN: this;
|
||||
NaN(): this;
|
||||
/**
|
||||
* Asserts that the target is neither null nor undefined
|
||||
*/
|
||||
exist: this;
|
||||
exist(): this;
|
||||
/**
|
||||
* Asserts that the target is empty
|
||||
*/
|
||||
empty: this;
|
||||
empty(): this;
|
||||
/**
|
||||
* Asserts that the target is an arguments object
|
||||
*/
|
||||
arguments: this;
|
||||
arguments(): this;
|
||||
/**
|
||||
* Asserts that the target is an arguments object
|
||||
*/
|
||||
Arguments: this;
|
||||
Arguments(): this;
|
||||
/**
|
||||
* Asserts that the target is strictly equal to value(===)
|
||||
*/
|
||||
@@ -976,26 +936,26 @@ declare namespace adone {
|
||||
/**
|
||||
* Asserts that the target is extensible
|
||||
*/
|
||||
extensible: this;
|
||||
extensible(): this;
|
||||
/**
|
||||
* Asserts that the target is sealed
|
||||
*/
|
||||
sealed: this;
|
||||
sealed(): this;
|
||||
/**
|
||||
* Asserts that the target is frozen
|
||||
*/
|
||||
frozen: this;
|
||||
frozen(): this;
|
||||
/**
|
||||
* Asserts that the target is a finite number
|
||||
*/
|
||||
finite: this;
|
||||
finite(): this;
|
||||
}
|
||||
|
||||
interface MockAssertions extends Assertion {
|
||||
/**
|
||||
* Asserts that the spy has been called
|
||||
*/
|
||||
called: this;
|
||||
called(): this;
|
||||
/**
|
||||
* Asserts that the spy has been called n times
|
||||
*/
|
||||
@@ -1003,15 +963,15 @@ declare namespace adone {
|
||||
/**
|
||||
* Asserts that the spy has been called once
|
||||
*/
|
||||
calledOnce: this;
|
||||
calledOnce(): this;
|
||||
/**
|
||||
* Asserts that the spy has been called twice
|
||||
*/
|
||||
calledTwice: this;
|
||||
calledTwice(): this;
|
||||
/**
|
||||
* Asserts that the spy has been been called with `new`
|
||||
*/
|
||||
calledThrice: this;
|
||||
calledThrice(): this;
|
||||
/**
|
||||
* Asserts that the spy has been called before anotherSpy
|
||||
*/
|
||||
|
||||
32
types/adone/glosses/data.d.ts
vendored
32
types/adone/glosses/data.d.ts
vendored
@@ -30,7 +30,12 @@ declare namespace adone {
|
||||
* or an array of String and Number objects that serve as a whitelist
|
||||
* for selecting/filtering the properties of the value object to be included in the JSON string
|
||||
*/
|
||||
replacer?: I.Replacer
|
||||
replacer?: I.Replacer,
|
||||
|
||||
/**
|
||||
* Wheter to append a newline
|
||||
*/
|
||||
newline?: boolean
|
||||
}): Buffer;
|
||||
|
||||
/**
|
||||
@@ -84,6 +89,8 @@ declare namespace adone {
|
||||
*/
|
||||
function decode(buf: collection.I.ByteArray.Wrappable): any;
|
||||
|
||||
function tryDecode(buf: collection.ByteArray): any;
|
||||
|
||||
namespace I {
|
||||
type Type = string | number; // ?
|
||||
type DecodeFunction = (buf: collection.ByteArray) => any;
|
||||
@@ -153,6 +160,8 @@ declare namespace adone {
|
||||
* Represents a MessagePack serializer
|
||||
*/
|
||||
class Serializer {
|
||||
constructor(initialCapacity?: number);
|
||||
|
||||
/**
|
||||
* Encoder instance
|
||||
*/
|
||||
@@ -211,6 +220,8 @@ declare namespace adone {
|
||||
* x.Exception, Error, Date, Map, Set, math.Long
|
||||
*/
|
||||
const serializer: Serializer;
|
||||
|
||||
function registerCommonTypesFor(s: Serializer): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,21 +255,32 @@ declare namespace adone {
|
||||
* Base64 encoder
|
||||
*/
|
||||
namespace base64 {
|
||||
namespace I {
|
||||
interface DecodeOptions {
|
||||
buffer?: boolean;
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
interface EncodeOptions {
|
||||
buffer?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a string/Buffer to base64
|
||||
*/
|
||||
function encode(str: string | Buffer, options: { buffer: false }): string;
|
||||
function encode(str: string | Buffer, options?: { buffer?: true }): Buffer;
|
||||
function encode(str: string | Buffer, options: I.EncodeOptions & { buffer: false }): string;
|
||||
function encode(str: string | Buffer, options?: I.EncodeOptions): Buffer;
|
||||
|
||||
/**
|
||||
* Decodes base64 string/buffer into a buffer
|
||||
*/
|
||||
function decode(str: string | Buffer, options: { buffer: true }): Buffer;
|
||||
function decode(str: string | Buffer, options: I.DecodeOptions & { buffer: true }): Buffer;
|
||||
|
||||
/**
|
||||
* Decodes base64 string/buffer into a string
|
||||
*/
|
||||
function decode(str: string | Buffer, options?: { buffer?: false }): string;
|
||||
function decode(str: string | Buffer, options?: I.DecodeOptions): string;
|
||||
|
||||
function encodeVLQ(value: number): string;
|
||||
|
||||
|
||||
6
types/adone/glosses/events.d.ts
vendored
6
types/adone/glosses/events.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
declare namespace adone {
|
||||
namespace event {
|
||||
class EventEmitter {
|
||||
static listenerCount(emitter: EventEmitter, event: string | symbol): number;
|
||||
class Emitter {
|
||||
static listenerCount(emitter: Emitter, event: string | symbol): number;
|
||||
static defaultMaxListeners: number;
|
||||
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
@@ -19,7 +19,7 @@ declare namespace adone {
|
||||
listenerCount(type: string | symbol): number;
|
||||
}
|
||||
|
||||
class AsyncEmitter extends EventEmitter {
|
||||
class AsyncEmitter extends Emitter {
|
||||
constructor(concurrency?: number);
|
||||
|
||||
setConcurrency(max?: number): this;
|
||||
|
||||
6
types/adone/glosses/fast.d.ts
vendored
6
types/adone/glosses/fast.d.ts
vendored
@@ -152,7 +152,7 @@ declare namespace adone {
|
||||
type SymbolicFile = File;
|
||||
|
||||
/* tslint:disable-next-line:no-empty-interface */
|
||||
interface Stream<S, T = File> extends stream.CoreStream<S, T> {
|
||||
interface Stream<S, T = File> extends stream.core.Stream<S, T> {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ declare namespace adone {
|
||||
export const File: I.FileConstructor;
|
||||
|
||||
namespace I {
|
||||
type CoreStreamSource = stream.I.CoreStream.Source<any, File>;
|
||||
type CoreStreamSource = stream.core.I.Source<any, File>;
|
||||
|
||||
interface LocalStreamConstructorOptions {
|
||||
/**
|
||||
@@ -586,7 +586,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Read JSON manifests written out by revisionHash
|
||||
*/
|
||||
manifest?: File[] | stream.CoreStream<any, File>,
|
||||
manifest?: File[] | stream.core.Stream<any, File>,
|
||||
|
||||
/**
|
||||
* Modify the name of the unreved files before using them
|
||||
|
||||
568
types/adone/glosses/fs.d.ts
vendored
568
types/adone/glosses/fs.d.ts
vendored
@@ -22,6 +22,14 @@ declare namespace adone {
|
||||
function readlink(path: string | Buffer | I.URL, options: { encoding: null }): Promise<Buffer>;
|
||||
function readlink(path: string | Buffer | I.URL, options?: { encoding?: I.Encoding }): Promise<string>;
|
||||
|
||||
/**
|
||||
* Reads the value of a symbolic link
|
||||
*/
|
||||
function readlinkSync(path: string | Buffer | I.URL, encoding: null): Buffer;
|
||||
function readlinkSync(path: string | Buffer | I.URL, encoding: I.Encoding): string;
|
||||
function readlinkSync(path: string | Buffer | I.URL, options: { encoding: null }): Buffer;
|
||||
function readlinkSync(path: string | Buffer | I.URL, options?: { encoding?: I.Encoding }): string;
|
||||
|
||||
/**
|
||||
* Deletes a name and possibly the file it refers to
|
||||
*/
|
||||
@@ -32,6 +40,21 @@ declare namespace adone {
|
||||
*/
|
||||
function unlinkSync(path: string | Buffer | I.URL): void;
|
||||
|
||||
/**
|
||||
* Changes the file system timestamps of the object referenced by path
|
||||
*/
|
||||
function utimes(path: string | Buffer | I.URL, atime: number | string | Date, mtime: number | string | Date): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes the file system timestamps of the object referenced by path
|
||||
*/
|
||||
function utimesSync(path: string | Buffer | I.URL, atime: number | string | Date, mtime: number | string | Date): void;
|
||||
|
||||
/**
|
||||
* Changes the file system timestamps of the object referenced by path
|
||||
*/
|
||||
function utimesMillis(path: string | Buffer | I.URL, atime: number, mtime: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes permissions of a file
|
||||
*/
|
||||
@@ -42,6 +65,11 @@ declare namespace adone {
|
||||
*/
|
||||
function chown(path: string | Buffer | I.URL, uid: number, gid: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes ownership recursively for a given path
|
||||
*/
|
||||
function chownr(path: string | Buffer | I.URL, uid: number, gid: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Deletes a directory
|
||||
*/
|
||||
@@ -63,6 +91,87 @@ declare namespace adone {
|
||||
function readdirSync(path: string | Buffer | I.URL, options: { encoding: null }): Buffer[];
|
||||
function readdirSync(path: string | Buffer | I.URL, options?: { encoding?: I.Encoding }): string[];
|
||||
|
||||
namespace I {
|
||||
interface ReaddirpEntry {
|
||||
/**
|
||||
* filename
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* full path to a file
|
||||
*/
|
||||
fullPath: string;
|
||||
|
||||
/**
|
||||
* relative path to a file
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
* relative path to the parent dir
|
||||
*/
|
||||
parentDir: string;
|
||||
|
||||
/**
|
||||
* full path to the parent dir
|
||||
*/
|
||||
fullParentDir: string;
|
||||
|
||||
/**
|
||||
* file stats
|
||||
*/
|
||||
stat: fs.I.Stats;
|
||||
}
|
||||
|
||||
type ReaddirpFilter = string | ((entry: ReaddirpEntry) => boolean);
|
||||
|
||||
interface ReaddirpOptions {
|
||||
/**
|
||||
* filter for files
|
||||
*/
|
||||
fileFilter?: ReaddirpFilter | ReaddirpFilter[];
|
||||
|
||||
/**
|
||||
* filter for directories
|
||||
*/
|
||||
directoryFilter?: ReaddirpFilter | ReaddirpFilter[];
|
||||
|
||||
/**
|
||||
* maximum recursion depth
|
||||
*
|
||||
* Infinity by default
|
||||
*/
|
||||
depth?: number;
|
||||
|
||||
/**
|
||||
* whether to emit files
|
||||
*
|
||||
* true by default
|
||||
*/
|
||||
files?: boolean;
|
||||
|
||||
/**
|
||||
* whether to emit directories
|
||||
*
|
||||
* true by default
|
||||
*/
|
||||
directories?: boolean;
|
||||
|
||||
/**
|
||||
* whether to use lstat for stating
|
||||
*
|
||||
* false by default
|
||||
*/
|
||||
lstat?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverses the given path
|
||||
*/
|
||||
function readdirp(root: string | Buffer | I.URL, options?: I.ReaddirpOptions): stream.core.Stream<never, I.ReaddirpEntry>;
|
||||
|
||||
/**
|
||||
* Gets file status, identical to stat, except that if pathname is a symbolic link,
|
||||
* then it returns information about the link itself, not the file that it refers to
|
||||
@@ -117,6 +226,15 @@ declare namespace adone {
|
||||
flag?: I.Flag
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* Appends data to a file, creating the file if it does not yet exist
|
||||
*/
|
||||
function appendFileSync(file: string | Buffer | number, data: string | Buffer, options?: {
|
||||
encoding?: I.Encoding,
|
||||
mode?: number,
|
||||
flag?: I.Flag
|
||||
}): void;
|
||||
|
||||
/**
|
||||
* Tests a user's permissions for the file or directory specified by path
|
||||
*/
|
||||
@@ -154,6 +272,14 @@ declare namespace adone {
|
||||
cwd?: string
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* Recursively deletes empty directiries inside the given directory
|
||||
*/
|
||||
function rmEmpty(path: string, options?: {
|
||||
cwd?: string;
|
||||
filter?: (filename: string) => boolean
|
||||
}): Promise<void>;
|
||||
|
||||
namespace I {
|
||||
interface Access {
|
||||
read: boolean;
|
||||
@@ -460,12 +586,12 @@ declare namespace adone {
|
||||
/**
|
||||
* Copies this from this directory to the given path
|
||||
*/
|
||||
copyTo(destPath: string, options?: I.CopyOptions): Promise<void>;
|
||||
copyTo(destPath: string, options?: I.CopyToOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Copies files from the given path to this directory
|
||||
*/
|
||||
copyFrom(srcPath: string, options?: I.CopyOptions): Promise<void>;
|
||||
copyFrom(srcPath: string, options?: I.CopyToOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates a new directory with the given path
|
||||
@@ -560,7 +686,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Represents a file that supports random access
|
||||
*/
|
||||
class RandomAccessFile extends event.EventEmitter {
|
||||
class RandomAccessFile extends event.Emitter {
|
||||
constructor(filename: string, options?: I.RandomAccessFile.ConstructorOptions);
|
||||
|
||||
/**
|
||||
@@ -602,7 +728,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Represents an abstract random access reader
|
||||
*/
|
||||
class AbstractRandomAccessReader extends event.EventEmitter {
|
||||
class AbstractRandomAccessReader extends event.Emitter {
|
||||
/**
|
||||
* Increments the reference counter
|
||||
*/
|
||||
@@ -826,7 +952,7 @@ declare namespace adone {
|
||||
}>;
|
||||
}
|
||||
|
||||
type Stream<T> = stream.CoreStream<never, T>;
|
||||
type Stream<T> = stream.core.Stream<never, T>;
|
||||
|
||||
interface EmitterConstructor {
|
||||
new(pattern: string, optons: Options, callback?: (error: any, matches: string[]) => void): Emitter;
|
||||
@@ -835,7 +961,7 @@ declare namespace adone {
|
||||
prototype: Emitter;
|
||||
}
|
||||
|
||||
interface Emitter extends event.EventEmitter {
|
||||
interface Emitter extends event.Emitter {
|
||||
isIgnored(path: string): boolean;
|
||||
|
||||
/**
|
||||
@@ -999,7 +1125,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Represents a file watcher
|
||||
*/
|
||||
class Watcher extends event.EventEmitter {
|
||||
class Watcher extends event.Emitter {
|
||||
constructor(options?: I.Watcher.ConstructorOptions);
|
||||
|
||||
/**
|
||||
@@ -1128,214 +1254,209 @@ declare namespace adone {
|
||||
function whichSync(cmd: string, options?: I.Which.Options): string;
|
||||
|
||||
/**
|
||||
* Functions to work with files using file descriptors
|
||||
* Opens and possibly creates a file
|
||||
*/
|
||||
namespace fd {
|
||||
/**
|
||||
* Opens and possibly create a file
|
||||
*/
|
||||
function open(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): Promise<I.FD>;
|
||||
function open(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): Promise<I.FD>;
|
||||
|
||||
/**
|
||||
* Opens and possibly create a file
|
||||
*/
|
||||
function openSync(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): I.FD;
|
||||
/**
|
||||
* Opens and possibly creates a file
|
||||
*/
|
||||
function openSync(path: string | Buffer | I.URL, flags: I.Flag | number, mode?: number): I.FD;
|
||||
|
||||
/**
|
||||
* Closes a file descriptor
|
||||
*/
|
||||
function close(fd: I.FD): Promise<void>;
|
||||
/**
|
||||
* Closes a file descriptor
|
||||
*/
|
||||
function close(fd: I.FD): Promise<void>;
|
||||
|
||||
/**
|
||||
* Closes a file descriptor
|
||||
*/
|
||||
function closeSync(fd: I.FD): void;
|
||||
/**
|
||||
* Closes a file descriptor
|
||||
*/
|
||||
function closeSync(fd: I.FD): void;
|
||||
|
||||
/**
|
||||
* Changes the file timestamps of a file referenced by the supplied file descriptor
|
||||
*/
|
||||
function utimes(fd: I.FD, atime: number, mtime: number): Promise<void>;
|
||||
/**
|
||||
* Changes the file timestamps of a file referenced by the supplied file descriptor
|
||||
*/
|
||||
function futimes(fd: I.FD, atime: number, mtime: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes the file timestamps of a file referenced by the supplied file descriptor
|
||||
*/
|
||||
function utimesSync(fd: I.FD, atime: number, mtime: number): void;
|
||||
/**
|
||||
* Changes the file timestamps of a file referenced by the supplied file descriptor
|
||||
*/
|
||||
function futimesSync(fd: I.FD, atime: number, mtime: number): void;
|
||||
|
||||
/**
|
||||
* Gets file status
|
||||
*/
|
||||
function stat(fd: I.FD): Promise<I.Stats>;
|
||||
/**
|
||||
* Gets file status
|
||||
*/
|
||||
function fstat(fd: I.FD): Promise<I.Stats>;
|
||||
|
||||
/**
|
||||
* Gets file status
|
||||
*/
|
||||
function statSync(fd: I.FD): I.Stats;
|
||||
/**
|
||||
* Gets file status
|
||||
*/
|
||||
function fstatSync(fd: I.FD): I.Stats;
|
||||
|
||||
/**
|
||||
* Truncates a file to a specified length
|
||||
*/
|
||||
function truncate(fd: I.FD, length?: number): Promise<void>;
|
||||
/**
|
||||
* Truncates a file to a specified length
|
||||
*/
|
||||
function ftruncate(fd: I.FD, length?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Truncates a file to a specified length
|
||||
*/
|
||||
function truncateSync(fd: I.FD, length?: number): void;
|
||||
/**
|
||||
* Truncates a file to a specified length
|
||||
*/
|
||||
function ftruncateSync(fd: I.FD, length?: number): void;
|
||||
|
||||
/**
|
||||
* Read data from the file specified by fd
|
||||
*/
|
||||
function read(
|
||||
fd: I.FD,
|
||||
/**
|
||||
* Read data from the file specified by fd
|
||||
* The buffer that the data will be written to
|
||||
*/
|
||||
function read(
|
||||
fd: I.FD,
|
||||
/**
|
||||
* The buffer that the data will be written to
|
||||
*/
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* The offset in the buffer to start writing at
|
||||
*/
|
||||
offset: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to read
|
||||
*/
|
||||
length: number,
|
||||
/**
|
||||
* An argument specifying where to begin reading from in the file
|
||||
*/
|
||||
position: number
|
||||
): Promise<number>;
|
||||
|
||||
function readSync(
|
||||
fd: I.FD,
|
||||
/**
|
||||
* The buffer that the data will be written to
|
||||
*/
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* The offset in the buffer to start writing at
|
||||
*/
|
||||
offset: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to read
|
||||
*/
|
||||
length: number,
|
||||
/**
|
||||
* An argument specifying where to begin reading from in the file
|
||||
*/
|
||||
position: number
|
||||
): number;
|
||||
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* Writes buffer to the file specified by fd
|
||||
* The offset in the buffer to start writing at
|
||||
*/
|
||||
function write(
|
||||
fd: I.FD,
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* Determines the part of the buffer to be written
|
||||
*/
|
||||
offset?: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to write
|
||||
*/
|
||||
length?: number,
|
||||
/**
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
position?: number
|
||||
): Promise<number>;
|
||||
|
||||
offset: number,
|
||||
/**
|
||||
* Writes string to the file specified by fd
|
||||
* An integer specifying the number of bytes to read
|
||||
*/
|
||||
function write(
|
||||
fd: I.FD,
|
||||
string: string,
|
||||
/**
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
position?: number,
|
||||
/**
|
||||
* The expected string encoding
|
||||
*/
|
||||
encoding?: I.Encoding
|
||||
): Promise<number>;
|
||||
|
||||
length: number,
|
||||
/**
|
||||
* Writes buffer to the file specified by fd
|
||||
* An argument specifying where to begin reading from in the file
|
||||
*/
|
||||
function writeSync(
|
||||
fd: I.FD,
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* Determines the part of the buffer to be written
|
||||
*/
|
||||
offset?: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to write
|
||||
*/
|
||||
length?: number,
|
||||
/**
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
position?: number
|
||||
): number;
|
||||
position: number
|
||||
): Promise<number>;
|
||||
|
||||
function readSync(
|
||||
fd: I.FD,
|
||||
/**
|
||||
* Writes string to the file specified by fd
|
||||
* The buffer that the data will be written to
|
||||
*/
|
||||
function writeSync(
|
||||
fd: I.FD,
|
||||
string: string,
|
||||
/**
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
position?: number,
|
||||
/**
|
||||
* The expected string encoding
|
||||
*/
|
||||
encoding?: I.Encoding
|
||||
): number;
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* The offset in the buffer to start writing at
|
||||
*/
|
||||
offset: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to read
|
||||
*/
|
||||
length: number,
|
||||
/**
|
||||
* An argument specifying where to begin reading from in the file
|
||||
*/
|
||||
position: number
|
||||
): number;
|
||||
|
||||
/**
|
||||
* Writes buffer to the file specified by fd
|
||||
*/
|
||||
function write(
|
||||
fd: I.FD,
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* Synchronizes a file's in-core state with storage
|
||||
* Determines the part of the buffer to be written
|
||||
*/
|
||||
function sync(fd: I.FD): Promise<void>;
|
||||
offset?: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to write
|
||||
*/
|
||||
length?: number,
|
||||
/**
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
position?: number
|
||||
): Promise<number>;
|
||||
|
||||
/**
|
||||
* Writes string to the file specified by fd
|
||||
*/
|
||||
function write(
|
||||
fd: I.FD,
|
||||
string: string,
|
||||
/**
|
||||
* Synchronizes a file's in-core state with storage
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
function syncSync(fd: I.FD): void;
|
||||
position?: number,
|
||||
/**
|
||||
* The expected string encoding
|
||||
*/
|
||||
encoding?: I.Encoding
|
||||
): Promise<number>;
|
||||
|
||||
/**
|
||||
* Writes buffer to the file specified by fd
|
||||
*/
|
||||
function writeSync(
|
||||
fd: I.FD,
|
||||
buffer: Buffer | Uint8Array,
|
||||
/**
|
||||
* Changes ownership of a file
|
||||
* Determines the part of the buffer to be written
|
||||
*/
|
||||
function chown(fd: I.FD, uid: number, gid: number): Promise<void>;
|
||||
offset?: number,
|
||||
/**
|
||||
* An integer specifying the number of bytes to write
|
||||
*/
|
||||
length?: number,
|
||||
/**
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
position?: number
|
||||
): number;
|
||||
|
||||
/**
|
||||
* Writes string to the file specified by fd
|
||||
*/
|
||||
function writeSync(
|
||||
fd: I.FD,
|
||||
string: string,
|
||||
/**
|
||||
* Changes ownership of a file
|
||||
* The offset from the beginning of the file where this data should be written
|
||||
*/
|
||||
function chownSync(fd: I.FD, uid: number, gid: number): void;
|
||||
position?: number,
|
||||
/**
|
||||
* The expected string encoding
|
||||
*/
|
||||
encoding?: I.Encoding
|
||||
): number;
|
||||
|
||||
/**
|
||||
* Changes permissions of a file
|
||||
*/
|
||||
function chmod(fd: I.FD, mode: number): Promise<void>;
|
||||
/**
|
||||
* Synchronizes a file's in-core state with storage
|
||||
*/
|
||||
function fsync(fd: I.FD): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes permissions of a file
|
||||
*/
|
||||
function chmodSync(fd: I.FD, mode: number): void;
|
||||
/**
|
||||
* Synchronizes a file's in-core state with storage
|
||||
*/
|
||||
function fsyncSync(fd: I.FD): void;
|
||||
|
||||
/**
|
||||
* Repositions read/write file offset
|
||||
*/
|
||||
function seek(fd: I.FD, offset: number, whence: number): Promise<number>;
|
||||
/**
|
||||
* Changes ownership of a file
|
||||
*/
|
||||
function fchown(fd: I.FD, uid: number, gid: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Applies or removes an advisory lock on an open file
|
||||
*/
|
||||
function lock(fd: I.FD, flags: "sh" | "ex" | "shnb" | "exnb" | "un" | number): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Changes ownership of a file
|
||||
*/
|
||||
function fchownSync(fd: I.FD, uid: number, gid: number): void;
|
||||
|
||||
/**
|
||||
* Changes permissions of a file
|
||||
*/
|
||||
function fchmod(fd: I.FD, mode: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Changes permissions of a file
|
||||
*/
|
||||
function fchmodSync(fd: I.FD, mode: number): void;
|
||||
|
||||
/**
|
||||
* Repositions read/write file offset
|
||||
*/
|
||||
function seek(fd: I.FD, offset: number, whence: number): Promise<number>;
|
||||
|
||||
/**
|
||||
* Applies or removes an advisory lock on an open file
|
||||
*/
|
||||
function flock(fd: I.FD, flags: "sh" | "ex" | "shnb" | "exnb" | "un" | number): Promise<void>;
|
||||
|
||||
namespace constants {
|
||||
const F_OK: number;
|
||||
@@ -1475,12 +1596,63 @@ declare namespace adone {
|
||||
function existsSync(path: string | Buffer | I.URL): boolean;
|
||||
|
||||
/**
|
||||
* Creates a new directory and any necessary subdirectories
|
||||
* Creates a new directory
|
||||
*/
|
||||
function mkdir(path: string, mode?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates a new directory
|
||||
*/
|
||||
function mkdirSync(path: string, mode?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates a new directory and any necessary subdirectories
|
||||
*/
|
||||
function mkdirp(path: string, mode?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates a new directory and any necessary subdirectories
|
||||
*/
|
||||
function mkdirpSync(path: string, mode?: number): Promise<void>;
|
||||
|
||||
namespace I {
|
||||
interface CopyOptions {
|
||||
/**
|
||||
* regexp or function against which each filename is tested whether to copy it or not
|
||||
*/
|
||||
filter?: RegExp | ((src: string, dst: string) => boolean);
|
||||
|
||||
/**
|
||||
* transform function which applies when files are streamed
|
||||
*/
|
||||
transform?(
|
||||
readStream: NodeJS.ReadableStream,
|
||||
writeStream: NodeJS.WritableStream,
|
||||
file: {
|
||||
name: string,
|
||||
mode: number,
|
||||
mtime: Date,
|
||||
atime: Date,
|
||||
stats: adone.fs.I.Stats
|
||||
}
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Whether to overwrite destination files if they exist.
|
||||
*
|
||||
* true by default
|
||||
*/
|
||||
clobber?: boolean; // ???
|
||||
|
||||
/**
|
||||
* Whether to overwrite destination files if they exist.
|
||||
*
|
||||
* true by default
|
||||
*/
|
||||
overwrite?: boolean;
|
||||
}
|
||||
|
||||
interface CopyToOptions {
|
||||
/**
|
||||
* Do not replace existing files
|
||||
*/
|
||||
@@ -1494,10 +1666,15 @@ declare namespace adone {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies all files from src to dst
|
||||
* Recursively copies all the files from src to dst
|
||||
*/
|
||||
function copy(src: string, dst: string, options?: I.CopyOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Copies all files from src to dst
|
||||
*/
|
||||
function copyTo(src: string, dst: string, options?: I.CopyToOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Renames a file
|
||||
*/
|
||||
@@ -1514,8 +1691,32 @@ declare namespace adone {
|
||||
|
||||
/**
|
||||
* Returns the last lines of a file
|
||||
*
|
||||
* @param path path to a file
|
||||
* @param n number of lines to return
|
||||
*/
|
||||
function tail(path: string, n: number, options?: { separator?: string, chunkLength?: number }): Promise<Buffer[]>;
|
||||
function tail(path: string, n: number, options?: {
|
||||
/**
|
||||
* Line separator
|
||||
*
|
||||
* By default "\r\n" for windows and "\n" for others
|
||||
*/
|
||||
separator?: string,
|
||||
|
||||
/**
|
||||
* The number of bytes to read at once
|
||||
*
|
||||
* By default 4096
|
||||
*/
|
||||
chunkLength?: number
|
||||
|
||||
/**
|
||||
* Position from which to start reading (from the end)
|
||||
*
|
||||
* By default stats.size of the file
|
||||
*/
|
||||
pos?: number
|
||||
}): Promise<Buffer[]>;
|
||||
|
||||
namespace I {
|
||||
interface StatVFS {
|
||||
@@ -1667,11 +1868,6 @@ declare namespace adone {
|
||||
*/
|
||||
function lookup(path: string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Recursively changes ownership of files
|
||||
*/
|
||||
function chownr(path: string, uid: number, gid: number): Promise<void>;
|
||||
|
||||
namespace I.TailWatcher {
|
||||
interface ConstructorOptions {
|
||||
/**
|
||||
@@ -1709,7 +1905,7 @@ declare namespace adone {
|
||||
* Represents an event emitter that watches for a file growing,
|
||||
* emits "line" event for each new line in a file
|
||||
*/
|
||||
class TailWatcher extends event.EventEmitter {
|
||||
class TailWatcher extends event.Emitter {
|
||||
constructor(filename: string, options?: I.TailWatcher.ConstructorOptions);
|
||||
|
||||
/**
|
||||
|
||||
199
types/adone/glosses/is.d.ts
vendored
199
types/adone/glosses/is.d.ts
vendored
@@ -6,13 +6,13 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is `null`
|
||||
*/
|
||||
function _null(obj: any): boolean;
|
||||
function _null(obj: any): obj is null;
|
||||
export { _null as null };
|
||||
|
||||
/**
|
||||
* Checks whether the given object is `undefined`
|
||||
*/
|
||||
export function undefined(obj: any): boolean;
|
||||
export function undefined(obj: any): obj is undefined;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is nither `undefined` nor `null`
|
||||
@@ -22,52 +22,54 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is either `undefined` or `null`
|
||||
*/
|
||||
export function nil(obj: any): boolean;
|
||||
export function nil(obj: any): obj is undefined | null;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a number
|
||||
*/
|
||||
export function number(obj: any): boolean;
|
||||
export function number(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a finite number or a string represents a finite number
|
||||
*/
|
||||
export function numeral(obj: any): boolean;
|
||||
export function numeral(obj: number): obj is number;
|
||||
export function numeral(obj: string): obj is string;
|
||||
export function numeral(obj: any): obj is number | string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is either +Infinity or -Inginity
|
||||
*/
|
||||
export function infinite(obj: any): boolean;
|
||||
export function infinite(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an odd number
|
||||
*/
|
||||
export function odd(obj: any): boolean;
|
||||
export function odd(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an even number
|
||||
*/
|
||||
export function even(obj: any): boolean;
|
||||
export function even(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a float
|
||||
*/
|
||||
export function float(obj: any): boolean;
|
||||
export function float(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is -0
|
||||
*/
|
||||
export function negativeZero(obj: any): boolean;
|
||||
export function negativeZero(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a string
|
||||
*/
|
||||
export function string(obj: any): boolean;
|
||||
export function string(obj: any): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an empty string
|
||||
* Checks whether the given object is an empty string, i.e. a string with only whitespace characters
|
||||
*/
|
||||
export function emptyString(obj: any): boolean;
|
||||
export function emptyString(obj: any): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the first string is a substring of the second string from the given offset
|
||||
@@ -87,7 +89,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is a boolean
|
||||
*/
|
||||
export function boolean(obj: any): boolean;
|
||||
export function boolean(obj: any): obj is boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a string with ".json" extension or an object
|
||||
@@ -215,7 +217,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given string is a glob
|
||||
*/
|
||||
export function glob(str: string): boolean;
|
||||
export function glob(str: any): str is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given path is not a dot-file path (.secret)
|
||||
@@ -236,7 +238,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is a promise
|
||||
*/
|
||||
export function promise(obj: any): boolean;
|
||||
export function promise(obj: any): obj is PromiseLike<any>;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is a valid date-string
|
||||
@@ -246,7 +248,7 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is a buffer
|
||||
*/
|
||||
export function buffer(obj: any): boolean;
|
||||
export function buffer(obj: any): obj is Buffer;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a callback function, i.e. it has a common function name
|
||||
@@ -266,27 +268,27 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is a finite number
|
||||
*/
|
||||
export function finite(obj: any): boolean;
|
||||
export function finite(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an integer
|
||||
*/
|
||||
export function integer(obj: any): boolean;
|
||||
export function integer(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a safe integer
|
||||
*/
|
||||
export function safeInteger(obj: any): boolean;
|
||||
export function safeInteger(obj: any): obj is number;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an array
|
||||
*/
|
||||
export function array(obj: any): boolean;
|
||||
export function array(obj: any): obj is any[];
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a Uint8 array
|
||||
*/
|
||||
export function uint8Array(obj: any): boolean;
|
||||
export function uint8Array(obj: any): obj is Uint8Array;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone configuration
|
||||
@@ -296,22 +298,22 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.math.Long
|
||||
*/
|
||||
export function long(obj: any): boolean;
|
||||
export function long(obj: any): obj is adone.math.Long;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.math.BigNumber
|
||||
*/
|
||||
export function bigNumber(obj: any): boolean;
|
||||
export function bigNumber(obj: any): obj is adone.math.BigNumber;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.collection.ByteArray
|
||||
*/
|
||||
export function byteArray(obj: any): boolean;
|
||||
export function byteArray(obj: any): obj is adone.collection.ByteArray;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.datetime
|
||||
*/
|
||||
export function datetime(obj: any): boolean;
|
||||
export function datetime(obj: any): obj is adone.I.datetime.Datetime;
|
||||
|
||||
export function transform(obj: any): boolean;
|
||||
|
||||
@@ -498,17 +500,17 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is an array buffer
|
||||
*/
|
||||
export function arrayBuffer(obj: any): boolean;
|
||||
export function arrayBuffer(obj: any): obj is ArrayBuffer;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an array buffer view
|
||||
*/
|
||||
export function arrayBufferView(obj: any): boolean;
|
||||
export function arrayBufferView(obj: any): obj is ArrayBufferView;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a date
|
||||
*/
|
||||
export function date(obj: any): boolean;
|
||||
export function date(obj: any): obj is Date;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an error, instance of Error
|
||||
@@ -518,27 +520,22 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is a map
|
||||
*/
|
||||
export function map(obj: any): boolean;
|
||||
export function map(obj: any): obj is Map<any, any>;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a regexp
|
||||
*/
|
||||
export function regexp(obj: any): boolean;
|
||||
export function regexp(obj: any): obj is RegExp;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a set
|
||||
*/
|
||||
export function set(obj: any): boolean;
|
||||
export function set(obj: any): obj is Set<any>;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a symbol
|
||||
*/
|
||||
export function symbol(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given buffer a valid UTF-8 encoded text
|
||||
*/
|
||||
export function validUTF8(obj: Buffer): boolean;
|
||||
export function symbol(obj: any): obj is symbol;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a vault valuable
|
||||
@@ -549,5 +546,131 @@ declare namespace adone {
|
||||
* Checks whether the given object is an adone task
|
||||
*/
|
||||
export function task(obj: any): boolean;
|
||||
|
||||
namespace I {
|
||||
interface FQDNOptions {
|
||||
/**
|
||||
* Whether to require top-level domain, default `true`
|
||||
*/
|
||||
requireTld?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to allow underscores("_"), default `false`
|
||||
*/
|
||||
allowUnderscores?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to allow trailing dot, default `false`
|
||||
*/
|
||||
allowTrailingDot?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given object(string) is a fully qualified domain name (e.g. domain.com).
|
||||
*/
|
||||
export function fqdn(obj: any, options?: I.FQDNOptions): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object(string) is a url
|
||||
*/
|
||||
export function url(obj: any, options?: I.FQDNOptions & {
|
||||
/**
|
||||
* List of valid protocols.
|
||||
* Used when requireValidProtocol is `true`.
|
||||
* Default ["http", "https", "ftp"]
|
||||
*/
|
||||
protocols?: string[],
|
||||
|
||||
/**
|
||||
* Whether to require protocol, default `true`
|
||||
*/
|
||||
requireProtocol?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to require host, default `true`
|
||||
*/
|
||||
requireHost?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to require valid protocol defined in `protocols` options, default `true`
|
||||
*/
|
||||
requireValidProtocol?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to allow urls like "//example.com", default `false`
|
||||
*/
|
||||
allowProtocolRelativeUrls?: boolean
|
||||
}): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object(string) is a valid email address
|
||||
*/
|
||||
export function email(obj: any, options?: {
|
||||
/**
|
||||
* Whether to allow email addresses with display names ("Name <local@domain>"")
|
||||
*/
|
||||
allowDisplayName?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to require display name
|
||||
*/
|
||||
requireDisplayName?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to allow UTF8 characters in the local part
|
||||
*/
|
||||
allowUtf8LocalPart?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to require top-level domain, default `true`
|
||||
*/
|
||||
requireTld?: boolean
|
||||
}): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid IPv4 address
|
||||
*/
|
||||
export function ip(obj: any, version: 4): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid IPv6 address
|
||||
*/
|
||||
export function ip(obj: any, version: 6): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object in a valid IPv4 or IPv6 address
|
||||
*/
|
||||
export function ip(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid UUIDv1 identifier
|
||||
*/
|
||||
export function uuid(obj: any, version: 1): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid UUIDv2 identifier
|
||||
*/
|
||||
export function uuid(obj: any, version: 2): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid UUIDv3 identifier
|
||||
*/
|
||||
export function uuid(obj: any, version: 3): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid UUIDv4 identifier
|
||||
*/
|
||||
export function uuid(obj: any, version: 4): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid UUIDv5 identifier
|
||||
*/
|
||||
export function uuid(obj: any, version: 5): obj is string;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a valid UUID identifier (v1, v2, v3, v4 or v5)
|
||||
*/
|
||||
export function uuid(obj: any, version?: "all"): obj is string;
|
||||
}
|
||||
}
|
||||
|
||||
31
types/adone/glosses/promise.d.ts
vendored
31
types/adone/glosses/promise.d.ts
vendored
@@ -125,5 +125,36 @@ declare namespace adone {
|
||||
*/
|
||||
function _finally<T>(promise: Promise<T>, onFinally?: (...args: any[]) => void): Promise<T>;
|
||||
export { _finally as finally };
|
||||
|
||||
namespace I {
|
||||
type ResolvableProps<T> = object & {[K in keyof T]: PromiseLike<T[K]> | T[K]};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that is fulfilled when all the object's values are fulfilled
|
||||
*/
|
||||
export function props<T>(obj: I.ResolvableProps<T>): Promise<T>;
|
||||
|
||||
namespace I {
|
||||
interface _RetryOptions {
|
||||
max: number;
|
||||
|
||||
timeout: number;
|
||||
|
||||
match: (string | RegExp | Error) | Array<string | RegExp | Error>;
|
||||
|
||||
backOffBase: number;
|
||||
|
||||
backOffExponent: number;
|
||||
|
||||
report: (message: string, options: _RetryOptions, err: any) => void;
|
||||
|
||||
name: string;
|
||||
}
|
||||
|
||||
type RetryOptions = Partial<_RetryOptions>;
|
||||
}
|
||||
|
||||
export function retry<T>(fn: (info: { current: number }) => PromiseLike<T> | T, options?: number | I.RetryOptions): Promise<T>;
|
||||
}
|
||||
}
|
||||
|
||||
22
types/adone/glosses/shani.d.ts
vendored
22
types/adone/glosses/shani.d.ts
vendored
@@ -94,6 +94,11 @@ declare namespace adone {
|
||||
* Mark this block as exclusive
|
||||
*/
|
||||
skip: DescribeFunction;
|
||||
|
||||
/**
|
||||
* Mark this block as todo
|
||||
*/
|
||||
todo: DescribeFunction;
|
||||
}
|
||||
|
||||
interface TestOptions {
|
||||
@@ -146,6 +151,11 @@ declare namespace adone {
|
||||
* Mark this test as exclusive
|
||||
*/
|
||||
skip: TestFunction;
|
||||
|
||||
/**
|
||||
* Mark this test as todo
|
||||
*/
|
||||
todo: TestFunction;
|
||||
}
|
||||
|
||||
interface HookRuntimeContext {
|
||||
@@ -172,7 +182,7 @@ declare namespace adone {
|
||||
| "end before each hook" | "end after each hook"
|
||||
| "end before test hook" | "end after test hook";
|
||||
|
||||
interface Emitter extends event.EventEmitter {
|
||||
interface Emitter extends event.Emitter {
|
||||
on(event: "enter block", listener: (event: { block: Block }) => void): this;
|
||||
on(event: "exit block", listener: (event: { block: Block }) => void): this;
|
||||
on(event: "start test", listener: (event: { block: Block, test: Test }) => void): this;
|
||||
@@ -267,6 +277,11 @@ declare namespace adone {
|
||||
*/
|
||||
only(): this;
|
||||
|
||||
/**
|
||||
* Marks this test as todo
|
||||
*/
|
||||
todo(): this;
|
||||
|
||||
/**
|
||||
* Returns the timeout of the test
|
||||
*/
|
||||
@@ -355,6 +370,11 @@ declare namespace adone {
|
||||
*/
|
||||
only(): this;
|
||||
|
||||
/**
|
||||
* Marks this block as todo
|
||||
*/
|
||||
todo(): this;
|
||||
|
||||
/**
|
||||
* Returns the timeout of the block
|
||||
*/
|
||||
|
||||
414
types/adone/glosses/streams.d.ts
vendored
414
types/adone/glosses/streams.d.ts
vendored
@@ -1,223 +1,225 @@
|
||||
declare namespace adone {
|
||||
namespace stream {
|
||||
namespace I.CoreStream {
|
||||
interface ConstructorOptions<S, T> {
|
||||
/**
|
||||
* Whether the initial stream is asynchronous
|
||||
*/
|
||||
async?: boolean;
|
||||
namespace core {
|
||||
namespace I {
|
||||
interface ConstructorOptions<S, T> {
|
||||
/**
|
||||
* Whether the initial stream is asynchronous
|
||||
*/
|
||||
async?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the initial stream is synchronous
|
||||
*/
|
||||
sync?: boolean;
|
||||
/**
|
||||
* Whether the initial stream is synchronous
|
||||
*/
|
||||
sync?: boolean;
|
||||
|
||||
/**
|
||||
* The initial transform (passthrough is default)
|
||||
*/
|
||||
transform?: TransformFunction<S, T>;
|
||||
/**
|
||||
* The initial transform (passthrough is default)
|
||||
*/
|
||||
transform?: TransformFunction<S, T>;
|
||||
|
||||
/**
|
||||
* The initial flush function
|
||||
*/
|
||||
flush?: FlushFunction<T>;
|
||||
/**
|
||||
* The initial flush function
|
||||
*/
|
||||
flush?: FlushFunction<T>;
|
||||
}
|
||||
|
||||
type Source<S, T> = S[] | Stream<S, T>;
|
||||
|
||||
interface TransformContext<T> {
|
||||
/**
|
||||
* Pushes the given value into the stream
|
||||
*/
|
||||
push(value: T): boolean;
|
||||
}
|
||||
|
||||
type TransformFunction<S, T> = (this: TransformContext<T>, value: S) => void;
|
||||
type FlushFunction<T> = (this: TransformContext<T>) => void;
|
||||
}
|
||||
|
||||
type Source<S, T> = S[] | CoreStream<S, T>;
|
||||
/**
|
||||
* Represents a chain of transform streams
|
||||
*/
|
||||
class Stream<S = any, T = S> implements PromiseLike<T[]> {
|
||||
constructor(source?: I.Source<S, T>, options?: I.ConstructorOptions<S, T>);
|
||||
|
||||
/**
|
||||
* Writes the given value into the stream
|
||||
*/
|
||||
write(value: S): boolean;
|
||||
|
||||
interface TransformContext<T> {
|
||||
/**
|
||||
* Pushes the given value into the stream
|
||||
*/
|
||||
push(value: T): boolean;
|
||||
|
||||
/**
|
||||
* Ends the stream
|
||||
*/
|
||||
end(): this;
|
||||
|
||||
/**
|
||||
* Destroys the stream
|
||||
*/
|
||||
destroy(): this;
|
||||
|
||||
/**
|
||||
* Pauses the stream
|
||||
*/
|
||||
pause(): this;
|
||||
|
||||
/**
|
||||
* Resumes the stream
|
||||
*/
|
||||
resume(): this;
|
||||
|
||||
/**
|
||||
* Whether the stream is paused
|
||||
*/
|
||||
isPaused(): boolean;
|
||||
|
||||
/**
|
||||
* Whether the stream is ended
|
||||
*/
|
||||
isEnded(): boolean;
|
||||
|
||||
/**
|
||||
* Pipes this stream to another
|
||||
*/
|
||||
pipe<T>(stream: T, options?: { end?: boolean }): T;
|
||||
|
||||
/**
|
||||
* Adds a new synchronous transform stream into the chain
|
||||
*/
|
||||
throughSync<R>(transform: I.TransformFunction<T, R>, flush?: I.FlushFunction<R>): Stream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new asynchronous transform stream into the chain
|
||||
*/
|
||||
throughAsync<R>(transform: I.TransformFunction<T, R>, flush?: I.FlushFunction<R>): Stream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new transform stream into the chain
|
||||
*/
|
||||
through<R>(transform: I.TransformFunction<T, R>, flush?: I.FlushFunction<R>): Stream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new map transform into the chain.
|
||||
*
|
||||
* Note: synchronous functions create a synchronous transform.
|
||||
* If your function returns a promise use an asynchronous function if you don't want to pass a promise through the stream
|
||||
*/
|
||||
map<R>(callback: (value: T) => R | Promise<R>): Stream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new conditional map transform into the chain
|
||||
*/
|
||||
mapIf<R>(condition: (value: T) => boolean | Promise<boolean>, callback: (value: T) => R): Stream<S, T | R>;
|
||||
|
||||
/**
|
||||
* Adds a new filter transform into the chain
|
||||
*/
|
||||
filter(callback: (value: T) => boolean | Promise<boolean>): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that calls the given callback for each value from the stream.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
forEach(callback: (value: T) => void, options?: {
|
||||
/**
|
||||
* Whethe to wait for asynchronous functions (await)
|
||||
*/
|
||||
wait?: boolean,
|
||||
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that calls the given callback when the underlying stream ends.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
done(callback: () => void, options?: {
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that gather all the read values into an array and calls the given callback
|
||||
* when the underlying stream ends.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
toArray(callback: (result: T[]) => void, options?: {
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that filters the values by their uniqueness
|
||||
*
|
||||
* @param prop callback that calculates value's hash which is used in uniqueness checks
|
||||
*/
|
||||
unique(prop?: (value: T) => any): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that filters the values using the given given function with ability to restore the filtered values
|
||||
*/
|
||||
stash(name: string, filter: (value: T) => boolean): this;
|
||||
stash(filter: (value: T) => boolean): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that restores the previous stashed values
|
||||
*/
|
||||
unstash(name?: string): Stream<S, T>; // ??
|
||||
|
||||
/**
|
||||
* Flattens all the read array values
|
||||
*/
|
||||
flatten(): Stream<S, T>; // ??
|
||||
|
||||
/**
|
||||
* Merges the given stream into a core stream
|
||||
*/
|
||||
static merge<S = any, T = S>(streams: Array<Stream<any, any> | nodestd.stream.Transform | nodestd.stream.Readable | nodestd.stream.Duplex>, options?: {
|
||||
/**
|
||||
* Whether to end the stream when all the given streams end
|
||||
*/
|
||||
end?: boolean,
|
||||
|
||||
/**
|
||||
* Options for the initial core stream
|
||||
*/
|
||||
sourceOptions?: I.ConstructorOptions<S, T>
|
||||
}): Stream<S, T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
then<T1 = T[], T2 = never>(onResolve?: (value: T[]) => T1 | PromiseLike<T1>, onReject?: (reason: any) => T2 | PromiseLike<T2>): Promise<T1 | T2>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
catch<T1 = never>(onReject?: (reason: any) => T1 | PromiseLike<T1>): Promise<T[] | T1>;
|
||||
}
|
||||
|
||||
type TransformFunction<S, T> = (this: TransformContext<T>, value: S) => void;
|
||||
type FlushFunction<T> = (this: TransformContext<T>) => void;
|
||||
/**
|
||||
* Creates a CoreStream instance
|
||||
*/
|
||||
function create<S = any, T = S>(source?: I.Source<S, T>, options?: I.ConstructorOptions<S, T>): Stream<S, T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a chain of transform streams
|
||||
*/
|
||||
class CoreStream<S = any, T = S> implements PromiseLike<T[]> {
|
||||
constructor(source?: I.CoreStream.Source<S, T>, options?: I.CoreStream.ConstructorOptions<S, T>);
|
||||
|
||||
/**
|
||||
* Writes the given value into the stream
|
||||
*/
|
||||
write(value: S): boolean;
|
||||
|
||||
/**
|
||||
* Pushes the given value into the stream
|
||||
*/
|
||||
push(value: T): boolean;
|
||||
|
||||
/**
|
||||
* Ends the stream
|
||||
*/
|
||||
end(): this;
|
||||
|
||||
/**
|
||||
* Destroys the stream
|
||||
*/
|
||||
destroy(): this;
|
||||
|
||||
/**
|
||||
* Pauses the stream
|
||||
*/
|
||||
pause(): this;
|
||||
|
||||
/**
|
||||
* Resumes the stream
|
||||
*/
|
||||
resume(): this;
|
||||
|
||||
/**
|
||||
* Whether the stream is paused
|
||||
*/
|
||||
isPaused(): boolean;
|
||||
|
||||
/**
|
||||
* Whether the stream is ended
|
||||
*/
|
||||
isEnded(): boolean;
|
||||
|
||||
/**
|
||||
* Pipes this stream to another
|
||||
*/
|
||||
pipe<T>(stream: T, options?: { end?: boolean }): T;
|
||||
|
||||
/**
|
||||
* Adds a new synchronous transform stream into the chain
|
||||
*/
|
||||
throughSync<R>(transform: I.CoreStream.TransformFunction<T, R>, flush?: I.CoreStream.FlushFunction<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new asynchronous transform stream into the chain
|
||||
*/
|
||||
throughAsync<R>(transform: I.CoreStream.TransformFunction<T, R>, flush?: I.CoreStream.FlushFunction<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new transform stream into the chain
|
||||
*/
|
||||
through<R>(transform: I.CoreStream.TransformFunction<T, R>, flush?: I.CoreStream.FlushFunction<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new map transform into the chain.
|
||||
*
|
||||
* Note: synchronous functions create a synchronous transform.
|
||||
* If your function returns a promise use an asynchronous function if you don't want to pass a promise through the stream
|
||||
*/
|
||||
map<R>(callback: (value: T) => R | Promise<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new conditional map transform into the chain
|
||||
*/
|
||||
mapIf<R>(condition: (value: T) => boolean | Promise<boolean>, callback: (value: T) => R): CoreStream<S, T | R>;
|
||||
|
||||
/**
|
||||
* Adds a new filter transform into the chain
|
||||
*/
|
||||
filter(callback: (value: T) => boolean | Promise<boolean>): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that calls the given callback for each value from the stream.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
forEach(callback: (value: T) => void, options?: {
|
||||
/**
|
||||
* Whethe to wait for asynchronous functions (await)
|
||||
*/
|
||||
wait?: boolean,
|
||||
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that calls the given callback when the underlying stream ends.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
done(callback: () => void, options?: {
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that gather all the read values into an array and calls the given callback
|
||||
* when the underlying stream ends.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
toArray(callback: (result: T[]) => void, options?: {
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that filters the values by their uniqueness
|
||||
*
|
||||
* @param prop callback that calculates value's hash which is used in uniqueness checks
|
||||
*/
|
||||
unique(prop?: (value: T) => any): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that filters the values using the given given function with ability to restore the filtered values
|
||||
*/
|
||||
stash(name: string, filter: (value: T) => boolean): this;
|
||||
stash(filter: (value: T) => boolean): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that restores the previous stashed values
|
||||
*/
|
||||
unstash(name?: string): CoreStream<S, T>; // ??
|
||||
|
||||
/**
|
||||
* Flattens all the read array values
|
||||
*/
|
||||
flatten(): CoreStream<S, T>; // ??
|
||||
|
||||
/**
|
||||
* Merges the given stream into a core stream
|
||||
*/
|
||||
static merge<S = any, T = S>(streams: Array<CoreStream<any, any> | nodestd.stream.Transform | nodestd.stream.Readable | nodestd.stream.Duplex>, options?: {
|
||||
/**
|
||||
* Whether to end the stream when all the given streams end
|
||||
*/
|
||||
end?: boolean,
|
||||
|
||||
/**
|
||||
* Options for the initial core stream
|
||||
*/
|
||||
sourceOptions?: I.CoreStream.ConstructorOptions<S, T>
|
||||
}): CoreStream<S, T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
then<T1 = T[], T2 = never>(onResolve?: (value: T[]) => T1 | PromiseLike<T1>, onReject?: (reason: any) => T2 | PromiseLike<T2>): Promise<T1 | T2>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
catch<T1 = never>(onReject?: (reason: any) => T1 | PromiseLike<T1>): Promise<T[] | T1>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CoreStream instance
|
||||
*/
|
||||
function core<S = any, T = S>(source?: I.CoreStream.Source<S, T>, options?: I.CoreStream.ConstructorOptions<S, T>): CoreStream<S, T>;
|
||||
}
|
||||
}
|
||||
|
||||
830
types/adone/glosses/utils.d.ts
vendored
830
types/adone/glosses/utils.d.ts
vendored
@@ -16,10 +16,6 @@ declare namespace adone {
|
||||
|
||||
function functionName(fn: (...args: any[]) => any): string;
|
||||
|
||||
function mapArguments(argmap: (...args: any[]) => any): (...args: any[]) => any;
|
||||
function mapArguments(argmap: number): <T>(...args: T[]) => T[];
|
||||
function mapArguments(...args: any[]): <T>(x: T) => T;
|
||||
|
||||
namespace I {
|
||||
interface ParseMsResult {
|
||||
days: number;
|
||||
@@ -33,8 +29,6 @@ declare namespace adone {
|
||||
|
||||
function pluralizeWord(str: string, plural?: string, count?: number): string;
|
||||
|
||||
function functionParams(func: (...args: any[]) => any): string[];
|
||||
|
||||
function randomChoice<T>(arrayLike: ArrayLike<T>, from?: number, to?: number): T;
|
||||
|
||||
function shuffleArray<T>(array: T[]): T[];
|
||||
@@ -70,19 +64,8 @@ declare namespace adone {
|
||||
|
||||
function globParent(str: string): string;
|
||||
|
||||
namespace I {
|
||||
interface ByResult<S, T, R> {
|
||||
(a: S, b: S): R;
|
||||
compare(a: T, b: T): R;
|
||||
by(a: S): T;
|
||||
}
|
||||
}
|
||||
function by<S, T, R>(by: (a: S) => T, compare?: (a: T, b: T) => R): I.ByResult<S, T, R>;
|
||||
|
||||
function toFastProperties(object: object): object;
|
||||
|
||||
function stripBom(x: string): string;
|
||||
|
||||
namespace I {
|
||||
interface SortKeysOptions {
|
||||
deep?: boolean;
|
||||
@@ -118,12 +101,42 @@ declare namespace adone {
|
||||
|
||||
namespace I {
|
||||
interface CloneOptions {
|
||||
/**
|
||||
* Clone recursively
|
||||
*
|
||||
* `true` by default
|
||||
*/
|
||||
deep?: boolean;
|
||||
|
||||
/**
|
||||
* Clone non-plain object, they will be plain objects
|
||||
*
|
||||
* `false` by default
|
||||
*/
|
||||
nonPlainObjects?: boolean;
|
||||
|
||||
/**
|
||||
* Clone only enumerable properties
|
||||
*
|
||||
* `true` by default
|
||||
*/
|
||||
onlyEnumerable?: boolean;
|
||||
}
|
||||
}
|
||||
function clone(object: object, options?: I.CloneOptions): object;
|
||||
|
||||
function toUTF8Array(str: string): number[];
|
||||
class Cloner {
|
||||
/**
|
||||
* Clones the given object
|
||||
*/
|
||||
clone(obj: any, options?: I.CloneOptions): any;
|
||||
|
||||
/**
|
||||
* Returns a clone function that is binded to this cloner
|
||||
*/
|
||||
binding(): (obj: any, options?: I.CloneOptions) => any;
|
||||
}
|
||||
|
||||
function clone(object: any, options?: I.CloneOptions): any;
|
||||
|
||||
function asyncIter<T>(array: T[], iter: (elem: T, index: number, cb: () => void) => any, cb: () => void): void;
|
||||
|
||||
@@ -150,20 +163,31 @@ declare namespace adone {
|
||||
function assignDeep<T>(target: T, ...sources: object[]): T;
|
||||
|
||||
namespace I {
|
||||
interface MatchOptions {
|
||||
interface MatchPathOptions {
|
||||
index?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
dot?: boolean;
|
||||
}
|
||||
}
|
||||
function match(criteria: any, options?: I.MatchOptions): (value: any, options?: I.MatchOptions) => number | boolean;
|
||||
function match(criteria: any, value: any, options?: I.MatchOptions): number | boolean;
|
||||
function matchPath(criteria: any, options?: I.MatchPathOptions): (value: any, options?: I.MatchPathOptions) => number | boolean;
|
||||
function matchPath(criteria: any, value: any, options?: I.MatchPathOptions): number | boolean;
|
||||
|
||||
namespace I {
|
||||
class Sorter {
|
||||
edges: string[];
|
||||
|
||||
add(item: string, deps: string | string[]): void;
|
||||
|
||||
sort(): string[];
|
||||
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
interface ToposortFunction {
|
||||
<T>(edges: Array<[T, T]>): T[];
|
||||
array<T>(nodes: T[], edges: Array<[T, T]>): T[];
|
||||
(edges: Array<[string, string]>): string[];
|
||||
array(nodes: string[], edges: Array<[string, string]>): string[];
|
||||
Sorter: typeof Sorter;
|
||||
}
|
||||
}
|
||||
const toposort: I.ToposortFunction;
|
||||
@@ -217,12 +241,12 @@ declare namespace adone {
|
||||
function v1(options?: I.V1Options): string;
|
||||
function v1(options: I.V1Options, buf: any[], offset?: number): number[];
|
||||
|
||||
function v4(options?: any): string;
|
||||
function v4(options: any, buf: any[], offset?: number): number[];
|
||||
|
||||
function v3(name: string | number[], namespace: string | number[]): string;
|
||||
function v3(name: string | number[], namespace: string | number[], buf: any[], offset?: number): number[];
|
||||
|
||||
function v4(options?: any): string;
|
||||
function v4(options: any, buf: any[], offset?: number): number[];
|
||||
|
||||
function v5(name: string | number[], namespace: string | number[]): string;
|
||||
function v5(name: string | number[], namespace: string | number[], buf: any[], offset?: number): number[];
|
||||
}
|
||||
@@ -237,40 +261,6 @@ declare namespace adone {
|
||||
}
|
||||
function delegate(object: object, property: string): I.Delegator;
|
||||
|
||||
namespace I {
|
||||
interface GlobExpOptions {
|
||||
nocomment?: boolean;
|
||||
nonegate?: boolean;
|
||||
nobrace?: boolean;
|
||||
noglobstar?: boolean;
|
||||
nocase?: boolean;
|
||||
dot?: boolean;
|
||||
noext?: boolean;
|
||||
matchBase?: boolean;
|
||||
flipNegate?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
class GlobExp {
|
||||
constructor(pattern: string, options?: I.GlobExpOptions);
|
||||
|
||||
hasMagic(): boolean;
|
||||
|
||||
static hasMagic(pattern: string, options?: I.GlobExpOptions): boolean;
|
||||
|
||||
expandBraces(): string[];
|
||||
|
||||
static expandBraces(pattern: string, options?: I.GlobExpOptions): string[];
|
||||
|
||||
makeRe(): RegExp;
|
||||
|
||||
static makeRe(pattern: string, options?: I.GlobExpOptions): RegExp;
|
||||
|
||||
static test(p: string, pattern: string, options?: I.GlobExpOptions): boolean;
|
||||
|
||||
test(p: string): boolean;
|
||||
}
|
||||
|
||||
namespace iconv {
|
||||
// TODO: need to normalize source code
|
||||
}
|
||||
@@ -278,9 +268,6 @@ declare namespace adone {
|
||||
namespace sqlstring {
|
||||
function escapeId(val: string | string[], forbidQualified?: boolean): string;
|
||||
function dateToString(date: any, timeZone?: string): string;
|
||||
function arrayToList(array: any[]): string;
|
||||
function bufferToString(buffer: Buffer): string;
|
||||
function objectToValues(object: object, timeZone?: string): string;
|
||||
function escape(value: any, stringifyObjects?: boolean, timeZone?: string): string;
|
||||
function format(sql: string, values?: any, stringifyObjects?: boolean, timeZone?: string): string;
|
||||
}
|
||||
@@ -316,49 +303,71 @@ declare namespace adone {
|
||||
}
|
||||
const binarySearch: I.BinarySearchFunction;
|
||||
|
||||
/**
|
||||
* buffer tools
|
||||
*/
|
||||
namespace buffer {
|
||||
function concat(list: Buffer[], totalLength: number): Buffer;
|
||||
function mask(buffer: Buffer, mask: Buffer, output: Buffer, offset: number, length: number): void;
|
||||
function unmask(buffer: Buffer, mask: Buffer): void;
|
||||
/**
|
||||
* Converts the given Buffer to ArrayBuffer
|
||||
*/
|
||||
function toArrayBuffer(buf: Buffer): ArrayBuffer;
|
||||
|
||||
/**
|
||||
* Returns a new buffer that represents a^b
|
||||
*
|
||||
* If the lengths are not equal, it assumes missing bytes as 0x00
|
||||
*
|
||||
* @param length length of the result buffer. max(a.length, b.length) by default
|
||||
*/
|
||||
function xor(a: Buffer, b: Buffer, length?: number): Buffer;
|
||||
}
|
||||
|
||||
function shebang(str: string): string | null;
|
||||
|
||||
class ReInterval {
|
||||
constructor(callback: (...args: any[]) => void, interval: number, args?: any[]);
|
||||
|
||||
reschedule(interval: number): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
class RateLimiter {
|
||||
constructor(tokensPerInterval?: number, interval?: number, fireImmediately?: boolean);
|
||||
|
||||
removeTokens(count: number): Promise<number>;
|
||||
|
||||
tryRemoveTokens(count: number): boolean;
|
||||
|
||||
getTokensRemaining(): number;
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface ThrottleOptions {
|
||||
max?: number;
|
||||
interval?: number;
|
||||
ordered?: boolean;
|
||||
waitForReturn?: boolean;
|
||||
interface ReInterval {
|
||||
reschedule(interval: number): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
destroy(): void;
|
||||
}
|
||||
}
|
||||
function throttle<R>(fn: () => R, options?: I.ThrottleOptions): () => Promise<R>;
|
||||
function throttle<T1, R>(fn: (a: T1) => R, options?: I.ThrottleOptions): (a: T1) => Promise<R>;
|
||||
function throttle<T1, T2, R>(fn: (a: T1, b: T2) => R, options?: I.ThrottleOptions): (a: T1, b: T2) => Promise<R>;
|
||||
function throttle<T1, T2, T3, R>(fn: (a: T1, b: T2, c: T3) => R, options?: I.ThrottleOptions): (a: T1, b: T2, c: T3) => Promise<R>;
|
||||
function throttle<T1, T2, T3, T4, R>(fn: (a: T1, b: T2, c: T3, d: T4) => R, options?: I.ThrottleOptions): (a: T1, b: T2, c: T3, d: T4) => Promise<R>;
|
||||
function throttle<T1, T2, T3, T4, T5, R>(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, options?: I.ThrottleOptions): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise<R>;
|
||||
function throttle<R>(fn: (...args: any[]) => R, options?: I.ThrottleOptions): (...args: any[]) => Promise<R>;
|
||||
|
||||
function reinterval(callback: (...args: any[]) => void, interval: number, args?: any[]): I.ReInterval;
|
||||
|
||||
namespace throttle {
|
||||
namespace I {
|
||||
interface Options {
|
||||
max?: number;
|
||||
interval?: number;
|
||||
ordered?: boolean;
|
||||
waitForReturn?: boolean;
|
||||
onDone?: () => void;
|
||||
drop?: boolean;
|
||||
dropLast?: boolean;
|
||||
}
|
||||
}
|
||||
function create<R>(fn: () => R, options?: I.Options): () => Promise<R>;
|
||||
function create<T1, R>(fn: (a: T1) => R, options?: I.Options): (a: T1) => Promise<R>;
|
||||
function create<T1, T2, R>(fn: (a: T1, b: T2) => R, options?: I.Options): (a: T1, b: T2) => Promise<R>;
|
||||
function create<T1, T2, T3, R>(fn: (a: T1, b: T2, c: T3) => R, options?: I.Options): (a: T1, b: T2, c: T3) => Promise<R>;
|
||||
function create<T1, T2, T3, T4, R>(fn: (a: T1, b: T2, c: T3, d: T4) => R, options?: I.Options): (a: T1, b: T2, c: T3, d: T4) => Promise<R>;
|
||||
function create<T1, T2, T3, T4, T5, R>(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, options?: I.Options): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise<R>;
|
||||
function create<R>(fn: (...args: any[]) => R, options?: I.Options): (...args: any[]) => Promise<R>;
|
||||
|
||||
class RateLimiter {
|
||||
constructor(tokensPerInterval?: number, interval?: number, fireImmediately?: boolean);
|
||||
|
||||
removeTokens(count: number): Promise<number>;
|
||||
|
||||
tryRemoveTokens(count: number): boolean;
|
||||
|
||||
getTokensRemaining(): number;
|
||||
}
|
||||
|
||||
const DROPPED: symbol;
|
||||
}
|
||||
|
||||
namespace I.fakeClock {
|
||||
interface Timer {
|
||||
@@ -475,36 +484,6 @@ declare namespace adone {
|
||||
function lowerBoundKey<T>(range: I.Range<T>): T | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utils for uid/gid
|
||||
*/
|
||||
namespace userid {
|
||||
/**
|
||||
* Returns uid by the given username
|
||||
*/
|
||||
function uid(username: string): { uid: number, gid: number };
|
||||
|
||||
/**
|
||||
* Returns gid by the given groupname
|
||||
*/
|
||||
function gid(groupname: string): number;
|
||||
|
||||
/**
|
||||
* Returns username by the given uid
|
||||
*/
|
||||
function username(uid: number): string;
|
||||
|
||||
/**
|
||||
* Returns groupname by the given gid
|
||||
*/
|
||||
function groupname(gid: number): string;
|
||||
|
||||
/**
|
||||
* Returns gids the given user belongs
|
||||
*/
|
||||
function gids(username: string): number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a log file rotator
|
||||
*/
|
||||
@@ -572,5 +551,598 @@ declare namespace adone {
|
||||
function debounce<T1, T2, T3, T4, R>(fn: (a: T1, b: T2, c: T3, d: T4) => R, timeout: number, options?: I.DebounceOptions): (a: T1, b: T2, c: T3, d: T4) => R;
|
||||
function debounce<T1, T2, T3, T4, T5, R>(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, timeout: number, options?: I.DebounceOptions): (a: T1, b: T2, c: T3, d: T4, e: T5) => R;
|
||||
function debounce<R>(fn: (...args: any[]) => R, timeout: number, options?: I.DebounceOptions): (...args: any[]) => R;
|
||||
|
||||
/**
|
||||
* Finds difference between the given arrays
|
||||
*/
|
||||
function arrayDiff<T = any>(...arrays: T[][]): T[];
|
||||
|
||||
namespace I {
|
||||
type FillRangeTransform = () => void;
|
||||
|
||||
interface FillRangeOptions {
|
||||
/**
|
||||
* The increment to use for the range. Can be used with letters or numbers
|
||||
*/
|
||||
step?: number;
|
||||
|
||||
/**
|
||||
* By default, null is returned when an invalid range is passed.
|
||||
* Enable this option to throw a RangeError on invalid ranges
|
||||
*
|
||||
* false by default
|
||||
*/
|
||||
strictRanges?: boolean;
|
||||
|
||||
/**
|
||||
* Cast all returned values to strings.
|
||||
*
|
||||
* By default, integers are returned as numbers.
|
||||
*/
|
||||
stringify?: boolean;
|
||||
|
||||
/**
|
||||
* Create a regex-compatible source string, instead of expanding values to an array.
|
||||
*
|
||||
* false by default
|
||||
*/
|
||||
toRegex?: boolean;
|
||||
|
||||
/**
|
||||
* Customize each value in the returned array (or string)
|
||||
*/
|
||||
transform?: FillRangeTransform;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Expands numbers and letters
|
||||
*/
|
||||
function fillRange(from: number, to: number, options: I.FillRangeOptions & { toRegex: true }): string;
|
||||
function fillRange(from: number, to: number, options: I.FillRangeOptions & { stringify: true }): string[];
|
||||
function fillRange(from: number, to: number, options?: I.FillRangeOptions): number[];
|
||||
|
||||
function fillRange(from: string, to: string, options: I.FillRangeOptions & { toRegex: true }): string;
|
||||
function fillRange(from: string, to: string, options?: I.FillRangeOptions): string[];
|
||||
|
||||
function fillRange(from: string | number, to: string | number, options: I.FillRangeOptions & { toRegex: true }): string;
|
||||
function fillRange(from: string | number, to: string | number, options?: I.FillRangeOptions): Array<string | number>;
|
||||
|
||||
namespace inflection {
|
||||
function singularizeWord(str: string, singular?: string): string;
|
||||
function pluralizeWord(str: string, plural?: string): string;
|
||||
function underscore(str: string, allUpperCase?: boolean): string;
|
||||
}
|
||||
|
||||
function machineId(original?: boolean): Promise<string>;
|
||||
|
||||
namespace I {
|
||||
interface MergeOptions {
|
||||
plainObjects?: boolean;
|
||||
allowPrototypes?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function merge(target: any, source: any, options?: I.MergeOptions): any;
|
||||
|
||||
function omit(obj: any, props: ((v: string) => boolean) | string[] | string): object;
|
||||
|
||||
function parseTime(val: number): number;
|
||||
function parseTime(val: any): number | null;
|
||||
|
||||
function pick(obj: any, props: Iterable<any>): object;
|
||||
|
||||
// pool: TODO
|
||||
|
||||
namespace querystring {
|
||||
function escape(str: string): string;
|
||||
|
||||
const formats: {
|
||||
RFC1738: "RFC1738"
|
||||
RFC3986: "RFC3986",
|
||||
default: string,
|
||||
formatters: {
|
||||
RFC1738(val: string): string,
|
||||
RFC3986(val: string): string
|
||||
}
|
||||
};
|
||||
|
||||
namespace I {
|
||||
interface ParseOptions {
|
||||
ignoreQueryPrefix?: boolean;
|
||||
delimiter?: string;
|
||||
depth?: number;
|
||||
arrayLimit?: number;
|
||||
parseArrays?: boolean;
|
||||
decoder?: (str: string, defaultDecoder: (str: string) => string) => string;
|
||||
allowDots?: boolean;
|
||||
plainObjects?: boolean;
|
||||
allowPrototypes?: boolean;
|
||||
parameterLimit?: number;
|
||||
strictNullHandling?: boolean;
|
||||
}
|
||||
|
||||
interface StringifyOptions {
|
||||
delimiter?: string;
|
||||
strictNullHandling?: boolean;
|
||||
skipNulls?: boolean;
|
||||
encode?: boolean;
|
||||
encoder?: (str: string) => any;
|
||||
filter?: Array<string | number> | ((prefix: string, value: any) => any);
|
||||
arrayFormat?: "indices" | "brackets" | "repeat";
|
||||
indices?: boolean;
|
||||
sort?: (a: any, b: any) => number;
|
||||
serializeDate?: (d: Date) => string;
|
||||
format?: "RFC1738" | "RFC3986";
|
||||
encodeValuesOnly?: boolean;
|
||||
addQueryPrefix?: boolean;
|
||||
allowDots?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function parse(str: string, options?: I.ParseOptions): any;
|
||||
|
||||
function stringify(obj: any, options?: I.StringifyOptions): string;
|
||||
|
||||
function unescape(str: string): string;
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface RegexNotOptions {
|
||||
contains?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function regexNot(pattern: string, options?: I.RegexNotOptions): RegExp;
|
||||
|
||||
function repeat<T>(item: T, n: number): T[];
|
||||
|
||||
// retry: TODO
|
||||
|
||||
function signalNameToCode(signame: string): number;
|
||||
|
||||
function splitBuffer(buf: string | Buffer, splitBuf: string | Buffer, includeDelim?: boolean): Buffer[];
|
||||
|
||||
namespace I {
|
||||
type SplitStringSplitFunction = (token: {
|
||||
val: string;
|
||||
idx: number;
|
||||
arr: string[];
|
||||
str: string;
|
||||
}) => void;
|
||||
|
||||
interface SplitStringOptions {
|
||||
braces?: object | boolean;
|
||||
keepEscaping?: boolean;
|
||||
keepQuotes?: boolean;
|
||||
keepDoubleQuotes?: boolean;
|
||||
keepSingleQuotes?: boolean;
|
||||
separator?: string;
|
||||
split?: SplitStringSplitFunction;
|
||||
}
|
||||
}
|
||||
|
||||
function splitString(str: string): string[];
|
||||
function splitString(str: string, options: I.SplitStringOptions): string[];
|
||||
function splitString(str: string, splitter: I.SplitStringSplitFunction): string[];
|
||||
function splitString(str: string, options: I.SplitStringOptions, splitter: I.SplitStringSplitFunction): string[];
|
||||
|
||||
// terraformer: TODO
|
||||
|
||||
namespace I {
|
||||
interface ToRegexOptions {
|
||||
contains?: boolean;
|
||||
negate?: boolean;
|
||||
nocase?: boolean;
|
||||
flags?: string;
|
||||
cache?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function toRegex(patterns: string | string[], options?: I.ToRegexOptions): RegExp;
|
||||
|
||||
namespace I {
|
||||
interface ToRegexRangeOptions {
|
||||
capture?: boolean;
|
||||
shorthand?: boolean;
|
||||
relaxZeros?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function toRegexRange(min: string | number, max: string | number, options?: I.ToRegexRangeOptions): RegExp;
|
||||
|
||||
namespace xorDistance {
|
||||
function compare(a: Buffer, b: Buffer): boolean;
|
||||
|
||||
function create(a: Buffer, b: Buffer): Buffer;
|
||||
|
||||
function gt(a: Buffer, b: Buffer): boolean;
|
||||
|
||||
function lt(a: Buffer, b: Buffer): boolean;
|
||||
|
||||
function eq(a: Buffer, b: Buffer): boolean;
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface BracesOptions {
|
||||
/**
|
||||
* Generate an "expanded" brace pattern (this option is unncessary with the `.expand` method, which does the same thing).
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
expand?: boolean;
|
||||
|
||||
/**
|
||||
* Enabled by default.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
optimize?: boolean;
|
||||
|
||||
/**
|
||||
* Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
nodupes?: boolean;
|
||||
|
||||
/**
|
||||
* When `braces.expand()` is used, or `options.expand` is true, brace patterns will automatically be [optimized](#optionsoptimize)
|
||||
* when the difference between the range minimum and range maximum exceeds the `rangeLimit`.
|
||||
* This is to prevent huge ranges from freezing your application.
|
||||
*
|
||||
* You can set this to any number, or change `options.rangeLimit` to `Inifinity` to disable this altogether.
|
||||
*
|
||||
* @default 250
|
||||
*/
|
||||
rangeLimit?: number;
|
||||
|
||||
/**
|
||||
* Customize range expansion.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
transform?: (str: string) => string;
|
||||
|
||||
/**
|
||||
* In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times.
|
||||
*
|
||||
* Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists)
|
||||
*
|
||||
* The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers)
|
||||
* are defined in the given pattern, and not to try to expand them as lists.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
quantifiers?: boolean;
|
||||
|
||||
/**
|
||||
* Strip backslashes that were used for escaping from the result.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
unescape?: boolean;
|
||||
}
|
||||
interface BracesFunction {
|
||||
(pattern: string, options?: BracesOptions): string[];
|
||||
expand(pattern: string, options?: BracesOptions): string[];
|
||||
MAX_LENGTH: number;
|
||||
clearCache(): void;
|
||||
resizeCache(newSize: number): void;
|
||||
getCache(): object; // TODO
|
||||
makeRe(pattern: string, options?: BracesOptions): RegExp;
|
||||
}
|
||||
}
|
||||
|
||||
const braces: I.BracesFunction;
|
||||
|
||||
namespace I {
|
||||
interface MatchOptions {
|
||||
/**
|
||||
* Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
basename?: boolean;
|
||||
|
||||
/**
|
||||
* Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression.
|
||||
* Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**.
|
||||
* Instead, the star is treated the same as an other star.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
bash?: boolean;
|
||||
|
||||
/**
|
||||
* Disable regex and function memoization.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `dot`.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* Similar to the `--failglob` behavior in Bash, throws an error when no matches are found.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
failglob?: boolean;
|
||||
|
||||
/**
|
||||
* String or array of glob patterns to match files to ignore.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
ignore?: string | string[];
|
||||
|
||||
/**
|
||||
* Alias for [options.basename](#options-basename).
|
||||
*/
|
||||
matchBase?: boolean;
|
||||
|
||||
/**
|
||||
* Disable expansion of brace patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nobrace`.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
nobrace?: boolean;
|
||||
|
||||
/**
|
||||
* Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
nocase?: boolean;
|
||||
|
||||
/**
|
||||
* Remove duplicate elements from the result array.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
nodupes?: boolean;
|
||||
|
||||
/**
|
||||
* Disable extglob support, so that extglobs are regarded as literal characters.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
noext?: boolean;
|
||||
|
||||
/**
|
||||
* Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
nonegate?: boolean;
|
||||
|
||||
/**
|
||||
* Disable matching with globstars (`**`).
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
noglobstar?: boolean;
|
||||
|
||||
/**
|
||||
* Alias for [options.nullglob](#options-nullglob).
|
||||
*/
|
||||
nonull?: boolean;
|
||||
|
||||
/**
|
||||
* If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array.
|
||||
* Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
nullglob?: boolean;
|
||||
|
||||
/**
|
||||
* Pass your own instance of [snapdragon](https://github.com/jonschlinkert/snapdragon), to customize parsers or compilers.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
snapdragon?: object;
|
||||
|
||||
/**
|
||||
* Generate a source map by enabling the `sourcemap` option with the `.parse`, `.compile`, or `.create` methods.
|
||||
*
|
||||
* _(Note that sourcemaps are currently not enabled for brace patterns)_
|
||||
*/
|
||||
sourcemap?: boolean;
|
||||
|
||||
/**
|
||||
* Remove backslashes from returned matches.
|
||||
*
|
||||
* @default undefined
|
||||
*/
|
||||
unescape?: boolean;
|
||||
|
||||
/**
|
||||
* Convert path separators on returned files to posix/unix-style forward slashes.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
unixify?: boolean;
|
||||
}
|
||||
|
||||
interface MatchFunction {
|
||||
/**
|
||||
* The main function takes a list of strings and one or more glob patterns to use for matching.
|
||||
*
|
||||
* @param list A list of strings to match
|
||||
* @param patterns One or more glob patterns to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns an array of matches
|
||||
*/
|
||||
(list: string[], patterns: string | string[], options?: MatchOptions): string[];
|
||||
|
||||
/**
|
||||
* Similar to the main function, but `pattern` must be a string.
|
||||
*
|
||||
* @param list Array of strings to match
|
||||
* @param pattern Glob pattern to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns an array of matches
|
||||
*/
|
||||
match(list: string[], pattern: string, options?: MatchOptions): string[];
|
||||
|
||||
/**
|
||||
* Returns true if the specified `string` matches the given glob `pattern`.
|
||||
*
|
||||
* @param string String to match
|
||||
* @param pattern Glob pattern to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns true if the string matches the glob pattern.
|
||||
*/
|
||||
isMatch(string: string, pattern: string, options?: MatchOptions): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
|
||||
*
|
||||
* @param list The string or array of strings to test. Returns as soon as the first match is found.
|
||||
* @param patterns One or more glob patterns to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns true if any patterns match `str`
|
||||
*/
|
||||
some(list: string | string[], patterns: string | string[], options?: MatchOptions): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if every string in the given `list` matches any of the given glob `patterns`.
|
||||
*
|
||||
* @param list The string or array of strings to test.
|
||||
* @param patterns One or more glob patterns to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns true if any patterns match `str`
|
||||
*/
|
||||
every(list: string | string[], patterns: string | string[], options?: MatchOptions): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||||
*
|
||||
* @param str The string to test.
|
||||
* @param patterns One or more glob patterns to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns true if any patterns match `str`
|
||||
*/
|
||||
any(str: string | string[], patterns: string | string[], options?: MatchOptions): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if **all** of the given `patterns` match the specified string.
|
||||
*
|
||||
* @param str The string to test.
|
||||
* @param patterns One or more glob patterns to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns true if any patterns match `str`
|
||||
*/
|
||||
all(str: string | string[], patterns: string | string[], options?: MatchOptions): boolean;
|
||||
|
||||
/**
|
||||
* Returns a list of strings that _**do not match any**_ of the given `patterns`.
|
||||
*
|
||||
* @param list Array of strings to match.
|
||||
* @param patterns One or more glob pattern to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns an array of strings that **do not match** the given patterns.
|
||||
*/
|
||||
not(list: string[], patterns: string | string[], options?: MatchOptions): string[];
|
||||
|
||||
/**
|
||||
* Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
|
||||
*
|
||||
* @param str The string to match.
|
||||
* @param patterns Glob pattern to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns true if the patter matches any part of `str`.
|
||||
*/
|
||||
contains(str: string, patterns: string | string[], options?: MatchOptions): boolean;
|
||||
|
||||
/**
|
||||
* Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys.
|
||||
* If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead.
|
||||
*
|
||||
* @param object The object with keys to filter.
|
||||
* @param patterns One or more glob patterns to use for matching.
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns an object with only keys that match the given patterns.
|
||||
*/
|
||||
matchKeys<T>(object: T, patterns: string | string[], options?: MatchOptions): Partial<T>;
|
||||
|
||||
/**
|
||||
* Returns a memoized matcher function from the given glob `pattern` and `options`.
|
||||
* The returned function takes a string to match as its only argument and returns true if the string is a match.
|
||||
*
|
||||
* @param pattern Glob pattern
|
||||
* @param options See available options for changing how matches are performed.
|
||||
* @returns Returns a matcher function.
|
||||
*/
|
||||
matcher(pattern: string | string[], options?: MatchOptions): (str: string) => boolean;
|
||||
|
||||
/**
|
||||
* Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match.
|
||||
*
|
||||
* @param pattern Glob pattern to use for matching.
|
||||
* @param string String to match
|
||||
* @param options See available options for changing how matches are performed
|
||||
* @returns Returns an array of captures if the string matches the glob pattern, otherwise `null`.
|
||||
*/
|
||||
capture(pattern: string, string: string, options?: MatchOptions): string[] | null;
|
||||
|
||||
/**
|
||||
* Create a regular expression from the given glob `pattern`.
|
||||
*
|
||||
* @param pattern A glob pattern to convert to regex.
|
||||
* @param options See available options for changing how matches are performed.
|
||||
* @returns Returns a regex created from the given pattern.
|
||||
*/
|
||||
makeRe(pattern: string, options?: MatchOptions): RegExp;
|
||||
|
||||
/**
|
||||
* Expand the given brace `pattern`.
|
||||
*
|
||||
* @param pattern String with brace pattern to expand.
|
||||
* @param options Any options to change how expansion is performed. See the [braces](https://github.com/micromatch/braces) library for all available options.
|
||||
*/
|
||||
braces(pattern: string, options?: MatchOptions): string[];
|
||||
|
||||
/**
|
||||
* Parses the given glob `pattern` and returns an array of abstract syntax trees (ASTs), with the compiled `output` and optional source `map` on each AST.
|
||||
*
|
||||
* @param pattern Glob pattern to parse and compile.
|
||||
* @param options Any options to change how parsing and compiling is performed.
|
||||
* @returns Returns an object with the parsed AST, compiled string and optional source map.
|
||||
*/
|
||||
create(pattern: string, options?: MatchOptions): object;
|
||||
|
||||
/**
|
||||
* Parse the given `str` with the given `options`.
|
||||
*
|
||||
* @returns Returns an AST
|
||||
*/
|
||||
parse(str: string, options?: MatchOptions): object;
|
||||
|
||||
/**
|
||||
* Compile the given `ast` or string with the given `options`.
|
||||
*
|
||||
* @returns Returns an object that has an `output` property with the compiled string.
|
||||
*/
|
||||
compile(ast: object | string, options?: MatchOptions): object;
|
||||
|
||||
MAX_LENGTH: number;
|
||||
|
||||
clearCache(): void;
|
||||
|
||||
resizeCache(newSize: number): void;
|
||||
|
||||
getCache(): object; // TODO
|
||||
}
|
||||
}
|
||||
|
||||
const match: I.MatchFunction;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ namespace assertionTests {
|
||||
assert.fail(1, 2, "hello");
|
||||
assert.fail(1, 2, "hello", "<");
|
||||
|
||||
assert.isOk(1);
|
||||
assert.isOk(1, "hello");
|
||||
assert.ok(1);
|
||||
assert.ok(1, "hello");
|
||||
|
||||
assert.isNotOk(1);
|
||||
assert.isNotOk(1, "hello");
|
||||
assert.notOk(1);
|
||||
assert.notOk(1, "hello");
|
||||
|
||||
assert.equal(1, 2);
|
||||
assert.equal(1, 2, "hello");
|
||||
@@ -68,38 +68,38 @@ namespace assertionTests {
|
||||
assert.notDeepEqual(1, 2);
|
||||
assert.notDeepEqual(1, 2, "hello");
|
||||
|
||||
assert.isAbove(1, 2);
|
||||
assert.isAbove(1, 2, "hello");
|
||||
assert.above(1, 2);
|
||||
assert.above(1, 2, "hello");
|
||||
|
||||
assert.isAtLeast(1, 2);
|
||||
assert.isAtLeast(1, 2, "hello");
|
||||
assert.atLeast(1, 2);
|
||||
assert.atLeast(1, 2, "hello");
|
||||
|
||||
assert.isBelow(1, 2);
|
||||
assert.isBelow(1, 2, "hello");
|
||||
assert.below(1, 2);
|
||||
assert.below(1, 2, "hello");
|
||||
|
||||
assert.isAtMost(1, 2);
|
||||
assert.isAtMost(1, 2, "hello");
|
||||
assert.atMost(1, 2);
|
||||
assert.atMost(1, 2, "hello");
|
||||
|
||||
assert.isTrue(1);
|
||||
assert.isTrue(1, "hello");
|
||||
assert.true(1);
|
||||
assert.true(1, "hello");
|
||||
|
||||
assert.isNotTrue(1);
|
||||
assert.isNotTrue(1, "hello");
|
||||
assert.notTrue(1);
|
||||
assert.notTrue(1, "hello");
|
||||
|
||||
assert.isFalse(1);
|
||||
assert.isFalse(1, "hello");
|
||||
assert.false(1);
|
||||
assert.false(1, "hello");
|
||||
|
||||
assert.isNotFalse(1);
|
||||
assert.isNotFalse(1, "hello");
|
||||
assert.notFalse(1);
|
||||
assert.notFalse(1, "hello");
|
||||
|
||||
assert.isNull(1);
|
||||
assert.isNull(1, "hello");
|
||||
assert.null(1);
|
||||
assert.null(1, "hello");
|
||||
|
||||
assert.isNaN(1);
|
||||
assert.isNaN(1, "hello");
|
||||
assert.NaN(1);
|
||||
assert.NaN(1, "hello");
|
||||
|
||||
assert.isNotNaN(1);
|
||||
assert.isNotNaN(1, "hello");
|
||||
assert.NotNaN(1);
|
||||
assert.NotNaN(1, "hello");
|
||||
|
||||
assert.exists(1);
|
||||
assert.exists(1, "hello");
|
||||
@@ -107,49 +107,49 @@ namespace assertionTests {
|
||||
assert.notExists(1);
|
||||
assert.notExists(1, "hello");
|
||||
|
||||
assert.isUndefined(1);
|
||||
assert.isUndefined(1, "hello");
|
||||
assert.undefined(1);
|
||||
assert.undefined(1, "hello");
|
||||
|
||||
assert.isDefined(1);
|
||||
assert.isDefined(1, "hello");
|
||||
assert.defined(1);
|
||||
assert.defined(1, "hello");
|
||||
|
||||
assert.isFunction(1);
|
||||
assert.isFunction(1, "hello");
|
||||
assert.function(1);
|
||||
assert.function(1, "hello");
|
||||
|
||||
assert.isNotFunction(1);
|
||||
assert.isNotFunction(1, "hello");
|
||||
assert.notFunction(1);
|
||||
assert.notFunction(1, "hello");
|
||||
|
||||
assert.isObject(1);
|
||||
assert.isObject(1, "hello");
|
||||
assert.object(1);
|
||||
assert.object(1, "hello");
|
||||
|
||||
assert.isNotObject(1);
|
||||
assert.isNotObject(1, "hello");
|
||||
assert.notObject(1);
|
||||
assert.notObject(1, "hello");
|
||||
|
||||
assert.isArray(1);
|
||||
assert.isArray(1, "hello");
|
||||
assert.array(1);
|
||||
assert.array(1, "hello");
|
||||
|
||||
assert.isNotArray(1);
|
||||
assert.isNotArray(1, "hello");
|
||||
assert.notArray(1);
|
||||
assert.notArray(1, "hello");
|
||||
|
||||
assert.isString(1, "hello");
|
||||
assert.string(1, "hello");
|
||||
|
||||
assert.isNotString(1);
|
||||
assert.isNotString(1, "hello");
|
||||
assert.notString(1);
|
||||
assert.notString(1, "hello");
|
||||
|
||||
assert.isNumber(1);
|
||||
assert.isNumber(1, "hello");
|
||||
assert.number(1);
|
||||
assert.number(1, "hello");
|
||||
|
||||
assert.isNotNumber(1);
|
||||
assert.isNotNumber(1, "hello");
|
||||
assert.notNumber(1);
|
||||
assert.notNumber(1, "hello");
|
||||
|
||||
assert.isFinite(1);
|
||||
assert.isFinite(1, "hello");
|
||||
assert.finite(1);
|
||||
assert.finite(1, "hello");
|
||||
|
||||
assert.isBoolean(1);
|
||||
assert.isBoolean(1, "hello");
|
||||
assert.boolean(1);
|
||||
assert.boolean(1, "hello");
|
||||
|
||||
assert.isNotBoolean(1);
|
||||
assert.isNotBoolean(1, "hello");
|
||||
assert.notBoolean(1);
|
||||
assert.notBoolean(1, "hello");
|
||||
|
||||
assert.typeOf(1, "string");
|
||||
assert.typeOf(1, "number", "hello");
|
||||
@@ -457,26 +457,26 @@ namespace assertionTests {
|
||||
|
||||
assert.ifError(1);
|
||||
|
||||
assert.isExtensible({});
|
||||
assert.isExtensible({}, "hello");
|
||||
assert.extensible({});
|
||||
assert.extensible({}, "hello");
|
||||
|
||||
assert.isNotExtensible({});
|
||||
assert.isNotExtensible({}, "hello");
|
||||
assert.notExtensible({});
|
||||
assert.notExtensible({}, "hello");
|
||||
|
||||
assert.isSealed({});
|
||||
assert.isSealed({}, "hello");
|
||||
assert.sealed({});
|
||||
assert.sealed({}, "hello");
|
||||
|
||||
assert.isNotSealed({});
|
||||
assert.isNotSealed({}, "hello");
|
||||
assert.notSealed({});
|
||||
assert.notSealed({}, "hello");
|
||||
|
||||
assert.isFrozen({});
|
||||
assert.isFrozen({}, "hello");
|
||||
assert.frozen({});
|
||||
assert.frozen({}, "hello");
|
||||
|
||||
assert.isNotFrozen({});
|
||||
assert.isNotFrozen({}, "hello");
|
||||
assert.notFrozen({});
|
||||
assert.notFrozen({}, "hello");
|
||||
|
||||
assert.isEmpty({});
|
||||
assert.isEmpty({}, "hello");
|
||||
assert.empty({});
|
||||
assert.empty({}, "hello");
|
||||
}
|
||||
|
||||
const { expect } = assertion;
|
||||
@@ -499,16 +499,16 @@ namespace assertionTests {
|
||||
expect(1).to.contain(2, "hello").and;
|
||||
expect(1).but.contains(2).and;
|
||||
expect(1).but.contains(2, "hello").and;
|
||||
expect(1).to.ok.not.ok;
|
||||
expect(1).to.be.true.but.false;
|
||||
expect(1).to.be.false.but.true;
|
||||
expect(1).to.be.null.and.null;
|
||||
expect(1).to.be.undefined.and.true;
|
||||
expect(1).to.be.NaN.and.null;
|
||||
expect(1).to.exist.and.be.null;
|
||||
expect(1).to.be.empty.and.true;
|
||||
expect(1).to.be.arguments.and.a("number");
|
||||
expect(1).to.be.Arguments.and.false;
|
||||
expect(1).to.ok().and.a("string");
|
||||
expect(1).to.be.true().but.false();
|
||||
expect(1).to.be.false().but.true();
|
||||
expect(1).to.be.null().and.null();
|
||||
expect(1).to.be.undefined().and.true();
|
||||
expect(1).to.be.NaN().and.null();
|
||||
expect(1).to.exist().and.be.null();
|
||||
expect(1).to.be.empty().and.true();
|
||||
expect(1).to.be.arguments().and.a("number");
|
||||
expect(1).to.be.Arguments().and.false();
|
||||
expect(1).to.be.equal(2).and;
|
||||
expect(1).to.be.equal(2, "hello").and;
|
||||
expect(1).but.equals(2).and;
|
||||
@@ -624,19 +624,19 @@ namespace assertionTests {
|
||||
expect(() => {}).but.decreases({}, "a", "hello").and;
|
||||
expect(() => {}).to.decreases({}).by(2).and;
|
||||
expect(() => {}).to.decreases({}).by(2, "hello").and;
|
||||
expect({}).to.be.extensible.and;
|
||||
expect({}).to.be.sealed.and;
|
||||
expect({}).to.be.frozen.and;
|
||||
expect({}).to.be.finite.and;
|
||||
expect({}).to.be.extensible().and;
|
||||
expect({}).to.be.sealed().and;
|
||||
expect({}).to.be.frozen().and;
|
||||
expect({}).to.be.finite().and;
|
||||
|
||||
namespace mockTests {
|
||||
const s1 = adone.shani.util.spy();
|
||||
const s2 = adone.shani.util.spy();
|
||||
|
||||
expect(s1).to.have.been.called;
|
||||
expect(s1).to.have.been.calledOnce;
|
||||
expect(s1).to.have.been.calledTwice;
|
||||
expect(s1).to.have.been.calledThrice;
|
||||
expect(s1).to.have.been.called();
|
||||
expect(s1).to.have.been.calledOnce();
|
||||
expect(s1).to.have.been.calledTwice();
|
||||
expect(s1).to.have.been.calledThrice();
|
||||
expect(s1).to.have.callCount(100);
|
||||
expect(s1).to.have.been.calledBefore(s2);
|
||||
expect(s1).to.have.been.calledAfter(s2);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace dataTests {
|
||||
{ const a: Buffer = json.encode(1, { replacer: ["a", "b", "c"] }); }
|
||||
{ const a: Buffer = json.encode(1, { replacer: (k: string, v: any) => null }); }
|
||||
{ const a: Buffer = json.encode(1, { space: " " }); }
|
||||
{ const a: Buffer = json.encode(1, { newline: true }); }
|
||||
|
||||
json.decode("123");
|
||||
json.decode(Buffer.from("123"));
|
||||
@@ -52,6 +53,8 @@ namespace dataTests {
|
||||
mpak.decode(new Uint8Array(10));
|
||||
mpak.decode(new ArrayBuffer(10));
|
||||
|
||||
mpak.tryDecode(new adone.collection.ByteArray());
|
||||
|
||||
new mpak.Encoder([]);
|
||||
new mpak.Encoder([{
|
||||
type: 10,
|
||||
@@ -73,6 +76,9 @@ namespace dataTests {
|
||||
new mpak.Decoder([]).decode(new ArrayBuffer(10));
|
||||
new mpak.Decoder([]).tryDecode(adone.collection.ByteArray.wrap("hello"));
|
||||
|
||||
new mpak.Serializer();
|
||||
new mpak.Serializer(100);
|
||||
mpak.registerCommonTypesFor(new mpak.Serializer());
|
||||
{ const a: adone.data.mpak.Encoder = new mpak.Serializer().encoder; }
|
||||
{ const a: adone.data.mpak.Decoder = new mpak.Serializer().decoder; }
|
||||
{ const a: adone.data.mpak.Serializer = new mpak.Serializer().registerEncoder(10, (x) => true, (x) => new adone.collection.ByteArray(10)); }
|
||||
@@ -125,6 +131,7 @@ namespace dataTests {
|
||||
{ const a: string = base64.decode("string", {}); }
|
||||
{ const a: string = base64.decode("string", { buffer: false }); }
|
||||
{ const a: Buffer = base64.decode("string", { buffer: true }); }
|
||||
{ const a: string = base64.decode("string", { encoding: "utf8" }); }
|
||||
|
||||
{ const a: string = base64.encodeVLQ(123); }
|
||||
{ const a: number = base64.decodeVLQ("H"); }
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
namespace eventsTests {
|
||||
namespace EventEmitter {
|
||||
namespace static {
|
||||
const a: number = adone.event.EventEmitter.listenerCount(new adone.event.EventEmitter(), "event");
|
||||
const b: number = adone.event.EventEmitter.defaultMaxListeners;
|
||||
const a: number = adone.event.Emitter.listenerCount(new adone.event.Emitter(), "event");
|
||||
const b: number = adone.event.Emitter.defaultMaxListeners;
|
||||
}
|
||||
|
||||
namespace addListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().addListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().addListener(Symbol("event"), () => { });
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().addListener("event", () => { });
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().addListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace on {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().on("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().on(Symbol("event"), () => { });
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().on("event", () => { });
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().on(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace once {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().once("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().once(Symbol("event"), () => { });
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().once("event", () => { });
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().once(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().prependListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().prependListener(Symbol("event"), () => { });
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().prependListener("event", () => { });
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().prependListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependOnceListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().prependOnceListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().prependOnceListener(Symbol("event"), () => { });
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().prependOnceListener("event", () => { });
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().prependOnceListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace removeListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().removeListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().removeListener(Symbol("event"), () => { });
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().removeListener("event", () => { });
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().removeListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace removeAllListeners {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().removeAllListeners("event");
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().removeAllListeners(Symbol("event"));
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().removeAllListeners("event");
|
||||
const b: adone.event.Emitter = new adone.event.Emitter().removeAllListeners(Symbol("event"));
|
||||
}
|
||||
|
||||
namespace setMaxListeners {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().setMaxListeners(10);
|
||||
const a: adone.event.Emitter = new adone.event.Emitter().setMaxListeners(10);
|
||||
}
|
||||
|
||||
namespace getMaxListeners {
|
||||
const a: number = new adone.event.EventEmitter().getMaxListeners();
|
||||
const a: number = new adone.event.Emitter().getMaxListeners();
|
||||
}
|
||||
|
||||
namespace listeners {
|
||||
const a: Array<(...args: any[]) => any> = new adone.event.EventEmitter().listeners("event");
|
||||
const b: Array<(...args: any[]) => any> = new adone.event.EventEmitter().listeners(Symbol("event"));
|
||||
const a: Array<(...args: any[]) => any> = new adone.event.Emitter().listeners("event");
|
||||
const b: Array<(...args: any[]) => any> = new adone.event.Emitter().listeners(Symbol("event"));
|
||||
}
|
||||
|
||||
namespace emit {
|
||||
const a: boolean = new adone.event.EventEmitter().emit("event", 1, 2, 3);
|
||||
const b: boolean = new adone.event.EventEmitter().emit(Symbol("event"), 1, 2, 3);
|
||||
const a: boolean = new adone.event.Emitter().emit("event", 1, 2, 3);
|
||||
const b: boolean = new adone.event.Emitter().emit(Symbol("event"), 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace eventNames {
|
||||
const a: Array<string | symbol> = new adone.event.EventEmitter().eventNames();
|
||||
const b: Array<string | symbol> = new adone.event.EventEmitter().eventNames();
|
||||
const a: Array<string | symbol> = new adone.event.Emitter().eventNames();
|
||||
const b: Array<string | symbol> = new adone.event.Emitter().eventNames();
|
||||
}
|
||||
|
||||
namespace listenerCount {
|
||||
const a: number = new adone.event.EventEmitter().listenerCount("event");
|
||||
const b: number = new adone.event.EventEmitter().listenerCount(Symbol("event"));
|
||||
const a: number = new adone.event.Emitter().listenerCount("event");
|
||||
const b: number = new adone.event.Emitter().listenerCount(Symbol("event"));
|
||||
}
|
||||
}
|
||||
|
||||
namespace AsyncEmitter {
|
||||
const a: adone.event.EventEmitter = new adone.event.AsyncEmitter();
|
||||
const a: adone.event.Emitter = new adone.event.AsyncEmitter();
|
||||
new adone.event.AsyncEmitter(10);
|
||||
|
||||
namespace setConcurrency {
|
||||
|
||||
@@ -11,6 +11,15 @@ namespace fsTests {
|
||||
fs.readlink("file", null).then((x: Buffer) => x);
|
||||
fs.readlink("file", "hex").then((x: string) => x);
|
||||
fs.readlink("file").then((x: string) => x);
|
||||
fs.readlinkSync("file");
|
||||
fs.readlinkSync(Buffer.from("file"));
|
||||
fs.readlinkSync(new URL("file://file"));
|
||||
{ const a: string = fs.readlinkSync("file", {}); }
|
||||
{ const a: string = fs.readlinkSync("file", { encoding: "utf8" }); }
|
||||
{ const a: Buffer = fs.readlinkSync("file", { encoding: null }); }
|
||||
{ const a: Buffer = fs.readlinkSync("file", null); }
|
||||
{ const a: string = fs.readlinkSync("file", "hex"); }
|
||||
{ const a: string = fs.readlinkSync("file"); }
|
||||
}
|
||||
|
||||
namespace unlinkTests {
|
||||
@@ -22,6 +31,24 @@ namespace fsTests {
|
||||
fs.unlinkSync(new URL("file://file"));
|
||||
}
|
||||
|
||||
namespace utimesTests {
|
||||
fs.utimes("hello", 100, 100).then(() => {});
|
||||
fs.utimes(Buffer.from("hello"), 100, 100).then(() => {});
|
||||
fs.utimes(new URL("hello"), 100, 100).then(() => {});
|
||||
fs.utimes("hello", "100", "100").then(() => {});
|
||||
fs.utimes("hello", new Date(100), new Date(100)).then(() => {});
|
||||
|
||||
fs.utimesSync("hello", 100, 100);
|
||||
fs.utimesSync(Buffer.from("hello"), 100, 100);
|
||||
fs.utimesSync(new URL("hello"), 100, 100);
|
||||
fs.utimesSync("hello", "100", "100");
|
||||
fs.utimesSync("hello", new Date(100), new Date(100));
|
||||
|
||||
fs.utimesMillis("hello", 100, 100);
|
||||
fs.utimesMillis(Buffer.from("hello"), 100, 100);
|
||||
fs.utimesMillis(new URL("hello"), 100, 100);
|
||||
}
|
||||
|
||||
namespace chmodTests {
|
||||
fs.chmod("file", 0o333).then(() => {});
|
||||
fs.chmod(Buffer.from("file"), 0o333).then(() => {});
|
||||
@@ -60,6 +87,87 @@ namespace fsTests {
|
||||
const e: Buffer[] = fs.readdirSync("file", { encoding: null });
|
||||
}
|
||||
|
||||
namespace readdirpTests {
|
||||
fs.readdirp("hello").forEach((entry) => {
|
||||
{ const a: string = entry.fullParentDir; }
|
||||
{ const a: string = entry.fullPath; }
|
||||
{ const a: string = entry.name; }
|
||||
{ const a: string = entry.parentDir; }
|
||||
{ const a: string = entry.path; }
|
||||
{ const a: adone.fs.I.Stats = entry.stat; }
|
||||
});
|
||||
|
||||
fs.readdirp(Buffer.from("hello"));
|
||||
fs.readdirp(new URL("hello"));
|
||||
fs.readdirp("hello", {});
|
||||
fs.readdirp("hello", { depth: 100 });
|
||||
fs.readdirp("hello", { directories: true });
|
||||
fs.readdirp("hello", { directoryFilter: () => true });
|
||||
fs.readdirp("hello", {
|
||||
directoryFilter: (entry) => {
|
||||
{ const a: string = entry.fullParentDir; }
|
||||
{ const a: string = entry.fullPath; }
|
||||
{ const a: string = entry.name; }
|
||||
{ const a: string = entry.parentDir; }
|
||||
{ const a: string = entry.path; }
|
||||
{ const a: adone.fs.I.Stats = entry.stat; }
|
||||
return true;
|
||||
}
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
directoryFilter: [(entry) => {
|
||||
{ const a: string = entry.fullParentDir; }
|
||||
{ const a: string = entry.fullPath; }
|
||||
{ const a: string = entry.name; }
|
||||
{ const a: string = entry.parentDir; }
|
||||
{ const a: string = entry.path; }
|
||||
{ const a: adone.fs.I.Stats = entry.stat; }
|
||||
return true;
|
||||
}]
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
directoryFilter: ["*"]
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
directoryFilter: "*"
|
||||
});
|
||||
fs.readdirp("hello", { fileFilter: () => true });
|
||||
fs.readdirp("hello", {
|
||||
fileFilter: (entry) => {
|
||||
{ const a: string = entry.fullParentDir; }
|
||||
{ const a: string = entry.fullPath; }
|
||||
{ const a: string = entry.name; }
|
||||
{ const a: string = entry.parentDir; }
|
||||
{ const a: string = entry.path; }
|
||||
{ const a: adone.fs.I.Stats = entry.stat; }
|
||||
return true;
|
||||
}
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
fileFilter: [(entry) => {
|
||||
{ const a: string = entry.fullParentDir; }
|
||||
{ const a: string = entry.fullPath; }
|
||||
{ const a: string = entry.name; }
|
||||
{ const a: string = entry.parentDir; }
|
||||
{ const a: string = entry.path; }
|
||||
{ const a: adone.fs.I.Stats = entry.stat; }
|
||||
return true;
|
||||
}]
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
fileFilter: ["*"]
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
fileFilter: "*"
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
files: false
|
||||
});
|
||||
fs.readdirp("hello", {
|
||||
lstat: true
|
||||
});
|
||||
}
|
||||
|
||||
namespace lstatTests {
|
||||
fs.lstat("file").then((x: nodestd.fs.Stats) => {});
|
||||
fs.lstat(Buffer.from("file")).then((x: nodestd.fs.Stats) => {});
|
||||
@@ -119,6 +227,15 @@ namespace fsTests {
|
||||
fs.appendFile("file", "hello", { encoding: "utf8" }).then(() => {});
|
||||
fs.appendFile("file", "hello", { mode: 0o755 }).then(() => {});
|
||||
fs.appendFile("file", "hello", { flag: "w" }).then(() => {});
|
||||
|
||||
fs.appendFileSync("file", "hello");
|
||||
fs.appendFileSync(Buffer.from("file"), "hello");
|
||||
fs.appendFileSync(10, "hello");
|
||||
fs.appendFileSync("file", Buffer.from("hello"));
|
||||
fs.appendFileSync("file", "hello", {});
|
||||
fs.appendFileSync("file", "hello", { encoding: "utf8" });
|
||||
fs.appendFileSync("file", "hello", { mode: 0o755 });
|
||||
fs.appendFileSync("file", "hello", { flag: "w" });
|
||||
}
|
||||
|
||||
namespace accessTests {
|
||||
@@ -153,6 +270,12 @@ namespace fsTests {
|
||||
fs.rm("file", { cwd: __dirname }).then((x) => {});
|
||||
}
|
||||
|
||||
namespace rmEmptyTests {
|
||||
fs.rmEmpty("file").then(() => {});
|
||||
fs.rmEmpty("file", { cwd: "a" }).then(() => {});
|
||||
fs.rmEmpty("file", { filter: (filename) => filename.charCodeAt(0) === 100 }).then(() => {});
|
||||
}
|
||||
|
||||
namespace ModeTests {
|
||||
const stat = fs.statSync("file");
|
||||
const mode = new fs.Mode(stat);
|
||||
@@ -513,37 +636,36 @@ namespace fsTests {
|
||||
}
|
||||
|
||||
namespace fdTests {
|
||||
const { fd } = fs;
|
||||
fd.open("hello", "r+").then((x: number) => {});
|
||||
fd.open(Buffer.from("hello"), "r+").then((x: number) => {});
|
||||
fd.open(new URL("file://hello"), "r+").then((x: number) => {});
|
||||
{ const a: number = fd.openSync("hello", "r+"); }
|
||||
{ const a: number = fd.openSync(Buffer.from("hello"), "r+"); }
|
||||
{ const a: number = fd.openSync(new URL("file://hello"), "r+"); }
|
||||
fd.close(10).then(() => {});
|
||||
fd.closeSync(10);
|
||||
fd.utimes(10, 100500, 100500).then(() => {});
|
||||
fd.utimesSync(10, 100500, 100500);
|
||||
fd.stat(10).then((x: adone.fs.I.Stats) => {});
|
||||
{ const a: adone.fs.I.Stats = fd.statSync(10); }
|
||||
fd.truncate(10).then(() => {});
|
||||
fd.truncate(10, 10).then(() => {});
|
||||
fd.truncateSync(10);
|
||||
fd.truncateSync(10, 10);
|
||||
fd.read(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {});
|
||||
{ const a: number = fd.readSync(10, Buffer.alloc(10), 0, 10, 10); }
|
||||
fd.write(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {});
|
||||
{ const a: number = fd.writeSync(10, Buffer.alloc(10), 0, 10, 10); }
|
||||
fd.write(10, "hello", 10, "utf8").then((x: number) => {});
|
||||
{ const a: number = fd.writeSync(10, "hello", 10, "utf8"); }
|
||||
fd.sync(10).then(() => {});
|
||||
fd.syncSync(10);
|
||||
fd.chown(10, 0, 0).then(() => {});
|
||||
fd.chownSync(10, 0, 0);
|
||||
fd.chmod(10, 0o755).then(() => {});
|
||||
fd.chmodSync(10, 0o755);
|
||||
fd.seek(10, 100, 0).then((x: number) => {});
|
||||
fd.lock(10, "sh").then(() => {});
|
||||
fs.open("hello", "r+").then((x: number) => {});
|
||||
fs.open(Buffer.from("hello"), "r+").then((x: number) => {});
|
||||
fs.open(new URL("file://hello"), "r+").then((x: number) => {});
|
||||
{ const a: number = fs.openSync("hello", "r+"); }
|
||||
{ const a: number = fs.openSync(Buffer.from("hello"), "r+"); }
|
||||
{ const a: number = fs.openSync(new URL("file://hello"), "r+"); }
|
||||
fs.close(10).then(() => {});
|
||||
fs.closeSync(10);
|
||||
fs.futimes(10, 100500, 100500).then(() => {});
|
||||
fs.futimesSync(10, 100500, 100500);
|
||||
fs.fstat(10).then((x: adone.fs.I.Stats) => {});
|
||||
{ const a: adone.fs.I.Stats = fs.fstatSync(10); }
|
||||
fs.ftruncate(10).then(() => {});
|
||||
fs.ftruncate(10, 10).then(() => {});
|
||||
fs.ftruncateSync(10);
|
||||
fs.ftruncateSync(10, 10);
|
||||
fs.read(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {});
|
||||
{ const a: number = fs.readSync(10, Buffer.alloc(10), 0, 10, 10); }
|
||||
fs.write(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {});
|
||||
{ const a: number = fs.writeSync(10, Buffer.alloc(10), 0, 10, 10); }
|
||||
fs.write(10, "hello", 10, "utf8").then((x: number) => {});
|
||||
{ const a: number = fs.writeSync(10, "hello", 10, "utf8"); }
|
||||
fs.fsync(10).then(() => {});
|
||||
fs.fsyncSync(10);
|
||||
fs.fchown(10, 0, 0).then(() => {});
|
||||
fs.fchownSync(10, 0, 0);
|
||||
fs.fchmod(10, 0o755).then(() => {});
|
||||
fs.fchmodSync(10, 0o755);
|
||||
fs.seek(10, 100, 0).then((x: number) => {});
|
||||
fs.flock(10, "sh").then(() => {});
|
||||
}
|
||||
|
||||
namespace constantsTests {
|
||||
@@ -668,13 +790,44 @@ namespace fsTests {
|
||||
namespace mkdirTests {
|
||||
fs.mkdir("/path/to/some/dir").then(() => {});
|
||||
fs.mkdir("/path/to/some/dir", 0o755).then(() => {});
|
||||
|
||||
fs.mkdirSync("/path/to/some/dir").then(() => {});
|
||||
fs.mkdirSync("/path/to/some/dir", 0o755).then(() => {});
|
||||
}
|
||||
|
||||
namespace mkdirTests {
|
||||
fs.mkdirp("/path/to/some/dir").then(() => {});
|
||||
fs.mkdirp("/path/to/some/dir", 0o755).then(() => {});
|
||||
|
||||
fs.mkdirpSync("/path/to/some/dir").then(() => {});
|
||||
fs.mkdirpSync("/path/to/some/dir", 0o755).then(() => {});
|
||||
}
|
||||
|
||||
namespace copyTests {
|
||||
fs.copy("a", "b").then(() => {});
|
||||
fs.copy("a", "b", {}).then(() => {});
|
||||
fs.copy("a", "b", { cwd: "/tmp" }).then(() => {});
|
||||
fs.copy("a", "b", { ignoreExisting: true }).then(() => {});
|
||||
fs.copy("a", "b", {});
|
||||
fs.copy("a", "b", { clobber: true }).then(() => {});
|
||||
fs.copy("a", "b", { overwrite: true }).then(() => {});
|
||||
fs.copy("a", "b", { filter: /asd/ }).then(() => {});
|
||||
fs.copy("a", "b", { filter: () => true }).then(() => {});
|
||||
fs.copy("a", "b", { filter: (a) => a.charCodeAt(0) === 100 }).then(() => {});
|
||||
fs.copy("a", "b", {
|
||||
transform(r, w, file) {
|
||||
file.atime.getDay();
|
||||
file.mtime.getDay();
|
||||
file.mode.toExponential();
|
||||
file.name.charCodeAt(0);
|
||||
file.stats.atimeMs.toExponential();
|
||||
r.pipe(w);
|
||||
}
|
||||
}).then(() => {});
|
||||
}
|
||||
|
||||
namespace copyTests {
|
||||
fs.copyTo("a", "b").then(() => {});
|
||||
fs.copyTo("a", "b", {});
|
||||
fs.copyTo("a", "b", { cwd: "/tmp" }).then(() => {});
|
||||
fs.copyTo("a", "b", { ignoreExisting: true }).then(() => {});
|
||||
}
|
||||
|
||||
namespace renameTests {
|
||||
@@ -689,6 +842,7 @@ namespace fsTests {
|
||||
fs.tail("file", 10, {}).then((x: Buffer[]) => {});
|
||||
fs.tail("file", 10, { separator: "\n" }).then((x: Buffer[]) => {});
|
||||
fs.tail("file", 10, { chunkLength: 4096 }).then((x: Buffer[]) => {});
|
||||
fs.tail("file", 10, { pos: 10 }).then((x: Buffer[]) => {});
|
||||
}
|
||||
|
||||
namespace statVFSTests {
|
||||
|
||||
@@ -1,115 +1,411 @@
|
||||
namespace isTests {
|
||||
{ const a: boolean = adone.is.null({}); }
|
||||
{ const a: boolean = adone.is.undefined({}); }
|
||||
{ const a: boolean = adone.is.exist({}); }
|
||||
{ const a: boolean = adone.is.nil({}); }
|
||||
{ const a: boolean = adone.is.number({}); }
|
||||
{ const a: boolean = adone.is.numeral({}); }
|
||||
{ const a: boolean = adone.is.infinite({}); }
|
||||
{ const a: boolean = adone.is.odd({}); }
|
||||
{ const a: boolean = adone.is.even({}); }
|
||||
{ const a: boolean = adone.is.float({}); }
|
||||
{ const a: boolean = adone.is.negativeZero({}); }
|
||||
{ const a: boolean = adone.is.string({}); }
|
||||
{ const a: boolean = adone.is.emptyString({}); }
|
||||
{ const a: boolean = adone.is.substring("abc", "abcdef"); }
|
||||
{ const a: boolean = adone.is.substring("abc", "abcdef", 0); }
|
||||
{ const a: boolean = adone.is.prefix("abc", "abcdef"); }
|
||||
{ const a: boolean = adone.is.suffix("def", "abbdef"); }
|
||||
{ const a: boolean = adone.is.boolean({}); }
|
||||
{ const a: boolean = adone.is.json({}); }
|
||||
{ const a: boolean = adone.is.object({}); }
|
||||
{ const a: boolean = adone.is.plainObject({}); }
|
||||
{ const a: boolean = adone.is.class({}); }
|
||||
{ const a: boolean = adone.is.emptyObject({}); }
|
||||
{ const a: boolean = adone.is.propertyOwned({}, "a"); }
|
||||
{ const a: boolean = adone.is.propertyDefined({}, "a"); }
|
||||
{ const a: boolean = adone.is.conforms({}, {}); }
|
||||
{ const a: boolean = adone.is.conforms({}, {}, true); }
|
||||
{ const a: boolean = adone.is.arrayLikeObject({}); }
|
||||
{ const a: boolean = adone.is.inArray(1, [1, 2, 3]); }
|
||||
{ const a: boolean = adone.is.inArray(1, [1, 2, 3], 0); }
|
||||
{ const a: boolean = adone.is.inArray(1, [1, 2, 3], 0, (a, b) => a === b); }
|
||||
{ const a: boolean = adone.is.sameType({}, {}); }
|
||||
{ const a: boolean = adone.is.primitive({}); }
|
||||
{ const a: boolean = adone.is.equalArrays([], []); }
|
||||
{ const a: boolean = adone.is.deepEqual({}, {}); }
|
||||
{ const a: boolean = adone.is.shallowEqual({}, {}); }
|
||||
{ const a: boolean = adone.is.stream({}); }
|
||||
{ const a: boolean = adone.is.writableStream({}); }
|
||||
{ const a: boolean = adone.is.readableStream({}); }
|
||||
{ const a: boolean = adone.is.duplexStream({}); }
|
||||
{ const a: boolean = adone.is.transformStream({}); }
|
||||
{ const a: boolean = adone.is.utf8(Buffer.alloc(10)); }
|
||||
{ const a: boolean = adone.is.win32PathAbsolute("abc"); }
|
||||
{ const a: boolean = adone.is.posixPathAbsolute("abc"); }
|
||||
{ const a: boolean = adone.is.pathAbsolute("abc"); }
|
||||
{ const a: boolean = adone.is.glob("abc"); }
|
||||
{ const a: boolean = adone.is.dotfile("abc"); }
|
||||
{ const a: boolean = adone.is.function(() => { }); }
|
||||
{ const a: boolean = adone.is.asyncFunction(async () => { }); }
|
||||
{ const a: boolean = adone.is.promise({}); }
|
||||
{ const a: boolean = adone.is.validDate("07.08.2017"); }
|
||||
{ const a: boolean = adone.is.buffer({}); }
|
||||
{ const a: boolean = adone.is.callback({}); }
|
||||
{ const a: boolean = adone.is.generator({}); }
|
||||
{ const a: boolean = adone.is.nan({}); }
|
||||
{ const a: boolean = adone.is.finite({}); }
|
||||
{ const a: boolean = adone.is.integer({}); }
|
||||
{ const a: boolean = adone.is.safeInteger({}); }
|
||||
{ const a: boolean = adone.is.array({}); }
|
||||
{ const a: boolean = adone.is.uint8Array({}); }
|
||||
{ const a: boolean = adone.is.configuration({}); }
|
||||
{ const a: boolean = adone.is.long({}); }
|
||||
{ const a: boolean = adone.is.bigNumber({}); }
|
||||
{ const a: boolean = adone.is.byteArray({}); }
|
||||
{ const a: boolean = adone.is.datetime({}); }
|
||||
{ const a: boolean = adone.is.transform({}); }
|
||||
{ const a: boolean = adone.is.subsystem({}); }
|
||||
{ const a: boolean = adone.is.application({}); }
|
||||
{ const a: boolean = adone.is.logger({}); }
|
||||
{ const a: boolean = adone.is.coreStream({}); }
|
||||
{ const a: boolean = adone.is.fastStream({}); }
|
||||
{ const a: boolean = adone.is.fastLocalStream({}); }
|
||||
{ const a: boolean = adone.is.fastLocalMapStream({}); }
|
||||
{ const a: boolean = adone.is.genesisNetron({}); }
|
||||
{ const a: boolean = adone.is.genesisPeer({}); }
|
||||
{ const a: boolean = adone.is.netronAdapter({}); }
|
||||
{ const a: boolean = adone.is.netron({}); }
|
||||
{ const a: boolean = adone.is.netronPeer({}); }
|
||||
{ const a: boolean = adone.is.netronDefinition({}); }
|
||||
{ const a: boolean = adone.is.netronDefinitions({}); }
|
||||
{ const a: boolean = adone.is.netronReference({}); }
|
||||
{ const a: boolean = adone.is.netronInterface({}); }
|
||||
{ const a: boolean = adone.is.netronContext({}); }
|
||||
{ const a: boolean = adone.is.netronIMethod({}, "hello"); }
|
||||
{ const a: boolean = adone.is.netronIProperty({}, "hello"); }
|
||||
{ const a: boolean = adone.is.netronStub({}); }
|
||||
{ const a: boolean = adone.is.netronRemoteStub({}); }
|
||||
{ const a: boolean = adone.is.netronStream({}); }
|
||||
{ const a: boolean = adone.is.iterable({}); }
|
||||
{ const a: boolean = adone.is.windows; }
|
||||
{ const a: boolean = adone.is.linux; }
|
||||
{ const a: boolean = adone.is.freebsd; }
|
||||
{ const a: boolean = adone.is.darwin; }
|
||||
{ const a: boolean = adone.is.sunos; }
|
||||
{ const a: boolean = adone.is.uppercase("abc"); }
|
||||
{ const a: boolean = adone.is.lowercase("abc"); }
|
||||
{ const a: boolean = adone.is.digits("012"); }
|
||||
{ const a: boolean = adone.is.identifier("someMethod"); }
|
||||
{ const a: boolean = adone.is.binaryExtension("mp3"); }
|
||||
{ const a: boolean = adone.is.binaryPath("a.mp3"); }
|
||||
{ const a: boolean = adone.is.ip4("192.168.1.1"); }
|
||||
{ const a: boolean = adone.is.ip6("::192.168.1.1"); }
|
||||
{ const a: boolean = adone.is.arrayBuffer({}); }
|
||||
{ const a: boolean = adone.is.arrayBufferView({}); }
|
||||
{ const a: boolean = adone.is.date({}); }
|
||||
{ const a: boolean = adone.is.error({}); }
|
||||
{ const a: boolean = adone.is.map({}); }
|
||||
{ const a: boolean = adone.is.regexp({}); }
|
||||
{ const a: boolean = adone.is.set({}); }
|
||||
{ const a: boolean = adone.is.symbol({}); }
|
||||
{ const a: boolean = adone.is.validUTF8(Buffer.from("hello")); }
|
||||
{ const a: boolean = adone.is.vaultValuable({}); }
|
||||
{ const a: boolean = adone.is.task({}); }
|
||||
const {
|
||||
is
|
||||
} = adone;
|
||||
{
|
||||
const a: boolean = is.null({});
|
||||
const b: any = 2;
|
||||
if (is.null(b)) {
|
||||
const c: null = b;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.undefined({});
|
||||
const b: any = 2;
|
||||
if (is.undefined(b)) {
|
||||
const c: undefined = b;
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.exist({}); }
|
||||
{
|
||||
const a: boolean = is.nil({});
|
||||
const b: any = 2;
|
||||
if (is.nil(b)) {
|
||||
const c: null | undefined = b;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.number({});
|
||||
const b: any = 2;
|
||||
if (is.number(b)) {
|
||||
b.toExponential();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.numeral({});
|
||||
const b: any = 2;
|
||||
if (is.numeral(b)) {
|
||||
const c: string | number = b;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.infinite({});
|
||||
const b: any = 2;
|
||||
if (is.infinite(b)) {
|
||||
b.toPrecision();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.odd({});
|
||||
const b: any = 2;
|
||||
if (is.odd(b)) {
|
||||
b.toFixed(2);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.even({});
|
||||
const b: any = 2;
|
||||
if (is.even(b)) {
|
||||
b.toFixed(2);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.float({});
|
||||
const b: any = 2;
|
||||
if (is.float(b)) {
|
||||
b.toFixed();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.negativeZero({});
|
||||
const b: any = 2;
|
||||
if (is.negativeZero(b)) {
|
||||
b.toFixed();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.string({});
|
||||
const b: any = 2;
|
||||
if (is.string(b)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.emptyString({});
|
||||
const b: any = 2;
|
||||
if (is.emptyString(b)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.substring("abc", "abcdef"); }
|
||||
{ const a: boolean = is.substring("abc", "abcdef", 0); }
|
||||
{ const a: boolean = is.prefix("abc", "abcdef"); }
|
||||
{ const a: boolean = is.suffix("def", "abbdef"); }
|
||||
{
|
||||
const a: boolean = is.boolean({});
|
||||
const b: any = 2;
|
||||
if (is.boolean(b)) {
|
||||
b === true;
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.json({}); }
|
||||
{ const a: boolean = is.object({}); }
|
||||
{ const a: boolean = is.plainObject({}); }
|
||||
{ const a: boolean = is.class({}); }
|
||||
{ const a: boolean = is.emptyObject({}); }
|
||||
{ const a: boolean = is.propertyOwned({}, "a"); }
|
||||
{ const a: boolean = is.propertyDefined({}, "a"); }
|
||||
{ const a: boolean = is.conforms({}, {}); }
|
||||
{ const a: boolean = is.conforms({}, {}, true); }
|
||||
{ const a: boolean = is.arrayLikeObject({}); }
|
||||
{ const a: boolean = is.inArray(1, [1, 2, 3]); }
|
||||
{ const a: boolean = is.inArray(1, [1, 2, 3], 0); }
|
||||
{ const a: boolean = is.inArray(1, [1, 2, 3], 0, (a, b) => a === b); }
|
||||
{ const a: boolean = is.sameType({}, {}); }
|
||||
{ const a: boolean = is.primitive({}); }
|
||||
{ const a: boolean = is.equalArrays([], []); }
|
||||
{ const a: boolean = is.deepEqual({}, {}); }
|
||||
{ const a: boolean = is.shallowEqual({}, {}); }
|
||||
{ const a: boolean = is.stream({}); }
|
||||
{ const a: boolean = is.writableStream({}); }
|
||||
{ const a: boolean = is.readableStream({}); }
|
||||
{ const a: boolean = is.duplexStream({}); }
|
||||
{ const a: boolean = is.transformStream({}); }
|
||||
{ const a: boolean = is.utf8(Buffer.alloc(10)); }
|
||||
{ const a: boolean = is.win32PathAbsolute("abc"); }
|
||||
{ const a: boolean = is.posixPathAbsolute("abc"); }
|
||||
{ const a: boolean = is.pathAbsolute("abc"); }
|
||||
{
|
||||
const a: boolean = is.glob("abc");
|
||||
const b: any = 2;
|
||||
if (is.glob(b)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.dotfile("abc"); }
|
||||
{ const a: boolean = is.function(() => { }); }
|
||||
{ const a: boolean = is.asyncFunction(async () => { }); }
|
||||
{
|
||||
const a: boolean = is.promise({});
|
||||
const b: any = 2;
|
||||
if (is.promise(b)) {
|
||||
b.then(() => {});
|
||||
}
|
||||
const c = Promise.resolve(2);
|
||||
if (is.promise(c)) {
|
||||
c.then((x) => x.toFixed(2));
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.validDate("07.08.2017"); }
|
||||
{
|
||||
const a: boolean = is.buffer({});
|
||||
const b: any = 2;
|
||||
if (is.buffer(b)) {
|
||||
b.writeDoubleBE(10, 10);
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.callback({}); }
|
||||
{ const a: boolean = is.generator({}); }
|
||||
{ const a: boolean = is.nan({}); }
|
||||
{
|
||||
const a: boolean = is.finite({});
|
||||
const b: any = 2;
|
||||
if (is.finite(b)) {
|
||||
b.toFixed();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.integer({});
|
||||
const b: any = 2;
|
||||
if (is.integer(b)) {
|
||||
b.toFixed();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.safeInteger({});
|
||||
const b: any = 2;
|
||||
if (is.safeInteger(b)) {
|
||||
b.toFixed();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.array({});
|
||||
const b: any = 2;
|
||||
if (is.array(b)) {
|
||||
b.length + b[0];
|
||||
}
|
||||
const c = [1, 2, 3];
|
||||
if (is.array(c)) {
|
||||
c[0].toFixed(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uint8Array({});
|
||||
const b: any = 2;
|
||||
if (is.uint8Array(b)) {
|
||||
b.copyWithin(1, 2);
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.configuration({}); }
|
||||
{
|
||||
const a: boolean = is.long({});
|
||||
const b: any = 2;
|
||||
if (is.long(b)) {
|
||||
b.getHighBitsUnsigned();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.bigNumber({});
|
||||
const b: any = 2;
|
||||
if (is.bigNumber(b)) {
|
||||
b.add(b).isBitSet(10);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.byteArray({});
|
||||
const b: any = 2;
|
||||
if (is.byteArray(b)) {
|
||||
b.toBuffer();
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.datetime({});
|
||||
const b: any = 2;
|
||||
if (is.datetime(b)) {
|
||||
b.add(2, "hours");
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.transform({}); }
|
||||
{ const a: boolean = is.subsystem({}); }
|
||||
{ const a: boolean = is.application({}); }
|
||||
{ const a: boolean = is.logger({}); }
|
||||
{ const a: boolean = is.coreStream({}); }
|
||||
{ const a: boolean = is.fastStream({}); }
|
||||
{ const a: boolean = is.fastLocalStream({}); }
|
||||
{ const a: boolean = is.fastLocalMapStream({}); }
|
||||
{ const a: boolean = is.genesisNetron({}); }
|
||||
{ const a: boolean = is.genesisPeer({}); }
|
||||
{ const a: boolean = is.netronAdapter({}); }
|
||||
{ const a: boolean = is.netron({}); }
|
||||
{ const a: boolean = is.netronPeer({}); }
|
||||
{ const a: boolean = is.netronDefinition({}); }
|
||||
{ const a: boolean = is.netronDefinitions({}); }
|
||||
{ const a: boolean = is.netronReference({}); }
|
||||
{ const a: boolean = is.netronInterface({}); }
|
||||
{ const a: boolean = is.netronContext({}); }
|
||||
{ const a: boolean = is.netronIMethod({}, "hello"); }
|
||||
{ const a: boolean = is.netronIProperty({}, "hello"); }
|
||||
{ const a: boolean = is.netronStub({}); }
|
||||
{ const a: boolean = is.netronRemoteStub({}); }
|
||||
{ const a: boolean = is.netronStream({}); }
|
||||
{ const a: boolean = is.iterable({}); }
|
||||
{ const a: boolean = is.windows; }
|
||||
{ const a: boolean = is.linux; }
|
||||
{ const a: boolean = is.freebsd; }
|
||||
{ const a: boolean = is.darwin; }
|
||||
{ const a: boolean = is.sunos; }
|
||||
{ const a: boolean = is.uppercase("abc"); }
|
||||
{ const a: boolean = is.lowercase("abc"); }
|
||||
{ const a: boolean = is.digits("012"); }
|
||||
{ const a: boolean = is.identifier("someMethod"); }
|
||||
{ const a: boolean = is.binaryExtension("mp3"); }
|
||||
{ const a: boolean = is.binaryPath("a.mp3"); }
|
||||
{ const a: boolean = is.ip4("192.168.1.1"); }
|
||||
{ const a: boolean = is.ip6("::192.168.1.1"); }
|
||||
{
|
||||
const a: boolean = is.arrayBuffer({});
|
||||
const b: any = 2;
|
||||
if (is.arrayBuffer(b)) {
|
||||
b.slice(10);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.arrayBufferView({});
|
||||
const b: any = 2;
|
||||
if (is.arrayBufferView(b)) {
|
||||
b.byteLength + b.byteOffset;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.date({});
|
||||
const b: any = 2;
|
||||
if (is.date(b)) {
|
||||
b.getMonth() + b.getDate();
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.error({}); }
|
||||
{
|
||||
const a: boolean = is.map({});
|
||||
const b: any = 2;
|
||||
if (is.map(b)) {
|
||||
b.has("asd");
|
||||
b.set(1, 2);
|
||||
b.set("1", 2);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.regexp({});
|
||||
const b: any = 2;
|
||||
if (is.regexp(b)) {
|
||||
b.test("hello");
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.set({});
|
||||
const b: any = 2;
|
||||
if (is.set(b)) {
|
||||
b.add("h");
|
||||
b.has(1);
|
||||
}
|
||||
}
|
||||
{ const a: boolean = is.symbol({}); }
|
||||
{ const a: boolean = is.vaultValuable({}); }
|
||||
{ const a: boolean = is.task({}); }
|
||||
{
|
||||
const a: boolean = is.fqdn(1);
|
||||
const b: any = 2;
|
||||
if (is.fqdn(b)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
if (is.fqdn(b, {})) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
is.fqdn(1, {
|
||||
allowTrailingDot: false
|
||||
});
|
||||
is.fqdn(1, {
|
||||
allowUnderscores: false
|
||||
});
|
||||
is.fqdn(1, {
|
||||
requireTld: true
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: boolean = is.email(1);
|
||||
const b: any = 2;
|
||||
if (is.email(b)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
if (is.email(b, {})) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
is.email(1, {
|
||||
allowDisplayName: false
|
||||
});
|
||||
is.email(1, {
|
||||
allowUtf8LocalPart: false
|
||||
});
|
||||
is.email(1, {
|
||||
requireDisplayName: false
|
||||
});
|
||||
is.email(1, {
|
||||
requireTld: false
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2);
|
||||
const b: any = 2;
|
||||
if (is.uuid(b)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, "all");
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, "all")) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, "all");
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, "all")) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, 1);
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, 1)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, 2);
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, 2)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, 3);
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, 2)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, 4);
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, 2)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
{
|
||||
const a: boolean = is.uuid(2, 5);
|
||||
const b: any = 2;
|
||||
if (is.uuid(b, 2)) {
|
||||
b.charCodeAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,4 +106,34 @@ namespace promiseTests {
|
||||
namespace _finally {
|
||||
promise.finally(Promise.resolve(2), () => 2).then((x: number) => {});
|
||||
}
|
||||
|
||||
namespace props {
|
||||
promise.props({ a: Promise.resolve(2) }).then((x) => x.a);
|
||||
}
|
||||
|
||||
namespace retry {
|
||||
promise.retry((info) => {
|
||||
{ const a: number = info.current; }
|
||||
});
|
||||
|
||||
promise.retry(() => {}, {});
|
||||
promise.retry(() => {}, { backOffBase: 1000 });
|
||||
promise.retry(() => {}, { backOffExponent: 2 });
|
||||
promise.retry(() => {}, { match: "a" });
|
||||
promise.retry(() => {}, { match: ["a"] });
|
||||
promise.retry(() => {}, { match: [/abc/] });
|
||||
promise.retry(() => {}, { match: /abc/ });
|
||||
promise.retry(() => {}, { match: [new Error()] });
|
||||
promise.retry(() => {}, { match: new Error() });
|
||||
promise.retry(() => {}, { max: 100 });
|
||||
promise.retry(() => {}, { name: "asd" });
|
||||
promise.retry(() => {}, {
|
||||
report(msg: string, opts) {
|
||||
opts.backOffBase < 100;
|
||||
}
|
||||
});
|
||||
promise.retry(() => {}, {
|
||||
timeout: 100
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,82 +2,82 @@ namespace streamsTests {
|
||||
const { stream } = adone;
|
||||
|
||||
namespace CoreStreamTests {
|
||||
const { CoreStream } = stream;
|
||||
const { core: { Stream } } = stream;
|
||||
|
||||
new CoreStream();
|
||||
new CoreStream(undefined);
|
||||
new CoreStream(undefined, {});
|
||||
new CoreStream(undefined, { async: true });
|
||||
new CoreStream(undefined, { sync: true });
|
||||
new CoreStream(undefined, {
|
||||
new Stream();
|
||||
new Stream(undefined);
|
||||
new Stream(undefined, {});
|
||||
new Stream(undefined, { async: true });
|
||||
new Stream(undefined, { sync: true });
|
||||
new Stream(undefined, {
|
||||
transform(x) {
|
||||
this.push(x);
|
||||
}
|
||||
});
|
||||
new CoreStream(undefined, {
|
||||
new Stream(undefined, {
|
||||
flush() {
|
||||
this.push(1);
|
||||
}
|
||||
});
|
||||
|
||||
new CoreStream([]);
|
||||
new CoreStream(new CoreStream([]));
|
||||
new Stream([]);
|
||||
new Stream(new Stream([]));
|
||||
|
||||
{ const a: boolean = new CoreStream().write(1); }
|
||||
{ const a: boolean = new CoreStream().push(1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().end(); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().destroy(); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().pause(); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().resume(); }
|
||||
{ const a: boolean = new CoreStream().isPaused(); }
|
||||
{ const a: boolean = new CoreStream().isEnded(); }
|
||||
{ const a: nodestd.stream.Transform = new CoreStream().pipe(new adone.std.stream.Transform()); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughSync(function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughSync(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughAsync(function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughAsync(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().through(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<number, string> = new CoreStream<number, number>([1, 2, 3]).map((x) => `${x}`); }
|
||||
{ const a: adone.stream.CoreStream<any, number | string> = new CoreStream<string, string>().mapIf((x) => x === "1", () => 1); }
|
||||
{ const a: adone.stream.CoreStream<any, number | string> = new CoreStream<number, string>().mapIf(async (x) => x === "1", () => 1); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().filter((x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().filter(async (x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1, {}); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1, { passthrough: true }); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1, { wait: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().done(() => {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().done(() => {}, {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().done(() => {}, { passthrough: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().toArray((x: any[]) => {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().toArray((x: any[]) => {}, {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().toArray((x: any[]) => {}, { passthrough: true }); }
|
||||
{ const a: adone.stream.CoreStream<number, string> = new CoreStream<number, string>().unique(); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().unique((x) => x + 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().stash((x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().stash("hello", (x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<number, string> = new CoreStream().unstash("hello"); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().unstash(); }
|
||||
{ const a: adone.stream.CoreStream<any, string> = new CoreStream().flatten(); }
|
||||
{ const a: Promise<any[]> = new CoreStream().then(); }
|
||||
{ const a: Promise<string> = new CoreStream().then(() => "1"); }
|
||||
{ const a: Promise<number> = new CoreStream().then(() => 1, () => 2); }
|
||||
{ const a: Promise<any[]> = new CoreStream().catch(); }
|
||||
{ const a: Promise<number[] | number> = new CoreStream<number, number>().catch(() => 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new CoreStream()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Readable()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Transform()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Transform()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Duplex()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { end: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: {} }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { async: true } }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { sync: false } }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { transform(x) { this.push(x); } } }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { flush() { this.push(1); } } }); }
|
||||
{ const a: boolean = new Stream().write(1); }
|
||||
{ const a: boolean = new Stream().push(1); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().end(); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().destroy(); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().pause(); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().resume(); }
|
||||
{ const a: boolean = new Stream().isPaused(); }
|
||||
{ const a: boolean = new Stream().isEnded(); }
|
||||
{ const a: nodestd.stream.Transform = new Stream().pipe(new adone.std.stream.Transform()); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = new Stream().throughSync(function () { this.push(1); }); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = new Stream().throughSync(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = new Stream().throughAsync(function () { this.push(1); }); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = new Stream().throughAsync(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = new Stream().through(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.core.Stream<number, string> = new Stream<number, number>([1, 2, 3]).map((x) => `${x}`); }
|
||||
{ const a: adone.stream.core.Stream<any, number | string> = new Stream<string, string>().mapIf((x) => x === "1", () => 1); }
|
||||
{ const a: adone.stream.core.Stream<any, number | string> = new Stream<number, string>().mapIf(async (x) => x === "1", () => 1); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = new Stream<number, number>().filter((x) => x === 1); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().filter(async (x) => x === 1); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = new Stream<number, number>().forEach(async (x) => x === 1); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = new Stream<number, number>().forEach(async (x) => x === 1, {}); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = new Stream<number, number>().forEach(async (x) => x === 1, { passthrough: true }); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = new Stream<number, number>().forEach(async (x) => x === 1, { wait: true }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().done(() => {}); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().done(() => {}, {}); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().done(() => {}, { passthrough: true }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().toArray((x: any[]) => {}); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().toArray((x: any[]) => {}, {}); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().toArray((x: any[]) => {}, { passthrough: true }); }
|
||||
{ const a: adone.stream.core.Stream<number, string> = new Stream<number, string>().unique(); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = new Stream<number, number>().unique((x) => x + 1); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().stash((x) => x === 1); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().stash("hello", (x) => x === 1); }
|
||||
{ const a: adone.stream.core.Stream<number, string> = new Stream().unstash("hello"); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = new Stream().unstash(); }
|
||||
{ const a: adone.stream.core.Stream<any, string> = new Stream().flatten(); }
|
||||
{ const a: Promise<any[]> = new Stream().then(); }
|
||||
{ const a: Promise<string> = new Stream().then(() => "1"); }
|
||||
{ const a: Promise<number> = new Stream().then(() => 1, () => 2); }
|
||||
{ const a: Promise<any[]> = new Stream().catch(); }
|
||||
{ const a: Promise<number[] | number> = new Stream<number, number>().catch(() => 1); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([new Stream()]); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([new adone.std.stream.Readable()]); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([new adone.std.stream.Transform()]); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([new adone.std.stream.Transform()]); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([new adone.std.stream.Duplex()]); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], {}); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], { end: true }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], { sourceOptions: {} }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], { sourceOptions: { async: true } }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], { sourceOptions: { sync: false } }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], { sourceOptions: { transform(x) { this.push(x); } } }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = Stream.merge([], { sourceOptions: { flush() { this.push(1); } } }); }
|
||||
(async () => {
|
||||
const res = await new CoreStream([1, 2, 3, 4, 5])
|
||||
const res = await new Stream([1, 2, 3, 4, 5])
|
||||
.map((x: number) => `${x}`)
|
||||
.mapIf((x: string) => x[0] === "1", (x) => x.slice(1))
|
||||
.map((x) => [x, x, x])
|
||||
@@ -91,13 +91,13 @@ namespace streamsTests {
|
||||
}
|
||||
|
||||
namespace coreTests {
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = stream.core([1, 2, 3]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(stream.core([])); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(undefined, {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(undefined, { async: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(undefined, { sync: false }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = stream.core<string, number>(undefined, { transform(x) { this.push(Number(x)); } }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = stream.core(undefined, { flush() { this.push(1); } }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = stream.core.create(); }
|
||||
{ const a: adone.stream.core.Stream<number, number> = stream.core.create([1, 2, 3]); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = stream.core.create(stream.core.create([])); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = stream.core.create(undefined, {}); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = stream.core.create(undefined, { async: true }); }
|
||||
{ const a: adone.stream.core.Stream<any, any> = stream.core.create(undefined, { sync: false }); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = stream.core.create<string, number>(undefined, { transform(x) { this.push(Number(x)); } }); }
|
||||
{ const a: adone.stream.core.Stream<any, number> = stream.core.create(undefined, { flush() { this.push(1); } }); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,6 @@ namespace utilTests {
|
||||
const b: string = util.functionName((a, b, c) => { });
|
||||
}
|
||||
|
||||
namespace mapArguments {
|
||||
const a: (...args: any[]) => any = util.mapArguments(() => { });
|
||||
const b: <T>(...args: T[]) => T[] = util.mapArguments(1);
|
||||
const c: (...args: any[]) => any = util.mapArguments([1]);
|
||||
const d: <T>(x: T) => T = util.mapArguments();
|
||||
}
|
||||
|
||||
namespace parseMs {
|
||||
const result: {
|
||||
days: number;
|
||||
@@ -56,10 +49,6 @@ namespace utilTests {
|
||||
const c: string = util.pluralizeWord("day", "days", 1);
|
||||
}
|
||||
|
||||
namespace functionParams {
|
||||
const a: string[] = util.functionParams((a: any, b: any, c: any) => { });
|
||||
}
|
||||
|
||||
namespace randomChoice {
|
||||
const a: number = util.randomChoice([1, 2, 3]);
|
||||
const b: string = util.randomChoice(["1", "2", "3"]);
|
||||
@@ -174,19 +163,10 @@ namespace utilTests {
|
||||
const a: string = util.globParent("a/b/c/**");
|
||||
}
|
||||
|
||||
namespace by {
|
||||
const a: (a: number, b: number) => any = util.by((x: number): number => x);
|
||||
const b: (a: number, b: number) => number = util.by((x: number): string => `${x}`, (a: string, b: string) => a.length - b.length);
|
||||
}
|
||||
|
||||
namespace toFastProperties {
|
||||
const a: object = util.toFastProperties({});
|
||||
}
|
||||
|
||||
namespace stripBom {
|
||||
const a: string = util.stripBom("123");
|
||||
}
|
||||
|
||||
namespace sortKeys {
|
||||
const a: object = util.sortKeys({});
|
||||
const b: object = util.sortKeys({}, {});
|
||||
@@ -234,16 +214,27 @@ namespace utilTests {
|
||||
const b: number | null = util.parseSize("123Kb");
|
||||
}
|
||||
|
||||
namespace Cloner {
|
||||
const a = new util.Cloner();
|
||||
a.clone({});
|
||||
a.clone({}, {});
|
||||
a.clone({}, { deep: true });
|
||||
a.clone({}, { nonPlainObjects: false });
|
||||
a.clone({}, { onlyEnumerable: true });
|
||||
const c = a.binding();
|
||||
c({});
|
||||
c({}, {});
|
||||
c({}, { deep: true });
|
||||
c({}, { onlyEnumerable: false });
|
||||
c({}, { nonPlainObjects: true });
|
||||
}
|
||||
|
||||
namespace clone {
|
||||
const a: object = util.clone({});
|
||||
const b: object = util.clone({}, {});
|
||||
const c: object = util.clone({}, { deep: true });
|
||||
}
|
||||
|
||||
namespace toUTF8Array {
|
||||
const a: number[] = util.toUTF8Array("hello");
|
||||
}
|
||||
|
||||
namespace asyncIter {
|
||||
util.asyncIter([1, 2, 3], () => { }, () => { });
|
||||
}
|
||||
@@ -298,28 +289,34 @@ namespace utilTests {
|
||||
const a: object = util.assignDeep({ a: 1 }, { a: 2 });
|
||||
}
|
||||
|
||||
namespace match {
|
||||
const a: number | boolean = util.match(["a", "b", "c"], "a");
|
||||
const b: (a: any, b: any) => number | boolean = util.match("a", { index: true });
|
||||
const c: number | boolean = util.match(["a", "b", "c"], "a", { dot: true });
|
||||
const d: (a: any, b: any) => number | boolean = util.match("a", { end: 2 });
|
||||
const e: (a: any, b: any) => number | boolean = util.match("a", { start: 2 });
|
||||
const f: (a: any, b: any) => number | boolean = util.match("a");
|
||||
namespace matchPath {
|
||||
const a: number | boolean = util.matchPath(["a", "b", "c"], "a");
|
||||
const b: (a: any, b: any) => number | boolean = util.matchPath("a", { index: true });
|
||||
const c: number | boolean = util.matchPath(["a", "b", "c"], "a", { dot: true });
|
||||
const d: (a: any, b: any) => number | boolean = util.matchPath("a", { end: 2 });
|
||||
const e: (a: any, b: any) => number | boolean = util.matchPath("a", { start: 2 });
|
||||
const f: (a: any, b: any) => number | boolean = util.matchPath("a");
|
||||
}
|
||||
|
||||
namespace toposort {
|
||||
const a: number[] = util.toposort([
|
||||
[0, 1],
|
||||
[2, 3],
|
||||
[4, 5],
|
||||
[6, 7]
|
||||
const a: string[] = util.toposort([
|
||||
["0", "1"],
|
||||
["2", "3"],
|
||||
["4", "5"],
|
||||
["6", "7"]
|
||||
]);
|
||||
const b: number[] = util.toposort.array([0, 1, 2], [
|
||||
[0, 1],
|
||||
[2, 3],
|
||||
[4, 5],
|
||||
[6, 7]
|
||||
const b: string[] = util.toposort.array(["0", "1", "2"], [
|
||||
["0", "1"],
|
||||
["2", "3"],
|
||||
["4", "5"],
|
||||
["6", "7"]
|
||||
]);
|
||||
const sorter = new util.toposort.Sorter();
|
||||
sorter.add("a", "b");
|
||||
sorter.add("a", ["c"]);
|
||||
const c: string[] = sorter.sort();
|
||||
sorter.clear();
|
||||
sorter.edges[0][0].charCodeAt(100);
|
||||
}
|
||||
|
||||
namespace jsesc {
|
||||
@@ -394,73 +391,6 @@ namespace utilTests {
|
||||
a.getter("a").access("b").method("c").setter("d");
|
||||
}
|
||||
|
||||
namespace GlobExp {
|
||||
{
|
||||
const glob = new util.GlobExp("*.js");
|
||||
const a: boolean = glob.hasMagic();
|
||||
const b: string[] = glob.expandBraces();
|
||||
const c: RegExp = glob.makeRe();
|
||||
const d: boolean = glob.test("a.js");
|
||||
}
|
||||
{
|
||||
const a: boolean = util.GlobExp.hasMagic("*.js");
|
||||
const b: string[] = util.GlobExp.expandBraces("*.js");
|
||||
const c: RegExp = util.GlobExp.makeRe("*.js");
|
||||
const d: boolean = util.GlobExp.test("*.js", "a.js");
|
||||
}
|
||||
new util.GlobExp("");
|
||||
new util.GlobExp("", {});
|
||||
new util.GlobExp("", { dot: true });
|
||||
new util.GlobExp("", { flipNegate: true });
|
||||
new util.GlobExp("", { matchBase: true });
|
||||
new util.GlobExp("", { nobrace: true });
|
||||
new util.GlobExp("", { nocase: true });
|
||||
new util.GlobExp("", { nocomment: true });
|
||||
new util.GlobExp("", { noext: true });
|
||||
new util.GlobExp("", { noglobstar: true });
|
||||
new util.GlobExp("", { nonegate: true });
|
||||
util.GlobExp.hasMagic("", {});
|
||||
util.GlobExp.hasMagic("", { dot: true });
|
||||
util.GlobExp.hasMagic("", { flipNegate: true });
|
||||
util.GlobExp.hasMagic("", { matchBase: true });
|
||||
util.GlobExp.hasMagic("", { nobrace: true });
|
||||
util.GlobExp.hasMagic("", { nocase: true });
|
||||
util.GlobExp.hasMagic("", { nocomment: true });
|
||||
util.GlobExp.hasMagic("", { noext: true });
|
||||
util.GlobExp.hasMagic("", { noglobstar: true });
|
||||
util.GlobExp.hasMagic("", { nonegate: true });
|
||||
util.GlobExp.expandBraces("", {});
|
||||
util.GlobExp.expandBraces("", { dot: true });
|
||||
util.GlobExp.expandBraces("", { flipNegate: true });
|
||||
util.GlobExp.expandBraces("", { matchBase: true });
|
||||
util.GlobExp.expandBraces("", { nobrace: true });
|
||||
util.GlobExp.expandBraces("", { nocase: true });
|
||||
util.GlobExp.expandBraces("", { nocomment: true });
|
||||
util.GlobExp.expandBraces("", { noext: true });
|
||||
util.GlobExp.expandBraces("", { noglobstar: true });
|
||||
util.GlobExp.expandBraces("", { nonegate: true });
|
||||
util.GlobExp.makeRe("", {});
|
||||
util.GlobExp.makeRe("", { dot: true });
|
||||
util.GlobExp.makeRe("", { flipNegate: true });
|
||||
util.GlobExp.makeRe("", { matchBase: true });
|
||||
util.GlobExp.makeRe("", { nobrace: true });
|
||||
util.GlobExp.makeRe("", { nocase: true });
|
||||
util.GlobExp.makeRe("", { nocomment: true });
|
||||
util.GlobExp.makeRe("", { noext: true });
|
||||
util.GlobExp.makeRe("", { noglobstar: true });
|
||||
util.GlobExp.makeRe("", { nonegate: true });
|
||||
util.GlobExp.test("a", "b", {});
|
||||
util.GlobExp.test("a", "b", { dot: true });
|
||||
util.GlobExp.test("a", "b", { flipNegate: true });
|
||||
util.GlobExp.test("a", "b", { matchBase: true });
|
||||
util.GlobExp.test("a", "b", { nobrace: true });
|
||||
util.GlobExp.test("a", "b", { nocase: true });
|
||||
util.GlobExp.test("a", "b", { nocomment: true });
|
||||
util.GlobExp.test("a", "b", { noext: true });
|
||||
util.GlobExp.test("a", "b", { noglobstar: true });
|
||||
util.GlobExp.test("a", "b", { nonegate: true });
|
||||
}
|
||||
|
||||
namespace iconv {
|
||||
// TODO
|
||||
}
|
||||
@@ -477,19 +407,6 @@ namespace utilTests {
|
||||
const b: string = util.sqlstring.dateToString(123, "local");
|
||||
}
|
||||
|
||||
namespace arrayToList {
|
||||
const a: string = util.sqlstring.arrayToList(["1", "a"]);
|
||||
}
|
||||
|
||||
namespace bufferToString {
|
||||
const a: string = util.sqlstring.bufferToString(Buffer.alloc(10));
|
||||
}
|
||||
|
||||
namespace objectToValues {
|
||||
const a: string = util.sqlstring.objectToValues({ a: 1 });
|
||||
const b: string = util.sqlstring.objectToValues({ a: 1 }, "local");
|
||||
}
|
||||
|
||||
namespace escape {
|
||||
const a: string = util.sqlstring.escape(1);
|
||||
const b: string = util.sqlstring.escape(1, true);
|
||||
@@ -532,44 +449,55 @@ namespace utilTests {
|
||||
}
|
||||
|
||||
namespace buffer {
|
||||
const a: Buffer = util.buffer.concat([Buffer.alloc(10), Buffer.alloc(20)], 30);
|
||||
util.buffer.mask(Buffer.alloc(10), Buffer.alloc(10), Buffer.alloc(10), 0, 10);
|
||||
util.buffer.unmask(Buffer.alloc(10), Buffer.alloc(10));
|
||||
namespace toArrayBuffer {
|
||||
const a = util.buffer.toArrayBuffer(Buffer.from("hello"));
|
||||
a.slice(10);
|
||||
}
|
||||
|
||||
namespace xor {
|
||||
const a = util.buffer.xor(Buffer.from("hello"), Buffer.from("world"));
|
||||
a.writeUInt32LE(20, 1);
|
||||
}
|
||||
}
|
||||
|
||||
namespace shebang {
|
||||
const a: string | null = util.shebang("#!/bin/sh");
|
||||
}
|
||||
|
||||
namespace ReInterval {
|
||||
new util.ReInterval(() => { }, 1000);
|
||||
new util.ReInterval(() => { }, 1000, [1]);
|
||||
const a = new util.ReInterval(() => { }, 1000);
|
||||
namespace reinterval {
|
||||
util.reinterval(() => { }, 1000);
|
||||
util.reinterval(() => { }, 1000, [1]);
|
||||
const a = util.reinterval(() => { }, 1000);
|
||||
a.reschedule(400);
|
||||
a.clear();
|
||||
a.destroy();
|
||||
}
|
||||
|
||||
namespace RateLimiter {
|
||||
new util.RateLimiter();
|
||||
new util.RateLimiter(1);
|
||||
new util.RateLimiter(1, 1000);
|
||||
new util.RateLimiter(1, 1000, true);
|
||||
const a = new util.RateLimiter();
|
||||
a.removeTokens(1).then((x: number) => { });
|
||||
const b: boolean = a.tryRemoveTokens(10);
|
||||
const c: number = a.getTokensRemaining();
|
||||
}
|
||||
|
||||
namespace throttle {
|
||||
const a: () => Promise<number> = util.throttle(() => 42);
|
||||
const b: (a: number) => Promise<string> = util.throttle((a: number) => `${a}`);
|
||||
const c: (a: number, b: string) => Promise<string> = util.throttle((a: number, b: string) => String(a) + b);
|
||||
const d = util.throttle(() => { }, {});
|
||||
const e = util.throttle(() => { }, { interval: 1000 });
|
||||
const f = util.throttle(() => { }, { max: 10 });
|
||||
const g = util.throttle(() => { }, { ordered: true });
|
||||
const h = util.throttle(() => { }, { waitForReturn: true });
|
||||
namespace RateLimiter {
|
||||
new util.throttle.RateLimiter();
|
||||
new util.throttle.RateLimiter(1);
|
||||
new util.throttle.RateLimiter(1, 1000);
|
||||
new util.throttle.RateLimiter(1, 1000, true);
|
||||
const a = new util.throttle.RateLimiter();
|
||||
a.removeTokens(1).then((x: number) => { });
|
||||
const b: boolean = a.tryRemoveTokens(10);
|
||||
const c: number = a.getTokensRemaining();
|
||||
}
|
||||
|
||||
const a: () => Promise<number> = util.throttle.create(() => 42);
|
||||
const b: (a: number) => Promise<string> = util.throttle.create((a: number) => `${a}`);
|
||||
const c: (a: number, b: string) => Promise<string> = util.throttle.create((a: number, b: string) => String(a) + b);
|
||||
const d = util.throttle.create(() => { }, {});
|
||||
const e = util.throttle.create(() => { }, { interval: 1000 });
|
||||
const f = util.throttle.create(() => { }, { max: 10 });
|
||||
const g = util.throttle.create(() => { }, { ordered: true });
|
||||
const h = util.throttle.create(() => { }, { waitForReturn: true });
|
||||
const i = util.throttle.create(() => { }, { onDone() {} });
|
||||
const j = util.throttle.create(() => { }, { drop: true });
|
||||
const k = util.throttle.create(() => { }, { dropLast: true });
|
||||
|
||||
const l: symbol = util.throttle.DROPPED;
|
||||
}
|
||||
|
||||
namespace fakeClock {
|
||||
@@ -741,17 +669,6 @@ namespace utilTests {
|
||||
}
|
||||
}
|
||||
|
||||
namespace userid {
|
||||
const { userid } = util;
|
||||
|
||||
{ const a: number = userid.uid("someone").gid; }
|
||||
{ const a: number = userid.uid("someone").uid; }
|
||||
{ const a: number = userid.gid("someone"); }
|
||||
{ const a: string = userid.username(1000); }
|
||||
{ const a: string = userid.groupname(1000); }
|
||||
{ const gids: number[] = userid.gids("someone"); }
|
||||
}
|
||||
|
||||
namespace LogRotator {
|
||||
const { LogRotator } = util;
|
||||
new LogRotator("file.log");
|
||||
@@ -766,4 +683,679 @@ namespace utilTests {
|
||||
new LogRotator("file.log").start();
|
||||
new LogRotator("file.log").stop();
|
||||
}
|
||||
|
||||
namespace arrayDiff {
|
||||
const { arrayDiff } = util;
|
||||
|
||||
arrayDiff([1, 2, 3], [4, 5, 6])[0].toFixed();
|
||||
arrayDiff(["1"])[0].charCodeAt(100);
|
||||
}
|
||||
|
||||
namespace fillRange {
|
||||
const { fillRange } = util;
|
||||
|
||||
{ const a: number[] = fillRange(1, 2); }
|
||||
{ const a: string[] = fillRange(1, 2, { stringify: true }); }
|
||||
{ const a: string = fillRange(1, 2, { toRegex: true }); }
|
||||
{ const a: string[] = fillRange("1", "2"); }
|
||||
{ const a: string = fillRange("1", "2", { toRegex: true }); }
|
||||
}
|
||||
|
||||
namespace inflection {
|
||||
const { inflection } = util;
|
||||
|
||||
{ const a: string = inflection.singularizeWord("hello"); }
|
||||
{ const a: string = inflection.singularizeWord("hello", "aaaa"); }
|
||||
{ const a: string = inflection.pluralizeWord("hello"); }
|
||||
{ const a: string = inflection.pluralizeWord("hello", "aaaa"); }
|
||||
{ const a: string = inflection.underscore("hello"); }
|
||||
}
|
||||
|
||||
namespace machineId {
|
||||
const { machineId } = util;
|
||||
|
||||
(async () => {
|
||||
const a: string = await machineId();
|
||||
});
|
||||
}
|
||||
|
||||
namespace merge {
|
||||
const { merge } = util;
|
||||
|
||||
merge({}, {});
|
||||
merge({}, {}, { allowPrototypes: true });
|
||||
merge({}, {}, { plainObjects: false });
|
||||
}
|
||||
|
||||
namespace omit {
|
||||
const { omit } = util;
|
||||
|
||||
omit({}, ["a"]);
|
||||
omit({}, "a");
|
||||
omit({}, (x) => x === "a");
|
||||
}
|
||||
|
||||
namespace parseTime {
|
||||
const { parseTime } = util;
|
||||
|
||||
{ const a: number = parseTime(123); }
|
||||
{ const a: number | null = parseTime("12"); }
|
||||
}
|
||||
|
||||
namespace pick {
|
||||
const { pick } = util;
|
||||
|
||||
pick({}, ["a", "b", "c"]);
|
||||
pick({}, new Set(["a", "b", "c"]));
|
||||
}
|
||||
|
||||
namespace querystring {
|
||||
const { querystring: qs } = util;
|
||||
|
||||
{ const a: string = qs.escape("asd"); }
|
||||
{ const a: string = qs.formats.default; }
|
||||
{ const a: string = qs.formats.RFC1738; }
|
||||
{ const a: string = qs.formats.RFC3986; }
|
||||
{ const a: string = qs.formats.formatters.RFC1738("ha"); }
|
||||
{ const a: string = qs.formats.formatters.RFC3986("ha"); }
|
||||
{ const a: object = qs.parse("asdasd"); }
|
||||
{ const a: object = qs.parse("asdasd", {}); }
|
||||
{ const a: object = qs.parse("asdasd", { allowDots: false }); }
|
||||
{ const a: object = qs.parse("asdasd", { allowPrototypes: false }); }
|
||||
{ const a: object = qs.parse("asdasd", { arrayLimit: 100 }); }
|
||||
{ const a: object = qs.parse("asdasd", { decoder: (s) => s }); }
|
||||
{ const a: object = qs.parse("asdasd", { decoder: (s, d) => d(s) }); }
|
||||
{ const a: object = qs.parse("asdasd", { delimiter: "a" }); }
|
||||
{ const a: object = qs.parse("asdasd", { depth: 100 }); }
|
||||
{ const a: object = qs.parse("asdasd", { ignoreQueryPrefix: false }); }
|
||||
{ const a: object = qs.parse("asdasd", { parameterLimit: 100 }); }
|
||||
{ const a: object = qs.parse("asdasd", { parseArrays: false }); }
|
||||
{ const a: object = qs.parse("asdasd", { plainObjects: true }); }
|
||||
{ const a: object = qs.parse("asdasd", { strictNullHandling: false }); }
|
||||
{ const a: string = qs.stringify({}); }
|
||||
{ const a: string = qs.stringify({}, {}); }
|
||||
{ const a: string = qs.stringify({}, { addQueryPrefix: false }); }
|
||||
{ const a: string = qs.stringify({}, { allowDots: false }); }
|
||||
{ const a: string = qs.stringify({}, { arrayFormat: "indices" }); }
|
||||
{ const a: string = qs.stringify({}, { arrayFormat: "brackets" }); }
|
||||
{ const a: string = qs.stringify({}, { arrayFormat: "repeat" }); }
|
||||
{ const a: string = qs.stringify({}, { delimiter: "1" }); }
|
||||
{ const a: string = qs.stringify({}, { encode: true }); }
|
||||
{ const a: string = qs.stringify({}, { encoder: (s) => s }); }
|
||||
{ const a: string = qs.stringify({}, { encodeValuesOnly: false }); }
|
||||
{ const a: string = qs.stringify({}, { filter: [1, 2, 3] }); }
|
||||
{ const a: string = qs.stringify({}, { filter: ["1", "2", "3"] }); }
|
||||
{ const a: string = qs.stringify({}, { filter: (prefix: string, value: any) => value === 1 }); }
|
||||
{ const a: string = qs.stringify({}, { indices: false }); }
|
||||
{ const a: string = qs.stringify({}, { serializeDate(d) { return String(d.getTime()); } }); }
|
||||
{ const a: string = qs.stringify({}, { skipNulls: false }); }
|
||||
{ const a: string = qs.stringify({}, { sort(a, b) { return a - b; } }); }
|
||||
{ const a: string = qs.stringify({}, { strictNullHandling: false }); }
|
||||
}
|
||||
|
||||
namespace regexNot {
|
||||
const { regexNot } = util;
|
||||
|
||||
{ const a: RegExp = regexNot("a"); }
|
||||
{ const a: RegExp = regexNot("a", {}); }
|
||||
{ const a: RegExp = regexNot("a", { contains: false }); }
|
||||
}
|
||||
|
||||
namespace repeat {
|
||||
const { repeat } = util;
|
||||
{ const a: number[] = repeat(1, 10); }
|
||||
{ const a: string[] = repeat("a", 10); }
|
||||
{ const a: number[][] = repeat([2], 10); }
|
||||
}
|
||||
|
||||
namespace signalNameToCode {
|
||||
const { signalNameToCode } = util;
|
||||
signalNameToCode("SIGINT").toFixed(2);
|
||||
}
|
||||
|
||||
namespace splitBuffer {
|
||||
const { splitBuffer } = util;
|
||||
|
||||
{ const a: Buffer[] = splitBuffer(Buffer.from("asd"), Buffer.from("|")); }
|
||||
{ const a: Buffer[] = splitBuffer(Buffer.from("asd"), Buffer.from("|"), true); }
|
||||
{ const a: Buffer[] = splitBuffer("asd", Buffer.from("|"), true); }
|
||||
{ const a: Buffer[] = splitBuffer("asd", "|"); }
|
||||
}
|
||||
|
||||
namespace splitString {
|
||||
const { splitString } = util;
|
||||
|
||||
splitString("a");
|
||||
splitString("a", {});
|
||||
splitString("a", { braces: false });
|
||||
splitString("a", { keepDoubleQuotes: false });
|
||||
splitString("a", { keepEscaping: false });
|
||||
splitString("a", { keepQuotes: false });
|
||||
splitString("a", { keepSingleQuotes: false });
|
||||
splitString("a", { separator: "|" });
|
||||
splitString("a", {
|
||||
split(token) {
|
||||
{ const a: string[] = token.arr; }
|
||||
{ const a: number = token.idx; }
|
||||
{ const a: string = token.str; }
|
||||
{ const a: string = token.val; }
|
||||
}
|
||||
});
|
||||
splitString("a", (token) => {
|
||||
{ const a: string[] = token.arr; }
|
||||
{ const a: number = token.idx; }
|
||||
{ const a: string = token.str; }
|
||||
{ const a: string = token.val; }
|
||||
});
|
||||
splitString("a", {}, (token) => {
|
||||
{ const a: string[] = token.arr; }
|
||||
{ const a: number = token.idx; }
|
||||
{ const a: string = token.str; }
|
||||
{ const a: string = token.val; }
|
||||
});
|
||||
}
|
||||
|
||||
namespace toRegex {
|
||||
const { toRegex } = util;
|
||||
|
||||
{ const a: RegExp = toRegex("a"); }
|
||||
{ const a: RegExp = toRegex(["a"]); }
|
||||
{ const a: RegExp = toRegex(["a"], {}); }
|
||||
{ const a: RegExp = toRegex(["a"], { cache: false }); }
|
||||
{ const a: RegExp = toRegex(["a"], { contains: false }); }
|
||||
{ const a: RegExp = toRegex(["a"], { flags: "i" }); }
|
||||
{ const a: RegExp = toRegex(["a"], { negate: false }); }
|
||||
{ const a: RegExp = toRegex(["a"], { nocase: false }); }
|
||||
}
|
||||
|
||||
namespace toRegexRange {
|
||||
const { toRegexRange } = util;
|
||||
|
||||
{ const a: RegExp = toRegexRange(1, 10); }
|
||||
{ const a: RegExp = toRegexRange("1", "10"); }
|
||||
{ const a: RegExp = toRegexRange(1, 10, {}); }
|
||||
{ const a: RegExp = toRegexRange(1, 10, { capture: false }); }
|
||||
{ const a: RegExp = toRegexRange(1, 10, { relaxZeros: true }); }
|
||||
{ const a: RegExp = toRegexRange(1, 10, { shorthand: false }); }
|
||||
}
|
||||
|
||||
namespace xorDistance {
|
||||
const { compare, create, eq, gt, lt } = util.xorDistance;
|
||||
|
||||
{ const a: boolean = compare(Buffer.from("1"), Buffer.from("2")); }
|
||||
{ const a: Buffer = create(Buffer.from("1"), Buffer.from("2")); }
|
||||
{ const a: boolean = gt(Buffer.from("1"), Buffer.from("2")); }
|
||||
{ const a: boolean = lt(Buffer.from("1"), Buffer.from("2")); }
|
||||
{ const a: boolean = eq(Buffer.from("1"), Buffer.from("2")); }
|
||||
}
|
||||
|
||||
namespace braces {
|
||||
const { braces } = util;
|
||||
|
||||
{ const a: string[] = braces("a"); }
|
||||
{ const a: string[] = braces("a", {}); }
|
||||
{ const a: string[] = braces("a", { expand: false }); }
|
||||
{ const a: string[] = braces("a", { nodupes: false }); }
|
||||
{ const a: string[] = braces("a", { optimize: true }); }
|
||||
{ const a: string[] = braces("a", { quantifiers: false }); }
|
||||
{ const a: string[] = braces("a", { rangeLimit: 100 }); }
|
||||
{ const a: string[] = braces("a", { transform: (s: string) => s }); }
|
||||
{ const a: string[] = braces("a", { unescape: false }); }
|
||||
|
||||
{ const a: string[] = braces.expand("a"); }
|
||||
{ const a: string[] = braces.expand("a", {}); }
|
||||
{ const a: string[] = braces.expand("a", { expand: false }); }
|
||||
{ const a: string[] = braces.expand("a", { nodupes: false }); }
|
||||
{ const a: string[] = braces.expand("a", { optimize: true }); }
|
||||
{ const a: string[] = braces.expand("a", { quantifiers: false }); }
|
||||
{ const a: string[] = braces.expand("a", { rangeLimit: 100 }); }
|
||||
{ const a: string[] = braces.expand("a", { transform: (s: string) => s }); }
|
||||
{ const a: string[] = braces.expand("a", { unescape: false }); }
|
||||
|
||||
{ const a: RegExp = braces.makeRe("a"); }
|
||||
{ const a: RegExp = braces.makeRe("a", {}); }
|
||||
{ const a: RegExp = braces.makeRe("a", { expand: false }); }
|
||||
{ const a: RegExp = braces.makeRe("a", { nodupes: false }); }
|
||||
{ const a: RegExp = braces.makeRe("a", { optimize: true }); }
|
||||
{ const a: RegExp = braces.makeRe("a", { quantifiers: false }); }
|
||||
{ const a: RegExp = braces.makeRe("a", { rangeLimit: 100 }); }
|
||||
{ const a: RegExp = braces.makeRe("a", { transform: (s: string) => s }); }
|
||||
{ const a: RegExp = braces.makeRe("a", { unescape: false }); }
|
||||
|
||||
{ const a: number = braces.MAX_LENGTH; }
|
||||
{ const a: object = braces.getCache(); }
|
||||
braces.clearCache();
|
||||
braces.resizeCache(100500);
|
||||
}
|
||||
|
||||
namespace match {
|
||||
const { match } = util;
|
||||
|
||||
{ const a: string[] = match(["a"], "a"); }
|
||||
{ const a: string[] = match(["a"], ["a"]); }
|
||||
{ const a: string[] = match(["a"], ["a"], {}); }
|
||||
{ const a: string[] = match(["a"], ["a"], { basename: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { bash: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { cache: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { dot: true }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { failglob: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { ignore: "a" }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { ignore: ["a"] }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { matchBase: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { nobrace: true }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { nocase: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { nodupes: true }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { noext: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { noglobstar: true }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { nonegate: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { nonull: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { nullglob: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { snapdragon: {} }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { sourcemap: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { unescape: false }); }
|
||||
{ const a: string[] = match(["a"], ["a"], { unixify: false }); }
|
||||
|
||||
{ const a: string[] = match.match(["a"], "a"); }
|
||||
{ const a: string[] = match.match(["a"], "a", {}); }
|
||||
{ const a: string[] = match.match(["a"], "a", { basename: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { bash: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { cache: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { dot: true }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { failglob: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { ignore: "a" }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { ignore: ["a"] }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { matchBase: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { nobrace: true }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { nocase: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { nodupes: true }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { noext: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { noglobstar: true }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { nonegate: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { nonull: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { nullglob: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { snapdragon: {} }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { sourcemap: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { unescape: false }); }
|
||||
{ const a: string[] = match.match(["a"], "a", { unixify: false }); }
|
||||
|
||||
{ const a: boolean = match.isMatch("a", "a"); }
|
||||
{ const a: boolean = match.isMatch("a", "a", {}); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { basename: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { bash: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { cache: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { dot: true }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { failglob: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { ignore: "a" }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { ignore: ["a"] }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { matchBase: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { nobrace: true }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { nocase: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { nodupes: true }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { noext: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { noglobstar: true }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { nonegate: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { nonull: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { nullglob: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { snapdragon: {} }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { sourcemap: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { unescape: false }); }
|
||||
{ const a: boolean = match.isMatch("a", "a", { unixify: false }); }
|
||||
|
||||
{ const a: boolean = match.some(["a"], ["a"]); }
|
||||
{ const a: boolean = match.some("a", "a"); }
|
||||
{ const a: boolean = match.some("a", "a", {}); }
|
||||
{ const a: boolean = match.some("a", "a", { basename: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { bash: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { cache: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { dot: true }); }
|
||||
{ const a: boolean = match.some("a", "a", { failglob: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { ignore: "a" }); }
|
||||
{ const a: boolean = match.some("a", "a", { ignore: ["a"] }); }
|
||||
{ const a: boolean = match.some("a", "a", { matchBase: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { nobrace: true }); }
|
||||
{ const a: boolean = match.some("a", "a", { nocase: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { nodupes: true }); }
|
||||
{ const a: boolean = match.some("a", "a", { noext: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { noglobstar: true }); }
|
||||
{ const a: boolean = match.some("a", "a", { nonegate: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { nonull: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { nullglob: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { snapdragon: {} }); }
|
||||
{ const a: boolean = match.some("a", "a", { sourcemap: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { unescape: false }); }
|
||||
{ const a: boolean = match.some("a", "a", { unixify: false }); }
|
||||
|
||||
{ const a: boolean = match.every(["a"], ["a"]); }
|
||||
{ const a: boolean = match.every("a", "a"); }
|
||||
{ const a: boolean = match.every("a", "a", {}); }
|
||||
{ const a: boolean = match.every("a", "a", { basename: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { bash: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { cache: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { dot: true }); }
|
||||
{ const a: boolean = match.every("a", "a", { failglob: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { ignore: "a" }); }
|
||||
{ const a: boolean = match.every("a", "a", { ignore: ["a"] }); }
|
||||
{ const a: boolean = match.every("a", "a", { matchBase: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { nobrace: true }); }
|
||||
{ const a: boolean = match.every("a", "a", { nocase: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { nodupes: true }); }
|
||||
{ const a: boolean = match.every("a", "a", { noext: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { noglobstar: true }); }
|
||||
{ const a: boolean = match.every("a", "a", { nonegate: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { nonull: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { nullglob: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { snapdragon: {} }); }
|
||||
{ const a: boolean = match.every("a", "a", { sourcemap: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { unescape: false }); }
|
||||
{ const a: boolean = match.every("a", "a", { unixify: false }); }
|
||||
|
||||
{ const a: boolean = match.any(["a"], ["a"]); }
|
||||
{ const a: boolean = match.any("a", "a"); }
|
||||
{ const a: boolean = match.any("a", "a", {}); }
|
||||
{ const a: boolean = match.any("a", "a", { basename: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { bash: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { cache: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { dot: true }); }
|
||||
{ const a: boolean = match.any("a", "a", { failglob: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { ignore: "a" }); }
|
||||
{ const a: boolean = match.any("a", "a", { ignore: ["a"] }); }
|
||||
{ const a: boolean = match.any("a", "a", { matchBase: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { nobrace: true }); }
|
||||
{ const a: boolean = match.any("a", "a", { nocase: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { nodupes: true }); }
|
||||
{ const a: boolean = match.any("a", "a", { noext: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { noglobstar: true }); }
|
||||
{ const a: boolean = match.any("a", "a", { nonegate: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { nonull: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { nullglob: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { snapdragon: {} }); }
|
||||
{ const a: boolean = match.any("a", "a", { sourcemap: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { unescape: false }); }
|
||||
{ const a: boolean = match.any("a", "a", { unixify: false }); }
|
||||
|
||||
{ const a: boolean = match.all("a", "a"); }
|
||||
{ const a: boolean = match.all("a", ["a"]); }
|
||||
{ const a: boolean = match.all(["a"], "a"); }
|
||||
{ const a: boolean = match.all(["a"], "a", {}); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { basename: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { bash: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { cache: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { dot: true }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { failglob: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { ignore: "a" }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { ignore: ["a"] }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { matchBase: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { nobrace: true }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { nocase: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { nodupes: true }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { noext: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { noglobstar: true }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { nonegate: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { nonull: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { nullglob: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { snapdragon: {} }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { sourcemap: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { unescape: false }); }
|
||||
{ const a: boolean = match.all(["a"], ["a"], { unixify: false }); }
|
||||
|
||||
{ const a: string[] = match.not(["a"], ["a"]); }
|
||||
{ const a: string[] = match.not(["a"], "a"); }
|
||||
{ const a: string[] = match.not(["a"], "a", {}); }
|
||||
{ const a: string[] = match.not(["a"], "a", { basename: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { bash: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { cache: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { dot: true }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { failglob: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { ignore: "a" }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { ignore: ["a"] }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { matchBase: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { nobrace: true }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { nocase: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { nodupes: true }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { noext: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { noglobstar: true }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { nonegate: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { nonull: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { nullglob: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { snapdragon: {} }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { sourcemap: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { unescape: false }); }
|
||||
{ const a: string[] = match.not(["a"], "a", { unixify: false }); }
|
||||
|
||||
{ const a: boolean = match.contains("a", "a"); }
|
||||
{ const a: boolean = match.contains("a", ["a"]); }
|
||||
{ const a: boolean = match.contains("a", ["a"], {}); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { basename: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { bash: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { cache: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { dot: true }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { failglob: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { ignore: "a" }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { ignore: ["a"] }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { matchBase: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { nobrace: true }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { nocase: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { nodupes: true }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { noext: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { noglobstar: true }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { nonegate: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { nonull: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { nullglob: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { snapdragon: {} }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { sourcemap: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { unescape: false }); }
|
||||
{ const a: boolean = match.contains("a", ["a"], { unixify: false }); }
|
||||
|
||||
{ const a: object = match.matchKeys({}, "a"); }
|
||||
{ const a: object = match.matchKeys({}, ["a"]); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], {}); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { basename: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { bash: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { cache: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { dot: true }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { failglob: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { ignore: "a" }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { ignore: ["a"] }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { matchBase: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { nobrace: true }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { nocase: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { nodupes: true }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { noext: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { noglobstar: true }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { nonegate: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { nonull: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { nullglob: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { snapdragon: {} }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { sourcemap: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { unescape: false }); }
|
||||
{ const a: object = match.matchKeys({}, ["a"], { unixify: false }); }
|
||||
|
||||
{ const a: (s: string) => boolean = match.matcher("a"); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"]); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], {}); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { basename: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { bash: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { cache: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { dot: true }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { failglob: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { ignore: "a" }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { ignore: ["a"] }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { matchBase: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { nobrace: true }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { nocase: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { nodupes: true }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { noext: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { noglobstar: true }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { nonegate: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { nonull: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { nullglob: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { snapdragon: {} }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { sourcemap: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { unescape: false }); }
|
||||
{ const a: (s: string) => boolean = match.matcher(["a"], { unixify: false }); }
|
||||
|
||||
{ const a: string[] | null = match.capture("a", "a"); }
|
||||
{ const a: string[] | null = match.capture("a", "a", {}); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { basename: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { bash: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { cache: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { dot: true }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { failglob: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { ignore: "a" }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { ignore: ["a"] }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { matchBase: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { nobrace: true }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { nocase: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { nodupes: true }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { noext: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { noglobstar: true }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { nonegate: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { nonull: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { nullglob: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { snapdragon: {} }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { sourcemap: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { unescape: false }); }
|
||||
{ const a: string[] | null = match.capture("a", "a", { unixify: false }); }
|
||||
|
||||
{ const a: RegExp = match.makeRe("a"); }
|
||||
{ const a: RegExp = match.makeRe("a", {}); }
|
||||
{ const a: RegExp = match.makeRe("a", { basename: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { bash: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { cache: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { dot: true }); }
|
||||
{ const a: RegExp = match.makeRe("a", { failglob: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { ignore: "a" }); }
|
||||
{ const a: RegExp = match.makeRe("a", { ignore: ["a"] }); }
|
||||
{ const a: RegExp = match.makeRe("a", { matchBase: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { nobrace: true }); }
|
||||
{ const a: RegExp = match.makeRe("a", { nocase: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { nodupes: true }); }
|
||||
{ const a: RegExp = match.makeRe("a", { noext: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { noglobstar: true }); }
|
||||
{ const a: RegExp = match.makeRe("a", { nonegate: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { nonull: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { nullglob: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { snapdragon: {} }); }
|
||||
{ const a: RegExp = match.makeRe("a", { sourcemap: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { unescape: false }); }
|
||||
{ const a: RegExp = match.makeRe("a", { unixify: false }); }
|
||||
|
||||
{ const a: string[] = match.braces("a"); }
|
||||
{ const a: string[] = match.braces("a", {}); }
|
||||
{ const a: string[] = match.braces("a", {}); }
|
||||
{ const a: string[] = match.braces("a", { basename: false }); }
|
||||
{ const a: string[] = match.braces("a", { bash: false }); }
|
||||
{ const a: string[] = match.braces("a", { cache: false }); }
|
||||
{ const a: string[] = match.braces("a", { dot: true }); }
|
||||
{ const a: string[] = match.braces("a", { failglob: false }); }
|
||||
{ const a: string[] = match.braces("a", { ignore: "a" }); }
|
||||
{ const a: string[] = match.braces("a", { ignore: ["a"] }); }
|
||||
{ const a: string[] = match.braces("a", { matchBase: false }); }
|
||||
{ const a: string[] = match.braces("a", { nobrace: true }); }
|
||||
{ const a: string[] = match.braces("a", { nocase: false }); }
|
||||
{ const a: string[] = match.braces("a", { nodupes: true }); }
|
||||
{ const a: string[] = match.braces("a", { noext: false }); }
|
||||
{ const a: string[] = match.braces("a", { noglobstar: true }); }
|
||||
{ const a: string[] = match.braces("a", { nonegate: false }); }
|
||||
{ const a: string[] = match.braces("a", { nonull: false }); }
|
||||
{ const a: string[] = match.braces("a", { nullglob: false }); }
|
||||
{ const a: string[] = match.braces("a", { snapdragon: {} }); }
|
||||
{ const a: string[] = match.braces("a", { sourcemap: false }); }
|
||||
{ const a: string[] = match.braces("a", { unescape: false }); }
|
||||
{ const a: string[] = match.braces("a", { unixify: false }); }
|
||||
|
||||
{ const a: object = match.create("a"); }
|
||||
{ const a: object = match.create("a", {}); }
|
||||
{ const a: object = match.create("a", { basename: false }); }
|
||||
{ const a: object = match.create("a", { bash: false }); }
|
||||
{ const a: object = match.create("a", { cache: false }); }
|
||||
{ const a: object = match.create("a", { dot: true }); }
|
||||
{ const a: object = match.create("a", { failglob: false }); }
|
||||
{ const a: object = match.create("a", { ignore: "a" }); }
|
||||
{ const a: object = match.create("a", { ignore: ["a"] }); }
|
||||
{ const a: object = match.create("a", { matchBase: false }); }
|
||||
{ const a: object = match.create("a", { nobrace: true }); }
|
||||
{ const a: object = match.create("a", { nocase: false }); }
|
||||
{ const a: object = match.create("a", { nodupes: true }); }
|
||||
{ const a: object = match.create("a", { noext: false }); }
|
||||
{ const a: object = match.create("a", { noglobstar: true }); }
|
||||
{ const a: object = match.create("a", { nonegate: false }); }
|
||||
{ const a: object = match.create("a", { nonull: false }); }
|
||||
{ const a: object = match.create("a", { nullglob: false }); }
|
||||
{ const a: object = match.create("a", { snapdragon: {} }); }
|
||||
{ const a: object = match.create("a", { sourcemap: false }); }
|
||||
{ const a: object = match.create("a", { unescape: false }); }
|
||||
{ const a: object = match.create("a", { unixify: false }); }
|
||||
{ const a: object = match.create("a"); }
|
||||
|
||||
{ const a: object = match.parse("a", {}); }
|
||||
{ const a: object = match.parse("a", { basename: false }); }
|
||||
{ const a: object = match.parse("a", { bash: false }); }
|
||||
{ const a: object = match.parse("a", { cache: false }); }
|
||||
{ const a: object = match.parse("a", { dot: true }); }
|
||||
{ const a: object = match.parse("a", { failglob: false }); }
|
||||
{ const a: object = match.parse("a", { ignore: "a" }); }
|
||||
{ const a: object = match.parse("a", { ignore: ["a"] }); }
|
||||
{ const a: object = match.parse("a", { matchBase: false }); }
|
||||
{ const a: object = match.parse("a", { nobrace: true }); }
|
||||
{ const a: object = match.parse("a", { nocase: false }); }
|
||||
{ const a: object = match.parse("a", { nodupes: true }); }
|
||||
{ const a: object = match.parse("a", { noext: false }); }
|
||||
{ const a: object = match.parse("a", { noglobstar: true }); }
|
||||
{ const a: object = match.parse("a", { nonegate: false }); }
|
||||
{ const a: object = match.parse("a", { nonull: false }); }
|
||||
{ const a: object = match.parse("a", { nullglob: false }); }
|
||||
{ const a: object = match.parse("a", { snapdragon: {} }); }
|
||||
{ const a: object = match.parse("a", { sourcemap: false }); }
|
||||
{ const a: object = match.parse("a", { unescape: false }); }
|
||||
{ const a: object = match.parse("a", { unixify: false }); }
|
||||
|
||||
{ const a: object = match.compile("a", {}); }
|
||||
{ const a: object = match.compile({}, {}); }
|
||||
{ const a: object = match.compile("a", { basename: false }); }
|
||||
{ const a: object = match.compile({}, { basename: false }); }
|
||||
{ const a: object = match.compile("a", { bash: false }); }
|
||||
{ const a: object = match.compile({}, { bash: false }); }
|
||||
{ const a: object = match.compile("a", { cache: false }); }
|
||||
{ const a: object = match.compile({}, { cache: false }); }
|
||||
{ const a: object = match.compile("a", { dot: true }); }
|
||||
{ const a: object = match.compile({}, { dot: true }); }
|
||||
{ const a: object = match.compile("a", { failglob: false }); }
|
||||
{ const a: object = match.compile({}, { failglob: false }); }
|
||||
{ const a: object = match.compile("a", { ignore: "a" }); }
|
||||
{ const a: object = match.compile({}, { ignore: "a" }); }
|
||||
{ const a: object = match.compile("a", { ignore: ["a"] }); }
|
||||
{ const a: object = match.compile({}, { ignore: ["a"] }); }
|
||||
{ const a: object = match.compile("a", { matchBase: false }); }
|
||||
{ const a: object = match.compile({}, { matchBase: false }); }
|
||||
{ const a: object = match.compile("a", { nobrace: true }); }
|
||||
{ const a: object = match.compile({}, { nobrace: true }); }
|
||||
{ const a: object = match.compile("a", { nocase: false }); }
|
||||
{ const a: object = match.compile({}, { nocase: false }); }
|
||||
{ const a: object = match.compile("a", { nodupes: true }); }
|
||||
{ const a: object = match.compile({}, { nodupes: true }); }
|
||||
{ const a: object = match.compile("a", { noext: false }); }
|
||||
{ const a: object = match.compile({}, { noext: false }); }
|
||||
{ const a: object = match.compile("a", { noglobstar: true }); }
|
||||
{ const a: object = match.compile({}, { noglobstar: true }); }
|
||||
{ const a: object = match.compile("a", { nonegate: false }); }
|
||||
{ const a: object = match.compile({}, { nonegate: false }); }
|
||||
{ const a: object = match.compile("a", { nonull: false }); }
|
||||
{ const a: object = match.compile({}, { nonull: false }); }
|
||||
{ const a: object = match.compile("a", { nullglob: false }); }
|
||||
{ const a: object = match.compile({}, { nullglob: false }); }
|
||||
{ const a: object = match.compile("a", { snapdragon: {} }); }
|
||||
{ const a: object = match.compile({}, { snapdragon: {} }); }
|
||||
{ const a: object = match.compile("a", { sourcemap: false }); }
|
||||
{ const a: object = match.compile({}, { sourcemap: false }); }
|
||||
{ const a: object = match.compile("a", { unescape: false }); }
|
||||
{ const a: object = match.compile({}, { unescape: false }); }
|
||||
{ const a: object = match.compile("a", { unixify: false }); }
|
||||
{ const a: object = match.compile({}, { unixify: false }); }
|
||||
|
||||
{ const a: number = match.MAX_LENGTH; }
|
||||
match.clearCache();
|
||||
match.resizeCache(10050);
|
||||
{ const a: object = match.getCache(); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user