mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 20:21:46 +00:00
Merge branch 'master' into esri-leaflet
This commit is contained in:
+1
-1
@@ -1,9 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{*.json,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
|
||||
[](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
@@ -96,7 +96,7 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
|
||||
// Steve <https://github.com/steve>
|
||||
// John <https://github.com/john>
|
||||
```
|
||||
* `npm install -g typescript@2.0` and run `tsc`.
|
||||
* If there is a `tslint.json`, run `npm run lint package-name`. Otherwise, run `tsc` in the package directory.
|
||||
|
||||
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
|
||||
If it doesn't, you can do so yourself in the comment associated with the PR.
|
||||
@@ -133,6 +133,7 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
|
||||
|
||||
* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
|
||||
* Formatting: Either use all tabs, or always use 4 spaces.
|
||||
* `function sum(nums: number[]): number`: Use `ReadonlyArray` if a function does not write to its parameters.
|
||||
* `interface Foo { new(): Foo; }`:
|
||||
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }`.
|
||||
* `const Class: { new(): IClass; }`:
|
||||
@@ -177,6 +178,18 @@ If a `tslint.json` turns rules off, this is because that hasn't been fixed yet.
|
||||
|
||||
(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.)
|
||||
|
||||
To assert that an expression is of a given type, use `$ExpectType`. To assert that an expression causes a compile error, use `$ExpectError`.
|
||||
|
||||
```js
|
||||
// $ExpectType void
|
||||
f(1);
|
||||
|
||||
// $ExpectError
|
||||
f("one");
|
||||
```
|
||||
|
||||
For more details, see [dtslint](https://github.com/Microsoft/dtslint#write-tests) readme.
|
||||
|
||||
Test by running `npm run lint package-name` where `package-name` is the name of your package.
|
||||
This script uses [dtslint](https://github.com/Microsoft/dtslint).
|
||||
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"libraryName": "ag-grid",
|
||||
"typingsPackageName": "ag-grid",
|
||||
"sourceRepoURL": "https://github.com/ceolter/ag-grid",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ajv",
|
||||
"typingsPackageName": "ajv",
|
||||
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "angular-ui-router-default",
|
||||
"typingsPackageName": "angular-ui-router-default",
|
||||
"sourceRepoURL": "https://github.com/nonplus/angular-ui-router-default",
|
||||
"asOfVersion": "0.0.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "angular-ui-router-uib-modal",
|
||||
"typingsPackageName": "angular-ui-router-uib-modal",
|
||||
"sourceRepoURL": "https://github.com/nonplus/angular-ui-router-uib-modal",
|
||||
"asOfVersion": "0.0.11"
|
||||
},
|
||||
{
|
||||
"libraryName": "antd",
|
||||
"typingsPackageName": "antd",
|
||||
@@ -18,6 +36,12 @@
|
||||
"sourceRepoURL": "https://github.com/doxout/anydb-sql",
|
||||
"asOfVersion": "0.6.46"
|
||||
},
|
||||
{
|
||||
"libraryName": "apn",
|
||||
"typingsPackageName": "apn",
|
||||
"sourceRepoURL": "https://github.com/node-apn/node-apn",
|
||||
"asOfVersion": "2.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "Argon2",
|
||||
"typingsPackageName": "argon2",
|
||||
@@ -54,6 +78,12 @@
|
||||
"sourceRepoURL": "http://www.babylonjs.com/",
|
||||
"asOfVersion": "2.4.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "base64url",
|
||||
"typingsPackageName": "base64url",
|
||||
"sourceRepoURL": "https://github.com/brianloveswords/base64url",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "BigInteger.js",
|
||||
"typingsPackageName": "big-integer",
|
||||
@@ -294,6 +324,12 @@
|
||||
"sourceRepoURL": "https://github.com/localForage/localForage",
|
||||
"asOfVersion": "0.0.34"
|
||||
},
|
||||
{
|
||||
"libraryName": "lodash-decorators",
|
||||
"typingsPackageName": "lodash-decorators",
|
||||
"sourceRepoURL": "https://github.com/steelsojka/lodash-decorators",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "lower-case",
|
||||
"typingsPackageName": "lower-case",
|
||||
@@ -438,6 +474,12 @@
|
||||
"sourceRepoURL": "https://github.com/getsentry/raven-js",
|
||||
"asOfVersion": "3.10.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "raw-body",
|
||||
"typingsPackageName": "raw-body",
|
||||
"sourceRepoURL": "https://github.com/stream-utils/raw-body",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-day-picker",
|
||||
"typingsPackageName": "react-day-picker",
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
"scripts": {
|
||||
"compile-scripts": "tsc -p scripts",
|
||||
"not-needed": "node scripts/not-needed.js",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 8",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
function repeat(s: string, count: number) {
|
||||
return Array(count + 1).join(s);
|
||||
}
|
||||
|
||||
const home = path.join(__dirname, '..');
|
||||
|
||||
for (const dirName of fs.readdirSync(home)) {
|
||||
|
||||
Vendored
+14
@@ -1041,6 +1041,12 @@ declare namespace AceAjax {
|
||||
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any): void;
|
||||
addEventListener(ev: string, callback: Function): void;
|
||||
|
||||
off(ev: string, callback: Function): void;
|
||||
|
||||
removeListener(ev: string, callback: Function): void;
|
||||
|
||||
removeEventListener(ev: string, callback: Function): void;
|
||||
|
||||
inMultiSelectMode: boolean;
|
||||
|
||||
selectMoreLines(n: number): void;
|
||||
@@ -2166,8 +2172,16 @@ declare namespace AceAjax {
|
||||
**/
|
||||
export interface Selection {
|
||||
|
||||
on(ev: string, callback: Function): void;
|
||||
|
||||
addEventListener(ev: string, callback: Function): void;
|
||||
|
||||
off(ev: string, callback: Function): void;
|
||||
|
||||
removeListener(ev: string, callback: Function): void;
|
||||
|
||||
removeEventListener(ev: string, callback: Function): void;
|
||||
|
||||
moveCursorWordLeft(): void;
|
||||
|
||||
moveCursorWordRight(): void;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// Actual tests inside ./test/
|
||||
|
||||
const a: string = adone.ok;
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const _null: symbol;
|
||||
export { _null as null };
|
||||
export function noop(): void;
|
||||
export function identity<T>(x: T): T;
|
||||
export function truly(): true;
|
||||
export function falsely(): false;
|
||||
export const ok: "OK";
|
||||
export const bad: "BAD";
|
||||
export const exts: [".js", ".tjs", ".ajs"];
|
||||
export function log(...args: any[]): void;
|
||||
export function fatal(...args: any[]): void;
|
||||
export function error(...args: any[]): void;
|
||||
export function warn(...args: any[]): void;
|
||||
export function info(...args: any[]): void;
|
||||
export function debug(...args: any[]): void;
|
||||
export function trace(...args: any[]): void;
|
||||
export function o(...props: any[]): object;
|
||||
export const Date: typeof global.Date;
|
||||
export const hrtime: typeof global.process.hrtime;
|
||||
export const setTimeout: typeof global.setTimeout;
|
||||
export const setInterval: typeof global.setInterval;
|
||||
export const setImmediate: typeof global.setImmediate;
|
||||
export const clearTimeout: typeof global.clearTimeout;
|
||||
export const clearInterval: typeof global.clearInterval;
|
||||
export const clearImmediate: typeof global.clearImmediate;
|
||||
interface LazifyOptions {
|
||||
configurable: boolean;
|
||||
}
|
||||
export function lazify(modules: object, obj?: object, require?: (path: string) => any, options?: LazifyOptions): object;
|
||||
interface Tag {
|
||||
set(Class: object, tag: string): void;
|
||||
has(obj: object, tag: string): boolean;
|
||||
define(tag: string, predicate?: string): void;
|
||||
SUBSYSTEM: symbol;
|
||||
APPLICATION: symbol;
|
||||
TRANSFORM: symbol;
|
||||
CORE_STREAM: symbol;
|
||||
LOGGER: symbol;
|
||||
LONG: symbol;
|
||||
BIGNUMBER: symbol;
|
||||
EXBUFFER: symbol;
|
||||
EXDATE: symbol;
|
||||
CONFIGURATION: symbol;
|
||||
GENESIS_NETRON: symbol;
|
||||
GENESIS_PEER: symbol;
|
||||
NETRON: symbol;
|
||||
NETRON_PEER: symbol;
|
||||
NETRON_ADAPTER: symbol;
|
||||
NETRON_DEFINITION: symbol;
|
||||
NETRON_DEFINITIONS: symbol;
|
||||
NETRON_REFERENCE: symbol;
|
||||
NETRON_INTERFACE: symbol;
|
||||
NETRON_STUB: symbol;
|
||||
NETRON_REMOTESTUB: symbol;
|
||||
NETRON_STREAM: symbol;
|
||||
FAST_STREAM: symbol;
|
||||
FAST_FS_STREAM: symbol;
|
||||
FAST_FS_MAP_STREAM: symbol;
|
||||
}
|
||||
export const tag: Tag;
|
||||
export function run(App: object, ignoreArgs?: boolean): Promise<void>;
|
||||
export function bind(libName: string): object;
|
||||
export function getAssetAbsolutePath(relPath: string): string;
|
||||
export function loadAsset(relPath: string): string | Buffer;
|
||||
export function require(path: string): object;
|
||||
export const package: object;
|
||||
|
||||
import * as std from "./glosses/std";
|
||||
export { std };
|
||||
|
||||
export * from "./glosses/common";
|
||||
export * from "./glosses/math";
|
||||
export * from "./glosses/utils";
|
||||
export * from "./glosses/assertion";
|
||||
export * from "./glosses/promise";
|
||||
export * from "./glosses/shani";
|
||||
|
||||
import "./glosses/shani-global";
|
||||
|
||||
export const assert: adone.assertion.I.AssertFunction;
|
||||
export const expect: adone.assertion.I.ExpectFunction;
|
||||
|
||||
export as namespace adone;
|
||||
Vendored
+1074
File diff suppressed because it is too large
Load Diff
Vendored
+465
@@ -0,0 +1,465 @@
|
||||
/**
|
||||
* predicates
|
||||
*/
|
||||
export namespace is {
|
||||
function _null(obj: any): boolean;
|
||||
export { _null as null };
|
||||
export function undefined(obj: any): boolean;
|
||||
export function exist(obj: any): boolean;
|
||||
export function nil(obj: any): boolean;
|
||||
export function number(obj: any): boolean;
|
||||
export function numeral(obj: any): boolean;
|
||||
export function infinite(obj: any): boolean;
|
||||
export function odd(obj: any): boolean;
|
||||
export function even(obj: any): boolean;
|
||||
export function float(obj: any): boolean;
|
||||
export function negativeZero(obj: any): boolean;
|
||||
export function string(obj: any): boolean;
|
||||
export function emptyString(obj: any): boolean;
|
||||
export function substring(substring: string, string: string, offset?: number): boolean;
|
||||
export function prefix(prefix: string, string: string): boolean;
|
||||
export function suffix(suffix: string, string: string): boolean;
|
||||
export function boolean(obj: any): boolean;
|
||||
export function json(obj: any): boolean;
|
||||
export function object(obj: any): boolean;
|
||||
export function plainObject(obj: any): boolean;
|
||||
function _class(obj: any): boolean;
|
||||
export { _class as class };
|
||||
export function emptyObject(obj: any): boolean;
|
||||
export function propertyOwned(obj: any, field: string): boolean;
|
||||
export function propertyDefined(obj: any, field: string): boolean;
|
||||
export function conforms(obj: object, schema: object, strict?: boolean): boolean;
|
||||
export function arrayLikeObject(obj: any): boolean;
|
||||
export function inArray<T>(value: T, array: any[], offset?: number, comparator?: (a: T, b: T) => boolean): boolean;
|
||||
export function sameType(value: any, other: any): boolean;
|
||||
export function primitive(obj: any): boolean;
|
||||
export function equalArrays(left: any[], right: any[]): boolean;
|
||||
export function deepEqual(left: any, right: any): boolean;
|
||||
export function shallowEqual(left: any, right: any): boolean;
|
||||
export function stream(obj: any): boolean;
|
||||
export function writableStream(obj: any): boolean;
|
||||
export function readableStream(obj: any): boolean;
|
||||
export function duplexStream(obj: any): boolean;
|
||||
export function transformStream(obj: any): boolean;
|
||||
export function utf8(obj: Buffer): boolean;
|
||||
export function win32PathAbsolute(path: string): boolean;
|
||||
export function posixPathAbsolute(path: string): boolean;
|
||||
export function pathAbsolute(path: string): boolean;
|
||||
export function glob(str: string): boolean;
|
||||
export function dotfile(str: string): boolean;
|
||||
function _function(obj: any): boolean;
|
||||
export { _function as function };
|
||||
export function asyncFunction(obj: any): boolean;
|
||||
export function promise(obj: any): boolean;
|
||||
export function validDate(str: string): boolean;
|
||||
export function buffer(obj: any): boolean;
|
||||
export function callback(obj: any): boolean;
|
||||
export function generator(obj: any): boolean;
|
||||
export function nan(obj: any): boolean;
|
||||
export function finite(obj: any): boolean;
|
||||
export function integer(obj: any): boolean;
|
||||
export function safeInteger(obj: any): boolean;
|
||||
export function array(obj: any): boolean;
|
||||
export function uint8Array(obj: any): boolean;
|
||||
export function configuration(obj: any): boolean;
|
||||
export function long(obj: any): boolean;
|
||||
export function bigNumber(obj: any): boolean;
|
||||
export function exbuffer(obj: any): boolean;
|
||||
export function exdate(obj: any): boolean;
|
||||
export function transform(obj: any): boolean;
|
||||
export function subsystem(obj: any): boolean;
|
||||
export function application(obj: any): boolean;
|
||||
export function logger(obj: any): boolean;
|
||||
export function coreStream(obj: any): boolean;
|
||||
export function fastStream(obj: any): boolean;
|
||||
export function fastFSStream(obj: any): boolean;
|
||||
export function fastFSMapStream(obj: any): boolean;
|
||||
export function genesisNetron(obj: any): boolean;
|
||||
export function genesisPeer(obj: any): boolean;
|
||||
export function netronAdapter(obj: any): boolean;
|
||||
export function netron(obj: any): boolean;
|
||||
export function netronPeer(obj: any): boolean;
|
||||
export function netronDefinition(obj: any): boolean;
|
||||
export function netronDefinitions(obj: any): boolean;
|
||||
export function netronReference(obj: any): boolean;
|
||||
export function netronInterface(obj: any): boolean;
|
||||
export function netronContext(obj: any): boolean;
|
||||
export function netronIMethod(netronInterface: object, name: string): boolean;
|
||||
export function netronIProperty(netronInterface: any, name: string): boolean;
|
||||
export function netronStub(obj: any): boolean;
|
||||
export function netronRemoteStub(obj: any): boolean;
|
||||
export function netronStream(obj: any): boolean;
|
||||
export function iterable(obj: any): boolean;
|
||||
export const windows: boolean;
|
||||
export const linux: boolean;
|
||||
export const freebsd: boolean;
|
||||
export const darwin: boolean;
|
||||
export const sunos: boolean;
|
||||
export function uppercase(str: string): boolean;
|
||||
export function lowercase(str: string): boolean;
|
||||
export function digits(str: string): boolean;
|
||||
export function identifier(str: string): boolean;
|
||||
export function binaryExtension(str: string): boolean;
|
||||
export function binaryPath(str: string): boolean;
|
||||
export function ip4(str: string): boolean;
|
||||
export function ip6(str: string): boolean;
|
||||
export function arrayBuffer(obj: any): boolean;
|
||||
export function arrayBufferView(obj: any): boolean;
|
||||
export function date(obj: any): boolean;
|
||||
export function error(obj: any): boolean;
|
||||
export function map(obj: any): boolean;
|
||||
export function regexp(obj: any): boolean;
|
||||
export function set(obj: any): boolean;
|
||||
export function symbol(obj: any): boolean;
|
||||
export function validUTF8(obj: any): boolean;
|
||||
}
|
||||
|
||||
export namespace x {
|
||||
class Exception extends Error {
|
||||
constructor(message?: string | Error, captureStackTrace?: boolean);
|
||||
}
|
||||
class Runtime extends Exception { }
|
||||
class IncompleteBufferError extends Exception { }
|
||||
class NotImplemented extends Exception { }
|
||||
class IllegalState extends Exception { }
|
||||
class NotValid extends Exception { }
|
||||
class Unknown extends Exception { }
|
||||
class NotExists extends Exception { }
|
||||
class Exists extends Exception { }
|
||||
class Empty extends Exception { }
|
||||
class InvalidAccess extends Exception { }
|
||||
class NotSupported extends Exception { }
|
||||
class InvalidArgument extends Exception { }
|
||||
class InvalidNumberOfArguments extends Exception { }
|
||||
class NotFound extends Exception { }
|
||||
class Timeout extends Exception { }
|
||||
class Incorrect extends Exception { }
|
||||
class NotAllowed extends Exception { }
|
||||
class LimitExceeded extends Exception { }
|
||||
class Encoding extends Exception { }
|
||||
class Network extends Exception { }
|
||||
class Bind extends Exception { }
|
||||
class Connect extends Exception { }
|
||||
class Database extends Exception { }
|
||||
class DatabaseInitialization extends Exception { }
|
||||
class DatabaseOpen extends Exception { }
|
||||
class DatabaseRead extends Exception { }
|
||||
class DatabaseWrite extends Exception { }
|
||||
class NetronIllegalState extends Exception { }
|
||||
class NetronPeerDisconnected extends Exception { }
|
||||
class NetronTimeout extends Exception { }
|
||||
}
|
||||
|
||||
export class EventEmitter {
|
||||
static listenerCount(emitter: EventEmitter, event: string | symbol): number;
|
||||
static defaultMaxListeners: number;
|
||||
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
removeAllListeners(event?: string | symbol): this;
|
||||
setMaxListeners(n: number): this;
|
||||
getMaxListeners(): number;
|
||||
listeners(event: string | symbol): Array<(...args: any[]) => any>;
|
||||
emit(event: string | symbol, ...args: any[]): boolean;
|
||||
eventNames(): Array<string | symbol>;
|
||||
listenerCount(type: string | symbol): number;
|
||||
}
|
||||
|
||||
export class AsyncEmitter extends EventEmitter {
|
||||
constructor(concurrency?: number);
|
||||
|
||||
setConcurrency(max?: number): this;
|
||||
|
||||
emitParallel(event: string, ...args: any[]): Promise<any[]>;
|
||||
|
||||
emitSerial(event: string, ...args: any[]): Promise<any[]>;
|
||||
|
||||
emitReduce(event: string, ...args: any[]): Promise<any>;
|
||||
|
||||
emitReduceRight(event: string, ...args: any[]): Promise<any>;
|
||||
|
||||
subscribe(event: string, listener: (...args: any[]) => void, once?: boolean): () => void;
|
||||
}
|
||||
|
||||
declare namespace I {
|
||||
type Long = adone.math.Long;
|
||||
|
||||
type Longable = adone.math.I.Longable;
|
||||
|
||||
namespace ExBuffer {
|
||||
interface Varint32 {
|
||||
value: number;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface Varint64 {
|
||||
value: Long;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface String {
|
||||
string: string;
|
||||
length: number;
|
||||
}
|
||||
|
||||
type Wrappable = string | ExBuffer | Buffer | Uint8Array | ArrayBuffer;
|
||||
|
||||
type METRICS = "b" | "c";
|
||||
}
|
||||
}
|
||||
|
||||
export class ExBuffer {
|
||||
constructor(capacity?: number, noAssert?: boolean);
|
||||
|
||||
readBitSet(offset?: number): number[];
|
||||
|
||||
read(length: number, offset?: number): ExBuffer;
|
||||
|
||||
readInt8(offset?: number): number;
|
||||
|
||||
readUInt8(offset?: number): number;
|
||||
|
||||
readInt16LE(offset?: number): number;
|
||||
|
||||
readUInt16LE(offset?: number): number;
|
||||
|
||||
readInt16BE(offset?: number): number;
|
||||
|
||||
readUInt16BE(offset?: number): number;
|
||||
|
||||
readInt32LE(offset?: number): number;
|
||||
|
||||
readUInt32LE(offset?: number): number;
|
||||
|
||||
readInt32BE(offset?: number): number;
|
||||
|
||||
readUInt32BE(offset?: number): number;
|
||||
|
||||
readInt64LE(offset?: number): adone.math.Long;
|
||||
|
||||
readUInt64LE(offset?: number): adone.math.Long;
|
||||
|
||||
readInt64BE(offset?: number): adone.math.Long;
|
||||
|
||||
readUInt64BE(offset?: number): adone.math.Long;
|
||||
|
||||
readFloatLE(offset?: number): number;
|
||||
|
||||
readFloatBE(offset?: number): number;
|
||||
|
||||
readDoubleLE(offset?: number): number;
|
||||
|
||||
readDoubleBE(offset?: number): number;
|
||||
|
||||
write(source: I.ExBuffer.Wrappable, offset?: number, length?: number, encoding?: string): this;
|
||||
|
||||
writeBitSet(value: number[]): this;
|
||||
|
||||
writeBitSet(value: number[], offset: number): number;
|
||||
|
||||
writeInt8(value: number, offset?: number): this;
|
||||
|
||||
writeUInt8(value: number, offset?: number): this;
|
||||
|
||||
writeInt16LE(value: number, offset?: number): this;
|
||||
|
||||
writeInt16BE(value: number, offset?: number): this;
|
||||
|
||||
writeUInt16LE(value: number, offset?: number): this;
|
||||
|
||||
writeUInt16BE(value: number, offset?: number): this;
|
||||
|
||||
writeInt32LE(value: number, offset?: number): this;
|
||||
|
||||
writeInt32BE(value: number, offset?: number): this;
|
||||
|
||||
writeUInt32LE(value: number, offset?: number): this;
|
||||
|
||||
writeUInt32BE(value: number, offset?: number): this;
|
||||
|
||||
writeInt64LE(value: I.Longable, offset?: number): this;
|
||||
|
||||
writeInt64BE(value: I.Longable, offset?: number): this;
|
||||
|
||||
writeUInt64LE(value: I.Longable, offset?: number): this;
|
||||
|
||||
writeUInt64BE(value: I.Longable, offset?: number): this;
|
||||
|
||||
writeFloatLE(value: number, offset?: number): this;
|
||||
|
||||
writeFloatBE(value: number, offset?: number): this;
|
||||
|
||||
writeDoubleLE(value: number, offset?: number): this;
|
||||
|
||||
writeDoubleBE(value: number, offset?: number): this;
|
||||
|
||||
writeVarint32(value: number): this;
|
||||
|
||||
writeVarint32(value: number, offset: number): number;
|
||||
|
||||
writeVarint32ZigZag(value: number): this;
|
||||
|
||||
writeVarint32ZigZag(value: number, offset: number): number;
|
||||
|
||||
readVarint32(): number;
|
||||
|
||||
readVarint32(offset: number): I.ExBuffer.Varint32;
|
||||
|
||||
readVarint32ZigZag(): number;
|
||||
|
||||
readVarint32ZigZag(offset: number): I.ExBuffer.Varint32;
|
||||
|
||||
writeVarint64(value: I.Longable): this;
|
||||
|
||||
writeVarint64(value: I.Longable, offset: number): number;
|
||||
|
||||
writeVarint64ZigZag(value: I.Longable): this;
|
||||
|
||||
writeVarint64ZigZag(value: I.Longable, offset: number): number;
|
||||
|
||||
readVarint64(): I.Long;
|
||||
|
||||
readVarint64(offset: number): I.ExBuffer.Varint64;
|
||||
|
||||
readVarint64ZigZag(): adone.math.Long;
|
||||
|
||||
readVarint64ZigZag(offset: number): I.ExBuffer.Varint64;
|
||||
|
||||
writeCString(str: string): this;
|
||||
|
||||
writeCString(str: string, offset: number): number;
|
||||
|
||||
readCString(): string;
|
||||
|
||||
readCString(offset: number): I.ExBuffer.String;
|
||||
|
||||
writeString(str: string): this;
|
||||
|
||||
writeString(str: string, offset: number): number;
|
||||
|
||||
readString(length: number, metrics?: I.ExBuffer.METRICS): string;
|
||||
|
||||
readString(length: number, metrics: I.ExBuffer.METRICS, offset: number): I.ExBuffer.String;
|
||||
|
||||
readString(length: number, offset: number): I.ExBuffer.String;
|
||||
|
||||
writeVString(str: string): this;
|
||||
|
||||
writeVString(str: string, offset: number): number;
|
||||
|
||||
readVString(): string;
|
||||
|
||||
readVString(offset: number): I.ExBuffer.String;
|
||||
|
||||
appendTo(target: ExBuffer, offset?: number): this;
|
||||
|
||||
assert(assert?: boolean): this;
|
||||
|
||||
capacity(): number;
|
||||
|
||||
clear(): this;
|
||||
|
||||
compact(begin?: number, end?: number): this;
|
||||
|
||||
copy(begin?: number, end?: number): ExBuffer;
|
||||
|
||||
copyTo(target: ExBuffer, targetOffset?: number, souceOffset?: number, sourceLimit?: number): this | ExBuffer;
|
||||
|
||||
ensureCapacity(capacity: number): this;
|
||||
|
||||
fill(value: string | number, begin?: number, end?: number): this;
|
||||
|
||||
flip(): this;
|
||||
|
||||
mark(offset?: number): this;
|
||||
|
||||
prepend(source: I.ExBuffer.Wrappable, encoding?: string, offset?: number): this;
|
||||
|
||||
prepend(source: I.ExBuffer.Wrappable, offset: number): this;
|
||||
|
||||
prependTo(target: ExBuffer, offset?: number): this;
|
||||
|
||||
remaining(): number;
|
||||
|
||||
reset(): this;
|
||||
|
||||
resize(capacity: number): this;
|
||||
|
||||
reverse(begin?: number, end?: number): this;
|
||||
|
||||
skip(length: number): this;
|
||||
|
||||
slice(begin?: number, end?: number): ExBuffer;
|
||||
|
||||
toBuffer(forceCopy?: boolean, begin?: number, end?: number): Buffer;
|
||||
|
||||
toArrayBuffer(): ArrayBuffer;
|
||||
|
||||
toString(encoding?: string, begin?: number, end?: number): string;
|
||||
|
||||
toBase64(begin?: number, end?: number): string;
|
||||
|
||||
toBinary(begin?: number, end?: number): string;
|
||||
|
||||
toDebug(columns?: boolean): string;
|
||||
|
||||
toHex(begin?: number, end?: number): string;
|
||||
|
||||
toUTF8(begin?: number, end?: number): string;
|
||||
|
||||
static accessor(): typeof Buffer;
|
||||
|
||||
static allocate(capacity?: number, noAssert?: boolean): ExBuffer;
|
||||
|
||||
static concat(buffers: I.ExBuffer.Wrappable[], encoding?: string, noAssert?: boolean): ExBuffer;
|
||||
|
||||
static type(): typeof Buffer;
|
||||
|
||||
static wrap(buffer: I.ExBuffer.Wrappable, encoding?: string, noAssert?: boolean): ExBuffer;
|
||||
|
||||
static calculateVarint32(value: number): number;
|
||||
|
||||
static zigZagEncode32(n: number): number;
|
||||
|
||||
static zigZagDecode32(n: number): number;
|
||||
|
||||
static calculateVarint64(value: number | string): number;
|
||||
|
||||
static zigZagEncode64(value: number | string | I.Long): I.Long;
|
||||
|
||||
static zigZagDecode64(value: number | string | I.Long): I.Long;
|
||||
|
||||
static calculateUTF8Chars(str: string): number;
|
||||
|
||||
static calculateString(str: string): number;
|
||||
|
||||
static fromBase64(str: string): ExBuffer;
|
||||
|
||||
static btoa(str: string): string;
|
||||
|
||||
static atob(b64: string): string;
|
||||
|
||||
static fromBinary(str: string): ExBuffer;
|
||||
|
||||
static fromDebug(str: string, noAssert?: boolean): ExBuffer;
|
||||
|
||||
static fromHex(str: string, noAssert?: boolean): ExBuffer;
|
||||
|
||||
static fromUTF8(str: string, noAssert?: boolean): ExBuffer;
|
||||
|
||||
static DEFAULT_CAPACITY: number;
|
||||
|
||||
static DEFAULT_NOASSERT: boolean;
|
||||
|
||||
static MAX_VARINT32_BYTES: number;
|
||||
|
||||
static MAX_VARINT64_BYTES: number;
|
||||
|
||||
static METRICS_CHARS: string;
|
||||
|
||||
static METRICS_BYTES: string;
|
||||
}
|
||||
Vendored
+118
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* math related things
|
||||
*/
|
||||
export namespace math {
|
||||
namespace I {
|
||||
interface LowHighBits {
|
||||
low: number;
|
||||
high: number;
|
||||
}
|
||||
type Longable = math.Long | number | string | LowHighBits;
|
||||
}
|
||||
|
||||
export class Long {
|
||||
constructor(low?: number, high?: number, unsigned?: boolean);
|
||||
|
||||
toInt(): number;
|
||||
|
||||
toNumber(): number;
|
||||
|
||||
toString(radix?: number): string;
|
||||
|
||||
getHighBits(): number;
|
||||
|
||||
getHighBitsUnsigned(): number;
|
||||
|
||||
getLowBits(): number;
|
||||
|
||||
getLowBitsUnsigned(): number;
|
||||
|
||||
getNumBitsAbs(): number;
|
||||
|
||||
isZero(): boolean;
|
||||
|
||||
isNegative(): boolean;
|
||||
|
||||
isPositive(): boolean;
|
||||
|
||||
isOdd(): boolean;
|
||||
|
||||
isEven(): boolean;
|
||||
|
||||
equals(other: I.Longable): boolean;
|
||||
|
||||
lessThan(other: I.Longable): boolean;
|
||||
|
||||
lessThanOrEqual(other: I.Longable): boolean;
|
||||
|
||||
greaterThan(other: I.Longable): boolean;
|
||||
|
||||
greaterThanOrEqual(other: I.Longable): boolean;
|
||||
|
||||
compare(other: I.Longable): number;
|
||||
|
||||
negate(): Long;
|
||||
|
||||
add(addend: I.Longable): Long;
|
||||
|
||||
sub(subtrahend: I.Longable): Long;
|
||||
|
||||
mul(multiplier: I.Longable): Long;
|
||||
|
||||
div(divisor: I.Longable): Long;
|
||||
|
||||
mod(divisor: I.Longable): Long;
|
||||
|
||||
not(): Long;
|
||||
|
||||
and(other: I.Longable): Long;
|
||||
|
||||
or(other: I.Longable): Long;
|
||||
|
||||
xor(other: I.Longable): Long;
|
||||
|
||||
shl(numBits: number | Long): Long;
|
||||
|
||||
shr(numBits: number | Long): Long;
|
||||
|
||||
shru(numBits: number | Long): Long;
|
||||
|
||||
toSigned(): Long;
|
||||
|
||||
toUnsigned(): Long;
|
||||
|
||||
toBytes(le?: boolean): number[];
|
||||
|
||||
toBytesLE(): number[];
|
||||
|
||||
toBytesBE(): number[];
|
||||
|
||||
static fromInt(value: number, unsigned?: boolean): Long;
|
||||
|
||||
static fromNumber(value?: number, unsigned?: boolean): Long;
|
||||
|
||||
static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
|
||||
|
||||
static fromString(str: string, unsigned?: boolean, radix?: number): Long;
|
||||
|
||||
static fromString(str: string, radix?: number): Long;
|
||||
|
||||
static fromValue(val: I.Longable): Long;
|
||||
|
||||
static MIN_VALUE: Long;
|
||||
|
||||
static MAX_VALUE: Long;
|
||||
|
||||
static MAX_UNSIGNED_VALUE: Long;
|
||||
|
||||
static ZERO: Long;
|
||||
|
||||
static UZERO: Long;
|
||||
|
||||
static ONE: Long;
|
||||
|
||||
static UONE: Long;
|
||||
|
||||
static NEG_ONE: Long;
|
||||
}
|
||||
}
|
||||
Vendored
+114
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* promise helpers
|
||||
*/
|
||||
export namespace promise {
|
||||
namespace I {
|
||||
interface Deferred<T> {
|
||||
/**
|
||||
* Resolves the promise
|
||||
*/
|
||||
resolve(value?: T): void;
|
||||
|
||||
/**
|
||||
* Rejects the promise
|
||||
*/
|
||||
reject(value?: any): void;
|
||||
|
||||
promise: Promise<T>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a promise and returns an interface to control the state
|
||||
*/
|
||||
export function defer<T>(): I.Deferred<T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be resolved after given milliseconds
|
||||
*
|
||||
* @param ms delay in milliseconds
|
||||
* @param value resolving value
|
||||
*/
|
||||
export function delay<T>(ms: number, value?: T): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be rejected after given milliseconds if the given promise is not fulfilled
|
||||
*
|
||||
* @param ms timeout in milliseconds
|
||||
*/
|
||||
export function timeout<T>(promise: Promise<T>, ms: number): Promise<T>;
|
||||
|
||||
/**
|
||||
* Converts a promise to node.js style callback
|
||||
*/
|
||||
export function nodeify<T>(promise: Promise<T>, callback: (err?: any, value?: T) => void): Promise<T>;
|
||||
|
||||
namespace I {
|
||||
interface PromisifyOptions {
|
||||
/**
|
||||
* Context to bind to new function
|
||||
*/
|
||||
context?: object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a callback function to a promise-based function
|
||||
*/
|
||||
export function promisify<R>(fn: (callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): () => Promise<R>;
|
||||
export function promisify<T, R>(fn: (a: T, callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): (a: T) => Promise<R>;
|
||||
export function promisify<T>(fn: (a: T, callback: (err?: any) => void) => void, options?: I.PromisifyOptions): (a: T) => Promise<void>;
|
||||
export function promisify<T1, T2, R>(fn: (a: T1, b: T2, callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2) => Promise<R>;
|
||||
export function promisify<T1, T2>(fn: (a: T1, b: T2, callback: (err?: any) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, R>(fn: (a: T1, b: T2, c: T3, callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2, c: T3) => Promise<R>;
|
||||
export function promisify<T1, T2, T3>(fn: (a: T1, b: T2, c: T3, callback: (err?: any) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2, c: T3) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, T4, R>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, callback: (err?: any, result?: R) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4) => Promise<R>;
|
||||
export function promisify<T1, T2, T3, T4>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, callback: (err?: any) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, T4, T5, R>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, e: T5, callback: (err?: any, result?: R) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise<R>;
|
||||
export function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, callback: (err?: any) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise<void>;
|
||||
export function promisify(fn: (...args: any[]) => void, options?: I.PromisifyOptions): (...args: any[]) => Promise<any>;
|
||||
|
||||
namespace I {
|
||||
interface PromisifyAllOptions {
|
||||
/**
|
||||
* Suffix to use for keys
|
||||
*/
|
||||
suffix?: string;
|
||||
|
||||
/**
|
||||
* Function to filter keys
|
||||
*/
|
||||
|
||||
filter?(key: string): boolean;
|
||||
/**
|
||||
* Context to bind to new functions
|
||||
*/
|
||||
context?: object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Promisifies entire object
|
||||
*/
|
||||
export function promisifyAll(source: object, options?: I.PromisifyAllOptions): object;
|
||||
|
||||
/**
|
||||
* Executes a function after promise fulfillment
|
||||
*
|
||||
* @returns the original promise
|
||||
*/
|
||||
function _finally<T>(promise: Promise<T>, onFinally?: (...args: any[]) => void): Promise<T>;
|
||||
export { _finally as finally };
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Defines a tests block
|
||||
*/
|
||||
declare const describe: adone.shani.I.DescribeFunction;
|
||||
|
||||
/**
|
||||
* Defines a tests block
|
||||
*/
|
||||
declare const context: adone.shani.I.DescribeFunction;
|
||||
|
||||
/**
|
||||
* Defines a test
|
||||
*/
|
||||
declare const it: adone.shani.I.TestFunction;
|
||||
|
||||
/**
|
||||
* Defines a test
|
||||
*/
|
||||
declare const specify: adone.shani.I.TestFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called only once before the block's tests
|
||||
*/
|
||||
declare const before: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called only once after the block's tests
|
||||
*/
|
||||
declare const after: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called before each test
|
||||
*/
|
||||
declare const beforeEach: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called after each test
|
||||
*/
|
||||
declare const afterEach: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* assertion functions
|
||||
*/
|
||||
declare const assert: adone.assertion.I.AssertFunction;
|
||||
|
||||
/**
|
||||
* bdd-style assertion functons
|
||||
*/
|
||||
declare const expect: adone.assertion.I.ExpectFunction;
|
||||
|
||||
/**
|
||||
* tools for installing controllable timer functions
|
||||
*/
|
||||
declare const fakeClock: adone.util.I.fakeClock.FakeClock;
|
||||
|
||||
/**
|
||||
* defines a spy function
|
||||
*/
|
||||
declare const spy: typeof adone.shani.util.spy;
|
||||
|
||||
/**
|
||||
* defines a stub function
|
||||
*/
|
||||
declare const stub: typeof adone.shani.util.stub;
|
||||
|
||||
/**
|
||||
* defines a mock function
|
||||
*/
|
||||
declare const mock: typeof adone.shani.util.mock;
|
||||
|
||||
/**
|
||||
* defines a matcher for spies/stubs/mocks
|
||||
*/
|
||||
declare const match: typeof adone.shani.util.match;
|
||||
|
||||
/**
|
||||
* assertion tool for http server responses
|
||||
*/
|
||||
declare const request: typeof adone.shani.util.request;
|
||||
Vendored
+1655
File diff suppressed because it is too large
Load Diff
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
import * as assert from "assert";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as util from "util";
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
import * as url from "url";
|
||||
import * as net from "net";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as child_process from "child_process";
|
||||
import * as os from "os";
|
||||
import * as cluster from "cluster";
|
||||
import * as repl from "repl";
|
||||
import * as punycode from "punycode";
|
||||
import * as readline from "readline";
|
||||
import * as string_decoder from "string_decoder";
|
||||
import * as querystring from "querystring";
|
||||
import * as crypto from "crypto";
|
||||
import * as vm from "vm";
|
||||
import * as v8 from "v8";
|
||||
import * as domain from "domain";
|
||||
import * as tty from "tty";
|
||||
import * as buffer from "buffer";
|
||||
import * as constants from "constants";
|
||||
import * as zlib from "zlib";
|
||||
import * as tls from "tls";
|
||||
import * as console from "console";
|
||||
import * as dns from "dns";
|
||||
import * as timers from "timers";
|
||||
import * as dgram from "dgram";
|
||||
|
||||
export {
|
||||
assert,
|
||||
fs,
|
||||
path,
|
||||
util,
|
||||
events,
|
||||
stream,
|
||||
url,
|
||||
net,
|
||||
http,
|
||||
https,
|
||||
child_process,
|
||||
os,
|
||||
cluster,
|
||||
repl,
|
||||
punycode,
|
||||
readline,
|
||||
string_decoder,
|
||||
querystring,
|
||||
crypto,
|
||||
vm,
|
||||
v8,
|
||||
domain,
|
||||
tty,
|
||||
buffer,
|
||||
constants,
|
||||
zlib,
|
||||
tls,
|
||||
console,
|
||||
dns,
|
||||
timers,
|
||||
dgram,
|
||||
};
|
||||
Vendored
+473
@@ -0,0 +1,473 @@
|
||||
/**
|
||||
* various utility functions
|
||||
*/
|
||||
export namespace util {
|
||||
function arrify<T>(val: T[]): T[];
|
||||
function arrify<T>(val: T): [T];
|
||||
|
||||
function slice<T>(args: T[], sliceStart?: number, sliceEnd?: number): T[];
|
||||
|
||||
function spliceOne(list: any[], index: number): void;
|
||||
|
||||
function normalizePath(str: string, stripTrailing?: boolean): string;
|
||||
|
||||
function unixifyPath(filePath: string, unescape?: boolean): string;
|
||||
|
||||
function functionName(fn: (...args: any[]) => any): string;
|
||||
|
||||
function mapArguments(argmap: (...args: any[]) => 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;
|
||||
hours: number;
|
||||
minutes: number;
|
||||
seconds: number;
|
||||
milliseconds: number;
|
||||
}
|
||||
}
|
||||
function parseMs(ms: number): I.ParseMsResult;
|
||||
|
||||
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[];
|
||||
|
||||
function enumerate<T>(iterable: Iterable<T>, start?: number): IterableIterator<[number, T]>;
|
||||
|
||||
function zip<T1, T2>(a: Iterable<T1>, b: Iterable<T2>): IterableIterator<[T1, T2]>;
|
||||
function zip<T1, T2, T3>(a: Iterable<T1>, b: Iterable<T2>, c: Iterable<T3>): IterableIterator<[T1, T2, T3]>;
|
||||
function zip<T1, T2, T3, T4>(a: Iterable<T1>, b: Iterable<T2>, c: Iterable<T3>, d: Iterable<T4>): IterableIterator<[T1, T2, T3, T4]>;
|
||||
function zip(...iterables: Array<Iterable<any>>): IterableIterator<any[]>;
|
||||
|
||||
namespace I {
|
||||
interface KeysOptions {
|
||||
onlyEnumerable?: boolean;
|
||||
followProto?: boolean;
|
||||
all?: boolean;
|
||||
}
|
||||
}
|
||||
function keys(object: object, options?: I.KeysOptions): string[];
|
||||
|
||||
function values(object: object, options?: I.KeysOptions): any[];
|
||||
|
||||
function entries(object: object, options?: I.KeysOptions): Array<string | any>;
|
||||
|
||||
function toDotNotation(object: object): object;
|
||||
|
||||
namespace I {
|
||||
interface FlattenOptions {
|
||||
depth?: number;
|
||||
}
|
||||
}
|
||||
function flatten(array: any[], options?: I.FlattenOptions): any[];
|
||||
|
||||
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;
|
||||
compare?(a: any, b: any): number;
|
||||
}
|
||||
}
|
||||
function sortKeys(object: object, options?: I.SortKeysOptions): object;
|
||||
|
||||
namespace I {
|
||||
interface GlobizeOptions {
|
||||
exts?: string;
|
||||
recursively?: boolean;
|
||||
}
|
||||
}
|
||||
function globize(path: string, options?: I.GlobizeOptions): string;
|
||||
|
||||
function unique<T>(array: T[], projection?: (a: T) => any): T[];
|
||||
|
||||
function invertObject(source: object, options?: I.KeysOptions): object;
|
||||
|
||||
namespace I {
|
||||
interface HumanizeTimeOptions {
|
||||
msDecimalDigits?: number;
|
||||
secDecimalDigits?: number;
|
||||
verbose?: boolean;
|
||||
compact?: boolean;
|
||||
}
|
||||
}
|
||||
function humanizeTime(ms: number, options?: I.HumanizeTimeOptions): string;
|
||||
function humanizeSize(num: number, space?: string): string;
|
||||
|
||||
function parseSize(str: string | number): number | null;
|
||||
|
||||
namespace I {
|
||||
interface CloneOptions {
|
||||
deep?: boolean;
|
||||
}
|
||||
}
|
||||
function clone(object: object, options?: I.CloneOptions): object;
|
||||
|
||||
function toUTF8Array(str: string): number[];
|
||||
|
||||
function asyncIter<T>(array: T[], iter: (elem: T, index: number, cb: () => void) => any, cb: () => void): void;
|
||||
|
||||
function asyncFor<T>(obj: { [key: string]: T }, iter: (key: string, value: T, index: number, length: number, next: () => void) => void, cb: () => void): void;
|
||||
|
||||
namespace I {
|
||||
interface OnceOptions {
|
||||
silent: boolean;
|
||||
}
|
||||
}
|
||||
function once<T>(fn: (...args: any[]) => T, options?: I.OnceOptions): (...args: any[]) => T;
|
||||
|
||||
namespace I {
|
||||
type WaterFallTask = (...args: any[]) => void;
|
||||
}
|
||||
function asyncWaterfall<T>(tasks: I.WaterFallTask[], callback?: (err?: Error | null, ...args: any[]) => void): void;
|
||||
|
||||
function xrange(start?: number, stop?: number, step?: number): IterableIterator<number>;
|
||||
|
||||
function range(start?: number, stop?: number, step?: number): number[];
|
||||
|
||||
function reFindAll(regexp: RegExp, str: string): RegExpExecArray[];
|
||||
|
||||
function assignDeep<T>(target: T, ...sources: object[]): T;
|
||||
|
||||
namespace I {
|
||||
interface MatchOptions {
|
||||
index?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
dot?: boolean;
|
||||
}
|
||||
}
|
||||
function match(criteria: any | any[], options?: I.MatchOptions): (value: any | any[], options?: I.MatchOptions) => number | boolean;
|
||||
function match(criteria: any | any[], value: any | any[], options?: I.MatchOptions): number | boolean;
|
||||
|
||||
namespace I {
|
||||
interface ToposortFunction {
|
||||
<T>(edges: Array<[T, T]>): T[];
|
||||
array<T>(nodes: T[], edges: Array<[T, T]>): T[];
|
||||
}
|
||||
}
|
||||
const toposort: I.ToposortFunction;
|
||||
|
||||
namespace I {
|
||||
interface JSEscOptions {
|
||||
escapeEverything?: boolean;
|
||||
minimal?: boolean;
|
||||
isScriptContext?: boolean;
|
||||
quotes?: string;
|
||||
wrap?: boolean;
|
||||
es6?: boolean;
|
||||
json?: boolean;
|
||||
compact?: boolean;
|
||||
lowercaseHex?: boolean;
|
||||
numbers?: string;
|
||||
indent?: string;
|
||||
indentLevel?: number;
|
||||
__inline1__?: boolean;
|
||||
__inline2__?: boolean;
|
||||
}
|
||||
}
|
||||
function jsesc(argument: any, options?: I.JSEscOptions): string;
|
||||
|
||||
namespace I {
|
||||
type PossibleTypes = "object" | "class" | "null" | "global" | "Array" | "RegExp" | "Date"
|
||||
| "Promise" | "Set" | "Map" | "WeakSet" | "DataView" | "Map Iterator" | "Set Iterator"
|
||||
| "Array Iterator" | "String Iterator" | "Object" | "function" | "boolean" | "number"
|
||||
| "undefined" | "string" | "symbol";
|
||||
}
|
||||
|
||||
function typeOf(obj: any): I.PossibleTypes;
|
||||
function typeOf(obj: any): string;
|
||||
|
||||
namespace memcpy {
|
||||
function utou(target: Buffer, targetOffset: number, source: Buffer, sourceStart: number, sourceEnd: number): number;
|
||||
function atoa(target: ArrayBuffer, targetOffset: number, source: ArrayBuffer, sourceStart: number, sourceEnd: number): number;
|
||||
function atou(target: Buffer, targetOffset: number, source: ArrayBuffer, sourceStart: number, sourceEnd: number): number;
|
||||
function utoa(target: ArrayBuffer, targetOffset: number, source: Buffer, sourceStart: number, sourceEnd: number): number;
|
||||
function copy(target: Buffer | ArrayBuffer, targetOffset: number, source: Buffer | ArrayBuffer, sourceStart: number, sourceEnd: number): number;
|
||||
}
|
||||
|
||||
namespace uuid {
|
||||
namespace I {
|
||||
interface V1Options {
|
||||
clockseq?: number;
|
||||
msecs?: number;
|
||||
nsecs?: number;
|
||||
}
|
||||
}
|
||||
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 v5(name: string | number[], namespace: string | number[]): string;
|
||||
function v5(name: string | number[], namespace: string | number[], buf: any[], offset?: number): number[];
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface Delegator {
|
||||
method(name: string): Delegator;
|
||||
access(name: string): Delegator;
|
||||
getter(name: string): Delegator;
|
||||
setter(name: string): Delegator;
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
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 | any[], stringifyObjects?: boolean, timeZone?: string): string;
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface EditorOptions {
|
||||
text?: string;
|
||||
editor?: string;
|
||||
path?: string;
|
||||
ext?: string;
|
||||
}
|
||||
}
|
||||
class Editor {
|
||||
static DEFAULT: string;
|
||||
|
||||
constructor(options?: I.EditorOptions);
|
||||
|
||||
spawn(): Promise<adone.std.child_process.ChildProcess>;
|
||||
|
||||
run(): Promise<string>;
|
||||
|
||||
cleanup(): Promise<void>;
|
||||
|
||||
static edit(options?: I.EditorOptions): Promise<string>;
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface BinarySearchFunction {
|
||||
<T>(aHaystack: T[], aNeedle: number, aLow?: number, aHigh?: number, aCompare?: (a: T, b: T) => number, aBias?: number): T;
|
||||
GREATEST_LOWER_BOUND: number;
|
||||
LEAST_UPPER_BOUND: number;
|
||||
}
|
||||
}
|
||||
const binarySearch: I.BinarySearchFunction;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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>;
|
||||
|
||||
namespace I.fakeClock {
|
||||
interface Timer {
|
||||
id: number;
|
||||
ref(): void;
|
||||
unref(): void;
|
||||
}
|
||||
interface Clock {
|
||||
setTimeout(func: (...args: any[]) => void, timeout: number, ...args: any[]): Timer;
|
||||
clearTimeout(timer: Timer): void;
|
||||
nextTick(func: (...args: any[]) => void, ...args: any[]): void;
|
||||
setInterval(func: (...args: any[]) => void, ...args: any[]): Timer;
|
||||
clearInterval(timer: Timer): void;
|
||||
setImmediate(func: (...args: any[]) => void, ...args: any[]): Timer;
|
||||
clearImmediate(timer: Timer): void;
|
||||
updateHrTime(newNow: number): void;
|
||||
tick(ms: number): number;
|
||||
next(): number;
|
||||
runAll(): number;
|
||||
runToLast(): number;
|
||||
setSystemTime(systemTime: number): void;
|
||||
hrtime(prev?: [number, number]): [number, number];
|
||||
}
|
||||
interface InstalledClock extends Clock {
|
||||
uninstall(): void;
|
||||
}
|
||||
interface InstallOptions {
|
||||
target?: object;
|
||||
now?: number;
|
||||
toFake?: string[];
|
||||
loopLimit?: number;
|
||||
shouldAdvanceTime?: boolean;
|
||||
advanceTimeDelta?: number;
|
||||
}
|
||||
|
||||
interface Timers {
|
||||
setTimeout: typeof global.setTimeout;
|
||||
clearTimeout: typeof global.clearTimeout;
|
||||
setInterval: typeof global.setInterval;
|
||||
clearInterval: typeof global.clearInterval;
|
||||
setImmediate: typeof global.setImmediate;
|
||||
clearImmediate: typeof global.clearImmediate;
|
||||
Date: typeof global.Date;
|
||||
hrtime: typeof global.process.hrtime;
|
||||
nextTick: typeof global.process.nextTick;
|
||||
}
|
||||
|
||||
interface FakeClock {
|
||||
timers: Timers;
|
||||
createClock(now?: number, loopLimit?: number): Clock;
|
||||
install(now?: number | Date | InstallOptions): InstalledClock;
|
||||
}
|
||||
}
|
||||
|
||||
const fakeClock: I.fakeClock.FakeClock;
|
||||
|
||||
namespace ltgt {
|
||||
namespace I {
|
||||
interface Range<T> {
|
||||
lt?: T;
|
||||
lte?: T;
|
||||
gt?: T;
|
||||
gte?: T;
|
||||
min?: T;
|
||||
max?: T;
|
||||
start?: T;
|
||||
end?: T;
|
||||
reverse?: boolean;
|
||||
}
|
||||
type Comparator<T> = (a: T, b: T) => number;
|
||||
}
|
||||
function contains<T>(range: I.Range<T>, key: T, compare?: I.Comparator<T>): boolean;
|
||||
|
||||
function filter<T>(range: I.Range<T>, compare?: I.Comparator<T>): (key: T) => boolean;
|
||||
|
||||
function toLtgt<T, R>(
|
||||
range: I.Range<T>,
|
||||
_range: object,
|
||||
map?: (value: T, isUpperBound: boolean) => R,
|
||||
lowerBound?: T,
|
||||
upperBound?: T
|
||||
): I.Range<R>;
|
||||
|
||||
function endInclusive<T>(range: I.Range<T>): boolean;
|
||||
|
||||
function startInclusive<T>(range: I.Range<T>): boolean;
|
||||
|
||||
function end<T>(range: I.Range<T>): T | undefined;
|
||||
|
||||
function end<T, R>(range: I.Range<T>, defaultValue: R): T | R;
|
||||
|
||||
function start<T>(range: I.Range<T>): T | undefined;
|
||||
|
||||
function start<T, R>(range: I.Range<T>, defaultValue?: R): T | R;
|
||||
|
||||
function upperBound<T>(range: I.Range<T>): T | undefined;
|
||||
|
||||
function upperBound<T, R>(range: I.Range<T>, defaultValue: R): T | R;
|
||||
|
||||
function upperBoundKey<T>(range: I.Range<T>): T | undefined;
|
||||
|
||||
function upperBoundExclusive<T>(range: I.Range<T>): boolean;
|
||||
|
||||
function lowerBoundExclusive<T>(range: I.Range<T>): boolean;
|
||||
|
||||
function upperBoundInclusive<T>(range: I.Range<T>): boolean;
|
||||
|
||||
function lowerBoundInclusive<T>(range: I.Range<T>): boolean;
|
||||
|
||||
function lowerBound<T>(range: I.Range<T>): T | undefined;
|
||||
|
||||
function lowerBound<T, R>(range: I.Range<T>, defaultValue: R): T | R;
|
||||
|
||||
function lowerBoundKey<T>(range: I.Range<T>): T | undefined;
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for adone 0.6
|
||||
// Project: https://github.com/ciferox/adone
|
||||
// Definitions by: am <https://github.com/s0m3on3>, Maximus <https://github.com/maxveres>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import * as adone from "./adone";
|
||||
|
||||
export default adone;
|
||||
@@ -0,0 +1,653 @@
|
||||
namespace assertionTests {
|
||||
const { assertion } = adone;
|
||||
|
||||
namespace assertionInterface {
|
||||
namespace exception {
|
||||
const a: adone.x.Exception = new assertion.AssertionError();
|
||||
const b: adone.x.Exception = new assertion.AssertionError("hello");
|
||||
const c: adone.x.Exception = new assertion.AssertionError("hello", { actual: 2, expected: 3 }, () => {});
|
||||
}
|
||||
|
||||
namespace config {
|
||||
assertion.config.includeStack = true;
|
||||
assertion.config.proxyExcludedKeys = ["a"];
|
||||
assertion.config.showDiff = false;
|
||||
assertion.config.truncateThreshold = 20;
|
||||
assertion.config.useProxy = false;
|
||||
}
|
||||
|
||||
namespace loadInterfaces {
|
||||
assertion.loadAssertInterface().config.includeStack = true;
|
||||
assertion.loadExpectInterface().config.includeStack = true;
|
||||
assertion.loadMockInterface().config.includeStack = true;
|
||||
}
|
||||
|
||||
namespace use {
|
||||
assertion.use(() => {}).use(() => {}).config.includeStack = true;
|
||||
}
|
||||
}
|
||||
|
||||
const { assert } = assertion;
|
||||
|
||||
namespace assertTests {
|
||||
assert(1);
|
||||
assert(1, "hello");
|
||||
assert.fail();
|
||||
assert.fail(1);
|
||||
assert.fail(1, 2);
|
||||
assert.fail(1, 2, "hello");
|
||||
assert.fail(1, 2, "hello", "<");
|
||||
|
||||
assert.isOk(1);
|
||||
assert.isOk(1, "hello");
|
||||
|
||||
assert.isNotOk(1);
|
||||
assert.isNotOk(1, "hello");
|
||||
|
||||
assert.equal(1, 2);
|
||||
assert.equal(1, 2, "hello");
|
||||
|
||||
assert.notEqual(1, 2);
|
||||
assert.notEqual(1, 2, "hello");
|
||||
|
||||
assert.strictEqual(1, 2);
|
||||
assert.strictEqual(1, 2, "hello");
|
||||
|
||||
assert.notStrictEqual(1, 2);
|
||||
assert.notStrictEqual(1, 2, "hello");
|
||||
|
||||
assert.deepEqual(1, 2);
|
||||
assert.deepEqual(1, 2, "hello");
|
||||
|
||||
assert.deepStrictEqual(1, 2);
|
||||
assert.deepStrictEqual(1, 2, "hello");
|
||||
|
||||
assert.equalArrays([1, 2, 3], [4, 5, 6]);
|
||||
assert.equalArrays([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notDeepEqual(1, 2);
|
||||
assert.notDeepEqual(1, 2, "hello");
|
||||
|
||||
assert.isAbove(1, 2);
|
||||
assert.isAbove(1, 2, "hello");
|
||||
|
||||
assert.isAtLeast(1, 2);
|
||||
assert.isAtLeast(1, 2, "hello");
|
||||
|
||||
assert.isBelow(1, 2);
|
||||
assert.isBelow(1, 2, "hello");
|
||||
|
||||
assert.isAtMost(1, 2);
|
||||
assert.isAtMost(1, 2, "hello");
|
||||
|
||||
assert.isTrue(1);
|
||||
assert.isTrue(1, "hello");
|
||||
|
||||
assert.isNotTrue(1);
|
||||
assert.isNotTrue(1, "hello");
|
||||
|
||||
assert.isFalse(1);
|
||||
assert.isFalse(1, "hello");
|
||||
|
||||
assert.isNotFalse(1);
|
||||
assert.isNotFalse(1, "hello");
|
||||
|
||||
assert.isNull(1);
|
||||
assert.isNull(1, "hello");
|
||||
|
||||
assert.isNaN(1);
|
||||
assert.isNaN(1, "hello");
|
||||
|
||||
assert.isNotNaN(1);
|
||||
assert.isNotNaN(1, "hello");
|
||||
|
||||
assert.exists(1);
|
||||
assert.exists(1, "hello");
|
||||
|
||||
assert.notExists(1);
|
||||
assert.notExists(1, "hello");
|
||||
|
||||
assert.isUndefined(1);
|
||||
assert.isUndefined(1, "hello");
|
||||
|
||||
assert.isDefined(1);
|
||||
assert.isDefined(1, "hello");
|
||||
|
||||
assert.isFunction(1);
|
||||
assert.isFunction(1, "hello");
|
||||
|
||||
assert.isNotFunction(1);
|
||||
assert.isNotFunction(1, "hello");
|
||||
|
||||
assert.isObject(1);
|
||||
assert.isObject(1, "hello");
|
||||
|
||||
assert.isNotObject(1);
|
||||
assert.isNotObject(1, "hello");
|
||||
|
||||
assert.isArray(1);
|
||||
assert.isArray(1, "hello");
|
||||
|
||||
assert.isNotArray(1);
|
||||
assert.isNotArray(1, "hello");
|
||||
|
||||
assert.isString(1, "hello");
|
||||
|
||||
assert.isNotString(1);
|
||||
assert.isNotString(1, "hello");
|
||||
|
||||
assert.isNumber(1);
|
||||
assert.isNumber(1, "hello");
|
||||
|
||||
assert.isNotNumber(1);
|
||||
assert.isNotNumber(1, "hello");
|
||||
|
||||
assert.isFinite(1);
|
||||
assert.isFinite(1, "hello");
|
||||
|
||||
assert.isBoolean(1);
|
||||
assert.isBoolean(1, "hello");
|
||||
|
||||
assert.isNotBoolean(1);
|
||||
assert.isNotBoolean(1, "hello");
|
||||
|
||||
assert.typeOf(1, "string");
|
||||
assert.typeOf(1, "number", "hello");
|
||||
|
||||
assert.notTypeOf(1, "string");
|
||||
assert.notTypeOf(1, "number", "hello");
|
||||
|
||||
assert.instanceOf(1, Date);
|
||||
class A {}
|
||||
assert.instanceOf("4", A, "hello");
|
||||
|
||||
assert.notInstanceOf(1, Date);
|
||||
assert.notInstanceOf(Date, A, "hello");
|
||||
|
||||
assert.include([1, 2, 3], 4);
|
||||
assert.include([1, 2, 3], 4, "hello");
|
||||
assert.include("string", "string");
|
||||
assert.include("string", "string", "string");
|
||||
|
||||
assert.notInclude([1, 2, 3], 4);
|
||||
assert.notInclude([1, 2, 3], 4, "hello");
|
||||
assert.notInclude("string", "string");
|
||||
assert.notInclude("string", "string", "string");
|
||||
|
||||
assert.deepInclude([1, 2, 3], 4);
|
||||
assert.deepInclude([1, 2, 3], 4, "hello");
|
||||
assert.deepInclude("string", "string");
|
||||
assert.deepInclude("string", "string", "string");
|
||||
|
||||
assert.notDeepInclude([1, 2, 3], 4);
|
||||
assert.notDeepInclude([1, 2, 3], 4, "hello");
|
||||
assert.notDeepInclude("string", "string");
|
||||
assert.notDeepInclude("string", "string", "string");
|
||||
|
||||
assert.nestedInclude({ a: 1 }, {});
|
||||
assert.nestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notNestedInclude({ a: 1 }, {});
|
||||
assert.notNestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.deepNestedInclude({ a: 1 }, {});
|
||||
assert.deepNestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notDeepNestedInclude({ a: 1 }, {});
|
||||
assert.notDeepNestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.ownInclude({ a: 1 }, {});
|
||||
assert.ownInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notOwnInclude({ a: 1 }, {});
|
||||
assert.notOwnInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.deepOwnInclude({ a: 1 }, {});
|
||||
assert.deepOwnInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notDeepOwnInclude({ a: 1 }, {});
|
||||
assert.notDeepOwnInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.match("1", /\d+/);
|
||||
assert.match("1", /\d+/, "hello");
|
||||
|
||||
assert.notMatch("1", /\d+/);
|
||||
assert.notMatch("1", /\d+/, "hello");
|
||||
|
||||
assert.property({ a: 1 }, "a");
|
||||
assert.property({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.notProperty({ a: 1 }, "a");
|
||||
assert.notProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.propertyVal({ a: 1 }, "a", 1);
|
||||
assert.propertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.deepPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.deepPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notDeepPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notDeepPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.ownProperty({ a: 1 }, "a");
|
||||
assert.ownProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.notOwnProperty({ a: 1 }, "a");
|
||||
assert.notOwnProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.ownPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.ownPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.deepOwnPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.deepOwnPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notDeepOwnPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notDeepOwnPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.nestedProperty({ a: 1 }, "a");
|
||||
assert.nestedProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.notNestedProperty({ a: 1 }, "a");
|
||||
assert.notNestedProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.nestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.nestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notNestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notNestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.deepNestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.deepNestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notDeepNestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notDeepNestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.lengthOf([1, 2, 3], 3);
|
||||
assert.lengthOf([1, 2, 3], 3, "hello");
|
||||
|
||||
assert.hasAnyKeys({ a: 1 }, "a");
|
||||
assert.hasAnyKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAnyKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAnyKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAnyKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.hasAllKeys({ a: 1 }, "a");
|
||||
assert.hasAllKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAllKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAllKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAllKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.containsAllKeys({ a: 1 }, "a");
|
||||
assert.containsAllKeys({ a: 1 }, ["a"]);
|
||||
assert.containsAllKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.containsAllKeys({ a: 1 }, { a: 1 });
|
||||
assert.containsAllKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.hasAnyDeepKeys({ a: 1 }, "a");
|
||||
assert.hasAnyDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAnyDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAnyDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAnyDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.hasAllDeepKeys({ a: 1 }, "a");
|
||||
assert.hasAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.containsAllDeepKeys({ a: 1 }, "a");
|
||||
assert.containsAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.containsAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.containsAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.containsAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.throws(() => {});
|
||||
assert.throws(() => {}, Error);
|
||||
assert.throws(() => {}, Error, /\d+/);
|
||||
assert.throws(() => {}, Error, "string");
|
||||
assert.throws(() => {}, Error, "string", "hello");
|
||||
|
||||
assert.throws(async () => {}).then(() => 42);
|
||||
assert.throws(async () => {}, Error).then(() => 42);
|
||||
assert.throws(async () => {}, Error, /\d+/).then(() => 42);
|
||||
assert.throws(async () => {}, Error, "string").then(() => 42);
|
||||
assert.throws(async () => {}, Error, "string", "hello").then(() => 42);
|
||||
|
||||
assert.doesNotThrow(() => {});
|
||||
assert.doesNotThrow(() => {}, Error);
|
||||
assert.doesNotThrow(() => {}, Error, /\d+/);
|
||||
assert.doesNotThrow(() => {}, Error, "string");
|
||||
assert.doesNotThrow(() => {}, Error, "string", "hello");
|
||||
|
||||
assert.doesNotThrow(async () => {}).then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error).then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error, /\d+/).then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error, "string").then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error, "string", "hello").then(() => 42);
|
||||
|
||||
assert.operator(1, "<", 2);
|
||||
assert.operator(1, "<", 2, "hello");
|
||||
|
||||
assert.closeTo(1, 2, 1);
|
||||
assert.closeTo(1, 2, 1, "hello");
|
||||
|
||||
assert.approximately(1, 2, 2);
|
||||
assert.approximately(1, 2, 2, "hello");
|
||||
|
||||
assert.sameMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.sameMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notSameMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.notSameMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.sameDeepMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.sameDeepMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notSameDeepMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.notSameDeepMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.sameOrderedMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.sameOrderedMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notSameOrderedMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.notSameOrderedMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.includeMembers([1, 2, 3], [3]);
|
||||
assert.includeMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.includeDeepMembers([1, 2, 3], [3]);
|
||||
assert.includeDeepMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeDeepMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeDeepMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.includeOrderedMembers([1, 2, 3], [3]);
|
||||
assert.includeOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeOrderedMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.includeDeepOrderedMembers([1, 2, 3], [3]);
|
||||
assert.includeDeepOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeDeepOrderedMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeDeepOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.oneOf(1, [1, 2, 3]);
|
||||
assert.oneOf(1, [1, 2, 3], "hello");
|
||||
|
||||
assert.changes(() => {}, {}, "a");
|
||||
assert.changes(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.changesBy(() => {}, {}, "a", 2);
|
||||
assert.changesBy(() => {}, {}, "a", 2, "hello");
|
||||
|
||||
assert.doesNotChange(() => {}, {}, "a");
|
||||
assert.doesNotChange(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.changesButNotBy(() => {}, {}, "a", 20);
|
||||
assert.changesButNotBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.increases(() => {}, {}, "a");
|
||||
assert.increases(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.increasesBy(() => {}, {}, "a", 20);
|
||||
assert.increasesBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.doesNotIncrease(() => {}, {}, "a");
|
||||
assert.doesNotIncrease(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.increasesButNotBy(() => {}, {}, "a", 20);
|
||||
assert.increasesButNotBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.decreases(() => {}, {}, "a");
|
||||
assert.decreases(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.decreasesBy(() => {}, {}, "a", 20);
|
||||
assert.decreasesBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.doesNotDecrease(() => {}, {}, "a");
|
||||
assert.doesNotDecrease(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.doesNotDecreaseBy(() => {}, {}, "a", 20);
|
||||
assert.doesNotDecreaseBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.decreasesButNotBy(() => {}, {}, "a", 20);
|
||||
assert.decreasesButNotBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.ifError(1);
|
||||
|
||||
assert.isExtensible({});
|
||||
assert.isExtensible({}, "hello");
|
||||
|
||||
assert.isNotExtensible({});
|
||||
assert.isNotExtensible({}, "hello");
|
||||
|
||||
assert.isSealed({});
|
||||
assert.isSealed({}, "hello");
|
||||
|
||||
assert.isNotSealed({});
|
||||
assert.isNotSealed({}, "hello");
|
||||
|
||||
assert.isFrozen({});
|
||||
assert.isFrozen({}, "hello");
|
||||
|
||||
assert.isNotFrozen({});
|
||||
assert.isNotFrozen({}, "hello");
|
||||
|
||||
assert.isEmpty({});
|
||||
assert.isEmpty({}, "hello");
|
||||
}
|
||||
|
||||
const { expect } = assertion;
|
||||
|
||||
namespace expectTests {
|
||||
expect(1);
|
||||
expect(1, "hello");
|
||||
expect.fail(1, 2);
|
||||
expect.fail(1, 2, "hello");
|
||||
expect.fail(1, 2, "hello", "+");
|
||||
expect(1).to.be.been.is.and.has.have.with.that.which.at.of.same.but.does.not.deep.nested.own.ordered.any.all.a("number");
|
||||
expect(1).to.be.a("number", "hello").and;
|
||||
expect(1).to.be.an("array").and;
|
||||
expect(1).to.be.an("array", "hello").and;
|
||||
expect(1).to.include(1).and;
|
||||
expect(1).to.include(1, "hello").and;
|
||||
expect(1).but.includes(2).and;
|
||||
expect(1).but.includes(2, "hello").and;
|
||||
expect(1).to.contain(2).and;
|
||||
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.be.equal(2).and;
|
||||
expect(1).to.be.equal(2, "hello").and;
|
||||
expect(1).but.equals(2).and;
|
||||
expect(1).but.equals(2, "hello").and;
|
||||
expect(1).to.eq(2).and;
|
||||
expect(1).to.eq(2, "hello").and;
|
||||
expect(1).but.eqls(2).and;
|
||||
expect(1).but.eqls(2, "hello").and;
|
||||
expect(1).to.eqlArray([1, 2, 3]).and;
|
||||
expect(1).to.eqlArray([1, 2, 3], "hello").and;
|
||||
expect(1).to.be.above(2).and;
|
||||
expect(1).to.be.above(2, "hello").and;
|
||||
expect(1).to.be.gt(2).and;
|
||||
expect(1).to.be.gt(2, "hello").and;
|
||||
expect(1).to.be.greaterThan(2).and;
|
||||
expect(1).to.be.greaterThan(2, "hello").and;
|
||||
expect(1).to.be.at.least(10).and;
|
||||
expect(1).to.be.at.least(10, "hello").and;
|
||||
expect(1).to.be.gte(10).and;
|
||||
expect(1).to.be.gte(10, "hello").and;
|
||||
expect(1).to.be.below(100).and;
|
||||
expect(1).to.be.below(100, "hello").and;
|
||||
expect(1).to.be.lt(10).and;
|
||||
expect(1).to.be.lt(10, "hello").and;
|
||||
expect(1).to.be.lessThan(10, "hello").and;
|
||||
expect(1).to.be.at.most(10).and;
|
||||
expect(1).to.be.at.most(10, "hello").and;
|
||||
expect(1).to.be.lte(10).and;
|
||||
expect(1).to.be.lte(10, "hello").and;
|
||||
expect(1).to.be.within(1, 10).and;
|
||||
expect(1).to.be.within(1, 10, "hello").and;
|
||||
expect(1).to.be.instanceof(Number).and;
|
||||
expect(1).to.be.instanceof(Number, "hello").and;
|
||||
expect(1).to.be.instanceOf(Number).and;
|
||||
expect(1).to.be.instanceOf(Number, "hello").and;
|
||||
expect(1).to.have.property("a").and;
|
||||
expect(1).to.have.property("a", 1).and;
|
||||
expect(1).to.have.property("a", 1, "hello").and;
|
||||
expect(1).to.have.ownProperty("a").and;
|
||||
expect(1).to.have.ownProperty("a", 1).and;
|
||||
expect(1).to.have.ownProperty("a", 1, "hello").and;
|
||||
expect(1).to.haveOwnProperty("a").and;
|
||||
expect(1).to.haveOwnProperty("a", 1).and;
|
||||
expect(1).to.haveOwnProperty("a", 1, "hello").and;
|
||||
expect(1).to.have.ownPropertyDescriptor("a").and;
|
||||
expect(1).to.have.ownPropertyDescriptor("a", {}).and;
|
||||
expect(1).to.have.ownPropertyDescriptor("a", {}, "hello").and;
|
||||
expect(1).to.haveOwnPropertyDescriptor("a").and;
|
||||
expect(1).to.haveOwnPropertyDescriptor("a", {}).and;
|
||||
expect(1).to.haveOwnPropertyDescriptor("a", {}, "hello").and;
|
||||
expect("a").to.have.length(1).and;
|
||||
expect("a").to.have.length(1, "hello").and;
|
||||
expect("a").to.have.lengthOf(1).and;
|
||||
expect("a").to.have.lengthOf(1, "hello").and;
|
||||
expect(1).to.match(/\d+/).and;
|
||||
expect(1).to.match(/\d+/, "hello").and;
|
||||
expect(1).to.have.string("1230").and;
|
||||
expect(1).to.have.string("1230", "hello").and;
|
||||
expect(1).to.have.key("a").and;
|
||||
expect(1).to.have.key("a", "b").and;
|
||||
expect(1).to.have.key(["a", "b"]).and;
|
||||
expect(1).to.have.key({ a: 1, b: 2 }).and;
|
||||
expect(1).to.have.keys("a").and;
|
||||
expect(1).to.have.keys("a", "b").and;
|
||||
expect(1).to.have.keys(["a", "b"]).and;
|
||||
expect(1).to.have.keys({ a: 1, b: 2 }).and;
|
||||
expect(() => {}).to.throw().and;
|
||||
expect(() => {}).to.throw(Error).and;
|
||||
expect(() => {}).to.throw(Error, "string").and;
|
||||
expect(() => {}).to.throw(Error, "string", "hello").and;
|
||||
expect(() => {}).to.throw(Error, /\d+/).and;
|
||||
expect(() => {}).to.throw(Error, /\d+/, "hello").and;
|
||||
expect(() => {}).but.throws().and;
|
||||
expect(() => {}).but.throws(Error).and;
|
||||
expect(() => {}).but.throws(Error, "string").and;
|
||||
expect(() => {}).but.throws(Error, "string", "hello").and;
|
||||
expect(() => {}).but.throws(Error, /\d+/).and;
|
||||
expect(() => {}).but.throws(Error, /\d+/, "hello").and;
|
||||
expect(1).to.respondTo("a").and;
|
||||
expect(1).to.respondTo("a", "hello").and;
|
||||
expect(1).to.respondsTo("a").and;
|
||||
expect(1).to.respondsTo("a", "hello").and;
|
||||
expect(1).itself.to.respondsTo("a").and;
|
||||
expect(1).to.satisfy(() => true).and;
|
||||
expect(1).to.satisfy(() => true, "hello").and;
|
||||
expect(1).but.satisfies(() => true).and;
|
||||
expect(1).but.satisfies(() => true, "hello").and;
|
||||
expect(1).to.be.closeTo(2, 1).and;
|
||||
expect(1).to.be.closeTo(2, 1, "hello").and;
|
||||
expect(1).to.be.approximately(1, 2).and;
|
||||
expect(1).to.be.approximately(1, 2, "hello").and;
|
||||
expect(1).to.have.members([1, 2, 3]).and;
|
||||
expect(1).to.have.members([1, 2, 3], "hello").and;
|
||||
expect(1).to.be.oneOf([1, 2, 3]).and;
|
||||
expect(1).to.be.oneOf([1, 2, 3], "hello").and;
|
||||
expect(() => {}).to.change(() => {}).and;
|
||||
expect(() => {}).to.change({}, "a").and;
|
||||
expect(() => {}).to.change({}, "a", "hello").and;
|
||||
expect(() => {}).but.changes(() => {}).and;
|
||||
expect(() => {}).but.changes({}, "a").and;
|
||||
expect(() => {}).but.changes({}, "a", "hello").and;
|
||||
expect(() => {}).to.increase({}).and;
|
||||
expect(() => {}).to.increase({}, "a").and;
|
||||
expect(() => {}).to.increase({}, "a", "hello").and;
|
||||
expect(() => {}).but.increases({}).and;
|
||||
expect(() => {}).but.increases({}, "a").and;
|
||||
expect(() => {}).but.increases({}, "a", "hello").and;
|
||||
expect(() => {}).to.decrease({}).and;
|
||||
expect(() => {}).to.decrease({}, "a").and;
|
||||
expect(() => {}).to.decrease({}, "a", "hello").and;
|
||||
expect(() => {}).but.decreases({}).and;
|
||||
expect(() => {}).but.decreases({}, "a").and;
|
||||
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;
|
||||
|
||||
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.callCount(100);
|
||||
expect(s1).to.have.been.calledBefore(s2);
|
||||
expect(s1).to.have.been.calledAfter(s2);
|
||||
expect(s1).to.have.been.calledImmediatelyAfter(s2);
|
||||
expect(s1).to.have.been.calledImmediatelyBefore(s2);
|
||||
expect(s1).to.have.been.calledOn({});
|
||||
expect(s1).to.have.been.calledOn({});
|
||||
expect(s1).to.have.been.calledWith(1, 2, 3);
|
||||
expect(s1).to.have.been.calledWithExactly(1, 2, 3);
|
||||
expect(s1).to.have.returned(1);
|
||||
expect(s1).to.have.thrown({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,808 @@
|
||||
namespace commonTests {
|
||||
namespace is {
|
||||
{ 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.exbuffer({}); }
|
||||
{ const a: boolean = adone.is.exdate({}); }
|
||||
{ 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.fastFSStream({}); }
|
||||
{ const a: boolean = adone.is.fastFSMapStream({}); }
|
||||
{ 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({}); }
|
||||
}
|
||||
|
||||
namespace x {
|
||||
{ const a: Error = new adone.x.Exception(); }
|
||||
{ const a: Error = new adone.x.Exception("message"); }
|
||||
{ const a: Error = new adone.x.Exception(new Error()); }
|
||||
{ const a: Error = new adone.x.Exception(new Error(), true); }
|
||||
{ const a: adone.x.Exception = new adone.x.Runtime(); }
|
||||
{ const a: adone.x.Exception = new adone.x.IncompleteBufferError(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NotImplemented(); }
|
||||
{ const a: adone.x.Exception = new adone.x.IllegalState(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NotValid(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Unknown(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NotExists(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Exists(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Empty(); }
|
||||
{ const a: adone.x.Exception = new adone.x.InvalidAccess(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NotSupported(); }
|
||||
{ const a: adone.x.Exception = new adone.x.InvalidArgument(); }
|
||||
{ const a: adone.x.Exception = new adone.x.InvalidNumberOfArguments(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NotFound(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Timeout(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Incorrect(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NotAllowed(); }
|
||||
{ const a: adone.x.Exception = new adone.x.LimitExceeded(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Encoding(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Network(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Bind(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Connect(); }
|
||||
{ const a: adone.x.Exception = new adone.x.Database(); }
|
||||
{ const a: adone.x.Exception = new adone.x.DatabaseInitialization(); }
|
||||
{ const a: adone.x.Exception = new adone.x.DatabaseOpen(); }
|
||||
{ const a: adone.x.Exception = new adone.x.DatabaseRead(); }
|
||||
{ const a: adone.x.Exception = new adone.x.DatabaseWrite(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NetronIllegalState(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NetronPeerDisconnected(); }
|
||||
{ const a: adone.x.Exception = new adone.x.NetronTimeout(); }
|
||||
}
|
||||
|
||||
namespace EventEmitter {
|
||||
namespace static {
|
||||
const a: number = adone.EventEmitter.listenerCount(new adone.EventEmitter(), "event");
|
||||
const b: number = adone.EventEmitter.defaultMaxListeners;
|
||||
}
|
||||
|
||||
namespace addListener {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().addListener("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().addListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace on {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().on("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().on(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace once {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().once("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().once(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependListener {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().prependListener("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().prependListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependOnceListener {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().prependOnceListener("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().prependOnceListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependOnceListener {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().prependOnceListener("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().prependOnceListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace removeListener {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().removeListener("event", () => { });
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().removeListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace removeAllListeners {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().removeAllListeners("event");
|
||||
const b: adone.EventEmitter = new adone.EventEmitter().removeAllListeners(Symbol("event"));
|
||||
}
|
||||
|
||||
namespace setMaxListeners {
|
||||
const a: adone.EventEmitter = new adone.EventEmitter().setMaxListeners(10);
|
||||
}
|
||||
|
||||
namespace getMaxListeners {
|
||||
const a: number = new adone.EventEmitter().getMaxListeners();
|
||||
}
|
||||
|
||||
namespace listeners {
|
||||
const a: Array<(...args: any[]) => any> = new adone.EventEmitter().listeners("event");
|
||||
const b: Array<(...args: any[]) => any> = new adone.EventEmitter().listeners(Symbol("event"));
|
||||
}
|
||||
|
||||
namespace emit {
|
||||
const a: boolean = new adone.EventEmitter().emit("event", 1, 2, 3);
|
||||
const b: boolean = new adone.EventEmitter().emit(Symbol("event"), 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace eventNames {
|
||||
const a: Array<string | symbol> = new adone.EventEmitter().eventNames();
|
||||
const b: Array<string | symbol> = new adone.EventEmitter().eventNames();
|
||||
}
|
||||
|
||||
namespace listenerCount {
|
||||
const a: number = new adone.EventEmitter().listenerCount("event");
|
||||
const b: number = new adone.EventEmitter().listenerCount(Symbol("event"));
|
||||
}
|
||||
}
|
||||
|
||||
namespace AsyncEmitter {
|
||||
const a: adone.EventEmitter = new adone.AsyncEmitter();
|
||||
new adone.AsyncEmitter(10);
|
||||
|
||||
namespace setConcurrency {
|
||||
const a: adone.AsyncEmitter = new adone.AsyncEmitter().setConcurrency();
|
||||
const b: adone.AsyncEmitter = new adone.AsyncEmitter().setConcurrency(10);
|
||||
}
|
||||
|
||||
namespace emitParallel {
|
||||
const a: Promise<any[]> = new adone.AsyncEmitter().emitParallel("even");
|
||||
const b: Promise<any[]> = new adone.AsyncEmitter().emitParallel("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace emitSerial {
|
||||
const a: Promise<any[]> = new adone.AsyncEmitter().emitSerial("even");
|
||||
const b: Promise<any[]> = new adone.AsyncEmitter().emitSerial("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace emitReduce {
|
||||
const a: Promise<any[]> = new adone.AsyncEmitter().emitReduce("even");
|
||||
const b: Promise<any[]> = new adone.AsyncEmitter().emitReduce("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace emitReduceRight {
|
||||
const a: Promise<any[]> = new adone.AsyncEmitter().emitReduceRight("even");
|
||||
const b: Promise<any[]> = new adone.AsyncEmitter().emitReduceRight("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace subscribe {
|
||||
const a: () => void = new adone.AsyncEmitter().subscribe("event", () => { });
|
||||
const b: () => void = new adone.AsyncEmitter().subscribe("event", () => { }, true);
|
||||
}
|
||||
}
|
||||
|
||||
namespace ExBuffer {
|
||||
new adone.ExBuffer();
|
||||
new adone.ExBuffer(10);
|
||||
new adone.ExBuffer(10, true);
|
||||
|
||||
const buffer = new adone.ExBuffer();
|
||||
|
||||
namespace readBitSet {
|
||||
const a: number[] = buffer.readBitSet();
|
||||
const b: number[] = buffer.readBitSet(10);
|
||||
}
|
||||
|
||||
namespace read {
|
||||
const a: adone.ExBuffer = buffer.read(1);
|
||||
const b: adone.ExBuffer = buffer.read(1, 10);
|
||||
}
|
||||
|
||||
namespace readInt8 {
|
||||
const a: number = buffer.readInt8();
|
||||
const b: number = buffer.readInt8(10);
|
||||
}
|
||||
|
||||
namespace readUInt8 {
|
||||
const a: number = buffer.readUInt8();
|
||||
const b: number = buffer.readUInt8(10);
|
||||
}
|
||||
|
||||
namespace readInt16LE {
|
||||
const a: number = buffer.readInt16LE();
|
||||
const b: number = buffer.readInt16LE(10);
|
||||
}
|
||||
|
||||
namespace readUInt16LE {
|
||||
const a: number = buffer.readUInt16LE();
|
||||
const b: number = buffer.readUInt16LE(10);
|
||||
}
|
||||
|
||||
namespace readInt16BE {
|
||||
const a: number = buffer.readInt16BE();
|
||||
const b: number = buffer.readInt16BE(10);
|
||||
}
|
||||
|
||||
namespace readUInt16BE {
|
||||
const a: number = buffer.readUInt16BE();
|
||||
const b: number = buffer.readUInt16BE(10);
|
||||
}
|
||||
|
||||
namespace readInt32LE {
|
||||
const a: number = buffer.readInt32LE();
|
||||
const b: number = buffer.readInt32LE(10);
|
||||
}
|
||||
|
||||
namespace readUInt32LE {
|
||||
const a: number = buffer.readUInt32LE();
|
||||
const b: number = buffer.readUInt32LE(10);
|
||||
}
|
||||
|
||||
namespace readInt32BE {
|
||||
const a: number = buffer.readInt32BE();
|
||||
const b: number = buffer.readInt32BE(10);
|
||||
}
|
||||
|
||||
namespace readUInt32BE {
|
||||
const a: number = buffer.readUInt32BE();
|
||||
const b: number = buffer.readUInt32BE(10);
|
||||
}
|
||||
|
||||
namespace readInt64LE {
|
||||
const a: adone.math.Long = buffer.readInt64LE();
|
||||
const b: adone.math.Long = buffer.readInt64LE(10);
|
||||
}
|
||||
|
||||
namespace readUInt64LE {
|
||||
const a: adone.math.Long = buffer.readUInt64LE();
|
||||
const b: adone.math.Long = buffer.readUInt64LE(10);
|
||||
}
|
||||
|
||||
namespace readInt64BE {
|
||||
const a: adone.math.Long = buffer.readInt64BE();
|
||||
const b: adone.math.Long = buffer.readInt64BE(10);
|
||||
}
|
||||
|
||||
namespace readUInt64BE {
|
||||
const a: adone.math.Long = buffer.readUInt64BE();
|
||||
const b: adone.math.Long = buffer.readUInt64BE(10);
|
||||
}
|
||||
|
||||
namespace readFloatLE {
|
||||
const a: number = buffer.readFloatLE();
|
||||
const b: number = buffer.readFloatLE(10);
|
||||
}
|
||||
|
||||
namespace readFloatBE {
|
||||
const a: number = buffer.readFloatBE();
|
||||
const b: number = buffer.readFloatBE(10);
|
||||
}
|
||||
|
||||
namespace readDoubleLE {
|
||||
const a: number = buffer.readDoubleLE();
|
||||
const b: number = buffer.readDoubleLE(10);
|
||||
}
|
||||
|
||||
namespace readDoubleBE {
|
||||
const a: number = buffer.readDoubleBE();
|
||||
const b: number = buffer.readDoubleBE(10);
|
||||
}
|
||||
|
||||
namespace write {
|
||||
const a: adone.ExBuffer = buffer.write("1");
|
||||
const b: adone.ExBuffer = buffer.write(new adone.ExBuffer());
|
||||
const c: adone.ExBuffer = buffer.write(Buffer.alloc(10));
|
||||
const d: adone.ExBuffer = buffer.write(new Uint8Array([1, 2, 3]));
|
||||
const e: adone.ExBuffer = buffer.write(new ArrayBuffer(10));
|
||||
const f: adone.ExBuffer = buffer.write("1", 10);
|
||||
const g: adone.ExBuffer = buffer.write("1", 10, 10);
|
||||
const h: adone.ExBuffer = buffer.write("1", 10, 10, "utf8");
|
||||
}
|
||||
|
||||
namespace writeBitSet {
|
||||
const a: adone.ExBuffer = buffer.writeBitSet([1, 2, 3]);
|
||||
const b: number = buffer.writeBitSet([1, 2, 3], 10);
|
||||
}
|
||||
|
||||
namespace writeInt8 {
|
||||
const a: adone.ExBuffer = buffer.writeInt8(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt8(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt8 {
|
||||
const a: adone.ExBuffer = buffer.writeUInt8(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt8(10, 10);
|
||||
}
|
||||
|
||||
namespace writeInt16LE {
|
||||
const a: adone.ExBuffer = buffer.writeInt16LE(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt16LE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeInt16BE {
|
||||
const a: adone.ExBuffer = buffer.writeInt16BE(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt16BE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt16LE {
|
||||
const a: adone.ExBuffer = buffer.writeUInt16LE(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt16LE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt16BE {
|
||||
const a: adone.ExBuffer = buffer.writeUInt16BE(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt16BE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeInt32LE {
|
||||
const a: adone.ExBuffer = buffer.writeInt32LE(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt32LE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeInt32BE {
|
||||
const a: adone.ExBuffer = buffer.writeInt32BE(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt32BE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt32LE {
|
||||
const a: adone.ExBuffer = buffer.writeUInt32LE(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt32LE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt32BE {
|
||||
const a: adone.ExBuffer = buffer.writeUInt32BE(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt32BE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeInt64LE {
|
||||
const a: adone.ExBuffer = buffer.writeInt64LE(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt64LE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeInt64BE {
|
||||
const a: adone.ExBuffer = buffer.writeInt64BE(10);
|
||||
const b: adone.ExBuffer = buffer.writeInt64BE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt64LE {
|
||||
const a: adone.ExBuffer = buffer.writeUInt64LE(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt64LE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeUInt64BE {
|
||||
const a: adone.ExBuffer = buffer.writeUInt64BE(10);
|
||||
const b: adone.ExBuffer = buffer.writeUInt64BE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeFloatLE {
|
||||
const a: adone.ExBuffer = buffer.writeFloatLE(10);
|
||||
const b: adone.ExBuffer = buffer.writeFloatLE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeFloatBE {
|
||||
const a: adone.ExBuffer = buffer.writeFloatBE(10);
|
||||
const b: adone.ExBuffer = buffer.writeFloatBE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeDoubleLE {
|
||||
const a: adone.ExBuffer = buffer.writeDoubleLE(10);
|
||||
const b: adone.ExBuffer = buffer.writeDoubleLE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeDoubleBE {
|
||||
const a: adone.ExBuffer = buffer.writeDoubleBE(10);
|
||||
const b: adone.ExBuffer = buffer.writeDoubleBE(10, 10);
|
||||
}
|
||||
|
||||
namespace writeVarInt32 {
|
||||
const a: adone.ExBuffer = buffer.writeVarint32(10);
|
||||
const b: number = buffer.writeVarint32(10, 10);
|
||||
}
|
||||
|
||||
namespace writeVarInt32ZigZag {
|
||||
const a: adone.ExBuffer = buffer.writeVarint32ZigZag(10);
|
||||
const b: number = buffer.writeVarint32ZigZag(10, 10);
|
||||
}
|
||||
|
||||
namespace readVarint32 {
|
||||
const a: number = buffer.readVarint32();
|
||||
const b: { value: number, length: number } = buffer.readVarint32(10);
|
||||
}
|
||||
|
||||
namespace readVarint32ZigZag {
|
||||
const a: number = buffer.readVarint32ZigZag();
|
||||
const b: { value: number, length: number } = buffer.readVarint32ZigZag(10);
|
||||
}
|
||||
|
||||
namespace writeVarint64 {
|
||||
const a: adone.ExBuffer = buffer.writeVarint64(10);
|
||||
const b: number = buffer.writeVarint64(10, 10);
|
||||
}
|
||||
|
||||
namespace writeVarint64ZigZag {
|
||||
const a: adone.ExBuffer = buffer.writeVarint64ZigZag(10);
|
||||
const b: number = buffer.writeVarint64ZigZag(10, 10);
|
||||
}
|
||||
|
||||
namespace readVarint64 {
|
||||
const a: adone.math.Long = buffer.readVarint64();
|
||||
const b: { value: adone.math.Long, length: number } = buffer.readVarint64(10);
|
||||
}
|
||||
|
||||
namespace readVarint64ZigZag {
|
||||
const a: adone.math.Long = buffer.readVarint64ZigZag();
|
||||
const b: { value: adone.math.Long, length: number } = buffer.readVarint64ZigZag(10);
|
||||
}
|
||||
|
||||
namespace writeCString {
|
||||
const a: adone.ExBuffer = buffer.writeCString("asd");
|
||||
const b: number = buffer.writeCString("123", 10);
|
||||
}
|
||||
|
||||
namespace readCString {
|
||||
const a: string = buffer.readCString();
|
||||
const b: { string: string, length: number } = buffer.readCString(10);
|
||||
}
|
||||
|
||||
namespace writeString {
|
||||
const a: adone.ExBuffer = buffer.writeString("abc");
|
||||
const b: number = buffer.writeString("abc", 10);
|
||||
}
|
||||
|
||||
namespace readString {
|
||||
const a: string = buffer.readString(10);
|
||||
const b: string = buffer.readString(10, "b");
|
||||
const c: string = buffer.readString(10, "c");
|
||||
const d: { string: string, length: number } = buffer.readString(10, "c", 10);
|
||||
}
|
||||
|
||||
namespace writeVString {
|
||||
const a: adone.ExBuffer = buffer.writeVString("abc");
|
||||
const b: number = buffer.writeVString("abc", 10);
|
||||
}
|
||||
|
||||
namespace readVString {
|
||||
const a: string = buffer.readVString();
|
||||
const b: { string: string, length: number } = buffer.readVString(10);
|
||||
}
|
||||
|
||||
namespace appendTo {
|
||||
const a: adone.ExBuffer = buffer.appendTo(new adone.ExBuffer());
|
||||
const b: adone.ExBuffer = buffer.appendTo(new adone.ExBuffer(), 10);
|
||||
}
|
||||
|
||||
namespace assert {
|
||||
const a: adone.ExBuffer = buffer.assert();
|
||||
const b: adone.ExBuffer = buffer.assert(true);
|
||||
}
|
||||
|
||||
namespace capacity {
|
||||
const a: number = buffer.capacity();
|
||||
}
|
||||
|
||||
namespace clear {
|
||||
const a: adone.ExBuffer = buffer.clear();
|
||||
}
|
||||
|
||||
namespace compact {
|
||||
const a: adone.ExBuffer = buffer.compact();
|
||||
const b: adone.ExBuffer = buffer.compact(1);
|
||||
const c: adone.ExBuffer = buffer.compact(1, 10);
|
||||
}
|
||||
|
||||
namespace copyTo {
|
||||
const a: adone.ExBuffer = buffer.copyTo(new adone.ExBuffer());
|
||||
const b: adone.ExBuffer = buffer.copyTo(new adone.ExBuffer(), 0);
|
||||
const c: adone.ExBuffer = buffer.copyTo(new adone.ExBuffer(), 0, 0);
|
||||
const d: adone.ExBuffer = buffer.copyTo(new adone.ExBuffer(), 0, 0, 10);
|
||||
}
|
||||
|
||||
namespace ensureCapacity {
|
||||
const a: adone.ExBuffer = buffer.ensureCapacity(10);
|
||||
}
|
||||
|
||||
namespace fill {
|
||||
const a: adone.ExBuffer = buffer.fill("0");
|
||||
const b: adone.ExBuffer = buffer.fill(0);
|
||||
const c: adone.ExBuffer = buffer.fill(0, 0);
|
||||
const d: adone.ExBuffer = buffer.fill(0, 0, 10);
|
||||
}
|
||||
|
||||
namespace flip {
|
||||
const a: adone.ExBuffer = buffer.flip();
|
||||
}
|
||||
|
||||
namespace mark {
|
||||
const a: adone.ExBuffer = buffer.mark();
|
||||
const b: adone.ExBuffer = buffer.mark(10);
|
||||
}
|
||||
|
||||
namespace prepend {
|
||||
const a: adone.ExBuffer = buffer.prepend("");
|
||||
const b: adone.ExBuffer = buffer.prepend(new adone.ExBuffer());
|
||||
const c: adone.ExBuffer = buffer.prepend(Buffer.alloc(10));
|
||||
const d: adone.ExBuffer = buffer.prepend(new Uint8Array([1, 2, 3]));
|
||||
const e: adone.ExBuffer = buffer.prepend(new ArrayBuffer(10));
|
||||
const f: adone.ExBuffer = buffer.prepend("", "utf8");
|
||||
const g: adone.ExBuffer = buffer.prepend("", "utf8", 10);
|
||||
const h: adone.ExBuffer = buffer.prepend("", 10);
|
||||
}
|
||||
|
||||
namespace prependTo {
|
||||
const a: adone.ExBuffer = buffer.prependTo(new adone.ExBuffer());
|
||||
const b: adone.ExBuffer = buffer.prependTo(new adone.ExBuffer(), 10);
|
||||
}
|
||||
|
||||
namespace remaining {
|
||||
const a: number = buffer.remaining();
|
||||
}
|
||||
|
||||
namespace reset {
|
||||
const a: adone.ExBuffer = buffer.reset();
|
||||
}
|
||||
|
||||
namespace resize {
|
||||
const a: adone.ExBuffer = buffer.resize(10);
|
||||
}
|
||||
|
||||
namespace reverse {
|
||||
const a: adone.ExBuffer = buffer.reverse();
|
||||
const b: adone.ExBuffer = buffer.reverse(1);
|
||||
const c: adone.ExBuffer = buffer.reverse(1, 10);
|
||||
}
|
||||
|
||||
namespace skip {
|
||||
const a: adone.ExBuffer = buffer.skip(10);
|
||||
}
|
||||
|
||||
namespace slice {
|
||||
const a: adone.ExBuffer = buffer.slice();
|
||||
const b: adone.ExBuffer = buffer.slice(1);
|
||||
const c: adone.ExBuffer = buffer.slice(1, 10);
|
||||
}
|
||||
|
||||
namespace toBuffer {
|
||||
const a: Buffer = buffer.toBuffer();
|
||||
const b: Buffer = buffer.toBuffer(true);
|
||||
const c: Buffer = buffer.toBuffer(true, 0);
|
||||
const d: Buffer = buffer.toBuffer(true, 0, 10);
|
||||
}
|
||||
|
||||
namespace toArrayBuffer {
|
||||
const a: ArrayBuffer = buffer.toArrayBuffer();
|
||||
}
|
||||
|
||||
namespace toString {
|
||||
const a: string = buffer.toString();
|
||||
const b: string = buffer.toString("utf8");
|
||||
const c: string = buffer.toString("utf8", 0);
|
||||
const d: string = buffer.toString("utf8", 0, 10);
|
||||
}
|
||||
|
||||
namespace toBase64 {
|
||||
const a: string = buffer.toBase64();
|
||||
const b: string = buffer.toBase64(0);
|
||||
const c: string = buffer.toBase64(0, 10);
|
||||
}
|
||||
|
||||
namespace toBinary {
|
||||
const a: string = buffer.toBinary();
|
||||
const b: string = buffer.toBinary(0);
|
||||
const c: string = buffer.toBinary(0, 10);
|
||||
}
|
||||
|
||||
namespace toDebug {
|
||||
const a: string = buffer.toDebug();
|
||||
const b: string = buffer.toDebug(true);
|
||||
}
|
||||
|
||||
namespace toUTF8 {
|
||||
const a: string = buffer.toUTF8();
|
||||
const b: string = buffer.toUTF8(0);
|
||||
const c: string = buffer.toUTF8(0, 10);
|
||||
}
|
||||
|
||||
namespace static {
|
||||
namespace accessor {
|
||||
const a: typeof Buffer = adone.ExBuffer.accessor();
|
||||
}
|
||||
|
||||
namespace allocate {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.allocate();
|
||||
const b: adone.ExBuffer = adone.ExBuffer.allocate(10);
|
||||
const c: adone.ExBuffer = adone.ExBuffer.allocate(10, true);
|
||||
}
|
||||
|
||||
namespace concat {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.concat([
|
||||
new adone.ExBuffer(),
|
||||
Buffer.alloc(10),
|
||||
new Uint8Array([1, 2, 3]),
|
||||
new ArrayBuffer(10)
|
||||
]);
|
||||
const b: adone.ExBuffer = adone.ExBuffer.concat([
|
||||
new adone.ExBuffer(),
|
||||
Buffer.alloc(10),
|
||||
new Uint8Array([1, 2, 3]),
|
||||
new ArrayBuffer(10)
|
||||
], "utf8");
|
||||
const c: adone.ExBuffer = adone.ExBuffer.concat([
|
||||
new adone.ExBuffer(),
|
||||
Buffer.alloc(10),
|
||||
new Uint8Array([1, 2, 3]),
|
||||
new ArrayBuffer(10)
|
||||
], "utf8", true);
|
||||
}
|
||||
|
||||
namespace type {
|
||||
const a: typeof Buffer = adone.ExBuffer.type();
|
||||
}
|
||||
|
||||
namespace wrap {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.wrap("");
|
||||
const b: adone.ExBuffer = adone.ExBuffer.wrap(new adone.ExBuffer());
|
||||
const c: adone.ExBuffer = adone.ExBuffer.wrap(Buffer.alloc(10));
|
||||
const d: adone.ExBuffer = adone.ExBuffer.wrap(new Uint8Array([1, 2, 3]));
|
||||
const e: adone.ExBuffer = adone.ExBuffer.wrap(new ArrayBuffer(10));
|
||||
const f: adone.ExBuffer = adone.ExBuffer.wrap("", "utf8");
|
||||
const g: adone.ExBuffer = adone.ExBuffer.wrap("", "utf8", true);
|
||||
}
|
||||
|
||||
namespace calculateVarint32 {
|
||||
const a: number = adone.ExBuffer.calculateVarint32(10);
|
||||
}
|
||||
|
||||
namespace zigZagEncode32 {
|
||||
const a: number = adone.ExBuffer.zigZagEncode32(10);
|
||||
}
|
||||
|
||||
namespace zigZagDecode32 {
|
||||
const a: number = adone.ExBuffer.zigZagDecode32(10);
|
||||
}
|
||||
|
||||
namespace calculateVarint64 {
|
||||
const a: number = adone.ExBuffer.calculateVarint64(10);
|
||||
const b: number = adone.ExBuffer.calculateVarint64("10");
|
||||
}
|
||||
|
||||
namespace zigZagEncode64 {
|
||||
const a: adone.math.Long = adone.ExBuffer.zigZagEncode64(10);
|
||||
const b: adone.math.Long = adone.ExBuffer.zigZagEncode64("10");
|
||||
const c: adone.math.Long = adone.ExBuffer.zigZagEncode64(adone.math.Long.fromValue(10));
|
||||
}
|
||||
|
||||
namespace zigZagDecode64 {
|
||||
const a: adone.math.Long = adone.ExBuffer.zigZagDecode64(10);
|
||||
const b: adone.math.Long = adone.ExBuffer.zigZagDecode64("10");
|
||||
const c: adone.math.Long = adone.ExBuffer.zigZagDecode64(adone.math.Long.fromValue(10));
|
||||
}
|
||||
|
||||
namespace calculateUTF8Chars {
|
||||
const a: number = adone.ExBuffer.calculateUTF8Chars("123");
|
||||
}
|
||||
|
||||
namespace calculateString {
|
||||
const a: number = adone.ExBuffer.calculateString("123");
|
||||
}
|
||||
|
||||
namespace fromBase64 {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.fromBase64("123");
|
||||
}
|
||||
|
||||
namespace btoa {
|
||||
const a: string = adone.ExBuffer.btoa("123");
|
||||
}
|
||||
|
||||
namespace atob {
|
||||
const a: string = adone.ExBuffer.atob("123");
|
||||
}
|
||||
|
||||
namespace fromBinary {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.fromBinary("123");
|
||||
}
|
||||
|
||||
namespace fromDebug {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.fromDebug("12");
|
||||
const b: adone.ExBuffer = adone.ExBuffer.fromDebug("12", true);
|
||||
}
|
||||
|
||||
namespace fromHex {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.fromHex("192");
|
||||
const b: adone.ExBuffer = adone.ExBuffer.fromHex("192", true);
|
||||
}
|
||||
|
||||
namespace fromUTF8 {
|
||||
const a: adone.ExBuffer = adone.ExBuffer.fromUTF8("123");
|
||||
const b: adone.ExBuffer = adone.ExBuffer.fromUTF8("123", true);
|
||||
}
|
||||
|
||||
namespace constants {
|
||||
const a: number = adone.ExBuffer.DEFAULT_CAPACITY;
|
||||
const b: boolean = adone.ExBuffer.DEFAULT_NOASSERT;
|
||||
const c: number = adone.ExBuffer.MAX_VARINT32_BYTES;
|
||||
const d: number = adone.ExBuffer.MAX_VARINT64_BYTES;
|
||||
const e: string = adone.ExBuffer.METRICS_CHARS;
|
||||
const f: string = adone.ExBuffer.METRICS_BYTES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
const { math } = adone;
|
||||
|
||||
namespace mathTests {
|
||||
namespace Long {
|
||||
new math.Long();
|
||||
new math.Long(0);
|
||||
new math.Long(0, 0);
|
||||
new math.Long(0, 0, true);
|
||||
|
||||
namespace toInt {
|
||||
const a: number = new math.Long().toInt();
|
||||
}
|
||||
|
||||
namespace toNumber {
|
||||
const a: number = new math.Long().toNumber();
|
||||
}
|
||||
|
||||
namespace toString {
|
||||
const a: string = new math.Long().toString();
|
||||
const b: string = new math.Long().toString(16);
|
||||
}
|
||||
|
||||
namespace getHighBits {
|
||||
const a: number = new math.Long().getHighBits();
|
||||
}
|
||||
|
||||
namespace getLowBits {
|
||||
const a: number = new math.Long().getLowBits();
|
||||
}
|
||||
|
||||
namespace getLowBitsUnsigned {
|
||||
const a: number = new math.Long().getLowBitsUnsigned();
|
||||
}
|
||||
|
||||
namespace getHighBitsUnsigned {
|
||||
const a: number = new math.Long().getHighBitsUnsigned();
|
||||
}
|
||||
|
||||
namespace getNumBitsAbs {
|
||||
const a: number = new math.Long().getNumBitsAbs();
|
||||
}
|
||||
|
||||
namespace isZero {
|
||||
const a: boolean = new math.Long().isZero();
|
||||
}
|
||||
|
||||
namespace isNegative {
|
||||
const a: boolean = new math.Long().isNegative();
|
||||
}
|
||||
|
||||
namespace isPositive {
|
||||
const a: boolean = new math.Long().isPositive();
|
||||
}
|
||||
|
||||
namespace isOdd {
|
||||
const a: boolean = new math.Long().isOdd();
|
||||
}
|
||||
|
||||
namespace isEven {
|
||||
const a: boolean = new math.Long().isEven();
|
||||
}
|
||||
|
||||
namespace equals {
|
||||
const a = new math.Long();
|
||||
const b: boolean = a.equals(new math.Long());
|
||||
const c: boolean = a.equals(1);
|
||||
const d: boolean = a.equals("1");
|
||||
const e: boolean = a.equals({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace lessThan {
|
||||
const a = new math.Long();
|
||||
const b: boolean = a.lessThan(new math.Long());
|
||||
const c: boolean = a.lessThan(1);
|
||||
const d: boolean = a.lessThan("1");
|
||||
const e: boolean = a.lessThan({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace lessThanOrEqual {
|
||||
const a = new math.Long();
|
||||
const b: boolean = a.lessThanOrEqual(new math.Long());
|
||||
const c: boolean = a.lessThanOrEqual(1);
|
||||
const d: boolean = a.lessThanOrEqual("1");
|
||||
const e: boolean = a.lessThanOrEqual({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace greaterThan {
|
||||
const a = new math.Long();
|
||||
const b: boolean = a.greaterThan(new math.Long());
|
||||
const c: boolean = a.greaterThan(1);
|
||||
const d: boolean = a.greaterThan("1");
|
||||
const e: boolean = a.greaterThan({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace greaterThanOrEqual {
|
||||
const a = new math.Long();
|
||||
const b: boolean = a.greaterThanOrEqual(new math.Long());
|
||||
const c: boolean = a.greaterThanOrEqual(1);
|
||||
const d: boolean = a.greaterThanOrEqual("1");
|
||||
const e: boolean = a.greaterThanOrEqual({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace greaterThanOrEqual {
|
||||
const a = new math.Long();
|
||||
const b: number = a.compare(new math.Long());
|
||||
const c: number = a.compare(1);
|
||||
const d: number = a.compare("1");
|
||||
const e: number = a.compare({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace negate {
|
||||
const a: adone.math.Long = new math.Long().negate();
|
||||
}
|
||||
|
||||
namespace add {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.add(new math.Long());
|
||||
const c: adone.math.Long = a.add(1);
|
||||
const d: adone.math.Long = a.add("1");
|
||||
const e: adone.math.Long = a.add({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace sub {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.sub(new math.Long());
|
||||
const c: adone.math.Long = a.sub(1);
|
||||
const d: adone.math.Long = a.sub("1");
|
||||
const e: adone.math.Long = a.sub({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace mul {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.mul(new math.Long());
|
||||
const c: adone.math.Long = a.mul(1);
|
||||
const d: adone.math.Long = a.mul("1");
|
||||
const e: adone.math.Long = a.mul({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace div {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.div(new math.Long());
|
||||
const c: adone.math.Long = a.div(1);
|
||||
const d: adone.math.Long = a.div("1");
|
||||
const e: adone.math.Long = a.div({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace mod {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.mod(new math.Long());
|
||||
const c: adone.math.Long = a.mod(1);
|
||||
const d: adone.math.Long = a.mod("1");
|
||||
const e: adone.math.Long = a.mod({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace not {
|
||||
const a: adone.math.Long = new math.Long().not();
|
||||
}
|
||||
|
||||
namespace and {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.and(new math.Long());
|
||||
const c: adone.math.Long = a.and(1);
|
||||
const d: adone.math.Long = a.and("1");
|
||||
const e: adone.math.Long = a.and({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace or {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.or(new math.Long());
|
||||
const c: adone.math.Long = a.or(1);
|
||||
const d: adone.math.Long = a.or("1");
|
||||
const e: adone.math.Long = a.or({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace xor {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.xor(new math.Long());
|
||||
const c: adone.math.Long = a.xor(1);
|
||||
const d: adone.math.Long = a.xor("1");
|
||||
const e: adone.math.Long = a.xor({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace shl {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.shl(new math.Long());
|
||||
const c: adone.math.Long = a.shl(1);
|
||||
}
|
||||
|
||||
namespace shr {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.shr(new math.Long());
|
||||
const c: adone.math.Long = a.shr(1);
|
||||
}
|
||||
|
||||
namespace shru {
|
||||
const a = new math.Long();
|
||||
const b: adone.math.Long = a.shr(new math.Long());
|
||||
const c: adone.math.Long = a.shr(1);
|
||||
}
|
||||
|
||||
namespace toSigned {
|
||||
const a: adone.math.Long = new math.Long().toSigned();
|
||||
}
|
||||
|
||||
namespace toUnsigned {
|
||||
const a: adone.math.Long = new math.Long().toUnsigned();
|
||||
}
|
||||
|
||||
namespace toBytes {
|
||||
const a: number[] = new math.Long().toBytes();
|
||||
}
|
||||
|
||||
namespace toBytesLE {
|
||||
const a: number[] = new math.Long().toBytesLE();
|
||||
}
|
||||
|
||||
namespace static {
|
||||
namespace fromInt {
|
||||
const a: adone.math.Long = math.Long.fromInt(123);
|
||||
const b: adone.math.Long = math.Long.fromInt(123, true);
|
||||
}
|
||||
|
||||
namespace fromNumber {
|
||||
const a: adone.math.Long = math.Long.fromNumber(123);
|
||||
const b: adone.math.Long = math.Long.fromNumber(123, true);
|
||||
}
|
||||
|
||||
namespace fromBits {
|
||||
const a: adone.math.Long = math.Long.fromBits(0, 0);
|
||||
const b: adone.math.Long = math.Long.fromBits(123, 0, true);
|
||||
}
|
||||
|
||||
namespace fromString {
|
||||
const a: adone.math.Long = math.Long.fromString("123");
|
||||
const b: adone.math.Long = math.Long.fromString("123", true);
|
||||
const c: adone.math.Long = math.Long.fromString("123", 16);
|
||||
const d: adone.math.Long = math.Long.fromString("123", true, 16);
|
||||
}
|
||||
|
||||
namespace fromValue {
|
||||
const a: adone.math.Long = math.Long.fromValue(new math.Long());
|
||||
const b: adone.math.Long = math.Long.fromValue(1);
|
||||
const c: adone.math.Long = math.Long.fromValue("1");
|
||||
const e: adone.math.Long = math.Long.fromValue({ low: 0, high: 0 });
|
||||
}
|
||||
|
||||
namespace constants {
|
||||
const a: adone.math.Long = math.Long.MIN_VALUE;
|
||||
const b: adone.math.Long = math.Long.MAX_VALUE;
|
||||
const c: adone.math.Long = math.Long.MAX_UNSIGNED_VALUE;
|
||||
const d: adone.math.Long = math.Long.ZERO;
|
||||
const e: adone.math.Long = math.Long.UZERO;
|
||||
const f: adone.math.Long = math.Long.ONE;
|
||||
const g: adone.math.Long = math.Long.UONE;
|
||||
const h: adone.math.Long = math.Long.NEG_ONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
namespace promiseTests {
|
||||
const { promise } = adone;
|
||||
|
||||
namespace defer {
|
||||
const a = promise.defer();
|
||||
a.promise.then((x) => 2);
|
||||
a.resolve(2);
|
||||
a.reject(3);
|
||||
const b = promise.defer<string>();
|
||||
b.resolve("3");
|
||||
b.reject(2);
|
||||
b.promise.then((x: string) => x);
|
||||
}
|
||||
|
||||
namespace delay {
|
||||
const a: Promise<any> = promise.delay(10);
|
||||
const b: Promise<number> = promise.delay(10, 2);
|
||||
promise.delay(20, "3").then((x: string) => x);
|
||||
}
|
||||
|
||||
namespace timeout {
|
||||
promise.timeout(Promise.resolve(2), 100).then((x: number) => x);
|
||||
}
|
||||
|
||||
namespace nodeify {
|
||||
promise.nodeify(Promise.resolve(2), (err: any, value: number) => value).then((x: number) => x);
|
||||
promise.nodeify(Promise.resolve(2), () => 42).then((x: number) => x);
|
||||
}
|
||||
|
||||
namespace promisify {
|
||||
type Callback<T> = (err?: any, result?: T) => void;
|
||||
namespace noargs {
|
||||
const f = (cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)().then((x: number) => { });
|
||||
}
|
||||
namespace nargs1 {
|
||||
const f = (a: number, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1).then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs2 {
|
||||
const f = (a: number, b: string, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1").then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs3 {
|
||||
const f = (a: number, b: string, c: number, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1", 1).then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs4 {
|
||||
const f = (a: number, b: string, c: number, d: string, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1", 1, "1").then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs5 {
|
||||
const f = (a: number, b: string, c: number, d: string, e: number, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1", 1, "1", 1).then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace moreargs {
|
||||
const f = (a: number, b: string, c: number, d: string, e: number, f: string, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, 2, 3).then((x) => x);
|
||||
}
|
||||
|
||||
namespace options {
|
||||
promise.promisify((cb: Callback<number>) => cb(null, 42), {});
|
||||
promise.promisify((cb: Callback<number>) => cb(null, 42), { context: {} });
|
||||
}
|
||||
}
|
||||
|
||||
namespace promisifyAll {
|
||||
const a: object = promise.promisifyAll({});
|
||||
promise.promisifyAll({}, {});
|
||||
promise.promisifyAll({}, { context: {} });
|
||||
promise.promisifyAll({}, { filter: () => true });
|
||||
promise.promisifyAll({}, { suffix: "Async" });
|
||||
}
|
||||
|
||||
namespace _finally {
|
||||
promise.finally(Promise.resolve(2), () => 2).then((x: number) => {});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
namespace shaniGlobalTests {
|
||||
namespace describeTests {
|
||||
describe("hello", () => {});
|
||||
|
||||
describe("hello", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
describe("1", "2", "3", "4", "45", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
describe("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
context("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace itTests {
|
||||
it("should be here", () => {});
|
||||
|
||||
it("should be here", function () {
|
||||
this.timeout(100);
|
||||
this.skip();
|
||||
this.a;
|
||||
});
|
||||
|
||||
it("should be here", function (done: () => void) {
|
||||
this.timeout(1000);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
|
||||
it("hello", {}, () => {});
|
||||
|
||||
it("hello", {
|
||||
skip: true
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
skip: () => true
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
timeout: () => 1202
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
timeout: 1010
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
before() {}
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
before: ["hello", () => {}]
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
after() {}
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
after: ["hello", () => {}]
|
||||
}, () => {});
|
||||
|
||||
specify("hello", {
|
||||
after: ["hello", () => {}]
|
||||
}, () => {});
|
||||
}
|
||||
|
||||
namespace beforeTests {
|
||||
before(function() {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
before("description", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
before("description", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterTests {
|
||||
after(function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
after("description", function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
after("description", function (done) {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace beforeEachTests {
|
||||
beforeEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
beforeEach("hello", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
beforeEach("hello", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterEachTests {
|
||||
afterEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
afterEach("asd", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
afterEach("asd", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
expect(1).to.be.a("number");
|
||||
assert.equal(1, 1);
|
||||
fakeClock.install().tick(100);
|
||||
stub()(1, 2, 3);
|
||||
expect(spy()).to.have.been.calledOnce;
|
||||
match(2).and(match(2));
|
||||
mock().alwaysCalledOn({});
|
||||
request({}).expectBody("");
|
||||
}
|
||||
@@ -0,0 +1,544 @@
|
||||
namespace shaniTests {
|
||||
const { shani } = adone;
|
||||
|
||||
namespace engineOptionsTests {
|
||||
new shani.Engine();
|
||||
new shani.Engine({});
|
||||
new shani.Engine({ callGc: true });
|
||||
new shani.Engine({ defaultTimeout: 1000 });
|
||||
new shani.Engine({ defaultHookTimeout: 1000 });
|
||||
new shani.Engine({ transpilerOptions: {} });
|
||||
}
|
||||
|
||||
namespace contextTests {
|
||||
const e = new adone.shani.Engine();
|
||||
const c = e.context();
|
||||
|
||||
namespace describeTests {
|
||||
c.describe("hello", () => {});
|
||||
|
||||
c.describe("hello", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.describe("1", "2", "3", "4", "45", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.describe("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.context("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace itTests {
|
||||
c.it("should be here", () => {});
|
||||
|
||||
c.it("should be here", function () {
|
||||
this.timeout(100);
|
||||
this.skip();
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.it("should be here", function (done) {
|
||||
this.timeout(100);
|
||||
this.skip();
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.it("hello", {}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
skip: true
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
skip: () => true
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
timeout: () => 1202
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
timeout: 1010
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
before() { }
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
before: ["hello", () => { }]
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
after() { }
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
after: ["hello", () => { }]
|
||||
}, () => { });
|
||||
|
||||
c.specify("hello", {
|
||||
after: ["hello", () => { }]
|
||||
}, () => { });
|
||||
}
|
||||
|
||||
namespace beforeTests {
|
||||
c.before(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.before("description", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.before("description", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterTests {
|
||||
c.after(function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.after("description", function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.after("description", function (done) {
|
||||
this.timeout(10);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace beforeEachTests {
|
||||
c.beforeEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.beforeEach("hello", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.beforeEach("hello", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterEachTests {
|
||||
c.afterEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.afterEach("asd", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.afterEach("asd", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace rootTests {
|
||||
const { root } = c;
|
||||
root.children[0];
|
||||
root.prepare().then((x) => { });
|
||||
root.addChild(root);
|
||||
const check = (hook: adone.shani.I.Hook) => {
|
||||
hook.run().then((x) => x);
|
||||
hook.cause();
|
||||
hook.failed() === true;
|
||||
hook.timeout() + 2;
|
||||
hook.timeout(10).timeout(10).timeout() + 2;
|
||||
};
|
||||
for (const hook of root.beforeHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
for (const hook of root.afterHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
for (const hook of root.beforeEachHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
for (const hook of root.afterEachHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
root.isInclusive() === true;
|
||||
root.isExclusive() === false;
|
||||
root.hasInclusive() === true;
|
||||
root.skip().only().skip();
|
||||
const a: number | null = root.timeout();
|
||||
root.timeout(100).timeout(100);
|
||||
root.level() + 2;
|
||||
root.level(2).level() + 2;
|
||||
root.chain().toLowerCase();
|
||||
root.blockChain()[0].blockChain()[0].addChild(root);
|
||||
}
|
||||
|
||||
namespace eventEmitterTests {
|
||||
const a = c.start();
|
||||
a.on("enter block", ({ block }) => {
|
||||
block.addChild(block);
|
||||
}).on("exit block", ({ block }) => {
|
||||
block.addChild(block);
|
||||
}).on("start test", ({ block, test }) => {
|
||||
block.addChild(test);
|
||||
test.chain();
|
||||
}).on("end test", ({ block, test, meta }) => {
|
||||
block.addChild(test);
|
||||
test.chain();
|
||||
meta.err;
|
||||
meta.elapsed + 2;
|
||||
}).on("start before hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end before hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start after hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end after hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start before each hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end before each hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start after each hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end after each hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start before test hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end before test hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start after test hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end after test hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("error", (err) => {}).on("done", () => {}).stop();
|
||||
}
|
||||
}
|
||||
|
||||
namespace utilTests {
|
||||
const { util } = shani;
|
||||
|
||||
namespace spyCallTests {
|
||||
const call = util.spy().firstCall;
|
||||
call.calledBefore(call) === true;
|
||||
call.calledAfter(call) === true;
|
||||
call.calledWithNew(call) === true;
|
||||
call.thisValue;
|
||||
call.args[0];
|
||||
call.exception;
|
||||
call.returnValue;
|
||||
call.calledOn({}) === true;
|
||||
call.calledWith(1, 2, 3) === true;
|
||||
call.calledWithExactly(1, 2, 3) === true;
|
||||
call.calledWithMatch(1, 2, 3) === true;
|
||||
call.notCalledWith(1, 2, 3) === true;
|
||||
call.notCalledWithMatch(1, 2, 3) === true;
|
||||
call.returned(1) === true;
|
||||
call.threw() === true;
|
||||
call.threw("12") === true;
|
||||
call.threw({}) === true;
|
||||
call.callArg(1);
|
||||
call.callArgOn(1, {});
|
||||
call.callArgWith(1, 1, 2, 3);
|
||||
call.callArgOnWith(1, {}, 1, 2, 3);
|
||||
call.yield(1, 2, 3);
|
||||
call.yieldOn({}, 1, 2, 3);
|
||||
call.yieldToOn("a", {}, 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace spyTests {
|
||||
util.spy().alwaysCalledOn({});
|
||||
util.spy(() => { }).alwaysCalledOn({});
|
||||
const a: number = util.spy().callCount;
|
||||
const s = util.spy();
|
||||
s.called === true;
|
||||
s.notCalled === true;
|
||||
s.calledOnce === true;
|
||||
s.calledTwice === true;
|
||||
s.calledThrice === true;
|
||||
s.firstCall.args;
|
||||
s.secondCall.args;
|
||||
s.thirdCall.args;
|
||||
s.lastCall.args;
|
||||
s.thisValues[0];
|
||||
s.args[0][0];
|
||||
s.exceptions[0];
|
||||
s.returnValues[0];
|
||||
s(1, 2, 3);
|
||||
s.calledBefore(s);
|
||||
s.calledAfter(s);
|
||||
s.calledImmediatelyAfter(s);
|
||||
s.calledImmediatelyBefore(s);
|
||||
s.calledWithNew() === true;
|
||||
s.withArgs(1, 2, 3).firstCall.args;
|
||||
s.alwaysCalledOn({}) === true;
|
||||
s.alwaysCalledWith(1, 2, 3) === true;
|
||||
s.alwaysCalledWithExactly(1, 2, 3) === true;
|
||||
s.alwaysCalledWithMatch(1, 2, 3) === true;
|
||||
s.neverCalledWith(1, 2, 3) === true;
|
||||
s.neverCalledWithMatch(1, 2, 3) === true;
|
||||
s.alwaysThrew() === true;
|
||||
s.alwaysThrew("a") === true;
|
||||
s.alwaysThrew({}) === true;
|
||||
s.alwaysReturned({}) === true;
|
||||
s.invokeCallback(1, 2, 3);
|
||||
s.getCall(0).args;
|
||||
s.getCalls()[0].args;
|
||||
s.reset();
|
||||
s.printf("%s", "1").toLowerCase();
|
||||
s.restore();
|
||||
}
|
||||
|
||||
namespace stubTests {
|
||||
util.stub({});
|
||||
class A {
|
||||
a() {}
|
||||
}
|
||||
util.stub(new A(), "a").resetHistory();
|
||||
const s = util.stub();
|
||||
s.resetBehavior();
|
||||
s.resetHistory();
|
||||
s.usingPromise({}).alwaysCalledOn(2);
|
||||
s.returns({}).resetBehavior();
|
||||
s.returnsArg(1).resetBehavior();
|
||||
s.returnsThis().resetBehavior();
|
||||
s.resolves().resetBehavior();
|
||||
s.resolves(1).resetBehavior();
|
||||
s.throws().resetBehavior();
|
||||
s.throws("1").resetBehavior();
|
||||
s.throwsArg(1).resetBehavior();
|
||||
s.throwsException().resetBehavior();
|
||||
s.throwsException("1").resetBehavior();
|
||||
s.throwsException({}).resetBehavior();
|
||||
s.rejects().resetBehavior();
|
||||
s.rejects("string").resetBehavior();
|
||||
s.rejects(1).resetBehavior();
|
||||
s.callsArg(1).resetBehavior();
|
||||
s.callThrough().resetBehavior();
|
||||
s.callsArgOn(1, {}).resetBehavior();
|
||||
s.callsArgOnWith(1, {}, 123).resetBehavior();
|
||||
s.callsArgAsync(1).resetBehavior();
|
||||
s.callsArgOnAsync(1, {}).resetBehavior();
|
||||
s.callsArgOnWithAsync(1, {}, 1, 2, 3).resetBehavior();
|
||||
s.callsFake(() => { }).resetBehavior();
|
||||
s.get(() => { }).resetBehavior();
|
||||
s.set((v) => 1).resetBehavior();
|
||||
s.onCall(1).resetBehavior();
|
||||
s.onFirstCall().resetBehavior();
|
||||
s.onSecondCall().resetBehavior();
|
||||
s.onThirdCall().resetBehavior();
|
||||
s.value(1).resetBehavior();
|
||||
s.yields(1, 2, 3).resetBehavior();
|
||||
s.yieldsOn({}, 1, 2).resetBehavior();
|
||||
s.yieldsRight(1, 2, 3).resetBehavior();
|
||||
s.yieldsTo("a", 1, 2, 3).resetBehavior();
|
||||
s.yieldsToOn("a", {}, 1, 2, 3).resetBehavior();
|
||||
s.yieldsAsync(1, 2, 3).resetBehavior();
|
||||
s.yieldsOnAsync({}, 1, 2, 3).resetBehavior();
|
||||
s.yieldsToAsync("a", 1, 2, 3).resetBehavior();
|
||||
s.yieldsToOnAsync("1", {}, 1, 2, 3).resetBehavior();
|
||||
s.withArgs(1, 2, 3).resetBehavior();
|
||||
}
|
||||
|
||||
namespace expectationTests {
|
||||
util.expectation.create("");
|
||||
const e = util.expectation.create();
|
||||
e.atLeast(1).never();
|
||||
e.atMost(2).never();
|
||||
e.never().never();
|
||||
e.once().never();
|
||||
e.twice().never();
|
||||
e.thrice().never();
|
||||
e.exactly(1).never();
|
||||
e.withArgs(1, 2, 3).never();
|
||||
e.withExactArgs(1, 2, 3).never();
|
||||
e.on({}).never();
|
||||
e.verify().never();
|
||||
e.restore();
|
||||
}
|
||||
|
||||
namespace mockTests {
|
||||
util.mock().never();
|
||||
util.mock({}).expects("").restore();
|
||||
util.mock({}).verify();
|
||||
}
|
||||
|
||||
namespace assertTests {
|
||||
util.assert.failException;
|
||||
util.assert.fail();
|
||||
util.assert.fail("1");
|
||||
util.assert.pass(1);
|
||||
const s = util.spy();
|
||||
util.assert.notCalled(s);
|
||||
util.assert.called(s);
|
||||
util.assert.calledOnce(s);
|
||||
util.assert.calledTwice(s);
|
||||
util.assert.calledThrice(s);
|
||||
util.assert.callCount(s, 10);
|
||||
util.assert.callOrder(s, s, s, s);
|
||||
util.assert.calledOn(s, {});
|
||||
util.assert.calledOn(s, {});
|
||||
util.assert.alwaysCalledOn(s, {});
|
||||
util.assert.calledWith(s, {});
|
||||
util.assert.neverCalledWith(s, {});
|
||||
util.assert.calledWithExactly(s, {});
|
||||
util.assert.alwaysCalledWithExactly(s, {});
|
||||
util.assert.calledWithMatch(s, {});
|
||||
util.assert.alwaysCalledWithMatch(s, {});
|
||||
util.assert.neverCalledWithMatch(s, {});
|
||||
util.assert.threw(s);
|
||||
util.assert.threw(s, "a");
|
||||
util.assert.threw(s, {});
|
||||
util.assert.alwaysThrew(s);
|
||||
util.assert.alwaysThrew(s, "");
|
||||
util.assert.alwaysThrew(s, {});
|
||||
util.assert.expose({});
|
||||
util.assert.expose({}, { includeFail: true });
|
||||
util.assert.expose({}, { prefix: "a" });
|
||||
}
|
||||
|
||||
namespace matchTests {
|
||||
util.match(1).and(util.match(1));
|
||||
util.match("1").and(util.match(1));
|
||||
util.match(/1/).and(util.match(1));
|
||||
util.match({}).and(util.match(1));
|
||||
util.match((v: any) => true).and(util.match(1));
|
||||
util.match((v: any) => true, "a").and(util.match(1));
|
||||
util.match.any.and;
|
||||
util.match.defined.and;
|
||||
util.match.truthy.and;
|
||||
util.match.falsy.and;
|
||||
util.match.bool.and;
|
||||
util.match.number.and;
|
||||
util.match.string.and;
|
||||
util.match.object.and;
|
||||
util.match.func.and;
|
||||
util.match.map.contains(new Map());
|
||||
util.match.map.deepEquals(new Map());
|
||||
util.match.set.contains(new Set());
|
||||
util.match.array.contains([]);
|
||||
util.match.array.deepEquals([]);
|
||||
util.match.array.endsWith([]);
|
||||
util.match.array.startsWith([]);
|
||||
util.match.regexp.and;
|
||||
util.match.date.and;
|
||||
util.match.symbol.and;
|
||||
util.match.same({}).and;
|
||||
util.match.typeOf("string").and;
|
||||
util.match.instanceOf({}).and;
|
||||
util.match.has("a").and;
|
||||
util.match.has("a", {}).and;
|
||||
util.match.hasOwn("a").and;
|
||||
util.match.hasOwn("a", {}).and;
|
||||
}
|
||||
|
||||
namespace sandboxTests {
|
||||
util.sandbox.create();
|
||||
util.sandbox.create({});
|
||||
util.sandbox.create({ injectInto: {} });
|
||||
util.sandbox.create({ properties: ["a"] });
|
||||
const s = util.sandbox.create();
|
||||
s.assert.alwaysCalledOn(s.spy(), {});
|
||||
s.spy().args;
|
||||
s.stub().args;
|
||||
s.mock().args;
|
||||
s.restore();
|
||||
s.reset();
|
||||
s.resetHistory();
|
||||
s.resetBehavior();
|
||||
s.usingPromise({}).reset();
|
||||
s.verify();
|
||||
s.verifyAndRestore();
|
||||
}
|
||||
}
|
||||
|
||||
namespace requestTests {
|
||||
const r = request({});
|
||||
r.get("/").head("/").post("/").put("/").options("/");
|
||||
r.attach("fname", "hello");
|
||||
r.attach("fname", "hello", {});
|
||||
r.attach("fname", "hello", { type: "application/javascript" });
|
||||
r.attach("fname", "hello", { filename: "a.js" });
|
||||
r.field("a", "basd");
|
||||
r.send("asd");
|
||||
r.setHeader("Cookie", "key=value");
|
||||
r.auth("user", "pass");
|
||||
r.expect(() => true);
|
||||
r.expect(async () => true);
|
||||
r.expect((response) => {
|
||||
assert.equal(response.statusCode, 200);
|
||||
return response.body.length === 0;
|
||||
});
|
||||
r.expectStatus(200);
|
||||
r.expectStatusMessage("OK");
|
||||
r.expectBody("body");
|
||||
r.expectBody(Buffer.from("body"));
|
||||
r.expectBody(/body/);
|
||||
r.expectBody({ a: 1 });
|
||||
r.expectBody("body", {});
|
||||
r.expectBody("body", { decompress: true });
|
||||
r.expectEmptyBody();
|
||||
r.expectHeader("Cookie", "key=value");
|
||||
r.expectHeaderExists("Cookie");
|
||||
r.then((x: adone.shani.util.I.Response) => {
|
||||
x.statusCode === 200;
|
||||
x.body.fill(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
import adone from "adone";
|
||||
|
||||
import * as assert from "assert";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as util from "util";
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
import * as url from "url";
|
||||
import * as net from "net";
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import * as child_process from "child_process";
|
||||
import * as os from "os";
|
||||
import * as cluster from "cluster";
|
||||
import * as repl from "repl";
|
||||
import * as punycode from "punycode";
|
||||
import * as readline from "readline";
|
||||
import * as string_decoder from "string_decoder";
|
||||
import * as querystring from "querystring";
|
||||
import * as crypto from "crypto";
|
||||
import * as vm from "vm";
|
||||
import * as v8 from "v8";
|
||||
import * as domain from "domain";
|
||||
import * as tty from "tty";
|
||||
import * as buffer from "buffer";
|
||||
import * as constants from "constants";
|
||||
import * as zlib from "zlib";
|
||||
import * as tls from "tls";
|
||||
import * as console from "console";
|
||||
import * as dns from "dns";
|
||||
import * as timers from "timers";
|
||||
import * as dgram from "dgram";
|
||||
|
||||
const { std } = adone;
|
||||
|
||||
namespace stdTests {
|
||||
namespace assert {
|
||||
std.assert(true);
|
||||
}
|
||||
|
||||
namespace fs {
|
||||
std.fs.readFileSync("test").length;
|
||||
}
|
||||
|
||||
namespace path {
|
||||
std.path.join("a", "b").charAt(0);
|
||||
}
|
||||
|
||||
namespace util {
|
||||
std.util.format("hello").charAt(0);
|
||||
}
|
||||
|
||||
namespace events {
|
||||
new std.events.EventEmitter().on("event", () => {});
|
||||
}
|
||||
|
||||
namespace steam {
|
||||
new std.stream.PassThrough().resume();
|
||||
}
|
||||
|
||||
namespace url {
|
||||
std.url.parse("https://adone.io").hostname;
|
||||
}
|
||||
|
||||
namespace net {
|
||||
std.net.connect(31337).write("hello");
|
||||
}
|
||||
|
||||
namespace http {
|
||||
std.http.get("http://localhost").end();
|
||||
}
|
||||
|
||||
namespace https {
|
||||
std.https.get("https://adone.io").end();
|
||||
}
|
||||
|
||||
namespace child_process {
|
||||
std.child_process.fork(__filename, [], { stdio: ["ipc"] }).send("hello");
|
||||
}
|
||||
|
||||
namespace os {
|
||||
std.os.tmpdir().charAt(0);
|
||||
}
|
||||
|
||||
namespace cluster {
|
||||
std.cluster.fork().kill();
|
||||
}
|
||||
|
||||
namespace repl {
|
||||
std.repl.start().close();
|
||||
}
|
||||
|
||||
namespace punycode {
|
||||
std.punycode.decode("ads").charAt(0);
|
||||
}
|
||||
|
||||
namespace readline {
|
||||
std.readline.clearLine(process.stdout, 1);
|
||||
}
|
||||
|
||||
namespace string_decoder {
|
||||
new std.string_decoder.StringDecoder().end().charAt(0);
|
||||
}
|
||||
|
||||
namespace querystring {
|
||||
std.querystring.escape("hello").charAt(0);
|
||||
}
|
||||
|
||||
namespace crypto {
|
||||
std.crypto.createHash("sha1").update("hello").digest("hex");
|
||||
}
|
||||
|
||||
namespace vm {
|
||||
std.vm.runInContext("a + 2", std.vm.createContext({ a: 1 }));
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
std.v8.getHeapStatistics().heap_size_limit + 2;
|
||||
}
|
||||
|
||||
namespace domain {
|
||||
std.domain.create().members;
|
||||
}
|
||||
|
||||
namespace tty {
|
||||
std.tty.isatty(1) === true;
|
||||
}
|
||||
|
||||
namespace buffer {
|
||||
std.buffer.Buffer.alloc(10);
|
||||
}
|
||||
|
||||
namespace constants {
|
||||
std.constants.EACCES + 2;
|
||||
}
|
||||
|
||||
namespace zlib {
|
||||
std.zlib.createDeflate().write("ttt");
|
||||
}
|
||||
|
||||
namespace tls {
|
||||
std.tls.connect({}).end();
|
||||
}
|
||||
|
||||
namespace console {
|
||||
std.console.trace("message");
|
||||
}
|
||||
|
||||
namespace dns {
|
||||
std.dns.resolve4("adone.io", (err, data) => {});
|
||||
}
|
||||
|
||||
namespace timers {
|
||||
std.timers.setTimeout(() => {}, 2000).unref();
|
||||
}
|
||||
|
||||
namespace dgram {
|
||||
std.dgram.createSocket("udp4").bind(31337);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,737 @@
|
||||
const { util } = adone;
|
||||
|
||||
namespace utilTests {
|
||||
namespace arrify {
|
||||
const a: number[] = util.arrify([1, 2, 3]);
|
||||
const b: number[] = util.arrify(1);
|
||||
const c: string[] = util.arrify("2");
|
||||
const d: string[] = util.arrify(["1"]);
|
||||
}
|
||||
|
||||
namespace slice {
|
||||
const a: number[] = util.slice([1, 2, 3]);
|
||||
const b: number[] = util.slice([1, 2, 3], 1);
|
||||
const c: number[] = util.slice([1, 2, 3], 1, 4);
|
||||
const d: string[] = util.slice(["1"]);
|
||||
}
|
||||
|
||||
namespace spliceOne {
|
||||
util.spliceOne([1, 2, 3], 0);
|
||||
}
|
||||
|
||||
namespace normalizePath {
|
||||
const a: string = util.normalizePath("path");
|
||||
const b: string = util.normalizePath("path", true);
|
||||
}
|
||||
|
||||
namespace unixifyPath {
|
||||
const a: string = util.unixifyPath("path");
|
||||
const b: string = util.unixifyPath("path", true);
|
||||
}
|
||||
|
||||
namespace functionName {
|
||||
const a: string = util.functionName(function f() { });
|
||||
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;
|
||||
hours: number;
|
||||
milliseconds: number;
|
||||
minutes: number;
|
||||
} = util.parseMs(123);
|
||||
}
|
||||
|
||||
namespace pluralizeWord {
|
||||
const a: string = util.pluralizeWord("day");
|
||||
const b: string = util.pluralizeWord("day", "days");
|
||||
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"]);
|
||||
}
|
||||
|
||||
namespace shuffleArray {
|
||||
const a: number[] = util.shuffleArray([1, 2, 3]);
|
||||
const b: string[] = util.shuffleArray(["1", "2", "3"]);
|
||||
}
|
||||
|
||||
namespace enumerate {
|
||||
{
|
||||
const a = util.enumerate([1, 2, 3]);
|
||||
const it = a[Symbol.iterator]();
|
||||
const value: [number, number] = it.next().value;
|
||||
for (const i of a) {
|
||||
const [idx, value]: [number, number] = i;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a = util.enumerate(["1", "2"]);
|
||||
const it = a[Symbol.iterator]();
|
||||
const value: [number, string] = it.next().value;
|
||||
for (const i of a) {
|
||||
const [idx, value]: [number, string] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace zip {
|
||||
{
|
||||
const a = util.zip([1, 2, 3], ["4", "5", "6"]);
|
||||
const it = a[Symbol.iterator]();
|
||||
const value: [number, string] = it.next().value;
|
||||
for (const i of a) {
|
||||
const [i1, i2]: [number, string] = i;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a = util.zip(
|
||||
[1, 2, 3],
|
||||
["4", "5", "6"],
|
||||
[7, 8, 9]
|
||||
);
|
||||
const it = a[Symbol.iterator]();
|
||||
const value: [number, string, number] = it.next().value;
|
||||
for (const i of a) {
|
||||
const [i1, i2, i3]: [number, string, number] = i;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a = util.zip(
|
||||
[1, 2, 3],
|
||||
["4", "5", "6"],
|
||||
[7, 8, 9],
|
||||
["10", "11", "12"]
|
||||
);
|
||||
const it = a[Symbol.iterator]();
|
||||
const value: [number, string, number, string] = it.next().value;
|
||||
for (const i of a) {
|
||||
const [i1, i2, i3, i4]: [number, string, number, string] = i;
|
||||
}
|
||||
}
|
||||
{
|
||||
const a = util.zip(
|
||||
[1, 2, 3],
|
||||
["4", "5", "6"],
|
||||
[7, 8, 9],
|
||||
["10", "11", "12"],
|
||||
[13, 14, 15, 16]
|
||||
);
|
||||
const it = a[Symbol.iterator]();
|
||||
const value: any[] = it.next().value;
|
||||
for (const i of a) {
|
||||
const [i1, i2, i3, i4]: any[] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace keys {
|
||||
const a: string[] = util.keys({});
|
||||
const b: string[] = util.keys({}, { all: true });
|
||||
const c: string[] = util.keys({}, { followProto: true });
|
||||
const d: string[] = util.keys({}, { onlyEnumerable: true });
|
||||
}
|
||||
|
||||
namespace values {
|
||||
const a: any[] = util.values({});
|
||||
const b: any[] = util.values({}, { all: true });
|
||||
const c: any[] = util.values({}, { followProto: true });
|
||||
const d: any[] = util.values({}, { onlyEnumerable: true });
|
||||
}
|
||||
|
||||
namespace entries {
|
||||
const a: Array<[string, any]> = util.entries({});
|
||||
const b: Array<[string, any]> = util.entries({}, { all: true });
|
||||
const c: Array<[string, any]> = util.entries({}, { followProto: true });
|
||||
const d: Array<[string, any]> = util.entries({}, { onlyEnumerable: true });
|
||||
}
|
||||
|
||||
namespace toDotNotation {
|
||||
const a: object = util.toDotNotation({ a: 1 });
|
||||
}
|
||||
|
||||
namespace flatten {
|
||||
const a: number[] = util.flatten([1, [2, 3]]);
|
||||
const b: number[] = util.flatten([1, [2, 3]], {});
|
||||
const c: number[] = util.flatten([1, [2, 3]], { depth: 1 });
|
||||
}
|
||||
|
||||
namespace globParent {
|
||||
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({}, {});
|
||||
const c: object = util.sortKeys({}, { deep: true });
|
||||
const d: object = util.sortKeys({}, { compare: (a, b) => 2 });
|
||||
}
|
||||
|
||||
namespace globize {
|
||||
const a: string = util.globize("test");
|
||||
const b: string = util.globize("test", {});
|
||||
const c: string = util.globize("test", { exts: "" });
|
||||
const d: string = util.globize("test", { recursively: true });
|
||||
}
|
||||
|
||||
namespace unique {
|
||||
const a: number[] = util.unique([1, 2, 3]);
|
||||
const b: string[] = util.unique(["1", "2", "3"]);
|
||||
const c: object[] = util.unique([{ a: 1 }, { a: 2 }], (obj: any) => obj.a);
|
||||
}
|
||||
|
||||
namespace invertObject {
|
||||
const a: object = util.invertObject({});
|
||||
const b: object = util.invertObject({}, {});
|
||||
const c: object = util.invertObject({}, { all: true });
|
||||
const d: object = util.invertObject({}, { followProto: true });
|
||||
const e: object = util.invertObject({}, { onlyEnumerable: true });
|
||||
}
|
||||
|
||||
namespace humanizeTime {
|
||||
const a: string = util.humanizeTime(12345);
|
||||
const b: string = util.humanizeTime(12345, {});
|
||||
const c: string = util.humanizeTime(12345, { compact: true });
|
||||
const d: string = util.humanizeTime(12345, { msDecimalDigits: 2 });
|
||||
const e: string = util.humanizeTime(12345, { secDecimalDigits: 2 });
|
||||
const f: string = util.humanizeTime(12345, { verbose: true });
|
||||
}
|
||||
|
||||
namespace humanizeSize {
|
||||
const a: string = util.humanizeSize(12345);
|
||||
const b: string = util.humanizeSize(12345, "");
|
||||
}
|
||||
|
||||
namespace parseSize {
|
||||
const a: number | null = util.parseSize(123);
|
||||
const b: number | null = util.parseSize("123Kb");
|
||||
}
|
||||
|
||||
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], () => { }, () => { });
|
||||
}
|
||||
|
||||
namespace asyncFor {
|
||||
util.asyncFor({}, () => { }, () => { });
|
||||
}
|
||||
|
||||
namespace once {
|
||||
{
|
||||
const f = () => 2;
|
||||
const a: () => number = util.once(f);
|
||||
}
|
||||
{
|
||||
const f = (a: number) => `${a}`;
|
||||
const a: (a: number) => string = util.once(f);
|
||||
}
|
||||
}
|
||||
|
||||
namespace asyncWaterfall {
|
||||
util.asyncWaterfall([
|
||||
(callback: (a: any, b: any, c: any) => void) => {
|
||||
callback(null, 'one', 'two');
|
||||
}
|
||||
], (err: any, result: any) => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
namespace xrange {
|
||||
for (const i of util.xrange(10)) {
|
||||
const a: number = i;
|
||||
}
|
||||
for (const i of util.xrange(1, 10)) {
|
||||
const a: number = i;
|
||||
}
|
||||
for (const i of util.xrange(1, 10, 2)) {
|
||||
const a: number = i;
|
||||
}
|
||||
}
|
||||
namespace range {
|
||||
const a: number[] = util.range(10);
|
||||
const b: number[] = util.range(1, 10);
|
||||
const c: number[] = util.range(1, 10, 2);
|
||||
}
|
||||
|
||||
namespace reFindAll {
|
||||
const a: RegExpExecArray[] = util.reFindAll(/\d+/, "1 2 3 4 5");
|
||||
}
|
||||
|
||||
namespace assignDeep {
|
||||
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 toposort {
|
||||
const a: number[] = 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]
|
||||
]);
|
||||
}
|
||||
|
||||
namespace jsesc {
|
||||
const a: string = util.jsesc({ a: 1 });
|
||||
const b: string = util.jsesc({ a: 1 }, { escapeEverything: true });
|
||||
const c: string = util.jsesc({ a: 1 }, { minimal: true });
|
||||
const d: string = util.jsesc({ a: 1 }, { isScriptContext: true });
|
||||
const e: string = util.jsesc({ a: 1 }, { quotes: "'" });
|
||||
const f: string = util.jsesc({ a: 1 }, { wrap: true });
|
||||
const g: string = util.jsesc({ a: 1 }, { es6: true });
|
||||
const h: string = util.jsesc({ a: 1 }, { json: true });
|
||||
const i: string = util.jsesc({ a: 1 }, { compact: true });
|
||||
const j: string = util.jsesc({ a: 1 }, { lowercaseHex: true });
|
||||
const k: string = util.jsesc({ a: 1 }, { numbers: "decimal" });
|
||||
const l: string = util.jsesc({ a: 1 }, { indent: " " });
|
||||
const m: string = util.jsesc({ a: 1 }, { indentLevel: 4 });
|
||||
const n: string = util.jsesc({ a: 1 }, { __inline1__: true });
|
||||
const o: string = util.jsesc({ a: 1 }, { __inline2__: true });
|
||||
}
|
||||
|
||||
namespace typeOf {
|
||||
const a: string = util.typeOf(1);
|
||||
}
|
||||
|
||||
namespace memcpy {
|
||||
const a: number = util.memcpy.utou(Buffer.alloc(10), 0, Buffer.alloc(10), 0, 10);
|
||||
const b: number = util.memcpy.atoa(new ArrayBuffer(10), 0, new ArrayBuffer(10), 0, 10);
|
||||
const c: number = util.memcpy.atou(Buffer.alloc(10), 0, new ArrayBuffer(10), 0, 10);
|
||||
const d: number = util.memcpy.utoa(new ArrayBuffer(10), 0, Buffer.alloc(10), 0, 10);
|
||||
const e: number = util.memcpy.copy(Buffer.alloc(10), 0, Buffer.alloc(10), 0, 10);
|
||||
const f: number = util.memcpy.copy(new ArrayBuffer(10), 0, new ArrayBuffer(10), 0, 10);
|
||||
const g: number = util.memcpy.copy(Buffer.alloc(10), 0, new ArrayBuffer(10), 0, 10);
|
||||
const h: number = util.memcpy.copy(new ArrayBuffer(10), 0, Buffer.alloc(10), 0, 10);
|
||||
}
|
||||
|
||||
namespace uuid {
|
||||
namespace v1 {
|
||||
const a: string = util.uuid.v1();
|
||||
const b: number[] = util.uuid.v1({}, []);
|
||||
const c: number[] = util.uuid.v1({}, [], 1);
|
||||
const d: string = util.uuid.v1({});
|
||||
const e: string = util.uuid.v1({ clockseq: 1 });
|
||||
const f: string = util.uuid.v1({ msecs: 1 });
|
||||
const g: string = util.uuid.v1({ nsecs: 1 });
|
||||
}
|
||||
|
||||
namespace v4 {
|
||||
const a: string = util.uuid.v4();
|
||||
const b: number[] = util.uuid.v4({}, []);
|
||||
const c: number[] = util.uuid.v4({}, [], 1);
|
||||
const d: string = util.uuid.v4({});
|
||||
const e: string = util.uuid.v4({ clockseq: 1 });
|
||||
const f: string = util.uuid.v4({ msecs: 1 });
|
||||
const g: string = util.uuid.v4({ nsecs: 1 });
|
||||
}
|
||||
|
||||
namespace v5 {
|
||||
const a: string = util.uuid.v5([], []);
|
||||
const b: number[] = util.uuid.v5([], [], []);
|
||||
const c: number[] = util.uuid.v5([], [], [], 1);
|
||||
}
|
||||
}
|
||||
|
||||
namespace delegate {
|
||||
const a = util.delegate({}, "a");
|
||||
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
|
||||
}
|
||||
|
||||
namespace sqlstring {
|
||||
namespace escapeId {
|
||||
const a: string = util.sqlstring.escapeId("asd");
|
||||
const b: string = util.sqlstring.escapeId(["asd"]);
|
||||
const c: string = util.sqlstring.escapeId(["asd"], true);
|
||||
}
|
||||
|
||||
namespace dateToString {
|
||||
const a: string = util.sqlstring.dateToString(Date.now());
|
||||
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);
|
||||
const c: string = util.sqlstring.escape(1, true, "local");
|
||||
}
|
||||
|
||||
namespace format {
|
||||
const a: string = util.sqlstring.format("??");
|
||||
const b: string = util.sqlstring.format("??", "a");
|
||||
const c: string = util.sqlstring.format("??", ["a"]);
|
||||
const d: string = util.sqlstring.format("??", ["a"], true);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Editor {
|
||||
namespace options {
|
||||
new util.Editor();
|
||||
new util.Editor({});
|
||||
new util.Editor({ text: "" });
|
||||
new util.Editor({ editor: "" });
|
||||
new util.Editor({ path: "" });
|
||||
new util.Editor({ ext: "" });
|
||||
}
|
||||
|
||||
const a: string = util.Editor.DEFAULT;
|
||||
new util.Editor().spawn().then((x: adone.std.child_process.ChildProcess) => { });
|
||||
new util.Editor().run().then((x: string) => { });
|
||||
new util.Editor().cleanup().then((x: undefined) => { });
|
||||
util.Editor.edit().then((x: string) => { });
|
||||
}
|
||||
|
||||
namespace binarySearch {
|
||||
const a: number = util.binarySearch.GREATEST_LOWER_BOUND;
|
||||
const b: number = util.binarySearch.GREATEST_LOWER_BOUND;
|
||||
const c: number = util.binarySearch([1, 2, 3], 2);
|
||||
const d: number = util.binarySearch([1, 2, 3], 2, 0);
|
||||
const e: number = util.binarySearch([1, 2, 3], 2, 0, 10);
|
||||
const f: number = util.binarySearch([1, 2, 3], 2, 0, 10, (a, b) => a - b);
|
||||
const g: number = util.binarySearch([1, 2, 3], 2, 0, 10, (a, b) => a - b, util.binarySearch.GREATEST_LOWER_BOUND);
|
||||
}
|
||||
|
||||
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 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);
|
||||
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 fakeClock {
|
||||
namespace timers {
|
||||
const a: typeof global.setTimeout = util.fakeClock.timers.setTimeout;
|
||||
const b: typeof global.clearTimeout = util.fakeClock.timers.clearTimeout;
|
||||
const c: typeof global.setInterval = util.fakeClock.timers.setInterval;
|
||||
const d: typeof global.clearInterval = util.fakeClock.timers.clearInterval;
|
||||
const e: typeof global.setImmediate = util.fakeClock.timers.setImmediate;
|
||||
const f: typeof global.clearImmediate = util.fakeClock.timers.clearImmediate;
|
||||
const g: typeof global.Date = util.fakeClock.timers.Date;
|
||||
const h: typeof global.process.hrtime = util.fakeClock.timers.hrtime;
|
||||
const i: typeof global.process.nextTick = util.fakeClock.timers.nextTick;
|
||||
}
|
||||
|
||||
namespace install {
|
||||
util.fakeClock.install();
|
||||
util.fakeClock.install(100);
|
||||
util.fakeClock.install(new Date());
|
||||
util.fakeClock.install({});
|
||||
util.fakeClock.install({ advanceTimeDelta: 20 });
|
||||
util.fakeClock.install({ loopLimit: 20 });
|
||||
util.fakeClock.install({ now: 20 });
|
||||
util.fakeClock.install({ shouldAdvanceTime: false });
|
||||
util.fakeClock.install({ target: {} });
|
||||
const clock = util.fakeClock.install({ toFake: ["setTimeout", "clearTimeout"] });
|
||||
{
|
||||
const timer = clock.setTimeout(() => {}, 100, 1, 2, 3);
|
||||
const id: number = timer.id;
|
||||
timer.ref();
|
||||
timer.unref();
|
||||
clock.clearTimeout(timer);
|
||||
}
|
||||
{
|
||||
const timer = clock.setInterval(() => {}, 1, 2, 3);
|
||||
const id: number = timer.id;
|
||||
timer.ref();
|
||||
timer.unref();
|
||||
clock.clearInterval(timer);
|
||||
}
|
||||
{
|
||||
const timer = clock.setImmediate(() => {}, 1, 2, 3);
|
||||
const id: number = timer.id;
|
||||
timer.ref();
|
||||
timer.unref();
|
||||
clock.clearImmediate(timer);
|
||||
}
|
||||
clock.nextTick(() => {}, 1, 2, 3);
|
||||
clock.updateHrTime(10);
|
||||
const a: number = clock.tick(100);
|
||||
const b: number = clock.next();
|
||||
const c: number = clock.runAll();
|
||||
const d: number = clock.runToLast();
|
||||
clock.setSystemTime(100);
|
||||
const e: [number, number] = clock.hrtime();
|
||||
const f: [number, number] = clock.hrtime(e);
|
||||
clock.uninstall();
|
||||
}
|
||||
|
||||
namespace createClock {
|
||||
util.fakeClock.createClock();
|
||||
util.fakeClock.createClock(0);
|
||||
const clock = util.fakeClock.createClock(0, 100);
|
||||
{
|
||||
const timer = clock.setTimeout(() => {}, 100, 1, 2, 3);
|
||||
const id: number = timer.id;
|
||||
timer.ref();
|
||||
timer.unref();
|
||||
clock.clearTimeout(timer);
|
||||
}
|
||||
{
|
||||
const timer = clock.setInterval(() => {}, 1, 2, 3);
|
||||
const id: number = timer.id;
|
||||
timer.ref();
|
||||
timer.unref();
|
||||
clock.clearInterval(timer);
|
||||
}
|
||||
{
|
||||
const timer = clock.setImmediate(() => {}, 1, 2, 3);
|
||||
const id: number = timer.id;
|
||||
timer.ref();
|
||||
timer.unref();
|
||||
clock.clearImmediate(timer);
|
||||
}
|
||||
clock.nextTick(() => {}, 1, 2, 3);
|
||||
clock.updateHrTime(10);
|
||||
const a: number = clock.tick(100);
|
||||
const b: number = clock.next();
|
||||
const c: number = clock.runAll();
|
||||
const d: number = clock.runToLast();
|
||||
clock.setSystemTime(100);
|
||||
const e: [number, number] = clock.hrtime();
|
||||
const f: [number, number] = clock.hrtime(e);
|
||||
}
|
||||
|
||||
namespace ltgt {
|
||||
namespace contains {
|
||||
const a: boolean = util.ltgt.contains({ lt: 2 }, 2);
|
||||
const b: boolean = util.ltgt.contains({ lt: 2 }, 2, (a, b) => b - a);
|
||||
const c: boolean = util.ltgt.contains({ lt: "2" }, "2");
|
||||
const d: boolean = util.ltgt.contains({ lt: "2" }, "2", (a, b) => b.charCodeAt(0) - a.charCodeAt(0));
|
||||
}
|
||||
|
||||
namespace filter {
|
||||
const a: (a: number) => boolean = util.ltgt.filter({ lt: 2 });
|
||||
const b: (a: number) => boolean = util.ltgt.filter({ lt: 2 }, (a, b) => b - a);
|
||||
const c: (a: string) => boolean = util.ltgt.filter({ lt: "2" });
|
||||
const d: (a: string) => boolean = util.ltgt.filter({ lt: "2" }, (a, b) => b.charCodeAt(0) - a.charCodeAt(0));
|
||||
}
|
||||
|
||||
namespace toLtgt {
|
||||
const a: adone.util.ltgt.I.Range<number> = util.ltgt.toLtgt({ lt: 2 }, {});
|
||||
const b: adone.util.ltgt.I.Range<string> = util.ltgt.toLtgt({ lt: 2 }, {}, (a) => `${a}`);
|
||||
const c: adone.util.ltgt.I.Range<number> = util.ltgt.toLtgt({ lt: 2 }, {}, (a) => a, 2);
|
||||
const d: adone.util.ltgt.I.Range<number> = util.ltgt.toLtgt({ lt: 2 }, {}, (a) => a, 2, 5);
|
||||
}
|
||||
|
||||
namespace endEnclusive {
|
||||
const a: boolean = util.ltgt.endInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace startInclusive {
|
||||
const a: boolean = util.ltgt.startInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace end {
|
||||
const a: number | undefined = util.ltgt.end({ lt: 2 });
|
||||
const b: number | string = util.ltgt.end({ lt: 2 }, "2");
|
||||
const c: number = util.ltgt.end({ lt: 2 }, 2);
|
||||
}
|
||||
|
||||
namespace start {
|
||||
const a: number | undefined = util.ltgt.start({ lt: 2 });
|
||||
const b: number | string = util.ltgt.start({ lt: 2 }, "2");
|
||||
const c: number = util.ltgt.start({ lt: 2 }, 2);
|
||||
}
|
||||
|
||||
namespace upperBound {
|
||||
const a: number | undefined = util.ltgt.upperBound({ lt: 2 });
|
||||
const b: number | string = util.ltgt.upperBound({ lt: 2 }, "2");
|
||||
const c: number = util.ltgt.upperBound({ lt: 2 }, 2);
|
||||
}
|
||||
|
||||
namespace upperBoundKey {
|
||||
const a: number | undefined = util.ltgt.upperBoundKey({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace upperBoundExclusive {
|
||||
const a: boolean = util.ltgt.upperBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace lowerBoundExclusive {
|
||||
const a: boolean = util.ltgt.lowerBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace upperBoundInclusive {
|
||||
const a: boolean = util.ltgt.upperBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace lowerBoundInclusive {
|
||||
const a: boolean = util.ltgt.lowerBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace lowerBound {
|
||||
const a: number | undefined = util.ltgt.lowerBound({ lt: 2 });
|
||||
const b: number | string = util.ltgt.lowerBound({ lt: 2 }, "2");
|
||||
const c: number = util.ltgt.lowerBound({ lt: 2 }, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import adone from "adone";
|
||||
|
||||
namespace AdoneRootImportTests {
|
||||
adone.falsely() === false;
|
||||
adone.std.fs.createReadStream(__filename).close();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
namespace AdoneRootTests {
|
||||
{ const a: symbol = adone.null; }
|
||||
adone.noop();
|
||||
{ const a: number = adone.identity(2); }
|
||||
{ const a: string = adone.identity("2"); }
|
||||
{ const a: number[] = adone.identity([1, 2]); }
|
||||
{ adone.truly() === true; }
|
||||
{ adone.falsely() === false; }
|
||||
{ const a: string = adone.ok; }
|
||||
{ const a: string = adone.bad; }
|
||||
{ const a: string[] = adone.exts; }
|
||||
adone.log();
|
||||
adone.fatal();
|
||||
adone.error();
|
||||
adone.warn();
|
||||
adone.info();
|
||||
adone.debug();
|
||||
adone.trace();
|
||||
{ const a: object = adone.o(); }
|
||||
{ const a: object = adone.o({}); }
|
||||
{ const a: typeof Date = adone.Date; }
|
||||
{ const a: typeof process.hrtime = adone.hrtime; }
|
||||
{ const a: typeof setTimeout = adone.setTimeout; }
|
||||
{ const a: typeof clearTimeout = adone.clearTimeout; }
|
||||
{ const a: typeof setInterval = adone.setInterval; }
|
||||
{ const a: typeof clearInterval = adone.clearInterval; }
|
||||
{ const a: typeof setImmediate = adone.setImmediate; }
|
||||
{ const a: typeof clearImmediate = adone.clearImmediate; }
|
||||
adone.lazify({});
|
||||
adone.lazify({}, {});
|
||||
adone.lazify({}, {}, () => { });
|
||||
adone.lazify({}, {}, () => { }, { configurable: true });
|
||||
adone.tag.set({}, "123");
|
||||
adone.tag.has({}, "123") === true;
|
||||
adone.tag.define("12");
|
||||
adone.tag.define("123", "456");
|
||||
{ const a: symbol = adone.tag.SUBSYSTEM; }
|
||||
{ const a: symbol = adone.tag.APPLICATION; }
|
||||
{ const a: symbol = adone.tag.TRANSFORM; }
|
||||
{ const a: symbol = adone.tag.CORE_STREAM; }
|
||||
{ const a: symbol = adone.tag.LOGGER; }
|
||||
{ const a: symbol = adone.tag.LONG; }
|
||||
{ const a: symbol = adone.tag.BIGNUMBER; }
|
||||
{ const a: symbol = adone.tag.EXBUFFER; }
|
||||
{ const a: symbol = adone.tag.EXDATE; }
|
||||
{ const a: symbol = adone.tag.CONFIGURATION; }
|
||||
{ const a: symbol = adone.tag.GENESIS_NETRON; }
|
||||
{ const a: symbol = adone.tag.GENESIS_PEER; }
|
||||
{ const a: symbol = adone.tag.NETRON; }
|
||||
{ const a: symbol = adone.tag.NETRON_PEER; }
|
||||
{ const a: symbol = adone.tag.NETRON_ADAPTER; }
|
||||
{ const a: symbol = adone.tag.NETRON_DEFINITION; }
|
||||
{ const a: symbol = adone.tag.NETRON_DEFINITIONS; }
|
||||
{ const a: symbol = adone.tag.NETRON_REFERENCE; }
|
||||
{ const a: symbol = adone.tag.NETRON_INTERFACE; }
|
||||
{ const a: symbol = adone.tag.NETRON_STUB; }
|
||||
{ const a: symbol = adone.tag.NETRON_REMOTESTUB; }
|
||||
{ const a: symbol = adone.tag.NETRON_STREAM; }
|
||||
{ const a: symbol = adone.tag.FAST_STREAM; }
|
||||
{ const a: symbol = adone.tag.FAST_FS_STREAM; }
|
||||
{ const a: symbol = adone.tag.FAST_FS_MAP_STREAM; }
|
||||
{ const a: Promise<void> = adone.run({}); }
|
||||
{ const a: Promise<void> = adone.run({}, false); }
|
||||
{ const a: object = adone.bind("library"); } // hmm
|
||||
{ const a: string = adone.getAssetAbsolutePath("asset"); }
|
||||
{ const a: Buffer | string = adone.loadAsset("asset"); }
|
||||
{ const a: object = adone.require("path"); }
|
||||
{ const a: object = adone.package; }
|
||||
{ const a: typeof adone.assertion.assert = adone.assert; }
|
||||
{ const a: typeof adone.assertion.expect = adone.expect; }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2017",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"adone.d.ts",
|
||||
"glosses/common.d.ts",
|
||||
"glosses/math.d.ts",
|
||||
"glosses/std.d.ts",
|
||||
"glosses/utils.d.ts",
|
||||
"glosses/assertion.d.ts",
|
||||
"glosses/promise.d.ts",
|
||||
"glosses/shani.d.ts",
|
||||
"glosses/shani-global.d.ts",
|
||||
"adone-tests.ts",
|
||||
"test/index.ts",
|
||||
"test/index-import.ts",
|
||||
"test/glosses/common.ts",
|
||||
"test/glosses/math.ts",
|
||||
"test/glosses/std.ts",
|
||||
"test/glosses/utils.ts",
|
||||
"test/glosses/assertion.ts",
|
||||
"test/glosses/promise.ts",
|
||||
"test/glosses/shani.ts",
|
||||
"test/glosses/shani-global.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-namespace": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"no-single-declare-module": false,
|
||||
"unified-signatures": false,
|
||||
"space-before-function-paren": false
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
|
||||
checkGridOptions(<ag.grid.GridOptions>{});
|
||||
checkColDef(<ag.grid.ColDef>{});
|
||||
|
||||
function checkGridOptions(gridOptions: ag.grid.GridOptions): void {
|
||||
|
||||
gridOptions.virtualPaging = true;
|
||||
gridOptions.toolPanelSuppressPivot = true;
|
||||
gridOptions.toolPanelSuppressValues = true;
|
||||
gridOptions.rowsAlreadyGrouped = true;
|
||||
gridOptions.suppressRowClickSelection = true;
|
||||
gridOptions.suppressCellSelection = true;
|
||||
gridOptions.sortingOrder = ['asc','desc'];
|
||||
gridOptions.suppressMultiSort = true;
|
||||
gridOptions.suppressHorizontalScroll = true;
|
||||
gridOptions.unSortIcon = true;
|
||||
gridOptions.rowHeight = 0;
|
||||
gridOptions.rowBuffer = 0;
|
||||
gridOptions.enableColResize = true;
|
||||
gridOptions.enableCellExpressions = true;
|
||||
gridOptions.enableSorting = true;
|
||||
gridOptions.enableServerSideSorting = true;
|
||||
gridOptions.enableFilter = true;
|
||||
gridOptions.enableServerSideFilter = true;
|
||||
gridOptions.colWidth = 0;
|
||||
gridOptions.suppressMenuHide = true;
|
||||
gridOptions.singleClickEdit = true;
|
||||
gridOptions.debug = true;
|
||||
gridOptions.icons = {};
|
||||
gridOptions.angularCompileRows = true;
|
||||
gridOptions.angularCompileFilters = true;
|
||||
gridOptions.angularCompileHeaders = true;
|
||||
gridOptions.localeText = {};
|
||||
gridOptions.localeTextFunc = function() {}
|
||||
gridOptions.suppressScrollLag = true;
|
||||
gridOptions.groupSuppressAutoColumn = true;
|
||||
gridOptions.groupSelectsChildren = true;
|
||||
gridOptions.groupHidePivotColumns = true;
|
||||
gridOptions.groupIncludeFooter = true;
|
||||
gridOptions.groupUseEntireRow = true;
|
||||
gridOptions.groupSuppressRow = true;
|
||||
gridOptions.groupSuppressBlankHeader = true;
|
||||
gridOptions.forPrint = true;
|
||||
gridOptions.groupColumnDef = {};
|
||||
gridOptions.context = {};
|
||||
gridOptions.rowStyle = {color: 'red'};
|
||||
gridOptions.rowClass = 'green';
|
||||
gridOptions.groupDefaultExpanded = false;
|
||||
gridOptions.slaveGrids = [];
|
||||
gridOptions.rowSelection = 'single';
|
||||
gridOptions.rowDeselection = true;
|
||||
gridOptions.rowData = [];
|
||||
gridOptions.floatingTopRowData = [];
|
||||
gridOptions.floatingBottomRowData = [];
|
||||
gridOptions.showToolPanel = true;
|
||||
gridOptions.groupKeys = ['a','b']
|
||||
gridOptions.groupAggFields = ['a','b']
|
||||
gridOptions.columnDefs = [];
|
||||
gridOptions.datasource = {};
|
||||
gridOptions.pinnedColumnCount = 0;
|
||||
gridOptions.groupHeaders = true;
|
||||
gridOptions.headerHeight = 0;
|
||||
gridOptions.groupRowInnerRenderer = function(params) {};
|
||||
gridOptions.groupRowRenderer = {};
|
||||
gridOptions.isScrollLag = function() {return true;}
|
||||
gridOptions.isExternalFilterPresent = function() { return true; };
|
||||
gridOptions.doesExternalFilterPass = function(node: ag.grid.RowNode) { return false; };
|
||||
gridOptions.getRowStyle = function() {};
|
||||
gridOptions.getRowClass = function() {};
|
||||
gridOptions.headerCellRenderer = function() {};
|
||||
gridOptions.groupAggFunction = function(nodes: any[]) {};
|
||||
gridOptions.onReady = function(api: any) {};
|
||||
gridOptions.onModelUpdated = function() {};
|
||||
gridOptions.onCellClicked = function(params) {};
|
||||
gridOptions.onCellDoubleClicked = function(params) {};
|
||||
gridOptions.onCellContextMenu = function(params) {};
|
||||
gridOptions.onCellValueChanged = function(params) {};
|
||||
gridOptions.onCellFocused = function(params) {};
|
||||
gridOptions.onRowSelected = function(params) {};
|
||||
gridOptions.onSelectionChanged = function() {};
|
||||
gridOptions.onBeforeFilterChanged = function() {};
|
||||
gridOptions.onAfterFilterChanged = function() {};
|
||||
gridOptions.onFilterModified = function() {};
|
||||
gridOptions.onBeforeSortChanged = function() {};
|
||||
gridOptions.onAfterSortChanged = function() {};
|
||||
gridOptions.onVirtualRowRemoved = function(params) {};
|
||||
gridOptions.onRowClicked = function(params) {};
|
||||
gridOptions.api = null;
|
||||
gridOptions.columnApi = null;
|
||||
|
||||
}
|
||||
|
||||
function checkColDef(colDef: ag.grid.ColDef): void {
|
||||
|
||||
colDef.sort = 'test';
|
||||
colDef.sortedAt = 0;
|
||||
colDef.sortingOrder = ['asc','desc'];
|
||||
colDef.headerName = 'test';
|
||||
colDef.field = 'test';
|
||||
colDef.headerValueGetter = 'test';
|
||||
colDef.colId = 'test';
|
||||
colDef.hide = true;
|
||||
colDef.headerTooltip = 'test';
|
||||
colDef.valueGetter = 'test';
|
||||
colDef.headerCellRenderer = {};
|
||||
colDef.headerClass = 'test';
|
||||
colDef.width = 0;
|
||||
colDef.minWidth = 0;
|
||||
colDef.maxWidth = 0;
|
||||
colDef.cellClass = 'test';
|
||||
colDef.cellStyle = {color: 'test'};
|
||||
colDef.cellRenderer = function() {};
|
||||
colDef.floatingCellRenderer = function() {};
|
||||
colDef.aggFunc = 'test';
|
||||
colDef.comparator = function() {};
|
||||
colDef.checkboxSelection = true;
|
||||
colDef.suppressMenu = true;
|
||||
colDef.suppressSorting = true;
|
||||
colDef.unSortIcon = true;
|
||||
colDef.suppressSizeToFit = true;
|
||||
colDef.suppressResize = true;
|
||||
colDef.headerGroup = 'test';
|
||||
colDef.headerGroupShow = 'test';
|
||||
colDef.editable = true;
|
||||
colDef.newValueHandler = function() {};
|
||||
colDef.volatile = true;
|
||||
colDef.template = 'test';
|
||||
colDef.templateUrl = 'test';
|
||||
colDef.filter = 'test';
|
||||
colDef.filterParams = {};
|
||||
colDef.onCellValueChanged = function() {};
|
||||
colDef.onCellClicked = function() {};
|
||||
colDef.onCellDoubleClicked = function() {};
|
||||
colDef.onCellContextMenu = function() {};
|
||||
colDef.cellClassRules = {};
|
||||
}
|
||||
Vendored
-1991
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ag-grid-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import AggregateError = require('aggregate-error');
|
||||
|
||||
const err = new AggregateError([new Error('foo'), 'bar']);
|
||||
|
||||
for (const el of Array.from(err)) {
|
||||
let err: Error = el;
|
||||
}
|
||||
|
||||
throw err;
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for aggregate-error 1.0
|
||||
// Project: https://github.com/sindresorhus/aggregate-error#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = AggregateError;
|
||||
|
||||
declare class AggregateError extends Error implements Iterable<Error> {
|
||||
constructor(errors: Iterable<Error | string>);
|
||||
|
||||
[Symbol.iterator](): Iterator<Error>;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aggregate-error-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
const handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => {
|
||||
const handler = (event: Alexa.RequestBody<Alexa.Request>, context: Alexa.Context, callback: () => void) => {
|
||||
let alexa = Alexa.handler(event, context);
|
||||
alexa.resources = {};
|
||||
alexa.registerHandlers(handlers);
|
||||
alexa.execute();
|
||||
};
|
||||
|
||||
let handlers: Alexa.Handlers = {
|
||||
let handlers: Alexa.Handlers<Alexa.Request> = {
|
||||
'LaunchRequest': function() {
|
||||
this.emit('SayHello');
|
||||
},
|
||||
|
||||
Vendored
+30
-27
@@ -3,45 +3,47 @@
|
||||
// Definitions by: Pete Beegle <https://github.com/petebeegle>
|
||||
// Huw <https://github.com/hoo29>
|
||||
// pascalwhoop <https://github.com/pascalwhoop>
|
||||
// Ben <https://github.com/blforce>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void ): AlexaObject;
|
||||
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void ): AlexaObject<T>;
|
||||
export function CreateStateHandler(state: string, obj: any): any;
|
||||
export let StateString: string;
|
||||
|
||||
export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED";
|
||||
export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED";
|
||||
|
||||
export interface AlexaObject extends Handler {
|
||||
export interface AlexaObject<T> extends Handler<T> {
|
||||
_event: any;
|
||||
_context: any;
|
||||
_callback: any;
|
||||
state: any;
|
||||
appId: any;
|
||||
response: any;
|
||||
resources: any;
|
||||
dynamoDBTableName: any;
|
||||
saveBeforeResponse: boolean;
|
||||
registerHandlers: (...handlers: Handlers[]) => any;
|
||||
registerHandlers: (...handlers: Array<Handlers<T>>) => any;
|
||||
execute: () => void;
|
||||
}
|
||||
|
||||
export interface Handlers {
|
||||
[intent: string]: (this: Handler) => void;
|
||||
export interface Handlers<T> {
|
||||
[intent: string]: (this: Handler<T>) => void;
|
||||
}
|
||||
|
||||
export interface Handler {
|
||||
export interface Handler<T> {
|
||||
on: any;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
emitWithState: any;
|
||||
state: any;
|
||||
handler: any;
|
||||
event: RequestBody;
|
||||
event: RequestBody<T>;
|
||||
attributes: any;
|
||||
context: any;
|
||||
name: any;
|
||||
isOverriden: any;
|
||||
t: (token: string) => void;
|
||||
t: (token: string, ...args: any[]) => void;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
@@ -55,10 +57,10 @@ export interface Context {
|
||||
awsRequestId: string;
|
||||
}
|
||||
|
||||
export interface RequestBody {
|
||||
export interface RequestBody<T> {
|
||||
version: string;
|
||||
session: Session;
|
||||
request: LaunchRequest | IntentRequest | SessionEndedRequest;
|
||||
request: T;
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
@@ -75,36 +77,37 @@ export interface SessionApplication {
|
||||
|
||||
export interface SessionUser {
|
||||
userId: string;
|
||||
accessToken: string;
|
||||
accessToken?: string;
|
||||
}
|
||||
|
||||
export interface LaunchRequest extends Request { }
|
||||
|
||||
export interface IntentRequest extends Request {
|
||||
dialogState: DialogStates;
|
||||
intent: Intent;
|
||||
}
|
||||
|
||||
export interface SlotValue {
|
||||
confirmationStatus: ConfirmationStatuses;
|
||||
name: string;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export interface Intent {
|
||||
confirmationStatus: ConfirmationStatuses;
|
||||
name: string;
|
||||
slots: Record<string, SlotValue>;
|
||||
dialogState?: DialogStates;
|
||||
intent?: Intent;
|
||||
}
|
||||
|
||||
export interface SessionEndedRequest extends Request {
|
||||
reason: string;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface Request {
|
||||
type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
|
||||
requestId: string;
|
||||
timeStamp: string;
|
||||
timestamp: string;
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface SlotValue {
|
||||
confirmationStatus?: ConfirmationStatuses;
|
||||
name: string;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export interface Intent {
|
||||
confirmationStatus?: ConfirmationStatuses;
|
||||
name: string;
|
||||
slots: Record<string, SlotValue>;
|
||||
}
|
||||
|
||||
export interface ResponseBody {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"object-literal-key-quote": false,
|
||||
"no-empty-interface": false,
|
||||
"prefer-method-signature": false,
|
||||
"object-literal-key-quotes": false
|
||||
"object-literal-key-quotes": false,
|
||||
"no-any": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
|
||||
|
||||
let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
attributesToIndex: [""],
|
||||
attributesforFaceting: [""],
|
||||
attributesForFaceting: [""],
|
||||
unretrievableAttributes: [""],
|
||||
attributesToRetrieve: [""],
|
||||
ranking: [""],
|
||||
|
||||
Vendored
+1
-1
@@ -976,7 +976,7 @@ declare namespace algoliasearch {
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributesforfaceting
|
||||
*/
|
||||
attributesforFaceting?: string[];
|
||||
attributesForFaceting?: string[];
|
||||
/**
|
||||
* The list of attributes that cannot be retrieved at query time
|
||||
* default: null
|
||||
|
||||
@@ -16,13 +16,19 @@ amqp.connect('amqp://localhost')
|
||||
.then(connection => {
|
||||
return connection.createChannel()
|
||||
.tap(channel => channel.checkQueue('myQueue'))
|
||||
.then(channel => channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString())))
|
||||
.then(channel => {
|
||||
return channel.consume('myQueue', newMsg => {
|
||||
if (newMsg != null) {
|
||||
// test promise api properties
|
||||
if (newMsg.properties.contentType === 'application/json') {
|
||||
console.log('New Message: ' + newMsg.content.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.finally(() => connection.close());
|
||||
});
|
||||
|
||||
// test promise api properties
|
||||
let amqpMessage: amqp.Message;
|
||||
amqpMessage.properties.contentType = 'application/json';
|
||||
let amqpAssertExchangeOptions: amqp.Options.AssertExchange;
|
||||
let anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
|
||||
|
||||
@@ -49,7 +55,14 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
if (!err) {
|
||||
channel.assertQueue('myQueue', {}, (err, ok) => {
|
||||
if (!err) {
|
||||
channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString()));
|
||||
channel.consume('myQueue', newMsg => {
|
||||
if (newMsg != null) {
|
||||
// test callback api properties
|
||||
if (newMsg.properties.contentType === 'application/json') {
|
||||
console.log('New Message: ' + newMsg.content.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -57,8 +70,5 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
}
|
||||
});
|
||||
|
||||
// test callback api properties
|
||||
let amqpcbMessage: amqpcb.Message;
|
||||
amqpcbMessage.properties.contentType = 'application/json';
|
||||
let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
|
||||
let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
|
||||
|
||||
Vendored
+1
-1
@@ -31,7 +31,7 @@ export interface Channel extends events.EventEmitter {
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
|
||||
consume(queue: string, onMessage: (msg: Message | null) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
|
||||
|
||||
cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | false) => void): void;
|
||||
|
||||
Vendored
+1
-1
@@ -40,7 +40,7 @@ export interface Channel extends events.EventEmitter {
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise<Replies.Consume>;
|
||||
consume(queue: string, onMessage: (msg: Message | null) => any, options?: Options.Consume): Promise<Replies.Consume>;
|
||||
|
||||
cancel(consumerTag: string): Promise<Replies.Empty>;
|
||||
get(queue: string, options?: Options.Get): Promise<Message | false>;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +20,4 @@
|
||||
"callback_api.d.ts",
|
||||
"amqplib-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import * as angular from "angular";
|
||||
import {ClipboardService} from "angular-clipboard";
|
||||
import { ClipboardService } from "angular-clipboard";
|
||||
|
||||
interface TestScope extends ng.IScope {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
const app = angular.module('testModule', ['angular-clipboard']);
|
||||
app.controller('TestController', ($scope: ng.IScope, clipboard: ClipboardService) => {
|
||||
app.controller('TestController', ($scope: TestScope, clipboard: ClipboardService) => {
|
||||
$scope['testCopy'] = () => {
|
||||
if (clipboard.supported) {
|
||||
clipboard.copyText('hiiiiiii');
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import * as angular from 'angular';
|
||||
|
||||
|
||||
interface TestScope extends angular.IScope {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
angular
|
||||
.module('angular-locker-tests', ['angular-locker'])
|
||||
.config(['lockerProvider', function config(lockerProvider: angular.locker.ILockerProvider) {
|
||||
@@ -13,7 +18,7 @@ angular
|
||||
|
||||
lockerProvider.defaults(lockerSettings);
|
||||
}])
|
||||
.controller('LockerController', ['$scope', 'locker', function ($scope: angular.IScope, locker: angular.locker.ILockerService) {
|
||||
.controller('LockerController', ['$scope', 'locker', function ($scope: TestScope, locker: angular.locker.ILockerService) {
|
||||
locker.put('someKey', 'someVal');
|
||||
|
||||
// put an item into session storage
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
const myApp = angular.module('testModule', ['ngMaterial']);
|
||||
|
||||
interface TestScope extends ng.IScope {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
myApp.config((
|
||||
$mdThemingProvider: ng.material.IThemingProvider,
|
||||
$mdIconProvider: ng.material.IIconProvider,
|
||||
@@ -50,7 +54,7 @@ myApp.config((
|
||||
});
|
||||
});
|
||||
|
||||
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => {
|
||||
myApp.controller('BottomSheetController', ($scope: TestScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => {
|
||||
$scope['openBottomSheet'] = () => {
|
||||
$mdBottomSheet.show({
|
||||
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>',
|
||||
@@ -84,7 +88,7 @@ myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng
|
||||
$scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel');
|
||||
});
|
||||
|
||||
myApp.controller('ColorController', ($scope: ng.IScope, $mdColor: ng.material.IColorService) => {
|
||||
myApp.controller('ColorController', ($scope: TestScope, $mdColor: ng.material.IColorService) => {
|
||||
const colorExpression: ng.material.IColorExpression = { color: '#FFFFFF' };
|
||||
const element: Element = new Element();
|
||||
|
||||
@@ -99,7 +103,7 @@ myApp.controller('ColorController', ($scope: ng.IScope, $mdColor: ng.material.IC
|
||||
};
|
||||
});
|
||||
|
||||
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService, $q: ng.IQService) => {
|
||||
myApp.controller('DialogController', ($scope: TestScope, $mdDialog: ng.material.IDialogService, $q: ng.IQService) => {
|
||||
$scope['openDialog'] = () => {
|
||||
$mdDialog.show({
|
||||
template: '<md-dialog>Hello!</md-dialog>'
|
||||
@@ -201,7 +205,7 @@ class IconDirective implements ng.IDirective {
|
||||
}
|
||||
myApp.directive('icon-directive', ($mdIcon: ng.material.IIcon) => new IconDirective($mdIcon));
|
||||
|
||||
myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.IMedia) => {
|
||||
myApp.controller('MediaController', ($scope: TestScope, $mdMedia: ng.material.IMedia) => {
|
||||
$scope.$watch(() => $mdMedia('lg'), (big: boolean) => {
|
||||
$scope['bigScreen'] = big;
|
||||
});
|
||||
@@ -210,7 +214,7 @@ myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.IM
|
||||
$scope['anotherCustom'] = $mdMedia('max-width: 300px');
|
||||
});
|
||||
|
||||
myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.ISidenavService) => {
|
||||
myApp.controller('SidenavController', ($scope: TestScope, $mdSidenav: ng.material.ISidenavService) => {
|
||||
const componentId = 'left';
|
||||
$scope['toggle'] = () => $mdSidenav(componentId).toggle();
|
||||
$scope['open'] = () => $mdSidenav(componentId).open();
|
||||
@@ -229,7 +233,7 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
|
||||
$scope['onClose'] = $mdSidenav(componentId).onClose(() => { });
|
||||
});
|
||||
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService, $q: ng.IQService) => {
|
||||
myApp.controller('ToastController', ($scope: TestScope, $mdToast: ng.material.IToastService, $q: ng.IQService) => {
|
||||
$scope['openToast'] = () => {
|
||||
$mdToast.show($mdToast.simple().textContent('Hello!'));
|
||||
$mdToast.updateTextContent('New Content');
|
||||
@@ -260,7 +264,7 @@ myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IT
|
||||
};
|
||||
});
|
||||
|
||||
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService, $q: ng.IQService) => {
|
||||
myApp.controller('PanelController', ($scope: TestScope, $mdPanel: ng.material.IPanelService, $q: ng.IQService) => {
|
||||
$scope['createPanel'] = () => {
|
||||
const config: ng.material.IPanelConfig = {
|
||||
id: 'myPanel',
|
||||
|
||||
Vendored
+3
@@ -61,6 +61,9 @@ declare module 'angular' {
|
||||
controllerAs(controllerAs?: string): T;
|
||||
parent(parent?: string | Element | JQuery): T; // default: root node
|
||||
ariaLabel(ariaLabel: string): T;
|
||||
openFrom(from: string | Element | Event | { top: number, left: number }): T;
|
||||
closeTo(to: string | Element | { top: number, left: number }): T;
|
||||
multiple(multiple: boolean): T;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
|
||||
@@ -27,6 +27,8 @@ interface CustomScope extends angular.meteor.IScope {
|
||||
removeAll: () => void;
|
||||
removeAuto: (todo: ITodo) => void;
|
||||
toSticky: (todo: ITodo) => void;
|
||||
|
||||
picture: any;
|
||||
}
|
||||
|
||||
var Todos = new Mongo.Collection<ITodo>('todos');
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import * as angular from "angular";
|
||||
import "angular-pdfjs-viewer";
|
||||
|
||||
angular.module('app').config((pdfjsViewerConfigProvider: angular.pdfjsViewer.ConfigProvider) => {
|
||||
pdfjsViewerConfigProvider.setWorkerSrc("/assets/pdf.js-viewer/pdf.worker.js");
|
||||
pdfjsViewerConfigProvider.setCmapDir("/assets/pdf.js-viewer/cmaps");
|
||||
pdfjsViewerConfigProvider.setImageDir("/assets/pdf.js-viewer/images");
|
||||
|
||||
pdfjsViewerConfigProvider.disableWorker();
|
||||
pdfjsViewerConfigProvider.setVerbosity("infos"); // "errors", "warnings" or "infos"
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for angular-pdfjs-viewer 1.0
|
||||
// Project: https://github.com/legalthings/angular-pdfjs-viewer
|
||||
// Definitions by: Bastien Moulia <https://github.com/bastienmoulia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
namespace pdfjsViewer {
|
||||
interface ConfigProvider extends angular.IServiceProvider {
|
||||
setWorkerSrc(src: string): void;
|
||||
setCmapDir(dir: string): void;
|
||||
setImageDir(dir: string): void;
|
||||
disableWorker(): void;
|
||||
setVerbosity(verbosity: "errors" | "warnings" | "infos"): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-pdfjs-viewer-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,15 +1,75 @@
|
||||
// Examples of working with resource, previously from the angular.d.ts. readme
|
||||
// Working with $resource
|
||||
|
||||
// We have the option to define arguments for a custom resource
|
||||
interface IArticleParameters {
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface IArticleResource extends ng.resource.IResource<IArticleResource> {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
|
||||
// Although all actions defined on IArticleResourceClass are avaiable with
|
||||
// the '$' prefix, we have the choice to expose only what we will use
|
||||
$publish(): IArticleResource;
|
||||
$unpublish(): IArticleResource;
|
||||
}
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResource> {
|
||||
// Overload get to accept our custom parameters
|
||||
get(): IArticleResource;
|
||||
get(params: IArticleParameters, onSuccess: Function): IArticleResource;
|
||||
|
||||
// Add our custom resource actions
|
||||
publish(params?: IArticleParameters): IArticleResource;
|
||||
unpublish(params: IArticleParameters): IArticleResource;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService): void {
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
let publishDescriptor: ng.resource.IActionDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
let articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : {
|
||||
method: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
let article: IArticleResource = articleResource.get({id: 1}, function success(): void {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
});
|
||||
}
|
||||
|
||||
import IHttpPromiseCallbackArg = angular.IHttpPromiseCallbackArg;
|
||||
|
||||
interface IMyData {}
|
||||
interface IMyHttpPromiseCallbackArg extends IHttpPromiseCallbackArg<IMyData> {}
|
||||
interface IMyResource extends angular.resource.IResource<IMyResource> { }
|
||||
interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource> { }
|
||||
interface IMyResource extends angular.resource.IResource<IMyResource> {}
|
||||
interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource> {}
|
||||
|
||||
///////////////////////////////////////
|
||||
// IActionDescriptor
|
||||
///////////////////////////////////////
|
||||
var actionDescriptor: angular.resource.IActionDescriptor;
|
||||
let actionDescriptor: angular.resource.IActionDescriptor;
|
||||
|
||||
angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactoryService) {
|
||||
actionDescriptor.method = 'method action';
|
||||
@@ -27,19 +87,18 @@ angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactorySe
|
||||
actionDescriptor.withCredentials = true;
|
||||
actionDescriptor.responseType = 'response type';
|
||||
actionDescriptor.interceptor = {
|
||||
response: function<IMyData> () { return <IMyHttpPromiseCallbackArg>{}; },
|
||||
responseError: function () {}
|
||||
response() { return {} as IMyHttpPromiseCallbackArg; },
|
||||
responseError() {}
|
||||
};
|
||||
actionDescriptor.cancellable = true;
|
||||
});
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceClass
|
||||
///////////////////////////////////////
|
||||
var resourceClass: IMyResourceClass;
|
||||
var resource: IMyResource;
|
||||
var resourceArray: angular.resource.IResourceArray<IMyResource>;
|
||||
let resourceClass: IMyResourceClass;
|
||||
let resource: IMyResource;
|
||||
let resourceArray: angular.resource.IResourceArray<IMyResource>;
|
||||
|
||||
resource = resourceClass.delete();
|
||||
resource = resourceClass.delete({ key: 'value' });
|
||||
@@ -94,9 +153,9 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () {
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
|
||||
var promise : angular.IPromise<IMyResource>;
|
||||
var arrayPromise : angular.IPromise<IMyResource[]>;
|
||||
var json: IMyResource;
|
||||
let promise: angular.IPromise<IMyResource>;
|
||||
let arrayPromise: angular.IPromise<IMyResource[]>;
|
||||
let json: IMyResource;
|
||||
|
||||
promise = resource.$delete();
|
||||
promise = resource.$delete({ key: 'value' });
|
||||
@@ -140,7 +199,7 @@ json = resource.toJSON();
|
||||
///////////////////////////////////////
|
||||
// IResourceService
|
||||
///////////////////////////////////////
|
||||
var resourceService: angular.resource.IResourceService;
|
||||
let resourceService: angular.resource.IResourceService;
|
||||
resourceClass = resourceService<IMyResource, IMyResourceClass>('test');
|
||||
resourceClass = resourceService<IMyResource>('test');
|
||||
resourceClass = resourceService('test');
|
||||
@@ -148,22 +207,20 @@ resourceClass = resourceService('test');
|
||||
///////////////////////////////////////
|
||||
// IModule
|
||||
///////////////////////////////////////
|
||||
var mod: ng.IModule;
|
||||
var resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<IMyResource>;
|
||||
var resourceService: angular.resource.IResourceService;
|
||||
let mod: ng.IModule;
|
||||
let resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<IMyResource>;
|
||||
|
||||
resourceClass = resourceServiceFactoryFunction<IMyResourceClass>(resourceService);
|
||||
|
||||
resourceServiceFactoryFunction = function (resourceService: angular.resource.IResourceService) { return <any>resourceClass; };
|
||||
resourceServiceFactoryFunction = function (resourceService: angular.resource.IResourceService) { return resourceClass as any; };
|
||||
mod = mod.factory('factory name', resourceServiceFactoryFunction);
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceServiceProvider
|
||||
///////////////////////////////////////
|
||||
var resourceServiceProvider: angular.resource.IResourceServiceProvider;
|
||||
let resourceServiceProvider: angular.resource.IResourceServiceProvider;
|
||||
resourceServiceProvider.defaults.stripTrailingSlashes = false;
|
||||
|
||||
Vendored
+32
-22
@@ -37,23 +37,35 @@ declare module 'angular' {
|
||||
// that deeply.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IResourceService {
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T, U>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: IActionHash, options?: IResourceOptions): U;
|
||||
<T>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
|
||||
/**
|
||||
* A factory which creates a resource object that lets you interact with RESTful server-side data sources.
|
||||
* @param url A parameterized URL template with parameters prefixed by : as in /user/:username
|
||||
* @param paramDefaults Default values for url parameters.
|
||||
* @param actions example: {update: { method: 'PUT' }, delete: deleteDescriptor } where deleteDescriptor: IActionDescriptor
|
||||
* @param options Hash with custom settings that should extend the default $resourceProvider behavior
|
||||
*/
|
||||
(url: string, paramDefaults?: any, actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T>(url: string, paramDefaults?: any, actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
|
||||
<T, U>(url: string, paramDefaults?: any, actions?: IActionHash, options?: IResourceOptions): U;
|
||||
}
|
||||
|
||||
// Hash of action descriptors allows custom action names
|
||||
interface IActionHash {
|
||||
[action: string]: IActionDescriptor
|
||||
[action: string]: IActionDescriptor;
|
||||
}
|
||||
|
||||
interface IResourceResponse {
|
||||
config: any;
|
||||
data: any;
|
||||
headers: any;
|
||||
resource: any;
|
||||
status: number;
|
||||
statusText: string;
|
||||
}
|
||||
|
||||
interface IResourceInterceptor {
|
||||
response?(response: IResourceResponse): any;
|
||||
responseError?(rejection: any): any;
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
@@ -71,11 +83,11 @@ declare module 'angular' {
|
||||
* would be used for multiple requests. If you are looking for a way to cancel requests, you should
|
||||
* use the cancellable option.
|
||||
*/
|
||||
timeout?: number
|
||||
timeout?: number;
|
||||
cancellable?: boolean;
|
||||
withCredentials?: boolean;
|
||||
responseType?: string;
|
||||
interceptor?: angular.IHttpInterceptor;
|
||||
interceptor?: IResourceInterceptor;
|
||||
}
|
||||
|
||||
// Allow specify more resource methods
|
||||
@@ -116,7 +128,7 @@ declare module 'angular' {
|
||||
// Also, static calls always return the IResource (or IResourceArray) retrieved
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
interface IResourceClass<T> {
|
||||
new(dataOrParams? : any) : T & IResource<T>;
|
||||
new(dataOrParams?: any): T & IResource<T>;
|
||||
get: IResourceMethod<T>;
|
||||
|
||||
query: IResourceArrayMethod<T>;
|
||||
@@ -153,7 +165,7 @@ declare module 'angular' {
|
||||
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** the promise of the original server interaction that created this instance. **/
|
||||
/** The promise of the original server interaction that created this instance. */
|
||||
$promise: angular.IPromise<T>;
|
||||
$resolved: boolean;
|
||||
toJSON(): T;
|
||||
@@ -165,7 +177,7 @@ declare module 'angular' {
|
||||
interface IResourceArray<T> extends Array<T & IResource<T>> {
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<IResourceArray<T>>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
@@ -178,10 +190,8 @@ declare module 'angular' {
|
||||
|
||||
// IResourceServiceProvider used to configure global settings
|
||||
interface IResourceServiceProvider extends angular.IServiceProvider {
|
||||
|
||||
defaults: IResourceOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
@@ -199,8 +209,8 @@ declare module 'angular' {
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
$promise: angular.IPromise<Array<T>>;
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<T[]>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO: Fix up types to remove these
|
||||
"interface-name": false,
|
||||
"only-arrow-functions": false,
|
||||
"no-empty-interface": false,
|
||||
"ban-types": false,
|
||||
"space-before-function-paren": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Vendored
+5
@@ -45,9 +45,14 @@ declare namespace mgcrea.ngStrap {
|
||||
template?: string;
|
||||
templateUrl?: string;
|
||||
contentTemplate?: string;
|
||||
prefixClass?: string;
|
||||
prefixEvent?: string;
|
||||
id?: string;
|
||||
scope?: ng.IScope;
|
||||
onBeforeHide?: (modal: IModal) => void;
|
||||
onHide?: (modal: IModal) => void;
|
||||
onBeforeShow?: (modal: IModal) => void;
|
||||
onShow?: (modal: IModal) => void;
|
||||
}
|
||||
|
||||
interface IModalScope extends ng.IScope {
|
||||
|
||||
+2
-2
@@ -312,7 +312,7 @@ declare module 'angular' {
|
||||
openClass?: string;
|
||||
}
|
||||
|
||||
interface IModalProvider extends IServiceProvider {
|
||||
interface IModalProvider extends angular.IServiceProvider {
|
||||
/**
|
||||
* Default options all modals will use.
|
||||
*/
|
||||
@@ -876,7 +876,7 @@ declare module 'angular' {
|
||||
useContentExp?: boolean;
|
||||
}
|
||||
|
||||
interface ITooltipProvider extends IServiceProvider {
|
||||
interface ITooltipProvider extends angular.IServiceProvider {
|
||||
/**
|
||||
* Provide a set of defaults for certain tooltip and popover attributes.
|
||||
*/
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import * as angular from "angular";
|
||||
|
||||
angular.module("test", [
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('concrete', {
|
||||
// no abstract or default
|
||||
})
|
||||
.state('string', {
|
||||
abstract: true,
|
||||
default: 'concrete'
|
||||
})
|
||||
.state('func_str', {
|
||||
abstract: true,
|
||||
default: function($rootScope): string { return $rootScope.test; }
|
||||
})
|
||||
.state('func_promise', {
|
||||
abstract: true,
|
||||
default: function($q: ng.IQService): ng.IPromise<string> {
|
||||
return $q.when("concrete");
|
||||
}
|
||||
})
|
||||
.state('injection_str', {
|
||||
abstract: true,
|
||||
default: ["$rootScope", function($rootScope) {
|
||||
return $rootScope.test;
|
||||
}]
|
||||
})
|
||||
.state('injection_promise', {
|
||||
abstract: true,
|
||||
default: ["$q", function($q: ng.IQService) {
|
||||
return $q.when("concrete");
|
||||
}]
|
||||
})
|
||||
;
|
||||
});
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// Type definitions for angular-ui-router-default 0.5
|
||||
// Project: https://github.com/nonplus/angular-ui-router-default
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as aur from "angular-ui-router";
|
||||
|
||||
declare module "angular" {
|
||||
namespace ui {
|
||||
export type StateDefaultSpecifier = string
|
||||
| ((...args: any[]) => string)
|
||||
| ((...args: any[]) => ng.IPromise<string>)
|
||||
| (string | ((...args: any[]) => string))[]
|
||||
| (string | ((...args: any[]) => ng.IPromise<string>))[];
|
||||
interface IState {
|
||||
default?: StateDefaultSpecifier
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-ui-router-default-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
angular.module("test", [
|
||||
"ui.bootstrap",
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('contacts', {
|
||||
// no modal
|
||||
resolve: {
|
||||
a: function() {
|
||||
return "a";
|
||||
},
|
||||
b: function() {
|
||||
return ["a", "b"];
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('contacts.contact', {
|
||||
// boolean modal
|
||||
modal: true
|
||||
})
|
||||
.state('contacts.contact.edit', {
|
||||
// string[] modal
|
||||
modal: ["a", "b"]
|
||||
})
|
||||
;
|
||||
});
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
// Type definitions for angular-ui-uib-modal (ui.router module) 0.11
|
||||
// Project: https://github.com/nonplus/angular-ui-router-uib-modal
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as auir from "angular-ui-router";
|
||||
|
||||
declare module "angular" {
|
||||
namespace ui {
|
||||
interface IState {
|
||||
modal?: boolean | string[];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-ui-router-uib-modal-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -23,8 +23,12 @@ namespace application {
|
||||
|
||||
myApp.factory('DatasourceTest', factory);
|
||||
|
||||
interface TestScope extends ng.IScope {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
// demo/examples/adapter
|
||||
myApp.controller('mainController', ['$scope', 'DatasourceTest', function($scope: ng.IScope, datasource: DatasourceTest) {
|
||||
myApp.controller('mainController', ['$scope', 'DatasourceTest', function($scope: TestScope, datasource: DatasourceTest) {
|
||||
var firstListAdapter: ng.ui.IScrollAdapter, secondListAdapter: ng.ui.IScrollAdapter;
|
||||
$scope['datasource'] = datasource;
|
||||
|
||||
|
||||
+11
-140
@@ -2,27 +2,23 @@
|
||||
|
||||
## Referencing AngularJS definition files in your code
|
||||
|
||||
To do that, simply add `` at the top of your code.
|
||||
|
||||
That will make available to your code all interfaces AngularJS' main module **ng** implements, as well as the **AUTO** module.
|
||||
Read the [TypeScript handbook](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html) for details on consuming these type definitions.
|
||||
|
||||
If you are including other AngularJS' modules in your code, like **ngResource**, just like you needed to include the additional module implementation file in your code, _angular-resource.js_, you will also need to reference the definitions file related to that module. Your code would then have the following definitions files reference:
|
||||
|
||||
|
||||
|
||||
|
||||
Having these modules in separated files is actually good because they sometimes either augment or modify some of **ng**'s interfaces, and thus those differences should only be available to you when you really need them. Also, it forces you to explicit what you're going to be using.
|
||||
|
||||
|
||||
Having these modules in separated packages is actually good because they sometimes either augment or modify some of **ng**'s interfaces, and thus those differences should only be available to you when you really need them. Also, it forces you to explicit what you're going to be using.
|
||||
|
||||
The following extra definition files are available for referencing:
|
||||
|
||||
* angular-resource.d.ts (for the **ngResource** module)
|
||||
* angular-route.d.ts (for the **ngRoute** module)
|
||||
* angular-cookies.d.ts (for the **ngCookies** module)
|
||||
* angular-sanitize.d.ts (for the **ngSanitize** module)
|
||||
* angular-animate.d.ts (for the **ngAnimate** module)
|
||||
* angular-mocks.d.ts (for the **ngMock** and **ngMockE2E** modules)
|
||||
|
||||
(postfix with version number for specific verion, eg. angular-resource-1.0.d.ts)
|
||||
* angular-resource/index.d.ts (for the **ngResource** module)
|
||||
* angular-route/index.d.ts (for the **ngRoute** module)
|
||||
* angular-cookies/index.d.ts (for the **ngCookies** module)
|
||||
* angular-sanitize/index.d.ts (for the **ngSanitize** module)
|
||||
* angular-animate/index.d.ts (for the **ngAnimate** module)
|
||||
* angular-mocks/index.d.ts (for the **ngMock** and **ngMockE2E** modules)
|
||||
|
||||
## The Angular Static
|
||||
|
||||
@@ -31,7 +27,7 @@ The definitions declare the AngularJS static variable `angular` as ambient. That
|
||||
|
||||
## Definitions modularized
|
||||
|
||||
To avoid cluttering the list of suggestions as you type in your IDE, all interfaces reside in their respective module namespace:
|
||||
To avoid cluttering the list of suggestions as you type in your IDE, all interfaces reside in their respective module namespace after you include their respective definitions:
|
||||
|
||||
* `ng` for AngularJS' **ng** module
|
||||
* `ng.auto` for **AUTO**
|
||||
@@ -105,128 +101,3 @@ function Controller($scope: ICustomScope) {
|
||||
|
||||
## Examples
|
||||
|
||||
### Working with $resource
|
||||
```ts
|
||||
|
||||
|
||||
|
||||
// We have the option to define arguments for a custom resource
|
||||
interface IArticleParameters {
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface IArticleResource extends ng.resource.IResource<IArticleResource> {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
|
||||
// Although all actions defined on IArticleResourceClass are avaiable with
|
||||
// the '$' prefix, we have the choice to expose only what we will use
|
||||
$publish(): IArticleResource;
|
||||
$unpublish(): IArticleResource;
|
||||
}
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResource> {
|
||||
// Overload get to accept our custom parameters
|
||||
get(): ng.resource.IResource;
|
||||
get(params: IArticleParameters, onSuccess: Function): IArticleResource;
|
||||
|
||||
// Add our custom resource actions
|
||||
publish(): IArticleResource;
|
||||
publish(params: IArticleParameters): IArticleResource;
|
||||
unpublish(params: IArticleParameters): IArticleResource;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articleResource = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article: IArticleResource = articleResource.get({id: 1}, function success() {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Working with $resource in angular-1.0 definitions
|
||||
```ts
|
||||
|
||||
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass {
|
||||
publish: ng.resource.IActionCall;
|
||||
unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
interface IArticleResource extends ng.resource.IResource {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
$publish: ng.resource.IActionCall;
|
||||
$unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articles = <IArticleResourceClass> $resource('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articles.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article = <IArticleResource> articles.get({id: 1});
|
||||
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ declare namespace angular {
|
||||
* ### Example
|
||||
*
|
||||
* ```
|
||||
* import {Component} from 'angular2/core';
|
||||
* import { Component } from 'angular2/core';
|
||||
* import {bootstrap} from 'angular2/platform/browser';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router';
|
||||
*
|
||||
|
||||
Vendored
+23
-13
@@ -451,8 +451,6 @@ declare namespace angular {
|
||||
* see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
|
||||
*/
|
||||
interface IRootScopeService {
|
||||
[index: string]: any;
|
||||
|
||||
$apply(): any;
|
||||
$apply(exp: string): any;
|
||||
$apply(exp: (scope: IScope) => any): any;
|
||||
@@ -976,7 +974,7 @@ declare namespace angular {
|
||||
// DocumentService
|
||||
// see http://docs.angularjs.org/api/ng.$document
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IDocumentService extends JQuery {
|
||||
interface IDocumentService extends JQLite {
|
||||
// Must return intersection type for index signature compatibility with JQuery
|
||||
[index: number]: HTMLElement & Document;
|
||||
}
|
||||
@@ -993,7 +991,7 @@ declare namespace angular {
|
||||
// RootElementService
|
||||
// see http://docs.angularjs.org/api/ng.$rootElement
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRootElementService extends JQuery {}
|
||||
interface IRootElementService extends JQLite {}
|
||||
|
||||
interface IQResolveReject<T> {
|
||||
(): void;
|
||||
@@ -1037,6 +1035,12 @@ declare namespace angular {
|
||||
* Creates a Deferred object which represents a task which will finish in the future.
|
||||
*/
|
||||
defer<T>(): IDeferred<T>;
|
||||
/**
|
||||
* Returns a promise that resolves or rejects as soon as one of those promises resolves or rejects, with the value or reason from that promise.
|
||||
*
|
||||
* @param promises A list or hash of promises.
|
||||
*/
|
||||
race<T>(promises: Array<IPromise<T>> | {[key: string]: IPromise<T>}): IPromise<T>;
|
||||
/**
|
||||
* Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it.
|
||||
*
|
||||
@@ -1298,12 +1302,12 @@ declare namespace angular {
|
||||
|
||||
interface ICloneAttachFunction {
|
||||
// Let's hint but not force cloneAttachFn's signature
|
||||
(clonedElement?: JQuery, scope?: IScope): any;
|
||||
(clonedElement?: JQLite, scope?: IScope): any;
|
||||
}
|
||||
|
||||
// This corresponds to the "publicLinkFn" returned by $compile.
|
||||
interface ITemplateLinkingFunction {
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ITemplateLinkingFunctionOptions): JQuery;
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ITemplateLinkingFunctionOptions): JQLite;
|
||||
}
|
||||
|
||||
interface ITemplateLinkingFunctionOptions {
|
||||
@@ -1321,9 +1325,9 @@ declare namespace angular {
|
||||
*/
|
||||
interface ITranscludeFunction {
|
||||
// If the scope is provided, then the cloneAttachFn must be as well.
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite;
|
||||
// If one argument is provided, then it's assumed to be the cloneAttachFn.
|
||||
(cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
(cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite;
|
||||
|
||||
/**
|
||||
* Returns true if the specified slot contains content (i.e. one or more DOM nodes)
|
||||
@@ -1474,6 +1478,12 @@ declare namespace angular {
|
||||
* See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
|
||||
*/
|
||||
responseType?: string;
|
||||
|
||||
/**
|
||||
* Name of the parameter added (by AngularJS) to the request to specify the name (in the server response) of the JSON-P callback to invoke.
|
||||
* If unspecified, $http.defaults.jsonpCallbackParam will be used by default. This property is only applicable to JSON-P requests.
|
||||
*/
|
||||
jsonpCallbackParam?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1952,7 +1962,7 @@ declare namespace angular {
|
||||
interface IDirectiveLinkFn {
|
||||
(
|
||||
scope: IScope,
|
||||
instanceElement: JQuery,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: IAttributes,
|
||||
controller?: IController | IController[] | {[key: string]: IController},
|
||||
transclude?: ITranscludeFunction
|
||||
@@ -1966,7 +1976,7 @@ declare namespace angular {
|
||||
|
||||
interface IDirectiveCompileFn {
|
||||
(
|
||||
templateElement: JQuery,
|
||||
templateElement: JQLite,
|
||||
templateAttributes: IAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -1998,9 +2008,9 @@ declare namespace angular {
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
restrict?: string;
|
||||
scope?: boolean | {[boundProperty: string]: string};
|
||||
template?: string | ((tElement: JQuery, tAttrs: IAttributes) => string);
|
||||
template?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
templateNamespace?: string;
|
||||
templateUrl?: string | ((tElement: JQuery, tAttrs: IAttributes) => string);
|
||||
templateUrl?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
terminal?: boolean;
|
||||
transclude?: boolean | 'element' | {[slot: string]: string};
|
||||
}
|
||||
@@ -2013,7 +2023,7 @@ declare namespace angular {
|
||||
* See: http://docs.angularjs.org/api/angular.element
|
||||
*/
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {}
|
||||
interface IAugmentedJQuery extends JQuery {}
|
||||
interface IAugmentedJQuery extends JQLite {}
|
||||
|
||||
/**
|
||||
* Same as IController. Keeping it for compatibility with older versions of these type definitions.
|
||||
|
||||
Vendored
+77
-73
@@ -25,6 +25,10 @@
|
||||
|
||||
// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts
|
||||
|
||||
interface JQLite extends JQuery {
|
||||
[index: number]: HTMLElement;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Adds the specified class(es) to each of the set of matched elements.
|
||||
@@ -32,7 +36,7 @@ interface JQuery {
|
||||
* @param className One or more space-separated classes to be added to the class attribute of each matched element.
|
||||
* @see {@link https://api.jquery.com/addClass/#addClass-className}
|
||||
*/
|
||||
addClass(className: string): JQuery;
|
||||
addClass(className: string): this;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, after each element in the set of matched elements.
|
||||
@@ -41,14 +45,14 @@ interface JQuery {
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/after/#after-content-content}
|
||||
*/
|
||||
after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
|
||||
/**
|
||||
* Insert content, specified by the parameter, after each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/after/#after-function}
|
||||
*/
|
||||
after(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
after(func: (index: number, html: string) => string | Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
|
||||
@@ -57,14 +61,14 @@ interface JQuery {
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/append/#append-content-content}
|
||||
*/
|
||||
append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/append/#append-function}
|
||||
*/
|
||||
append(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
append(func: (index: number, html: string) => string | Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Get the value of an attribute for the first element in the set of matched elements.
|
||||
@@ -80,14 +84,14 @@ interface JQuery {
|
||||
* @param value A value to set for the attribute. If this is `null`, the attribute will be deleted.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributeName-value}
|
||||
*/
|
||||
attr(attributeName: string, value: string | number | null): JQuery;
|
||||
attr(attributeName: string, value: string | number | null): this;
|
||||
/**
|
||||
* Set one or more attributes for the set of matched elements.
|
||||
*
|
||||
* @param attributes An object of attribute-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributes}
|
||||
*/
|
||||
attr(attributes: Object): JQuery;
|
||||
attr(attributes: Object): this;
|
||||
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
@@ -96,7 +100,7 @@ interface JQuery {
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
|
||||
*/
|
||||
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
@@ -104,21 +108,21 @@ interface JQuery {
|
||||
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble}
|
||||
*/
|
||||
bind(eventType: string, preventBubble: boolean): JQuery;
|
||||
bind(eventType: string, preventBubble: boolean): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param events An object containing one or more DOM event types and functions to execute for them.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-events}
|
||||
*/
|
||||
bind(events: any): JQuery;
|
||||
bind(events: any): this;
|
||||
|
||||
/**
|
||||
* Get the children of each element in the set of matched elements, optionally filtered by a selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/children/}
|
||||
*/
|
||||
children(): JQuery;
|
||||
children(): this;
|
||||
|
||||
/**
|
||||
* Create a deep copy of the set of matched elements.
|
||||
@@ -127,13 +131,13 @@ interface JQuery {
|
||||
* @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).
|
||||
* @see {@link https://api.jquery.com/clone/}
|
||||
*/
|
||||
clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery;
|
||||
clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this;
|
||||
|
||||
/**
|
||||
* Get the children of each element in the set of matched elements, including text and comment nodes.
|
||||
* @see {@link https://api.jquery.com/contents/}
|
||||
*/
|
||||
contents(): JQuery;
|
||||
contents(): this;
|
||||
|
||||
/**
|
||||
* Get the value of style properties for the first element in the set of matched elements.
|
||||
@@ -157,7 +161,7 @@ interface JQuery {
|
||||
* @param value A value to set for the property.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName-value}
|
||||
*/
|
||||
css(propertyName: string, value: string | number): JQuery;
|
||||
css(propertyName: string, value: string | number): this;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
@@ -165,14 +169,14 @@ interface JQuery {
|
||||
* @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName-function}
|
||||
*/
|
||||
css(propertyName: string, value: (index: number, value: string) => string | number): JQuery;
|
||||
css(propertyName: string, value: (index: number, value: string) => string | number): this;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/css/#css-properties}
|
||||
*/
|
||||
css(properties: JQLiteCssProperties): JQuery;
|
||||
css(properties: JQLiteCssProperties): this;
|
||||
|
||||
/**
|
||||
* Store arbitrary data associated with the matched elements.
|
||||
@@ -181,7 +185,7 @@ interface JQuery {
|
||||
* @param value The new data value; it can be any JavaScript type including Array or Object.
|
||||
* @see {@link https://api.jquery.com/data/#data-key-value}
|
||||
*/
|
||||
data(key: string, value: any): JQuery;
|
||||
data(key: string, value: any): this;
|
||||
/**
|
||||
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
|
||||
*
|
||||
@@ -195,7 +199,7 @@ interface JQuery {
|
||||
* @param obj An object of key-value pairs of data to update.
|
||||
* @see {@link https://api.jquery.com/data/#data-obj}
|
||||
*/
|
||||
data(obj: { [key: string]: any; }): JQuery;
|
||||
data(obj: { [key: string]: any; }): this;
|
||||
/**
|
||||
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
|
||||
* @see {@link https://api.jquery.com/data/#data}
|
||||
@@ -208,13 +212,13 @@ interface JQuery {
|
||||
* @param selector A selector expression that filters the set of matched elements to be removed.
|
||||
* @see {@link https://api.jquery.com/detach/}
|
||||
*/
|
||||
detach(selector?: string): JQuery;
|
||||
detach(selector?: string): this;
|
||||
|
||||
/**
|
||||
* Remove all child nodes of the set of matched elements from the DOM.
|
||||
* @see {@link https://api.jquery.com/empty/}
|
||||
*/
|
||||
empty(): JQuery;
|
||||
empty(): this;
|
||||
|
||||
/**
|
||||
* Reduce the set of matched elements to the one at the specified index.
|
||||
@@ -222,7 +226,7 @@ interface JQuery {
|
||||
* @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set.
|
||||
* @see {@link https://api.jquery.com/eq/}
|
||||
*/
|
||||
eq(index: number): JQuery;
|
||||
eq(index: number): this;
|
||||
|
||||
/**
|
||||
* Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
|
||||
@@ -230,9 +234,9 @@ interface JQuery {
|
||||
* @param selector A string containing a selector expression to match elements against.
|
||||
* @see {@link https://api.jquery.com/find/#find-selector}
|
||||
*/
|
||||
find(selector: string): JQuery;
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
find(selector: string): this;
|
||||
find(element: any): this;
|
||||
find(obj: JQuery): this;
|
||||
|
||||
/**
|
||||
* Determine whether any of the matched elements are assigned the given class.
|
||||
@@ -253,21 +257,21 @@ interface JQuery {
|
||||
* @param htmlString A string of HTML to set as the content of each matched element.
|
||||
* @see {@link https://api.jquery.com/html/#html-htmlString}
|
||||
*/
|
||||
html(htmlString: string): JQuery;
|
||||
html(htmlString: string): this;
|
||||
/**
|
||||
* Set the HTML contents of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/html/#html-function}
|
||||
*/
|
||||
html(func: (index: number, oldhtml: string) => string): JQuery;
|
||||
html(func: (index: number, oldhtml: string) => string): this;
|
||||
|
||||
/**
|
||||
* Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/next/}
|
||||
*/
|
||||
next(): JQuery;
|
||||
next(): this;
|
||||
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
@@ -276,7 +280,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -285,7 +289,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -294,7 +298,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
|
||||
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -304,7 +308,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
|
||||
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -313,7 +317,7 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data}
|
||||
*/
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): JQuery;
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -321,13 +325,13 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data}
|
||||
*/
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): JQuery;
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): this;
|
||||
|
||||
/**
|
||||
* Remove an event handler.
|
||||
* @see {@link https://api.jquery.com/off/#off}
|
||||
*/
|
||||
off(): JQuery;
|
||||
off(): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -336,7 +340,7 @@ interface JQuery {
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -344,7 +348,7 @@ interface JQuery {
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on().
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -352,7 +356,7 @@ interface JQuery {
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
off(events: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -360,7 +364,7 @@ interface JQuery {
|
||||
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector}
|
||||
*/
|
||||
off(events: { [key: string]: any; }, selector?: string): JQuery;
|
||||
off(events: { [key: string]: any; }, selector?: string): this;
|
||||
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
@@ -369,7 +373,7 @@ interface JQuery {
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-data-handler}
|
||||
*/
|
||||
one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -378,7 +382,7 @@ interface JQuery {
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-data-handler}
|
||||
*/
|
||||
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -387,7 +391,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
|
||||
*/
|
||||
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -397,7 +401,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
|
||||
*/
|
||||
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -406,7 +410,7 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data}
|
||||
*/
|
||||
one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
|
||||
one(events: { [key: string]: any; }, selector?: string, data?: any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -414,14 +418,14 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data}
|
||||
*/
|
||||
one(events: { [key: string]: any; }, data?: any): JQuery;
|
||||
one(events: { [key: string]: any; }, data?: any): this;
|
||||
|
||||
/**
|
||||
* Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/parent/}
|
||||
*/
|
||||
parent(): JQuery;
|
||||
parent(): this;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
|
||||
@@ -430,14 +434,14 @@ interface JQuery {
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/prepend/#prepend-content-content}
|
||||
*/
|
||||
prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/prepend/#prepend-function}
|
||||
*/
|
||||
prepend(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
prepend(func: (index: number, html: string) => string | Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Get the value of a property for the first element in the set of matched elements.
|
||||
@@ -453,14 +457,14 @@ interface JQuery {
|
||||
* @param value A value to set for the property.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName-value}
|
||||
*/
|
||||
prop(propertyName: string, value: string | number | boolean): JQuery;
|
||||
prop(propertyName: string, value: string | number | boolean): this;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-properties}
|
||||
*/
|
||||
prop(properties: Object): JQuery;
|
||||
prop(properties: Object): this;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
@@ -468,7 +472,7 @@ interface JQuery {
|
||||
* @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName-function}
|
||||
*/
|
||||
prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery;
|
||||
prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): this;
|
||||
|
||||
/**
|
||||
* Specify a function to execute when the DOM is fully loaded.
|
||||
@@ -476,7 +480,7 @@ interface JQuery {
|
||||
* @param handler A function to execute after the DOM is ready.
|
||||
* @see {@link https://api.jquery.com/ready/}
|
||||
*/
|
||||
ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery;
|
||||
ready(handler: (jQueryAlias?: JQueryStatic) => any): this;
|
||||
|
||||
/**
|
||||
* Remove the set of matched elements from the DOM.
|
||||
@@ -484,7 +488,7 @@ interface JQuery {
|
||||
* @param selector A selector expression that filters the set of matched elements to be removed.
|
||||
* @see {@link https://api.jquery.com/remove/}
|
||||
*/
|
||||
remove(selector?: string): JQuery;
|
||||
remove(selector?: string): this;
|
||||
|
||||
/**
|
||||
* Remove an attribute from each element in the set of matched elements.
|
||||
@@ -492,7 +496,7 @@ interface JQuery {
|
||||
* @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
|
||||
* @see {@link https://api.jquery.com/removeAttr/}
|
||||
*/
|
||||
removeAttr(attributeName: string): JQuery;
|
||||
removeAttr(attributeName: string): this;
|
||||
|
||||
/**
|
||||
* Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
|
||||
@@ -500,7 +504,7 @@ interface JQuery {
|
||||
* @param className One or more space-separated classes to be removed from the class attribute of each matched element.
|
||||
* @see {@link https://api.jquery.com/removeClass/#removeClass-className}
|
||||
*/
|
||||
removeClass(className?: string): JQuery;
|
||||
removeClass(className?: string): this;
|
||||
|
||||
/**
|
||||
* Remove a previously-stored piece of data.
|
||||
@@ -508,19 +512,19 @@ interface JQuery {
|
||||
* @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
|
||||
* @see {@link https://api.jquery.com/removeData/#removeData-name}
|
||||
*/
|
||||
removeData(name: string): JQuery;
|
||||
removeData(name: string): this;
|
||||
/**
|
||||
* Remove a previously-stored piece of data.
|
||||
*
|
||||
* @param list An array of strings naming the pieces of data to delete.
|
||||
* @see {@link https://api.jquery.com/removeData/#removeData-list}
|
||||
*/
|
||||
removeData(list: string[]): JQuery;
|
||||
removeData(list: string[]): this;
|
||||
/**
|
||||
* Remove all previously-stored piece of data.
|
||||
* @see {@link https://api.jquery.com/removeData/}
|
||||
*/
|
||||
removeData(): JQuery;
|
||||
removeData(): this;
|
||||
|
||||
/**
|
||||
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
|
||||
@@ -528,14 +532,14 @@ interface JQuery {
|
||||
* @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object.
|
||||
* @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent}
|
||||
*/
|
||||
replaceWith(newContent: JQuery | any[] | Element | Text | string): JQuery;
|
||||
replaceWith(newContent: JQuery | any[] | Element | Text | string): this;
|
||||
/**
|
||||
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
|
||||
*
|
||||
* @param func A function that returns content with which to replace the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/replaceWith/#replaceWith-function}
|
||||
*/
|
||||
replaceWith(func: () => Element | JQuery): JQuery;
|
||||
replaceWith(func: () => Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Get the combined text contents of each element in the set of matched elements, including their descendants.
|
||||
@@ -548,14 +552,14 @@ interface JQuery {
|
||||
* @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation.
|
||||
* @see {@link https://api.jquery.com/text/#text-text}
|
||||
*/
|
||||
text(text: string | number | boolean): JQuery;
|
||||
text(text: string | number | boolean): this;
|
||||
/**
|
||||
* Set the content of each element in the set of matched elements to the specified text.
|
||||
*
|
||||
* @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.
|
||||
* @see {@link https://api.jquery.com/text/#text-function}
|
||||
*/
|
||||
text(func: (index: number, text: string) => string): JQuery;
|
||||
text(func: (index: number, text: string) => string): this;
|
||||
|
||||
/**
|
||||
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
|
||||
@@ -564,14 +568,14 @@ interface JQuery {
|
||||
* @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
|
||||
* @see {@link https://api.jquery.com/toggleClass/#toggleClass-className}
|
||||
*/
|
||||
toggleClass(className: string, swtch?: boolean): JQuery;
|
||||
toggleClass(className: string, swtch?: boolean): this;
|
||||
/**
|
||||
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
|
||||
*
|
||||
* @param swtch A boolean value to determine whether the class should be added or removed.
|
||||
* @see {@link https://api.jquery.com/toggleClass/#toggleClass-state}
|
||||
*/
|
||||
toggleClass(swtch?: boolean): JQuery;
|
||||
toggleClass(swtch?: boolean): this;
|
||||
|
||||
/**
|
||||
* Execute all handlers attached to an element for an event.
|
||||
@@ -597,7 +601,7 @@ interface JQuery {
|
||||
* @param handler The function that is to be no longer executed.
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler}
|
||||
*/
|
||||
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
@@ -605,14 +609,14 @@ interface JQuery {
|
||||
* @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-eventType-false}
|
||||
*/
|
||||
unbind(eventType: string, fls: boolean): JQuery;
|
||||
unbind(eventType: string, fls: boolean): this;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param evt A JavaScript event object as passed to an event handler.
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-event}
|
||||
*/
|
||||
unbind(evt: any): JQuery;
|
||||
unbind(evt: any): this;
|
||||
|
||||
/**
|
||||
* Get the current value of the first element in the set of matched elements.
|
||||
@@ -625,14 +629,14 @@ interface JQuery {
|
||||
* @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked.
|
||||
* @see {@link https://api.jquery.com/val/#val-value}
|
||||
*/
|
||||
val(value: string | string[] | number): JQuery;
|
||||
val(value: string | string[] | number): this;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
* @see {@link https://api.jquery.com/val/#val-function}
|
||||
*/
|
||||
val(func: (index: number, value: string) => string): JQuery;
|
||||
val(func: (index: number, value: string) => string): this;
|
||||
|
||||
/**
|
||||
* Wrap an HTML structure around each element in the set of matched elements.
|
||||
@@ -640,14 +644,14 @@ interface JQuery {
|
||||
* @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
|
||||
* @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement}
|
||||
*/
|
||||
wrap(wrappingElement: JQuery | Element | string): JQuery;
|
||||
wrap(wrappingElement: JQuery | Element | string): this;
|
||||
/**
|
||||
* Wrap an HTML structure around each element in the set of matched elements.
|
||||
*
|
||||
* @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/wrap/#wrap-function}
|
||||
*/
|
||||
wrap(func: (index: number) => string | JQuery): JQuery;
|
||||
wrap(func: (index: number) => string | JQuery): this;
|
||||
|
||||
// Undocumented
|
||||
length: number;
|
||||
@@ -661,13 +665,13 @@ interface JQuery {
|
||||
scope<T extends ng.IScope>(): T;
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key: string, value: any): this;
|
||||
inheritedData(obj: { [key: string]: any; }): this;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQuery;
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQLite;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import * as angular from 'angular';
|
||||
|
||||
function JQLite() {
|
||||
function indexSignature() {
|
||||
angular.element('p')[0]; // $ExpectType HTMLElement
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
import * as $ from 'jquery';
|
||||
import $ = require('jquery');
|
||||
import * as angular from 'angular';
|
||||
|
||||
function JQuery() {
|
||||
function indexSignature() {
|
||||
$('p')[0]; // $ExpectType HTMLElement
|
||||
}
|
||||
|
||||
function addClass() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').addClass('className');
|
||||
@@ -82,11 +86,14 @@ function JQuery() {
|
||||
alt: 'jQuery Logo'
|
||||
});
|
||||
|
||||
// $ExpectType string
|
||||
$('img').attr('src');
|
||||
// @types/angular's definition wins here
|
||||
// // $ExpectType string | undefined
|
||||
// $('img').attr('src');
|
||||
}
|
||||
|
||||
function bind() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -95,6 +102,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -103,16 +118,32 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -123,19 +154,35 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function children() {
|
||||
$('p').children();
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').children('span');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').children();
|
||||
}
|
||||
|
||||
function off() {
|
||||
function defaultContext_defaultData(this: HTMLElement, event: JQuery.Event<HTMLElement>) { }
|
||||
|
||||
function defaultContext_customData(this: HTMLElement, event: JQuery.Event<HTMLElement, string>) { }
|
||||
|
||||
function customContext_defaultData(this: I1, event: JQuery.Event<HTMLElement>) { }
|
||||
|
||||
function customContext_customData(this: I1, event: JQuery.Event<HTMLElement, string>) { }
|
||||
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
$('table').off('myEvent', 'td', defaultContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
@@ -144,12 +191,16 @@ function JQuery() {
|
||||
$('table').off('myEvent', 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
$('table').off('myEvent', defaultContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
@@ -159,24 +210,20 @@ function JQuery() {
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -187,6 +234,8 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function on() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -195,6 +244,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -203,6 +260,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -211,6 +276,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', false);
|
||||
|
||||
@@ -222,6 +295,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -230,66 +311,106 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function one() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -298,6 +419,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -306,6 +435,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -314,6 +451,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', false);
|
||||
|
||||
@@ -325,6 +470,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -333,62 +486,100 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"index.d.ts",
|
||||
"jqlite.d.ts",
|
||||
"angular-tests.ts",
|
||||
"test/jqlite-tests.ts",
|
||||
"test/jquery3-merging-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import anymatch = require('anymatch');
|
||||
|
||||
const matchers = [
|
||||
'path/to/file.js',
|
||||
'path/anyjs/**/*.js',
|
||||
/foo\.js$/,
|
||||
(str: string) => str.indexOf('bar') !== -1 && str.length > 10
|
||||
];
|
||||
|
||||
// $ExpectType boolean
|
||||
anymatch(matchers, 'path/to/file.js');
|
||||
// $ExpectType boolean
|
||||
anymatch(matchers, 'path/to/file.js', false);
|
||||
// $ExpectType boolean
|
||||
anymatch(matchers, 'path/to/file.js', false, 1);
|
||||
// $ExpectType boolean
|
||||
anymatch(matchers, 'path/to/file.js', false, 1, 2);
|
||||
|
||||
// $ExpectType number
|
||||
anymatch(matchers, 'foo.js', true);
|
||||
// $ExpectType number
|
||||
anymatch(matchers, 'path/anyjs/foo.js', true, 2);
|
||||
// $ExpectType number
|
||||
anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3);
|
||||
|
||||
const matcher = anymatch(matchers);
|
||||
// $ExpectType boolean
|
||||
matcher('path/to/file.js');
|
||||
// $ExpectType boolean
|
||||
matcher('path/to/file.js', false);
|
||||
// $ExpectType boolean
|
||||
matcher('path/to/file.js', false, 1);
|
||||
// $ExpectType boolean
|
||||
matcher('path/to/file.js', false, 1, 2);
|
||||
// $ExpectType number
|
||||
matcher('path/anyjs/baz.js', true);
|
||||
// $ExpectType number
|
||||
matcher('path/anyjs/baz.js', true, 2);
|
||||
// $ExpectType number
|
||||
matcher('path/anyjs/baz.js', true, 2, 3);
|
||||
|
||||
// tslint:disable-next-line no-unnecessary-callback-wrapper
|
||||
['foo.js', 'bar.js'].filter(str => matcher(str));
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for anymatch 1.3
|
||||
// Project: https://github.com/es128/anymatch
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = anymatch;
|
||||
|
||||
declare function anymatch(matcher: anymatch.Matcher): CurrriedMatcher;
|
||||
declare function anymatch(matcher: anymatch.Matcher, testString: string | string[], returnIndex: true, startIndex?: number, endIndex?: number): number;
|
||||
declare function anymatch(matcher: anymatch.Matcher, testString: string | string[], returnIndex?: boolean, startIndex?: number, endIndex?: number): boolean;
|
||||
|
||||
declare namespace anymatch {
|
||||
type Matcher = MatcherType | MatcherType[];
|
||||
type MatcherType = string | RegExp | ((...testStrings: string[]) => boolean);
|
||||
}
|
||||
|
||||
interface CurrriedMatcher {
|
||||
(testString: string | string[], returnIndex: true, startIndex?: number, endIndex?: number): number;
|
||||
(testString: string | string[], returnIndex?: boolean, startIndex?: number, endIndex?: number): boolean;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"anymatch-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
import apn = require("apn");
|
||||
|
||||
//Hand made TypeScript tests
|
||||
//==========================
|
||||
|
||||
//Create with a hex string
|
||||
var device1 = new apn.Device("ca11ab1e");
|
||||
//Create with a Buffer
|
||||
var device2 = new apn.Device(new Buffer("ca55e77e"));
|
||||
|
||||
//Create the notification
|
||||
var notification = new apn.Notification();
|
||||
notification.alert = {
|
||||
title: "The Title",
|
||||
body: "This is the body",
|
||||
};
|
||||
notification.badge = 5;
|
||||
//Fluid api
|
||||
notification.setAlertTitle("The Title")
|
||||
.setAlertText("This is the body")
|
||||
.setLaunchImage("LaunchImage");
|
||||
|
||||
//Establish the connection
|
||||
var connection = new apn.Connection({
|
||||
cert: "path/to/cert.pem",
|
||||
key: "path/to/cert.pem"
|
||||
});
|
||||
//Testing some specialized event listeners
|
||||
connection.on("error", (error) => {
|
||||
console.log("push error", error.name, error.message);
|
||||
});
|
||||
connection.on("transmissionError", (errorCode, notification, device) => {
|
||||
console.log("push failed", errorCode, "notification", notification.alert, "device id: ", device.toString());
|
||||
});
|
||||
|
||||
//Send it using hex string
|
||||
connection.pushNotification(notification, "ba5eba11");
|
||||
//Send it using Buffer
|
||||
connection.pushNotification(notification, new Buffer("5ca1ab1e"));
|
||||
//Send it using Device
|
||||
connection.pushNotification(notification, device1);
|
||||
|
||||
//Connecting to feedback service
|
||||
var feedbackService = new apn.Feedback({
|
||||
cert: "path/to/cert.pem",
|
||||
key: "path/to/cert.pem",
|
||||
interval: 0
|
||||
});
|
||||
feedbackService.on("error", (error:Error) => {
|
||||
console.log("push feedback error", error.name, error.message);
|
||||
});
|
||||
function processFeedbackData(device:apn.Device, time:number) {
|
||||
}
|
||||
feedbackService.on("feedback", (feedbackData) => {
|
||||
feedbackData.forEach((data) => {
|
||||
processFeedbackData(data.device, data.time);
|
||||
})
|
||||
});
|
||||
feedbackService.start();
|
||||
|
||||
|
||||
//Original examples from apn package
|
||||
//==================================
|
||||
|
||||
//sending-to-multiple-devices.js
|
||||
//------------------------------
|
||||
|
||||
var tokens = ["<insert token here>", "<insert token here>"];
|
||||
|
||||
if(tokens[0] === "<insert token here>") {
|
||||
console.log("Please set token to a valid device token for the push notification service");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
// Create a connection to the service using mostly default parameters.
|
||||
|
||||
var service = new apn.connection({ production: false });
|
||||
|
||||
service.on("connected", function() {
|
||||
console.log("Connected");
|
||||
});
|
||||
|
||||
service.on("transmitted", function(notification, device) {
|
||||
console.log("Notification transmitted to:" + device.token.toString("hex"));
|
||||
});
|
||||
|
||||
service.on("transmissionError", function(errCode, notification, device) {
|
||||
console.error("Notification caused error: " + errCode + " for device ", device, notification);
|
||||
if (errCode === 8) {
|
||||
console.log("A error code of 8 indicates that the device token is invalid. This could be for a number of reasons - are you using the correct environment? i.e. Production vs. Sandbox");
|
||||
}
|
||||
});
|
||||
|
||||
service.on("timeout", function () {
|
||||
console.log("Connection Timeout");
|
||||
});
|
||||
|
||||
service.on("disconnected", function() {
|
||||
console.log("Disconnected from APNS");
|
||||
});
|
||||
|
||||
service.on("socketError", console.error);
|
||||
|
||||
|
||||
// If you plan on sending identical paylods to many devices you can do something like this.
|
||||
function pushNotificationToMany() {
|
||||
console.log("Sending the same notification each of the devices with one call to pushNotification.");
|
||||
var note = new apn.notification();
|
||||
note.setAlertText("Hello, from node-apn!");
|
||||
note.badge = 1;
|
||||
|
||||
service.pushNotification(note, tokens);
|
||||
}
|
||||
|
||||
pushNotificationToMany();
|
||||
|
||||
|
||||
// If you have a list of devices for which you want to send a customised notification you can create one and send it to and individual device.
|
||||
function pushSomeNotifications() {
|
||||
console.log("Sending a tailored notification to %d devices", tokens.length);
|
||||
tokens.forEach(function(token, i) {
|
||||
var note = new apn.notification();
|
||||
note.setAlertText("Hello, from node-apn! You are number: " + i);
|
||||
note.badge = i;
|
||||
|
||||
service.pushNotification(note, token);
|
||||
});
|
||||
}
|
||||
|
||||
pushSomeNotifications();
|
||||
|
||||
//feedback.js
|
||||
//-----------
|
||||
|
||||
function handleFeedback(feedbackData:apn.FeedbackData[]) {
|
||||
feedbackData.forEach(function(feedbackItem) {
|
||||
console.log("Device: " + feedbackItem.device.toString() + " has been unreachable, since: " + feedbackItem.time);
|
||||
});
|
||||
}
|
||||
|
||||
// Setup a connection to the feedback service using a custom interval (10 seconds)
|
||||
var feedback = new apn.feedback({ production: false, interval: 10 });
|
||||
|
||||
feedback.on("feedback", handleFeedback);
|
||||
feedback.on("feedbackError", console.error);
|
||||
Vendored
-364
@@ -1,364 +0,0 @@
|
||||
// Type definitions for node-apn
|
||||
// Project: https://github.com/argon/node-apn
|
||||
// Definitions by: Zenorbi <https://github.com/zenorbi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference types="node"/>
|
||||
|
||||
import events = require("events");
|
||||
import net = require("net");
|
||||
export interface ConnectionOptions {
|
||||
/**
|
||||
* The filename of the connection certificate to load from disk, or a Buffer/String containing the certificate data. (Defaults to: `cert.pem`)
|
||||
*/
|
||||
cert?: string | Buffer;
|
||||
/**
|
||||
* The filename of the connection key to load from disk, or a Buffer/String containing the key data. (Defaults to: `key.pem`)
|
||||
*/
|
||||
key?: string | Buffer;
|
||||
/**
|
||||
* An array of trusted certificates. Each element should contain either a filename to load, or a Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs will be used. - You may need to use this as some environments don't include the CA used by Apple (entrust_2048).
|
||||
*/
|
||||
ca?: (string | Buffer)[];
|
||||
/**
|
||||
* File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data. If supplied will always be used instead of certificate and key above.
|
||||
*/
|
||||
pfx?: string | Buffer;
|
||||
/**
|
||||
* The passphrase for the connection key, if required
|
||||
*/
|
||||
passphrase?: string;
|
||||
/**
|
||||
* Specifies which environment to connect to: Production (if true) or Sandbox - The hostname will be set automatically. (Defaults to NODE_ENV == "production", i.e. false unless the NODE_ENV environment variable is set accordingly)
|
||||
*/
|
||||
production?: boolean;
|
||||
/**
|
||||
* Enable when you are using a VoIP certificate to enable paylods up to 4096 bytes.
|
||||
*/
|
||||
voip?: boolean;
|
||||
/**
|
||||
* Gateway port (Defaults to: `2195`)
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Reject Unauthorized property to be passed through to tls.connect() (Defaults to `true`)
|
||||
*/
|
||||
rejectUnauthorized?: boolean;
|
||||
/**
|
||||
* Number of notifications to cache for error purposes (See "Handling Errors" below, (Defaults to: `1000`)
|
||||
*/
|
||||
cacheLength?: number;
|
||||
/**
|
||||
* Whether the cache should grow in response to messages being lost after errors. (Will still emit a 'cacheTooSmall' event) (Defaults to: `true`)
|
||||
*/
|
||||
autoAdjustCache?: boolean;
|
||||
/**
|
||||
* The maximum number of connections to create for sending messages. (Defaults to: `1`)
|
||||
*/
|
||||
maxConnections?: number;
|
||||
/**
|
||||
* The duration of time the module should wait, in milliseconds, when trying to establish a connection to Apple before failing. 0 = Disabled. {Defaults to: `10000`}
|
||||
*/
|
||||
connectTimeout?: number;
|
||||
/**
|
||||
* The duration the socket should stay alive with no activity in milliseconds. 0 = Disabled. (Defaults to: `3600000` - 1h)
|
||||
*/
|
||||
connectionTimeout?: number;
|
||||
/**
|
||||
* The maximum number of connection failures that will be tolerated before `apn` will "terminate". (Defaults to: 10)
|
||||
*/
|
||||
connectionRetryLimit?: number;
|
||||
/**
|
||||
* Whether to buffer notifications and resend them after failure. (Defaults to: `true`)
|
||||
*/
|
||||
buffersNotifications?: number;
|
||||
/**
|
||||
* Whether to aggresively empty the notification buffer while connected - if set to true node-apn may enter a tight loop under heavy load while delivering notifications. (Defaults to: `false`)
|
||||
*/
|
||||
fastMode?: boolean;
|
||||
}
|
||||
export declare class Connection extends events.EventEmitter {
|
||||
constructor(options: ConnectionOptions);
|
||||
/**
|
||||
* This is the business end of the module. Create a `Notification` object and pass it in, along with a single recipient or an array of them and node-apn will take care of the rest, delivering the notification to each recipient.
|
||||
*
|
||||
* A "recipient" is either a `Device` object, a `String`, or a `Buffer` containing the device token. `Device` objects are used internally and will be created if necessary. Where applicable, all events will return a `Device` regardless of the type passed to this method.
|
||||
*/
|
||||
pushNotification(notification: Notification, recipient: Device | string | Buffer | (Device | string | Buffer)[]): void;
|
||||
/**
|
||||
* Used to manually adjust the "cacheLength" property in the options. This is ideal if you choose to use the `cacheTooSmall` event to tweak your environment. It is safe for increasing and reducing cache size.
|
||||
*/
|
||||
setCacheLength(newLength: number): void;
|
||||
/**
|
||||
* Indicate to node-apn that when the queue of pending notifications is fully drained that it should close all open connections. This will mean that if there are no other pending resources (open sockets, running timers, etc.) the application will terminate. If notifications are pushed after the connection has completely shutdown a new connection will be established and, if applicable, `shutdown` will need to be called again.
|
||||
*/
|
||||
shutdown(): void;
|
||||
/**
|
||||
* Emitted when an error occurs during initialisation of the module, usually due to a problem with the keys and certificates.
|
||||
*/
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
/**
|
||||
* Emitted when the connection socket experiences an error. This may be useful for debugging but no action should be necessary.
|
||||
*/
|
||||
on(event: "socketError", listener: (error: Error) => void): this;
|
||||
/**
|
||||
* Emitted when a notification has been sent to Apple - not a guarantee that it has been accepted by Apple, an error relating to it may occur later on. A notification may also be "transmitted" several times if a preceding notification caused an error requiring retransmission.
|
||||
*/
|
||||
on(event: "transmitted", listener: (notification: Notification, decive: Device) => void): this;
|
||||
/**
|
||||
* Emitted when all pending notifications have been transmitted to Apple and the pending queue is empty. This may be called more than once if a notification error occurs and notifications must be re-sent.
|
||||
*/
|
||||
on(event: "completed", listener: () => void): this;
|
||||
/**
|
||||
* Emitted when Apple returns a notification as invalid but the notification has already been expunged from the cache - usually due to high throughput and indicates that notifications will be getting lost. The parameter is an estimate of how many notifications have been lost. You should experiment with increasing the cache size or enabling ```autoAdjustCache``` if you see this frequently.
|
||||
*
|
||||
* **Note**: With ```autoAdjustCache``` enabled this event will still be emitted when an adjustment is triggered.
|
||||
*/
|
||||
on(event: "cacheTooSmall", listener: (sizeDifference: number) => void): this;
|
||||
/**
|
||||
* Emitted when a connection to Apple is successfully established. The parameter indicates the number of open connections. No action is required as the connection is managed internally.
|
||||
*/
|
||||
on(event: "connected", listener: (openSockets: net.Socket[]) => void): this;
|
||||
/**
|
||||
* Emitted when the connection to Apple has been closed, this could be for numerous reasons, for example an error has occurred or the connection has timed out. The parameter is the same as for `connected` and again, no action is required.
|
||||
*/
|
||||
on(event: "disconnected", listener: (openSockets: net.Socket[]) => void): this;
|
||||
/**
|
||||
* Emitted when the connectionTimeout option has been specified and no activity has occurred on a socket for a specified duration. The socket will be closed immediately after this event and a `disconnected` event will also be emitted.
|
||||
*/
|
||||
on(event: "timeout", listener: () => void): this;
|
||||
/**
|
||||
* Emitted when a message has been received from Apple stating that a notification was invalid or if an internal error occurred before that notification could be pushed to Apple. If the notification is still in the cache it will be passed as the second argument, otherwise null. Where possible the associated `Device` object will be passed as a third parameter, however in cases where the token supplied to the module cannot be parsed into a `Buffer` the supplied value will be returned.
|
||||
|
||||
* Error codes smaller than 512 correspond to those returned by Apple as per their [docs][errors]. Other errors are applicable to `node-apn` itself. Definitions can be found in `lib/errors.js`.
|
||||
*/
|
||||
on(event: "transmissionError", listener: (errorCode: number, notification: Notification, device: Device | Buffer) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
export interface NotificationAlertOptions {
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
body: string;
|
||||
"title-loc-key"?: string;
|
||||
"title-loc-args"?: string[];
|
||||
"action-loc-key"?: string;
|
||||
"loc-key"?: string;
|
||||
"loc-args"?: string[];
|
||||
"launch-image"?: string;
|
||||
}
|
||||
export declare class Notification {
|
||||
/**
|
||||
* The maximum number of retries which should be performed when sending a notification if an error occurs. A value of 0 will only allow one attempt at sending (0 retries). Set to -1 to disable (default).
|
||||
*/
|
||||
public retryLimit: number;
|
||||
/**
|
||||
* The UNIX timestamp representing when the notification should expire. This does not contribute to the 2048 byte payload size limit. An expiry of 0 indicates that the notification expires immediately.
|
||||
*/
|
||||
public expiry: number;
|
||||
/**
|
||||
* From Apple's Documentation, Provide one of the following values:
|
||||
*
|
||||
* - 10 - The push message is sent immediately. (Default)
|
||||
* > The push notification must trigger an alert, sound, or badge on the device. It is an error use this priority for a push that contains only the content-available key.
|
||||
* - 5 - The push message is sent at a time that conserves power on the device receiving it.
|
||||
*/
|
||||
public priority: number;
|
||||
/**
|
||||
* The encoding to use when transmitting the notification to APNS, defaults to `utf8`. `utf16le` is also possible but as each character is represented by a minimum of 2 bytes, will at least halve the possible payload size. If in doubt leave as default.
|
||||
*/
|
||||
public encoding: string;
|
||||
/**
|
||||
* This object represents the root JSON object that you can add custom information for your application to. The properties below will only be added to the payload (under `aps`) when the notification is prepared for sending.
|
||||
*/
|
||||
public payload: any;
|
||||
/**
|
||||
* The value to specify for `payload.aps.badge`
|
||||
*/
|
||||
public badge: number;
|
||||
/**
|
||||
* The value to specify for `payload.aps.sound`
|
||||
*/
|
||||
public sound: string;
|
||||
/**
|
||||
* The value to specify for `payload.aps.alert` can be either a `String` or an `Object` as outlined by the payload documentation.
|
||||
*/
|
||||
public alert: string | NotificationAlertOptions;
|
||||
/**
|
||||
* Setting this to true will specify "content-available" in the payload when it is compiled.
|
||||
*/
|
||||
public newsstandAvailable: boolean;
|
||||
/**
|
||||
* Setting this to true will specify "content-available" in the payload when it is compiled.
|
||||
*/
|
||||
public contentAvailable: boolean;
|
||||
/**
|
||||
* The value to specify for the `mdm` field where applicable.
|
||||
*/
|
||||
public mdm: string | Object;
|
||||
/**
|
||||
* The value to specify for `payload.aps['url-args']`. This used for Safari Push NOtifications and should be an array of values in accordance with the Web Payload Documentation.
|
||||
*/
|
||||
public urlArgs: string[];
|
||||
/**
|
||||
* When this parameter is set and `notification#trim()` is called it will attempt to truncate the string at the nearest space.
|
||||
*/
|
||||
public truncateAtWordEnd: boolean;
|
||||
/**
|
||||
* You can optionally pass in an object representing the payload, or configure properties on the returned object.
|
||||
*/
|
||||
constructor(payload?: any);
|
||||
/**
|
||||
* Set the `aps.alert` text body. This will use the most space-efficient means.
|
||||
*/
|
||||
setAlertText(alertText: string): Notification;
|
||||
/**
|
||||
* Set the `title` property of the `aps.alert` object - used with Safari Push Notifications
|
||||
*/
|
||||
setAlertTitle(alertTitle: string): Notification;
|
||||
/**
|
||||
* Set the `action` property of the `aps.alert` object - used with Safari Push Notifications
|
||||
*/
|
||||
setAlertAction(alertAction: string): Notification;
|
||||
/**
|
||||
* Set the `action-loc-key` property of the `aps.alert` object.
|
||||
*/
|
||||
setActionLocKey(key: string): Notification;
|
||||
/**
|
||||
* Set the `loc-key` property of the `aps.alert` object.
|
||||
*/
|
||||
setLocKey(key: string): Notification;
|
||||
/**
|
||||
* Set the `loc-args` property of the `aps.alert` object.
|
||||
*/
|
||||
setLocArgs(args: string[]): Notification;
|
||||
/**
|
||||
* Set the `launch-image` property of the `aps.alert` object.
|
||||
*/
|
||||
setLaunchImage(image: string): Notification;
|
||||
/**
|
||||
* Set the `mdm` property on the payload.
|
||||
*/
|
||||
setMDM(mdm: string | Object): Notification;
|
||||
/**
|
||||
* Set the `content-available` property of the `aps` object.
|
||||
*/
|
||||
setNewsstandAvailable(available: boolean): Notification;
|
||||
/**
|
||||
* Set the `content-available` property of the `aps` object.
|
||||
*/
|
||||
setContentAvailable(available: boolean): Notification;
|
||||
/**
|
||||
* Set the `url-args` property of the `aps` object.
|
||||
*/
|
||||
setUrlArgs(urlArgs: string[]): Notification;
|
||||
/**
|
||||
* Attempt to automatically trim the notification alert text body to meet the payload size limit of 2048 bytes.
|
||||
*/
|
||||
trim(): number;
|
||||
}
|
||||
export declare class Device {
|
||||
public token: Buffer;
|
||||
/**
|
||||
* `deviceToken` can be a `Buffer` or a `String` containing a "hex" representation of the token. Throws an error if the deviceToken supplied is invalid.
|
||||
*/
|
||||
constructor(deviceToken: string | Buffer);
|
||||
}
|
||||
|
||||
export interface FeedbackOptions {
|
||||
/**
|
||||
* The filename of the connection certificate to load from disk, or a Buffer/String containing the certificate data. (Defaults to: `cert.pem`)
|
||||
*/
|
||||
cert?: string | Buffer;
|
||||
/**
|
||||
* The filename of the connection key to load from disk, or a Buffer/String containing the key data. (Defaults to: `key.pem`)
|
||||
*/
|
||||
key?: string | Buffer;
|
||||
/**
|
||||
* An array of trusted certificates. Each element should contain either a filename to load, or a Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs will be used. - You may need to use this as some environments don't include the CA used by Apple (entrust_2048).
|
||||
*/
|
||||
ca?: (string | Buffer)[];
|
||||
/**
|
||||
* File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data. If supplied will be used instead of certificate and key above.
|
||||
*/
|
||||
pfx?: string | Buffer;
|
||||
/**
|
||||
* The passphrase for the connection key, if required
|
||||
*/
|
||||
passphrase?: string;
|
||||
/**
|
||||
* Specifies which environment to connect to: Production (if true) or Sandbox - The hostname will be set automatically. (Defaults to NODE_ENV == "production", i.e. false unless the NODE_ENV environment variable is set accordingly)
|
||||
*/
|
||||
production?: boolean;
|
||||
/**
|
||||
* Feedback server port (Defaults to: `2196`)
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Sets the behaviour for triggering the `feedback` event. When `true` the event will be triggered once per connection with an array of timestamp and device token tuples. Otherwise a `feedback` event will be emitted once per token received. (Defaults to: true)
|
||||
*/
|
||||
batchFeedback?: boolean;
|
||||
/**
|
||||
* The maximum number of tokens to pass when emitting the event - a value of 0 will cause all tokens to be passed after connection is reset. After this number of tokens are received the `feedback` event will be emitted. (Only applies when `batchFeedback` is enabled)
|
||||
*/
|
||||
batchSize?: number;
|
||||
/**
|
||||
* How often to automatically poll the feedback service. Set to `0` to disable. (Defaults to: `3600`)
|
||||
*/
|
||||
interval?: number;
|
||||
}
|
||||
export interface FeedbackData {
|
||||
time: number;
|
||||
device: Device;
|
||||
}
|
||||
/**
|
||||
* Connection to the Apple Push Notification Feedback Service and if `interval` isn't disabled automatically begins polling the service. Many of the options are the same as `apn.Connection()`
|
||||
*/
|
||||
export declare class Feedback {
|
||||
constructor(options: FeedbackOptions);
|
||||
/**
|
||||
* Trigger a query of the feedback service. If `interval` is non-zero then this method will be called automatically.
|
||||
*/
|
||||
start(): void;
|
||||
/**
|
||||
* You can cancel the interval by calling `feedback.cancel()`. If you do not wish to have the service automatically queried then set `interval` to 0 and use `feedback.start()` to manually invoke it one time.
|
||||
*/
|
||||
cancel(): void;
|
||||
/**
|
||||
* Emitted when an error occurs initialising the module. Usually caused by failing to load the certificates.
|
||||
*/
|
||||
on(event: "error", listener: (error: Error) => void): Feedback;
|
||||
/**
|
||||
* Emitted when an error occurs receiving or processing the feedback and in the case of a socket error occurring. These errors are usually informational and node-apn will automatically recover.
|
||||
*/
|
||||
on(event: "feedbackError", listener: (error: Error) => void): Feedback;
|
||||
/**
|
||||
* Emitted when data has been received from the feedback service, typically once per connection. `feedbackData` is an array of objects, each containing the `time` returned by the server (epoch time) and the `device` a `Buffer` containing the device token.
|
||||
*/
|
||||
on(event: "feedback", listener: (feedbackData: FeedbackData[]) => void): Feedback;
|
||||
on(event: string, listener: Function): Feedback;
|
||||
}
|
||||
|
||||
export declare enum Errors {
|
||||
"noErrorsEncountered" = 0,
|
||||
"processingError" = 1,
|
||||
"missingDeviceToken" = 2,
|
||||
"missingTopic" = 3,
|
||||
"missingPayload" = 4,
|
||||
"invalidTokenSize" = 5,
|
||||
"invalidTopicSize" = 6,
|
||||
"invalidPayloadSize" = 7,
|
||||
"invalidToken" = 8,
|
||||
"apnsShutdown" = 10,
|
||||
"none" = 255,
|
||||
"retryLimitExceeded" = 512,
|
||||
"moduleInitialisationFailed" = 513,
|
||||
"connectionRetryLimitExceeded" = 514, // When a connection is unable to be established. Usually because of a network / SSL error this will be emitted
|
||||
"connectionTerminated" = 515
|
||||
}
|
||||
|
||||
//Lowercase aliases
|
||||
export { Connection as connection };
|
||||
export { Device as device };
|
||||
export { Errors as error };
|
||||
export { Feedback as feedback };
|
||||
export { Notification as notification };
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"apn-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+3334
-1558
File diff suppressed because it is too large
Load Diff
Vendored
+103
-29
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ArcGIS API for JavaScript 3.20
|
||||
// Type definitions for ArcGIS API for JavaScript 3.21
|
||||
// Project: https://developers.arcgis.com/javascript/3/
|
||||
// Definitions by: Esri <https://github.com/Esri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -18,6 +18,7 @@ declare module "esri" {
|
||||
import BasemapLayer = require("esri/dijit/BasemapLayer");
|
||||
import Symbol = require("esri/symbols/Symbol");
|
||||
import BookmarkItem = require("esri/dijit/BookmarkItem");
|
||||
import TimeInfo = require("esri/layers/TimeInfo");
|
||||
import Color = require("esri/Color");
|
||||
import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase");
|
||||
import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol");
|
||||
@@ -213,6 +214,8 @@ declare module "esri" {
|
||||
isReference?: boolean;
|
||||
/** Initial opacity or transparency of the basemap layer. */
|
||||
opacity?: number;
|
||||
/** A url to a JSON file containing the stylesheet information to render the VectorTileLayer. */
|
||||
styleUrl?: string;
|
||||
/** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */
|
||||
subDomains?: string[];
|
||||
/** The URL template used to retrieve the tiles. */
|
||||
@@ -221,7 +224,7 @@ declare module "esri" {
|
||||
tileInfo?: TileInfo;
|
||||
/** Define additional tile server domains for the layer. */
|
||||
tileServer?: string[];
|
||||
/** The type of layer, valid values are "BingMapsAerial", "BingMapsHybrid", "BingMapsRoad", "OpenStreetMap", or "WebTiledLayer". */
|
||||
/** The type of layer. */
|
||||
type?: string;
|
||||
/** URL to the ArcGIS Server REST resource that represents a map or image service. */
|
||||
url?: string;
|
||||
@@ -293,6 +296,8 @@ declare module "esri" {
|
||||
outFields?: string[];
|
||||
/** Refresh interval of the layer in minutes. */
|
||||
refreshInterval?: number;
|
||||
/** Time information for the layer, such as start time field, end time field, track id field, layers time extent and the draw time interval. */
|
||||
timeInfo?: TimeInfo;
|
||||
/** Visibility of the layer. */
|
||||
visible?: boolean;
|
||||
}
|
||||
@@ -474,17 +479,17 @@ declare module "esri" {
|
||||
/** The selected color. */
|
||||
color: Color;
|
||||
/** The row size of the palette. */
|
||||
colorsPerRow: number;
|
||||
colorsPerRow?: number;
|
||||
/** The set of available color options. */
|
||||
palette: Color[];
|
||||
palette?: Color[];
|
||||
/** Array of recent colors to show in the recent colors row. */
|
||||
recentColors: Color[];
|
||||
recentColors?: Color[];
|
||||
/** Toggles color selection being required. */
|
||||
required: boolean;
|
||||
required?: boolean;
|
||||
/** Toggles the recent color row. */
|
||||
showRecentColors: boolean;
|
||||
showRecentColors?: boolean;
|
||||
/** Toggles the transparency slider. */
|
||||
showTransparencySlider: boolean;
|
||||
showTransparencySlider?: boolean;
|
||||
}
|
||||
export interface ConnectOriginsToDestinationsOptions {
|
||||
/** The URL to the GPServer used to execute an analysis job. */
|
||||
@@ -879,6 +884,8 @@ declare module "esri" {
|
||||
showSelectFolder?: boolean;
|
||||
}
|
||||
export interface FeatureLayerOptions {
|
||||
/** Indicates whether attribute features containing m-values can be edited. */
|
||||
allowUpdateWithoutMValues?: boolean;
|
||||
/** Enable or disable the auto generalization of features from a non-editable layer in on-demand mode. */
|
||||
autoGeneralize?: boolean;
|
||||
/** Class attribute to set for the layer's node. */
|
||||
@@ -1401,6 +1408,22 @@ declare module "esri" {
|
||||
force3DTransforms?: boolean;
|
||||
/** By default the map creates and uses an out-of-the-box esri/dijit/Popup. */
|
||||
infoWindow?: InfoWindowBase;
|
||||
/** Indicates whether to enable double-click on a map to recenter and zoom in a level by using SHIFT + Click. */
|
||||
isClickRecenter?: boolean;
|
||||
/** Indicates whether double-clicking on map zooms in on extent. */
|
||||
isDoubleClickZoom?: boolean;
|
||||
/** Indicates whether to enable navigation of the map using a keyboard's arrow keys. */
|
||||
isKeyboardNavigation?: boolean;
|
||||
/** Indicates whether all map navigation is enabled. */
|
||||
isMapNavigation?: boolean;
|
||||
/** Indicates whether panning is enabled within the map. */
|
||||
isPan?: boolean;
|
||||
/** Indicates whether pinch zoom navigation is enabled on touch-enabled devices. */
|
||||
isPinchZoom?: boolean;
|
||||
/** Indicates whether to enable a mouse drag to zoom into to a specific region on the map. */
|
||||
isRubberBandZoom?: boolean;
|
||||
/** (Added at version 3.21). */
|
||||
isScrollWheel?: boolean;
|
||||
/** If provided, the map is initialized with the specified levels of detail. */
|
||||
lods?: LOD[];
|
||||
/** Display the esri logo on the map. */
|
||||
@@ -1547,8 +1570,6 @@ declare module "esri" {
|
||||
popupWindowFeatures?: string;
|
||||
/** The ArcGIS for Portal URL. */
|
||||
portalUrl?: string;
|
||||
/** Indicates whether to display social logins such as Google/Facebook. */
|
||||
showSocialLogins?: boolean;
|
||||
}
|
||||
export interface ObliqueViewerOptions {
|
||||
/** Azimuth angle value for which to display oblique images. */
|
||||
@@ -1765,6 +1786,8 @@ declare module "esri" {
|
||||
export interface PrintOptions {
|
||||
/** Set to true if the print service is an asynchronous geoprocessing service. */
|
||||
async?: boolean;
|
||||
/** Additional parameters for the print service. */
|
||||
extraParameters?: any;
|
||||
/** The map to print. */
|
||||
map?: Map;
|
||||
/** An optional array of user-defined templates. */
|
||||
@@ -1891,8 +1914,6 @@ declare module "esri" {
|
||||
expanded?: boolean;
|
||||
/** This the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. */
|
||||
graphicsLayer?: Layer;
|
||||
/** The symbol used for highlightGraphic. */
|
||||
highlightSymbol?: Symbol;
|
||||
/** A customized infoTemplate for the selected feature. */
|
||||
infoTemplate?: InfoTemplate;
|
||||
/** The text symbol for the label graphic. */
|
||||
@@ -2528,7 +2549,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
findCredential(url: string, userId?: string): Credential;
|
||||
/**
|
||||
* Returns the OAuth configuration for the passed in Portal server URL.
|
||||
* @param url The URL to the Portal.
|
||||
* @param url The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/portal" for your in-house portal.
|
||||
*/
|
||||
findOAuthInfo(url: string): OAuthInfo;
|
||||
/**
|
||||
@@ -2553,7 +2574,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
* Call this method (during your application initialization) with JSON previously obtained from toJson method to re-hydrate the state of identity manager.
|
||||
* @param json The JSON obtained from the toJson method.
|
||||
*/
|
||||
initialize(json: Object): any;
|
||||
initialize(json: Object): void;
|
||||
/** Returns true if the identity manager is busy accepting user input, i.e., the user has invoked signIn and is waiting for a response. */
|
||||
isBusy(): boolean;
|
||||
/**
|
||||
@@ -2576,7 +2597,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
registerServers(serverInfos: ServerInfo[]): void;
|
||||
/**
|
||||
* Registers the given OAuth2 access token with the identity manager.
|
||||
* @param properties See the object specifications table below for the structure of the properties object.
|
||||
* @param properties See the object specifications table below for the structure of the properties object.
|
||||
*/
|
||||
registerToken(properties: any): void;
|
||||
/**
|
||||
@@ -2889,8 +2910,6 @@ declare module "esri/arcgis/OAuthInfo" {
|
||||
popupWindowFeatures: string;
|
||||
/** The ArcGIS for Portal URL. */
|
||||
portalUrl: string;
|
||||
/** Indicates whether to display social logins like Google/Facebook. */
|
||||
showSocialLogins: boolean;
|
||||
/**
|
||||
* Creates a new OAuthInfo given the specified parameters.
|
||||
* @param params Various options to configure the OAuthInfo object.
|
||||
@@ -2947,6 +2966,8 @@ declare module "esri/arcgis/Portal" {
|
||||
defaultBasemap: any;
|
||||
/** The default extent for the map the portal displays in the map viewer. */
|
||||
defaultExtent: any;
|
||||
/** The default vector basemap to use for the portal. */
|
||||
defaultVectorBasemap: any;
|
||||
/** A description of the organization / portal. */
|
||||
description: string;
|
||||
/** The featured groups for the portal. */
|
||||
@@ -2957,6 +2978,8 @@ declare module "esri/arcgis/Portal" {
|
||||
featuredItemsGroupQuery: string;
|
||||
/** The query that identifies the group containing features items for the gallery. */
|
||||
galleryTemplatesGroupQuery: string;
|
||||
/** Helper services provided by the portal. */
|
||||
helperServices: any;
|
||||
/** The group that contains featured content to be displayed on the home page. */
|
||||
homePageFeaturedContent: string;
|
||||
/** The number of featured items that can be displayed on the home page. */
|
||||
@@ -2991,7 +3014,7 @@ declare module "esri/arcgis/Portal" {
|
||||
portalProperties: any;
|
||||
/** The URL to the thumbnail of the portal. */
|
||||
portalThumbnail: string;
|
||||
/** URL to the portal. */
|
||||
/** The REST URL for the portal, for example "https://www.arcgis.com/sharing/rest/" for ArcGIS Online and "https://www.example.com/arcgis/sharing/rest/" for your in-house portal. */
|
||||
portalUrl: string;
|
||||
/** The region for the organization. */
|
||||
region: string;
|
||||
@@ -3013,7 +3036,7 @@ declare module "esri/arcgis/Portal" {
|
||||
thumbnailUrl: string;
|
||||
/** Sets the units of measure for the organization's users. */
|
||||
units: string;
|
||||
/** The portal url. */
|
||||
/** The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal. */
|
||||
url: string;
|
||||
/** The prefix selected by the organization's administrator to be used with the customBaseURL. */
|
||||
urlKey: string;
|
||||
@@ -3021,9 +3044,13 @@ declare module "esri/arcgis/Portal" {
|
||||
user: PortalUser;
|
||||
/** If true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. */
|
||||
useStandardizedQuery: boolean;
|
||||
/** Whether an organization has opted in to use the vector tile basemaps. */
|
||||
useVectorBasemaps: boolean;
|
||||
/** The query that defines the vector tiles basemaps that should be displayed in the Basemap Gallery when useVectorBasemaps is true. */
|
||||
vectorBasemapGalleryGroupQuery: string;
|
||||
/**
|
||||
* Creates a new Portal object.
|
||||
* @param url URL to the ArcGIS.com site or in-house portal.
|
||||
* @param url The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal.
|
||||
*/
|
||||
constructor(url: string);
|
||||
/** Returns a PortalUser object that describes the user currently signed in to the portal. */
|
||||
@@ -3111,6 +3138,11 @@ declare module "esri/arcgis/Portal" {
|
||||
url: string;
|
||||
/** Get the current members for the group. */
|
||||
getMembers(): any;
|
||||
/**
|
||||
* Get the URL to the thumbnail image for the portal group.
|
||||
* @param width The desired image width.
|
||||
*/
|
||||
getThumbnailUrl(width?: number): string;
|
||||
/**
|
||||
* Execute a query against the group to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query.
|
||||
* @param queryParams The input query parameters.
|
||||
@@ -3196,6 +3228,11 @@ declare module "esri/arcgis/Portal" {
|
||||
getComments(): any;
|
||||
/** Returns the rating (if any) given to the item. */
|
||||
getRating(): any;
|
||||
/**
|
||||
* Get the URL to the thumbnail image for the portal item.
|
||||
* @param width The desired image width.
|
||||
*/
|
||||
getThumbnailUrl(width?: number): string;
|
||||
/**
|
||||
* Updates an item comment.
|
||||
* @param comment A PortalComment that contains the comment updates.
|
||||
@@ -3274,6 +3311,11 @@ declare module "esri/arcgis/Portal" {
|
||||
getNotifications(): any;
|
||||
/** Access the tag objects that have been created by the portal user. */
|
||||
getTags(): any;
|
||||
/**
|
||||
* Get the URL to the thumbnail image for the portal user.
|
||||
* @param width The desired image width.
|
||||
*/
|
||||
getThumbnailUrl(width?: number): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3440,7 +3482,7 @@ declare module "esri/dijit/BasemapGallery" {
|
||||
import esri = require("esri");
|
||||
import Basemap = require("esri/dijit/Basemap");
|
||||
|
||||
/** The BasemapGallery dijit displays a collection basemaps from ArcGIS.com or a user-defined set of map or image services. */
|
||||
/** The BasemapGallery dijit displays a collection of basemaps from ArcGIS.com or a user-defined set of map or image services. */
|
||||
class BasemapGallery {
|
||||
/** List of basemaps displayed in the BasemapGallery. */
|
||||
basemaps: Basemap[];
|
||||
@@ -3508,6 +3550,8 @@ declare module "esri/dijit/BasemapLayer" {
|
||||
fullExtent: Extent;
|
||||
/** The initial extent of the layer. */
|
||||
initialExtent: Extent;
|
||||
/** A url to a JSON file containing the stylesheet information to render the VectorTileLayer. */
|
||||
styleUrl: string;
|
||||
/** The subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */
|
||||
subDomains: string[];
|
||||
/** The tile info for the layer including lods, rows, cols, origin and spatial reference. */
|
||||
@@ -5288,6 +5332,8 @@ declare module "esri/dijit/PopupTemplate" {
|
||||
|
||||
/** The PopupTemplate class extends esri/InfoTemplate and provides support for defining a layout. */
|
||||
class PopupTemplate extends InfoTemplate {
|
||||
/** An array of objects that reference Arcade expressions. */
|
||||
expressionInfos: any[];
|
||||
/** The popup definition defined as a JavaScript object. */
|
||||
info: any;
|
||||
/**
|
||||
@@ -5640,6 +5686,9 @@ declare module "esri/dijit/SymbolStyler" {
|
||||
startup(): void;
|
||||
/** Saves the recent fill and outline colors. */
|
||||
storeColors(): void;
|
||||
/** Fired every time an edit is committed. */
|
||||
on(type: "style-update", listener: (event: { target: SymbolStyler }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
export = SymbolStyler;
|
||||
}
|
||||
@@ -5865,7 +5914,7 @@ declare module "esri/dijit/analysis/AnalysisBase" {
|
||||
checkJobStatus(jobId: string): void;
|
||||
/**
|
||||
* Starts an analysis tool.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
*/
|
||||
execute(params: string): void;
|
||||
/**
|
||||
@@ -8633,6 +8682,8 @@ declare module "esri/graphic" {
|
||||
getShape(): any;
|
||||
/** Returns one or more dojox/gfx/shape.Shape used to draw the graphic. */
|
||||
getShapes(): any[];
|
||||
/** In contrast to the getLayer method, getSouceLayer does not change when a graphic is added to another layer. */
|
||||
getSourceLayer(): Layer;
|
||||
/** Returns the title string based on attributes and infoTemplate values. */
|
||||
getTitle(): string;
|
||||
/** Hides the graphic. */
|
||||
@@ -9471,6 +9522,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
advancedQueryCapabilities: any;
|
||||
/** Returns true if the geometry of the features in the layer can be edited, false otherwise. */
|
||||
allowGeometryUpdates: boolean;
|
||||
/** Indicates whether attribute features containing m-values can be edited. */
|
||||
allowUpdateWithoutMValues: boolean;
|
||||
/** The URL, when available, where the layer's attribution data is stored. */
|
||||
attributionDataUrl: string;
|
||||
/** Information about the capabilities enabled for this layer. */
|
||||
@@ -10279,6 +10332,8 @@ declare module "esri/layers/KMLLayer" {
|
||||
getFeature(featureInfo: any): any;
|
||||
/** Get an array of map layers that were created to draw placemarks, ground and screen overlays. */
|
||||
getLayers(): Layer[];
|
||||
/** Refreshes the features in the KML Layer. */
|
||||
refresh(): void;
|
||||
/**
|
||||
* Set the visibility for the specified folder.
|
||||
* @param folder A KML folder.
|
||||
@@ -11034,6 +11089,8 @@ declare module "esri/layers/VectorTileLayer" {
|
||||
fullExtent: Extent;
|
||||
/** The initial extent of the layer. */
|
||||
initialExtent: Extent;
|
||||
/** Name of the vector tile layer. */
|
||||
name: string;
|
||||
/** The spatial reference of the layer. */
|
||||
spatialReference: SpatialReference;
|
||||
/** Contains information about the tiling scheme for the layer. */
|
||||
@@ -11055,6 +11112,10 @@ declare module "esri/layers/VectorTileLayer" {
|
||||
setStyle(styleUrl: string | any): void;
|
||||
/** Fires when the style is changed on the layer. */
|
||||
on(type: "style-change", listener: (event: { style: any; target: VectorTileLayer }) => void): esri.Handle;
|
||||
/** Fires when the layer has finished updating its content. */
|
||||
on(type: "update-end", listener: (event: { target: VectorTileLayer }) => void): esri.Handle;
|
||||
/** Fires when the layer begins to update its content. */
|
||||
on(type: "update-start", listener: (event: { target: VectorTileLayer }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
export = VectorTileLayer;
|
||||
@@ -11773,12 +11834,18 @@ declare module "esri/map" {
|
||||
isDoubleClickZoom: boolean;
|
||||
/** When true, keyboard navigation is enabled. */
|
||||
isKeyboardNavigation: boolean;
|
||||
/** Indicates whether all map navigation is enabled. */
|
||||
isMapNavigation: boolean;
|
||||
/** When true, map panning is enabled using the mouse. */
|
||||
isPan: boolean;
|
||||
/** When true, pan arrows are displayed around the edge of the map. */
|
||||
isPanArrows: boolean;
|
||||
/** Indicates whether pinch zoom navigation is enabled on touch-enabled devices. */
|
||||
isPinchZoom: boolean;
|
||||
/** When true, rubberband zoom is enabled. */
|
||||
isRubberBandZoom: boolean;
|
||||
/** It indicates whether map navigation based on mouse scroll wheel is enabled. */
|
||||
isScrollWheel: boolean;
|
||||
/** When true, the mouse scroll wheel zoom is enabled. */
|
||||
isScrollWheelZoom: boolean;
|
||||
/** When true, shift double click zoom is enabled. */
|
||||
@@ -11853,8 +11920,11 @@ declare module "esri/map" {
|
||||
disableMapNavigation(): void;
|
||||
/** Disallows panning a map using the mouse. */
|
||||
disablePan(): void;
|
||||
disablePinchZoom(): void;
|
||||
/** Disallows zooming in or out on a map using a bounding box. */
|
||||
disableRubberBandZoom(): void;
|
||||
/** Disables navigation of the map based on mouse scroll wheel. */
|
||||
disableScrollWheel(): void;
|
||||
/** Disallows zooming in or out on a map using the mouse scroll wheel. */
|
||||
disableScrollWheelZoom(): void;
|
||||
/** Disallows shift double clicking on a map to zoom in a level and center the map. */
|
||||
@@ -11871,8 +11941,12 @@ declare module "esri/map" {
|
||||
enableMapNavigation(): void;
|
||||
/** Permits users to pan a map using the mouse. */
|
||||
enablePan(): void;
|
||||
/** Enables the user to work with pinch zoom navigation for touch-enabled devices. */
|
||||
enablePinchZoom(): void;
|
||||
/** Permits users to zoom in or out on a map using a bounding box. */
|
||||
enableRubberBandZoom(): void;
|
||||
/** Enables the user to navigate the map based on mouse scroll wheel. */
|
||||
enableScrollWheel(): void;
|
||||
/** Permits users to zoom in or out on a map using the mouse scroll wheel. */
|
||||
enableScrollWheelZoom(): void;
|
||||
/** Permits users to shift double click on a map to zoom in a level and center the map. */
|
||||
@@ -12947,7 +13021,7 @@ declare module "esri/renderers/HeatmapRenderer" {
|
||||
import esri = require("esri");
|
||||
import Renderer = require("esri/renderers/Renderer");
|
||||
|
||||
/** The HeatmapRenderer renders point data into a raster visualization that emphasizes areas of higher density or weighted values. */
|
||||
/** The HeatmapRenderer renders feature layer point data into a raster visualization that emphasizes areas of higher density or weighted values. */
|
||||
class HeatmapRenderer extends Renderer {
|
||||
/** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */
|
||||
blurRadius: number;
|
||||
@@ -13052,7 +13126,7 @@ declare module "esri/renderers/Renderer" {
|
||||
* Returns the visual variable of the specified type.
|
||||
* @param type The type of visual variable desired.
|
||||
*/
|
||||
getVisualVariablesForType(type: string): any;
|
||||
getVisualVariablesForType(type: string): any[];
|
||||
/** Indicates if the renderer has defined visualVariables. */
|
||||
hasVisualVariables(): boolean;
|
||||
/**
|
||||
@@ -14873,7 +14947,7 @@ declare module "esri/tasks/GeometryService" {
|
||||
distance(params: DistanceParameters, callback?: Function, errback?: Function): any;
|
||||
/**
|
||||
* Converts an array of well-known strings into xy-coordinates based on the conversion type and spatial reference supplied by the user.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback An error object is returned if an error occurs during task execution.
|
||||
*/
|
||||
@@ -14945,7 +15019,7 @@ declare module "esri/tasks/GeometryService" {
|
||||
simplify(geometries: Geometry[], callback?: Function, errback?: Function): any;
|
||||
/**
|
||||
* Converts an array of xy-coordinates into well-known strings based on the conversion type and spatial reference supplied by the user.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback An error object is returned if an error occurs during task execution.
|
||||
*/
|
||||
@@ -15890,7 +15964,7 @@ declare module "esri/tasks/RouteParameters" {
|
||||
startTimeIsUTC: boolean;
|
||||
/** The set of stops loaded as network locations during analysis. */
|
||||
stops: any;
|
||||
/** If true , the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). */
|
||||
/** If true, the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). */
|
||||
timeWindowsAreUTC: boolean;
|
||||
/** Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. */
|
||||
travelMode: any;
|
||||
@@ -17172,7 +17246,7 @@ declare module "esri/tasks/locator" {
|
||||
*/
|
||||
constructor(url: string);
|
||||
/**
|
||||
* Find address candidates for the input addresses.
|
||||
* Find address candidates for multiple input addresses.
|
||||
* @param params The input addresses in the format supported by the geocoding service.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback The function to call if an error occurs on the server during task execution.
|
||||
@@ -17180,7 +17254,7 @@ declare module "esri/tasks/locator" {
|
||||
addressesToLocations(params: any, callback: Function, errback: Function): any;
|
||||
/**
|
||||
* Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter.
|
||||
* @param params Specify the address and optionally specify the outFields and searchExtent.
|
||||
* @param params Specify at least the address and optionally other properties.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback An error object is returned if an error occurs on the Server during task execution.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
import * as Archiver from 'archiver';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const options: Archiver.ArchiverOptions = {
|
||||
statConcurrency: 1,
|
||||
allowHalfOpen: true,
|
||||
readableObjectMode: true,
|
||||
writeableObjectMode: true,
|
||||
decodeStrings: true,
|
||||
encoding: 'test',
|
||||
highWaterMark: 1,
|
||||
objectmode: true,
|
||||
comment: 'test',
|
||||
forceLocalTime: true,
|
||||
forceZip64: true,
|
||||
store: true,
|
||||
zlib: {},
|
||||
gzip: true,
|
||||
gzipOptions: {},
|
||||
};
|
||||
|
||||
Archiver('zip', options);
|
||||
|
||||
const archiver = Archiver.create('zip');
|
||||
|
||||
const writeStream = fs.createWriteStream('./archiver.d.ts');
|
||||
@@ -14,8 +34,6 @@ archiver.append(readStream, { name: 'archiver.d.ts' });
|
||||
archiver.append(readStream, {name: 'archiver.d.ts'})
|
||||
.append(readStream, {name: 'archiver.d.ts'});
|
||||
|
||||
archiver.bulk({ mappaing: {} });
|
||||
|
||||
archiver.directory('./path', './someOtherPath');
|
||||
archiver.directory('./path', { name: "testName" });
|
||||
archiver.directory('./', "", {});
|
||||
@@ -38,4 +56,6 @@ archiver.setModule(() => {});
|
||||
archiver.pointer();
|
||||
archiver.use(() => {});
|
||||
|
||||
archiver.finalize();
|
||||
archiver.finalize().then();
|
||||
|
||||
archiver.symlink('./path', './target');
|
||||
|
||||
Vendored
+31
-23
@@ -1,22 +1,11 @@
|
||||
// Type definitions for archiver 1.3
|
||||
// Type definitions for archiver 2.0
|
||||
// Project: https://github.com/archiverjs/node-archiver
|
||||
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>, Dolan Miu <https://github.com/dolanmiu>
|
||||
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>, Dolan Miu <https://github.com/dolanmiu>, Crevil <https://github.com/crevil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import Archiver = require('archiver);
|
||||
var archiver = Archiver.create('zip');
|
||||
archiver.pipe(fs.createWriteStream('xxx'));
|
||||
archiver.append(fs.createReadStream('xxx'));
|
||||
archiver.finalize();
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as stream from 'stream';
|
||||
import * as glob from 'glob';
|
||||
import { ZlibOptions } from 'zlib';
|
||||
|
||||
declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver;
|
||||
|
||||
@@ -36,29 +25,48 @@ declare namespace archiver {
|
||||
abort(): this;
|
||||
append(source: stream.Readable | Buffer | string, name?: EntryData): this;
|
||||
|
||||
bulk(mappings: any): this;
|
||||
|
||||
directory(dirpath: string, options: EntryData | string, data?: EntryData): this;
|
||||
|
||||
file(filename: string, data: EntryData): this;
|
||||
glob(pattern: string, options?: glob.IOptions, data?: EntryData): this;
|
||||
finalize(): this;
|
||||
|
||||
pipe(stream: stream.Writable): void;
|
||||
finalize(): Promise<void>;
|
||||
|
||||
setFormat(format: string): this;
|
||||
setModule(module: Function): this;
|
||||
|
||||
pointer(): number;
|
||||
use(plugin: Function): this;
|
||||
|
||||
symlink(filepath: string, target: string): this;
|
||||
}
|
||||
|
||||
interface ArchiverOptions {
|
||||
type ArchiverOptions = CoreOptions & TransformOptions & ZipOptions & TarOptions;
|
||||
|
||||
interface CoreOptions {
|
||||
statConcurrency?: number;
|
||||
}
|
||||
|
||||
interface TransformOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writeableObjectMode?: boolean;
|
||||
decodeStrings?: boolean;
|
||||
encoding?: string;
|
||||
highWaterMark?: number;
|
||||
objectmode?: boolean;
|
||||
}
|
||||
|
||||
interface ZipOptions {
|
||||
comment?: string;
|
||||
forceLocalTime?: boolean;
|
||||
forceZip64?: boolean;
|
||||
store?: boolean;
|
||||
zlib?: ZlibOptions;
|
||||
}
|
||||
|
||||
interface TarOptions {
|
||||
gzip?: boolean;
|
||||
gzipOptions?: {
|
||||
level: number,
|
||||
};
|
||||
gzipOptions?: ZlibOptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
|
||||
|
||||
import {ArgumentParser, RawDescriptionHelpFormatter} from 'argparse';
|
||||
import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse';
|
||||
var args: any;
|
||||
|
||||
var simpleExample = new ArgumentParser({
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import arrify = require("arrify");
|
||||
|
||||
arrify(null);
|
||||
arrify<number>(null);
|
||||
|
||||
arrify(undefined);
|
||||
arrify<number>(undefined);
|
||||
|
||||
arrify(1);
|
||||
arrify([2, 3]);
|
||||
|
||||
function test(val?: string | string[]) {
|
||||
arrify(val);
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for arrify 1.0
|
||||
// Project: https://github.com/sindresorhus/arrify
|
||||
// Definitions by: AnJun Wang <https://github.com/wanganjun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* @example
|
||||
* arrify(undefined) // returns []
|
||||
* @example
|
||||
* arrify(null) // returns []
|
||||
* @example
|
||||
* arrify(1) // returns [1]
|
||||
* @example
|
||||
* arrify([2, 3]) // returns [2, 3]
|
||||
* @param val
|
||||
*/
|
||||
declare function arrify<T>(val: undefined | null | T | T[]): T[];
|
||||
export = arrify;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"arrify-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { unlessProduction, isDevelopment, isTest, isProduction, getEnv, setEnv } from 'asenv';
|
||||
import { equal, throws } from 'assert';
|
||||
|
||||
// Test isDevelopment()
|
||||
setEnv('development');
|
||||
equal(getEnv(), 'development', 'Should return be true');
|
||||
equal(isDevelopment(), true, 'NODE_ENV should be "development"');
|
||||
equal(isTest(), false, 'NODE_ENV should be "development"');
|
||||
equal(isProduction(), false, 'NODE_ENV should be "development"');
|
||||
equal(unlessProduction(() => true), true, "Shound return true");
|
||||
|
||||
// Test isTest()
|
||||
setEnv('test');
|
||||
equal(getEnv(), 'test', 'Should return be true');
|
||||
equal(isDevelopment(), false, 'NODE_ENV should be "test"');
|
||||
equal(isTest(), true, 'NODE_ENV should be "test"');
|
||||
equal(isProduction(), false, 'NODE_ENV should be "test"');
|
||||
equal(unlessProduction(() => true), true, "Shound return true");
|
||||
|
||||
// Test isProduction()
|
||||
setEnv('production');
|
||||
equal(getEnv(), 'production', 'Should return be true');
|
||||
equal(isDevelopment(), false, 'NODE_ENV should be "production"');
|
||||
equal(isTest(), false, 'NODE_ENV should be "production"');
|
||||
equal(isProduction(), true, 'NODE_ENV should be "production"');
|
||||
equal(unlessProduction(() => true), false, "Shound return false");
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for asenv 1.1
|
||||
// Project: https://github.com/a-labo/asenv#readme
|
||||
// Definitions by: Remisery <https://github.com/remisery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export function getEnv(): string;
|
||||
|
||||
export function isDevelopment(): boolean;
|
||||
|
||||
export function isProduction(): boolean;
|
||||
|
||||
export function isTest(): boolean;
|
||||
|
||||
export function setEnv(env: string): void;
|
||||
|
||||
export function unlessProduction(handle: () => any): any;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"asenv-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -13,3 +13,6 @@ let options = {
|
||||
|
||||
let div = document.createElement("div");
|
||||
let amcRating = new AskmethatRating(div, 2 , options);
|
||||
|
||||
options.readonly = true;
|
||||
amcRating.defaultOptions = options;
|
||||
|
||||
Vendored
+12
-1
@@ -75,7 +75,12 @@ export class AskmethatRating {
|
||||
*
|
||||
* @return options based on @type AskmethatRatingOptions
|
||||
*/
|
||||
readonly defaultOptions: any;
|
||||
/**
|
||||
* @function set the default option for the rating
|
||||
*
|
||||
* @return options based on @type AskmethatRatingOptions
|
||||
*/
|
||||
defaultOptions: AskmethatRatingOptions;
|
||||
/**
|
||||
* constructor with div element, default rating value & default options
|
||||
*
|
||||
@@ -122,6 +127,12 @@ export class AskmethatRating {
|
||||
* Update readonly status if needed for the rating
|
||||
*/
|
||||
private mutationEvent();
|
||||
/**
|
||||
* This is fired by mutation observer when an attribute changed in the hidden input
|
||||
* Is protected to have some unit tests
|
||||
* @param {MutationRecord[]} mutations list of mutations record
|
||||
*/
|
||||
protected mutationDisableEvent(mutations: MutationRecord[]): void;
|
||||
/**
|
||||
* @function static method to retrieve with identifier the value
|
||||
* @param {string} identifier: string container identifier
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import {Stream} from 'stream';
|
||||
import { Stream } from 'stream';
|
||||
|
||||
export function array(arr: any[], message ?: string): void;
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as webpack from 'webpack';
|
||||
import * as AssetsPlugin from 'assets-webpack-plugin';
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new AssetsPlugin(),
|
||||
new AssetsPlugin({
|
||||
filename: 'assets.json'
|
||||
}),
|
||||
new AssetsPlugin({
|
||||
filename: 'assets.json',
|
||||
fullPath: false,
|
||||
includeManifest: true,
|
||||
path: '/foo/bar',
|
||||
prettyPrint: true,
|
||||
processOutput: (assets) => (
|
||||
'window.assets = ' + JSON.stringify(assets)
|
||||
),
|
||||
update: true,
|
||||
metadata: {
|
||||
meta: 'data'
|
||||
},
|
||||
})
|
||||
]
|
||||
};
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
// Type definitions for assets-webpack-plugin 3.5
|
||||
// Project: https://github.com/sporto/assets-webpack-plugin
|
||||
// Definitions by: Michael Strobel <https://github.com/kryops>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
declare namespace AssetsWebpackPlugin {
|
||||
interface Assets {
|
||||
[name: string]: {
|
||||
[ext: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
type ProcessOutputFn = (assets: Assets) => string;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Name for the created json file.
|
||||
* "webpack-assets.json" by default
|
||||
*/
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* If false the output will not include the full path of the generated file.
|
||||
* true by default
|
||||
*/
|
||||
fullPath?: boolean;
|
||||
|
||||
/**
|
||||
* Inserts the manifest javascript as a text property in your assets.
|
||||
* Accepts the name of your manifest chunk.
|
||||
* A manifest is the last CommonChunk that only contains the webpack bootstrap code.
|
||||
* This is useful for production use when you want to inline the manifest
|
||||
* in your HTML skeleton for long-term caching.
|
||||
* false by default
|
||||
*/
|
||||
includeManifest?: boolean;
|
||||
|
||||
/**
|
||||
* Inject metadata into the output file. All values will be injected into the key "metadata"
|
||||
*/
|
||||
metadata?: object;
|
||||
|
||||
/**
|
||||
* Path where to save the created JSON file.
|
||||
* Defaults to the current directory
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* Whether to format the JSON output for readability.
|
||||
* false by default
|
||||
*/
|
||||
prettyPrint?: boolean;
|
||||
|
||||
/**
|
||||
* Formats the assets output.
|
||||
* Defaults to JSON.stringify
|
||||
*/
|
||||
processOutput?: ProcessOutputFn;
|
||||
|
||||
/**
|
||||
* When set to true, the output JSON file will be updated instead of overwritten.
|
||||
* false by default
|
||||
*/
|
||||
update?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare class AssetsWebpackPlugin extends webpack.Plugin {
|
||||
constructor(options?: AssetsWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
export = AssetsWebpackPlugin;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"assets-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user