mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 11:41:44 +00:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -256,7 +256,7 @@ When it graduates draft mode, we may remove it from DefinitelyTyped and deprecat
|
||||
|
||||
#### I want to update a package to a new major version
|
||||
|
||||
Before making your change, please create a new subfolder with the current version e.g. `v2`, and copy existing files to it. You will need to:
|
||||
If you intend to continue updating the older version of the package, you may create a new subfolder with the current version e.g. `v2`, and copy existing files to it. If so, you will need to:
|
||||
|
||||
1. Update the relative paths in `tsconfig.json` as well as `tslint.json`.
|
||||
2. Add path mapping rules to ensure that tests are running against the intended version.
|
||||
@@ -279,7 +279,8 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi
|
||||
}
|
||||
```
|
||||
|
||||
Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*.
|
||||
If there are other packages on DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version. You will also need to do this for packages depending on packages depending on the old version.
|
||||
|
||||
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`;
|
||||
transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
|
||||
|
||||
|
||||
Vendored
+2
@@ -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
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
*/
|
||||
|
||||
Vendored
+45
-85
@@ -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
|
||||
*/
|
||||
|
||||
Vendored
+27
-5
@@ -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;
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -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;
|
||||
|
||||
Vendored
+3
-3
@@ -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
|
||||
|
||||
Vendored
+382
-186
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+161
-38
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+31
@@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+21
-1
@@ -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
|
||||
*/
|
||||
|
||||
Vendored
+208
-206
@@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+701
-129
@@ -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 {
|
||||
|
||||
+188
-34
@@ -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 {
|
||||
|
||||
+409
-113
@@ -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); } }); }
|
||||
}
|
||||
}
|
||||
|
||||
+750
-158
@@ -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(); }
|
||||
}
|
||||
}
|
||||
|
||||
+230
-134
@@ -289,25 +289,25 @@ foo.then((x) => {
|
||||
|
||||
// $q signature tests
|
||||
namespace TestQ {
|
||||
interface TResult {
|
||||
interface AbcObject {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
interface TValue {
|
||||
interface EfObject {
|
||||
e: number;
|
||||
f: boolean;
|
||||
}
|
||||
interface TOther {
|
||||
interface GhObject {
|
||||
g: string;
|
||||
h: number;
|
||||
}
|
||||
const tResult: TResult = null;
|
||||
const promiseTResult: angular.IPromise<TResult> = null;
|
||||
const tValue: TValue = null;
|
||||
const promiseTValue: angular.IPromise<TValue> = null;
|
||||
const tOther: TOther = null;
|
||||
const promiseTOther: angular.IPromise<TOther> = null;
|
||||
const abcObject: AbcObject = null;
|
||||
const abcObjectPromise: angular.IPromise<AbcObject> = null;
|
||||
const efObject: EfObject = null;
|
||||
const efObjectPromise: angular.IPromise<EfObject> = null;
|
||||
const ghObject: GhObject = null;
|
||||
const ghObjectPromise: angular.IPromise<GhObject> = null;
|
||||
|
||||
const $q: angular.IQService = null;
|
||||
const promiseAny: angular.IPromise<any> = null;
|
||||
@@ -316,11 +316,11 @@ namespace TestQ {
|
||||
|
||||
// $q constructor
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = new $q<TResult>((resolve: (value: TResult) => any) => {});
|
||||
result = new $q<TResult>((resolve: (value: TResult) => any, reject: (value: any) => any) => {});
|
||||
result = $q<TResult>((resolve: (value: TResult) => any) => {});
|
||||
result = $q<TResult>((resolve: (value: TResult) => any, reject: (value: any) => any) => {});
|
||||
let result: angular.IPromise<AbcObject>;
|
||||
result = new $q<AbcObject>((resolve: (value: AbcObject) => any) => {});
|
||||
result = new $q<AbcObject>((resolve: (value: AbcObject) => any, reject: (value: any) => any) => {});
|
||||
result = $q<AbcObject>((resolve: (value: AbcObject) => any) => {});
|
||||
result = $q<AbcObject>((resolve: (value: AbcObject) => any, reject: (value: any) => any) => {});
|
||||
}
|
||||
|
||||
// $q.all
|
||||
@@ -332,8 +332,8 @@ namespace TestQ {
|
||||
$q.all([1, $q.when(2), '3']).then(([ n1, n2, n3 ]) => n1.toFixed() + n2.toFixed() + n3.slice(1));
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult[]>;
|
||||
result = $q.all<TResult>([promiseAny, promiseAny]);
|
||||
let result: angular.IPromise<AbcObject[]>;
|
||||
result = $q.all<AbcObject>([promiseAny, promiseAny]);
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<{[id: string]: any; }>;
|
||||
@@ -356,13 +356,13 @@ namespace TestQ {
|
||||
|
||||
// $q.defer
|
||||
{
|
||||
let result: angular.IDeferred<TResult>;
|
||||
result = $q.defer<TResult>();
|
||||
result.resolve(tResult);
|
||||
let result: angular.IDeferred<AbcObject>;
|
||||
result = $q.defer<AbcObject>();
|
||||
result.resolve(abcObject);
|
||||
const anyValue: any = null;
|
||||
result.reject(anyValue);
|
||||
result.promise.then(result => {
|
||||
return $q.resolve<TResult>(result);
|
||||
return $q.resolve<AbcObject>(result);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -380,10 +380,10 @@ namespace TestQ {
|
||||
result = $q.resolve();
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $q.resolve<TResult>(tResult);
|
||||
result = $q.resolve<TResult>(promiseTResult);
|
||||
const result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
|
||||
let result: angular.IPromise<AbcObject>;
|
||||
result = $q.resolve<AbcObject>(abcObject);
|
||||
result = $q.resolve<AbcObject>(abcObjectPromise);
|
||||
const result2: angular.IPromise<AbcObject | GhObject> = $q.resolve<AbcObject | GhObject>(Math.random() > 0.5 ? abcObject : ghObjectPromise);
|
||||
}
|
||||
|
||||
// $q.when
|
||||
@@ -392,32 +392,32 @@ namespace TestQ {
|
||||
result = $q.when();
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
let resultOther: angular.IPromise<TResult | TOther>;
|
||||
let result: angular.IPromise<AbcObject>;
|
||||
let resultOther: angular.IPromise<AbcObject | GhObject>;
|
||||
|
||||
result = $q.when<TResult>(tResult);
|
||||
result = $q.when<TResult>(promiseTResult);
|
||||
result = $q.when<AbcObject>(abcObject);
|
||||
result = $q.when<AbcObject>(abcObjectPromise);
|
||||
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any, (any) => any);
|
||||
result = $q.when<AbcObject, EfObject>(efObject, (result: EfObject) => abcObject);
|
||||
result = $q.when<AbcObject, EfObject>(efObject, (result: EfObject) => abcObject, (any) => any);
|
||||
result = $q.when<AbcObject, EfObject>(efObject, (result: EfObject) => abcObject, (any) => any, (any) => any);
|
||||
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any);
|
||||
result = $q.when<AbcObject, EfObject>(efObjectPromise, (result: EfObject) => abcObject);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObject);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObject);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObject, (any) => any);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObjectPromise);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObject, (any) => ghObjectPromise, (any) => any);
|
||||
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
|
||||
result = $q.when<AbcObject, EfObject>(efObject, (result: EfObject) => abcObjectPromise);
|
||||
result = $q.when<AbcObject, EfObject>(efObject, (result: EfObject) => abcObjectPromise, (any) => any);
|
||||
result = $q.when<AbcObject, EfObject>(efObject, (result: EfObject) => abcObjectPromise, (any) => any, (any) => any);
|
||||
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther);
|
||||
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any);
|
||||
result = $q.when<AbcObject, EfObject>(efObjectPromise, (result: EfObject) => abcObjectPromise);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObject);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObject, (any) => any);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObjectPromise);
|
||||
resultOther = $q.when<AbcObject, GhObject, EfObject>(efObjectPromise, (result: EfObject) => abcObjectPromise, (any) => ghObjectPromise, (any) => any);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,41 +440,41 @@ httpFoo.then((response: ng.IHttpResponse<any>) => {
|
||||
|
||||
// Deferred signature tests
|
||||
namespace TestDeferred {
|
||||
const any: any = null;
|
||||
const anything: any = null;
|
||||
|
||||
interface TResult {
|
||||
interface AbcObject {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
const tResult: TResult = null;
|
||||
const abcObject: AbcObject = null;
|
||||
|
||||
const deferred: angular.IDeferred<TResult> = null;
|
||||
const deferred: angular.IDeferred<AbcObject> = null;
|
||||
|
||||
// deferred.resolve
|
||||
{
|
||||
let result: void;
|
||||
result = deferred.resolve();
|
||||
result = deferred.resolve(tResult);
|
||||
result = deferred.resolve(abcObject);
|
||||
}
|
||||
|
||||
// deferred.reject
|
||||
{
|
||||
let result: void;
|
||||
result = deferred.reject();
|
||||
result = deferred.reject(any);
|
||||
result = deferred.reject(anything);
|
||||
}
|
||||
|
||||
// deferred.notify
|
||||
{
|
||||
let result: void;
|
||||
result = deferred.notify();
|
||||
result = deferred.notify(any);
|
||||
result = deferred.notify(anything);
|
||||
}
|
||||
|
||||
// deferred.promise
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
let result: angular.IPromise<AbcObject>;
|
||||
result = deferred.promise;
|
||||
}
|
||||
}
|
||||
@@ -517,111 +517,189 @@ namespace TestInjector {
|
||||
|
||||
// Promise signature tests
|
||||
namespace TestPromise {
|
||||
const any: any = null;
|
||||
const anything: any = null;
|
||||
|
||||
interface TResult {
|
||||
kind: 'result';
|
||||
interface AbcObject {
|
||||
kind: 'abc';
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
interface TOther {
|
||||
kind: 'other';
|
||||
interface DefObject {
|
||||
kind: 'def';
|
||||
d: number;
|
||||
e: string;
|
||||
f: boolean;
|
||||
}
|
||||
|
||||
function isTResult(x: TResult | TOther): x is TResult {
|
||||
return x.kind === 'result';
|
||||
function isAbcObject(x: AbcObject | DefObject): x is AbcObject {
|
||||
return x.kind === 'abc';
|
||||
}
|
||||
|
||||
const tresult: TResult = null;
|
||||
const tresultPromise: ng.IPromise<TResult> = null;
|
||||
const tresultHttpPromise: ng.IHttpPromise<TResult> = null;
|
||||
const abcObject: AbcObject = null;
|
||||
const abcObjectPromise: ng.IPromise<AbcObject> = null;
|
||||
const abcObjectHttpPromise: ng.IHttpPromise<AbcObject> = null;
|
||||
|
||||
const tother: TOther = null;
|
||||
const totherPromise: ng.IPromise<TOther> = null;
|
||||
const totherHttpPromise: ng.IHttpPromise<TOther> = null;
|
||||
const defObject: DefObject = null;
|
||||
const defObjectPromise: ng.IPromise<DefObject> = null;
|
||||
const defObjectHttpPromise: ng.IHttpPromise<DefObject> = null;
|
||||
|
||||
const promise: angular.IPromise<TResult> = null;
|
||||
const promise: angular.IPromise<AbcObject> = null;
|
||||
const $q: angular.IQService = null;
|
||||
|
||||
const assertPromiseType = <T>(arg: angular.IPromise<T>) => arg;
|
||||
const reject = $q.reject();
|
||||
const rejectedPromise = $q.reject();
|
||||
|
||||
// promise.then
|
||||
assertPromiseType<any>(promise.then((result) => any));
|
||||
assertPromiseType<any>(promise.then((result) => any, (any) => any));
|
||||
assertPromiseType<any>(promise.then((result) => any, (any) => any, (any) => any));
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => anything);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => anything, any => any);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => anything, any => any, any => any);
|
||||
|
||||
assertPromiseType<never>(promise.then((result) => reject));
|
||||
assertPromiseType<never>(promise.then((result) => reject, (any) => reject));
|
||||
assertPromiseType<never>(promise.then((result) => reject, (any) => reject, (any) => any));
|
||||
// $ExpectType IPromise<never>
|
||||
promise.then(result => rejectedPromise);
|
||||
// $ExpectType IPromise<never>
|
||||
promise.then(result => rejectedPromise, any => rejectedPromise);
|
||||
// $ExpectType IPromise<never>
|
||||
promise.then(result => rejectedPromise, any => rejectedPromise, any => any);
|
||||
|
||||
assertPromiseType<TResult>(promise.then((result) => result));
|
||||
assertPromiseType<TResult>(promise.then((result) => tresult));
|
||||
assertPromiseType<TResult>(promise.then((result) => tresultPromise));
|
||||
assertPromiseType<TResult>(promise.then((result) => result, (any) => any));
|
||||
assertPromiseType<TResult>(promise.then((result) => result, (any) => any, (any) => any));
|
||||
assertPromiseType<TResult>(promise.then((result) => result, (any) => reject, (any) => any));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(result => result);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(result => abcObject);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(result => abcObjectPromise);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => result, any => any);
|
||||
// $ExpectType IPromise<number | AbcObject>
|
||||
promise.then(result => result, any => Math.random());
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => result, any => any, any => any);
|
||||
// $ExpectType IPromise<number | AbcObject>
|
||||
promise.then(result => result, any => Math.random(), any => any);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(result => result, any => rejectedPromise, any => any);
|
||||
|
||||
assertPromiseType<angular.IPromise<never> | TResult>(promise.then((result) => anyOf2(reject, result)));
|
||||
assertPromiseType<TResult>(promise.then((result) => anyOf3(result, tresultPromise, reject)));
|
||||
assertPromiseType<TResult>(promise.then(
|
||||
(result) => anyOf3(reject, result, tresultPromise),
|
||||
(reason) => anyOf3(reject, tresult, tresultPromise)
|
||||
));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(result => anyOf2(rejectedPromise, result));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(result => anyOf3(result, abcObjectPromise, rejectedPromise));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.then(
|
||||
result => anyOf3(rejectedPromise, result, abcObjectPromise),
|
||||
reason => anyOf3(rejectedPromise, abcObject, abcObjectPromise)
|
||||
);
|
||||
|
||||
assertPromiseType<ng.IHttpResponse<TResult>>(promise.then((result) => tresultHttpPromise));
|
||||
// $ExpectType IPromise<IHttpResponse<AbcObject>>
|
||||
promise.then(result => abcObjectHttpPromise);
|
||||
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
|
||||
assertPromiseType<TResult | angular.IPromise<TResult> | angular.IPromise<never> | TOther | angular.IPromise<TOther>>(promise.then(
|
||||
(result) => anyOf3(reject, result, totherPromise),
|
||||
(reason) => anyOf3(reject, tother, tresultPromise)
|
||||
));
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.then(result => result, any => defObject);
|
||||
|
||||
assertPromiseType<TResult | TOther>(promise.then<TResult | TOther, TResult>(
|
||||
(result) => anyOf3(tresultPromise, result, totherPromise)
|
||||
));
|
||||
// These are broken and seemingly can't be made to work
|
||||
// with the current limitations of TypeScript.
|
||||
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother, (any) => any));
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise));
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any));
|
||||
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise));
|
||||
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any));
|
||||
// xExpectType IPromise<AbcObject | DefObject>
|
||||
// promise.then(result => anyOf2(result, defObjectPromise));
|
||||
// xExpectType IPromise<AbcObject | DefObject>
|
||||
// promise.then(result => anyOf3(rejectedPromise, result, defObjectPromise));
|
||||
// xExpectType IPromise<AbcObject | DefObject>
|
||||
// const a4 = promise.then(
|
||||
// result => anyOf3(rejectedPromise, result, defObjectPromise),
|
||||
// reason => anyOf3(rejectedPromise, defObject, abcObjectPromise)
|
||||
// );
|
||||
|
||||
assertPromiseType<TOther>(promise.then((result) => tother));
|
||||
assertPromiseType<TOther>(promise.then((result) => tother, (any) => any));
|
||||
assertPromiseType<TOther>(promise.then((result) => tother, (any) => any, (any) => any));
|
||||
assertPromiseType<TOther>(promise.then((result) => totherPromise));
|
||||
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any));
|
||||
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any, (any) => any));
|
||||
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise));
|
||||
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any));
|
||||
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any));
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.then<AbcObject | DefObject, AbcObject>(result =>
|
||||
anyOf3(abcObjectPromise, result, defObjectPromise)
|
||||
);
|
||||
|
||||
assertPromiseType<boolean>(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.then(result => result, any => defObject, any => any);
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.then(result => abcObjectPromise, any => defObjectPromise);
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.then(result => abcObjectPromise, any => defObjectPromise, any => any);
|
||||
// $ExpectType IPromise<IHttpResponse<AbcObject> | IHttpResponse<DefObject>>
|
||||
promise.then(result => abcObjectHttpPromise, any => defObjectHttpPromise);
|
||||
// $ExpectType IPromise<IHttpResponse<AbcObject> | IHttpResponse<DefObject>>
|
||||
promise.then(result => abcObjectHttpPromise, any => defObjectHttpPromise, any => any);
|
||||
|
||||
// $ExpectType IPromise<DefObject>
|
||||
promise.then(result => defObject);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => defObject, any => any);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => defObject, any => any, any => any);
|
||||
// $ExpectType IPromise<DefObject>
|
||||
promise.then(result => defObjectPromise);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => defObjectPromise, any => any);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => defObjectPromise, any => any, any => any);
|
||||
// $ExpectType IPromise<IHttpResponse<DefObject>>
|
||||
promise.then(result => defObjectHttpPromise);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => defObjectHttpPromise, any => any);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.then(result => defObjectHttpPromise, any => any, any => any);
|
||||
|
||||
// $ExpectType IPromise<boolean>
|
||||
promise
|
||||
.then(result => abcObject, any => defObject)
|
||||
.then(ambiguous => (isAbcObject(ambiguous) ? ambiguous.c : ambiguous.f));
|
||||
|
||||
// promise.then + $q.reject:
|
||||
|
||||
// $ExpectType IPromise<number>
|
||||
$q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject());
|
||||
// $ExpectType IPromise<number>
|
||||
$q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject('a'));
|
||||
// $ExpectType IPromise<never>
|
||||
$q.resolve().then(() => $q.reject('a'));
|
||||
// $ExpectType IPromise<void>
|
||||
$q.resolve().then(() => {
|
||||
if (Math.random() > 0.5) $q.reject();
|
||||
});
|
||||
|
||||
// promise.catch
|
||||
assertPromiseType<any>(promise.catch((err) => err));
|
||||
assertPromiseType<any>(promise.catch((err) => any));
|
||||
assertPromiseType<TResult>(promise.catch((err) => tresult));
|
||||
assertPromiseType<TResult | angular.IPromise<never>>(promise.catch((err) => anyOf2(tresult, reject)));
|
||||
assertPromiseType<TResult>(promise.catch((err) => anyOf3(tresult, tresultPromise, reject)));
|
||||
assertPromiseType<TResult>(promise.catch((err) => tresultPromise));
|
||||
assertPromiseType<TResult | ng.IHttpResponse<TResult>>(promise.catch((err) => tresultHttpPromise));
|
||||
assertPromiseType<TResult | TOther>(promise.catch((err) => tother));
|
||||
assertPromiseType<TResult | TOther>(promise.catch((err) => totherPromise));
|
||||
assertPromiseType<TResult | ng.IHttpResponse<TOther>>(promise.catch((err) => totherHttpPromise));
|
||||
// $ExpectType IPromise<any>
|
||||
promise.catch(err => err);
|
||||
// $ExpectType IPromise<any>
|
||||
promise.catch(err => anything);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.catch(err => abcObject);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.catch(err => anyOf2(abcObject, rejectedPromise));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.catch(err => anyOf3(abcObject, abcObjectPromise, rejectedPromise));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.catch(err => abcObjectPromise);
|
||||
// $ExpectType IPromise<AbcObject | IHttpResponse<AbcObject>>
|
||||
promise.catch(err => abcObjectHttpPromise);
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.catch(err => defObject);
|
||||
// $ExpectType IPromise<AbcObject | DefObject>
|
||||
promise.catch(err => defObjectPromise);
|
||||
// $ExpectType IPromise<AbcObject | IHttpResponse<DefObject>>
|
||||
promise.catch(err => defObjectHttpPromise);
|
||||
|
||||
assertPromiseType<boolean>(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
|
||||
// $ExpectType IPromise<boolean>
|
||||
promise
|
||||
.catch(err => defObject)
|
||||
.then(
|
||||
ambiguous => (isAbcObject(ambiguous) ? ambiguous.c : ambiguous.f)
|
||||
);
|
||||
|
||||
// promise.finally
|
||||
assertPromiseType<TResult>(promise.finally(() => any));
|
||||
assertPromiseType<TResult>(promise.finally(() => tresult));
|
||||
assertPromiseType<TResult>(promise.finally(() => tother));
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.finally(() => anything);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.finally(() => abcObject);
|
||||
// $ExpectType IPromise<AbcObject>
|
||||
promise.finally(() => defObject);
|
||||
}
|
||||
|
||||
function test_angular_forEach() {
|
||||
@@ -648,12 +726,12 @@ let elementReadyFn = angular.element(() => {
|
||||
|
||||
// $timeout signature tests
|
||||
namespace TestTimeout {
|
||||
interface TResult {
|
||||
interface AbcObject {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
const fnTResult: (...args: any[]) => TResult = null;
|
||||
const abcObjectFn: (...args: any[]) => AbcObject = null;
|
||||
const promiseAny: angular.IPromise<any> = null;
|
||||
const $timeout: angular.ITimeoutService = null;
|
||||
|
||||
@@ -668,13 +746,13 @@ namespace TestTimeout {
|
||||
result = $timeout(1, true);
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $timeout(fnTResult);
|
||||
result = $timeout(fnTResult, 1);
|
||||
result = $timeout(fnTResult, 1, true);
|
||||
result = $timeout(fnTResult, 1, true, 1);
|
||||
result = $timeout(fnTResult, 1, true, 1, '');
|
||||
result = $timeout(fnTResult, 1, true, 1, '', true);
|
||||
let result: angular.IPromise<AbcObject>;
|
||||
result = $timeout(abcObjectFn);
|
||||
result = $timeout(abcObjectFn, 1);
|
||||
result = $timeout(abcObjectFn, 1, true);
|
||||
result = $timeout(abcObjectFn, 1, true, 1);
|
||||
result = $timeout(abcObjectFn, 1, true, 1, '');
|
||||
result = $timeout(abcObjectFn, 1, true, 1, '', true);
|
||||
}
|
||||
|
||||
// $timeout.cancel
|
||||
@@ -1187,6 +1265,24 @@ function NgModelControllerTyping() {
|
||||
};
|
||||
}
|
||||
|
||||
// FormController
|
||||
angular.module('app').directive('formDebugChecker', () => {
|
||||
return {
|
||||
require: '^^form',
|
||||
link: (scope, el, attrs, ctrl) => {
|
||||
const form = ctrl as angular.IFormController;
|
||||
el.on('click', () => {
|
||||
const report = [] as string[];
|
||||
angular.forEach(form.$error, (controls, validationErrorKey) => {
|
||||
const names = controls.map(control => control.$name);
|
||||
report.push(`${validationErrorKey}: ${controls.length} control(s) (${names.join(', ')})`);
|
||||
});
|
||||
console.log(`This form has ${report.length} error(s).\n${report.join('\n')}`);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let $filter: angular.IFilterService;
|
||||
|
||||
function testFilter() {
|
||||
|
||||
Vendored
+32
-17
@@ -357,9 +357,9 @@ declare namespace angular {
|
||||
$valid: boolean;
|
||||
$invalid: boolean;
|
||||
$submitted: boolean;
|
||||
$error: any;
|
||||
$name: string;
|
||||
$pending: any;
|
||||
$error: { [validationErrorKey: string]: Array<INgModelController | IFormController> };
|
||||
$name?: string;
|
||||
$pending?: { [validationErrorKey: string]: Array<INgModelController | IFormController> };
|
||||
$addControl(control: INgModelController | IFormController): void;
|
||||
$removeControl(control: INgModelController | IFormController): void;
|
||||
$setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void;
|
||||
@@ -399,8 +399,8 @@ declare namespace angular {
|
||||
$parsers: IModelParser[];
|
||||
$formatters: IModelFormatter[];
|
||||
$viewChangeListeners: IModelViewChangeListener[];
|
||||
$error: any;
|
||||
$name: string;
|
||||
$error: { [validationErrorKey: string]: boolean };
|
||||
$name?: string;
|
||||
|
||||
$touched: boolean;
|
||||
$untouched: boolean;
|
||||
@@ -408,7 +408,7 @@ declare namespace angular {
|
||||
$validators: IModelValidators;
|
||||
$asyncValidators: IAsyncModelValidators;
|
||||
|
||||
$pending: any;
|
||||
$pending?: { [validationErrorKey: string]: boolean };
|
||||
$pristine: boolean;
|
||||
$dirty: boolean;
|
||||
$valid: boolean;
|
||||
@@ -1103,28 +1103,43 @@ declare namespace angular {
|
||||
|
||||
interface IPromise<T> {
|
||||
/**
|
||||
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
|
||||
* The successCallBack may return IPromise<never> for when a $q.reject() needs to be returned
|
||||
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
|
||||
* Regardless of when the promise was or will be resolved or rejected, then calls one of
|
||||
* the success or error callbacks asynchronously as soon as the result is available. The
|
||||
* callbacks are called with a single argument: the result or rejection reason.
|
||||
* Additionally, the notify callback may be called zero or more times to provide a
|
||||
* progress indication, before the promise is resolved or rejected.
|
||||
* The `successCallBack` may return `IPromise<never>` for when a `$q.reject()` needs to
|
||||
* be returned.
|
||||
* This method returns a new promise which is resolved or rejected via the return value
|
||||
* of the `successCallback`, `errorCallback`. It also notifies via the return value of
|
||||
* the `notifyCallback` method. The promise can not be resolved or rejected from the
|
||||
* `notifyCallback` method.
|
||||
*/
|
||||
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
then<TResult1, TResult2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2>;
|
||||
|
||||
then<TResult, TCatch>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback: (reason: any) => IPromise<TCatch>|TCatch, notifyCallback?: (state: any) => any): IPromise<TResult | TCatch>;
|
||||
then<TResult1, TResult2, TCatch1, TCatch2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback: (reason: any) => IPromise<TCatch1>|TCatch2, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2 | TCatch1 | TCatch2>;
|
||||
then<TResult1 = T, TResult2 = never>(
|
||||
successCallback?:
|
||||
| ((value: T) => IPromise<never> | IPromise<TResult1> | TResult1)
|
||||
| null,
|
||||
errorCallback?:
|
||||
| ((reason: any) => IPromise<never> | IPromise<TResult2> | TResult2)
|
||||
| null,
|
||||
notifyCallback?: (state: any) => any
|
||||
): IPromise<TResult1 | TResult2>;
|
||||
|
||||
/**
|
||||
* Shorthand for promise.then(null, errorCallback)
|
||||
*/
|
||||
catch<TCatch>(onRejected: (reason: any) => IPromise<TCatch>|TCatch): IPromise<T | TCatch>;
|
||||
catch<TCatch1, TCatch2>(onRejected: (reason: any) => IPromise<TCatch1>|TCatch2): IPromise<T | TCatch1 | TCatch2>;
|
||||
catch<TResult = never>(
|
||||
onRejected?:
|
||||
| ((reason: any) => IPromise<never> | IPromise<TResult> | TResult)
|
||||
| null
|
||||
): IPromise<T | TResult>;
|
||||
|
||||
/**
|
||||
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
|
||||
*
|
||||
* Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
|
||||
*/
|
||||
finally(finallyCallback: () => any): IPromise<T>;
|
||||
finally(finallyCallback: () => void): IPromise<T>;
|
||||
}
|
||||
|
||||
interface IDeferred<T> {
|
||||
|
||||
@@ -10,6 +10,14 @@ lock.acquire("key", (done) => {
|
||||
done();
|
||||
}).then(() => { /* ... */ });
|
||||
|
||||
lock.acquire("key", () => "stringValue")
|
||||
// Check returned value's type is inherited properly
|
||||
.then((str) => str.replace("s", "S"));
|
||||
|
||||
lock.acquire("key", async () => "stringValue")
|
||||
// Check returned value's type is inherited properly
|
||||
.then((str) => str.replace("s", "S"));
|
||||
|
||||
lock.acquire([ "key1", "key2" ], (done) => {
|
||||
done();
|
||||
}, (err, ret) => { /* ... */ });
|
||||
|
||||
Vendored
+11
-5
@@ -1,11 +1,12 @@
|
||||
// Type definitions for async-lock
|
||||
// Project: https://github.com/rain1017/async-lock
|
||||
// Definitions by: Elisée MAURER <https://github.com/elisee>
|
||||
// Definitions by: Elisée MAURER <https://github.com/elisee>, Alejandro <https://github.com/afharo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
|
||||
interface AsyncLockDoneCallback {
|
||||
(err?: Error, ret?: any): void;
|
||||
interface AsyncLockDoneCallback<T> {
|
||||
(err?: Error, ret?: T): void;
|
||||
}
|
||||
|
||||
interface AsyncLockOptions {
|
||||
@@ -18,8 +19,13 @@ interface AsyncLockOptions {
|
||||
declare class AsyncLock {
|
||||
constructor(options?: AsyncLockOptions);
|
||||
|
||||
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void;
|
||||
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike<any>;
|
||||
acquire<T>(key: string | string[],
|
||||
fn: (() => T | PromiseLike<T>) | ((done: AsyncLockDoneCallback<T>) => any),
|
||||
opts?: AsyncLockOptions): PromiseLike<T>;
|
||||
acquire<T>(key: string | string[],
|
||||
fn: (done: AsyncLockDoneCallback<T>) => any,
|
||||
cb: AsyncLockDoneCallback<T>,
|
||||
opts?: AsyncLockOptions): void;
|
||||
|
||||
isBusy(): boolean;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,11 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
|
||||
Vendored
+1
-1
@@ -457,7 +457,7 @@ export interface Statement {
|
||||
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
|
||||
*/
|
||||
export interface AuthResponseContext {
|
||||
[name: string]: string | number | boolean;
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// basic usage
|
||||
$(document).ready(() => {
|
||||
$.bootstrapGrowl('Message to show in alert');
|
||||
});
|
||||
|
||||
// with options example
|
||||
let offsetOptions: BootstrapGrowlIfightcrime.OffsetOption = {
|
||||
from: 'top',
|
||||
amount: 20
|
||||
};
|
||||
|
||||
let options: BootstrapGrowlIfightcrime.Options = {
|
||||
ele: 'body',
|
||||
type: 'info',
|
||||
offset: offsetOptions,
|
||||
align: 'right',
|
||||
width: 250,
|
||||
delay: 4000,
|
||||
allow_dismiss: true,
|
||||
stackup_spacing: 10
|
||||
};
|
||||
|
||||
$(document).ready(() => {
|
||||
$.bootstrapGrowl('Alert with options', options);
|
||||
});
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// Type definitions for Bootstrap Growl Ifightcrime 1.1
|
||||
// Project: https://github.com/ifightcrime/bootstrap-growl
|
||||
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare namespace BootstrapGrowlIfightcrime {
|
||||
type OffsetPositionType = 'top' | 'bottom';
|
||||
|
||||
type AlertType = 'info' | 'danger' | 'success' | 'warning' | string | null;
|
||||
|
||||
type AlignType = 'left' | 'center' | 'right';
|
||||
|
||||
interface OffsetOption {
|
||||
/**
|
||||
* Position: top or bottom
|
||||
*/
|
||||
from?: OffsetPositionType;
|
||||
|
||||
/**
|
||||
* Offset amount
|
||||
*/
|
||||
amount?: number;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Which element to append to
|
||||
*/
|
||||
ele?: string;
|
||||
|
||||
/**
|
||||
* Values of (null, 'info', 'danger', 'success', 'warning') or another value
|
||||
*/
|
||||
type?: AlertType;
|
||||
|
||||
/**
|
||||
* Offset Options
|
||||
*/
|
||||
offset?: OffsetOption;
|
||||
|
||||
/**
|
||||
* 'left', 'right', or 'center'
|
||||
*/
|
||||
align?: AlignType;
|
||||
|
||||
/**
|
||||
* Integer
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* Time while the message will be displayed. It's not equivalent to the *demo* timeOut!
|
||||
*/
|
||||
delay?: number;
|
||||
|
||||
/**
|
||||
* If true then will display a cross to close the popup.
|
||||
*/
|
||||
allow_dismiss?: boolean;
|
||||
|
||||
/**
|
||||
* Spacing between consecutively stacked growls.
|
||||
*/
|
||||
stackup_spacing?: number;
|
||||
}
|
||||
}
|
||||
interface JQueryStatic {
|
||||
/**
|
||||
* Show standard Bootstrap alerts into hovering "Growl-like" notifications
|
||||
* @param message to show.
|
||||
* @param options should be an options object.
|
||||
* @returns The element.
|
||||
*/
|
||||
bootstrapGrowl: (message: string, options?: BootstrapGrowlIfightcrime.Options) => JQuery;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap-growl-ifightcrime-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"extends": "dtslint/dt.json"}
|
||||
Vendored
+18
-7
@@ -228,11 +228,11 @@ declare namespace Bull {
|
||||
}
|
||||
|
||||
interface JobCounts {
|
||||
wait: number;
|
||||
active: number;
|
||||
completed: number;
|
||||
failed: number;
|
||||
delayed: number;
|
||||
waiting: number;
|
||||
}
|
||||
|
||||
interface JobInformation {
|
||||
@@ -384,21 +384,27 @@ declare namespace Bull {
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves when the queue is paused.
|
||||
* The pause is global, meaning that all workers in all queue instances for a given queue will be paused.
|
||||
* A paused queue will not process new jobs until resumed,
|
||||
* but current jobs being processed will continue until they are finalized.
|
||||
*
|
||||
* A paused queue will not process new jobs until resumed, but current jobs being processed will continue until
|
||||
* they are finalized. The pause can be either global or local. If global, all workers in all queue instances
|
||||
* for a given queue will be paused. If local, just this worker will stop processing new jobs after the current
|
||||
* lock expires. This can be useful to stop a worker from taking new jobs prior to shutting down.
|
||||
*
|
||||
* Pausing a queue that is already paused does nothing.
|
||||
*/
|
||||
pause(): Promise<void>;
|
||||
pause(isLocal?: boolean): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves when the queue is resumed after being paused.
|
||||
* The resume is global, meaning that all workers in all queue instances for a given queue will be resumed.
|
||||
*
|
||||
* The resume can be either local or global. If global, all workers in all queue instances for a given queue
|
||||
* will be resumed. If local, only this worker will be resumed. Note that resuming a queue globally will not
|
||||
* resume workers that have been paused locally; for those, resume(true) must be called directly on their
|
||||
* instances.
|
||||
*
|
||||
* Resuming a queue that is not paused does nothing.
|
||||
*/
|
||||
resume(): Promise<void>;
|
||||
resume(isLocal?: boolean): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a promise that returns the number of jobs in the queue, waiting or paused.
|
||||
@@ -445,6 +451,11 @@ declare namespace Bull {
|
||||
*/
|
||||
getFailed(start?: number, end?: number): Promise<Job[]>;
|
||||
|
||||
/**
|
||||
* Returns a promise that will return an array with the waiting jobs between start and end.
|
||||
*/
|
||||
getWaiting(start?: number, end?: number): Promise<Job[]>;
|
||||
|
||||
/**
|
||||
* Returns JobInformation of repeatable jobs (ordered descending). Provide a start and/or an end
|
||||
* index to limit the number of results. Start defaults to 0, end to -1 and asc to false.
|
||||
|
||||
@@ -1882,6 +1882,23 @@ function tooltip_order() {
|
||||
});
|
||||
}
|
||||
|
||||
function tooltip_order_function() {
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
["data2", 50, 20, 10, 40, 15, 25]
|
||||
]
|
||||
},
|
||||
tooltip: {
|
||||
order: (data1, data2) => {
|
||||
return data1.id - data2.id;
|
||||
// return data2.id - data2.id in case we want desc order
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// Chart options Tests
|
||||
////////////////////////
|
||||
|
||||
Vendored
+2
-1
@@ -744,8 +744,9 @@ export interface TooltipOptions {
|
||||
contents?(data: any, defaultTitleFormat: string, defaultValueFormat: string, color: any): string;
|
||||
/**
|
||||
* Set tooltip values order
|
||||
* Available Values: desc, asc, any[], function (data1, data2) { ... }, null
|
||||
*/
|
||||
order?: string | any[] | ((data: Data) => boolean);
|
||||
order?: string | any[] | ((data1: any, data2: any) => number) | null;
|
||||
}
|
||||
|
||||
export interface SubchartOptions {
|
||||
|
||||
@@ -51,6 +51,90 @@ describe('chai-string', function() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('#containIgnoreSpaces', function () {
|
||||
|
||||
it('should return true', function () {
|
||||
var str1 = '1234abcdef56',
|
||||
str2 = '1234a\nb\tc\r d ef56';
|
||||
str1.should.containIgnoreSpaces(str2);
|
||||
});
|
||||
|
||||
it('should return true (2)', function () {
|
||||
var str1 = 'abcdef',
|
||||
str2 = 'a\nb\tc\r d ef';
|
||||
str1.should.containIgnoreSpaces(str2);
|
||||
});
|
||||
|
||||
it('should return false', function () {
|
||||
var str1 = 'abdef',
|
||||
str2 = 'a\nb\tc\r d ef';
|
||||
str1.should.not.containIgnoreSpaces(str2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#containIgnoreCase', function () {
|
||||
|
||||
it('should return true', function () {
|
||||
var str1 = 'abcdef',
|
||||
str2 = 'cDe';
|
||||
str1.should.containIgnoreCase(str2);
|
||||
});
|
||||
|
||||
it('should return true (2)', function () {
|
||||
'abcdef'.should.containIgnoreCase('cDe');
|
||||
});
|
||||
|
||||
it('should return true (3)', function () {
|
||||
var str1 = 'abcdef',
|
||||
str2 = 'AbCdeF';
|
||||
str1.should.containIgnoreCase(str2);
|
||||
});
|
||||
|
||||
it('should return false', function () {
|
||||
var str1 = 'abcdef',
|
||||
str2 = 'efg';
|
||||
str1.should.not.containIgnoreCase(str2);
|
||||
});
|
||||
|
||||
it('should return false (3)', function () {
|
||||
var str1 = 'abcdef',
|
||||
str2 = 'zabcd';
|
||||
str1.should.not.containIgnoreCase(str2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#indexOf', function () {
|
||||
|
||||
it('should return true', function () {
|
||||
var str = 'abcabd',
|
||||
substr = 'ab',
|
||||
index = 0;
|
||||
str.indexOf(substr, index).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true (2)', function () {
|
||||
var str = 'abcabd',
|
||||
substr = 'ca',
|
||||
index = 2;
|
||||
str.indexOf(substr, index).should.be.true;
|
||||
});
|
||||
|
||||
it('should return true (3)', function () {
|
||||
var str = 'ababab',
|
||||
substr = 'ba',
|
||||
index = 1;
|
||||
str.indexOf(substr, index).should.be.true;
|
||||
});
|
||||
|
||||
it('should return false', function () {
|
||||
var str = 'abcaab',
|
||||
substr = 'da',
|
||||
index = 1;
|
||||
str.indexOf(substr, index).should.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('tdd alias', function() {
|
||||
let str: string;
|
||||
let str2: string;
|
||||
@@ -92,6 +176,14 @@ describe('chai-string', function() {
|
||||
assert.notEqualIgnoreSpaces(str, str2 + 'g');
|
||||
});
|
||||
|
||||
it('.containIgnoreSpaces', function () {
|
||||
assert.containIgnoreSpaces(str, str2);
|
||||
});
|
||||
|
||||
it('.notContainIgnoreSpaces', function () {
|
||||
assert.notContainIgnoreSpaces(str, str2 + 'g');
|
||||
});
|
||||
|
||||
it('.singleLine', function() {
|
||||
assert.singleLine(str);
|
||||
});
|
||||
@@ -125,5 +217,13 @@ describe('chai-string', function() {
|
||||
assert.entriesCount('', 'ab', 0);
|
||||
});
|
||||
|
||||
it('.indexOf', function () {
|
||||
assert.indexOf('abcabd', 'ab', 0);
|
||||
assert.indexOf('abcabd', 'ca', 2);
|
||||
assert.indexOf('ababab', 'ba', 1);
|
||||
assert.indexOf('ababab', 'ba', 1);
|
||||
'ababab'.indexOf('ba', 1).should.be.true;
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+9
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for chai-string 1.1.4
|
||||
// Type definitions for chai-string 1.4.0
|
||||
// Project: https://github.com/onechiporenko/chai-string
|
||||
// Definitions by: Nick Malaguti <https://github.com/nmalaguti>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -14,10 +14,13 @@ declare global {
|
||||
endWith(expected: string, message?: string): Assertion;
|
||||
equalIgnoreCase(expected: string, message?: string): Assertion;
|
||||
equalIgnoreSpaces(expected: string, message?: string): Assertion;
|
||||
containIgnoreCase(expected: string, msg?: string): Assertion;
|
||||
containIgnoreSpaces(expected: string, msg?: string): Assertion;
|
||||
singleLine(message?: string): Assertion;
|
||||
reverseOf(message?: string): Assertion;
|
||||
palindrome(message?: string): Assertion;
|
||||
entriesCount(substr: string, expected: number, message?: string): Assertion;
|
||||
indexOf(str: string, substr: string, index: number, msg?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Assert {
|
||||
@@ -29,6 +32,10 @@ declare global {
|
||||
notEqualIgnoreCase(val: string, exp: string, msg?: string): void;
|
||||
equalIgnoreSpaces(val: string, exp: string, msg?: string): void;
|
||||
notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void;
|
||||
containIgnoreCase(val: string, exp: string, msg?: string): void;
|
||||
notContainIgnoreCase(val: string, exp: string, msg?: string): void;
|
||||
containIgnoreSpaces(val: string, exp: string, msg?: string): void;
|
||||
notContainIgnoreSpaces(val: string, exp: string, msg?: string): void;
|
||||
singleLine(val: string, msg?: string): void;
|
||||
notSingleLine(val: string, msg?: string): void;
|
||||
reverseOf(val: string, exp: string, msg?: string): void;
|
||||
@@ -36,6 +43,7 @@ declare global {
|
||||
palindrome(val: string, msg?: string): void;
|
||||
notPalindrome(val: string, msg?: string): void;
|
||||
entriesCount(str: string, substr: string, count: number, msg?: string): void;
|
||||
indexOf(str: string, substr: string, index: number, msg?: string): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for conf 1.1
|
||||
// Type definitions for conf 1.4
|
||||
// Project: https://github.com/sindresorhus/conf
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
@@ -24,6 +24,7 @@ declare class Conf<T = any> implements Iterable<[string, T]> {
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+15
@@ -488,6 +488,21 @@ declare class cropperjs {
|
||||
*/
|
||||
rotateTo(degree: number): void;
|
||||
|
||||
/**
|
||||
* Scale the image.
|
||||
*/
|
||||
scale(scaleX: number, scaleY?: number): void;
|
||||
|
||||
/**
|
||||
* Scale the abscissa of the image.
|
||||
*/
|
||||
scaleX(scaleX: number): void;
|
||||
|
||||
/**
|
||||
* Scale the ordinate of the image.
|
||||
*/
|
||||
scaleY(scaleY: number): void;
|
||||
|
||||
/**
|
||||
* Clear the crop box.
|
||||
*/
|
||||
|
||||
+158
-176
@@ -1,6 +1,12 @@
|
||||
import * as assert from "power-assert";
|
||||
import { setWorldConstructor, defineParameterType, After, AfterAll, Before, BeforeAll, Given, When, Then } from "cucumber";
|
||||
import cucumber = require("cucumber");
|
||||
|
||||
type Callback = cucumber.CallbackStepDefinition;
|
||||
type Table = cucumber.TableDefinition;
|
||||
type HookScenarioResult = cucumber.HookScenarioResult;
|
||||
const Status = cucumber.Status;
|
||||
|
||||
// You can optionally declare your own world properties
|
||||
declare module "cucumber" {
|
||||
interface World {
|
||||
@@ -8,190 +14,166 @@ declare module "cucumber" {
|
||||
}
|
||||
}
|
||||
|
||||
function StepSample() {
|
||||
type Callback = cucumber.CallbackStepDefinition;
|
||||
type Table = cucumber.TableDefinition;
|
||||
type HookScenarioResult = cucumber.HookScenarioResult;
|
||||
const Status = cucumber.Status;
|
||||
|
||||
cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => {
|
||||
setWorldConstructor(function({attach, parameters}) {
|
||||
this.attach = attach;
|
||||
this.parameters = parameters;
|
||||
this.visit = (url: string, callback: Callback) => {
|
||||
callback(null, 'pending');
|
||||
};
|
||||
});
|
||||
|
||||
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll((callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll('@tag', (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
|
||||
if (scenarioResult.result.status === Status.FAILED) {
|
||||
runScenario(null, () => {
|
||||
console.log('finish tasks');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
After((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll((callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll({ timeout: 1000 }, (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll('@tag', (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
registerHandler('AfterFeatures', (event: any, callback: () => void) => {
|
||||
callback();
|
||||
});
|
||||
|
||||
Given(/^a variable set to (\d+)$/, (x: string) => {
|
||||
console.log("the number is: " + x);
|
||||
});
|
||||
|
||||
Given(/^a variable set to (\d+)$/, (x: number) => {
|
||||
console.log(typeof x);
|
||||
});
|
||||
|
||||
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
|
||||
this.visit('https://github.com/cucumber/cucumber-js', callback);
|
||||
});
|
||||
|
||||
When(/^I go to the README file$/, (title: string, callback: Callback) => {
|
||||
function StepSampleWithoutDefineSupportCode() {
|
||||
setWorldConstructor(function({attach, parameters}) {
|
||||
this.attach = attach;
|
||||
this.parameters = parameters;
|
||||
this.visit = (url: string, callback: Callback) => {
|
||||
callback(null, 'pending');
|
||||
});
|
||||
|
||||
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
|
||||
const pageTitle = this.browser.text('title');
|
||||
|
||||
if (title === pageTitle) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("Expected to be on page with title " + title));
|
||||
}
|
||||
});
|
||||
|
||||
// Type for data_table.js on
|
||||
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
|
||||
|
||||
Given(/^a table step with Table raw$/, (table: Table) => {
|
||||
const expected = [
|
||||
['Cucumber', 'Cucumis sativus'],
|
||||
['Burr Gherkin', 'Cucumis anguria']
|
||||
];
|
||||
const actual: string[][] = table.raw();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step with Table rows$/, (table: Table) => {
|
||||
const expected = [
|
||||
['Apricot', '5'],
|
||||
['Brocolli', '2'],
|
||||
['Cucumber', '10']
|
||||
];
|
||||
const actual: string[][] = table.rows();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step with Table rowHash$/, (table: Table) => {
|
||||
const expected = {
|
||||
Cucumber: 'Cucumis sativus',
|
||||
'Burr Gherkin': 'Cucumis anguria'
|
||||
};
|
||||
const actual: { [firstCol: string]: string } = table.rowsHash();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step$/, (table: Table) => {
|
||||
const expected = [
|
||||
{Vegetable: 'Apricot', Rating: '5'},
|
||||
{Vegetable: 'Brocolli', Rating: '2'},
|
||||
{Vegetable: 'Cucumber', Rating: '10'}
|
||||
];
|
||||
const actual: Array<{ [colName: string]: string }> = table.hashes();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
defineParameterType({
|
||||
regexp: /particular/,
|
||||
transformer: s => s.toUpperCase(),
|
||||
typeName: 'param' // deprecated but still supported
|
||||
});
|
||||
|
||||
defineParameterType({
|
||||
regexp: /particularly/,
|
||||
transformer: s => s.toUpperCase(),
|
||||
name: 'param'
|
||||
});
|
||||
|
||||
Given('a {param} step', param => {
|
||||
assert.equal(param, 'PARTICULAR');
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns();
|
||||
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
cucumber.clearSupportCodeFns();
|
||||
}
|
||||
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
function registerListener(): cucumber.EventListener {
|
||||
const listener = Object.assign(cucumber.Listener(), {
|
||||
handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => {
|
||||
// do some interesting stuff ...
|
||||
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll((callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll('@tag', (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
After((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll((callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll({ timeout: 1000 }, (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll('@tag', (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
Given(/^a variable set to (\d+)$/, (x: string) => {
|
||||
console.log("the number is: " + x);
|
||||
});
|
||||
|
||||
Given(/^a variable set to (\d+)$/, (x: number) => {
|
||||
console.log(typeof x);
|
||||
});
|
||||
|
||||
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
|
||||
this.visit('https://github.com/cucumber/cucumber-js', callback);
|
||||
});
|
||||
|
||||
When(/^I go to the README file$/, (title: string, callback: Callback) => {
|
||||
callback(null, 'pending');
|
||||
});
|
||||
|
||||
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
|
||||
const pageTitle = this.browser.text('title');
|
||||
|
||||
if (title === pageTitle) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("Expected to be on page with title " + title));
|
||||
}
|
||||
});
|
||||
|
||||
return listener;
|
||||
// Type for data_table.js on
|
||||
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
|
||||
|
||||
Given(/^a table step with Table raw$/, (table: Table) => {
|
||||
const expected = [
|
||||
['Cucumber', 'Cucumis sativus'],
|
||||
['Burr Gherkin', 'Cucumis anguria']
|
||||
];
|
||||
const actual: string[][] = table.raw();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step with Table rows$/, (table: Table) => {
|
||||
const expected = [
|
||||
['Apricot', '5'],
|
||||
['Brocolli', '2'],
|
||||
['Cucumber', '10']
|
||||
];
|
||||
const actual: string[][] = table.rows();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step with Table rowHash$/, (table: Table) => {
|
||||
const expected = {
|
||||
Cucumber: 'Cucumis sativus',
|
||||
'Burr Gherkin': 'Cucumis anguria'
|
||||
};
|
||||
const actual: { [firstCol: string]: string } = table.rowsHash();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step$/, (table: Table) => {
|
||||
const expected = [
|
||||
{Vegetable: 'Apricot', Rating: '5'},
|
||||
{Vegetable: 'Brocolli', Rating: '2'},
|
||||
{Vegetable: 'Cucumber', Rating: '10'}
|
||||
];
|
||||
const actual: Array<{ [colName: string]: string }> = table.hashes();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
defineParameterType({
|
||||
regexp: /particular/,
|
||||
transformer: s => s.toUpperCase(),
|
||||
typeName: 'param' // deprecated but still supported
|
||||
});
|
||||
|
||||
defineParameterType({
|
||||
regexp: /particularly/,
|
||||
transformer: s => s.toUpperCase(),
|
||||
name: 'param',
|
||||
preferForRegexpMatch: false,
|
||||
useForSnippets: false
|
||||
});
|
||||
|
||||
Given('a {param} step', param => {
|
||||
assert.equal(param, 'PARTICULAR');
|
||||
});
|
||||
}
|
||||
|
||||
// syntax defineSupportCode deprecated
|
||||
function StepSample() {
|
||||
cucumber.defineSupportCode((l) => {
|
||||
});
|
||||
}
|
||||
|
||||
const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns();
|
||||
cucumber.clearSupportCodeFns();
|
||||
|
||||
Vendored
+26
-7
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cucumber-js 3.2
|
||||
// Type definitions for cucumber-js 4.0
|
||||
// Project: https://github.com/cucumber/cucumber-js
|
||||
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
|
||||
// Jan Molak <https://github.com/jan-molak>
|
||||
@@ -49,6 +49,29 @@ export interface StepDefinitions {
|
||||
setDefaultTimeout(time: number): void;
|
||||
}
|
||||
|
||||
export function After(code: HookCode): void;
|
||||
export function After(options: HookOptions | string, code: HookCode): void;
|
||||
export function AfterAll(code: GlobalHookCode): void;
|
||||
export function AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
export function Before(code: HookCode): void;
|
||||
export function Before(options: HookOptions | string, code: HookCode): void;
|
||||
export function BeforeAll(code: GlobalHookCode): void;
|
||||
export function BeforeAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
|
||||
export function defineParameterType(transform: Transform): void;
|
||||
export function defineStep(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
|
||||
export function Given(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
export function Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
|
||||
export function setDefaultTimeout(time: number): void;
|
||||
export function setDefinitionFunctionWrapper(fn: () => void, options?: {[key: string]: any}): void;
|
||||
// tslint:disable-next-line ban-types
|
||||
export function setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void;
|
||||
export function Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
|
||||
export function Then(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
export function When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
|
||||
export function When(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
|
||||
export interface HookScenarioResult {
|
||||
sourceLocation: SourceLocation;
|
||||
result: ScenarioResult;
|
||||
@@ -98,12 +121,11 @@ export namespace pickle {
|
||||
export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void;
|
||||
export type GlobalHookCode = (callback?: CallbackStepDefinition) => void;
|
||||
|
||||
// tslint:disable-next-line ban-types
|
||||
export type AroundCode = (scenario: HookScenarioResult, runScenario?: (error: string, callback?: Function) => void) => void;
|
||||
|
||||
export interface Transform {
|
||||
regexp: RegExp;
|
||||
transformer(arg: string): any;
|
||||
useForSnippets?: boolean;
|
||||
preferForRegexpMatch?: boolean;
|
||||
name?: string;
|
||||
typeName?: string; // deprecated
|
||||
}
|
||||
@@ -122,12 +144,9 @@ export interface Hooks {
|
||||
After(options: HookOptions | string, code: HookCode): void;
|
||||
AfterAll(code: GlobalHookCode): void;
|
||||
AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
Around(code: AroundCode): void;
|
||||
setDefaultTimeout(time: number): void;
|
||||
// tslint:disable-next-line ban-types
|
||||
setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void;
|
||||
registerHandler(handlerOption: string, code: (event: any, callback: CallbackStepDefinition) => void): void;
|
||||
registerListener(listener: EventListener): void;
|
||||
defineParameterType(transform: Transform): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
import * as assert from "power-assert";
|
||||
import cucumber = require("cucumber");
|
||||
|
||||
// You can optionally declare your own world properties
|
||||
declare module "cucumber" {
|
||||
interface World {
|
||||
visit(url: string, callback: CallbackStepDefinition): void;
|
||||
}
|
||||
}
|
||||
|
||||
function StepSample() {
|
||||
type Callback = cucumber.CallbackStepDefinition;
|
||||
type Table = cucumber.TableDefinition;
|
||||
type HookScenarioResult = cucumber.HookScenarioResult;
|
||||
const Status = cucumber.Status;
|
||||
|
||||
cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => {
|
||||
setWorldConstructor(function({attach, parameters}) {
|
||||
this.attach = attach;
|
||||
this.parameters = parameters;
|
||||
this.visit = (url: string, callback: Callback) => {
|
||||
callback(null, 'pending');
|
||||
};
|
||||
});
|
||||
|
||||
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll((callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll('@tag', (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
|
||||
if (scenarioResult.result.status === Status.FAILED) {
|
||||
runScenario(null, () => {
|
||||
console.log('finish tasks');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
After((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll((callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll({ timeout: 1000 }, (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll('@tag', (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
registerHandler('AfterFeatures', (event: any, callback: () => void) => {
|
||||
callback();
|
||||
});
|
||||
|
||||
Given(/^a variable set to (\d+)$/, (x: string) => {
|
||||
console.log("the number is: " + x);
|
||||
});
|
||||
|
||||
Given(/^a variable set to (\d+)$/, (x: number) => {
|
||||
console.log(typeof x);
|
||||
});
|
||||
|
||||
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
|
||||
this.visit('https://github.com/cucumber/cucumber-js', callback);
|
||||
});
|
||||
|
||||
When(/^I go to the README file$/, (title: string, callback: Callback) => {
|
||||
callback(null, 'pending');
|
||||
});
|
||||
|
||||
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
|
||||
const pageTitle = this.browser.text('title');
|
||||
|
||||
if (title === pageTitle) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("Expected to be on page with title " + title));
|
||||
}
|
||||
});
|
||||
|
||||
// Type for data_table.js on
|
||||
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
|
||||
|
||||
Given(/^a table step with Table raw$/, (table: Table) => {
|
||||
const expected = [
|
||||
['Cucumber', 'Cucumis sativus'],
|
||||
['Burr Gherkin', 'Cucumis anguria']
|
||||
];
|
||||
const actual: string[][] = table.raw();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step with Table rows$/, (table: Table) => {
|
||||
const expected = [
|
||||
['Apricot', '5'],
|
||||
['Brocolli', '2'],
|
||||
['Cucumber', '10']
|
||||
];
|
||||
const actual: string[][] = table.rows();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step with Table rowHash$/, (table: Table) => {
|
||||
const expected = {
|
||||
Cucumber: 'Cucumis sativus',
|
||||
'Burr Gherkin': 'Cucumis anguria'
|
||||
};
|
||||
const actual: { [firstCol: string]: string } = table.rowsHash();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
Given(/^a table step$/, (table: Table) => {
|
||||
const expected = [
|
||||
{Vegetable: 'Apricot', Rating: '5'},
|
||||
{Vegetable: 'Brocolli', Rating: '2'},
|
||||
{Vegetable: 'Cucumber', Rating: '10'}
|
||||
];
|
||||
const actual: Array<{ [colName: string]: string }> = table.hashes();
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
defineParameterType({
|
||||
regexp: /particular/,
|
||||
transformer: s => s.toUpperCase(),
|
||||
typeName: 'param' // deprecated but still supported
|
||||
});
|
||||
|
||||
defineParameterType({
|
||||
regexp: /particularly/,
|
||||
transformer: s => s.toUpperCase(),
|
||||
name: 'param'
|
||||
});
|
||||
|
||||
Given('a {param} step', param => {
|
||||
assert.equal(param, 'PARTICULAR');
|
||||
});
|
||||
});
|
||||
|
||||
const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns();
|
||||
|
||||
cucumber.clearSupportCodeFns();
|
||||
}
|
||||
|
||||
function registerListener(): cucumber.EventListener {
|
||||
const listener = Object.assign(cucumber.Listener(), {
|
||||
handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => {
|
||||
// do some interesting stuff ...
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
|
||||
return listener;
|
||||
}
|
||||
Vendored
+311
@@ -0,0 +1,311 @@
|
||||
// Type definitions for cucumber-js 3.2
|
||||
// Project: https://github.com/cucumber/cucumber-js
|
||||
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
|
||||
// Jan Molak <https://github.com/jan-molak>
|
||||
// Isaiah Soung <https://github.com/isoung>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// ErikSchierboom <https://github.com/ErikSchierboom>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export enum Status {
|
||||
AMBIGUOUS = "ambiguous",
|
||||
FAILED = "failed",
|
||||
PASSED = "passed",
|
||||
PENDING = "pending",
|
||||
SKIPPED = "skipped",
|
||||
UNDEFINED = "undefined"
|
||||
}
|
||||
|
||||
export interface World {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface CallbackStepDefinition {
|
||||
pending(): PromiseLike<any>;
|
||||
(error?: any, pending?: string): void;
|
||||
}
|
||||
|
||||
export interface TableDefinition {
|
||||
raw(): string[][];
|
||||
rows(): string[][];
|
||||
rowsHash(): { [firstCol: string]: string };
|
||||
hashes(): Array<{ [colName: string]: string }>;
|
||||
}
|
||||
|
||||
export type StepDefinitionCode = (this: World, ...stepArgs: any[]) => any;
|
||||
|
||||
export interface StepDefinitionOptions {
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export interface StepDefinitions {
|
||||
Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
|
||||
Given(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
|
||||
When(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
|
||||
Then(pattern: RegExp | string, code: StepDefinitionCode): void;
|
||||
setDefaultTimeout(time: number): void;
|
||||
}
|
||||
|
||||
export interface HookScenarioResult {
|
||||
sourceLocation: SourceLocation;
|
||||
result: ScenarioResult;
|
||||
pickle: pickle.Pickle;
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
line: number;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface ScenarioResult {
|
||||
duration: number;
|
||||
status: Status;
|
||||
}
|
||||
|
||||
export namespace pickle {
|
||||
interface Pickle {
|
||||
language: string;
|
||||
locations: Location[];
|
||||
name: string;
|
||||
steps: Step[];
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
interface Location {
|
||||
column: number;
|
||||
line: number;
|
||||
}
|
||||
|
||||
interface Step {
|
||||
arguments: Argument[];
|
||||
locations: Location[];
|
||||
text: string;
|
||||
}
|
||||
|
||||
interface Argument {
|
||||
rows: Cell[];
|
||||
}
|
||||
|
||||
interface Cell {
|
||||
location: Location;
|
||||
value: string;
|
||||
}
|
||||
}
|
||||
|
||||
export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void;
|
||||
export type GlobalHookCode = (callback?: CallbackStepDefinition) => void;
|
||||
|
||||
// tslint:disable-next-line ban-types
|
||||
export type AroundCode = (scenario: HookScenarioResult, runScenario?: (error: string, callback?: Function) => void) => void;
|
||||
|
||||
export interface Transform {
|
||||
regexp: RegExp;
|
||||
transformer(arg: string): any;
|
||||
name?: string;
|
||||
typeName?: string; // deprecated
|
||||
}
|
||||
|
||||
export interface HookOptions {
|
||||
timeout?: number;
|
||||
tags?: any;
|
||||
}
|
||||
|
||||
export interface Hooks {
|
||||
Before(code: HookCode): void;
|
||||
Before(options: HookOptions | string, code: HookCode): void;
|
||||
BeforeAll(code: GlobalHookCode): void;
|
||||
BeforeAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
After(code: HookCode): void;
|
||||
After(options: HookOptions | string, code: HookCode): void;
|
||||
AfterAll(code: GlobalHookCode): void;
|
||||
AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
Around(code: AroundCode): void;
|
||||
setDefaultTimeout(time: number): void;
|
||||
// tslint:disable-next-line ban-types
|
||||
setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void;
|
||||
registerHandler(handlerOption: string, code: (event: any, callback: CallbackStepDefinition) => void): void;
|
||||
registerListener(listener: EventListener): void;
|
||||
defineParameterType(transform: Transform): void;
|
||||
}
|
||||
|
||||
export class EventListener {
|
||||
hear(event: events.Event, callback: () => void): void;
|
||||
hasHandlerForEvent(event: events.Event): boolean;
|
||||
buildHandlerNameForEvent(event: events.Event): string;
|
||||
getHandlerForEvent(event: events.Event): EventHook;
|
||||
buildHandlerName(shortName: string): string;
|
||||
setHandlerForEvent(shortName: string, handler: EventListener): void;
|
||||
}
|
||||
|
||||
export function Listener(): EventListener;
|
||||
|
||||
export namespace events {
|
||||
interface Event {
|
||||
name: string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface EventPayload {
|
||||
}
|
||||
|
||||
interface FeaturesPayload extends EventPayload {
|
||||
getFeatures(): any[]; // https://github.com/cucumber/cucumber-js/blob/dc698bf5bc10d591fa7adeec5fa21b2d90dc9679/lib/cucumber/runtime.js#L34
|
||||
}
|
||||
|
||||
interface FeaturesResultPayload extends EventPayload {
|
||||
duration: number;
|
||||
scenarioResults: any[];
|
||||
success: boolean;
|
||||
stepsResults: any[];
|
||||
strict: boolean;
|
||||
}
|
||||
|
||||
interface FeaturePayload extends EventPayload {
|
||||
description: string;
|
||||
keyword: string;
|
||||
line: number;
|
||||
name: string;
|
||||
tags: Tag[];
|
||||
uri: string;
|
||||
scenarios: Scenario[];
|
||||
}
|
||||
|
||||
interface ScenarioPayload extends EventPayload {
|
||||
feature: Feature;
|
||||
exception: Error;
|
||||
keyword: string;
|
||||
lines: number[];
|
||||
name: string;
|
||||
tags: Tag[];
|
||||
uri: string;
|
||||
line: number;
|
||||
description: string;
|
||||
steps: Step[];
|
||||
}
|
||||
|
||||
interface ScenarioResultPayload extends EventPayload {
|
||||
duration: any;
|
||||
failureException: Error;
|
||||
scenario: Scenario;
|
||||
status: Status;
|
||||
stepResults: any[];
|
||||
}
|
||||
|
||||
interface StepPayload extends EventPayload {
|
||||
arguments: any;
|
||||
line: number;
|
||||
name: string;
|
||||
scenario: Scenario;
|
||||
uri: string;
|
||||
isBackground: boolean;
|
||||
keyword: string;
|
||||
keywordType: string;
|
||||
}
|
||||
|
||||
interface StepResultPayload extends EventPayload {
|
||||
ambiguousStepDefinitions: any;
|
||||
attachments: any[];
|
||||
duration: any;
|
||||
failureException: Error;
|
||||
step: Step;
|
||||
stepDefinition: StepDefinition;
|
||||
status: Status;
|
||||
}
|
||||
}
|
||||
|
||||
export interface StepDefinition {
|
||||
// tslint:disable-next-line ban-types
|
||||
code: Function;
|
||||
line: number;
|
||||
options: {};
|
||||
pattern: any;
|
||||
uri: string;
|
||||
}
|
||||
|
||||
export interface Tag {
|
||||
name: string;
|
||||
line: number;
|
||||
}
|
||||
|
||||
export interface Step {
|
||||
arguments: any;
|
||||
line: number;
|
||||
name: string;
|
||||
scenario: Scenario;
|
||||
uri: string;
|
||||
isBackground: boolean;
|
||||
keyword: string;
|
||||
keywordType: string;
|
||||
}
|
||||
|
||||
export interface Scenario {
|
||||
feature: Feature;
|
||||
exception: Error;
|
||||
keyword: string;
|
||||
lines: number[];
|
||||
name: string;
|
||||
tags: Tag[];
|
||||
uri: string;
|
||||
line: number;
|
||||
description: string;
|
||||
steps: Step[];
|
||||
}
|
||||
|
||||
export interface Feature {
|
||||
description: string;
|
||||
keyword: string;
|
||||
line: number;
|
||||
name: string;
|
||||
tags: Tag[];
|
||||
uri: string;
|
||||
scenarios: Scenario[];
|
||||
}
|
||||
|
||||
export type EventHook = (event: events.Event, callback?: () => void) => void;
|
||||
|
||||
export type SupportCodeConsumer = (stepDefinitions: StepDefinitions & Hooks) => void;
|
||||
|
||||
export function defineSupportCode(consumer: SupportCodeConsumer): void;
|
||||
|
||||
export function getSupportCodeFns(): SupportCodeConsumer[];
|
||||
|
||||
export function clearSupportCodeFns(): void;
|
||||
|
||||
// https://github.com/cucumber/cucumber-js/commit/231183a8a11c985ef7ced1155b7a75f5120a34b6
|
||||
export class Formatter {
|
||||
constructor(options?: any);
|
||||
|
||||
log(data: any): void;
|
||||
}
|
||||
|
||||
export class SummaryFormatter extends Formatter {
|
||||
indent(text: string, numberOfSpaces: number): any;
|
||||
}
|
||||
|
||||
export class PrettyFormatter extends SummaryFormatter {
|
||||
formatTags(tags: Tag[]): any;
|
||||
logIndented(text: string, level: number): void;
|
||||
logStepResult(stepResult: any): void;
|
||||
}
|
||||
|
||||
export class ProgressFormatter extends SummaryFormatter {
|
||||
}
|
||||
|
||||
export class RerunFormatter extends Formatter {
|
||||
}
|
||||
|
||||
export class SnippetsFormatter extends Formatter {
|
||||
}
|
||||
|
||||
export class UsageFormatter extends Formatter {
|
||||
}
|
||||
|
||||
export class UsageJsonFormatter extends Formatter {
|
||||
}
|
||||
|
||||
export class JsonFormatter extends Formatter {
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": false,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"cucumber": [
|
||||
"cucumber/v3"
|
||||
],
|
||||
"cucumber/*": [
|
||||
"cucumber/v3/*"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cucumber-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"no-any-union": false,
|
||||
"rules": {
|
||||
"no-any-union": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import * as d3Fetch from 'd3-fetch';
|
||||
import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv';
|
||||
|
||||
interface MyType {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const url = 'foo.bar';
|
||||
|
||||
const init: RequestInit = {};
|
||||
|
||||
let p1: Promise<Blob> = d3Fetch.blob(url);
|
||||
p1 = d3Fetch.blob(url, init);
|
||||
let p2: Promise<ArrayBuffer> = d3Fetch.buffer(url);
|
||||
p2 = d3Fetch.buffer(url, init);
|
||||
let p3: Promise<HTMLImageElement> = d3Fetch.image(url);
|
||||
p3 = d3Fetch.image(url, init);
|
||||
let p4: Promise<any> = d3Fetch.json(url);
|
||||
p4 = d3Fetch.json(url, init);
|
||||
|
||||
let myString: Promise<string>;
|
||||
myString = d3Fetch.text(url);
|
||||
myString = d3Fetch.text(url, init);
|
||||
|
||||
const parseRow = (d: {}) => {
|
||||
const myType: MyType = { foo: 'foo' };
|
||||
return myType;
|
||||
};
|
||||
let promise2: Promise<DSVParsedArray<MyType>>;
|
||||
promise2 = d3Fetch.csv<MyType>(url);
|
||||
promise2 = d3Fetch.csv<MyType>(url, init);
|
||||
promise2 = d3Fetch.csv<MyType>(url, init, parseRow);
|
||||
promise2 = d3Fetch.dsv<MyType>(';', url);
|
||||
promise2 = d3Fetch.dsv<MyType>(';', url, init);
|
||||
promise2 = d3Fetch.dsv<MyType>(';', url, init, parseRow);
|
||||
promise2 = d3Fetch.tsv<MyType>(url);
|
||||
promise2 = d3Fetch.tsv<MyType>(url, init);
|
||||
promise2 = d3Fetch.tsv<MyType>(url, init, parseRow);
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for d3-fetch 1.0
|
||||
// Project: https://d3js.org/d3-fetch/
|
||||
// Definitions by: Hugues Stefanski <https://github.com/ledragon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv';
|
||||
|
||||
/** Fetches the binary file at the specified input URL as a Blob. If init is specified, it is passed along to the underlying call to fetch. */
|
||||
export function blob(url: string, init?: RequestInit): Promise<Blob>;
|
||||
/** Fetches the binary file at the specified input URL as an ArrayBuffer. If init is specified, it is passed along to the underlying call to fetch. */
|
||||
export function buffer(url: string, init?: RequestInit): Promise<ArrayBuffer>;
|
||||
|
||||
/** Equivalent to d3.dsv with the comma character as the delimiter. */
|
||||
export function csv<ParsedRow extends DSVRowAny>(
|
||||
url: string,
|
||||
init?: RequestInit,
|
||||
row?: (d: DSVRowAny) => ParsedRow
|
||||
): Promise<DSVParsedArray<ParsedRow>>;
|
||||
|
||||
/** Fetches the DSV file at the specified input URL. */
|
||||
export function dsv<ParsedRow extends DSVRowAny>(
|
||||
delimiter: string,
|
||||
url: string,
|
||||
init?: RequestInit,
|
||||
row?: (d: DSVRowAny) => ParsedRow
|
||||
): Promise<DSVParsedArray<ParsedRow>>;
|
||||
|
||||
/** Fetches the image at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */
|
||||
export function image(url: string, init?: RequestInit): Promise<HTMLImageElement>;
|
||||
|
||||
/** Fetches the json file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */
|
||||
export function json(url: string, init?: RequestInit): Promise<{}>;
|
||||
|
||||
/** Fetches the text file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */
|
||||
export function text(url: string, init?: RequestInit): Promise<string>;
|
||||
|
||||
/** Equivalent to d3.dsv with the tab character as the delimiter. */
|
||||
export function tsv<ParsedRow extends DSVRowAny>(
|
||||
url: string,
|
||||
init?: RequestInit,
|
||||
row?: (d: DSVRowAny) => ParsedRow
|
||||
): Promise<DSVParsedArray<ParsedRow>>;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"d3-fetch-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+47
-48
@@ -2,6 +2,7 @@
|
||||
// Project: http://echarts.baidu.com/
|
||||
// Definitions by: Xie Jingyang <https://github.com/xieisabug>, AntiMoron <https://github.com/AntiMoron>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace echarts {
|
||||
function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: {
|
||||
@@ -9,13 +10,13 @@ declare namespace echarts {
|
||||
renderer?: string
|
||||
}): ECharts;
|
||||
|
||||
const graphic: {
|
||||
const graphic: Graphic;
|
||||
|
||||
interface Graphic {
|
||||
clipPointsByRect(points: number[][], rect: ERectangle): number[][];
|
||||
clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle;
|
||||
LinearGradient: { new (x: number, y: number, x2: number, y2: number, colorStops: Array<Object>, globalCoord?: boolean): LinearGradient }
|
||||
|
||||
};
|
||||
|
||||
LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: Array<Object>, globalCoord?: boolean): LinearGradient }
|
||||
}
|
||||
|
||||
function connect(group: string | Array<string>): void;
|
||||
|
||||
@@ -29,6 +30,15 @@ declare namespace echarts {
|
||||
|
||||
function registerTheme(themeName: string, theme: Object): void;
|
||||
|
||||
interface MapObj {
|
||||
/** geoJson data for map */
|
||||
geoJson: object,
|
||||
/** special areas fro map */
|
||||
specialAreas: object
|
||||
}
|
||||
|
||||
function getMap(mapName: string): MapObj;
|
||||
|
||||
interface LinearGradient {
|
||||
colorStops: Array<Object>;
|
||||
global: boolean;
|
||||
@@ -39,9 +49,8 @@ declare namespace echarts {
|
||||
y2: number
|
||||
}
|
||||
|
||||
|
||||
interface ECharts {
|
||||
group: string;
|
||||
group: string
|
||||
|
||||
setOption(option: EChartOption, notMerge?: boolean, notRefreshImmediately?: boolean): void
|
||||
|
||||
@@ -66,20 +75,20 @@ declare namespace echarts {
|
||||
hideLoading(): void
|
||||
|
||||
getDataURL(opts: {
|
||||
// 导出的格式,可选 png, jpeg
|
||||
/** 导出的格式,可选 png, jpeg */
|
||||
type?: string,
|
||||
// 导出的图片分辨率比例,默认为 1。
|
||||
/** 导出的图片分辨率比例,默认为 1。*/
|
||||
pixelRatio?: number,
|
||||
// 导出的图片背景色,默认使用 option 里的 backgroundColor
|
||||
/** 导出的图片背景色,默认使用 option 里的 backgroundColor */
|
||||
backgroundColor?: string
|
||||
}): string
|
||||
|
||||
getConnectedDataURL(opts: {
|
||||
// 导出的格式,可选 png, jpeg
|
||||
/** 导出的格式,可选 png, jpeg */
|
||||
type: string,
|
||||
// 导出的图片分辨率比例,默认为 1。
|
||||
/** 导出的图片分辨率比例,默认为 1。 */
|
||||
pixelRatio: number,
|
||||
// 导出的图片背景色,默认使用 option 里的 backgroundColor
|
||||
/** 导出的图片背景色,默认使用 option 里的 backgroundColor */
|
||||
backgroundColor: string
|
||||
}): string
|
||||
|
||||
@@ -89,42 +98,32 @@ declare namespace echarts {
|
||||
|
||||
dispose(): void
|
||||
|
||||
// 转换逻辑点到像素
|
||||
convertToPixel(finder: {
|
||||
seriesIndex?: number,
|
||||
seriesId?: string,
|
||||
seriesName?: string,
|
||||
geoIndex?: number,
|
||||
geoId?: string,
|
||||
geoName?: string,
|
||||
xAxisIndex?: number,
|
||||
xAxisId?: string,
|
||||
xAxisName?: string,
|
||||
yAxisIndex?: number,
|
||||
yAxisId?: string,
|
||||
yAxisName?: string,
|
||||
gridIndex?: number,
|
||||
gridId?: string
|
||||
gridName?: string
|
||||
} | string, value: string | Array<any>): string | Array<any>
|
||||
/** 转换逻辑点到像素 */
|
||||
convertToPixel(finder: ConvertFinder | string, value: string | Array<any>): string | Array<any>
|
||||
|
||||
convertFromPixel(finder: {
|
||||
seriesIndex?: number,
|
||||
seriesId?: string,
|
||||
seriesName?: string,
|
||||
geoIndex?: number,
|
||||
geoId?: string,
|
||||
geoName?: string,
|
||||
xAxisIndex?: number,
|
||||
xAxisId?: string,
|
||||
xAxisName?: string,
|
||||
yAxisIndex?: number,
|
||||
yAxisId?: string,
|
||||
yAxisName?: string,
|
||||
gridIndex?: number,
|
||||
gridId?: string
|
||||
gridName?: string
|
||||
} | string, value: Array<any> | string): Array<any> | string
|
||||
convertFromPixel(finder: ConvertFinder | string, value: Array<any> | string): Array<any> | string
|
||||
|
||||
containPixel(finder: ConvertFinder | string,
|
||||
/** 要被判断的点,为像素坐标值,以 echarts 实例的 dom 节点的左上角为坐标 [0, 0] 点。*/
|
||||
value: any[]): boolean
|
||||
}
|
||||
|
||||
interface ConvertFinder {
|
||||
seriesIndex?: number,
|
||||
seriesId?: string,
|
||||
seriesName?: string,
|
||||
geoIndex?: number,
|
||||
geoId?: string,
|
||||
geoName?: string,
|
||||
xAxisIndex?: number,
|
||||
xAxisId?: string,
|
||||
xAxisName?: string,
|
||||
yAxisIndex?: number,
|
||||
yAxisId?: string,
|
||||
yAxisName?: string,
|
||||
gridIndex?: number,
|
||||
gridId?: string
|
||||
gridName?: string
|
||||
}
|
||||
|
||||
interface ERectangle {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import * as ed2curve from 'ed2curve';
|
||||
import * as nacl from 'tweetnacl';
|
||||
|
||||
const myKeyPair = nacl.sign.keyPair();
|
||||
|
||||
const newPublicKey = ed2curve.convertPublicKey(myKeyPair.publicKey);
|
||||
const newSecretKey = ed2curve.convertSecretKey(myKeyPair.secretKey);
|
||||
|
||||
const newKeyPair = ed2curve.convertKeyPair(myKeyPair);
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for ed2curve 0.2
|
||||
// Project: https://github.com/dchest/ed2curve-js
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
export as namespace ed2curve;
|
||||
|
||||
export type Ed25519PublicKey = Uint8Array;
|
||||
export type Ed25519SecretKey = Uint8Array;
|
||||
export type Curve25519PublicKey = Uint8Array;
|
||||
export type Curve25519SecretKey = Uint8Array;
|
||||
|
||||
export interface Ed25519KeyPair {
|
||||
publicKey: Ed25519PublicKey;
|
||||
secretKey: Ed25519SecretKey;
|
||||
}
|
||||
|
||||
export interface Curve25519KeyPair {
|
||||
publicKey: Curve25519PublicKey;
|
||||
secretKey: Curve25519SecretKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Ed25519 public key to Curve25519 public key.
|
||||
* montgomeryX = (edwardsY + 1)*inverse(1 - edwardsY) mod p
|
||||
*/
|
||||
export function convertPublicKey(publicKey: Ed25519PublicKey): Curve25519PublicKey | null;
|
||||
|
||||
/** Converts Ed25519 secret key to Curve25519 secret key. */
|
||||
export function convertSecretKey(secretKey: Ed25519SecretKey): Curve25519SecretKey | null;
|
||||
|
||||
/** Converts Ed25519 key pair to Curve25519 key pair. */
|
||||
export function convertKeyPair(keyPair: Ed25519KeyPair): Curve25519KeyPair;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ed2curve-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,8 +1,16 @@
|
||||
import * as packager from "electron-packager";
|
||||
|
||||
function callback(err: Error, appPath: string) {
|
||||
function callback(err: Error, appPaths: string[]) {
|
||||
const msg = err.message;
|
||||
const index = appPath.indexOf("test");
|
||||
const index = appPaths.indexOf("test");
|
||||
}
|
||||
|
||||
function completeFunction(buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) {
|
||||
callbackFn();
|
||||
}
|
||||
|
||||
function ignoreFunction(path: string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
packager({
|
||||
@@ -10,20 +18,38 @@ packager({
|
||||
name: "myapplication",
|
||||
platform: "win32",
|
||||
arch: "all",
|
||||
electronVersion: "0.34.0"
|
||||
electronVersion: "0.34.0",
|
||||
win32metadata: {
|
||||
CompanyName: "Acme CO",
|
||||
FileDescription: "My application",
|
||||
OriginalFilename: "myapp.exe",
|
||||
ProductName: "Application",
|
||||
InternalName: "roadrunner",
|
||||
"requested-execution-level": "highestAvailable",
|
||||
"application-manifest": "manifest.xml"
|
||||
}
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
electronVersion: "0.34.0",
|
||||
all: true
|
||||
all: true,
|
||||
win32metadata: {
|
||||
CompanyName: "Acme CO",
|
||||
FileDescription: "My application",
|
||||
OriginalFilename: "myapp.exe",
|
||||
ProductName: "Application",
|
||||
InternalName: "roadrunner",
|
||||
"requested-execution-level": "requireAdministrator",
|
||||
"application-manifest": "manifest.xml"
|
||||
}
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
platform: "win32",
|
||||
platform: "all",
|
||||
arch: "all",
|
||||
electronVersion: "0.34.0"
|
||||
}, callback);
|
||||
@@ -34,3 +60,136 @@ packager({
|
||||
electronVersion: "0.34.0",
|
||||
all: true
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
electronVersion: "0.34.0",
|
||||
arch: "arm64",
|
||||
executableName: "myapp"
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
afterCopy: [
|
||||
completeFunction
|
||||
],
|
||||
afterExtract: [
|
||||
completeFunction
|
||||
],
|
||||
afterPrune: [
|
||||
completeFunction
|
||||
],
|
||||
appCopyright: "Copyright",
|
||||
appVersion: "1.0",
|
||||
arch: "ia32",
|
||||
asar: false,
|
||||
buildVersion: "1.2.3",
|
||||
derefSymlinks: true,
|
||||
download: {
|
||||
cache: "./zips",
|
||||
mirror: "https://10.1.2.105/",
|
||||
quiet: true,
|
||||
strictSSL: true
|
||||
},
|
||||
extraResource: "foo.js",
|
||||
icon: "foo.ico",
|
||||
ignore: /ab+c/,
|
||||
out: "out",
|
||||
overwrite: true,
|
||||
packageManager: false,
|
||||
prune: true,
|
||||
quiet: true,
|
||||
tmpdir: "/tmp",
|
||||
win32metadata: {
|
||||
CompanyName: "Acme CO",
|
||||
FileDescription: "My application",
|
||||
OriginalFilename: "myapp.exe",
|
||||
ProductName: "Application",
|
||||
InternalName: "roadrunner",
|
||||
"requested-execution-level": "asInvoker",
|
||||
"application-manifest": "manifest.xml"
|
||||
}
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
arch: "x64",
|
||||
asar: true,
|
||||
derefSymlinks: false,
|
||||
download: {
|
||||
cache: "./zips",
|
||||
mirror: "https://10.1.2.105/",
|
||||
quiet: false,
|
||||
strictSSL: true
|
||||
},
|
||||
extraResource: [
|
||||
"foo.js",
|
||||
"bar.js"
|
||||
],
|
||||
ignore: [
|
||||
/ab+c/,
|
||||
new RegExp('abc')
|
||||
],
|
||||
overwrite: false,
|
||||
packageManager: "npm",
|
||||
platform: "darwin",
|
||||
prune: false,
|
||||
quiet: false,
|
||||
tmpdir: "false",
|
||||
appBundleId: "123456",
|
||||
appCategoryType: "public.app-category.developer-tools",
|
||||
extendInfo: "plist.txt",
|
||||
helperBundleId: "23223f",
|
||||
osxSign: true
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
arch: "armv7l",
|
||||
asar: {
|
||||
ordering: "order.txt",
|
||||
unpack: "*.js",
|
||||
unpackDir: "sub_dir"
|
||||
},
|
||||
download: {
|
||||
cache: "./zips",
|
||||
mirror: "https://10.1.2.105/",
|
||||
quiet: false,
|
||||
strictSSL: false
|
||||
},
|
||||
ignore: ignoreFunction,
|
||||
packageManager: "cnpm",
|
||||
platform: "linux"
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
arch: [
|
||||
"ia32",
|
||||
"x64"
|
||||
],
|
||||
download: {
|
||||
cache: "./zips",
|
||||
mirror: "https://10.1.2.105/",
|
||||
quiet: true,
|
||||
strictSSL: false
|
||||
},
|
||||
packageManager: "yarn",
|
||||
platform: "mas",
|
||||
extendInfo: {
|
||||
foo: "bar"
|
||||
},
|
||||
osxSign: {
|
||||
identity: "myidentity",
|
||||
entitlements: "path/to/my.entitlements",
|
||||
"entitlements-inherit": "path/to/inherit.entitlements"
|
||||
},
|
||||
protocols: [{
|
||||
name: "myappproto",
|
||||
schemes: [
|
||||
"myapp",
|
||||
"myapp2"
|
||||
]
|
||||
}]
|
||||
}, callback);
|
||||
|
||||
Vendored
+9
-4
@@ -1,7 +1,8 @@
|
||||
// Type definitions for electron-packager 8.7
|
||||
// Type definitions for electron-packager 10.1
|
||||
// Project: https://github.com/electron-userland/electron-packager
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Juan Jimenez-Anca <https://github.com/cortopy>
|
||||
// John Kleinschmidt <https://github.com/jkleinsc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -31,8 +32,8 @@ declare namespace electronPackager {
|
||||
|
||||
type ignoreFunction = (path: string) => boolean;
|
||||
type onCompleteFn = (buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) => void;
|
||||
type arch = "ia32" | "x64" | "armv7l" | "all";
|
||||
type packageManager = "npm" | "cnpm" | "yarn";
|
||||
type arch = "ia32" | "x64" | "armv7l" | "arm64" |"all";
|
||||
type packageManager = "npm" | "cnpm" | "yarn" | false;
|
||||
type platform = "linux" | "win32" | "darwin" | "mas" | "all";
|
||||
|
||||
interface AsarOptions {
|
||||
@@ -94,7 +95,7 @@ declare namespace electronPackager {
|
||||
* Arbitrary combinations of individual architectures are also supported via a comma-delimited string or array of strings.
|
||||
* The non-all values correspond to the architecture names used by Electron releases. This value is not restricted to the official set if download.mirror is set.
|
||||
*/
|
||||
arch?: arch;
|
||||
arch?: arch | arch[];
|
||||
/**
|
||||
* Whether to package the application's source code into an archive, using Electron's archive format
|
||||
*/
|
||||
@@ -120,6 +121,10 @@ declare namespace electronPackager {
|
||||
* One or more files to be copied directly into the app's Contents/Resources directory for OS X target platforms, and the resources directory for other target platforms.
|
||||
*/
|
||||
extraResource?: string | string[];
|
||||
/**
|
||||
* The name of the executable file, sans file extension. Defaults to the value for the name parameter
|
||||
*/
|
||||
executableName?: string;
|
||||
/**
|
||||
* The local path to the icon file, if the target platform supports setting embedding an icon.
|
||||
*/
|
||||
|
||||
Vendored
+46
-38
@@ -3284,7 +3284,7 @@ declare module 'ember' {
|
||||
|
||||
declare module '@ember/application' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Application;
|
||||
export default class Application extends Ember.Application { }
|
||||
export const getOwner: typeof Ember.getOwner;
|
||||
export const onLoad: typeof Ember.onLoad;
|
||||
export const runLoadHooks: typeof Ember.runLoadHooks;
|
||||
@@ -3299,22 +3299,23 @@ declare module '@ember/application/deprecations' {
|
||||
|
||||
declare module '@ember/application/globals-resolver' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.DefaultResolver;
|
||||
export default class GlobalsResolver extends Ember.DefaultResolver { }
|
||||
}
|
||||
|
||||
declare module '@ember/application/instance' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.ApplicationInstance;
|
||||
export default class ApplicationInstance extends Ember.ApplicationInstance { }
|
||||
}
|
||||
|
||||
declare module '@ember/application/resolver' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Resolver;
|
||||
export default class Resolver extends Ember.Resolver { }
|
||||
}
|
||||
|
||||
declare module '@ember/array' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Array;
|
||||
const EmberArray: typeof Ember.Array;
|
||||
export default EmberArray;
|
||||
export const A: typeof Ember.A;
|
||||
export const isArray: typeof Ember.isArray;
|
||||
export const makeArray: typeof Ember.makeArray;
|
||||
@@ -3322,43 +3323,44 @@ declare module '@ember/array' {
|
||||
|
||||
declare module '@ember/array/mutable' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.MutableArray;
|
||||
const MutableArray: typeof Ember.MutableArray;
|
||||
export default MutableArray;
|
||||
}
|
||||
|
||||
declare module '@ember/array/proxy' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.ArrayProxy;
|
||||
export default class ArrayProxy<T> extends Ember.ArrayProxy<T> { }
|
||||
}
|
||||
|
||||
declare module '@ember/component' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Component;
|
||||
export default class Component extends Ember.Component { }
|
||||
}
|
||||
|
||||
declare module '@ember/component/checkbox' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Checkbox;
|
||||
export default class Checkbox extends Ember.Checkbox { }
|
||||
}
|
||||
|
||||
declare module '@ember/component/helper' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Helper;
|
||||
export default class Helper extends Ember.Helper { }
|
||||
export const helper: typeof Ember.Helper.helper;
|
||||
}
|
||||
|
||||
declare module '@ember/component/text-area' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.TextArea;
|
||||
export default class TextArea extends Ember.TextArea { }
|
||||
}
|
||||
|
||||
declare module '@ember/component/text-field' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.TextField;
|
||||
export default class TextField extends Ember.TextField { }
|
||||
}
|
||||
|
||||
declare module '@ember/controller' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Controller;
|
||||
export default class Controller extends Ember.Controller { }
|
||||
export const inject: typeof Ember.inject.controller;
|
||||
}
|
||||
|
||||
@@ -3375,28 +3377,29 @@ declare module '@ember/debug' {
|
||||
|
||||
declare module '@ember/debug/container-debug-adapter' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.ContainerDebugAdapter;
|
||||
export default class ContainerDebugAdapter extends Ember.ContainerDebugAdapter { }
|
||||
}
|
||||
|
||||
declare module '@ember/debug/data-adapter' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.DataAdapter;
|
||||
export default class DataAdapter extends Ember.DataAdapter { }
|
||||
}
|
||||
|
||||
declare module '@ember/engine' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Engine;
|
||||
export default class Engine extends Ember.Engine { }
|
||||
export const getEngineParent: typeof Ember.getEngineParent;
|
||||
}
|
||||
|
||||
declare module '@ember/engine/instance' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.EngineInstance;
|
||||
export default class EngineInstance extends Ember.EngineInstance { }
|
||||
}
|
||||
|
||||
declare module '@ember/enumerable' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Enumerable;
|
||||
const Enumerable: typeof Ember.Enumerable;
|
||||
export default Enumerable;
|
||||
}
|
||||
|
||||
declare module '@ember/instrumentation' {
|
||||
@@ -3409,17 +3412,17 @@ declare module '@ember/instrumentation' {
|
||||
|
||||
declare module '@ember/map' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Map;
|
||||
export default class EmberMap extends Ember.Map { }
|
||||
}
|
||||
|
||||
declare module '@ember/map/with-default' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.MapWithDefault;
|
||||
export default class MapWithDefault extends Ember.MapWithDefault { }
|
||||
}
|
||||
|
||||
declare module '@ember/object' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Object;
|
||||
export default class EmberObject extends Ember.Object { }
|
||||
export const aliasMethod: typeof Ember.aliasMethod;
|
||||
export const computed: typeof Ember.computed;
|
||||
export const defineProperty: typeof Ember.defineProperty;
|
||||
@@ -3434,7 +3437,7 @@ declare module '@ember/object' {
|
||||
|
||||
declare module '@ember/object/computed' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.ComputedProperty;
|
||||
export default class ComputedProperty<T> extends Ember.ComputedProperty<T> { }
|
||||
export const alias: typeof Ember.computed.alias;
|
||||
export const and: typeof Ember.computed.and;
|
||||
export const bool: typeof Ember.computed.bool;
|
||||
@@ -3472,12 +3475,13 @@ declare module '@ember/object/computed' {
|
||||
|
||||
declare module '@ember/object/core' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.CoreObject;
|
||||
export default class CoreObject extends Ember.CoreObject { }
|
||||
}
|
||||
|
||||
declare module '@ember/object/evented' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Evented;
|
||||
const Evented: typeof Ember.Evented;
|
||||
export default Evented;
|
||||
export const on: typeof Ember.on;
|
||||
}
|
||||
|
||||
@@ -3497,12 +3501,14 @@ declare module '@ember/object/internals' {
|
||||
|
||||
declare module '@ember/object/mixin' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Mixin;
|
||||
const Mixin: typeof Ember.Mixin;
|
||||
export default Mixin;
|
||||
}
|
||||
|
||||
declare module '@ember/object/observable' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Observable;
|
||||
const Observable: typeof Ember.Observable;
|
||||
export default Observable;
|
||||
}
|
||||
|
||||
declare module '@ember/object/observers' {
|
||||
@@ -3513,12 +3519,13 @@ declare module '@ember/object/observers' {
|
||||
|
||||
declare module '@ember/object/promise-proxy-mixin' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.PromiseProxyMixin;
|
||||
const PromiseProxyMixin: typeof Ember.PromiseProxyMixin;
|
||||
export default PromiseProxyMixin;
|
||||
}
|
||||
|
||||
declare module '@ember/object/proxy' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.ObjectProxy;
|
||||
export default class ObjectProxy extends Ember.ObjectProxy { }
|
||||
}
|
||||
|
||||
declare module '@ember/polyfills' {
|
||||
@@ -3532,42 +3539,43 @@ declare module '@ember/polyfills' {
|
||||
|
||||
declare module '@ember/routing/auto-location' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.AutoLocation;
|
||||
export default class AutoLocation extends Ember.AutoLocation { }
|
||||
}
|
||||
|
||||
declare module '@ember/routing/hash-location' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.HashLocation;
|
||||
export default class HashLocation extends Ember.HashLocation { }
|
||||
}
|
||||
|
||||
declare module '@ember/routing/history-location' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.HistoryLocation;
|
||||
export default class HistoryLocation extends Ember.HistoryLocation { }
|
||||
}
|
||||
|
||||
declare module '@ember/routing/link-component' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.LinkComponent;
|
||||
export default class LinkComponent extends Ember.LinkComponent { }
|
||||
}
|
||||
|
||||
declare module '@ember/routing/location' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Location;
|
||||
const Location: typeof Ember.Location;
|
||||
export default Location;
|
||||
}
|
||||
|
||||
declare module '@ember/routing/none-location' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.NoneLocation;
|
||||
export default class NoneLocation extends Ember.NoneLocation { }
|
||||
}
|
||||
|
||||
declare module '@ember/routing/route' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Route;
|
||||
export default class Route extends Ember.Route { }
|
||||
}
|
||||
|
||||
declare module '@ember/routing/router' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Router;
|
||||
export default class EmberRouter extends Ember.Router { }
|
||||
}
|
||||
|
||||
declare module '@ember/runloop' {
|
||||
@@ -3589,7 +3597,7 @@ declare module '@ember/runloop' {
|
||||
|
||||
declare module '@ember/service' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Service;
|
||||
export default class Service extends Ember.Service { }
|
||||
export const inject: typeof Ember.inject.service;
|
||||
}
|
||||
|
||||
@@ -3619,7 +3627,7 @@ declare module '@ember/test' {
|
||||
|
||||
declare module '@ember/test/adapter' {
|
||||
import Ember from 'ember';
|
||||
export default Ember.Test.Adapter;
|
||||
export default class TestAdapter extends Ember.Test.Adapter { }
|
||||
}
|
||||
|
||||
declare module '@ember/utils' {
|
||||
|
||||
Vendored
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/expo/expo-sdk
|
||||
// Definitions by: Konstantin Kai <https://github.com/KonstantinKai>
|
||||
// Martynas Kadiša <https://github.com/martynaskadisa>
|
||||
// Sergio Sánchez <https://github.com/ssanchezmarc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -1213,7 +1214,7 @@ export namespace Notifications {
|
||||
type LocalNotificationId = string | number;
|
||||
|
||||
function addListener(listener: (notification: Notification) => any): EventSubscription;
|
||||
function getExponentPushTokenAsync(): Promise<string>;
|
||||
function getExpoPushTokenAsync(): Promise<string>;
|
||||
function presentLocalNotificationAsync(localNotification: LocalNotification): Promise<LocalNotificationId>;
|
||||
function scheduleLocalNotificationAsync(
|
||||
localNotification: LocalNotification,
|
||||
|
||||
Vendored
+29
-3
@@ -7,7 +7,8 @@
|
||||
import { Application as FeathersApplication } from '@feathersjs/feathers';
|
||||
import * as express from 'express';
|
||||
|
||||
export default function feathersExpress<T>(app: FeathersApplication<T>): express.Application & FeathersApplication<T>;
|
||||
export default function feathersExpress<T>(app: FeathersApplication<T>): Application<T>;
|
||||
export type Application<T> = express.Application & FeathersApplication<T>;
|
||||
|
||||
export function errorHandler(options?: any): express.ErrorRequestHandler;
|
||||
export function notFound(): express.RequestHandler;
|
||||
@@ -17,6 +18,31 @@ export const rest: {
|
||||
};
|
||||
|
||||
/*
|
||||
* Re-export of the express package. Can't be typed properly without just copying everything.
|
||||
* Re-export of the express package.
|
||||
**/
|
||||
export const original: any;
|
||||
|
||||
export {
|
||||
CookieOptions,
|
||||
Errback,
|
||||
ErrorRequestHandler,
|
||||
Express,
|
||||
Handler,
|
||||
IRoute,
|
||||
IRouter,
|
||||
IRouterHandler,
|
||||
IRouterMatcher,
|
||||
json,
|
||||
MediaType,
|
||||
NextFunction,
|
||||
Request,
|
||||
RequestHandler,
|
||||
RequestParamHandler,
|
||||
Response,
|
||||
Router,
|
||||
RouterOptions,
|
||||
Send,
|
||||
static,
|
||||
urlencoded
|
||||
} from 'express';
|
||||
|
||||
export const original: typeof express;
|
||||
|
||||
Vendored
+3
@@ -2,6 +2,9 @@
|
||||
// Project: http://feathersjs.com/
|
||||
// Definitions by: Jan Lohage <https://github.com/j2L4e>
|
||||
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="feathersjs__socket-commons"/>
|
||||
|
||||
// primus removed its typings from the repo https://github.com/primus/primus/pull/623, as of 01/2018 there are none on DT
|
||||
export default function feathersPrimus(options: any, callback?: (primus: any) => void): () => void;
|
||||
|
||||
+2
@@ -2,8 +2,10 @@
|
||||
// Project: http://feathersjs.com/
|
||||
// Definitions by: Jan Lohage <https://github.com/j2L4e>
|
||||
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="socket.io" />
|
||||
/// <reference types="feathersjs__socket-commons"/>
|
||||
|
||||
export default function feathersSocketIO(callback: (io: SocketIO.Server) => void): () => void;
|
||||
export default function feathersSocketIO(options: number | SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void;
|
||||
|
||||
Vendored
+1
@@ -161,5 +161,6 @@ export interface Feature<G extends GeometryObject, P = GeoJsonProperties> extend
|
||||
* https://tools.ietf.org/html/rfc7946#section-3.3
|
||||
*/
|
||||
export interface FeatureCollection<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject {
|
||||
type: "FeatureCollection";
|
||||
features: Array<Feature<G, P>>;
|
||||
}
|
||||
|
||||
Vendored
+3
-4
@@ -39,9 +39,8 @@ interface GoogleAnalytics {
|
||||
declare namespace UniversalAnalytics {
|
||||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
|
||||
|
||||
enum HitType {
|
||||
'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'
|
||||
}
|
||||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#hitType
|
||||
type HitType = 'pageview' | 'screenview' | 'event' | 'transaction' | 'item' | 'social' | 'exception' | 'timing';
|
||||
|
||||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
|
||||
|
||||
@@ -294,7 +293,7 @@ declare namespace UniversalAnalytics {
|
||||
flashVersion?: string;
|
||||
forceSSL?: boolean;
|
||||
hitCallback?(): void;
|
||||
hitType?: string;
|
||||
hitType?: HitType;
|
||||
hostname?: string;
|
||||
id?: string;
|
||||
javaEnabled?: boolean;
|
||||
|
||||
Vendored
+3
@@ -1,6 +1,9 @@
|
||||
declare namespace gsap {
|
||||
export interface TweenConfig {
|
||||
|
||||
/** Any tweenable property */
|
||||
[p: string]: any;
|
||||
|
||||
/** Amount of delay in seconds (or frames for frames-based tweens) before the animation should begin.*/
|
||||
delay?: number;
|
||||
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
import { TweenLite } from 'gsap';
|
||||
import { TweenLite, TweenMax } from 'gsap';
|
||||
|
||||
const tween = TweenLite
|
||||
const tweenLiteExample = TweenLite
|
||||
.to(document.getElementById('some-div'), 1, {
|
||||
width: '200px',
|
||||
height: '200px'
|
||||
height: '200px',
|
||||
x: '100px',
|
||||
y: '200px'
|
||||
})
|
||||
.seek(0.5);
|
||||
|
||||
const tweenMaxExample = TweenMax
|
||||
.to(document.getElementById('some-div'), 1, {
|
||||
width: '200px',
|
||||
height: '200px',
|
||||
x: '100px',
|
||||
y: '200px'
|
||||
})
|
||||
.seek(0.5);
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for GSAP 1.19
|
||||
// Project: http://greensock.com/
|
||||
// Definitions by: VILIC VANE <https://vilic.github.io/>, Robert S <https://github.com/codebelt>, Richard Fox <https://github.com/ProbablePrime>
|
||||
// Definitions by: VILIC VANE <https://vilic.github.io/>, Robert S <https://github.com/codebelt>, Richard Fox <https://github.com/ProbablePrime>, Philip Bulley <https://github.com/philipbulley>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Animation.d.ts"/>
|
||||
|
||||
@@ -29,6 +29,8 @@ nodemon({
|
||||
});
|
||||
return tasks
|
||||
}
|
||||
, nodeArgs: ['--trace-warnings']
|
||||
, args: ['-t']
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
+3
@@ -69,6 +69,9 @@ declare namespace nodemon {
|
||||
execMap?: { [key: string]: string | boolean | number; };
|
||||
events?: { [key: string]: string; };
|
||||
restartable?: string;
|
||||
args?: string[];
|
||||
nodeArgs?: string[];
|
||||
scriptPosition?: number;
|
||||
}
|
||||
|
||||
interface EventEmitter extends NodeJS.EventEmitter {
|
||||
|
||||
Vendored
+2
@@ -197,6 +197,8 @@ declare namespace Server {
|
||||
autoRewrite?: boolean;
|
||||
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
|
||||
protocolRewrite?: string;
|
||||
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
|
||||
proxyTimeout?: number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import humanizeString = require('humanize-string');
|
||||
|
||||
humanizeString('UnicornsAndRainbows');
|
||||
humanizeString('unicorns_and-Rainbows_andPonies ');
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for humanize-string 1.0
|
||||
// Project: https://github.com/sindresorhus/humanize-string/
|
||||
// Definitions by: Kevin Nacios <https://github.com/ragnarok56>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function humanizeString(text: string): string;
|
||||
|
||||
export = humanizeString;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"humanize-string-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
-10
@@ -548,16 +548,6 @@ declare namespace jest {
|
||||
// Relevant parts of Jasmine's API are below so they can be changed and removed over time.
|
||||
// This file can't reference jasmine.d.ts since the globals aren't compatible.
|
||||
|
||||
declare function spyOn(object: any, method: string): jasmine.Spy;
|
||||
/**
|
||||
* If you call the function pending anywhere in the spec body,
|
||||
* no matter the expectations, the spec will be marked pending.
|
||||
*/
|
||||
declare function pending(reason?: string): void;
|
||||
/**
|
||||
* Fails a test when called within one.
|
||||
*/
|
||||
declare function fail(error?: any): void;
|
||||
declare namespace jasmine {
|
||||
let DEFAULT_TIMEOUT_INTERVAL: number;
|
||||
function clock(): Clock;
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for jquery-awesome-cursor 0.3
|
||||
// Project: https://jwarby.github.io/jquery-awesome-cursor
|
||||
// Definitions by: Zsolt Kovács <https://github.com/zskovacs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
declare namespace JQueryAwesomeCursor {
|
||||
type flip = "horizontal" | "vertical" | "both";
|
||||
type cssHandler = (name: string) => void;
|
||||
|
||||
interface Options {
|
||||
color?: string;
|
||||
size?: number;
|
||||
hotspot?: number[] | string;
|
||||
flip?: flip;
|
||||
rotate?: number;
|
||||
outline?: string;
|
||||
font?: Font;
|
||||
}
|
||||
|
||||
interface Font {
|
||||
family: string;
|
||||
cssClass: string | cssHandler;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Default
|
||||
jQuery.awesomeCursor('pencil');
|
||||
|
||||
// Color
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
color: '#ff0000'
|
||||
});
|
||||
|
||||
// Size
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
size: 32
|
||||
});
|
||||
|
||||
// Hotspot
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
hotspot: [0, 17]
|
||||
});
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
hotspot: 'bottom left'
|
||||
});
|
||||
|
||||
// Flip
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
flip: 'horizontal'
|
||||
});
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
flip: 'vertical'
|
||||
});
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
flip: 'both'
|
||||
});
|
||||
|
||||
// Rotate
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
rotate: 45
|
||||
});
|
||||
|
||||
// Outline
|
||||
jQuery.awesomeCursor('pencil', {
|
||||
outline: 'red'
|
||||
});
|
||||
|
||||
// Different font
|
||||
jQuery.awesomeCursor('brush', {
|
||||
font: {
|
||||
family: 'typicons',
|
||||
cssClass: 'typcn typcn-%s'
|
||||
}
|
||||
});
|
||||
jQuery.awesomeCursor('brush', {
|
||||
font: {
|
||||
family: 'typicons',
|
||||
cssClass: (name) => {
|
||||
return 'typcn typcn-' + name;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Mixed
|
||||
jQuery.awesomeCursor('long-arrow-left', {
|
||||
color: 'red',
|
||||
hotspot: 'top left',
|
||||
rotate: 45,
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery-awesome-cursor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+4
-1
@@ -1,6 +1,8 @@
|
||||
// Type definitions for jQuery Mask Plugin 1.14
|
||||
// Project: https://igorescobar.github.io/jQuery-Mask-Plugin/
|
||||
// Definitions by: Anže Videnič <https://github.com/avidenic>, Igor Escobar <http://www.igorescobar.com/>
|
||||
// Definitions by: Anže Videnič <https://github.com/avidenic>
|
||||
// Igor Escobar <http://www.igorescobar.com/>
|
||||
// Anderson Friaça <https://github.com/AndersonFriaca>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -25,6 +27,7 @@ declare namespace jQueryMask {
|
||||
selectOnFocus?: boolean;
|
||||
reverse?: boolean;
|
||||
clearIfNotMatch?: boolean;
|
||||
placeholder?: string;
|
||||
onComplete?(value: string, e: Event, $element: JQuery, options: Options): void;
|
||||
onKeyPress?(value: string, e: Event, $element: JQuery, options: Options): void;
|
||||
onChange?(value: string, e: Event, $element: JQuery, options: Options): void;
|
||||
|
||||
@@ -27,6 +27,9 @@ $(document).ready(() => {
|
||||
placeholder: "__/__/____"
|
||||
}
|
||||
});
|
||||
$('.placeholder2').mask("00/00/0000", {
|
||||
placeholder: "__/__/____"
|
||||
});
|
||||
$('.fallback').mask("00r00r0000", {
|
||||
translation: {
|
||||
r: {
|
||||
|
||||
Vendored
+9
-1
@@ -2,6 +2,7 @@
|
||||
// Project: http://developer.longtailvideo.com/trac/
|
||||
// Definitions by: Martin Duparc <https://github.com/martinduparc>
|
||||
// Tomer Kruvi <https://github.com/kutomer>
|
||||
// Philipp Gürtler <https://github.com/philippguertler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// JW Player is the leading HTML5 & Flash video player, optimized for mobile and the desktop. Easy enough for beginners, advanced enough for pros.
|
||||
@@ -224,6 +225,13 @@ interface EventCallback<T extends CallbackParam> {
|
||||
(param: T): void;
|
||||
}
|
||||
|
||||
interface Region {
|
||||
x: 0; // x and y will always be 0 according to https://developer.jwplayer.com/jw-player/docs/javascript-api-reference/#jwplayergetsaferegion
|
||||
y: 0;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface JWPlayer {
|
||||
addButton(icon: string, label: string, handler: () => void, id: string): void;
|
||||
getAudioTracks(): any[];
|
||||
@@ -243,7 +251,7 @@ interface JWPlayer {
|
||||
getPosition(): number;
|
||||
getQualityLevels(): any[];
|
||||
getRenderingMode(): string;
|
||||
getSafeRegion(): any[];
|
||||
getSafeRegion(): Region;
|
||||
getState(): string;
|
||||
getVolume(): number;
|
||||
getEnvironment(): Environment;
|
||||
|
||||
Vendored
+13
-11
@@ -3,6 +3,8 @@
|
||||
// Definitions by: Daniel Imrie-Situnayake <https://github.com/dansitu>, Bill <https://github.com/bkim54>, Michael Haan <https://github.com/sfrooster>, Amiram Korach <https://github.com/amiram>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
// # Classes
|
||||
export class Client {
|
||||
constructor(connectionString: string, clientId?: string, options?: ZKOptions, noBatchOptions?: AckBatchOptions, sslOptions?: any);
|
||||
@@ -88,24 +90,24 @@ export class Offset {
|
||||
}
|
||||
|
||||
export class KeyedMessage {
|
||||
constructor(key: string, message: string);
|
||||
constructor(key: string, value: string | Buffer);
|
||||
}
|
||||
|
||||
// # Interfaces
|
||||
|
||||
export interface Message {
|
||||
topic: string;
|
||||
value: string;
|
||||
offset?: number;
|
||||
partition?: number;
|
||||
highWaterOffset?: number;
|
||||
key?: string;
|
||||
}
|
||||
topic: string;
|
||||
value: string | Buffer;
|
||||
offset?: number;
|
||||
partition?: number;
|
||||
highWaterOffset?: number;
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface ProducerOptions {
|
||||
requireAcks?: number;
|
||||
ackTimeoutMs?: number;
|
||||
partitionerType?: number;
|
||||
requireAcks?: number;
|
||||
ackTimeoutMs?: number;
|
||||
partitionerType?: number;
|
||||
}
|
||||
|
||||
export interface KafkaClientOptions {
|
||||
|
||||
Vendored
+2
-2
@@ -3810,7 +3810,7 @@ declare namespace kendo.ui {
|
||||
aggregates?: any;
|
||||
attributes?: any;
|
||||
columns?: any;
|
||||
command?: GridColumnCommandItem[];
|
||||
command?: string|(string|GridColumnCommandItem)[];
|
||||
editable?: Function;
|
||||
encoded?: boolean;
|
||||
field?: string;
|
||||
@@ -20341,4 +20341,4 @@ interface JQuery {
|
||||
kendoWindow(options: kendo.ui.WindowOptions): JQuery;
|
||||
data(key: "kendoWindow"): kendo.ui.Window;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -183,12 +183,12 @@ declare namespace Knex {
|
||||
|
||||
interface Join {
|
||||
(raw: Raw): QueryBuilder;
|
||||
(tableName: TableName, clause: (this: JoinClause, join: JoinClause) => void): QueryBuilder;
|
||||
(tableName: TableName, columns: { [key: string]: string | number | Raw }): QueryBuilder;
|
||||
(tableName: TableName, raw: Raw): QueryBuilder;
|
||||
(tableName: TableName, column1: string, column2: string): QueryBuilder;
|
||||
(tableName: TableName, column1: string, raw: Raw): QueryBuilder;
|
||||
(tableName: TableName, column1: string, operator: string, column2: string): QueryBuilder;
|
||||
(tableName: TableName | QueryCallback, clause: (this: JoinClause, join: JoinClause) => void): QueryBuilder;
|
||||
(tableName: TableName | QueryCallback, columns: { [key: string]: string | number | Raw }): QueryBuilder;
|
||||
(tableName: TableName | QueryCallback, raw: Raw): QueryBuilder;
|
||||
(tableName: TableName | QueryCallback, column1: string, column2: string): QueryBuilder;
|
||||
(tableName: TableName | QueryCallback, column1: string, raw: Raw): QueryBuilder;
|
||||
(tableName: TableName | QueryCallback, column1: string, operator: string, column2: string): QueryBuilder;
|
||||
}
|
||||
|
||||
interface JoinClause {
|
||||
|
||||
@@ -459,6 +459,44 @@ knex.select('*').from('accounts').joinRaw('natural full join table1').where('id'
|
||||
|
||||
knex.select('*').from('accounts').join(knex.raw('natural full join table1')).where('id', 1);
|
||||
|
||||
knex.select('*').from('accounts')
|
||||
.join(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.leftJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.leftOuterJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.rightJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.rightOuterJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.innerJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.crossJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.fullOuterJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
knex.select('*').from('accounts')
|
||||
.outerJoin(function() {
|
||||
this.select('*').from('accounts').as('special_accounts');
|
||||
}, 'special_accounts.a', '=', 'accounts.b');
|
||||
|
||||
|
||||
knex('customers')
|
||||
.distinct('first_name', 'last_name')
|
||||
.select();
|
||||
|
||||
Vendored
+100
-4
@@ -8,26 +8,122 @@ declare module "../index" {
|
||||
* @param arrays The arrays to process.
|
||||
* @return Returns the new array of grouped elements.
|
||||
*/
|
||||
zip<T>(...arrays: Array<List<T> | null | undefined>): T[][];
|
||||
zip<T1, T2>(arrays1: List<T1>, arrays2: List<T2>): Array<[T1 | undefined, T2 | undefined]>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3, T4>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3, T4, T5>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, arrays5: List<T5>): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T>(...arrays: Array<List<T> | null | undefined>): (T | undefined)[][];
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<TValue> {
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
): LoDashImplicitWrapper<Array<[T1 | undefined, T2 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
): LoDashImplicitWrapper<Array<[T1 | undefined, T2 | undefined, T3 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3, T4>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
): LoDashImplicitWrapper<Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3, T4, T5>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
arrays5: List<T5>,
|
||||
): LoDashImplicitWrapper<Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
...arrays: Array<List<T> | null | undefined>
|
||||
): LoDashImplicitWrapper<T[][]>;
|
||||
): LoDashImplicitWrapper<Array<Array<T | undefined>>>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<TValue> {
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
): LoDashExplicitWrapper<Array<[T1 | undefined, T2 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
): LoDashExplicitWrapper<Array<[T1 | undefined, T2 | undefined, T3 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3, T4>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
): LoDashExplicitWrapper<Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T1, T2, T3, T4, T5>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
arrays5: List<T5>,
|
||||
): LoDashExplicitWrapper<Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
*/
|
||||
zip<T>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
...arrays: Array<List<T> | null | undefined>
|
||||
): LoDashExplicitWrapper<T[][]>;
|
||||
): LoDashExplicitWrapper<Array<Array<T | undefined>>>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+102
-106
@@ -10,89 +10,110 @@ declare module "../index" {
|
||||
* @param [thisArg] The `this` binding of `iteratee`.
|
||||
* @return Returns the new array of grouped elements.
|
||||
*/
|
||||
zipWith<T>(
|
||||
...arrays: Array<List<T> | null | undefined>
|
||||
): T[][];
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
arrays: List<T> | null | undefined,
|
||||
arrays: List<T>,
|
||||
iteratee: (value1: T) => TResult
|
||||
): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
arrays: List<T> | null | undefined,
|
||||
arrays2: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T) => TResult
|
||||
zipWith<T1, T2, TResult>(
|
||||
arrays1: List<T1>,
|
||||
arrays2: List<T2>,
|
||||
iteratee: (value1: T1, value2: T2) => TResult
|
||||
): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
arrays: List<T> | null | undefined,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T) => TResult
|
||||
zipWith<T1, T2, T3, TResult>(
|
||||
arrays1: List<T1>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3) => TResult
|
||||
): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
arrays: List<T> | null | undefined,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
arrays4: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult
|
||||
zipWith<T1, T2, T3, T4, TResult>(
|
||||
arrays1: List<T1>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult
|
||||
): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
arrays: List<T> | null | undefined,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
arrays4: List<T> | null | undefined,
|
||||
arrays5: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T, value4: T, value5: T) => TResult
|
||||
zipWith<T1, T2, T3, T4, T5, TResult>(
|
||||
arrays1: List<T1>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
arrays5: List<T5>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult
|
||||
): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>
|
||||
): TResult[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<TValue> {
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
...arrays: Array<List<T> | null | undefined>
|
||||
): LoDashImplicitWrapper<T[][]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
this: LoDashImplicitWrapper<List<T>>,
|
||||
iteratee: (value1: T) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T) => TResult
|
||||
zipWith<T1, T2, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
iteratee: (value1: T1, value2: T2) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T1, T2, T3, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T1, T2, T3, T4, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T1, T2, T3, T4, T5, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
arrays5: List<T5>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
@@ -100,59 +121,59 @@ declare module "../index" {
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
arrays4: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
arrays4: List<T> | null | undefined,
|
||||
arrays5: List<T> | null | undefined,
|
||||
...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>
|
||||
): LoDashImplicitWrapper<TResult[]>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<TValue> {
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
...arrays: Array<List<T> | null | undefined>
|
||||
): LoDashExplicitWrapper<T[][]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
this: LoDashExplicitWrapper<List<T>>,
|
||||
iteratee: (value1: T) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T) => TResult
|
||||
zipWith<T1, T2, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
iteratee: (value1: T1, value2: T2) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T1, T2, T3, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T1, T2, T3, T4, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T1, T2, T3, T4, T5, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T1>>,
|
||||
arrays2: List<T2>,
|
||||
arrays3: List<T3>,
|
||||
arrays4: List<T4>,
|
||||
arrays5: List<T5>,
|
||||
iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
@@ -160,31 +181,6 @@ declare module "../index" {
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
arrays4: List<T> | null | undefined,
|
||||
iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
|
||||
/**
|
||||
* @see _.zipWith
|
||||
*/
|
||||
zipWith<T, TResult>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
arrays2: List<T> | null | undefined,
|
||||
arrays3: List<T> | null | undefined,
|
||||
arrays4: List<T> | null | undefined,
|
||||
arrays5: List<T> | null | undefined,
|
||||
...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>
|
||||
): LoDashExplicitWrapper<TResult[]>;
|
||||
}
|
||||
|
||||
@@ -3192,40 +3192,57 @@ namespace TestXor {
|
||||
}
|
||||
|
||||
// _.zip
|
||||
namespace TestZip {
|
||||
{
|
||||
let array: TResult[] | null | undefined = [] as any;
|
||||
let list: _.List<TResult> | null | undefined = [] as any;
|
||||
|
||||
{
|
||||
let result: TResult[][];
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip<TResult>(array);
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip<TResult>(array, list);
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip<TResult>(array, list, array);
|
||||
|
||||
result = _.zip<TResult>(array);
|
||||
result = _.zip<TResult>(array, list);
|
||||
result = _.zip<TResult>(array, list, array);
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip<TResult>(list);
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip<TResult>(list, array);
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip<TResult>(list, array, list);
|
||||
|
||||
result = _.zip<TResult>(list);
|
||||
result = _.zip<TResult>(list, array);
|
||||
result = _.zip<TResult>(list, array, list);
|
||||
// $ExpectType (TResult | undefined)[][]
|
||||
_.zip(list, array, list, array, list, array);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<TResult[]>;
|
||||
// $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]>
|
||||
_(array).zip<TResult>(list);
|
||||
// $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]>
|
||||
_(array).zip<TResult>(list, array);
|
||||
|
||||
result = _(array).zip<TResult>(list);
|
||||
result = _(array).zip<TResult>(list, array);
|
||||
|
||||
result = _(list).zip<TResult>(array);
|
||||
result = _(list).zip<TResult>(array, list);
|
||||
// $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]>
|
||||
_(list).zip<TResult>(array);
|
||||
// $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]>
|
||||
_(list).zip<TResult>(array, list);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitArrayWrapper<TResult[]>;
|
||||
// $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]>
|
||||
_(array).chain().zip<TResult>(list);
|
||||
// $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]>
|
||||
_(array).chain().zip<TResult>(list, array);
|
||||
|
||||
result = _(array).chain().zip<TResult>(list);
|
||||
result = _(array).chain().zip<TResult>(list, array);
|
||||
// $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]>
|
||||
_(list).chain().zip<TResult>(array);
|
||||
// $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]>
|
||||
_(list).chain().zip<TResult>(array, list);
|
||||
}
|
||||
|
||||
result = _(list).chain().zip<TResult>(array);
|
||||
result = _(list).chain().zip<TResult>(array, list);
|
||||
{
|
||||
_.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][]
|
||||
_.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][]
|
||||
_.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3359,18 +3376,9 @@ namespace TestZipObject {
|
||||
}
|
||||
|
||||
// _.zipWith
|
||||
namespace TestZipWith {
|
||||
{
|
||||
type TestZipWithFn = (a1: number, a2: number) => number;
|
||||
|
||||
{
|
||||
let result: number[][];
|
||||
result = _.zipWith([1, 2]);
|
||||
result = _.zipWith([1, 2], [3, 4], [5, 6]);
|
||||
result = _([1, 2]).zipWith().value();
|
||||
result = _([1, 2]).zipWith([3, 4], [5, 6]).value();
|
||||
result = _.chain([1, 2]).zipWith().value();
|
||||
result = _.chain([1, 2]).zipWith([3, 4], [5, 6]).value();
|
||||
}
|
||||
{
|
||||
let result: number[];
|
||||
|
||||
@@ -3511,6 +3519,19 @@ namespace TestZipWith {
|
||||
group; // $ExpectType number[]
|
||||
return 1;
|
||||
}).value();
|
||||
|
||||
result = _([1, 2]).zipWith(["a", "b"], (value1, value2) => {
|
||||
value1; // $ExpectType number
|
||||
value2; // $ExpectType string
|
||||
return 1;
|
||||
}).value();
|
||||
|
||||
result = _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => {
|
||||
value1; // $ExpectType number
|
||||
value2; // $ExpectType string
|
||||
value3; // $ExpectType boolean
|
||||
return 1;
|
||||
}).value();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -294,6 +294,7 @@ declare module 'luxon' {
|
||||
function eras(length?: EraLength, options?: InfoOptions): string[];
|
||||
function features(): Features;
|
||||
function hasDST(zone: string | Zone): boolean;
|
||||
function isValidIANAZone(zone: string): boolean;
|
||||
function meridiems(options?: InfoOptions): string[];
|
||||
function months(length?: UnitLength, options?: UnitOptions): string[];
|
||||
function monthsFormat(length?: UnitLength, options?: UnitOptions): string[];
|
||||
|
||||
Vendored
+4
@@ -26,8 +26,12 @@ declare namespace mapboxgl {
|
||||
constructor(options?: MapboxOptions);
|
||||
|
||||
addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this;
|
||||
|
||||
addControl(control: IControl, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this;
|
||||
|
||||
removeControl(control: Control): this;
|
||||
|
||||
removeControl(control: IControl): this;
|
||||
|
||||
addClass(klass: string, options?: mapboxgl.StyleOptions): this;
|
||||
|
||||
|
||||
Vendored
+4
@@ -280,5 +280,9 @@ declare namespace Memcached {
|
||||
* 5000, the idle timeout for the connections.
|
||||
*/
|
||||
idle ?: number;
|
||||
/**
|
||||
* '', sentinel to prepend to all memcache keys for namespacing the entries.
|
||||
*/
|
||||
namespace ?: string;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+24
-8
@@ -147,6 +147,7 @@ declare namespace Mocha {
|
||||
sync: boolean;
|
||||
timedOut: boolean;
|
||||
timeout(n: number | string): this;
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Suite` class. */
|
||||
@@ -170,9 +171,30 @@ declare namespace Mocha {
|
||||
currentTest: ITest;
|
||||
}
|
||||
|
||||
interface IStats {
|
||||
suites: number;
|
||||
tests: number;
|
||||
passes: number;
|
||||
pending: number;
|
||||
failures: number;
|
||||
start?: Date;
|
||||
end?: Date;
|
||||
duration?: Date;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Runner` class. */
|
||||
interface IRunner { }
|
||||
interface IRunner {
|
||||
stats?: IStats;
|
||||
started: boolean;
|
||||
suite: ISuite;
|
||||
total: number;
|
||||
failures: number;
|
||||
grep: (re: string, invert: boolean) => this;
|
||||
grepTotal: (suite: ISuite) => number;
|
||||
globals: (arr: ReadonlyArray<string>) => this | string[];
|
||||
abort: () => this;
|
||||
run: (fn?: (failures: number) => void) => this;
|
||||
}
|
||||
|
||||
interface IContextDefinition {
|
||||
(description: string, callback: (this: ISuiteCallbackContext) => void): ISuite;
|
||||
@@ -191,13 +213,7 @@ declare namespace Mocha {
|
||||
|
||||
export module reporters {
|
||||
export class Base {
|
||||
stats: {
|
||||
suites: number;
|
||||
tests: number;
|
||||
passes: number;
|
||||
pending: number;
|
||||
failures: number;
|
||||
};
|
||||
stats: IStats;
|
||||
|
||||
constructor(runner: IRunner);
|
||||
}
|
||||
|
||||
+60
-16
@@ -1,5 +1,8 @@
|
||||
let boolean: boolean;
|
||||
let string: string;
|
||||
let number: number;
|
||||
let stringOrUndefined: string | undefined;
|
||||
let dateOrUndefined: Date | undefined;
|
||||
|
||||
function test_describe() {
|
||||
describe('something', () => { });
|
||||
@@ -112,7 +115,7 @@ function test_setup() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
setup(function () {
|
||||
@@ -123,7 +126,7 @@ function test_setup() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
setup(function (done) {
|
||||
@@ -134,7 +137,7 @@ function test_setup() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -158,7 +161,7 @@ function test_teardown() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
teardown(function () {
|
||||
@@ -169,7 +172,7 @@ function test_teardown() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
teardown(function (done) {
|
||||
@@ -180,7 +183,7 @@ function test_teardown() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -192,7 +195,7 @@ function test_beforeEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -203,7 +206,7 @@ function test_beforeEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
@@ -214,7 +217,7 @@ function test_beforeEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
beforeEach("my description", function () {
|
||||
@@ -224,7 +227,7 @@ function test_beforeEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
beforeEach("my description", function (done) {
|
||||
@@ -235,7 +238,7 @@ function test_beforeEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -255,7 +258,7 @@ function test_afterEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
@@ -266,7 +269,7 @@ function test_afterEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
@@ -277,7 +280,7 @@ function test_afterEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
afterEach("my description", function () {
|
||||
@@ -287,7 +290,7 @@ function test_afterEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
afterEach("my description", function (done) {
|
||||
@@ -298,7 +301,7 @@ function test_afterEach() {
|
||||
boolean = this.currentTest.timedOut;
|
||||
string = this.currentTest.title;
|
||||
string = this.currentTest.fullTitle();
|
||||
string = this.currentTest.state;
|
||||
stringOrUndefined = this.currentTest.state;
|
||||
});
|
||||
|
||||
}
|
||||
@@ -455,3 +458,44 @@ function test_run_withOnComplete() {
|
||||
function test_throwError() {
|
||||
mocha.throwError(new Error("I'm an error!"));
|
||||
}
|
||||
|
||||
function test_mochaRunner_properties(runner: MochaDef.IRunner, suite: MochaDef.ISuite) {
|
||||
runner = runner.abort();
|
||||
|
||||
if (runner.stats !== undefined) {
|
||||
number = runner.stats.failures;
|
||||
number = runner.stats.passes;
|
||||
number = runner.stats.pending;
|
||||
number = runner.stats.suites;
|
||||
number = runner.stats.tests;
|
||||
|
||||
dateOrUndefined = runner.stats.start;
|
||||
dateOrUndefined = runner.stats.end;
|
||||
dateOrUndefined = runner.stats.duration;
|
||||
}
|
||||
|
||||
let s: MochaDef.ISuite = runner.suite;
|
||||
boolean = runner.started;
|
||||
number = runner.total;
|
||||
number = runner.failures;
|
||||
|
||||
runner = runner.grep("regex", false);
|
||||
number = runner.grepTotal(suite);
|
||||
|
||||
let globals: string[] | MochaDef.IRunner= runner.globals(["hello", "world"]);
|
||||
|
||||
runner = runner.run();
|
||||
runner = runner.run((f: number) => {});
|
||||
}
|
||||
|
||||
function test_base_reporter_properties(reporter: MochaDef.reporters.Base) {
|
||||
number = reporter.stats.failures;
|
||||
number = reporter.stats.passes;
|
||||
number = reporter.stats.pending;
|
||||
number = reporter.stats.suites;
|
||||
number = reporter.stats.tests;
|
||||
|
||||
dateOrUndefined = reporter.stats.start;
|
||||
dateOrUndefined = reporter.stats.end;
|
||||
dateOrUndefined = reporter.stats.duration;
|
||||
}
|
||||
@@ -6,8 +6,8 @@
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
Vendored
+1
-1
@@ -694,7 +694,7 @@ declare module "mongoose" {
|
||||
}
|
||||
|
||||
interface SchemaOptions {
|
||||
/** defaults to null (which means use the connection's autoIndex option) */
|
||||
/** defaults to false (which means use the connection's autoIndex option) */
|
||||
autoIndex?: boolean;
|
||||
/** defaults to true */
|
||||
bufferCommands?: boolean;
|
||||
|
||||
Vendored
+1
@@ -251,6 +251,7 @@ export declare class Request extends events.EventEmitter {
|
||||
public parameters: IRequestParameters;
|
||||
public verbose: boolean;
|
||||
public canceled: boolean;
|
||||
public multiple: boolean;
|
||||
public stream: any;
|
||||
public constructor(connection?: ConnectionPool);
|
||||
public constructor(transaction: Transaction);
|
||||
|
||||
Vendored
+54
-3
@@ -14,7 +14,7 @@ declare module "node-forge" {
|
||||
type Utf8 = string;
|
||||
type OID = string;
|
||||
|
||||
namespace pem {
|
||||
namespace pem {
|
||||
|
||||
interface EncodeOptions {
|
||||
maxline?: number;
|
||||
@@ -32,7 +32,7 @@ declare module "node-forge" {
|
||||
function encode(msg: ObjectPEM, options?: EncodeOptions): string;
|
||||
function decode(str: string): ObjectPEM[];
|
||||
}
|
||||
|
||||
|
||||
namespace pki {
|
||||
|
||||
type PEM = string;
|
||||
@@ -79,10 +79,11 @@ declare module "node-forge" {
|
||||
interface CertificateField extends CertificateFieldOptions {
|
||||
valueConstructed?: boolean;
|
||||
valueTagClass?: asn1.Class;
|
||||
value?: any[];
|
||||
value?: any[] | string;
|
||||
extensions?: any[];
|
||||
}
|
||||
|
||||
|
||||
interface Certificate {
|
||||
version: number;
|
||||
serialNumber: string;
|
||||
@@ -107,11 +108,61 @@ declare module "node-forge" {
|
||||
extensions: any[];
|
||||
publicKey: any;
|
||||
md: any;
|
||||
/**
|
||||
* Sets the subject of this certificate.
|
||||
*
|
||||
* @param attrs the array of subject attributes to use.
|
||||
* @param uniqueId an optional a unique ID to use.
|
||||
*/
|
||||
setSubject(attrs: CertificateField[], uniqueId?: string): void;
|
||||
/**
|
||||
* Sets the subject of this certificate.
|
||||
*
|
||||
* @param attrs the array of subject attributes to use.
|
||||
* @param uniqueId an optional a unique ID to use.
|
||||
*/
|
||||
setIssuer(attrs: CertificateField[], uniqueId?: string): void;
|
||||
/**
|
||||
* Sets the extensions of this certificate.
|
||||
*
|
||||
* @param exts the array of extensions to use.
|
||||
*/
|
||||
setExtensions(exts: any[]): void;
|
||||
/**
|
||||
* Gets an extension by its name or id.
|
||||
*
|
||||
* @param options the name to use or an object with:
|
||||
* name the name to use.
|
||||
* id the id to use.
|
||||
*
|
||||
* @return the extension or null if not found.
|
||||
*/
|
||||
getExtension(options: string | {name: string;} | {id: number;}): {} | undefined;
|
||||
|
||||
/**
|
||||
* Signs this certificate using the given private key.
|
||||
*
|
||||
* @param key the private key to sign with.
|
||||
* @param md the message digest object to use (defaults to forge.md.sha1).
|
||||
*/
|
||||
sign(key: pki.Key, md: md.MessageDigest): void;
|
||||
/**
|
||||
* Attempts verify the signature on the passed certificate using this
|
||||
* certificate's public key.
|
||||
*
|
||||
* @param child the certificate to verify.
|
||||
*
|
||||
* @return true if verified, false if not.
|
||||
*/
|
||||
verify(child: Certificate): boolean;
|
||||
|
||||
}
|
||||
|
||||
function certificateFromAsn1(obj: asn1.Asn1, computeHash?: boolean): Certificate;
|
||||
|
||||
function decryptRsaPrivateKey(pem: PEM, passphrase?: string): Key;
|
||||
|
||||
function createCertificate(): Certificate;
|
||||
}
|
||||
|
||||
namespace ssh {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as forge from "node-forge";
|
||||
import * as forge from 'node-forge';
|
||||
|
||||
let keypair = forge.pki.rsa.generateKeyPair({ bits: 512 });
|
||||
let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey);
|
||||
@@ -8,19 +8,23 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key);
|
||||
let pemKey: forge.pki.PEM = publicKeyPem;
|
||||
let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey);
|
||||
let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem);
|
||||
let cert = forge.pki.createCertificate();
|
||||
|
||||
{
|
||||
let subjectPublicKeyInfo = forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.OID, false,
|
||||
forge.asn1.oidToDer(forge.pki.oids['rsaEncryption']).getBytes(),
|
||||
forge.asn1.create(
|
||||
forge.asn1.Class.UNIVERSAL,
|
||||
forge.asn1.Type.OID,
|
||||
false,
|
||||
forge.asn1.oidToDer(forge.pki.oids['rsaEncryption']).getBytes()
|
||||
),
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.NULL, false, ''),
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.NULL, false, '')
|
||||
]),
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.BITSTRING, false, [
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []),
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []),
|
||||
forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, [])
|
||||
])
|
||||
])
|
||||
]);
|
||||
@@ -52,12 +56,14 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin
|
||||
src = new Uint8Array(2);
|
||||
encode = forge.util.binary.hex.encode(src);
|
||||
decode = forge.util.binary.hex.decode(encode);
|
||||
if (encode !== '0000' || src.byteLength !== decode.byteLength) throw Error('forge.util.binary.hex.encode / decode fail');
|
||||
if (encode !== '0000' || src.byteLength !== decode.byteLength)
|
||||
throw Error('forge.util.binary.hex.encode / decode fail');
|
||||
|
||||
src = new Uint8Array(2);
|
||||
encode = forge.util.binary.base64.encode(src);
|
||||
decode = forge.util.binary.base64.decode(encode);
|
||||
if (encode !== 'AAA=' || src.byteLength !== decode.byteLength) throw Error('forge.util.binary.base64.encode / decode fail');
|
||||
if (encode !== 'AAA=' || src.byteLength !== decode.byteLength)
|
||||
throw Error('forge.util.binary.base64.encode / decode fail');
|
||||
|
||||
src = new Uint8Array(10);
|
||||
encode = forge.util.binary.raw.encode(src);
|
||||
@@ -97,7 +103,6 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin
|
||||
if (hex.length !== 40) throw Error('forge.md.MessageDigest.update / digest fail');
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
let md: forge.md.MessageDigest;
|
||||
let hex: string;
|
||||
@@ -110,26 +115,74 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin
|
||||
}
|
||||
|
||||
{
|
||||
let payload = { "asd": "asd" }
|
||||
let cipher = forge.cipher.createCipher(
|
||||
"3DES-ECB",
|
||||
forge.util.createBuffer(key, "raw")
|
||||
);
|
||||
let payload = { asd: 'asd' };
|
||||
let cipher = forge.cipher.createCipher('3DES-ECB', forge.util.createBuffer(key, 'raw'));
|
||||
cipher.start();
|
||||
cipher.update(forge.util.createBuffer(JSON.stringify(payload), "raw"));
|
||||
cipher.update(forge.util.createBuffer(JSON.stringify(payload), 'raw'));
|
||||
cipher.finish();
|
||||
let encrypted = cipher.output;
|
||||
let token = forge.util.encode64(encrypted.getBytes());
|
||||
|
||||
let decipher = forge.cipher.createDecipher(
|
||||
"3DES-ECB",
|
||||
forge.util.createBuffer(key, "raw")
|
||||
);
|
||||
let decipher = forge.cipher.createDecipher('3DES-ECB', forge.util.createBuffer(key, 'raw'));
|
||||
decipher.start();
|
||||
decipher.update(forge.util.createBuffer(forge.util.decode64(token), "raw"));
|
||||
decipher.update(forge.util.createBuffer(forge.util.decode64(token), 'raw'));
|
||||
decipher.finish();
|
||||
let decrypted = decipher.output as forge.util.ByteStringBuffer;
|
||||
let content = JSON.parse(forge.util.encodeUtf8(decrypted.getBytes()));
|
||||
|
||||
if (content.asd == payload.asd) throw Error('forge.cipher.createCipher failed');
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cert.publicKey = keypair.publicKey;
|
||||
cert.serialNumber = new Date().getTime() + '';
|
||||
cert.validity.notBefore = new Date();
|
||||
cert.validity.notAfter = new Date();
|
||||
cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 20);
|
||||
const attrs = [
|
||||
{
|
||||
name: 'commonName',
|
||||
value: 'x22x22'
|
||||
},
|
||||
{
|
||||
name: 'countryName',
|
||||
value: 'GitHub'
|
||||
},
|
||||
{
|
||||
shortName: 'ST',
|
||||
value: 'GitHub'
|
||||
},
|
||||
{
|
||||
name: 'localityName',
|
||||
value: 'GitHub'
|
||||
},
|
||||
{
|
||||
name: 'organizationName',
|
||||
value: 'x22x22'
|
||||
},
|
||||
{
|
||||
shortName: 'OU',
|
||||
value: 'https://github.com/x22x22'
|
||||
}
|
||||
];
|
||||
cert.setSubject(attrs);
|
||||
cert.setIssuer(attrs);
|
||||
cert.setExtensions([
|
||||
{
|
||||
name: 'basicConstraints',
|
||||
critical: true,
|
||||
cA: true
|
||||
},
|
||||
{
|
||||
name: 'keyUsage',
|
||||
critical: true,
|
||||
keyCertSign: true
|
||||
},
|
||||
{
|
||||
name: 'subjectKeyIdentifier'
|
||||
}
|
||||
]);
|
||||
|
||||
// self-sign certificate
|
||||
cert.sign(keypair.privateKey, forge.md.sha256.create());
|
||||
}
|
||||
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { Socket } from 'net';
|
||||
import { Readable } from 'stream';
|
||||
import { URL } from 'url';
|
||||
import { Url } from 'url';
|
||||
|
||||
import { SentMessageInfo, Transport, TransportOptions } from '../..';
|
||||
import * as shared from '../shared';
|
||||
@@ -34,7 +34,7 @@ declare namespace Mail {
|
||||
/** String, Buffer or a Stream contents for the attachmentent */
|
||||
content?: string | Buffer | Readable;
|
||||
/** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */
|
||||
path?: string | URL;
|
||||
path?: string | Url;
|
||||
}
|
||||
|
||||
interface Attachment extends AttachmentLike {
|
||||
@@ -175,11 +175,11 @@ declare class Mail extends EventEmitter {
|
||||
setupProxy(proxyUrl: string): void;
|
||||
|
||||
set(key: 'oauth2_provision_cb', value: (user: string, renew: boolean, callback: (err: Error | null, accessToken?: string, expires?: number) => void) => void): Map<string, any>;
|
||||
set(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a', value: (proxy: URL, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void) => void): Map<string, any>;
|
||||
set(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a', value: (proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void) => void): Map<string, any>;
|
||||
set(key: string, value: any): Map<string, any>;
|
||||
|
||||
get(key: 'oauth2_provision_cb'): (user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void) => void;
|
||||
get(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a'): (proxy: URL, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void) => void;
|
||||
get(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a'): (proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void) => void;
|
||||
get(key: string): any;
|
||||
|
||||
addListener(event: 'error', listener: (err: Error) => void): this;
|
||||
|
||||
Vendored
+10
@@ -3237,6 +3237,16 @@ declare module paper {
|
||||
* Deselects all selected items in the project.
|
||||
*/
|
||||
deselectAll(): void;
|
||||
|
||||
/**
|
||||
* Adds the specified layer at the end of the this project’s layers list.
|
||||
*/
|
||||
addLayer(layer: Layer): Layer;
|
||||
|
||||
/**
|
||||
* Inserts the specified layer at the specified index in this project’s layers list.
|
||||
*/
|
||||
insertLayer(index: number, layer: Layer): Layer;
|
||||
|
||||
/**
|
||||
* Perform a hit-test on the items contained within the project at the location of the specified point.
|
||||
|
||||
Vendored
+16
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Pixi.js 4.6
|
||||
// Type definitions for Pixi.js 4.7
|
||||
// Project: https://github.com/pixijs/pixi.js/tree/dev
|
||||
// Definitions by: clark-stevenson <https://github.com/pixijs/pixi-typescript>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -63,6 +63,7 @@ declare namespace PIXI {
|
||||
let PRECISION: string;
|
||||
let UPLOADS_PER_FRAME: number;
|
||||
let CAN_UPLOAD_SAME_BUFFER: boolean;
|
||||
let MESH_CANVAS_PADDING: number;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -208,6 +209,7 @@ declare namespace PIXI {
|
||||
renderer: PIXI.WebGLRenderer | PIXI.CanvasRenderer;
|
||||
stage: Container;
|
||||
ticker: ticker.Ticker;
|
||||
loader: loaders.Loader;
|
||||
readonly screen: Rectangle;
|
||||
|
||||
stop(): void;
|
||||
@@ -497,6 +499,7 @@ declare namespace PIXI {
|
||||
drawCircle(x: number, y: number, radius: number): Graphics;
|
||||
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
|
||||
drawPolygon(path: number[] | Point[] | Polygon): Graphics;
|
||||
drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation?: number): Graphics;
|
||||
clear(): Graphics;
|
||||
isFastRect(): boolean;
|
||||
protected _renderCanvas(renderer: CanvasRenderer): void;
|
||||
@@ -1737,7 +1740,9 @@ declare namespace PIXI {
|
||||
|
||||
// shader
|
||||
|
||||
class Shader extends glCore.GLShader { }
|
||||
class Shader extends glCore.GLShader {
|
||||
constructor(gl: WebGLRenderingContext, vertexSrc: string | string[], fragmentSrc: string | string[], attributeLocations?: { [key: string]: number }, precision?: string);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////EXTRACT///////////////////////////////////////////
|
||||
@@ -2163,7 +2168,7 @@ declare namespace PIXI {
|
||||
|
||||
// pixi loader extends
|
||||
// https://github.com/englercj/resource-loader/
|
||||
// 2.0.9
|
||||
// 2.1.1
|
||||
|
||||
class MiniSignalBinding {
|
||||
//tslint:disable-next-line:ban-types forbidden-types
|
||||
@@ -2251,6 +2256,8 @@ declare namespace PIXI {
|
||||
onStart: MiniSignal;
|
||||
onComplete: MiniSignal;
|
||||
|
||||
concurrency: number;
|
||||
|
||||
add(...params: any[]): this;
|
||||
//tslint:disable-next-line:ban-types forbidden-types
|
||||
add(name: string, url: string, options?: LoaderOptions, cb?: Function): this;
|
||||
@@ -2268,6 +2275,7 @@ declare namespace PIXI {
|
||||
protected _prepareUrl(url: string): string;
|
||||
//tslint:disable-next-line:ban-types forbidden-types
|
||||
protected _loadResource(resource: Resource, dequeue: Function): void;
|
||||
protected _onStart(): void;
|
||||
protected _onComplete(): void;
|
||||
protected _onLoad(resource: Resource): void;
|
||||
|
||||
@@ -2523,7 +2531,11 @@ declare namespace PIXI {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
namespace particles {
|
||||
interface ParticleContainerProperties {
|
||||
/**
|
||||
* DEPRECIATED - Use `vertices`
|
||||
*/
|
||||
scale?: boolean;
|
||||
vertices?: boolean;
|
||||
position?: boolean;
|
||||
rotation?: boolean;
|
||||
uvs?: boolean;
|
||||
@@ -2531,7 +2543,7 @@ declare namespace PIXI {
|
||||
alpha?: boolean;
|
||||
}
|
||||
class ParticleContainer extends Container {
|
||||
constructor(maxSize?: number, properties?: ParticleContainerProperties, batchSize?: number, autoSize?: boolean);
|
||||
constructor(maxSize?: number, properties?: ParticleContainerProperties, batchSize?: number, autoResize?: boolean);
|
||||
protected _tint: number;
|
||||
protected tintRgb: number | any[];
|
||||
tint: number;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user