mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[adone] refactoring, new typings (#19812)
* [adone] refactoring, new typings * refactor to namespace style * move adone.run to adone.application * [std] remove unnecessary std.ts code * move is and x to separate dirs * init collections, add LinkedList typings, move ExBuffer here * init event, move EventEmitter and AsyncEmitter here * init fs * init fast * init streams, add core typings * remove common * [util] add userdir, LogRotator, debounce, uuid.v3, fix entries * [shani] add spy.waitFor* definitions * [is] add descriptions * [promise] callbackify * [adone] rename is.exbuffer to is.byteArray * [adone] add data typings * [adone] rename is.exdate to is.datetime * [adone] fs fixes * [adone] add datetime typings * [adone] improve datetime help messages * [adone] math * decomposition * add descriptions for Long * add typings for matrix, simd, BitSet, BigNumber, random * collections, math * add some lazify options * [collections] add help messages for ByteArray * [collections] add typings for Queue, AsyncQueue, PriorityQueue, FastLRU, Stack, BinarySearchTree, AVLTree, RedBlackTree, ArraySet, BufferList, DefaultMap, LRU, TimedoutMap * [math] add missing BitSet methods, normalize help messages * [adone] compressors, fast * [fast] change FIle.is* methods * [compressors] init * [adone] archives, fs, datetime * [archives] init, tar, zip * [fs] add AbstractRandomAccessReader, RandomAccessFdReader, RandomAccessBufferReader * [datetime] add support for ms-dos format * is, streams, fast * [fast] fix typo * [is] fix fast stream predicates, add some runtime predicates * [streams] more detailed core help messages
This commit is contained in:
parent
9769162cbb
commit
521a0c9adc
212
types/adone/adone.d.ts
vendored
212
types/adone/adone.d.ts
vendored
@ -1,85 +1,133 @@
|
||||
/// <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;
|
||||
declare namespace adone {
|
||||
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;
|
||||
|
||||
namespace I {
|
||||
interface LazifyOptions {
|
||||
/**
|
||||
* Whether the new properties are configurable, false by default
|
||||
*/
|
||||
configurable?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the new properties are writable, false by default
|
||||
*/
|
||||
writable?: boolean;
|
||||
|
||||
/**
|
||||
* A custom mapper for values, by default returns the exported object (module.exports),
|
||||
* but if the object is a transpiled es module and the default export is defined,
|
||||
* it returns the default export
|
||||
*
|
||||
* @param key property
|
||||
* @param mod module.exports
|
||||
*/
|
||||
mapper?(key: string, mod: any): any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the given object(or creates a new one) with the given lazyfied properties
|
||||
*/
|
||||
export function lazify(modules: object, obj?: object, require?: (path: string) => any, options?: I.LazifyOptions): object;
|
||||
|
||||
/**
|
||||
* Defines or extends the private part of the given object with the given lazyfied properties
|
||||
*/
|
||||
export function lazifyPrivate(modules: object, obj?: object, require?: (path: string) => any, options?: I.LazifyOptions): object;
|
||||
|
||||
/**
|
||||
* Defines the private part of the given object with the given modules
|
||||
*/
|
||||
export function definePrivate(modules: object, obj: object): object;
|
||||
|
||||
/**
|
||||
* Returns the private part of the given object
|
||||
*/
|
||||
export function private(obj: object): any;
|
||||
|
||||
namespace I {
|
||||
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: I.Tag;
|
||||
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;
|
||||
|
||||
namespace I {
|
||||
interface Runtime {
|
||||
term: object; // TODO
|
||||
logger: object; // TODO
|
||||
app: object; // TODO
|
||||
}
|
||||
}
|
||||
|
||||
export const runtime: I.Runtime;
|
||||
|
||||
export const homePath: string;
|
||||
export const rootPath: string;
|
||||
export const etcPath: string;
|
||||
export const config: object;
|
||||
export const emptyBuffer: Buffer;
|
||||
|
||||
export const assert: assertion.I.AssertFunction;
|
||||
export const expect: assertion.I.ExpectFunction;
|
||||
|
||||
export const std: typeof nodestd;
|
||||
}
|
||||
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;
|
||||
|
||||
5
types/adone/glosses/application.d.ts
vendored
Normal file
5
types/adone/glosses/application.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
declare namespace adone {
|
||||
namespace application {
|
||||
function run(app: object, ignoreArgs?: boolean): Promise<void>;
|
||||
}
|
||||
}
|
||||
670
types/adone/glosses/archives.d.ts
vendored
Normal file
670
types/adone/glosses/archives.d.ts
vendored
Normal file
@ -0,0 +1,670 @@
|
||||
declare namespace adone {
|
||||
/**
|
||||
* Various archivers
|
||||
*/
|
||||
namespace archive {
|
||||
/**
|
||||
* tar archiver
|
||||
*/
|
||||
namespace tar {
|
||||
namespace I {
|
||||
interface Header {
|
||||
/**
|
||||
* File path
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Type of entry, file by default
|
||||
*/
|
||||
type: "file" | "directory" | "link" | "symlink" | "block-device" | "character-device" | "fifo" | "contiguous-file";
|
||||
|
||||
/**
|
||||
* Entry mode, 0755 for dirs and 0644 by default
|
||||
*/
|
||||
mode: number;
|
||||
|
||||
/**
|
||||
* Last modified date for entry, now by default
|
||||
*/
|
||||
mtime: number;
|
||||
|
||||
/**
|
||||
* Entry size, 0 by default
|
||||
*/
|
||||
size: number;
|
||||
|
||||
/**
|
||||
* Linked file name
|
||||
*/
|
||||
linkname: string;
|
||||
|
||||
/**
|
||||
* uid for entry owner, 0 by default
|
||||
*/
|
||||
uid: number;
|
||||
|
||||
/**
|
||||
* gid for entry owner, 9 by default
|
||||
*/
|
||||
gid: number;
|
||||
|
||||
/**
|
||||
* uname of entry owner, null by default
|
||||
*/
|
||||
uname: string;
|
||||
|
||||
/**
|
||||
* gname of entry owner, null by default
|
||||
*/
|
||||
gname: string;
|
||||
|
||||
/**
|
||||
* device minor versio, 0 by default
|
||||
*/
|
||||
devmajor: number;
|
||||
|
||||
/**
|
||||
* device minor version, 0 by default
|
||||
*/
|
||||
devminor: number;
|
||||
}
|
||||
|
||||
type Optional<T> = {
|
||||
[P in keyof T]?: T[P];
|
||||
};
|
||||
|
||||
interface OptionalHeader extends Optional<Header> {
|
||||
/**
|
||||
* File path
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface CommonOptions {
|
||||
/**
|
||||
* Entries filter
|
||||
*/
|
||||
ignore?(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Header mapper, called for each each entry
|
||||
*/
|
||||
map?(header: Header): Header | undefined;
|
||||
|
||||
/**
|
||||
* Set the dmode and fmode to writable
|
||||
*/
|
||||
readable?: boolean;
|
||||
|
||||
/**
|
||||
* Set the dmode and fmode to writable
|
||||
*/
|
||||
writable?: boolean;
|
||||
|
||||
/**
|
||||
* Strip the parts of paths of files
|
||||
*/
|
||||
strip?: number;
|
||||
|
||||
/**
|
||||
* Ensure that packed directories have the corresponding modes
|
||||
*/
|
||||
dmode?: number;
|
||||
|
||||
/**
|
||||
* Ensure that packed files have the corresponding modes
|
||||
*/
|
||||
fmode?: number;
|
||||
|
||||
/**
|
||||
* A custom umask, process.umask() by default
|
||||
*/
|
||||
umask?: number;
|
||||
}
|
||||
|
||||
interface PackOptions extends CommonOptions {
|
||||
/**
|
||||
* Input read stream modifier, called for each entry
|
||||
*/
|
||||
mapStream?(stream: fs.I.ReadStream, header: Header): nodestd.stream.Readable;
|
||||
|
||||
/**
|
||||
* Pack the contents of the symlink instead of the link itself, false by default
|
||||
*/
|
||||
dereference?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies which entries to pack, all by default
|
||||
*/
|
||||
entries?: string[];
|
||||
|
||||
/**
|
||||
* Whether to sort entries before packing
|
||||
*/
|
||||
sort?: boolean;
|
||||
|
||||
/**
|
||||
* set false to ignore errors due to unsupported entry types (like device files), true by default
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
* A custom initial pack stream
|
||||
*/
|
||||
pack?: RawPackStream;
|
||||
}
|
||||
|
||||
type Writable = nodestd.stream.Writable;
|
||||
|
||||
interface LinkSink extends Writable {
|
||||
linkname: string;
|
||||
}
|
||||
|
||||
interface UnpackOptions extends CommonOptions {
|
||||
/**
|
||||
* Input read stream modifier, called for each entry
|
||||
*/
|
||||
mapStream?(stream: UnpackSourceStream, header: Header): nodestd.stream.Readable;
|
||||
|
||||
/**
|
||||
* Whether to change time properties of files
|
||||
*/
|
||||
utimes?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to change owner of the files
|
||||
*/
|
||||
chown?: boolean;
|
||||
|
||||
/**
|
||||
* A custom unpack stream
|
||||
*/
|
||||
unpack?: RawUnpackStream;
|
||||
|
||||
/**
|
||||
* Copies a file if cannot create a link
|
||||
*/
|
||||
hardlinkAsFilesFallback?: boolean;
|
||||
}
|
||||
|
||||
interface UnpackSourceStream extends nodestd.stream.PassThrough {
|
||||
_parent: RawUnpackStream;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a raw tar unpack stream
|
||||
*/
|
||||
class RawPackStream extends nodestd.stream.Readable {
|
||||
entry(header: I.OptionalHeader, buffer: Buffer, callback?: (err: any) => void): I.Writable;
|
||||
entry(header: I.OptionalHeader & { type: "symblink", linkname: string }, callback?: (err: any) => void): I.Writable;
|
||||
entry(header: I.OptionalHeader & { type: "symlink" }, callback?: (err: any) => void): I.LinkSink;
|
||||
entry(header: I.OptionalHeader, callback?: (err: any) => void): I.Writable;
|
||||
|
||||
finalize(): void;
|
||||
|
||||
destroy(err?: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a raw writable unpack stream
|
||||
*/
|
||||
class RawUnpackStream extends nodestd.stream.Writable {
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
on(event: "entry", listener: (header: I.Header, stream: I.UnpackSourceStream, next: (err?: any) => void) => void): this;
|
||||
on(event: "close", listener: () => void): this;
|
||||
on(event: "drain", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "finish", listener: () => void): this;
|
||||
on(event: "pipe", listener: (src: nodestd.stream.Readable) => void): this;
|
||||
on(event: "unpipe", listener: (src: nodestd.stream.Readable) => void): this;
|
||||
|
||||
once(event: string, listener: (...args: any[]) => void): this;
|
||||
once(event: "entry", listener: (header: I.Header, stream: I.UnpackSourceStream, next: (err?: any) => void) => void): this;
|
||||
once(event: "close", listener: () => void): this;
|
||||
once(event: "drain", listener: () => void): this;
|
||||
once(event: "error", listener: (err: Error) => void): this;
|
||||
once(event: "finish", listener: () => void): this;
|
||||
once(event: "pipe", listener: (src: nodestd.stream.Readable) => void): this;
|
||||
once(event: "unpipe", listener: (src: nodestd.stream.Readable) => void): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a pack stream for the files from the given directory
|
||||
*
|
||||
* @param cwd directory to pack
|
||||
*/
|
||||
function packStream(cwd: string, options?: I.PackOptions): RawPackStream;
|
||||
|
||||
/**
|
||||
* Creates an unpack stream to the given direcotry
|
||||
*
|
||||
* @param cwd direcotry to unpack to
|
||||
*/
|
||||
function unpackStream(cwd: string, options?: I.UnpackOptions): RawUnpackStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* zip archiver
|
||||
*/
|
||||
namespace zip {
|
||||
/**
|
||||
* zip packer
|
||||
*/
|
||||
namespace pack {
|
||||
class ZipFile {
|
||||
/**
|
||||
* A readable stream that will produce the contents of the zip file
|
||||
*/
|
||||
outputStream: nodestd.stream.Readable;
|
||||
|
||||
/**
|
||||
* Adds a file from the file system at realPath into the zipfile as metadataPath
|
||||
*
|
||||
* @param path path to the file
|
||||
* @param metadataPath path to the file inside the archive
|
||||
*/
|
||||
addFile(path: string, metadataPath: string, options?: {
|
||||
/**
|
||||
* Overrides the value that will be obtained from stat
|
||||
*/
|
||||
mtime?: number,
|
||||
|
||||
/**
|
||||
* Overrides the value that will be obtained from stat
|
||||
*/
|
||||
mode?: number,
|
||||
|
||||
/**
|
||||
* If true, the file data will be deflated (compression method 8).
|
||||
*
|
||||
* If false, the file data will be stored (compression method 0)
|
||||
*/
|
||||
compress?: boolean,
|
||||
|
||||
/**
|
||||
* Use ZIP64 format in this entry's Data Descriptor and Central Directory Record
|
||||
* regardless of if it's required or not (this may be useful for testing.).
|
||||
* Otherwise, packer will use ZIP64 format where necessary.
|
||||
*/
|
||||
forceZip64Format?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a file to the zip file whose content is read from readStream
|
||||
*
|
||||
* @param stream a readable stream for the file
|
||||
* @param metadataPath path to the file inside the archive
|
||||
*/
|
||||
addReadStream(stream: nodestd.stream.Readable, metadataPath: string, options?: {
|
||||
/**
|
||||
* Defines modified date, now by default
|
||||
*/
|
||||
mtime?: number,
|
||||
|
||||
/**
|
||||
* Defines file mode, 0o100664 by default
|
||||
*/
|
||||
mode?: number,
|
||||
|
||||
/**
|
||||
* If true, the file data will be deflated (compression method 8).
|
||||
*
|
||||
* If false, the file data will be stored (compression method 0)
|
||||
*/
|
||||
compress?: boolean,
|
||||
|
||||
/**
|
||||
* Use ZIP64 format in this entry's Data Descriptor and Central Directory Record
|
||||
* regardless of if it's required or not (this may be useful for testing.).
|
||||
* Otherwise, packer will use ZIP64 format where necessary.
|
||||
*/
|
||||
forceZip64Format?: boolean,
|
||||
|
||||
/**
|
||||
* If given, it will be checked against the actual number of bytes in the readStream,
|
||||
* and an error will be emitted if there is a mismatch
|
||||
*/
|
||||
size?: number
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a file to the zip file whose content is buffer
|
||||
*
|
||||
* @param buffer the file's contents, must be at most 0x3fffffff bytes long
|
||||
* @param metadataPath path to the file inside the archive
|
||||
*/
|
||||
addBuffer(buffer: Buffer, metadataPath: string, options?: {
|
||||
/**
|
||||
* Defines modified date, now by default
|
||||
*/
|
||||
mtime?: number,
|
||||
|
||||
/**
|
||||
* Defines file mode, 0o100664 by default
|
||||
*/
|
||||
mode?: number,
|
||||
|
||||
/**
|
||||
* If true, the file data will be deflated (compression method 8).
|
||||
*
|
||||
* If false, the file data will be stored (compression method 0)
|
||||
*/
|
||||
compress?: boolean,
|
||||
|
||||
/**
|
||||
* Use ZIP64 format in this entry's Data Descriptor and Central Directory Record
|
||||
* regardless of if it's required or not (this may be useful for testing.).
|
||||
* Otherwise, packer will use ZIP64 format where necessary.
|
||||
*/
|
||||
forceZip64Format?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds an entry to the zip file that indicates a directory should be created,
|
||||
* even if no other items in the zip file are contained in the directory
|
||||
*/
|
||||
addEmptyDirectory(metadataPath: string, options?: {
|
||||
/**
|
||||
* Defines modified date, now by default
|
||||
*/
|
||||
mtime?: number,
|
||||
|
||||
/**
|
||||
* Defines file mode, 0o40775 by default
|
||||
*/
|
||||
mode?: number
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Indicates that no more files will be added via addFile(), addReadStream(), or addBuffer().
|
||||
* Some time after calling this function, outputStream will be ended.
|
||||
*
|
||||
* @returns the final guessed size of the file, can be -1 if it is hard to guess before processing. This will happend
|
||||
* only if compression is enabled, or a stream with no size hint given
|
||||
*/
|
||||
end(options?: {
|
||||
/**
|
||||
* If true, packet will include the ZIP64 End of Central Directory Locator and ZIP64 End of Central Directory Record
|
||||
* regardless of whether or not they are required (this may be useful for testing.).
|
||||
* Otherwise, packer will include these structures if necessary
|
||||
*/
|
||||
forceZip64Format?: boolean
|
||||
}): Promise<number>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* zip unpacker
|
||||
*/
|
||||
namespace unpack {
|
||||
namespace I {
|
||||
interface ExtraField {
|
||||
id: number;
|
||||
data: Buffer;
|
||||
}
|
||||
|
||||
interface Entry<StringType> {
|
||||
versionMadeBy: number;
|
||||
versionNeededToExtract: number;
|
||||
generalPurposeBitFlag: number;
|
||||
compressionMethod: number;
|
||||
lastModFileTime: number;
|
||||
lastModFileDate: number;
|
||||
crc32: number;
|
||||
compressedSize: number;
|
||||
uncompressedSize: number;
|
||||
fileNameLength: number;
|
||||
extraFieldLength: number;
|
||||
fileCommentLength: number;
|
||||
internalFileAttributes: number;
|
||||
externalFileAttributes: number;
|
||||
relativeOffsetOfLocalHeader: number;
|
||||
|
||||
/**
|
||||
* The bytes for the file name are decoded with UTF-8 if generalPurposeBitFlag & 0x800, otherwise with CP437.
|
||||
* Alternatively, this field may be populated from the Info-ZIP Unicode Path Extra Field (see extraFields).
|
||||
*/
|
||||
fileName: StringType;
|
||||
|
||||
extraFields: ExtraField[];
|
||||
|
||||
/**
|
||||
* Comment decoded with the charset indicated by generalPurposeBitFlag & 0x800 as with the fileName
|
||||
*/
|
||||
fileComment: StringType;
|
||||
|
||||
getLastModDate(): adone.I.datetime.Datetime;
|
||||
|
||||
/**
|
||||
* Whether this entry is encrypted with "Traditional Encryption"
|
||||
*/
|
||||
isEncrypted(): boolean;
|
||||
|
||||
/**
|
||||
* Whether the entry is compressed
|
||||
*/
|
||||
isCompressed(): boolean;
|
||||
}
|
||||
|
||||
interface ZipFile<StringType> extends event.EventEmitter {
|
||||
/**
|
||||
* true until close() is called; then it's false
|
||||
*/
|
||||
isOpen: boolean;
|
||||
|
||||
/**
|
||||
* Total number of central directory records
|
||||
*/
|
||||
entryCount: number;
|
||||
|
||||
/**
|
||||
* Always decoded with CP437 per the spec
|
||||
*/
|
||||
comment: StringType;
|
||||
|
||||
/**
|
||||
* Causes all future calls to openReadStream() to fail,
|
||||
* and closes the fd after all streams created by openReadStream() have emitted their end events
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
readEntry(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Opens a read stream for the given entry
|
||||
*/
|
||||
openReadStream(entry: Entry<StringType>, options?: {
|
||||
/**
|
||||
* The option must be omitted when the entry is not compressed (see isCompressed()),
|
||||
* and either true (or omitted) or false when the entry is compressed.
|
||||
* Specifying decompress: false for a compressed entry causes the read stream
|
||||
* to provide the raw compressed file data without going through a zlib inflate transform
|
||||
*/
|
||||
decompress?: boolean,
|
||||
|
||||
/**
|
||||
* The option must be null (or omitted) for non-encrypted entries,
|
||||
* and false for encrypted entries. Omitting the option for an encrypted entry will result in an err.
|
||||
*/
|
||||
decrypt?: boolean,
|
||||
|
||||
/**
|
||||
* The start byte offset (inclusive) into this entry's file data
|
||||
*/
|
||||
start?: number,
|
||||
|
||||
/**
|
||||
* The end byte offset (exclusive) into this entry's file data
|
||||
*/
|
||||
end?: number,
|
||||
}): Promise<nodestd.stream.Readable>;
|
||||
|
||||
/**
|
||||
* Emitted for each entry.
|
||||
*
|
||||
* If decodeStrings is true, entries emitted via this event have already passed file name validation
|
||||
*
|
||||
* If validateEntrySizes is true and this entry's compressionMethod is 0 (stored without compression),
|
||||
* this entry has already passed entry size validation
|
||||
*/
|
||||
on(event: "entry", listener: (entry: Entry<StringType>) => void): this;
|
||||
|
||||
/**
|
||||
* Emitted after the last entry event has been emitted
|
||||
*/
|
||||
on(event: "end", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Emitted after the fd is actually closed
|
||||
*/
|
||||
on(event: "close", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Emitted in the case of errors with reading the zip file
|
||||
*/
|
||||
on(event: "error", listener: (err: any) => void): this;
|
||||
|
||||
/**
|
||||
* Emitted for each entry.
|
||||
*
|
||||
* If decodeStrings is true, entries emitted via this event have already passed file name validation
|
||||
*
|
||||
* If validateEntrySizes is true and this entry's compressionMethod is 0 (stored without compression),
|
||||
* this entry has already passed entry size validation
|
||||
*/
|
||||
once(event: "entry", listener: (entry: Entry<StringType>) => void): this;
|
||||
|
||||
/**
|
||||
* Emitted after the last entry event has been emitted
|
||||
*/
|
||||
once(event: "end", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Emitted after the fd is actually closed
|
||||
*/
|
||||
once(event: "close", listener: () => void): this;
|
||||
|
||||
/**
|
||||
* Emitted in the case of errors with reading the zip file
|
||||
*/
|
||||
once(event: "error", listener: (err: any) => void): this;
|
||||
}
|
||||
|
||||
interface CommonOptions {
|
||||
/**
|
||||
* Indicates that entries should be read only when readEntry() is called.
|
||||
* If lazyEntries is false, entry events will be emitted as fast as possible
|
||||
* to allow pipe()-ing file data from all entries in parallel.
|
||||
*
|
||||
* Default is false
|
||||
*/
|
||||
lazyEntries?: boolean;
|
||||
|
||||
/**
|
||||
* Causes unpacker to decode strings with CP437 or UTF-8 as required by the spec.
|
||||
*
|
||||
* When turned off zipfile.comment, entry.fileName, and entry.fileComment will be Buffer,
|
||||
* any Info-ZIP Unicode Path Extra Field will be ignored, automatic file name validation will not be performed
|
||||
*/
|
||||
decodeStrings?: boolean;
|
||||
|
||||
/**
|
||||
* Ensures that an entry's reported uncompressed size matches its actual uncompressed size
|
||||
*/
|
||||
validateEntrySizes?: boolean;
|
||||
}
|
||||
|
||||
interface PathOptions extends CommonOptions {
|
||||
/**
|
||||
* Autocloses the file after the last entry reading or when an error occurs
|
||||
*
|
||||
* Default is true
|
||||
*/
|
||||
autoClose?: boolean;
|
||||
}
|
||||
|
||||
interface FdOptions extends CommonOptions {
|
||||
/**
|
||||
* Autocloses the file after the last entry reading or when an error occurs
|
||||
*
|
||||
* Default is false
|
||||
*/
|
||||
autoClose?: boolean;
|
||||
}
|
||||
|
||||
type BufferOptions = CommonOptions;
|
||||
|
||||
interface RandomAccessReaderOptions extends CommonOptions {
|
||||
/**
|
||||
* Autocloses the file after the last entry reading or when an error occurs
|
||||
*
|
||||
* Default is true
|
||||
*/
|
||||
autoClose?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a file and creates a zipfile unpacker
|
||||
*/
|
||||
function open(path: string, options: I.PathOptions & { decodeStrings: false }): I.ZipFile<Buffer>;
|
||||
|
||||
/**
|
||||
* Opens a file and creates a zipfile unpacker
|
||||
*/
|
||||
function open(path: string, options?: I.PathOptions): I.ZipFile<string>;
|
||||
|
||||
/**
|
||||
* Creates a zipfile unpacker for the given fd
|
||||
*/
|
||||
function fromFd(fd: number, options: I.FdOptions & { decodeStrings: false }): I.ZipFile<Buffer>;
|
||||
|
||||
/**
|
||||
* Creates a zipfile unpacker for the given fd
|
||||
*/
|
||||
function fromFd(fd: number, options?: I.FdOptions): I.ZipFile<string>;
|
||||
|
||||
/**
|
||||
* Creates a zipfile unpacker for the given buffer
|
||||
*/
|
||||
function fromBuffer(buffer: Buffer, options: I.BufferOptions & { decodeStrings: false }): I.ZipFile<Buffer>;
|
||||
|
||||
/**
|
||||
* Creates a zipfile unpacker for the given buffer
|
||||
*/
|
||||
function fromBuffer(buffer: Buffer, options?: I.BufferOptions): I.ZipFile<string>;
|
||||
|
||||
/**
|
||||
* Creates a zipfile unpacker for the given random access reader.
|
||||
* This method of reading a zip file allows clients to implement their own back-end file system
|
||||
*
|
||||
* @param totalSize Indicates the total file size of the zip file
|
||||
*/
|
||||
function fromRandomAccessReader(
|
||||
reader: fs.AbstractRandomAccessReader,
|
||||
totalSize: number,
|
||||
options: I.RandomAccessReaderOptions & { decodeStrings: false }
|
||||
): I.ZipFile<Buffer>;
|
||||
|
||||
/**
|
||||
* Creates a zipfile unpacker for the given random access reader.
|
||||
* This method of reading a zip file allows clients to implement their own back-end file system
|
||||
*
|
||||
* @param totalSize Indicates the total file size of the zip file
|
||||
*/
|
||||
function fromRandomAccessReader(
|
||||
reader: fs.AbstractRandomAccessReader,
|
||||
totalSize: number,
|
||||
options?: I.RandomAccessReaderOptions
|
||||
): I.ZipFile<string>;
|
||||
|
||||
/**
|
||||
* Returns null or a String error message depending on the validity of fileName
|
||||
*/
|
||||
function validateFileName(filename: string): string | null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2134
types/adone/glosses/assertion.d.ts
vendored
2134
types/adone/glosses/assertion.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1966
types/adone/glosses/collections.d.ts
vendored
Normal file
1966
types/adone/glosses/collections.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
465
types/adone/glosses/common.d.ts
vendored
465
types/adone/glosses/common.d.ts
vendored
@ -1,465 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
1137
types/adone/glosses/compressors.d.ts
vendored
Normal file
1137
types/adone/glosses/compressors.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1032
types/adone/glosses/data.d.ts
vendored
Normal file
1032
types/adone/glosses/data.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1394
types/adone/glosses/datetime.d.ts
vendored
Normal file
1394
types/adone/glosses/datetime.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
38
types/adone/glosses/events.d.ts
vendored
Normal file
38
types/adone/glosses/events.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
declare namespace adone {
|
||||
namespace event {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
types/adone/glosses/exceptions.d.ts
vendored
Normal file
37
types/adone/glosses/exceptions.d.ts
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
declare namespace adone {
|
||||
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 { }
|
||||
}
|
||||
}
|
||||
745
types/adone/glosses/fast.d.ts
vendored
Normal file
745
types/adone/glosses/fast.d.ts
vendored
Normal file
@ -0,0 +1,745 @@
|
||||
declare namespace adone {
|
||||
/**
|
||||
* Filesystem Automation Streaming Templates/Transforms
|
||||
*/
|
||||
namespace fast {
|
||||
// File is based on vinyl typings
|
||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/vinyl/index.d.ts
|
||||
|
||||
namespace I {
|
||||
interface FileConstructorOptions {
|
||||
/**
|
||||
* The current workring directory of the file. Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Full path to the file
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* Stores the path history
|
||||
*/
|
||||
history?: string[];
|
||||
|
||||
/**
|
||||
* The result of a fs.Stat call
|
||||
*/
|
||||
stat?: fs.I.Stats;
|
||||
|
||||
/**
|
||||
* File contents
|
||||
*/
|
||||
contents?: null | Buffer | nodestd.stream.Readable;
|
||||
|
||||
/**
|
||||
* Used for relative pathing. Typically where a glob starts. Default: options.cwd
|
||||
*/
|
||||
base?: string;
|
||||
|
||||
symlink?: string;
|
||||
}
|
||||
|
||||
interface FileCloneOptions {
|
||||
contents?: boolean;
|
||||
deep?: boolean;
|
||||
}
|
||||
|
||||
interface FileConstructor {
|
||||
new(options: FileConstructorOptions & { contents: Buffer }): BufferFile;
|
||||
new(options: FileConstructorOptions & { contents: nodestd.stream.Readable }): StreamFile;
|
||||
new(options?: FileConstructorOptions): NullFile;
|
||||
|
||||
prototype: File;
|
||||
}
|
||||
|
||||
interface File {
|
||||
/**
|
||||
* Gets and sets the contents of the file
|
||||
*/
|
||||
contents: null | Buffer | nodestd.stream.Readable;
|
||||
|
||||
/**
|
||||
* Gets and sets current working directory. Will always be normalized and have trailing separators removed.
|
||||
*/
|
||||
cwd: string;
|
||||
|
||||
/**
|
||||
* Gets and sets base directory. Used for relative pathing (typically where a glob starts).
|
||||
*/
|
||||
base: string;
|
||||
|
||||
/**
|
||||
* Gets and sets the absolute pathname string or `undefined`. Setting to a different value
|
||||
* appends the new path to `file.history`. If set to the same value as the current path, it
|
||||
* is ignored. All new values are normalized and have trailing separators removed.
|
||||
*/
|
||||
path: string;
|
||||
|
||||
stat: fs.I.Stats;
|
||||
|
||||
/**
|
||||
* Gets the result of `path.relative(file.base, file.path)`. Or sets a new relative path for file.base
|
||||
*/
|
||||
relative: string;
|
||||
|
||||
/**
|
||||
* Gets and sets the dirname of `file.path`. Will always be normalized and have trailing
|
||||
* separators removed.
|
||||
*/
|
||||
dirname: string;
|
||||
|
||||
/**
|
||||
* Gets and sets the basename of `file.path`.
|
||||
*/
|
||||
basename: string;
|
||||
|
||||
/**
|
||||
* Gets and sets extname of `file.path`.
|
||||
*/
|
||||
extname: string;
|
||||
|
||||
/**
|
||||
* Gets and sets stem (filename without suffix) of `file.path`.
|
||||
*/
|
||||
stem: string;
|
||||
|
||||
/**
|
||||
* Array of `file.path` values the file has had, from `file.history[0]` (original)
|
||||
* through `file.history[file.history.length - 1]` (current). `file.history` and its elements
|
||||
* should normally be treated as read-only and only altered indirectly by setting `file.path`.
|
||||
*/
|
||||
readonly history: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Gets and sets the path where the file points to if it's a symbolic link. Will always
|
||||
* be normalized and have trailing separators removed.
|
||||
*/
|
||||
symlink: string;
|
||||
|
||||
/**
|
||||
* Returns a new File object with all attributes cloned.
|
||||
*/
|
||||
clone(options: FileCloneOptions & { contents: true }): this;
|
||||
clone(options?: FileCloneOptions): File;
|
||||
|
||||
isBuffer(): boolean;
|
||||
|
||||
isStream(): boolean;
|
||||
|
||||
isNull(): boolean;
|
||||
|
||||
isDirectory(): boolean;
|
||||
|
||||
isSymbolic(): boolean;
|
||||
}
|
||||
|
||||
interface NullFile extends File {
|
||||
contents: null;
|
||||
}
|
||||
|
||||
interface BufferFile extends File {
|
||||
contents: Buffer;
|
||||
//
|
||||
}
|
||||
|
||||
interface StreamFile extends File {
|
||||
contents: nodestd.stream.Readable;
|
||||
}
|
||||
|
||||
type DirectoryFile = File;
|
||||
type SymbolicFile = File;
|
||||
|
||||
/* tslint:disable-next-line:no-empty-interface */
|
||||
interface Stream<S, T = File> extends stream.CoreStream<S, T> {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
export const File: I.FileConstructor;
|
||||
|
||||
namespace I {
|
||||
type CoreStreamSource = stream.I.CoreStream.Source<any, File>;
|
||||
|
||||
interface LocalStreamConstructorOptions {
|
||||
/**
|
||||
* Whether to read files. Default: true
|
||||
*/
|
||||
read?: boolean;
|
||||
|
||||
/**
|
||||
* Read files as buffers. Default: true
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/**
|
||||
* Read files as streams
|
||||
*/
|
||||
stream?: boolean;
|
||||
|
||||
/**
|
||||
* Current working directory for files. Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface LocalStreamConstructor {
|
||||
new(source: CoreStreamSource | File[], options: LocalStreamConstructorOptions & { read: false }): LocalStream<NullFile>;
|
||||
new(source: CoreStreamSource | File[], options: LocalStreamConstructorOptions & { stream: true }): LocalStream<StreamFile>;
|
||||
new(source: CoreStreamSource | File[], options?: LocalStreamConstructorOptions): LocalStream<BufferFile>;
|
||||
|
||||
prototype: LocalStream<File>;
|
||||
}
|
||||
|
||||
interface LocalStreamDestOptions {
|
||||
/**
|
||||
* Mode that is used for writing
|
||||
*/
|
||||
mode?: number;
|
||||
|
||||
/**
|
||||
* Flag that is used for writing
|
||||
*/
|
||||
flag?: fs.I.Flag;
|
||||
|
||||
/**
|
||||
* Current working directory for files, dest is resolved using this cwd. Default: constuctor cwd or process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Whether to push written files into the stream
|
||||
*/
|
||||
produceFiles?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to inherit the source file's mode (access properties)
|
||||
*/
|
||||
originMode?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to inherit the source file's time properties (atime, mtime)
|
||||
*/
|
||||
originTimes?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to inherit the source file's uid and gid
|
||||
*/
|
||||
originOwner?: boolean;
|
||||
}
|
||||
|
||||
interface LocalStream<T> extends Stream<File, T> {
|
||||
/**
|
||||
* Writes all files into the given directory
|
||||
*
|
||||
* @param directory directory where to write files
|
||||
*/
|
||||
dest(directory: string, options?: LocalStreamDestOptions): this;
|
||||
|
||||
/**
|
||||
* Writes all files into the given directory using the given callback
|
||||
*
|
||||
* @param getDirectory callback that returns a directory for each file
|
||||
*/
|
||||
dest(getDirectory: (file: T) => string, options?: LocalStreamDestOptions): this;
|
||||
}
|
||||
}
|
||||
|
||||
export const LocalStream: I.LocalStreamConstructor;
|
||||
|
||||
namespace I {
|
||||
interface SrcOptions extends LocalStreamConstructorOptions {
|
||||
/**
|
||||
* Used for relative pathing of files. Typically where a glob starts.
|
||||
*/
|
||||
base?: string;
|
||||
|
||||
/**
|
||||
* Whether to match dotted files (hidden). Default: true
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to lstat instead of stat when stating. Default: false
|
||||
*/
|
||||
links?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param globs Source file/files
|
||||
*/
|
||||
function src(globs: string | string[], options: I.SrcOptions & { read: false }): I.LocalStream<I.NullFile>;
|
||||
function src(globs: string | string[], options: I.SrcOptions & { stream: true }): I.LocalStream<I.StreamFile>;
|
||||
function src(globs: string | string[], options?: I.SrcOptions): I.LocalStream<I.BufferFile>;
|
||||
|
||||
namespace I {
|
||||
type WatcherConstructorOptions = fs.I.Watcher.ConstructorOptions;
|
||||
|
||||
interface WatchOptions extends WatcherConstructorOptions, LocalStreamConstructorOptions {
|
||||
/**
|
||||
* Used for relative pathing of files. Typically where a glob starts.
|
||||
*/
|
||||
base?: string;
|
||||
|
||||
/**
|
||||
* Whether to match dotted files (hidden). Default: true
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to resume the stream on the next tick. Default: true
|
||||
*/
|
||||
resume?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param globs Source file/files
|
||||
*/
|
||||
function watch(globs: string | string[], options: I.WatchOptions & { read: false }): I.LocalStream<I.NullFile>;
|
||||
function watch(globs: string | string[], options: I.WatchOptions & { stream: true }): I.LocalStream<I.StreamFile>;
|
||||
function watch(globs: string | string[], options?: I.WatchOptions): I.LocalStream<I.BufferFile>;
|
||||
|
||||
namespace I {
|
||||
interface LocalMapStream<T> extends Stream<File, T> {
|
||||
dest(options?: LocalStreamDestOptions): this;
|
||||
}
|
||||
|
||||
interface Mapping {
|
||||
/**
|
||||
* Source file/files
|
||||
*/
|
||||
from: string;
|
||||
|
||||
/**
|
||||
* Destination directory
|
||||
*/
|
||||
to: string;
|
||||
}
|
||||
|
||||
interface MapOptions extends LocalStreamConstructorOptions {
|
||||
/**
|
||||
* Used for relative pathing of files. Typically where a glob starts.
|
||||
*/
|
||||
base?: string;
|
||||
|
||||
/**
|
||||
* Whether to match dotted files (hidden). Default: true
|
||||
*/
|
||||
dot?: boolean;
|
||||
}
|
||||
|
||||
type WatchMapOptions = MapOptions & WatcherConstructorOptions;
|
||||
|
||||
type MapSource = Mapping | Mapping[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The same as fast.src, but source and dest paths are defined in one place
|
||||
*/
|
||||
function map(mappings: I.MapSource, options: I.MapOptions & { read: false }): I.LocalMapStream<I.NullFile>;
|
||||
function map(mappings: I.MapSource, options: I.MapOptions & { stream: true }): I.LocalMapStream<I.StreamFile>;
|
||||
function map(mappings: I.MapSource, options?: I.MapOptions): I.LocalMapStream<I.BufferFile>;
|
||||
|
||||
function watchMap(mappings: I.MapSource, options: I.WatchMapOptions & { read: false }): I.LocalMapStream<I.NullFile>;
|
||||
function watchMap(mappings: I.MapSource, options: I.WatchMapOptions & { stream: true }): I.LocalMapStream<I.StreamFile>;
|
||||
function watchMap(mappings: I.MapSource, options?: I.WatchMapOptions): I.LocalMapStream<I.BufferFile>;
|
||||
|
||||
// plugins
|
||||
|
||||
namespace I {
|
||||
namespace plugin.compressor {
|
||||
type Compressor = "gz" | "deflate" | "brotli" | "lzma" | "xz" | "snappy"; // TODO keyof adone.compressor ?
|
||||
}
|
||||
|
||||
interface Stream<S, T> {
|
||||
/**
|
||||
* Compresses all files using the given compressor
|
||||
*/
|
||||
compress(this: {}, type: plugin.compressor.Compressor, options?: {
|
||||
/**
|
||||
* Whether to rename files, adds corresponding extname
|
||||
*/
|
||||
rename?: boolean,
|
||||
[key: string]: any
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Decompresses all files using the given compressor
|
||||
*/
|
||||
decompress(type: plugin.compressor.Compressor, options?: object): this;
|
||||
}
|
||||
|
||||
namespace plugin.archive {
|
||||
type Archiver = "tar" | "zip"; // TODO keyof adone.archive ?
|
||||
}
|
||||
|
||||
interface Stream<S, T> {
|
||||
/**
|
||||
* Packs all files into one archive of the given type
|
||||
*/
|
||||
pack(type: plugin.archive.Archiver, options?: object): this;
|
||||
|
||||
/**
|
||||
* Unpacks the incoming files using the given archive type
|
||||
*/
|
||||
unpack(type: plugin.archive.Archiver, options?: object): this;
|
||||
|
||||
/**
|
||||
* transpiles files
|
||||
*/
|
||||
transpile(options: object): this; // TODO adone.js.transpiler options
|
||||
|
||||
/**
|
||||
* Deletes lines from files
|
||||
*/
|
||||
deleteLines(filters: RegExp | RegExp[]): this;
|
||||
|
||||
/**
|
||||
* sets new filename
|
||||
*/
|
||||
rename(filename: string): this;
|
||||
rename(handle: {
|
||||
dirname?: string,
|
||||
prefix?: string,
|
||||
basename?: string,
|
||||
extname?: string
|
||||
}): this;
|
||||
rename(handler: (handle: {
|
||||
dirname: string,
|
||||
basename: string,
|
||||
extname: string
|
||||
}) => void): this;
|
||||
|
||||
/**
|
||||
* concats all files into one
|
||||
*/
|
||||
concat(file: string | { path: string }, options?: {
|
||||
newLine?: string
|
||||
}): this;
|
||||
|
||||
// flatten(options?: {
|
||||
// newPath?: string,
|
||||
// includeParents?: number | [number, number],
|
||||
// subPath?: number | [number, number],
|
||||
// }): this;
|
||||
}
|
||||
|
||||
namespace plugin.sourcemaps {
|
||||
interface WriteOptions<T> {
|
||||
/**
|
||||
* By default the source maps include the source code. Pass false to use the original files
|
||||
*/
|
||||
includeContent?: boolean;
|
||||
|
||||
/**
|
||||
* By default a comment containing / referencing the source map is added.
|
||||
* Set this to false to disable the comment (e.g. if you want to load the source maps by header)
|
||||
*/
|
||||
addComment?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the charset for inline source maps
|
||||
*/
|
||||
charset?: fs.I.Encoding;
|
||||
|
||||
/**
|
||||
* Set the location where the source files are hosted (use this when includeContent is set to false)
|
||||
*/
|
||||
sourceRoot?: string | ((file: T) => string);
|
||||
|
||||
/**
|
||||
* Function that is called for every source and receives the default source path as a parameter and the original file
|
||||
*/
|
||||
mapSources?(path: string, file: T): string;
|
||||
mapSourcesAbsolute?: boolean;
|
||||
|
||||
/**
|
||||
* This option allows to rename the map file.
|
||||
* It takes a function that is called for every map and receives the default map path as a parameter
|
||||
*/
|
||||
mapFile?(file: T): string;
|
||||
|
||||
/**
|
||||
* Set the destination path
|
||||
*/
|
||||
destPath?: string;
|
||||
|
||||
/**
|
||||
* Clone options
|
||||
*/
|
||||
clone?: FileCloneOptions;
|
||||
|
||||
/**
|
||||
* Specify a prefix to be prepended onto the source map URL when writing external source maps.
|
||||
*/
|
||||
sourceMappingURLPrefix?: string | ((file: T) => string);
|
||||
|
||||
/**
|
||||
* The output of the function must be the full URL to the source map (in function of the output file)
|
||||
*/
|
||||
sourceMappingURL?(file: T): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface Stream<S, T> {
|
||||
sourcemapsInit(options?: {
|
||||
/**
|
||||
* Whether to load existing sourcemaps
|
||||
*/
|
||||
loadMaps?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to generate initial sourcemaps instead of using empty sourcemap
|
||||
*/
|
||||
identityMap?: boolean,
|
||||
|
||||
largeFile?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param dest destination directory
|
||||
*/
|
||||
sourcemapsWrite(dest: string, options?: plugin.sourcemaps.WriteOptions<T>): this;
|
||||
sourcemapsWrite(options?: plugin.sourcemaps.WriteOptions<T>): this;
|
||||
}
|
||||
|
||||
namespace plugin.wrap {
|
||||
interface Options {
|
||||
/**
|
||||
* Set to explicit false value to disable automatic JSON, JSON5 and YAML parsing
|
||||
*/
|
||||
parse?: boolean;
|
||||
escape?: RegExp;
|
||||
evaluate?: RegExp;
|
||||
imports?: object;
|
||||
interpolate?: RegExp;
|
||||
sourceURL?: string;
|
||||
variable?: string;
|
||||
}
|
||||
|
||||
interface TemplateFunctionData<T> extends Options {
|
||||
file: T;
|
||||
contents: object;
|
||||
[custom: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Stream<S, T> {
|
||||
/**
|
||||
* Wraps contents
|
||||
*/
|
||||
wrap(
|
||||
template: { src: string } | string | ((data: plugin.wrap.TemplateFunctionData<T>) => string),
|
||||
data?: object | ((file: T) => object),
|
||||
options?: plugin.wrap.Options | ((file: T) => plugin.wrap.Options)
|
||||
): this;
|
||||
|
||||
/**
|
||||
* Replaces contents
|
||||
*/
|
||||
replace(search: string, replacement: string | ((search: string) => string)): this;
|
||||
replace(search: RegExp, replacement: string): this;
|
||||
replace(search: Array<string | RegExp>, replacement: Array<string | ((search: string) => string)>): this;
|
||||
|
||||
/**
|
||||
* Static asset revisioning by appending content hash to filenames
|
||||
*/
|
||||
revisionHash(options?: {
|
||||
manifest: {
|
||||
path?: string,
|
||||
merge?: boolean
|
||||
transformer?: {
|
||||
parse(str: string): any;
|
||||
stringify(obj: any): string;
|
||||
}
|
||||
}
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Rewrite occurrences of filenames which have been renamed by revisionHash
|
||||
*/
|
||||
revisionHashReplace(options?: {
|
||||
/**
|
||||
* Use canonical Uris when replacing filePaths,
|
||||
* i.e. when working with filepaths with non forward slash (/) path separators
|
||||
* we replace them with forward slash.
|
||||
* Default: true
|
||||
*/
|
||||
canonicalUris?: boolean,
|
||||
|
||||
/**
|
||||
* Add the prefix string to each replacement
|
||||
*/
|
||||
prefix?: string,
|
||||
|
||||
/**
|
||||
* Only substitute in new filenames in files of these types
|
||||
* Default: ['.js', '.css', '.html', '.hbs']
|
||||
*/
|
||||
replaceExtensions?: string[],
|
||||
|
||||
/**
|
||||
* Read JSON manifests written out by revisionHash
|
||||
*/
|
||||
manifest?: File[] | stream.CoreStream<any, File>,
|
||||
|
||||
/**
|
||||
* Modify the name of the unreved files before using them
|
||||
*/
|
||||
modifyUnreved?(path: string): string,
|
||||
|
||||
/**
|
||||
* Modify the name of the reved files before using them
|
||||
*/
|
||||
modifyReved?(path: string): string
|
||||
}): this;
|
||||
}
|
||||
|
||||
namespace plugin.chmod {
|
||||
interface Access {
|
||||
/**
|
||||
* Whether to have read access
|
||||
*/
|
||||
read?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to have write access
|
||||
*/
|
||||
write?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to ahve execute access
|
||||
*/
|
||||
execute?: boolean;
|
||||
}
|
||||
|
||||
interface Mode {
|
||||
/**
|
||||
* Owner properties
|
||||
*/
|
||||
owner?: Access;
|
||||
|
||||
/**
|
||||
* Group properties
|
||||
*/
|
||||
group?: Access;
|
||||
|
||||
/**
|
||||
* Others properties
|
||||
*/
|
||||
others?: Access;
|
||||
}
|
||||
}
|
||||
|
||||
interface Stream<S, T> {
|
||||
/**
|
||||
* Changes file mode
|
||||
*/
|
||||
chmod(mode?: number | plugin.chmod.Mode, dirMode?: number | plugin.chmod.Mode): this;
|
||||
}
|
||||
|
||||
namespace plugin.notify {
|
||||
interface Options<T> {
|
||||
notifier?: object; // TODO adone.notifier
|
||||
|
||||
host?: string;
|
||||
appName?: string;
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* Filter out files
|
||||
*/
|
||||
filter?(file: T): boolean;
|
||||
|
||||
/**
|
||||
* Whether to emit an error when the stream emits an error. Default: false
|
||||
*/
|
||||
emitError?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to notify on the last file. Default: false
|
||||
*/
|
||||
onLast?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to debounce notifications. Accepts a number as timeout or debounce options
|
||||
* Default: undefined
|
||||
*/
|
||||
debounce?: number | util.I.DebounceOptions & {
|
||||
/**
|
||||
* debounce timeout
|
||||
*/
|
||||
timeout: number
|
||||
};
|
||||
|
||||
/**
|
||||
* Object passed to the lodash template, for additional properties passed to the template
|
||||
*/
|
||||
templateOptions?: object;
|
||||
|
||||
/**
|
||||
* Whether to use console notifications (print a message to console)
|
||||
*/
|
||||
console?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use GUI notifications (notify-send/toaster/etc)
|
||||
*/
|
||||
gui?: boolean;
|
||||
|
||||
/**
|
||||
* Notification title
|
||||
*/
|
||||
title?: string | ((file: T) => string);
|
||||
|
||||
/**
|
||||
* Notification subtitle
|
||||
*/
|
||||
subtitle?: string | ((file: T) => string);
|
||||
|
||||
open?: string | ((file: T) => string);
|
||||
|
||||
/**
|
||||
* Notification message
|
||||
*/
|
||||
message?: string | ((file: T) => string);
|
||||
}
|
||||
|
||||
interface OnErrorOptions<T> extends Options<T> {
|
||||
/**
|
||||
* Whether to end the stream when an error occurs
|
||||
*/
|
||||
endStream?: boolean;
|
||||
}
|
||||
|
||||
type OptionsArg<T, O> = string | O | (() => O);
|
||||
}
|
||||
|
||||
interface Stream<S, T> {
|
||||
/**
|
||||
* Notify about passing through files
|
||||
*/
|
||||
notify(options?: plugin.notify.OptionsArg<T, plugin.notify.Options<T>>): this;
|
||||
|
||||
/**
|
||||
* Notify about errors
|
||||
*/
|
||||
notifyError(options?: plugin.notify.OptionsArg<T, plugin.notify.OnErrorOptions<T>>): this;
|
||||
}
|
||||
}
|
||||
|
||||
namespace plugin {
|
||||
namespace notify {
|
||||
/**
|
||||
* Creates a callback that can be used as a reporter for errors
|
||||
*/
|
||||
function onError<T = any>(options?: I.plugin.notify.OptionsArg<T, I.plugin.notify.OnErrorOptions<T>>): (error: T) => void;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1728
types/adone/glosses/fs.d.ts
vendored
Normal file
1728
types/adone/glosses/fs.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
553
types/adone/glosses/is.d.ts
vendored
Normal file
553
types/adone/glosses/is.d.ts
vendored
Normal file
@ -0,0 +1,553 @@
|
||||
declare namespace adone {
|
||||
/**
|
||||
* predicates
|
||||
*/
|
||||
namespace is {
|
||||
/**
|
||||
* Checks whether the given object is `null`
|
||||
*/
|
||||
function _null(obj: any): boolean;
|
||||
export { _null as null };
|
||||
|
||||
/**
|
||||
* Checks whether the given object is `undefined`
|
||||
*/
|
||||
export function undefined(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is nither `undefined` nor `null`
|
||||
*/
|
||||
export function exist(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is either `undefined` or `null`
|
||||
*/
|
||||
export function nil(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a number
|
||||
*/
|
||||
export function number(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a finite number or a string represents a finite number
|
||||
*/
|
||||
export function numeral(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is either +Infinity or -Inginity
|
||||
*/
|
||||
export function infinite(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an odd number
|
||||
*/
|
||||
export function odd(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an even number
|
||||
*/
|
||||
export function even(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a float
|
||||
*/
|
||||
export function float(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is -0
|
||||
*/
|
||||
export function negativeZero(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a string
|
||||
*/
|
||||
export function string(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an empty string
|
||||
*/
|
||||
export function emptyString(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the first string is a substring of the second string from the given offset
|
||||
*/
|
||||
export function substring(substring: string, string: string, offset?: number): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether `string` starts from `prefix`
|
||||
*/
|
||||
export function prefix(prefix: string, string: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether `strin` ends with `prefix`
|
||||
*/
|
||||
export function suffix(suffix: string, string: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a boolean
|
||||
*/
|
||||
export function boolean(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a string with ".json" extension or an object
|
||||
*/
|
||||
export function json(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is not a primitive, i.e. neither `undefined` nor `null` nor number nor string nor boolean nor symbol)
|
||||
*/
|
||||
export function object(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a plain object, i.e. created by Object
|
||||
*/
|
||||
export function plainObject(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone namespace
|
||||
*/
|
||||
export function namespace(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a class
|
||||
*/
|
||||
function _class(obj: any): boolean;
|
||||
export { _class as class };
|
||||
|
||||
/**
|
||||
* Checks whether the given object is empty, i.e. it is an object(not a primitive), and Object.keys returns an empty array
|
||||
*/
|
||||
export function emptyObject(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object has the given owned property
|
||||
*/
|
||||
export function propertyOwned(obj: any, field: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object has the given property
|
||||
*/
|
||||
export function propertyDefined(obj: any, field: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object conforms to `schema`.
|
||||
*/
|
||||
export function conforms(obj: object, schema: object, strict?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is like an array, i.e. it is not a primitive, not a function and has length
|
||||
*/
|
||||
export function arrayLikeObject(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given array has the given value
|
||||
*/
|
||||
export function inArray<T>(value: T, array: any[], offset?: number, comparator?: (a: T, b: T) => boolean): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given objects has same type
|
||||
*/
|
||||
export function sameType(value: any, other: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a primitive, i.e. it is either `undefined` or `null` or number or boolean or string or symbol
|
||||
*/
|
||||
export function primitive(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given arrays are equal
|
||||
*/
|
||||
export function equalArrays(left: any[], right: any[]): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given objects are deep equal
|
||||
*/
|
||||
export function deepEqual(left: any, right: any): boolean;
|
||||
|
||||
export function shallowEqual(left: any, right: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a stream, i.e. an object and has a pipe method
|
||||
*/
|
||||
export function stream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a writable stream, i.e. a stream that has _writableState
|
||||
*/
|
||||
export function writableStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a readable stream, i.e. a stream that has _readableState
|
||||
*/
|
||||
export function readableStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a duplex stream, i.e. a readable and writable stream
|
||||
*/
|
||||
export function duplexStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a transform stream, i.e. a stream that has _transformState
|
||||
*/
|
||||
export function transformStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given buffer is in utf8
|
||||
*/
|
||||
export function utf8(obj: Buffer): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given path is an absolute win32 path
|
||||
*/
|
||||
export function win32PathAbsolute(path: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given path is an absolute posix path
|
||||
*/
|
||||
export function posixPathAbsolute(path: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given path is an absolute path
|
||||
*/
|
||||
export function pathAbsolute(path: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is a glob
|
||||
*/
|
||||
export function glob(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given path is not a dot-file path (.secret)
|
||||
*/
|
||||
export function dotfile(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a function
|
||||
*/
|
||||
function _function(obj: any): boolean;
|
||||
export { _function as function };
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an async function
|
||||
*/
|
||||
export function asyncFunction(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a promise
|
||||
*/
|
||||
export function promise(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is a valid date-string
|
||||
*/
|
||||
export function validDate(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a buffer
|
||||
*/
|
||||
export function buffer(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a callback function, i.e. it has a common function name
|
||||
*/
|
||||
export function callback(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a generator function
|
||||
*/
|
||||
export function generator(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is NaN
|
||||
*/
|
||||
export function nan(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a finite number
|
||||
*/
|
||||
export function finite(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an integer
|
||||
*/
|
||||
export function integer(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a safe integer
|
||||
*/
|
||||
export function safeInteger(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an array
|
||||
*/
|
||||
export function array(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a Uint8 array
|
||||
*/
|
||||
export function uint8Array(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone configuration
|
||||
*/
|
||||
export function configuration(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.math.Long
|
||||
*/
|
||||
export function long(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.math.BigNumber
|
||||
*/
|
||||
export function bigNumber(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.collection.ByteArray
|
||||
*/
|
||||
export function byteArray(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an instance of adone.datetime
|
||||
*/
|
||||
export function datetime(obj: any): boolean;
|
||||
|
||||
export function transform(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone subsystem
|
||||
*/
|
||||
export function subsystem(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone application
|
||||
*/
|
||||
export function application(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone logger
|
||||
*/
|
||||
export function logger(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a core stream
|
||||
*/
|
||||
export function coreStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a fast local map stream
|
||||
*/
|
||||
export function fastLocalMapStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a fast local stream
|
||||
*/
|
||||
export function fastLocalStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a fast stream
|
||||
*/
|
||||
export function fastStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a genesis netron
|
||||
*/
|
||||
export function genesisNetron(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a genesis peer
|
||||
*/
|
||||
export function genesisPeer(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron adapter
|
||||
*/
|
||||
export function netronAdapter(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron instance
|
||||
*/
|
||||
export function netron(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron peer instance
|
||||
*/
|
||||
export function netronPeer(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron definition
|
||||
*/
|
||||
export function netronDefinition(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object represents netron definitions
|
||||
*/
|
||||
export function netronDefinitions(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron reference
|
||||
*/
|
||||
export function netronReference(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron interface
|
||||
*/
|
||||
export function netronInterface(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron context
|
||||
*/
|
||||
export function netronContext(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given netron interface has `name` method
|
||||
*/
|
||||
export function netronIMethod(netronInterface: object, name: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given netron interface has `name` property
|
||||
*/
|
||||
export function netronIProperty(netronInterface: any, name: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron stub
|
||||
*/
|
||||
export function netronStub(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron remote stub
|
||||
*/
|
||||
export function netronRemoteStub(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a netron stream
|
||||
*/
|
||||
export function netronStream(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is iterable, has defined Symbol.iterator property
|
||||
*/
|
||||
export function iterable(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* true if the OS is Windows
|
||||
*/
|
||||
export const windows: boolean;
|
||||
|
||||
/**
|
||||
* true if the OS is Linux
|
||||
*/
|
||||
export const linux: boolean;
|
||||
|
||||
/**
|
||||
* true is the OS is FreeBSD
|
||||
*/
|
||||
export const freebsd: boolean;
|
||||
|
||||
/**
|
||||
* true is the os is macOS
|
||||
*/
|
||||
export const darwin: boolean;
|
||||
|
||||
/**
|
||||
* true is the os is SunOS
|
||||
*/
|
||||
export const sunos: boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is uppercased
|
||||
*/
|
||||
export function uppercase(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is lowercased
|
||||
*/
|
||||
export function lowercase(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string includes only digits
|
||||
*/
|
||||
export function digits(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is a valid js identifier
|
||||
*/
|
||||
export function identifier(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is a binary extension (7z, zip, mp3, etc)
|
||||
*/
|
||||
export function binaryExtension(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is a path to a binary file
|
||||
*/
|
||||
export function binaryPath(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is an IPv4 address
|
||||
*/
|
||||
export function ip4(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given string is an IPv6 address
|
||||
*/
|
||||
export function ip6(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an array buffer
|
||||
*/
|
||||
export function arrayBuffer(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an array buffer view
|
||||
*/
|
||||
export function arrayBufferView(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a date
|
||||
*/
|
||||
export function date(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an error, instance of Error
|
||||
*/
|
||||
export function error(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a map
|
||||
*/
|
||||
export function map(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a regexp
|
||||
*/
|
||||
export function regexp(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a set
|
||||
*/
|
||||
export function set(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a symbol
|
||||
*/
|
||||
export function symbol(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given buffer a valid UTF-8 encoded text
|
||||
*/
|
||||
export function validUTF8(obj: Buffer): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is a vault valuable
|
||||
*/
|
||||
export function vaultValuable(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone task
|
||||
*/
|
||||
export function task(obj: any): boolean;
|
||||
}
|
||||
}
|
||||
118
types/adone/glosses/math.d.ts
vendored
118
types/adone/glosses/math.d.ts
vendored
@ -1,118 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
759
types/adone/glosses/math/index.d.ts
vendored
Normal file
759
types/adone/glosses/math/index.d.ts
vendored
Normal file
@ -0,0 +1,759 @@
|
||||
/// <reference path="./matrix.d.ts" />
|
||||
/// <reference path="./simd.d.ts" />
|
||||
|
||||
declare namespace adone {
|
||||
/**
|
||||
* math related things
|
||||
*/
|
||||
namespace math {
|
||||
namespace I {
|
||||
interface LowHighBits {
|
||||
/**
|
||||
* The low (signed) 32 bits of the long
|
||||
*/
|
||||
low: number;
|
||||
/**
|
||||
* The high (signed) 32 bits of the long
|
||||
*/
|
||||
high: number;
|
||||
}
|
||||
type Longable = Long | number | string | LowHighBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a 64 bit two's-complement integer
|
||||
*/
|
||||
class Long {
|
||||
low: number;
|
||||
high: number;
|
||||
unsigned: boolean;
|
||||
|
||||
/**
|
||||
* @param low The low (signed) 32 bits of the long
|
||||
* @param high The high (signed) 32 bits of the long
|
||||
* @param unsigned Whether unsigned or not, defaults to false for signed
|
||||
*/
|
||||
constructor(low?: number, high?: number, unsigned?: boolean);
|
||||
|
||||
/**
|
||||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer
|
||||
*/
|
||||
toInt(): number;
|
||||
|
||||
/**
|
||||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa)
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Converts the Long to a string written in the specified radix
|
||||
*
|
||||
* @param radix Radix (2-36), 10 by default
|
||||
*/
|
||||
toString(radix?: number): string;
|
||||
|
||||
inspect(): string;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as a signed integer
|
||||
*/
|
||||
getHighBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as an unsigned integer
|
||||
*/
|
||||
getHighBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as a signed integer
|
||||
*/
|
||||
getLowBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as an unsigned integer
|
||||
*/
|
||||
getLowBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the number of bits needed to represent the absolute value of this Long
|
||||
*/
|
||||
getNumBitsAbs(): number;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals zero
|
||||
*/
|
||||
isZero(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is negative
|
||||
*/
|
||||
isNegative(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is positive
|
||||
*/
|
||||
isPositive(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is odd
|
||||
*/
|
||||
isOdd(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is even
|
||||
*/
|
||||
isEven(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's
|
||||
*/
|
||||
equals(other: I.Longable): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's
|
||||
*/
|
||||
lessThan(other: I.Longable): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's
|
||||
*/
|
||||
lessThanOrEqual(other: I.Longable): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's
|
||||
*/
|
||||
greaterThan(other: I.Longable): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's
|
||||
*/
|
||||
greaterThanOrEqual(other: I.Longable): boolean;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
* Returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
|
||||
*/
|
||||
compare(other: I.Longable): number;
|
||||
|
||||
/**
|
||||
* Negates this Long's value
|
||||
*/
|
||||
negate(): Long;
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the specified Long
|
||||
*/
|
||||
add(addend: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long
|
||||
*/
|
||||
sub(subtrahend: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long
|
||||
*/
|
||||
mul(multiplier: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified
|
||||
*/
|
||||
div(divisor: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified
|
||||
*/
|
||||
mod(divisor: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise NOT of this Long
|
||||
*/
|
||||
not(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise AND of this Long and the specified
|
||||
*/
|
||||
and(other: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise OR of this Long and the specifieds
|
||||
*/
|
||||
or(other: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise XOR of this Long and the given one
|
||||
*/
|
||||
xor(other: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount
|
||||
*/
|
||||
shl(numBits: number | Long): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount
|
||||
*/
|
||||
shr(numBits: number | Long): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount
|
||||
*/
|
||||
shru(numBits: number | Long): Long;
|
||||
|
||||
/**
|
||||
* Converts this Long to signed
|
||||
*/
|
||||
toSigned(): Long;
|
||||
|
||||
/**
|
||||
* Converts this Long to unsigned
|
||||
*/
|
||||
toUnsigned(): Long;
|
||||
|
||||
/**
|
||||
* Converts this Long to an array of bytes, big-endian by default
|
||||
*
|
||||
* @param le Whether to return an array in little-endian format
|
||||
*/
|
||||
toBytes(le?: boolean): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to an array of bytes in little-endian format
|
||||
*/
|
||||
toBytesLE(): number[];
|
||||
|
||||
/**
|
||||
* Converts this Long to an array of bytes in big-endian format
|
||||
*/
|
||||
toBytesBE(): number[];
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given 32 bit integer value
|
||||
*/
|
||||
static fromInt(value: number, unsigned?: boolean): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned
|
||||
*/
|
||||
static fromNumber(value?: number, unsigned?: boolean): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits
|
||||
*/
|
||||
static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix
|
||||
*/
|
||||
static fromString(str: string, unsigned?: boolean, radix?: number): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix
|
||||
*/
|
||||
static fromString(str: string, radix?: number): Long;
|
||||
|
||||
/**
|
||||
* Converts the specified value to a Long
|
||||
*/
|
||||
static fromValue(val: I.Longable): Long;
|
||||
|
||||
/**
|
||||
* Minimum signed value
|
||||
*/
|
||||
static MIN_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Maximum signed value
|
||||
*/
|
||||
static MAX_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Maximum unsigned value
|
||||
*/
|
||||
static MAX_UNSIGNED_VALUE: Long;
|
||||
|
||||
/**
|
||||
* Signed zero
|
||||
*/
|
||||
static ZERO: Long;
|
||||
|
||||
/**
|
||||
* Unsigned zero
|
||||
*/
|
||||
static UZERO: Long;
|
||||
|
||||
/**
|
||||
* Signed one
|
||||
*/
|
||||
static ONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned one
|
||||
*/
|
||||
static UONE: Long;
|
||||
|
||||
/**
|
||||
* Signed negative one
|
||||
*/
|
||||
static NEG_ONE: Long;
|
||||
}
|
||||
|
||||
namespace I.BigNumber {
|
||||
interface BufferConvertOptions {
|
||||
endian?: 1 | -1 | "big" | "little";
|
||||
size?: "auto" | number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a number of arbitrary precision
|
||||
*/
|
||||
class BigNumber {
|
||||
/**
|
||||
* Creates a BigNumber from the given value, the base is 10
|
||||
*/
|
||||
constructor(n: number | string | BigNumber);
|
||||
|
||||
/**
|
||||
* Creates a BigNumber from the given string and base
|
||||
*/
|
||||
constructor(n: string, base: number);
|
||||
|
||||
/**
|
||||
* Converts the number to a string in the given base
|
||||
*/
|
||||
toString(base?: number): string;
|
||||
|
||||
/**
|
||||
* Converts the bignum into a Number.
|
||||
* If the bignum is too big you'll lose precision or you'll get ±Infinity.
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Returns a new Buffer with the data from the bignum.
|
||||
*/
|
||||
toBuffer(opts?: I.BigNumber.BufferConvertOptions): Buffer;
|
||||
|
||||
/**
|
||||
* Returns a new bignum containing the instance value plus n
|
||||
*/
|
||||
add(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Return a new bignum containing the instance value minus n
|
||||
*/
|
||||
sub(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum containing the instance value multiplied by n
|
||||
*/
|
||||
mul(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum containing the instance value integrally divided by n
|
||||
*/
|
||||
div(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the absolute value of the instance
|
||||
*/
|
||||
abs(): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the negative of the instance value
|
||||
*/
|
||||
neg(): BigNumber;
|
||||
|
||||
/**
|
||||
* Compares the instance value to n.
|
||||
*
|
||||
* Returns a positive integer if > n, a negative integer if < n, and 0 if == n
|
||||
*/
|
||||
cmp(n: number | string | BigNumber): number;
|
||||
|
||||
/**
|
||||
* Checks whether the instance value is greater than n (> n).
|
||||
*/
|
||||
gt(n: number | string | BigNumber): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the instance value is greater than or equal to n (>= n).
|
||||
*/
|
||||
ge(n: number | string | BigNumber): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the instance value is equal to n (== n).
|
||||
*/
|
||||
eq(n: number | string | BigNumber): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the instance value is less than n (< n).
|
||||
*/
|
||||
lt(n: number | string | BigNumber): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether the instance value is less than or equal to n (<= n).
|
||||
*/
|
||||
le(n: number | string | BigNumber): boolean;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the instance value bitwise AND (&)-ed with n.
|
||||
*/
|
||||
and(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the instance value bitwise inclusive-OR (|)-ed with n.
|
||||
*/
|
||||
or(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the instance value bitwise exclusive-OR (^)-ed with n.
|
||||
*/
|
||||
xor(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the instance value modulo n.
|
||||
*/
|
||||
mod(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the instance value raised to the nth power.
|
||||
*/
|
||||
pow(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum with the instance value raised to the nth power modulo m.
|
||||
*/
|
||||
powm(n: number | string | BigNumber, m: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Computes the multiplicative inverse modulo m.
|
||||
*/
|
||||
invertm(m: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a random number from 0 to this -1
|
||||
*/
|
||||
rand(): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a random number from this to upperBound - 1
|
||||
*/
|
||||
rand(upperBound: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Checks whether the bignum is:
|
||||
*
|
||||
* - certainly prime (true)
|
||||
*
|
||||
* - probably prime ('maybe')
|
||||
*
|
||||
* - certainly composite (false)
|
||||
*/
|
||||
probPrime(): boolean | "maybe";
|
||||
|
||||
/**
|
||||
* Returns the next prime number after this bignum
|
||||
*/
|
||||
nextPrime(): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum that is the square root. This truncates.
|
||||
*/
|
||||
sqrt(): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum that is the nth root. This truncates.
|
||||
*/
|
||||
root(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum that is the 2^n multiple. Equivalent of the << operator.
|
||||
*/
|
||||
shiftLeft(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a new bignum of the value integer divided by 2^n. Equivalent of the >> operator.
|
||||
*/
|
||||
shiftRight(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns the greatest common divisor of the current bignum with n as a new bignum.
|
||||
*/
|
||||
gcd(n: number | string | BigNumber): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns the Jacobi symbol (or Legendre symbol if n is prime) of the current bignum (= a) over n.
|
||||
* Note that n must be odd and >= 3. 0 <= a < n.
|
||||
* Returns -1 or 1
|
||||
*/
|
||||
jacobi(n: number | string | BigNumber): number;
|
||||
|
||||
/**
|
||||
* Returns the number of bits used to represent the current bignum
|
||||
*/
|
||||
bitLength(): number;
|
||||
|
||||
/**
|
||||
* Checks whether the bit at the given index is set
|
||||
*/
|
||||
isBitSet(n: number): boolean;
|
||||
|
||||
/**
|
||||
* Generates a probable prime number of length bits.
|
||||
*
|
||||
* @param bits the number of bits
|
||||
* @param safe If true, it will be a "safe" prime of the form p=2p'+1 where p' is also prime. Default: true
|
||||
*/
|
||||
static prime(bits: number, safe?: boolean): BigNumber;
|
||||
|
||||
/**
|
||||
* Creates a new bignum from a Buffer.
|
||||
*/
|
||||
static fromBuffer(buf: Buffer, opts?: I.BigNumber.BufferConvertOptions): BigNumber;
|
||||
|
||||
/**
|
||||
* One
|
||||
*/
|
||||
static ONE: BigNumber;
|
||||
|
||||
/**
|
||||
* Zero
|
||||
*/
|
||||
static ZERO: BigNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a set of bits
|
||||
*/
|
||||
class BitSet {
|
||||
/**
|
||||
* Creates a new bitset of n bits
|
||||
*/
|
||||
constructor(n: number);
|
||||
|
||||
/**
|
||||
* Creates a new bitset from a dehydrated bitset
|
||||
*/
|
||||
constructor(key: string);
|
||||
|
||||
/**
|
||||
* Checks whether a bit at a specific index is set
|
||||
*/
|
||||
get(idx: number): boolean;
|
||||
|
||||
/**
|
||||
* Sets a single bit.
|
||||
* Returns true if set was successfull
|
||||
*/
|
||||
set(idx: number): boolean;
|
||||
|
||||
/**
|
||||
* Sets a range of bits.
|
||||
* Returns true if set was successfull
|
||||
*/
|
||||
setRange(from: number, to: number): boolean;
|
||||
|
||||
/**
|
||||
* Unsets a single bit.
|
||||
* Returns true if unset was successfull
|
||||
*/
|
||||
unset(idx: number): boolean;
|
||||
|
||||
/**
|
||||
* Unsets a range of bits.
|
||||
* Returns true if unset was successfull
|
||||
*/
|
||||
unsetRange(from: number, to: number): boolean;
|
||||
|
||||
/**
|
||||
* Toggles a single bit
|
||||
*/
|
||||
toggle(idx: number): boolean;
|
||||
|
||||
/**
|
||||
* Toggles a range of bits
|
||||
*/
|
||||
toggleRange(from: number, to: number): boolean;
|
||||
|
||||
/**
|
||||
* Clears the entire bitset
|
||||
*/
|
||||
clear(): boolean;
|
||||
|
||||
/**
|
||||
* Clones the set
|
||||
*/
|
||||
clone(): BitSet;
|
||||
|
||||
/**
|
||||
* Turns the bitset into a comma separated string that skips leading & trailing 0 words.
|
||||
* Ends with the number of leading 0s and MAX_BIT.
|
||||
* Useful if you need the bitset to be an object key (eg dynamic programming).
|
||||
* Can rehydrate by passing the result into the constructor
|
||||
*/
|
||||
dehydrate(): string;
|
||||
|
||||
/**
|
||||
* Performs a bitwise AND on 2 bitsets or 1 bitset and 1 index.
|
||||
* Both bitsets must have the same number of words, no length check is performed to prevent and overflow.
|
||||
*/
|
||||
and(value: number | BitSet): BitSet;
|
||||
|
||||
/**
|
||||
* Performs a bitwise OR on 2 bitsets or 1 bitset and 1 index.
|
||||
* Both bitsets must have the same number of words, no length check is performed to prevent and overflow.
|
||||
*/
|
||||
or(value: number | BitSet): BitSet;
|
||||
|
||||
/**
|
||||
* Performs a bitwise XOR on 2 bitsets or 1 bitset and 1 index.
|
||||
* Both bitsets must have the same number of words, no length check is performed to prevent and overflow.
|
||||
*/
|
||||
xor(value: number | BitSet): BitSet;
|
||||
|
||||
/**
|
||||
* Runs a custom function on every set bit.
|
||||
* Faster than iterating over the entire bitset with a get().
|
||||
* If the callback returns `false` it stops iterating.
|
||||
*/
|
||||
forEach(callback: ((idx: number) => void | boolean)): void;
|
||||
|
||||
/**
|
||||
* Performs a circular shift bitset by an offset
|
||||
*
|
||||
* @param n number of positions that the bitset that will be shifted to the right. Using a negative number will result in a left shift.
|
||||
*/
|
||||
circularShift(n: number): BitSet;
|
||||
|
||||
/**
|
||||
* Gets the cardinality (count of set bits) for the entire bitset
|
||||
*/
|
||||
getCardinality(): number;
|
||||
|
||||
/**
|
||||
* Gets the indices of all set bits
|
||||
*/
|
||||
getIndices(): number[];
|
||||
|
||||
/**
|
||||
* Checks if one bitset is subset of another.
|
||||
*/
|
||||
isSubsetOf(other: BitSet): boolean;
|
||||
|
||||
/**
|
||||
* Quickly determines if a bitset is empty
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* Quickly determines if both bitsets are equal (faster than checking if the XOR of the two is === 0).
|
||||
* Both bitsets must have the same number of words, no length check is performed to prevent and overflow.
|
||||
*/
|
||||
isEqual(other: BitSet): boolean;
|
||||
|
||||
/**
|
||||
* Gets a string representation of the entire bitset, including leading 0s
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Finds first set bit (useful for processing queues, breadth-first tree searches, etc.).
|
||||
* Returns -1 if not found
|
||||
*
|
||||
* @param startWord the word to start with (only used internally by nextSetBit)
|
||||
*/
|
||||
ffs(startWord?: number): number;
|
||||
|
||||
/**
|
||||
* Finds first zero (unset bit).
|
||||
* Returns -1 if not found
|
||||
*
|
||||
* @param startWord the word to start with (only used internally by nextUnsetBit)
|
||||
*/
|
||||
ffz(startWord?: number): number;
|
||||
|
||||
/**
|
||||
* Finds last set bit.
|
||||
* Returns -1 if not found
|
||||
*
|
||||
* @param startWord the word to start with (only used internally by previousSetBit)
|
||||
*/
|
||||
fls(startWord?: number): number;
|
||||
|
||||
/**
|
||||
* Finds last zero (unset bit).
|
||||
* Returns -1 if not found
|
||||
*
|
||||
* @param startWord the word to start with (only used internally by previousUnsetBit)
|
||||
*/
|
||||
flz(startWord?: number): number;
|
||||
|
||||
/**
|
||||
* Finds first set bit, starting at a given index.
|
||||
* Return -1 if not found
|
||||
*
|
||||
* @param idx the starting index for the next set bit
|
||||
*/
|
||||
nextSetBit(idx: number): number;
|
||||
|
||||
/**
|
||||
* Finds first unset bit, starting at a given index.
|
||||
* Return -1 if not found
|
||||
*
|
||||
* @param idx the starting index for the next unset bit
|
||||
*/
|
||||
nextUnsetBit(idx: number): number;
|
||||
|
||||
/**
|
||||
* Finds last set bit, up to a given index.
|
||||
* Returns -1 if not found
|
||||
*
|
||||
* @param idx the starting index for the next unset bit (going in reverse)
|
||||
*/
|
||||
previousSetBit(idx: number): number;
|
||||
|
||||
/**
|
||||
* Finds last unset bit, up to a given index.
|
||||
* Returns -1 if not found
|
||||
*/
|
||||
previousUnsetBit(idx: number): number;
|
||||
|
||||
/**
|
||||
* Converts the bitset to a math.Long number
|
||||
*/
|
||||
toLong(): Long;
|
||||
|
||||
/**
|
||||
* Reads an unsigned integer of the given bits from the given offset
|
||||
*
|
||||
* @param bits number of bits, 1 by default
|
||||
* @param offset offset, 0 by default
|
||||
*/
|
||||
readUInt(bits?: number, offset?: number): number;
|
||||
|
||||
/**
|
||||
* Writes the given unsigned integer
|
||||
*
|
||||
* @param val integer
|
||||
* @param bits number of bits to write, 1 by default
|
||||
* @param offset write offset, 0 by default
|
||||
*/
|
||||
writeUInt(val: number, bits?: number, offset?: number): void;
|
||||
|
||||
/**
|
||||
* Creates a new BitSet from the given math.Long number
|
||||
*/
|
||||
static fromLong(l: Long): BitSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random number from min to max - 1
|
||||
*
|
||||
* @param min lower bound, default is 0
|
||||
* @param max upper bound, default is 0xFFFFFFFF
|
||||
*/
|
||||
function random(min?: number, max?: number): number;
|
||||
}
|
||||
}
|
||||
3140
types/adone/glosses/math/matrix.d.ts
vendored
Normal file
3140
types/adone/glosses/math/matrix.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2053
types/adone/glosses/math/simd.d.ts
vendored
Normal file
2053
types/adone/glosses/math/simd.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
211
types/adone/glosses/promise.d.ts
vendored
211
types/adone/glosses/promise.d.ts
vendored
@ -1,114 +1,129 @@
|
||||
/**
|
||||
* promise helpers
|
||||
*/
|
||||
export namespace promise {
|
||||
namespace I {
|
||||
interface Deferred<T> {
|
||||
/**
|
||||
* Resolves the promise
|
||||
*/
|
||||
resolve(value?: T): void;
|
||||
declare namespace adone {
|
||||
/**
|
||||
* promise helpers
|
||||
*/
|
||||
namespace promise {
|
||||
namespace I {
|
||||
interface Deferred<T = any> {
|
||||
/**
|
||||
* Resolves the promise
|
||||
*/
|
||||
resolve(value?: T): void;
|
||||
|
||||
/**
|
||||
* Rejects the promise
|
||||
*/
|
||||
reject(value?: any): void;
|
||||
/**
|
||||
* Rejects the promise
|
||||
*/
|
||||
reject(value?: any): void;
|
||||
|
||||
promise: Promise<T>;
|
||||
promise: Promise<T>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a promise and returns an interface to control the state
|
||||
*/
|
||||
export function defer<T>(): I.Deferred<T>;
|
||||
/**
|
||||
* Creates a promise and returns an interface to control the state
|
||||
*/
|
||||
export function defer(): I.Deferred;
|
||||
|
||||
/**
|
||||
* 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 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>;
|
||||
/**
|
||||
* 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>;
|
||||
/**
|
||||
* 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 function that returns promises to a node.js style callback function
|
||||
*
|
||||
* @param {Function} fn Function
|
||||
* @returns {Promise} the original promise
|
||||
*/
|
||||
export function callbackify<R>(fn: () => Promise<R>): (callback: (err?: any, result?: R) => void) => Promise<R>;
|
||||
export function callbackify<T, R>(fn: (a: T) => Promise<R>): (a: T, callback: (err?: any, result?: R) => void) => Promise<R>;
|
||||
export function callbackify<T1, T2, R>(fn: (a: T1, b: T2) => Promise<R>): (a: T1, b: T2, callback: (err?: any, result?: R) => void) => Promise<R>;
|
||||
export function callbackify<T1, T2, T3, R>(fn: (a: T1, b: T2, c: T3) => Promise<R>): (a: T1, b: T2, c: T3, callback: (err?: any, result?: R) => void) => Promise<R>;
|
||||
export function callbackify<T1, T2, T3, T4, R>(fn: (a: T1, b: T2, c: T3, d: T4) => Promise<R>): (a: T1, b: T2, c: T3, d: T4, callback: (err?: any, result?: R) => void) => Promise<R>;
|
||||
export function callbackify<R>(fn: (...args: any[]) => Promise<R>): (...args: any[]) => Promise<R>;
|
||||
|
||||
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>;
|
||||
/**
|
||||
* 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, e: T5, 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;
|
||||
namespace I {
|
||||
interface PromisifyAllOptions {
|
||||
/**
|
||||
* Suffix to use for keys
|
||||
*/
|
||||
suffix?: string;
|
||||
|
||||
/**
|
||||
* Function to filter keys
|
||||
*/
|
||||
/**
|
||||
* Function to filter keys
|
||||
*/
|
||||
|
||||
filter?(key: string): boolean;
|
||||
/**
|
||||
* Context to bind to new functions
|
||||
*/
|
||||
context?: object;
|
||||
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 };
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 };
|
||||
}
|
||||
|
||||
3264
types/adone/glosses/shani.d.ts
vendored
3264
types/adone/glosses/shani.d.ts
vendored
File diff suppressed because it is too large
Load Diff
2
types/adone/glosses/std.d.ts
vendored
2
types/adone/glosses/std.d.ts
vendored
@ -63,3 +63,5 @@ export {
|
||||
timers,
|
||||
dgram,
|
||||
};
|
||||
|
||||
export as namespace nodestd;
|
||||
|
||||
223
types/adone/glosses/streams.d.ts
vendored
Normal file
223
types/adone/glosses/streams.d.ts
vendored
Normal file
@ -0,0 +1,223 @@
|
||||
declare namespace adone {
|
||||
namespace stream {
|
||||
namespace I.CoreStream {
|
||||
interface ConstructorOptions<S, T> {
|
||||
/**
|
||||
* Whether the initial stream is asynchronous
|
||||
*/
|
||||
async?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the initial stream is synchronous
|
||||
*/
|
||||
sync?: boolean;
|
||||
|
||||
/**
|
||||
* The initial transform (passthrough is default)
|
||||
*/
|
||||
transform?: TransformFunction<S, T>;
|
||||
|
||||
/**
|
||||
* The initial flush function
|
||||
*/
|
||||
flush?: FlushFunction<T>;
|
||||
}
|
||||
|
||||
type Source<S, T> = S[] | CoreStream<S, T>;
|
||||
|
||||
interface TransformContext<T> {
|
||||
/**
|
||||
* Pushes the given value into the stream
|
||||
*/
|
||||
push(value: T): boolean;
|
||||
}
|
||||
|
||||
type TransformFunction<S, T> = (this: TransformContext<T>, value: S) => void;
|
||||
type FlushFunction<T> = (this: TransformContext<T>) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a chain of transform streams
|
||||
*/
|
||||
class CoreStream<S = any, T = S> implements PromiseLike<T[]> {
|
||||
constructor(source?: I.CoreStream.Source<S, T>, options?: I.CoreStream.ConstructorOptions<S, T>);
|
||||
|
||||
/**
|
||||
* Writes the given value into the stream
|
||||
*/
|
||||
write(value: S): boolean;
|
||||
|
||||
/**
|
||||
* Pushes the given value into the stream
|
||||
*/
|
||||
push(value: T): boolean;
|
||||
|
||||
/**
|
||||
* Ends the stream
|
||||
*/
|
||||
end(): this;
|
||||
|
||||
/**
|
||||
* Destroys the stream
|
||||
*/
|
||||
destroy(): this;
|
||||
|
||||
/**
|
||||
* Pauses the stream
|
||||
*/
|
||||
pause(): this;
|
||||
|
||||
/**
|
||||
* Resumes the stream
|
||||
*/
|
||||
resume(): this;
|
||||
|
||||
/**
|
||||
* Whether the stream is paused
|
||||
*/
|
||||
isPaused(): boolean;
|
||||
|
||||
/**
|
||||
* Whether the stream is ended
|
||||
*/
|
||||
isEnded(): boolean;
|
||||
|
||||
/**
|
||||
* Pipes this stream to another
|
||||
*/
|
||||
pipe<T>(stream: T, options?: { end?: boolean }): T;
|
||||
|
||||
/**
|
||||
* Adds a new synchronous transform stream into the chain
|
||||
*/
|
||||
throughSync<R>(transform: I.CoreStream.TransformFunction<T, R>, flush?: I.CoreStream.FlushFunction<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new asynchronous transform stream into the chain
|
||||
*/
|
||||
throughAsync<R>(transform: I.CoreStream.TransformFunction<T, R>, flush?: I.CoreStream.FlushFunction<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new transform stream into the chain
|
||||
*/
|
||||
through<R>(transform: I.CoreStream.TransformFunction<T, R>, flush?: I.CoreStream.FlushFunction<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new map transform into the chain.
|
||||
*
|
||||
* Note: synchronous functions create a synchronous transform.
|
||||
* If your function returns a promise use an asynchronous function if you don't want to pass a promise through the stream
|
||||
*/
|
||||
map<R>(callback: (value: T) => R | Promise<R>): CoreStream<S, R>;
|
||||
|
||||
/**
|
||||
* Adds a new conditional map transform into the chain
|
||||
*/
|
||||
mapIf<R>(condition: (value: T) => boolean | Promise<boolean>, callback: (value: T) => R): CoreStream<S, T | R>;
|
||||
|
||||
/**
|
||||
* Adds a new filter transform into the chain
|
||||
*/
|
||||
filter(callback: (value: T) => boolean | Promise<boolean>): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that calls the given callback for each value from the stream.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
forEach(callback: (value: T) => void, options?: {
|
||||
/**
|
||||
* Whethe to wait for asynchronous functions (await)
|
||||
*/
|
||||
wait?: boolean,
|
||||
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that calls the given callback when the underlying stream ends.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
done(callback: () => void, options?: {
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that gather all the read values into an array and calls the given callback
|
||||
* when the underlying stream ends.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
toArray(callback: (result: T[]) => void, options?: {
|
||||
/**
|
||||
* Passthrough the read values, by default it eats everything
|
||||
*/
|
||||
passthrough?: boolean
|
||||
}): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that filters the values by their uniqueness
|
||||
*
|
||||
* @param prop callback that calculates value's hash which is used in uniqueness checks
|
||||
*/
|
||||
unique(prop?: (value: T) => any): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that filters the values using the given given function with ability to restore the filtered values
|
||||
*/
|
||||
stash(name: string, filter: (value: T) => boolean): this;
|
||||
stash(filter: (value: T) => boolean): this;
|
||||
|
||||
/**
|
||||
* Adds a new transform that restores the previous stashed values
|
||||
*/
|
||||
unstash(name?: string): CoreStream<S, T>; // ??
|
||||
|
||||
/**
|
||||
* Flattens all the read array values
|
||||
*/
|
||||
flatten(): CoreStream<S, T>; // ??
|
||||
|
||||
/**
|
||||
* Merges the given stream into a core stream
|
||||
*/
|
||||
static merge<S = any, T = S>(streams: Array<CoreStream<any, any> | nodestd.stream.Transform | nodestd.stream.Readable | nodestd.stream.Duplex>, options?: {
|
||||
/**
|
||||
* Whether to end the stream when all the given streams end
|
||||
*/
|
||||
end?: boolean,
|
||||
|
||||
/**
|
||||
* Options for the initial core stream
|
||||
*/
|
||||
sourceOptions?: I.CoreStream.ConstructorOptions<S, T>
|
||||
}): CoreStream<S, T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
then<T1 = T[], T2 = never>(onResolve?: (value: T[]) => T1 | PromiseLike<T1>, onReject?: (reason: any) => T2 | PromiseLike<T2>): Promise<T1 | T2>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be fulfilled with an array of all the emitted values or the first occurred error.
|
||||
*
|
||||
* This method resumes the stream.
|
||||
*/
|
||||
catch<T1 = never>(onReject?: (reason: any) => T1 | PromiseLike<T1>): Promise<T[] | T1>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CoreStream instance
|
||||
*/
|
||||
function core<S = any, T = S>(source?: I.CoreStream.Source<S, T>, options?: I.CoreStream.ConstructorOptions<S, T>): CoreStream<S, T>;
|
||||
}
|
||||
}
|
||||
969
types/adone/glosses/utils.d.ts
vendored
969
types/adone/glosses/utils.d.ts
vendored
File diff suppressed because it is too large
Load Diff
25
types/adone/index.d.ts
vendored
25
types/adone/index.d.ts
vendored
@ -4,6 +4,27 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import * as adone from "./adone";
|
||||
/// <reference path="./adone.d.ts" />
|
||||
/// <reference path="./glosses/application.d.ts" />
|
||||
/// <reference path="./glosses/archives.d.ts" />
|
||||
/// <reference path="./glosses/assertion.d.ts" />
|
||||
/// <reference path="./glosses/collections.d.ts" />
|
||||
/// <reference path="./glosses/compressors.d.ts" />
|
||||
/// <reference path="./glosses/data.d.ts" />
|
||||
/// <reference path="./glosses/datetime.d.ts" />
|
||||
/// <reference path="./glosses/events.d.ts" />
|
||||
/// <reference path="./glosses/exceptions.d.ts" />
|
||||
/// <reference path="./glosses/fast.d.ts" />
|
||||
/// <reference path="./glosses/fs.d.ts" />
|
||||
/// <reference path="./glosses/is.d.ts" />
|
||||
/// <reference path="./glosses/math/index.d.ts" />
|
||||
/// <reference path="./glosses/promise.d.ts" />
|
||||
/// <reference path="./glosses/shani.d.ts" />
|
||||
/// <reference path="./glosses/shani-global.d.ts" />
|
||||
/// <reference path="./glosses/std.d.ts" />
|
||||
/// <reference path="./glosses/streams.d.ts" />
|
||||
/// <reference path="./glosses/utils.d.ts" />
|
||||
|
||||
export default adone;
|
||||
declare const _adone: typeof adone;
|
||||
|
||||
export { _adone as adone };
|
||||
|
||||
292
types/adone/test/glosses/archives.ts
Normal file
292
types/adone/test/glosses/archives.ts
Normal file
@ -0,0 +1,292 @@
|
||||
namespace archivesTests {
|
||||
const { archive } = adone;
|
||||
|
||||
namespace tarTests {
|
||||
const { tar } = archive;
|
||||
|
||||
namespace rawPackStreamTests {
|
||||
const { RawPackStream } = tar;
|
||||
|
||||
new RawPackStream();
|
||||
new RawPackStream({});
|
||||
{
|
||||
const a: nodestd.stream.Writable = new RawPackStream().entry({
|
||||
type: "file",
|
||||
gid: 0,
|
||||
mode: 10,
|
||||
mtime: 10,
|
||||
name: "path",
|
||||
size: 10,
|
||||
uid: 10
|
||||
});
|
||||
}
|
||||
{
|
||||
const a = new RawPackStream().entry({
|
||||
type: "symlink",
|
||||
gid: 0,
|
||||
mode: 10,
|
||||
mtime: 10,
|
||||
name: "path",
|
||||
size: 10,
|
||||
uid: 10
|
||||
});
|
||||
a.linkname;
|
||||
}
|
||||
{
|
||||
const a: nodestd.stream.Writable = new RawPackStream().entry({
|
||||
type: "symlink",
|
||||
gid: 0,
|
||||
mode: 10,
|
||||
mtime: 10,
|
||||
name: "path",
|
||||
size: 10,
|
||||
uid: 10,
|
||||
linkname: "/"
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: nodestd.stream.Writable = new RawPackStream().entry({
|
||||
type: "file",
|
||||
gid: 0,
|
||||
mode: 10,
|
||||
mtime: 10,
|
||||
name: "path",
|
||||
size: 10,
|
||||
uid: 10
|
||||
}, (err: any) => {});
|
||||
}
|
||||
{
|
||||
const a: nodestd.stream.Writable = new RawPackStream().entry({
|
||||
name: "path"
|
||||
}, Buffer.from("hello"));
|
||||
}
|
||||
{
|
||||
const a: nodestd.stream.Writable = new RawPackStream().entry({
|
||||
type: "file",
|
||||
gid: 0,
|
||||
mode: 10,
|
||||
mtime: 10,
|
||||
name: "path",
|
||||
size: 10,
|
||||
uid: 10
|
||||
}, Buffer.from("hello"), (err: any) => {});
|
||||
}
|
||||
|
||||
new RawPackStream().finalize();
|
||||
|
||||
new RawPackStream().destroy();
|
||||
new RawPackStream().destroy(new Error());
|
||||
}
|
||||
|
||||
namespace rawUnpackStreamTest {
|
||||
const { RawUnpackStream } = tar;
|
||||
|
||||
type Header = adone.archive.tar.I.Header;
|
||||
type UnpackSourceStream = adone.archive.tar.I.UnpackSourceStream;
|
||||
type RawUnpackStream = adone.archive.tar.RawUnpackStream;
|
||||
|
||||
new RawUnpackStream();
|
||||
new RawUnpackStream().on("entry", (header: Header, stream: UnpackSourceStream, next) => {
|
||||
{ const a: string = header.type; }
|
||||
{ const a: string | undefined = header.linkname; }
|
||||
{ const a: number = header.mode; }
|
||||
{ const a: number = header.mtime; }
|
||||
{ const a: string = header.name; }
|
||||
{ const a: number = header.size; }
|
||||
{ const a: number = header.uid; }
|
||||
{ const a: number = header.gid; }
|
||||
{ const a: nodestd.stream.Readable = stream; }
|
||||
{ const a: RawUnpackStream = stream._parent; }
|
||||
next();
|
||||
next(123);
|
||||
});
|
||||
new RawUnpackStream().once("entry", (header: Header, stream: UnpackSourceStream, next) => {
|
||||
{ const a: string = header.type; }
|
||||
{ const a: string | undefined = header.linkname; }
|
||||
{ const a: number = header.mode; }
|
||||
{ const a: number = header.mtime; }
|
||||
{ const a: string = header.name; }
|
||||
{ const a: number = header.size; }
|
||||
{ const a: number = header.uid; }
|
||||
{ const a: number = header.gid; }
|
||||
{ const a: nodestd.stream.Readable = stream; }
|
||||
{ const a: RawUnpackStream = stream._parent; }
|
||||
next();
|
||||
next(123);
|
||||
});
|
||||
}
|
||||
|
||||
namespace packStreamTests {
|
||||
const { packStream } = tar;
|
||||
type RawPackStream = adone.archive.tar.RawPackStream;
|
||||
type Header = adone.archive.tar.I.Header;
|
||||
|
||||
{ const a: RawPackStream = packStream("."); }
|
||||
{ const a: RawPackStream = packStream(".", {}); }
|
||||
{ const a: RawPackStream = packStream(".", { dereference: true }); }
|
||||
{ const a: RawPackStream = packStream(".", { dmode: 0o777 }); }
|
||||
{ const a: RawPackStream = packStream(".", { entries: ["."] }); }
|
||||
{ const a: RawPackStream = packStream(".", { fmode: 0o777 }); }
|
||||
{ const a: RawPackStream = packStream(".", { ignore: (name: string) => true }); }
|
||||
{ const a: RawPackStream = packStream(".", { map: (header: Header) => header }); }
|
||||
{ const a: RawPackStream = packStream(".", { map: (header: Header) => undefined }); }
|
||||
{ const a: RawPackStream = packStream(".", { mapStream: (stream: nodestd.stream.Readable, header: Header) => stream }); }
|
||||
{ const a: RawPackStream = packStream(".", { mapStream: (stream: nodestd.stream.Readable, header: Header) => stream }); }
|
||||
{ const a: RawPackStream = packStream(".", { pack: new tar.RawPackStream() }); }
|
||||
{ const a: RawPackStream = packStream(".", { readable: false }); }
|
||||
{ const a: RawPackStream = packStream(".", { sort: true }); }
|
||||
{ const a: RawPackStream = packStream(".", { strict: false }); }
|
||||
{ const a: RawPackStream = packStream(".", { strip: 2 }); }
|
||||
{ const a: RawPackStream = packStream(".", { umask: 2 }); }
|
||||
{ const a: RawPackStream = packStream(".", { writable: false }); }
|
||||
}
|
||||
|
||||
namespace unpackStreamTests {
|
||||
const { unpackStream } = tar;
|
||||
type RawUnpackStream = adone.archive.tar.RawUnpackStream;
|
||||
type UnpackSourceStream = adone.archive.tar.I.UnpackSourceStream;
|
||||
type Header = adone.archive.tar.I.Header;
|
||||
|
||||
{ const a: RawUnpackStream = unpackStream("."); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", {}); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { chown: false }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { dmode: 0o777 }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { unpack: new tar.RawUnpackStream() }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { fmode: 0o755 }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { hardlinkAsFilesFallback: false }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { ignore: (name: string) => true }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { map: (header: Header) => header }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { map: (header: Header) => undefined }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { mapStream: (stream: UnpackSourceStream, header) => stream }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { readable: false }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { strip: 2 }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { umask: 2 }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { utimes: false }); }
|
||||
{ const a: RawUnpackStream = unpackStream(".", { writable: false }); }
|
||||
}
|
||||
}
|
||||
|
||||
namespace zipTests {
|
||||
const { zip } = archive;
|
||||
|
||||
namespace packTests {
|
||||
const { fs } = adone;
|
||||
const { pack } = zip;
|
||||
type ZipFile = adone.archive.zip.pack.ZipFile;
|
||||
|
||||
const file = new pack.ZipFile();
|
||||
{ const a: ZipFile = file.addBuffer(Buffer.from("buffer"), "file"); }
|
||||
{ const a: ZipFile = file.addBuffer(Buffer.from("buffer"), "file", {}); }
|
||||
{ const a: ZipFile = file.addBuffer(Buffer.from("buffer"), "file", { compress: true }); }
|
||||
{ const a: ZipFile = file.addBuffer(Buffer.from("buffer"), "file", { forceZip64Format: true }); }
|
||||
{ const a: ZipFile = file.addBuffer(Buffer.from("buffer"), "file", { mode: 0 }); }
|
||||
{ const a: ZipFile = file.addBuffer(Buffer.from("buffer"), "file", { mtime: 0 }); }
|
||||
|
||||
{ const a: ZipFile = file.addEmptyDirectory("hello"); }
|
||||
{ const a: ZipFile = file.addEmptyDirectory("hello", {}); }
|
||||
{ const a: ZipFile = file.addEmptyDirectory("hello", { mode: 0 }); }
|
||||
{ const a: ZipFile = file.addEmptyDirectory("hello", { mtime: 0 }); }
|
||||
|
||||
{ const a: ZipFile = file.addFile("hello", "hello"); }
|
||||
{ const a: ZipFile = file.addFile("hello", "hello", {}); }
|
||||
{ const a: ZipFile = file.addFile("hello", "hello", { compress: true }); }
|
||||
{ const a: ZipFile = file.addFile("hello", "hello", { forceZip64Format: false }); }
|
||||
{ const a: ZipFile = file.addFile("hello", "hello", { mode: 0o111 }); }
|
||||
{ const a: ZipFile = file.addFile("hello", "hello", { mtime: 13 }); }
|
||||
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello"); }
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello", {}); }
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello", { compress: true }); }
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello", { forceZip64Format: false }); }
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello", { mode: 0 }); }
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello", { mtime: 0 }); }
|
||||
{ const a: ZipFile = file.addReadStream(fs.createReadStream("a"), "hello", { size: 0 }); }
|
||||
|
||||
{ const a: nodestd.stream.Readable = file.outputStream; }
|
||||
file.end().then((x: number) => {});
|
||||
}
|
||||
|
||||
namespace unpackTests {
|
||||
const { unpack } = zip;
|
||||
const { fs } = adone;
|
||||
type ZipFile<T> = adone.archive.zip.unpack.I.ZipFile<T>;
|
||||
type Entry<T> = adone.archive.zip.unpack.I.Entry<T>;
|
||||
|
||||
{
|
||||
const a: ZipFile<string> = unpack.open("hello");
|
||||
{ const b: boolean = a.isOpen; }
|
||||
{ const b: number = a.entryCount; }
|
||||
{ const b: string = a.comment; }
|
||||
a.close();
|
||||
a.readEntry().then((x) => {});
|
||||
a.on("entry", async (entry: Entry<string>) => {
|
||||
{ const a: number = entry.versionMadeBy; }
|
||||
{ const a: number = entry.versionNeededToExtract; }
|
||||
{ const a: number = entry.generalPurposeBitFlag; }
|
||||
{ const a: number = entry.compressionMethod; }
|
||||
{ const a: number = entry.lastModFileDate; }
|
||||
{ const a: number = entry.lastModFileTime; }
|
||||
{ const a: number = entry.crc32; }
|
||||
{ const a: number = entry.compressedSize; }
|
||||
{ const a: number = entry.uncompressedSize; }
|
||||
{ const a: number = entry.fileNameLength; }
|
||||
{ const a: number = entry.extraFieldLength; }
|
||||
{ const a: number = entry.fileCommentLength; }
|
||||
{ const a: number = entry.internalFileAttributes; }
|
||||
{ const a: number = entry.externalFileAttributes; }
|
||||
{ const a: number = entry.relativeOffsetOfLocalHeader; }
|
||||
{ const a: Array<{ id: number, data: Buffer }> = entry.extraFields; }
|
||||
{ const a: string = entry.fileComment; }
|
||||
{ const a: string = entry.fileName; }
|
||||
{ const a: adone.I.datetime.Datetime = entry.getLastModDate(); }
|
||||
{ const a: boolean = entry.isEncrypted(); }
|
||||
{ const a: boolean = entry.isCompressed(); }
|
||||
{ const stream: nodestd.stream.Readable = await a.openReadStream(entry); }
|
||||
{ const stream: nodestd.stream.Readable = await a.openReadStream(entry, {}); }
|
||||
{ const stream: nodestd.stream.Readable = await a.openReadStream(entry, { decompress: true }); }
|
||||
{ const stream: nodestd.stream.Readable = await a.openReadStream(entry, { decrypt: false }); }
|
||||
{ const stream: nodestd.stream.Readable = await a.openReadStream(entry, { end: 0 }); }
|
||||
{ const stream: nodestd.stream.Readable = await a.openReadStream(entry, { start: 0 }); }
|
||||
});
|
||||
a.on("end", () => {});
|
||||
a.on("close", () => {});
|
||||
a.on("error", (e: any) => {});
|
||||
}
|
||||
{
|
||||
const a: ZipFile<Buffer> = unpack.open("hello", { decodeStrings: false });
|
||||
{ const b: Buffer = a.comment; }
|
||||
a.on("entry", (entry: Entry<Buffer>) => {
|
||||
{ const a: Buffer = entry.fileComment; }
|
||||
{ const a: Buffer = entry.fileName; }
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: ZipFile<string> = unpack.open("hello", {}); }
|
||||
{ const a: ZipFile<string> = unpack.open("hello", { autoClose: true }); }
|
||||
{ const a: ZipFile<string> = unpack.open("hello", { lazyEntries: true }); }
|
||||
{ const a: ZipFile<string> = unpack.open("hello", { validateEntrySizes: false }); }
|
||||
|
||||
{ const a: ZipFile<string> = unpack.fromBuffer(Buffer.from("123")); }
|
||||
{ const a: ZipFile<string> = unpack.fromBuffer(Buffer.from("123"), {}); }
|
||||
{ const a: ZipFile<Buffer> = unpack.fromBuffer(Buffer.from("123"), { decodeStrings: false }); }
|
||||
{ const a: ZipFile<string> = unpack.fromBuffer(Buffer.from("123"), { lazyEntries: false }); }
|
||||
{ const a: ZipFile<string> = unpack.fromBuffer(Buffer.from("123"), { validateEntrySizes: false }); }
|
||||
|
||||
{ const a: ZipFile<string> = unpack.fromFd(0); }
|
||||
{ const a: ZipFile<string> = unpack.fromFd(0, {}); }
|
||||
{ const a: ZipFile<string> = unpack.fromFd(0, { autoClose: false }); }
|
||||
{ const a: ZipFile<Buffer> = unpack.fromFd(0, { decodeStrings: false }); }
|
||||
{ const a: ZipFile<string> = unpack.fromFd(0, { lazyEntries: true }); }
|
||||
{ const a: ZipFile<string> = unpack.fromFd(0, { validateEntrySizes: false }); }
|
||||
|
||||
{ const a: ZipFile<string> = unpack.fromRandomAccessReader(new fs.RandomAccessBufferReader(Buffer.from("asd")), 1); }
|
||||
{ const a: ZipFile<string> = unpack.fromRandomAccessReader(new fs.RandomAccessBufferReader(Buffer.from("asd")), 1, {}); }
|
||||
{ const a: ZipFile<string> = unpack.fromRandomAccessReader(new fs.RandomAccessBufferReader(Buffer.from("asd")), 1, { autoClose: false }); }
|
||||
{ const a: ZipFile<Buffer> = unpack.fromRandomAccessReader(new fs.RandomAccessBufferReader(Buffer.from("asd")), 1, { decodeStrings: false }); }
|
||||
{ const a: ZipFile<string> = unpack.fromRandomAccessReader(new fs.RandomAccessBufferReader(Buffer.from("asd")), 1, { lazyEntries: false }); }
|
||||
{ const a: ZipFile<string> = unpack.fromRandomAccessReader(new fs.RandomAccessBufferReader(Buffer.from("asd")), 1, { validateEntrySizes: false }); }
|
||||
|
||||
{ const a: string | null = unpack.validateFileName("hello"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
1003
types/adone/test/glosses/collections.ts
Normal file
1003
types/adone/test/glosses/collections.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,808 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
626
types/adone/test/glosses/compressors.ts
Normal file
626
types/adone/test/glosses/compressors.ts
Normal file
@ -0,0 +1,626 @@
|
||||
namespace compressorsTests {
|
||||
const { compressor } = adone;
|
||||
|
||||
namespace gzTests {
|
||||
const { gz } = compressor;
|
||||
|
||||
gz.compress("hello").then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { chunkSize: 4096 }).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { finishFlush: gz.Z_FINISH }).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { flush: gz.Z_NO_FLUSH }).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { info: true }).then((x: { buffer: Buffer, engine: nodestd.zlib.Gzip }) => {});
|
||||
gz.compress(Buffer.from("hello"), { level: gz.Z_BEST_COMPRESSION }).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { memLevel: gz.Z_BEST_COMPRESSION }).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { strategy: gz.Z_HUFFMAN_ONLY }).then((x: Buffer) => {});
|
||||
gz.compress(Buffer.from("hello"), { windowBits: 10 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = gz.compressSync("hello"); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { chunkSize: 4096 }); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { finishFlush: gz.Z_FINISH }); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { flush: gz.Z_NO_FLUSH }); }
|
||||
{ const a: { buffer: Buffer, engine: nodestd.zlib.Gzip } = gz.compressSync(Buffer.from("hello"), { info: true }); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { level: gz.Z_BEST_COMPRESSION }); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { memLevel: gz.Z_BEST_COMPRESSION }); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { strategy: gz.Z_HUFFMAN_ONLY }); }
|
||||
{ const a: Buffer = gz.compressSync(Buffer.from("hello"), { windowBits: 10 }); }
|
||||
|
||||
gz.decompress("hello").then((x: Buffer) => {});
|
||||
gz.decompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
gz.decompress(Buffer.from("hello"), { chunkSize: 4096 }).then((x: Buffer) => {});
|
||||
gz.decompress(Buffer.from("hello"), { finishFlush: gz.Z_FINISH }).then((x: Buffer) => {});
|
||||
gz.decompress(Buffer.from("hello"), { flush: gz.Z_NO_FLUSH }).then((x: Buffer) => {});
|
||||
gz.decompress(Buffer.from("hello"), { info: true }).then((x: { buffer: Buffer, engine: nodestd.zlib.Gunzip }) => {});
|
||||
gz.decompress(Buffer.from("hello"), { windowBits: 9 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = gz.decompressSync("hello"); }
|
||||
{ const a: Buffer = gz.decompressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = gz.decompressSync(Buffer.from("hello"), { chunkSize: 4096 }); }
|
||||
{ const a: Buffer = gz.decompressSync(Buffer.from("hello"), { finishFlush: gz.Z_FINISH }); }
|
||||
{ const a: Buffer = gz.decompressSync(Buffer.from("hello"), { flush: gz.Z_NO_FLUSH }); }
|
||||
{ const a: { buffer: Buffer, engine: nodestd.zlib.Gunzip } = gz.decompressSync(Buffer.from("hello"), { info: true }); }
|
||||
{ const a: Buffer = gz.decompressSync(Buffer.from("hello"), { windowBits: 9 }); }
|
||||
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream(); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({}); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({ chunkSize: 10 }); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({ flush: 10 }); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({ level: 9 }); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({ memLevel: 9 }); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({ strategy: 9 }); }
|
||||
{ const a: nodestd.zlib.Gzip = gz.compressStream({ windowBits: 9 }); }
|
||||
|
||||
{ const a: nodestd.zlib.Gunzip = gz.decompressStream(); }
|
||||
{ const a: nodestd.zlib.Gunzip = gz.decompressStream({}); }
|
||||
{ const a: nodestd.zlib.Gunzip = gz.decompressStream({ chunkSize: 4096 }); }
|
||||
{ const a: nodestd.zlib.Gunzip = gz.decompressStream({ flush: 0 }); }
|
||||
{ const a: nodestd.zlib.Gunzip = gz.decompressStream({ windowBits: 0 }); }
|
||||
|
||||
{ const a: number = gz.Z_NO_FLUSH; }
|
||||
{ const a: number = gz.Z_PARTIAL_FLUSH; }
|
||||
{ const a: number = gz.Z_SYNC_FLUSH; }
|
||||
{ const a: number = gz.Z_FULL_FLUSH; }
|
||||
{ const a: number = gz.Z_FINISH; }
|
||||
{ const a: number = gz.Z_BLOCK; }
|
||||
{ const a: number = gz.Z_TREES; }
|
||||
{ const a: number = gz.Z_OK; }
|
||||
{ const a: number = gz.Z_STREAM_END; }
|
||||
{ const a: number = gz.Z_NEED_DICT; }
|
||||
{ const a: number = gz.Z_ERRNO; }
|
||||
{ const a: number = gz.Z_STREAM_ERROR; }
|
||||
{ const a: number = gz.Z_DATA_ERROR; }
|
||||
{ const a: number = gz.Z_MEM_ERROR; }
|
||||
{ const a: number = gz.Z_BUF_ERROR; }
|
||||
{ const a: number = gz.Z_VERSION_ERROR; }
|
||||
{ const a: number = gz.Z_NO_COMPRESSION; }
|
||||
{ const a: number = gz.Z_BEST_SPEED; }
|
||||
{ const a: number = gz.Z_BEST_COMPRESSION; }
|
||||
{ const a: number = gz.Z_DEFAULT_COMPRESSION; }
|
||||
{ const a: number = gz.Z_FILTERED; }
|
||||
{ const a: number = gz.Z_HUFFMAN_ONLY; }
|
||||
{ const a: number = gz.Z_RLE; }
|
||||
{ const a: number = gz.Z_FIXED; }
|
||||
{ const a: number = gz.Z_DEFAULT_STRATEGY; }
|
||||
}
|
||||
|
||||
namespace deflateTests {
|
||||
const { deflate } = compressor;
|
||||
|
||||
deflate.compress("hello").then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { chunkSize: 4096 }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { dictionary: Buffer.from("123") }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { finishFlush: 0 }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { flush: 0 }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { info: true }).then((x: { buffer: Buffer, engine: nodestd.zlib.Deflate }) => {});
|
||||
deflate.compress(Buffer.from("hello"), { level: 0 }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { memLevel: 0 }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { strategy: 0 }).then((x: Buffer) => {});
|
||||
deflate.compress(Buffer.from("hello"), { windowBits: 0 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = deflate.compressSync("hello"); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { chunkSize: 4096 }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { dictionary: Buffer.from("123") }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { finishFlush: 0 }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { flush: 0 }); }
|
||||
{ const a: { buffer: Buffer, engine: nodestd.zlib.Deflate } = deflate.compressSync(Buffer.from("hello"), { info: true }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { level: 0 }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { memLevel: 0 }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { strategy: 0 }); }
|
||||
{ const a: Buffer = deflate.compressSync(Buffer.from("hello"), { windowBits: 0 }); }
|
||||
|
||||
deflate.rawCompress("hello").then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { chunkSize: 4096 }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { dictionary: Buffer.from("123") }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { finishFlush: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { flush: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { info: true }).then((x: { buffer: Buffer, engine: nodestd.zlib.DeflateRaw }) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { level: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { memLevel: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { strategy: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawCompress(Buffer.from("hello"), { windowBits: 0 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = deflate.rawCompressSync("hello"); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { chunkSize: 4096 }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { dictionary: Buffer.from("123") }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { finishFlush: 0 }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { flush: 0 }); }
|
||||
{ const a: { buffer: Buffer, engine: nodestd.zlib.DeflateRaw } = deflate.rawCompressSync(Buffer.from("hello"), { info: true }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { level: 0 }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { memLevel: 0 }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { strategy: 0 }); }
|
||||
{ const a: Buffer = deflate.rawCompressSync(Buffer.from("hello"), { windowBits: 0 }); }
|
||||
|
||||
deflate.decompress("hello").then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello"), { chunkSize: 4096 }).then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello"), { dictionary: Buffer.from("123") }).then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello"), { finishFlush: 0 }).then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello"), { flush: 0 }).then((x: Buffer) => {});
|
||||
deflate.decompress(Buffer.from("hello"), { info: true }).then((x: { buffer: Buffer, engine: nodestd.zlib.Inflate }) => {});
|
||||
deflate.decompress(Buffer.from("hello"), { windowBits: 0 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = deflate.decompressSync("hello"); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello"), { chunkSize: 4096 }); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello"), { dictionary: Buffer.from("123") }); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello"), { finishFlush: 0 }); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello"), { flush: 0 }); }
|
||||
{ const a: { buffer: Buffer, engine: nodestd.zlib.Inflate } = deflate.decompressSync(Buffer.from("hello"), { info: true }); }
|
||||
{ const a: Buffer = deflate.decompressSync(Buffer.from("hello"), { windowBits: 0 }); }
|
||||
|
||||
deflate.rawDecompress("hello").then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), { chunkSize: 4096 }).then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), { dictionary: Buffer.from("123") }).then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), { finishFlush: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), { flush: 0 }).then((x: Buffer) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), { info: true }).then((x: { buffer: Buffer, engine: nodestd.zlib.InflateRaw }) => {});
|
||||
deflate.rawDecompress(Buffer.from("hello"), { windowBits: 0 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = deflate.rawDecompressSync("hello"); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello"), { chunkSize: 4096 }); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello"), { dictionary: Buffer.from("123") }); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello"), { finishFlush: 0 }); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello"), { flush: 0 }); }
|
||||
{ const a: { buffer: Buffer, engine: nodestd.zlib.Inflate } = deflate.rawDecompressSync(Buffer.from("hello"), { info: true }); }
|
||||
{ const a: Buffer = deflate.rawDecompressSync(Buffer.from("hello"), { windowBits: 0 }); }
|
||||
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream(); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({}); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ chunkSize: 0 }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ dictionary: Buffer.from("123") }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ finishFlush: 0 }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ flush: 0 }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ level: 0 }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ memLevel: 0 }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ strategy: 0 }); }
|
||||
{ const a: nodestd.zlib.Deflate = deflate.compressStream({ windowBits: 0 }); }
|
||||
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream(); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({}); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ chunkSize: 0 }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ dictionary: Buffer.from("123") }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ finishFlush: 0 }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ flush: 0 }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ level: 0 }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ memLevel: 0 }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ strategy: 0 }); }
|
||||
{ const a: nodestd.zlib.DeflateRaw = deflate.rawCompressStream({ windowBits: 0 }); }
|
||||
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream(); }
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream({}); }
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream({ chunkSize: 0 }); }
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream({ dictionary: Buffer.from("123") }); }
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream({ finishFlush: 0 }); }
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream({ flush: 0 }); }
|
||||
{ const a: nodestd.zlib.Inflate = deflate.decompressStream({ windowBits: 0 }); }
|
||||
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream(); }
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream({}); }
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream({ chunkSize: 0 }); }
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream({ dictionary: Buffer.from("123") }); }
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream({ finishFlush: 0 }); }
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream({ flush: 0 }); }
|
||||
{ const a: nodestd.zlib.InflateRaw = deflate.rawDecompressStream({ windowBits: 0 }); }
|
||||
|
||||
{ const a: number = deflate.Z_NO_FLUSH; }
|
||||
{ const a: number = deflate.Z_PARTIAL_FLUSH; }
|
||||
{ const a: number = deflate.Z_SYNC_FLUSH; }
|
||||
{ const a: number = deflate.Z_FULL_FLUSH; }
|
||||
{ const a: number = deflate.Z_FINISH; }
|
||||
{ const a: number = deflate.Z_BLOCK; }
|
||||
{ const a: number = deflate.Z_TREES; }
|
||||
{ const a: number = deflate.Z_OK; }
|
||||
{ const a: number = deflate.Z_STREAM_END; }
|
||||
{ const a: number = deflate.Z_NEED_DICT; }
|
||||
{ const a: number = deflate.Z_ERRNO; }
|
||||
{ const a: number = deflate.Z_STREAM_ERROR; }
|
||||
{ const a: number = deflate.Z_DATA_ERROR; }
|
||||
{ const a: number = deflate.Z_MEM_ERROR; }
|
||||
{ const a: number = deflate.Z_BUF_ERROR; }
|
||||
{ const a: number = deflate.Z_VERSION_ERROR; }
|
||||
{ const a: number = deflate.Z_NO_COMPRESSION; }
|
||||
{ const a: number = deflate.Z_BEST_SPEED; }
|
||||
{ const a: number = deflate.Z_BEST_COMPRESSION; }
|
||||
{ const a: number = deflate.Z_DEFAULT_COMPRESSION; }
|
||||
{ const a: number = deflate.Z_FILTERED; }
|
||||
{ const a: number = deflate.Z_HUFFMAN_ONLY; }
|
||||
{ const a: number = deflate.Z_RLE; }
|
||||
{ const a: number = deflate.Z_FIXED; }
|
||||
{ const a: number = deflate.Z_DEFAULT_STRATEGY; }
|
||||
}
|
||||
|
||||
namespace brotliTests {
|
||||
const { brotli } = compressor;
|
||||
|
||||
brotli.compress("hello").then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { dictionary: Buffer.from("123") }).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { disable_literal_context_modeling: true }).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { lgblock: 0 }).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { lgwin: 0 }).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { mode: 0 }).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { quality: 0 }).then((x: Buffer) => {});
|
||||
brotli.compress(Buffer.from("hello"), { size_hint: 0 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = brotli.compressSync("hello"); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { dictionary: Buffer.from("123") }); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { disable_literal_context_modeling: true }); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { lgblock: 0 }); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { lgwin: 0 }); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { mode: 0 }); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { quality: 0 }); }
|
||||
{ const a: Buffer = brotli.compressSync(Buffer.from("hello"), { size_hint: 0 }); }
|
||||
|
||||
brotli.decompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
brotli.decompress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
brotli.decompress(Buffer.from("hello"), { dictionary: Buffer.from("123") }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = brotli.decompressSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = brotli.decompressSync(Buffer.from("hello"), {}); }
|
||||
{ const a: Buffer = brotli.decompressSync(Buffer.from("hello"), { dictionary: Buffer.from("123") }); }
|
||||
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream(); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({}); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ dictionary: Buffer.from("123") }); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ disable_literal_context_modeling: true }); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ lgblock: 0 }); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ lgwin: 0 }); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ mode: 0 }); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ quality: 0 }); }
|
||||
{ const a: nodestd.stream.Transform = brotli.compressStream({ size_hint: 0 }); }
|
||||
|
||||
{ const a: nodestd.stream.Transform = brotli.decompressStream(); }
|
||||
{ const a: nodestd.stream.Transform = brotli.decompressStream({}); }
|
||||
{ const a: nodestd.stream.Transform = brotli.decompressStream({ dictionary: Buffer.from("123") }); }
|
||||
}
|
||||
|
||||
namespace snappyTests {
|
||||
const { snappy } = compressor;
|
||||
|
||||
snappy.compress("hello").then((x: Buffer) => {});
|
||||
snappy.compress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Buffer = snappy.compressSync("hello"); }
|
||||
{ const a: Buffer = snappy.compressSync(Buffer.from("hello")); }
|
||||
|
||||
snappy.isValidCompressed(Buffer.from("123")).then((X: boolean) => {});
|
||||
{ const a: boolean = snappy.isValidCompressedSync(Buffer.from("123")); }
|
||||
|
||||
snappy.decompress(Buffer.from("123")).then((x: Buffer) => {});
|
||||
{ const a: Buffer = snappy.decompressSync(Buffer.from("123")); }
|
||||
}
|
||||
|
||||
namespace lzmaTests {
|
||||
const { lzma } = compressor;
|
||||
type Stream = adone.compressor.I.lzma.Stream;
|
||||
|
||||
{ const a: boolean = lzma.asyncCodeAvailable; }
|
||||
{ const a: number = lzma.versionNumber(); }
|
||||
{ const a: string = lzma.versionString(); }
|
||||
{ const a: boolean = lzma.checkIsSupported(lzma.CHECK_CRC32); }
|
||||
{ const a: number = lzma.checkSize(lzma.CHECK_CRC32); }
|
||||
{ const a: boolean = lzma.filterDecoderIsSupported(lzma.FILTER_ARM); }
|
||||
{ const a: boolean = lzma.filterEncoderIsSupported(lzma.FILTER_ARM); }
|
||||
{ const a: boolean = lzma.mfIsSupported(lzma.MF_BT2); }
|
||||
{ const a: number = lzma.rawEncoderMemusage([{ id: "LZMA_FILTER_DELTA", dist: 1 }]); }
|
||||
{ const a: number = lzma.rawDecoderMemusage([{ id: "LZMA_FILTER_DELTA", dist: 1 }]); }
|
||||
{ const a: number = lzma.easyEncoderMemusage(lzma.PRESET_DEFAULT); }
|
||||
{ const a: number = lzma.easyDecoderMemusage(lzma.PRESET_EXTREME); }
|
||||
|
||||
{
|
||||
const a: Stream = lzma.createStream("easyEncoder");
|
||||
{ const b: number = a.bufsize; }
|
||||
{ const b: number = a.totalIn(); }
|
||||
{ const b: number = a.totalOut(); }
|
||||
a.cleanup();
|
||||
a.push("1");
|
||||
a.write("1");
|
||||
a.end();
|
||||
a.destroy();
|
||||
}
|
||||
{ const a: Stream = lzma.createStream("easyEncoder", lzma.PRESET_DEFAULT); }
|
||||
{ const a: Stream = lzma.createStream("easyEncoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("easyEncoder", { check: lzma.CHECK_CRC32 }); }
|
||||
{ const a: Stream = lzma.createStream("easyEncoder", { preset: lzma.PRESET_EXTREME }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("autoDecoder"); }
|
||||
{ const a: Stream = lzma.createStream("autoDecoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("autoDecoder", { flags: lzma.LZMA_TELL_NO_CHECK }); }
|
||||
{ const a: Stream = lzma.createStream("autoDecoder", { memlimit: 1000 }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder"); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", lzma.PRESET_DEFAULT); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { blockSize: 4096 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { bufsize: 100 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { check: 0 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { flags: 0 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { memlimit: 0 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { preset: 1 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { synchronous: true }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { threads: 10 }); }
|
||||
{ const a: Stream = lzma.createStream("aloneEncoder", { timeout: 1 }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("aloneDecoder"); }
|
||||
{ const a: Stream = lzma.createStream("aloneDecoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("aloneDecoder", { memlimit: 1000 }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("rawEncoder"); }
|
||||
{ const a: Stream = lzma.createStream("rawEncoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("rawEncoder", { filters: [{ id: "LZMA_FILTER_DELTA" }] }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("rawDecoder"); }
|
||||
{ const a: Stream = lzma.createStream("rawDecoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("rawDecoder", { filters: [{ id: "LZMA_FILTER_DELTA" }] }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("streamEncoder"); }
|
||||
{ const a: Stream = lzma.createStream("streamEncoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("streamEncoder", { check: lzma.CHECK_CRC64 }); }
|
||||
{ const a: Stream = lzma.createStream("streamEncoder", { filters: [{ id: "LZMA_FILTER_DELTA" }] }); }
|
||||
|
||||
{ const a: Stream = lzma.createStream("streamDecoder"); }
|
||||
{ const a: Stream = lzma.createStream("streamDecoder", {}); }
|
||||
{ const a: Stream = lzma.createStream("streamDecoder", { flags: lzma.LZMA_CONCATENATED }); }
|
||||
{ const a: Stream = lzma.createStream("streamDecoder", { memlimit: 100 }); }
|
||||
|
||||
lzma.singleStringCoding(
|
||||
lzma.createStream("streamDecoder"),
|
||||
"hello"
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
lzma.singleStringCoding(
|
||||
lzma.createStream("streamDecoder"),
|
||||
Buffer.from("hello")
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
lzma.singleStringCoding(
|
||||
lzma.createStream("streamDecoder"),
|
||||
"hello",
|
||||
(err: any, data: Buffer) => {}
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
lzma.singleStringCoding(
|
||||
lzma.createStream("streamDecoder"),
|
||||
"hello",
|
||||
(err: any, data: Buffer) => {},
|
||||
(x: number) => {}
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
{ const a: number = lzma.CHECK_CRC32; }
|
||||
{ const a: number = lzma.CHECK_CRC64; }
|
||||
{ const a: number = lzma.CHECK_NONE; }
|
||||
{ const a: number = lzma.CHECK_SHA256; }
|
||||
{ const a: string = lzma.FILTERS_MAX; }
|
||||
{ const a: string = lzma.FILTER_ARM; }
|
||||
{ const a: string = lzma.FILTER_ARMTHUMB; }
|
||||
{ const a: string = lzma.FILTER_IA64; }
|
||||
{ const a: string = lzma.FILTER_POWERPC; }
|
||||
{ const a: string = lzma.FILTER_SPARC; }
|
||||
{ const a: string = lzma.FILTER_X86; }
|
||||
{ const a: string = lzma.FILTER_DELTA; }
|
||||
{ const a: string = lzma.FILTER_LZMA1; }
|
||||
{ const a: string = lzma.FILTER_LZMA2; }
|
||||
{ const a: number = lzma.PRESET_EXTREME; }
|
||||
{ const a: number = lzma.PRESET_DEFAULT; }
|
||||
{ const a: number = lzma.PRESET_LEVEL_MASK; }
|
||||
{ const a: number = lzma.MF_HC3; }
|
||||
{ const a: number = lzma.MF_HC4; }
|
||||
{ const a: number = lzma.MF_BT2; }
|
||||
{ const a: number = lzma.MF_BT3; }
|
||||
{ const a: number = lzma.MF_BT4; }
|
||||
{ const a: number = lzma.LZMA_TELL_NO_CHECK; }
|
||||
{ const a: number = lzma.LZMA_TELL_UNSUPPORTED_CHECK; }
|
||||
{ const a: number = lzma.LZMA_TELL_ANY_CHECK; }
|
||||
{ const a: number = lzma.LZMA_CONCATENATED; }
|
||||
{ const a: number = lzma.MODE_FAST; }
|
||||
{ const a: number = lzma.MODE_NORMAL; }
|
||||
{ const a: number = lzma.STREAM_HEADER_SIZE; }
|
||||
|
||||
lzma.compress("hello").then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), lzma.PRESET_DEFAULT).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { blockSize: 4096 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { bufsize: 0 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { check: 0 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { filters: [{ id: "LZMA_FILTER_ARMTHUMB" }] }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { flags: 0 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { memlimit: 0 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { preset: 0 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { synchronous: false }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { threads: 10 }).then((x: Buffer) => {});
|
||||
lzma.compress(Buffer.from("hello"), { timeout: 10 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Stream = lzma.compressStream(); }
|
||||
{ const a: Stream = lzma.compressStream(lzma.PRESET_DEFAULT); }
|
||||
{ const a: Stream = lzma.compressStream({}); }
|
||||
{ const a: Stream = lzma.compressStream({ blockSize: 4096 }); }
|
||||
{ const a: Stream = lzma.compressStream({ bufsize: 0 }); }
|
||||
{ const a: Stream = lzma.compressStream({ check: 0 }); }
|
||||
{ const a: Stream = lzma.compressStream({ filters: [{ id: "LZMA_FILTER_ARMTHUMB" }] }); }
|
||||
{ const a: Stream = lzma.compressStream({ flags: 0 }); }
|
||||
{ const a: Stream = lzma.compressStream({ memlimit: 0 }); }
|
||||
{ const a: Stream = lzma.compressStream({ preset: 0 }); }
|
||||
{ const a: Stream = lzma.compressStream({ synchronous: false }); }
|
||||
{ const a: Stream = lzma.compressStream({ threads: 10 }); }
|
||||
{ const a: Stream = lzma.compressStream({ timeout: 10 }); }
|
||||
|
||||
lzma.decompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
lzma.decompress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
lzma.decompress(Buffer.from("hello"), { memlimit: 100 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Stream = lzma.decompressStream(); }
|
||||
{ const a: Stream = lzma.decompressStream({}); }
|
||||
{ const a: Stream = lzma.decompressStream({ memlimit: 100 }); }
|
||||
}
|
||||
|
||||
namespace xzTests {
|
||||
const { xz } = compressor;
|
||||
type Stream = adone.compressor.I.lzma.Stream;
|
||||
|
||||
{ const a: boolean = xz.asyncCodeAvailable; }
|
||||
{ const a: number = xz.versionNumber(); }
|
||||
{ const a: string = xz.versionString(); }
|
||||
{ const a: boolean = xz.checkIsSupported(xz.CHECK_CRC32); }
|
||||
{ const a: number = xz.checkSize(xz.CHECK_CRC32); }
|
||||
{ const a: boolean = xz.filterDecoderIsSupported(xz.FILTER_ARM); }
|
||||
{ const a: boolean = xz.filterEncoderIsSupported(xz.FILTER_ARM); }
|
||||
{ const a: boolean = xz.mfIsSupported(xz.MF_BT2); }
|
||||
{ const a: number = xz.rawEncoderMemusage([{ id: "LZMA_FILTER_DELTA", dist: 1 }]); }
|
||||
{ const a: number = xz.rawDecoderMemusage([{ id: "LZMA_FILTER_DELTA", dist: 1 }]); }
|
||||
{ const a: number = xz.easyEncoderMemusage(xz.PRESET_DEFAULT); }
|
||||
{ const a: number = xz.easyDecoderMemusage(xz.PRESET_EXTREME); }
|
||||
|
||||
{
|
||||
const a: Stream = xz.createStream("easyEncoder");
|
||||
{ const b: number = a.bufsize; }
|
||||
{ const b: number = a.totalIn(); }
|
||||
{ const b: number = a.totalOut(); }
|
||||
a.cleanup();
|
||||
a.push("1");
|
||||
a.write("1");
|
||||
a.end();
|
||||
a.destroy();
|
||||
}
|
||||
{ const a: Stream = xz.createStream("easyEncoder", xz.PRESET_DEFAULT); }
|
||||
{ const a: Stream = xz.createStream("easyEncoder", {}); }
|
||||
{ const a: Stream = xz.createStream("easyEncoder", { check: xz.CHECK_CRC32 }); }
|
||||
{ const a: Stream = xz.createStream("easyEncoder", { preset: xz.PRESET_EXTREME }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("autoDecoder"); }
|
||||
{ const a: Stream = xz.createStream("autoDecoder", {}); }
|
||||
{ const a: Stream = xz.createStream("autoDecoder", { flags: xz.LZMA_TELL_NO_CHECK }); }
|
||||
{ const a: Stream = xz.createStream("autoDecoder", { memlimit: 1000 }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("aloneEncoder"); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", xz.PRESET_DEFAULT); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", {}); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { blockSize: 4096 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { bufsize: 100 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { check: 0 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { flags: 0 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { memlimit: 0 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { preset: 1 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { synchronous: true }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { threads: 10 }); }
|
||||
{ const a: Stream = xz.createStream("aloneEncoder", { timeout: 1 }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("aloneDecoder"); }
|
||||
{ const a: Stream = xz.createStream("aloneDecoder", {}); }
|
||||
{ const a: Stream = xz.createStream("aloneDecoder", { memlimit: 1000 }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("rawEncoder"); }
|
||||
{ const a: Stream = xz.createStream("rawEncoder", {}); }
|
||||
{ const a: Stream = xz.createStream("rawEncoder", { filters: [{ id: "LZMA_FILTER_DELTA" }] }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("rawDecoder"); }
|
||||
{ const a: Stream = xz.createStream("rawDecoder", {}); }
|
||||
{ const a: Stream = xz.createStream("rawDecoder", { filters: [{ id: "LZMA_FILTER_DELTA" }] }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("streamEncoder"); }
|
||||
{ const a: Stream = xz.createStream("streamEncoder", {}); }
|
||||
{ const a: Stream = xz.createStream("streamEncoder", { check: xz.CHECK_CRC64 }); }
|
||||
{ const a: Stream = xz.createStream("streamEncoder", { filters: [{ id: "LZMA_FILTER_DELTA" }] }); }
|
||||
|
||||
{ const a: Stream = xz.createStream("streamDecoder"); }
|
||||
{ const a: Stream = xz.createStream("streamDecoder", {}); }
|
||||
{ const a: Stream = xz.createStream("streamDecoder", { flags: xz.LZMA_CONCATENATED }); }
|
||||
{ const a: Stream = xz.createStream("streamDecoder", { memlimit: 100 }); }
|
||||
|
||||
xz.singleStringCoding(
|
||||
xz.createStream("streamDecoder"),
|
||||
"hello"
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
xz.singleStringCoding(
|
||||
xz.createStream("streamDecoder"),
|
||||
Buffer.from("hello")
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
xz.singleStringCoding(
|
||||
xz.createStream("streamDecoder"),
|
||||
"hello",
|
||||
(err: any, data: Buffer) => {}
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
xz.singleStringCoding(
|
||||
xz.createStream("streamDecoder"),
|
||||
"hello",
|
||||
(err: any, data: Buffer) => {},
|
||||
(x: number) => {}
|
||||
).then((x: Buffer) => {});
|
||||
|
||||
{ const a: number = xz.CHECK_CRC32; }
|
||||
{ const a: number = xz.CHECK_CRC64; }
|
||||
{ const a: number = xz.CHECK_NONE; }
|
||||
{ const a: number = xz.CHECK_SHA256; }
|
||||
{ const a: string = xz.FILTERS_MAX; }
|
||||
{ const a: string = xz.FILTER_ARM; }
|
||||
{ const a: string = xz.FILTER_ARMTHUMB; }
|
||||
{ const a: string = xz.FILTER_IA64; }
|
||||
{ const a: string = xz.FILTER_POWERPC; }
|
||||
{ const a: string = xz.FILTER_SPARC; }
|
||||
{ const a: string = xz.FILTER_X86; }
|
||||
{ const a: string = xz.FILTER_DELTA; }
|
||||
{ const a: string = xz.FILTER_LZMA1; }
|
||||
{ const a: string = xz.FILTER_LZMA2; }
|
||||
{ const a: number = xz.PRESET_EXTREME; }
|
||||
{ const a: number = xz.PRESET_DEFAULT; }
|
||||
{ const a: number = xz.PRESET_LEVEL_MASK; }
|
||||
{ const a: number = xz.MF_HC3; }
|
||||
{ const a: number = xz.MF_HC4; }
|
||||
{ const a: number = xz.MF_BT2; }
|
||||
{ const a: number = xz.MF_BT3; }
|
||||
{ const a: number = xz.MF_BT4; }
|
||||
{ const a: number = xz.LZMA_TELL_NO_CHECK; }
|
||||
{ const a: number = xz.LZMA_TELL_UNSUPPORTED_CHECK; }
|
||||
{ const a: number = xz.LZMA_TELL_ANY_CHECK; }
|
||||
{ const a: number = xz.LZMA_CONCATENATED; }
|
||||
{ const a: number = xz.MODE_FAST; }
|
||||
{ const a: number = xz.MODE_NORMAL; }
|
||||
{ const a: number = xz.STREAM_HEADER_SIZE; }
|
||||
|
||||
xz.compress("hello").then((x: Buffer) => {});
|
||||
xz.compress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
xz.compress(Buffer.from("hello"), xz.PRESET_DEFAULT).then((x: Buffer) => {});
|
||||
xz.compress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
xz.compress(Buffer.from("hello"), { check: xz.CHECK_CRC32 }).then((x: Buffer) => {});
|
||||
xz.compress(Buffer.from("hello"), { preset: xz.PRESET_EXTREME }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Stream = xz.compressStream(); }
|
||||
{ const a: Stream = xz.compressStream(xz.PRESET_DEFAULT); }
|
||||
{ const a: Stream = xz.compressStream({}); }
|
||||
{ const a: Stream = xz.compressStream({ check: xz.CHECK_CRC64 }); }
|
||||
{ const a: Stream = xz.compressStream({ preset: xz.PRESET_LEVEL_MASK }); }
|
||||
|
||||
xz.decompress(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
xz.decompress(Buffer.from("hello"), {}).then((x: Buffer) => {});
|
||||
xz.decompress(Buffer.from("hello"), { flags: xz.LZMA_CONCATENATED }).then((x: Buffer) => {});
|
||||
xz.decompress(Buffer.from("hello"), { memlimit: 100 }).then((x: Buffer) => {});
|
||||
|
||||
{ const a: Stream = xz.decompressStream(); }
|
||||
{ const a: Stream = xz.decompressStream({}); }
|
||||
{ const a: Stream = xz.decompressStream({ flags: xz.LZMA_TELL_ANY_CHECK }); }
|
||||
{ const a: Stream = xz.decompressStream({ memlimit: 100 }); }
|
||||
}
|
||||
}
|
||||
566
types/adone/test/glosses/data.ts
Normal file
566
types/adone/test/glosses/data.ts
Normal file
@ -0,0 +1,566 @@
|
||||
namespace dataTests {
|
||||
const { data } = adone;
|
||||
|
||||
namespace jsonTests {
|
||||
const { json } = data;
|
||||
|
||||
{ const a: Buffer = json.encode(1); }
|
||||
{ const a: Buffer = json.encode({}); }
|
||||
{ const a: Buffer = json.encode([]); }
|
||||
{ const a: Buffer = json.encode(1, {}); }
|
||||
{ const a: Buffer = json.encode(1, { replacer: ["a", "b", "c"] }); }
|
||||
{ const a: Buffer = json.encode(1, { replacer: (k: string, v: any) => null }); }
|
||||
{ const a: Buffer = json.encode(1, { space: " " }); }
|
||||
|
||||
json.decode("123");
|
||||
json.decode(Buffer.from("123"));
|
||||
|
||||
{ const a: string = json.encodeStable({ a: 1 }); }
|
||||
{ const a: string = json.encodeStable({ a: 1 }, {}); }
|
||||
json.encodeStable({ a: 1 }, {
|
||||
cmp: (a, b) => {
|
||||
a.key + "1";
|
||||
a.value;
|
||||
b.key + "1";
|
||||
a.value;
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
json.encodeStable({ a: 1 }, {
|
||||
cycles: true
|
||||
});
|
||||
json.encodeStable({ a: 1 }, {
|
||||
replacer: ["a", "b"]
|
||||
});
|
||||
json.encodeStable({ a: 1 }, {
|
||||
replacer: (key: string, value: any) => null
|
||||
});
|
||||
json.encodeStable({ a: 1 }, {
|
||||
space: " "
|
||||
});
|
||||
{ const a: string = json.encodeSafe({ a: 1 }); }
|
||||
json.decode("hello");
|
||||
}
|
||||
|
||||
namespace mpakTests {
|
||||
const { mpak } = data;
|
||||
|
||||
{ const a: Buffer = mpak.encode({ a: 1 }); }
|
||||
mpak.decode("hello");
|
||||
mpak.decode(adone.collection.ByteArray.wrap("hello"));
|
||||
mpak.decode(Buffer.from("123"));
|
||||
mpak.decode(new Uint8Array(10));
|
||||
mpak.decode(new ArrayBuffer(10));
|
||||
|
||||
new mpak.Encoder([]);
|
||||
new mpak.Encoder([{
|
||||
type: 10,
|
||||
check: () => true,
|
||||
encode: () => new adone.collection.ByteArray(10)
|
||||
}]);
|
||||
{ const a: adone.collection.ByteArray = new mpak.Encoder([]).encode("hello"); }
|
||||
{ const a: adone.collection.ByteArray = new mpak.Encoder([]).encode("hello", new adone.collection.ByteArray(10)).flip(); }
|
||||
|
||||
new mpak.Decoder([]);
|
||||
new mpak.Decoder([{
|
||||
type: 10,
|
||||
decode: (buf: adone.collection.ByteArray) => null
|
||||
}]);
|
||||
new mpak.Decoder([]).decode("hello");
|
||||
new mpak.Decoder([]).decode(adone.collection.ByteArray.wrap("hello"));
|
||||
new mpak.Decoder([]).decode(Buffer.from("123"));
|
||||
new mpak.Decoder([]).decode(new Uint8Array(10));
|
||||
new mpak.Decoder([]).decode(new ArrayBuffer(10));
|
||||
new mpak.Decoder([]).tryDecode(adone.collection.ByteArray.wrap("hello"));
|
||||
|
||||
{ const a: adone.data.mpak.Encoder = new mpak.Serializer().encoder; }
|
||||
{ const a: adone.data.mpak.Decoder = new mpak.Serializer().decoder; }
|
||||
{ const a: adone.data.mpak.Serializer = new mpak.Serializer().registerEncoder(10, (x) => true, (x) => new adone.collection.ByteArray(10)); }
|
||||
{ const a: adone.data.mpak.Serializer = new mpak.Serializer().registerDecoder(10, (buf: adone.collection.ByteArray) => null); }
|
||||
{ const a: adone.data.mpak.Serializer = new mpak.Serializer().register(10, Date, (x: Date) => x, (buf: adone.collection.ByteArray) => null); }
|
||||
new mpak.Serializer().encode(123);
|
||||
new mpak.Serializer().encode(123, new adone.collection.ByteArray(10));
|
||||
|
||||
class ExByteArray extends adone.collection.ByteArray {
|
||||
fafa() {
|
||||
return "I am useful!";
|
||||
}
|
||||
}
|
||||
|
||||
new mpak.Serializer().encode(123, new ExByteArray(10)).fafa();
|
||||
|
||||
new mpak.Serializer().decode("hello");
|
||||
new mpak.Serializer().decode(adone.collection.ByteArray.wrap("hello"));
|
||||
new mpak.Serializer().decode(Buffer.from("123"));
|
||||
new mpak.Serializer().decode(new Uint8Array(10));
|
||||
new mpak.Serializer().decode(new ArrayBuffer(10));
|
||||
|
||||
{ const a: adone.data.mpak.Serializer = mpak.serializer; }
|
||||
}
|
||||
|
||||
namespace json5Tests {
|
||||
const { json5 } = data;
|
||||
|
||||
{ const a: Buffer = json5.encode(123); }
|
||||
{ const a: Buffer = json5.encode(123, {}); }
|
||||
{ const a: Buffer = json5.encode(123, { replacer: (key: string, value: any) => null }); }
|
||||
{ const a: Buffer = json5.encode(123, { replacer: ["a", "b", "c"] }); }
|
||||
{ const a: Buffer = json5.encode(123, { space: " " }); }
|
||||
json5.decode("hello");
|
||||
json5.decode(Buffer.from("hello"));
|
||||
json5.decode(Buffer.from("hello"), (holder: object, key: string, value: any) => null);
|
||||
}
|
||||
|
||||
namespace base64Tests {
|
||||
const { base64 } = data;
|
||||
|
||||
{ const a: Buffer = base64.encode("string"); }
|
||||
{ const a: Buffer = base64.encode(Buffer.from("string")); }
|
||||
{ const a: string = base64.encode("string", { buffer: false }); }
|
||||
{ const a: Buffer = base64.encode("string", { buffer: true }); }
|
||||
{ const a: Buffer = base64.encode("string", {}); }
|
||||
|
||||
{ const a: string = base64.decode("string"); }
|
||||
{ const a: string = base64.decode(Buffer.from("string")); }
|
||||
{ const a: string = base64.decode("string", {}); }
|
||||
{ const a: string = base64.decode("string", { buffer: false }); }
|
||||
{ const a: Buffer = base64.decode("string", { buffer: true }); }
|
||||
|
||||
{ const a: string = base64.encodeVLQ(123); }
|
||||
{ const a: number = base64.decodeVLQ("H"); }
|
||||
{ const a: number = base64.decodeVLQ("H", 1); }
|
||||
{ const a: number = base64.decodeVLQ("H", 1, false); }
|
||||
{ const a: { value: number, index: number } = base64.decodeVLQ("H", 1, true); }
|
||||
|
||||
{ const a: number = base64.decodeCharCode("C"); }
|
||||
{ const a: string = base64.decodeNumber(12); }
|
||||
}
|
||||
|
||||
namespace yamlTests {
|
||||
const { yaml } = data;
|
||||
|
||||
namespace loaderTests {
|
||||
const { loader } = yaml;
|
||||
|
||||
loader.loadAll("hello")[0];
|
||||
loader.loadAll(Buffer.from("hello"))[0];
|
||||
loader.loadAll("hello", (doc) => 123);
|
||||
loader.loadAll("hello", undefined, {});
|
||||
loader.loadAll("hello", undefined, { filename: "hello" });
|
||||
loader.loadAll("hello", undefined, { json: true });
|
||||
loader.loadAll("hello", undefined, { onWarning: (warn) => null });
|
||||
loader.loadAll("hello", undefined, { schema: yaml.schema.CORE });
|
||||
|
||||
{ const a: any = loader.load("hello"); }
|
||||
{ const a: any = loader.load(Buffer.from("hello")); }
|
||||
loader.load("hello", {});
|
||||
loader.load("hello", { filename: "hello" });
|
||||
loader.load("hello", { json: true });
|
||||
loader.load("hello", { onWarning: (warn) => null });
|
||||
loader.load("hello", { schema: yaml.schema.DEFAULT_FULL });
|
||||
|
||||
loader.safeLoadAll("hello")[0];
|
||||
loader.safeLoadAll(Buffer.from("hello"))[0];
|
||||
loader.safeLoadAll(Buffer.from("hello"))[0];
|
||||
|
||||
loader.safeLoadAll("hello", (doc) => null);
|
||||
loader.safeLoadAll("hello", undefined, {})[0];
|
||||
loader.safeLoadAll("hello", undefined, { filename: "hello" })[0];
|
||||
loader.safeLoadAll("hello", undefined, { json: true })[0];
|
||||
loader.safeLoadAll("hello", undefined, { onWarning: (warn) => null })[0];
|
||||
loader.safeLoadAll("hello", undefined, { schema: yaml.schema.JSON })[0];
|
||||
|
||||
loader.safeLoad("hello");
|
||||
loader.safeLoad(Buffer.from("hello"));
|
||||
loader.safeLoad("hello", { filename: "hello" });
|
||||
loader.safeLoad("hello", { json: true });
|
||||
loader.safeLoad("hello", { onWarning: (warn) => null });
|
||||
loader.safeLoad("hello", { schema: yaml.schema.DEFAULT_SAFE });
|
||||
}
|
||||
|
||||
namespace dumperTests {
|
||||
const { dumper } = yaml;
|
||||
{ const a: string = dumper.dump("hello"); }
|
||||
{ const a: string = dumper.dump(Buffer.from("hello")); }
|
||||
{ const a: string = dumper.dump("hello", {}); }
|
||||
{ const a: string = dumper.dump("hello", { condenseFlow: true }); }
|
||||
{ const a: string = dumper.dump("hello", { flowLevel: 1 }); }
|
||||
{ const a: string = dumper.dump("hello", { indent: 4 }); }
|
||||
{ const a: string = dumper.dump("hello", { lineWidth: 80 }); }
|
||||
{ const a: string = dumper.dump("hello", { noCompatMode: true }); }
|
||||
{ const a: string = dumper.dump("hello", { noRefs: false }); }
|
||||
{ const a: string = dumper.dump("hello", { schema: yaml.schema.CORE }); }
|
||||
{ const a: string = dumper.dump("hello", { skipInvalid: true }); }
|
||||
{ const a: string = dumper.dump("hello", { sortKeys: true }); }
|
||||
{ const a: string = dumper.dump("hello", { styles: { a: "h" } }); }
|
||||
{ const a: string = dumper.safeDump("hello"); }
|
||||
{ const a: string = dumper.safeDump(Buffer.from("hello")); }
|
||||
{ const a: string = dumper.safeDump("hello", {}); }
|
||||
{ const a: string = dumper.safeDump("hello", { condenseFlow: true }); }
|
||||
{ const a: string = dumper.safeDump("hello", { flowLevel: 1 }); }
|
||||
{ const a: string = dumper.safeDump("hello", { indent: 4 }); }
|
||||
{ const a: string = dumper.safeDump("hello", { lineWidth: 80 }); }
|
||||
{ const a: string = dumper.safeDump("hello", { noCompatMode: true }); }
|
||||
{ const a: string = dumper.safeDump("hello", { noRefs: false }); }
|
||||
{ const a: string = dumper.safeDump("hello", { schema: yaml.schema.CORE }); }
|
||||
{ const a: string = dumper.safeDump("hello", { skipInvalid: true }); }
|
||||
{ const a: string = dumper.safeDump("hello", { sortKeys: true }); }
|
||||
{ const a: string = dumper.safeDump("hello", { styles: { a: "h" } }); }
|
||||
}
|
||||
|
||||
namespace typeTests {
|
||||
const { type } = yaml;
|
||||
|
||||
new type.Type("tag", { kind: "scalar" });
|
||||
new type.Type("tag", { kind: "sequence" });
|
||||
new type.Type("tag", { kind: "mapping" });
|
||||
new type.Type("tag", { kind: "scalar", resolve: (a: string) => true });
|
||||
new type.Type("tag", { kind: "scalar", construct: (a: string) => null });
|
||||
new type.Type("tag", { kind: "scalar", instanceOf: Date });
|
||||
new type.Type("tag", { kind: "scalar", predicate: (a) => true });
|
||||
new type.Type("tag", { kind: "scalar", represent: (a, s: string) => "asd" });
|
||||
new type.Type("tag", { kind: "scalar", represent: { check: (a, s: string) => "asd" } });
|
||||
new type.Type("tag", { kind: "scalar", defaultStyle: "asd" });
|
||||
new type.Type("tag", { kind: "scalar", styleAliases: {} });
|
||||
new type.Type<number>("tag", { kind: "scalar" }).construct("hello") + 1;
|
||||
!new type.Type<number>("tag", { kind: "scalar" }).resolve("hello");
|
||||
new type.Type<number>("tag", { kind: "scalar" }).instanceOf;
|
||||
new type.Type<number>("tag", { kind: "scalar" }).predicate;
|
||||
new type.Type<number>("tag", { kind: "scalar" }).represent;
|
||||
new type.Type<number>("tag", { kind: "scalar" }).defaultStyle;
|
||||
new type.Type<number>("tag", { kind: "scalar" }).styleAliases;
|
||||
type.Binary.construct("hello").fill(0);
|
||||
{ const a: boolean = type.Bool.construct("hello"); }
|
||||
type.Float.construct("hello") + 3.14;
|
||||
type.Int.construct("hello") + 3;
|
||||
type.Map.construct("hello");
|
||||
type.Merge.construct("hello");
|
||||
type.Null.construct("hello") === null;
|
||||
type.Omap.construct("hello")[0];
|
||||
type.Pairs.construct("hello")[0][0].charCodeAt(0);
|
||||
type.Seq.construct("hello")[0];
|
||||
type.Set.construct("hello");
|
||||
type.Str.construct("hello").charAt(0);
|
||||
type.Timestamp.construct("hello").getFullYear();
|
||||
type.js.Function.construct("hello").apply(null, [1, 2, 3]);
|
||||
type.js.RegExp.construct("hello").test("123");
|
||||
type.js.Undefined.construct("hello") === undefined;
|
||||
}
|
||||
|
||||
namespace schemaTests {
|
||||
const { schema } = yaml;
|
||||
|
||||
new schema.Schema({});
|
||||
new schema.Schema({
|
||||
include: [
|
||||
schema.CORE
|
||||
]
|
||||
});
|
||||
new schema.Schema({
|
||||
implicit: [
|
||||
yaml.type.Int
|
||||
]
|
||||
});
|
||||
new schema.Schema({
|
||||
explicit: [
|
||||
yaml.type.Int
|
||||
]
|
||||
});
|
||||
{ const a: adone.data.yaml.schema.Schema = new schema.Schema().include[0]; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().implicit[0]; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().explicit[0]; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().compiledImplicit[0]; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().compiledExplicit[0]; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().compiledTypeMap.scalar.hello; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().compiledTypeMap.sequence.hello; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().compiledTypeMap.mapping.hello; }
|
||||
{ const a: adone.data.yaml.type.Type = new schema.Schema().compiledTypeMap.fallback.hello; }
|
||||
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.create(schema.CORE, yaml.type.Binary); }
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.create([schema.CORE], [yaml.type.Binary]); }
|
||||
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.CORE; }
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.DEFAULT_FULL; }
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.DEFAULT_SAFE; }
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.FAILSAFE; }
|
||||
{ const a: adone.data.yaml.schema.Schema = schema.JSON; }
|
||||
}
|
||||
|
||||
const mark = new yaml.Mark("hello", "hello", 1, 2, 3);
|
||||
{ const a: string = mark.getSnippet(); }
|
||||
{ const a: string = mark.getSnippet(1); }
|
||||
{ const a: string = mark.getSnippet(1, 1); }
|
||||
{ const a: string = mark.toString(); }
|
||||
{ const a: string = mark.toString(true); }
|
||||
{ const a: string = new yaml.Exception("message", mark).reason; }
|
||||
{ const a: adone.data.yaml.Mark = new yaml.Exception("message", mark).mark; }
|
||||
|
||||
{ const a: Buffer = yaml.encode("hello"); }
|
||||
{ const a: Buffer = yaml.encode("hello", {}); }
|
||||
{ const a: Buffer = yaml.encode("hello", { condenseFlow: true }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { flowLevel: -1 }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { indent: 3 }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { lineWidth: 80 }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { noCompatMode: true }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { noRefs: true }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { schema: yaml.schema.CORE }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { skipInvalid: true }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { sortKeys: true }); }
|
||||
{ const a: Buffer = yaml.encode("hello", { styles: {} }); }
|
||||
|
||||
yaml.decode("hello");
|
||||
yaml.decode(Buffer.from("hello"));
|
||||
yaml.decode("hello", {});
|
||||
yaml.decode("hello", { filename: "hello" });
|
||||
yaml.decode("hello", { json: true });
|
||||
yaml.decode("hello", { onWarning: (warn) => null });
|
||||
yaml.decode("hello", { schema: yaml.schema.CORE });
|
||||
|
||||
yaml.loadAll("hello")[0];
|
||||
yaml.loadAll(Buffer.from("hello"))[0];
|
||||
yaml.loadAll("hello", (doc) => 123);
|
||||
yaml.loadAll("hello", undefined, {});
|
||||
yaml.loadAll("hello", undefined, { filename: "hello" });
|
||||
yaml.loadAll("hello", undefined, { json: true });
|
||||
yaml.loadAll("hello", undefined, { onWarning: (warn) => null });
|
||||
yaml.loadAll("hello", undefined, { schema: yaml.schema.CORE });
|
||||
|
||||
{ const a: any = yaml.load("hello"); }
|
||||
{ const a: any = yaml.load(Buffer.from("hello")); }
|
||||
yaml.load("hello", {});
|
||||
yaml.load("hello", { filename: "hello" });
|
||||
yaml.load("hello", { json: true });
|
||||
yaml.load("hello", { onWarning: (warn) => null });
|
||||
yaml.load("hello", { schema: yaml.schema.DEFAULT_FULL });
|
||||
|
||||
yaml.safeLoadAll("hello")[0];
|
||||
yaml.safeLoadAll(Buffer.from("hello"))[0];
|
||||
yaml.safeLoadAll(Buffer.from("hello"))[0];
|
||||
|
||||
yaml.safeLoadAll("hello", (doc) => null);
|
||||
yaml.safeLoadAll("hello", undefined, {})[0];
|
||||
yaml.safeLoadAll("hello", undefined, { filename: "hello" })[0];
|
||||
yaml.safeLoadAll("hello", undefined, { json: true })[0];
|
||||
yaml.safeLoadAll("hello", undefined, { onWarning: (warn) => null })[0];
|
||||
yaml.safeLoadAll("hello", undefined, { schema: yaml.schema.JSON })[0];
|
||||
|
||||
yaml.safeLoad("hello");
|
||||
yaml.safeLoad(Buffer.from("hello"));
|
||||
yaml.safeLoad("hello", { filename: "hello" });
|
||||
yaml.safeLoad("hello", { json: true });
|
||||
yaml.safeLoad("hello", { onWarning: (warn) => null });
|
||||
yaml.safeLoad("hello", { schema: yaml.schema.DEFAULT_SAFE });
|
||||
|
||||
{ const a: string = yaml.dump("hello"); }
|
||||
{ const a: string = yaml.dump(Buffer.from("hello")); }
|
||||
{ const a: string = yaml.dump("hello", {}); }
|
||||
{ const a: string = yaml.dump("hello", { condenseFlow: true }); }
|
||||
{ const a: string = yaml.dump("hello", { flowLevel: 1 }); }
|
||||
{ const a: string = yaml.dump("hello", { indent: 4 }); }
|
||||
{ const a: string = yaml.dump("hello", { lineWidth: 80 }); }
|
||||
{ const a: string = yaml.dump("hello", { noCompatMode: true }); }
|
||||
{ const a: string = yaml.dump("hello", { noRefs: false }); }
|
||||
{ const a: string = yaml.dump("hello", { schema: yaml.schema.CORE }); }
|
||||
{ const a: string = yaml.dump("hello", { skipInvalid: true }); }
|
||||
{ const a: string = yaml.dump("hello", { sortKeys: true }); }
|
||||
{ const a: string = yaml.dump("hello", { styles: { a: "h" } }); }
|
||||
{ const a: string = yaml.safeDump("hello"); }
|
||||
{ const a: string = yaml.safeDump(Buffer.from("hello")); }
|
||||
{ const a: string = yaml.safeDump("hello", {}); }
|
||||
{ const a: string = yaml.safeDump("hello", { condenseFlow: true }); }
|
||||
{ const a: string = yaml.safeDump("hello", { flowLevel: 1 }); }
|
||||
{ const a: string = yaml.safeDump("hello", { indent: 4 }); }
|
||||
{ const a: string = yaml.safeDump("hello", { lineWidth: 80 }); }
|
||||
{ const a: string = yaml.safeDump("hello", { noCompatMode: true }); }
|
||||
{ const a: string = yaml.safeDump("hello", { noRefs: false }); }
|
||||
{ const a: string = yaml.safeDump("hello", { schema: yaml.schema.CORE }); }
|
||||
{ const a: string = yaml.safeDump("hello", { skipInvalid: true }); }
|
||||
{ const a: string = yaml.safeDump("hello", { sortKeys: true }); }
|
||||
{ const a: string = yaml.safeDump("hello", { styles: { a: "h" } }); }
|
||||
}
|
||||
|
||||
namespace bsonTests {
|
||||
const { bson } = data;
|
||||
|
||||
new bson.Binary(10);
|
||||
{ const a: string = new bson.Binary(10)._bsontype; }
|
||||
new bson.Binary(Buffer.from("hello"));
|
||||
new bson.Binary(Buffer.from("hello"), 10);
|
||||
new bson.Binary(10).put(0);
|
||||
new bson.Binary(10).write("hello");
|
||||
new bson.Binary(10).write("hello", 0);
|
||||
new bson.Binary(10).write(Buffer.from("hello"));
|
||||
new bson.Binary(10).read(10);
|
||||
new bson.Binary(10).read(10, 0);
|
||||
{ const a: Buffer = new bson.Binary(10).value(true); }
|
||||
{ const a: string = new bson.Binary(10).value(); }
|
||||
{ const a: number = new bson.Binary(10).length(); }
|
||||
{ const a: string = new bson.Binary(10).toJSON(); }
|
||||
{ const a: string = new bson.Binary(10).toString(); }
|
||||
{ const a: number = bson.Binary.BUFFER_SIZE; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_DEFAULT; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_FUNCTION; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_BYTE_ARRAY; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_UUID_OLD; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_UUID; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_MD5; }
|
||||
{ const a: number = bson.Binary.SUBTYPE_USER_DEFINED; }
|
||||
|
||||
new bson.Code("hello");
|
||||
{ const a: string = new bson.Code("hello")._bsontype; }
|
||||
new bson.Code("hello", {});
|
||||
{ const a: object = new bson.Code("hello").toJSON().scope; }
|
||||
{ const a: string = new bson.Code("hello").toJSON().code; }
|
||||
|
||||
new bson.DBRef("aa", new bson.ObjectId());
|
||||
{ const a: string = new bson.DBRef("aa", new bson.ObjectId())._bsontype; }
|
||||
new bson.DBRef("aa", new bson.ObjectId(), "hh");
|
||||
{ const a: string = new bson.DBRef("aa", new bson.ObjectId()).toJSON().$ref; }
|
||||
{ const a: adone.data.bson.ObjectId = new bson.DBRef("aa", new bson.ObjectId()).toJSON().$id; }
|
||||
{ const a: string = new bson.DBRef("aa", new bson.ObjectId()).toJSON().$db; }
|
||||
|
||||
new bson.Decimal128(Buffer.from("0123456789abcdef"));
|
||||
{ const a: string = new bson.Decimal128(Buffer.from("0123456789abcdef"))._bsontype; }
|
||||
{ const a: string = new bson.Decimal128(Buffer.from("0123456789abcdef")).toString(); }
|
||||
{ const a: string = new bson.Decimal128(Buffer.from("0123456789abcdef")).toJSON().$numberDecimal; }
|
||||
{ const a: adone.data.bson.Decimal128 = bson.Decimal128.fromString("123"); }
|
||||
|
||||
new bson.Double(3.14);
|
||||
{ const a: string = new bson.Double(3.14)._bsontype; }
|
||||
{ const a: number = new bson.Double(3.14).valueOf(); }
|
||||
{ const a: number = new bson.Double(3.14).toJSON(); }
|
||||
|
||||
new bson.Int32(100500);
|
||||
{ const a: string = new bson.Int32(100500)._bsontype; }
|
||||
{ const a: number = new bson.Int32(100500).valueOf(); }
|
||||
{ const a: number = new bson.Int32(100500).toJSON(); }
|
||||
|
||||
new bson.Long();
|
||||
{ const a: string = new bson.Long()._bsontype; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.MIN_VALUE; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.MAX_UNSIGNED_VALUE; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.ZERO; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.UZERO; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.ONCE; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.UONE; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.ONE; }
|
||||
{ const a: adone.data.bson.Long = bson.Long.NEG_ONE; }
|
||||
|
||||
new bson.MaxKey();
|
||||
{ const a: string = new bson.MaxKey()._bsontype; }
|
||||
|
||||
new bson.MinKey();
|
||||
{ const a: string = new bson.MinKey()._bsontype; }
|
||||
|
||||
new bson.ObjectId();
|
||||
new bson.ObjectId("he");
|
||||
new bson.ObjectId(Buffer.from("asd"));
|
||||
new bson.ObjectId(new bson.ObjectId());
|
||||
new bson.ObjectId({ toHexString: () => "2", id: "he" });
|
||||
new bson.ObjectId({ toHexString: () => "2", id: Buffer.from("he") });
|
||||
new bson.ObjectId({ toHexString: () => "2", id: new bson.ObjectId() });
|
||||
{ const a: string = new bson.ObjectId().toHexString(); }
|
||||
{ const a: number = new bson.ObjectId().getInc(); }
|
||||
{ const a: Buffer = new bson.ObjectId().generate(); }
|
||||
{ const a: Buffer = new bson.ObjectId().generate(10050); }
|
||||
{ const a: string = new bson.ObjectId().toString(); }
|
||||
{ const a: string = new bson.ObjectId().toString("utf8"); }
|
||||
{ const a: string = new bson.ObjectId().toJSON(); }
|
||||
new bson.ObjectId().equals("he");
|
||||
new bson.ObjectId().equals(Buffer.from("he"));
|
||||
new bson.ObjectId().equals(new bson.ObjectId());
|
||||
new bson.ObjectId().equals({ toHexString: () => "2" });
|
||||
{ const a: Date = new bson.ObjectId().getTimestamp(); }
|
||||
{ const a: adone.data.bson.ObjectId = bson.ObjectId.createPk(); }
|
||||
{ const a: adone.data.bson.ObjectId = bson.ObjectId.createFromTime(100500); }
|
||||
{ const a: adone.data.bson.ObjectId = bson.ObjectId.createFromHexString("deadbeef"); }
|
||||
{ const a: boolean = bson.ObjectId.isValid("deadbeef"); }
|
||||
{ const a: number = bson.ObjectId.index; }
|
||||
|
||||
new bson.BSONRegExp("\\d");
|
||||
new bson.BSONRegExp("\\d", "mix");
|
||||
{ const a: string = new bson.BSONRegExp("\\d")._bsontype; }
|
||||
|
||||
new bson.Symbol("he");
|
||||
{ const a: string = new bson.Symbol("he")._bsontype; }
|
||||
{ const a: string = new bson.Symbol("he").valueOf(); }
|
||||
{ const a: string = new bson.Symbol("he").toString(); }
|
||||
{ const a: string = new bson.Symbol("he").inspect(); }
|
||||
{ const a: string = new bson.Symbol("he").toJSON(); }
|
||||
|
||||
new bson.Timestamp();
|
||||
new bson.Timestamp(100, 500);
|
||||
{ const a: string = new bson.Timestamp()._bsontype; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.MIN_VALUE; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.MAX_VALUE; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.MAX_UNSIGNED_VALUE; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.ZERO; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.UZERO; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.ONCE; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.ONE; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.UONE; }
|
||||
{ const a: adone.data.bson.Timestamp = bson.Timestamp.NEG_ONE; }
|
||||
|
||||
new bson.BSON();
|
||||
new bson.BSON([bson.Timestamp, bson.Binary]);
|
||||
{ const a: Buffer = new bson.BSON().serialize({ a: 1 }); }
|
||||
{ const a: Buffer = new bson.BSON().serialize({ a: 1 }, {}); }
|
||||
{ const a: Buffer = new bson.BSON().serialize({ a: 1 }, { checkKeys: true }); }
|
||||
{ const a: Buffer = new bson.BSON().serialize({ a: 1 }, { ignoreUndefined: true }); }
|
||||
{ const a: Buffer = new bson.BSON().serialize({ a: 1 }, { serializeFunctions: false }); }
|
||||
{ const a: number = new bson.BSON().serializeWithBufferAndIndex({ a: 1 }, Buffer.alloc(10)); }
|
||||
{ const a: number = new bson.BSON().serializeWithBufferAndIndex({ a: 1 }, Buffer.alloc(10), {}); }
|
||||
{ const a: number = new bson.BSON().serializeWithBufferAndIndex({ a: 1 }, Buffer.alloc(10), { checkKeys: true }); }
|
||||
{ const a: number = new bson.BSON().serializeWithBufferAndIndex({ a: 1 }, Buffer.alloc(10), { ignoreUndefined: true }); }
|
||||
{ const a: number = new bson.BSON().serializeWithBufferAndIndex({ a: 1 }, Buffer.alloc(10), { index: 10 }); }
|
||||
{ const a: number = new bson.BSON().serializeWithBufferAndIndex({ a: 1 }, Buffer.alloc(10), { serializeFunctions: false }); }
|
||||
{ const a: number = new bson.BSON().calculateObjectSize({ a: 1 }); }
|
||||
{ const a: number = new bson.BSON().calculateObjectSize({ a: 1 }, {}); }
|
||||
{ const a: number = new bson.BSON().calculateObjectSize({ a: 1 }, { ignoreUndefined: false }); }
|
||||
{ const a: number = new bson.BSON().calculateObjectSize({ a: 1 }, { serializeFunctions: false }); }
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha")).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), {}).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { bsonRegExp: false }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { cacheFunctions: false }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { cacheFunctonsCrc32: false }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { evalFunctions: false }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { fieldsAsRaw: ["a"] }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { promoteBuffers: false }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { promoteLongs: false }).a;
|
||||
new bson.BSON().deserialize(Buffer.from("aahaha"), { promoteValues: true }).a;
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, {}); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { bsonRegExp: false }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { cacheFunctions: false }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { cacheFunctonsCrc32: false }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { evalFunctions: false }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { fieldsAsRaw: ["b"] }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { promoteBuffers: false }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { promoteLongs: false }); }
|
||||
{ const a: number = new bson.BSON().deserializeStream(Buffer.from("ahaha"), 1, 2, [], 2, { promoteValues: true }); }
|
||||
{ const a: number = bson.c.BSON_INT32_MAX; }
|
||||
{ const a: number = bson.c.BSON_INT32_MIN; }
|
||||
{ const a: number = bson.c.BSON_INT64_MAX; }
|
||||
{ const a: number = bson.c.BSON_INT64_MIN; }
|
||||
{ const a: number = bson.c.JS_INT_MAX; }
|
||||
{ const a: number = bson.c.JS_INT_MIN; }
|
||||
{ const a: adone.data.bson.BSON = bson.serializer; }
|
||||
|
||||
{ const a: Buffer = bson.encode({ a: 1 }); }
|
||||
{ const a: Buffer = bson.encode({ a: 1 }, {}); }
|
||||
{ const a: Buffer = bson.encode({ a: 1 }, { checkKeys: true }); }
|
||||
{ const a: Buffer = bson.encode({ a: 1 }, { ignoreUndefined: false }); }
|
||||
{ const a: Buffer = bson.encode({ a: 1 }, { serializeFunctions: false }); }
|
||||
|
||||
bson.decode(bson.encode({ a: 1 })).a;
|
||||
bson.decode(bson.encode({ a: 1 }), {}).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { bsonRegExp: false }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { cacheFunctions: false }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { cacheFunctonsCrc32: false }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { evalFunctions: false }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { fieldsAsRaw: ["b"] }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { promoteBuffers: false }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { promoteLongs: false }).a;
|
||||
bson.decode(bson.encode({ a: 1 }), { promoteValues: true }).a;
|
||||
}
|
||||
}
|
||||
699
types/adone/test/glosses/datetime.ts
Normal file
699
types/adone/test/glosses/datetime.ts
Normal file
@ -0,0 +1,699 @@
|
||||
namespace datetimeTests {
|
||||
const { datetime } = adone;
|
||||
|
||||
{ const a: string = datetime.defaultFormat; }
|
||||
{ const a: string = datetime.defaultFormatUtc; }
|
||||
{ const a: adone.I.datetime.Datetime = datetime(); }
|
||||
datetime(datetime());
|
||||
datetime(new Date());
|
||||
datetime("hello");
|
||||
datetime(123);
|
||||
datetime([1, 2, 3]);
|
||||
datetime(["a"]);
|
||||
datetime();
|
||||
datetime({
|
||||
y: 1
|
||||
});
|
||||
datetime({
|
||||
year: 1
|
||||
});
|
||||
datetime({
|
||||
years: 1
|
||||
});
|
||||
datetime({
|
||||
month: 1
|
||||
});
|
||||
datetime({
|
||||
months: 1
|
||||
});
|
||||
datetime({
|
||||
M: 1
|
||||
});
|
||||
datetime({
|
||||
days: 1
|
||||
});
|
||||
datetime({
|
||||
day: 1
|
||||
});
|
||||
datetime({
|
||||
d: 1
|
||||
});
|
||||
datetime({
|
||||
y: 1000
|
||||
});
|
||||
datetime({
|
||||
months: 1
|
||||
});
|
||||
datetime({
|
||||
month: 1
|
||||
});
|
||||
datetime({
|
||||
M: 1
|
||||
});
|
||||
datetime({
|
||||
days: 1
|
||||
});
|
||||
datetime({
|
||||
day: 1
|
||||
});
|
||||
datetime({
|
||||
d: 1
|
||||
});
|
||||
datetime({
|
||||
dates: 1
|
||||
});
|
||||
datetime({
|
||||
date: 1
|
||||
});
|
||||
datetime({
|
||||
D: 1
|
||||
});
|
||||
datetime({
|
||||
hours: 1
|
||||
});
|
||||
datetime({
|
||||
hour: 1
|
||||
});
|
||||
datetime({
|
||||
h: 1
|
||||
});
|
||||
datetime({
|
||||
minutes: 1
|
||||
});
|
||||
datetime({
|
||||
minute: 1
|
||||
});
|
||||
datetime({
|
||||
m: 1
|
||||
});
|
||||
datetime({
|
||||
seconds: 1
|
||||
});
|
||||
datetime({
|
||||
second: 1
|
||||
});
|
||||
datetime({
|
||||
s: 1
|
||||
});
|
||||
datetime({
|
||||
milliseconds: 1
|
||||
});
|
||||
datetime({
|
||||
millisecond: 1
|
||||
});
|
||||
datetime({
|
||||
ms: 1
|
||||
});
|
||||
datetime(101, "DD MM");
|
||||
datetime(101, "DD MM", true);
|
||||
datetime(101, undefined, true);
|
||||
datetime(101, undefined, "ru", true);
|
||||
datetime.utc(datetime());
|
||||
datetime.utc(new Date());
|
||||
datetime.utc("hello");
|
||||
datetime.utc(123);
|
||||
datetime.utc([1, 2, 3]);
|
||||
datetime.utc(["a"]);
|
||||
datetime.utc();
|
||||
datetime.utc({
|
||||
y: 1
|
||||
});
|
||||
datetime.utc({
|
||||
year: 1
|
||||
});
|
||||
datetime.utc({
|
||||
years: 1
|
||||
});
|
||||
datetime.utc({
|
||||
month: 1
|
||||
});
|
||||
datetime.utc({
|
||||
months: 1
|
||||
});
|
||||
datetime.utc({
|
||||
M: 1
|
||||
});
|
||||
datetime.utc({
|
||||
days: 1
|
||||
});
|
||||
datetime({
|
||||
day: 1
|
||||
});
|
||||
datetime.utc({
|
||||
d: 1
|
||||
});
|
||||
datetime.utc({
|
||||
y: 1000
|
||||
});
|
||||
datetime.utc({
|
||||
months: 1
|
||||
});
|
||||
datetime({
|
||||
month: 1
|
||||
});
|
||||
datetime.utc({
|
||||
M: 1
|
||||
});
|
||||
datetime.utc({
|
||||
days: 1
|
||||
});
|
||||
datetime.utc({
|
||||
day: 1
|
||||
});
|
||||
datetime.utc({
|
||||
d: 1
|
||||
});
|
||||
datetime.utc({
|
||||
dates: 1
|
||||
});
|
||||
datetime.utc({
|
||||
date: 1
|
||||
});
|
||||
datetime({
|
||||
D: 1
|
||||
});
|
||||
datetime.utc({
|
||||
hours: 1
|
||||
});
|
||||
datetime.utc({
|
||||
hour: 1
|
||||
});
|
||||
datetime.utc({
|
||||
h: 1
|
||||
});
|
||||
datetime.utc({
|
||||
minutes: 1
|
||||
});
|
||||
datetime.utc({
|
||||
minute: 1
|
||||
});
|
||||
datetime.utc({
|
||||
m: 1
|
||||
});
|
||||
datetime.utc({
|
||||
seconds: 1
|
||||
});
|
||||
datetime.utc({
|
||||
second: 1
|
||||
});
|
||||
datetime.utc({
|
||||
s: 1
|
||||
});
|
||||
datetime.utc({
|
||||
milliseconds: 1
|
||||
});
|
||||
datetime.utc({
|
||||
millisecond: 1
|
||||
});
|
||||
datetime.utc({
|
||||
ms: 1
|
||||
});
|
||||
datetime.utc(101, "DD MM");
|
||||
datetime.utc(101, "DD MM", true);
|
||||
datetime.utc(101, undefined, true);
|
||||
datetime.utc(101, undefined, "ru", true);
|
||||
datetime.unix(101010).clone();
|
||||
|
||||
datetime.dos({ time: 100, date: 100 }).clone();
|
||||
|
||||
datetime.invalid();
|
||||
datetime.invalid({ charsLeftOver: 100 });
|
||||
datetime.invalid({ empty: true });
|
||||
datetime.invalid({ invalidFormat: false });
|
||||
datetime.invalid({ invalidMonth: "jan" });
|
||||
datetime.invalid({ iso: false });
|
||||
datetime.invalid({ meridiem: "am" });
|
||||
datetime.invalid({ nullInput: false });
|
||||
datetime.invalid({ overflow: 1 });
|
||||
datetime.invalid({ parsedDateParts: [1] });
|
||||
datetime.invalid({ unusedInput: ["1"] });
|
||||
datetime.invalid({ unusedTokens: ["1"] });
|
||||
datetime.invalid({ userInvalidated: false });
|
||||
datetime.isDuration(12);
|
||||
{ const a: string = datetime.locale(); }
|
||||
{ const a: string = datetime.locale("he"); }
|
||||
{ const a: string = datetime.locale(["he"]); }
|
||||
{ const a: string = datetime.locale("he", {}); }
|
||||
{ const a: string = datetime.locale("he", { calendar: { lastDay: "ha" } }); }
|
||||
{ const a: string = datetime.locale("he", { calendar: { lastWeek: "ha" } }); }
|
||||
{ const a: string = datetime.locale("he", { calendar: { nextDay: "ha" } }); }
|
||||
{ const a: string = datetime.locale("he", { calendar: { nextWeek: "ha" } }); }
|
||||
{ const a: string = datetime.locale("he", { calendar: { sameDay: "ha" } }); }
|
||||
{ const a: string = datetime.locale("he", { calendar: { sameElse: "ha" } }); }
|
||||
{ const a: string = datetime.locale("he", { invalidDate: "ha" }); }
|
||||
{ const a: string = datetime.locale("he", { isPM: (x: string) => true }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
longDateFormat: {
|
||||
l: "", ll: "", lll: "", llll: "",
|
||||
L: "", LL: "", LLL: "", LLLL: "",
|
||||
LT: "", lt: "", LTS: "", lts: ""
|
||||
}
|
||||
});
|
||||
}
|
||||
{ const a: string = datetime.locale("he", { meridiem: (hour: number, minute: number, isLower: boolean) => "ba" }); }
|
||||
{ const a: string = datetime.locale("he", { meridiemParse: /ab/ }); }
|
||||
|
||||
{ const a: string = datetime.locale("he", { monthsShort: ["a"] }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
monthsShort: {
|
||||
format: ["1"],
|
||||
standalone: ["1"],
|
||||
isFormat: /a/
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
monthsShort: (d) => d.clone() && "123"
|
||||
});
|
||||
const b: string = datetime.locale("he", {
|
||||
monthsShort: (d, f?: string) => d.clone() && "123"
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: string = datetime.locale("he", { monthsShort: ["a"] }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
monthsShort: {
|
||||
format: ["1"],
|
||||
standalone: ["1"],
|
||||
isFormat: /a/
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
monthsShort: (d) => d.clone() && "123"
|
||||
});
|
||||
const b: string = datetime.locale("he", {
|
||||
monthsShort: (d, f?: string) => d.clone() && "123"
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: string = datetime.locale("he", { ordinal: (n: number) => "1" }); }
|
||||
{ const a: string = datetime.locale("he", { ordinalParse: /a/ }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
relativeTime: {
|
||||
future: "he",
|
||||
past: "he",
|
||||
s: "he",
|
||||
m: "he",
|
||||
mm: "he",
|
||||
h: "he",
|
||||
hh: "he",
|
||||
d: "he",
|
||||
dd: "he",
|
||||
M: "he",
|
||||
MM: "he",
|
||||
y: "he",
|
||||
yy: 'he"'
|
||||
}
|
||||
});
|
||||
const b: string = datetime.locale("he", {
|
||||
relativeTime: {
|
||||
future: (x: string) => "he",
|
||||
past: (x: string) => "he",
|
||||
s: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
m: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
mm: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
h: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
hh: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
d: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
dd: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
M: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
MM: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
y: (x: number, y: boolean, z: string, a: boolean) => "he",
|
||||
yy: (x: number, y: boolean, z: string, a: boolean) => 'he"'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: string = datetime.locale("he", { week: { dow: 1, doy: 2 } }); }
|
||||
|
||||
{ const a: string = datetime.locale("he", { weekDays: ["a"] }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
weekDays: {
|
||||
format: ["1"],
|
||||
standalone: ["1"],
|
||||
isFormat: /a/
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
weekDays: (d: adone.I.datetime.Datetime) => d.clone() && "123"
|
||||
});
|
||||
const b: string = datetime.locale("he", {
|
||||
weekDays: (d: adone.I.datetime.Datetime, f?: string) => d.clone() && "123"
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: string = datetime.locale("he", { weekdaysMin: ["a"] }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
weekdaysMin: {
|
||||
format: ["1"],
|
||||
standalone: ["1"],
|
||||
isFormat: /a/
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
weekdaysMin: (d: adone.I.datetime.Datetime) => d.clone() && "123"
|
||||
});
|
||||
const b: string = datetime.locale("he", {
|
||||
weekdaysMin: (d: adone.I.datetime.Datetime, f?: string) => d.clone() && "123"
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: string = datetime.locale("he", { weekdaysShort: ["a"] }); }
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
weekdaysShort: {
|
||||
format: ["1"],
|
||||
standalone: ["1"],
|
||||
isFormat: /a/
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: string = datetime.locale("he", {
|
||||
weekdaysShort: (d: adone.I.datetime.Datetime) => d.clone() && "123"
|
||||
});
|
||||
const b: string = datetime.locale("he", {
|
||||
weekdaysShort: (d: adone.I.datetime.Datetime, f?: string) => d.clone() && "123"
|
||||
});
|
||||
}
|
||||
|
||||
datetime.localeData();
|
||||
datetime.localeData("en");
|
||||
datetime.localeData(["en"]);
|
||||
{ const a: string = datetime.localeData().calendar(); }
|
||||
{ const a: string = datetime.localeData().calendar("lastDay"); }
|
||||
{ const a: string = datetime.localeData().calendar("lastWeek"); }
|
||||
{ const a: string = datetime.localeData().calendar("nextDay"); }
|
||||
{ const a: string = datetime.localeData().calendar("nextWeek"); }
|
||||
{ const a: string = datetime.localeData().calendar("sameDay"); }
|
||||
{ const a: string = datetime.localeData().calendar("sameElse"); }
|
||||
{ const a: number = datetime.localeData().firstDayOfWeek(); }
|
||||
{ const a: string = datetime.localeData().invalidDate(); }
|
||||
{ const a: boolean = datetime.localeData().isPM("a"); }
|
||||
{ const a: string = datetime.localeData().longDateFormat("LL"); }
|
||||
{ const a: string = datetime.localeData().meridiem(10, 10, true); }
|
||||
{ const a: string[] = datetime.localeData().months(); }
|
||||
{ const a: string = datetime.localeData().months(adone.datetime()); }
|
||||
{ const a: number = datetime.localeData().monthsParse("he", "fa", false); }
|
||||
{ const a: RegExp = datetime.localeData().monthsRegex(false); }
|
||||
{ const a: string[] = datetime.localeData().monthsShort(); }
|
||||
{ const a: string = datetime.localeData().monthsShort(adone.datetime()); }
|
||||
{ const a: RegExp = datetime.localeData().monthsShortRegex(false); }
|
||||
{ const a: number = datetime.localeData().weekdaysParse("he", "fa", true); }
|
||||
{ const a: RegExp = datetime.localeData().weekdaysRegex(true); }
|
||||
{ const a: string[] = datetime.localeData().weekdaysShort(); }
|
||||
{ const a: string = datetime.localeData().weekdaysShort(adone.datetime()); }
|
||||
{ const a: RegExp = datetime.localeData().weekdaysShortRegex(false); }
|
||||
{ const a: adone.I.datetime.Duration = datetime.duration(); }
|
||||
{ const a: adone.I.datetime.Duration = datetime.duration(100, "days"); }
|
||||
{
|
||||
const a: adone.I.datetime.Duration = datetime.duration({
|
||||
years: 10,
|
||||
year: 10,
|
||||
y: 10,
|
||||
months: 10,
|
||||
month: 10,
|
||||
M: 10,
|
||||
days: 10,
|
||||
day: 10,
|
||||
d: 10,
|
||||
dates: 0,
|
||||
date: 10,
|
||||
D: 10,
|
||||
hours: 10,
|
||||
hour: 10,
|
||||
h: 10,
|
||||
minutes: 10,
|
||||
minute: 10,
|
||||
m: 10,
|
||||
seconds: 10,
|
||||
second: 10,
|
||||
s: 10,
|
||||
milliseconds: 10,
|
||||
millisecond: 10,
|
||||
ms: 10,
|
||||
quarters: 10,
|
||||
quarter: 10,
|
||||
Q: 10,
|
||||
weeks: 10,
|
||||
week: 10,
|
||||
w: 10
|
||||
});
|
||||
{ const b: adone.I.datetime.Duration = a.abs(); }
|
||||
{ const b: adone.I.datetime.Duration = a.add(1, "year"); }
|
||||
{ const b: adone.I.datetime.Duration = a.add(1); }
|
||||
{ const b: number = a.as("millisecond"); }
|
||||
{ const b: number = a.asDays(); }
|
||||
{ const b: number = a.asHours(); }
|
||||
{ const b: number = a.asMilliseconds(); }
|
||||
{ const b: number = a.asMinutes(); }
|
||||
{ const b: number = a.asMonths(); }
|
||||
{ const b: number = a.asSeconds(); }
|
||||
{ const b: number = a.asWeeks(); }
|
||||
{ const b: number = a.asYears(); }
|
||||
{ const b: number = a.days(); }
|
||||
{ const b: number = a.get("year"); }
|
||||
{ const b: number = a.hours(); }
|
||||
{ const b: string = a.humanize(); }
|
||||
{ const b: string = a.humanize(false); }
|
||||
{ const b: string = a.locale(); }
|
||||
{ const b: adone.I.datetime.Locale = a.localeData(); }
|
||||
{ const b: number = a.milliseconds(); }
|
||||
{ const b: number = a.minutes(); }
|
||||
{ const b: number = a.months(); }
|
||||
{ const b: number = a.seconds(); }
|
||||
{ const b: adone.I.datetime.Duration = a.subtract(1, "minute"); }
|
||||
{ const b: string = a.toISOString(); }
|
||||
{ const b: string = a.toJSON(); }
|
||||
{ const b: number = a.weeks(); }
|
||||
{ const b: number = a.years(); }
|
||||
}
|
||||
|
||||
{ const a: adone.I.datetime.Datetime = datetime.parseZone(1230, "DD"); }
|
||||
{ const a: adone.I.datetime.Datetime = datetime.parseZone(1230, "DD", false); }
|
||||
{ const a: adone.I.datetime.Datetime = datetime.parseZone(1230, "DD", "en", false); }
|
||||
|
||||
{ const a: string[] = datetime.months(); }
|
||||
{ const a: string = datetime.months(1); }
|
||||
{ const a: string = datetime.months("format", 1); }
|
||||
|
||||
{ const a: string[] = datetime.monthsShort(); }
|
||||
{ const a: string = datetime.monthsShort(1); }
|
||||
{ const a: string = datetime.monthsShort("format", 1); }
|
||||
|
||||
{ const a: string[] = datetime.weekdays(); }
|
||||
{ const a: string = datetime.weekdays(1); }
|
||||
{ const a: string[] = datetime.weekdays("format"); }
|
||||
{ const a: string = datetime.weekdays("format", 1); }
|
||||
{ const a: string[] = datetime.weekdays(true); }
|
||||
{ const a: string = datetime.weekdays(true, 1); }
|
||||
{ const a: string = datetime.weekdays(true, "format", 1); }
|
||||
|
||||
{ const a: string[] = datetime.weekdaysShort(); }
|
||||
{ const a: string = datetime.weekdaysShort(1); }
|
||||
{ const a: string[] = datetime.weekdaysShort("format"); }
|
||||
{ const a: string = datetime.weekdaysShort("format", 1); }
|
||||
{ const a: string[] = datetime.weekdaysShort(true); }
|
||||
{ const a: string = datetime.weekdaysShort(true, 1); }
|
||||
{ const a: string = datetime.weekdaysShort(true, "format", 1); }
|
||||
|
||||
{ const a: string[] = datetime.weekdaysMin(); }
|
||||
{ const a: string = datetime.weekdaysMin(1); }
|
||||
{ const a: string[] = datetime.weekdaysMin("format"); }
|
||||
{ const a: string = datetime.weekdaysMin("format", 1); }
|
||||
{ const a: string[] = datetime.weekdaysMin(true); }
|
||||
{ const a: string = datetime.weekdaysMin(true, 1); }
|
||||
{ const a: string = datetime.weekdaysMin(true, "format", 1); }
|
||||
|
||||
{ const a: adone.I.datetime.Datetime = adone.datetime.min(adone.datetime(), adone.datetime()); }
|
||||
{ const a: adone.I.datetime.Datetime = adone.datetime.max(adone.datetime(), adone.datetime()); }
|
||||
{ const a: number = adone.datetime.now(); }
|
||||
{
|
||||
const a: adone.I.datetime.Locale = adone.datetime.defineLocale("he", {});
|
||||
const b: adone.I.datetime.Locale = adone.datetime.defineLocale("he", {
|
||||
calendar: {
|
||||
lastDay: ""
|
||||
},
|
||||
invalidDate: "h",
|
||||
isPM: (x: string) => true,
|
||||
longDateFormat: {
|
||||
l: "", L: "", LL: "", ll: "", LLL: "", lll: "", LLLL: "", llll: "",
|
||||
LT: "", lt: "", LTS: "", lts: ""
|
||||
},
|
||||
ordinalParse: /ab/
|
||||
});
|
||||
}
|
||||
{
|
||||
const a: adone.I.datetime.Locale = adone.datetime.updateLocale("he", {
|
||||
ordinal: (k: number) => "hello"
|
||||
});
|
||||
}
|
||||
|
||||
{ const a: string[] = adone.datetime.locales(); }
|
||||
|
||||
{ const a: string = adone.datetime.normalizeUnits("y"); }
|
||||
|
||||
{ const a: number = adone.datetime.relativeTimeThreshold("y"); }
|
||||
{ const a: boolean = adone.datetime.relativeTimeThreshold("y", 10); }
|
||||
|
||||
{ const a: (x: number) => number = adone.datetime.relativeTimeRounding(); }
|
||||
{ const a: boolean = adone.datetime.relativeTimeRounding((x: number) => 123); }
|
||||
|
||||
{ const a: string = adone.datetime.calendarFormat(adone.datetime(), adone.datetime()); }
|
||||
|
||||
const d = adone.datetime();
|
||||
|
||||
{ const a: adone.I.datetime.Datetime = d.add(1, "day"); }
|
||||
{ const a: adone.I.datetime.Datetime = d.add(1, "hour"); }
|
||||
{ const a: adone.I.datetime.Datetime = d.add(1); }
|
||||
|
||||
{ const a: string = d.calendar("h"); }
|
||||
{ const a: string = d.calendar(1); }
|
||||
{ const a: string = d.calendar(adone.datetime()); }
|
||||
{ const a: string = d.calendar(new Date()); }
|
||||
{ const a: string = d.calendar([1, 2, 3]); }
|
||||
{ const a: string = d.calendar(["1", "2", "3"]); }
|
||||
|
||||
{ const a: adone.I.datetime.Datetime = d.clone(); }
|
||||
{
|
||||
const a: adone.I.datetime.DatetimeCreationData = d.creationData();
|
||||
a.format;
|
||||
a.input;
|
||||
a.isUTC;
|
||||
a.locale;
|
||||
a.strict;
|
||||
}
|
||||
{ const a: number = d.date(); }
|
||||
{ const a: number = d.dates(); }
|
||||
{ const a: number = d.day(); }
|
||||
{ const a: number = d.dayOfYear(); }
|
||||
{ const a: number = d.days(); }
|
||||
{ const a: number = d.daysInMonth(); }
|
||||
{ const a: number = d.diff(adone.datetime()); }
|
||||
{ const a: number = d.diff(1001); }
|
||||
{ const a: number = d.diff("asdasd"); }
|
||||
{ const a: number = d.diff(new Date()); }
|
||||
{ const a: number = d.diff(new Date(), "years"); }
|
||||
{ const a: adone.I.datetime.Datetime = d.endOf("year"); }
|
||||
{ const a: string = d.format("YYYY"); }
|
||||
{ const a: string = d.from(100); }
|
||||
{ const a: string = d.from(adone.datetime()); }
|
||||
{ const a: string = d.from(new Date()); }
|
||||
{ const a: string = d.from(100, true); }
|
||||
{ const a: string = d.fromNow(); }
|
||||
{ const a: string = d.fromNow(true); }
|
||||
{ const a: number = d.get("hours"); }
|
||||
{ const a: boolean = d.hasAlignedHourOffset(); }
|
||||
{ const a: boolean = d.hasAlignedHourOffset("123"); }
|
||||
{ const a: boolean = d.hasAlignedHourOffset(new Date()); }
|
||||
{ const a: boolean = d.hasAlignedHourOffset(123); }
|
||||
{ const a: boolean = d.hasAlignedHourOffset(adone.datetime()); }
|
||||
{ const a: number = d.hour(); }
|
||||
{ const a: number = d.hours(); }
|
||||
{ const a: string = d.inspect(); }
|
||||
{ const a: number = d.invalidAt(); }
|
||||
{ const a: boolean = d.isAfter(123123); }
|
||||
{ const a: boolean = d.isAfter(adone.datetime()); }
|
||||
{ const a: boolean = d.isBefore(123123); }
|
||||
{ const a: boolean = d.isBefore(adone.datetime()); }
|
||||
{ const a: boolean = d.isBetween(adone.datetime(), adone.datetime()); }
|
||||
{ const a: boolean = d.isBetween(adone.datetime(), 123); }
|
||||
{ const a: boolean = d.isDST(); }
|
||||
{ const a: boolean = d.isDSTShifted(); }
|
||||
{ const a: boolean = d.isLeapYear(); }
|
||||
{ const a: boolean = d.isLocal(); }
|
||||
{ const a: number = d.isoWeek(); }
|
||||
{ const a: number = d.isoWeekday(); }
|
||||
{ const a: number = d.isoWeeks(); }
|
||||
{ const a: number = d.isoWeeksInYear(); }
|
||||
{ const a: number = d.isoWeekYear(); }
|
||||
{ const a: boolean = d.isSame(13); }
|
||||
{ const a: boolean = d.isSame(adone.datetime()); }
|
||||
{ const a: boolean = d.isSame("23"); }
|
||||
{ const a: boolean = d.isSameOrAfter("123"); }
|
||||
{ const a: boolean = d.isSameOrAfter(123); }
|
||||
{ const a: boolean = d.isSameOrAfter(adone.datetime()); }
|
||||
{ const a: boolean = d.isSameOrBefore("123"); }
|
||||
{ const a: boolean = d.isSameOrBefore(123); }
|
||||
{ const a: boolean = d.isSameOrBefore(adone.datetime()); }
|
||||
{ const a: boolean = d.isUTC(); }
|
||||
{ const a: boolean = d.isUtc(); }
|
||||
{ const a: boolean = d.isUtcOffset(); }
|
||||
{ const a: boolean = d.isValid(); }
|
||||
{ const a: adone.I.datetime.Datetime = d.local(); }
|
||||
{ const a: string = d.locale(); }
|
||||
{ const a: adone.I.datetime.Locale = d.localeData(); }
|
||||
{ const a: number = d.millisecond(); }
|
||||
{ const a: number = d.milliseconds(); }
|
||||
{ const a: number = d.minute(); }
|
||||
{ const a: number = d.minutes(); }
|
||||
{ const a: number = d.months(); }
|
||||
{ const a: adone.I.datetime.Datetime = d.parseZone(); }
|
||||
{
|
||||
const a: adone.I.datetime.DatetimeParsingFlags = d.parsingFlags();
|
||||
a.charsLeftOver;
|
||||
a.empty;
|
||||
a.invalidFormat;
|
||||
a.invalidMonth;
|
||||
a.iso;
|
||||
a.meridiem;
|
||||
a.nullInput;
|
||||
a.overflow;
|
||||
a.parsedDateParts;
|
||||
a.unusedInput;
|
||||
a.unusedTokens;
|
||||
a.userInvalidated;
|
||||
}
|
||||
{ const a: number = d.quarter(); }
|
||||
{ const a: number = d.quarters(); }
|
||||
{ const a: number = d.second(); }
|
||||
{ const a: number = d.seconds(); }
|
||||
{ const a: adone.I.datetime.Datetime = d.set("year", 2); }
|
||||
{ const a: adone.I.datetime.Datetime = d.startOf("year"); }
|
||||
{ const a: adone.I.datetime.Datetime = d.subtract(1, "day"); }
|
||||
{ const a: adone.I.datetime.Datetime = d.subtract(1); }
|
||||
{ const a: string = d.to(100); }
|
||||
{ const a: string = d.to(adone.datetime()); }
|
||||
{ const a: string = d.to("asdjasd"); }
|
||||
{ const a: number[] = d.toArray(); }
|
||||
{ const a: Date = d.toDate(); }
|
||||
{ const a: string = d.toISOString(); }
|
||||
{ const a: string = d.toJSON(); }
|
||||
{ const b: { date: number, time: number } = d.toDOS(); }
|
||||
{ const a: string = d.toNow(); }
|
||||
{
|
||||
const a: adone.I.datetime.DatetimeObjectOutput = d.toObject();
|
||||
a.date;
|
||||
a.hours;
|
||||
a.milliseconds;
|
||||
a.minutes;
|
||||
a.months;
|
||||
a.seconds;
|
||||
a.years;
|
||||
}
|
||||
{ const a: number = d.unix(); }
|
||||
{ const a: adone.I.datetime.Datetime = d.utc(); }
|
||||
{ const a: number = d.utcOffset(); }
|
||||
{ const a: number = d.week(); }
|
||||
{ const a: number = d.weekday(); }
|
||||
{ const a: number = d.weeks(); }
|
||||
{ const a: number = d.weeksInYear(); }
|
||||
{ const a: number = d.weekYear(); }
|
||||
{ const a: number = d.year(); }
|
||||
{ const a: number = d.years(); }
|
||||
{ const a: string = d.zoneAbbr(); }
|
||||
{ const a: string = d.zoneName(); }
|
||||
}
|
||||
106
types/adone/test/glosses/events.ts
Normal file
106
types/adone/test/glosses/events.ts
Normal file
@ -0,0 +1,106 @@
|
||||
namespace eventsTests {
|
||||
namespace EventEmitter {
|
||||
namespace static {
|
||||
const a: number = adone.event.EventEmitter.listenerCount(new adone.event.EventEmitter(), "event");
|
||||
const b: number = adone.event.EventEmitter.defaultMaxListeners;
|
||||
}
|
||||
|
||||
namespace addListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().addListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().addListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace on {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().on("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().on(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace once {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().once("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().once(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().prependListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().prependListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace prependOnceListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().prependOnceListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().prependOnceListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace removeListener {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().removeListener("event", () => { });
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().removeListener(Symbol("event"), () => { });
|
||||
}
|
||||
|
||||
namespace removeAllListeners {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().removeAllListeners("event");
|
||||
const b: adone.event.EventEmitter = new adone.event.EventEmitter().removeAllListeners(Symbol("event"));
|
||||
}
|
||||
|
||||
namespace setMaxListeners {
|
||||
const a: adone.event.EventEmitter = new adone.event.EventEmitter().setMaxListeners(10);
|
||||
}
|
||||
|
||||
namespace getMaxListeners {
|
||||
const a: number = new adone.event.EventEmitter().getMaxListeners();
|
||||
}
|
||||
|
||||
namespace listeners {
|
||||
const a: Array<(...args: any[]) => any> = new adone.event.EventEmitter().listeners("event");
|
||||
const b: Array<(...args: any[]) => any> = new adone.event.EventEmitter().listeners(Symbol("event"));
|
||||
}
|
||||
|
||||
namespace emit {
|
||||
const a: boolean = new adone.event.EventEmitter().emit("event", 1, 2, 3);
|
||||
const b: boolean = new adone.event.EventEmitter().emit(Symbol("event"), 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace eventNames {
|
||||
const a: Array<string | symbol> = new adone.event.EventEmitter().eventNames();
|
||||
const b: Array<string | symbol> = new adone.event.EventEmitter().eventNames();
|
||||
}
|
||||
|
||||
namespace listenerCount {
|
||||
const a: number = new adone.event.EventEmitter().listenerCount("event");
|
||||
const b: number = new adone.event.EventEmitter().listenerCount(Symbol("event"));
|
||||
}
|
||||
}
|
||||
|
||||
namespace AsyncEmitter {
|
||||
const a: adone.event.EventEmitter = new adone.event.AsyncEmitter();
|
||||
new adone.event.AsyncEmitter(10);
|
||||
|
||||
namespace setConcurrency {
|
||||
const a: adone.event.AsyncEmitter = new adone.event.AsyncEmitter().setConcurrency();
|
||||
const b: adone.event.AsyncEmitter = new adone.event.AsyncEmitter().setConcurrency(10);
|
||||
}
|
||||
|
||||
namespace emitParallel {
|
||||
const a: Promise<any[]> = new adone.event.AsyncEmitter().emitParallel("even");
|
||||
const b: Promise<any[]> = new adone.event.AsyncEmitter().emitParallel("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace emitSerial {
|
||||
const a: Promise<any[]> = new adone.event.AsyncEmitter().emitSerial("even");
|
||||
const b: Promise<any[]> = new adone.event.AsyncEmitter().emitSerial("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace emitReduce {
|
||||
const a: Promise<any[]> = new adone.event.AsyncEmitter().emitReduce("even");
|
||||
const b: Promise<any[]> = new adone.event.AsyncEmitter().emitReduce("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace emitReduceRight {
|
||||
const a: Promise<any[]> = new adone.event.AsyncEmitter().emitReduceRight("even");
|
||||
const b: Promise<any[]> = new adone.event.AsyncEmitter().emitReduceRight("even", 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace subscribe {
|
||||
const a: () => void = new adone.event.AsyncEmitter().subscribe("event", () => { });
|
||||
const b: () => void = new adone.event.AsyncEmitter().subscribe("event", () => { }, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
types/adone/test/glosses/exceptions.ts
Normal file
36
types/adone/test/glosses/exceptions.ts
Normal file
@ -0,0 +1,36 @@
|
||||
namespace ExcetpionsTests {
|
||||
{ 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(); }
|
||||
}
|
||||
737
types/adone/test/glosses/fast.ts
Normal file
737
types/adone/test/glosses/fast.ts
Normal file
@ -0,0 +1,737 @@
|
||||
namespace fastTests {
|
||||
const { fast } = adone;
|
||||
|
||||
namespace FileTests {
|
||||
const { File } = fast;
|
||||
|
||||
new File();
|
||||
new File({ base: "/" });
|
||||
new File({ contents: Buffer.from("hello") });
|
||||
new File({ contents: Buffer.from("hello") }).contents.fill(0);
|
||||
new File({ contents: adone.fs.createReadStream("hello") }).contents.pipe(process.stdout);
|
||||
new File({ contents: null }).contents === null;
|
||||
new File({ cwd: "/" });
|
||||
new File({ history: ["a", "b"] });
|
||||
new File({ path: "/a/b/c" });
|
||||
new File({ stat: adone.fs.statSync("hello") });
|
||||
new File({ symlink: "/a/b/c" });
|
||||
|
||||
{
|
||||
const f = new File();
|
||||
f.base === "";
|
||||
f.base = "1";
|
||||
f.basename === "";
|
||||
f.basename = "2";
|
||||
f.contents === null;
|
||||
f.cwd === "";
|
||||
f.cwd = "1";
|
||||
f.dirname === "";
|
||||
f.dirname = "2";
|
||||
f.extname === "";
|
||||
f.extname = "3";
|
||||
f.history[0] === "";
|
||||
f.path === "";
|
||||
f.path = "2";
|
||||
f.relative === "";
|
||||
f.relative = "3";
|
||||
const s: adone.fs.I.Stats = f.stat;
|
||||
f.stem = "3";
|
||||
f.symlink = "5";
|
||||
}
|
||||
{
|
||||
const n = new File({ contents: null });
|
||||
n.clone({ contents: true }).contents === null;
|
||||
const b = new File({ contents: Buffer.from("1") });
|
||||
b.clone({ contents: true }).contents.fill(0);
|
||||
// todo stream
|
||||
}
|
||||
{
|
||||
const f = new File();
|
||||
const a: boolean = f.isBuffer();
|
||||
const b: boolean = f.isDirectory();
|
||||
const c: boolean = f.isNull();
|
||||
const d: boolean = f.isStream();
|
||||
const e: boolean = f.isSymbolic();
|
||||
}
|
||||
}
|
||||
|
||||
namespace srcTests {
|
||||
const { src } = fast;
|
||||
|
||||
src("hello");
|
||||
src(["hello"]);
|
||||
src("hello").forEach((x) => {
|
||||
x.isBuffer();
|
||||
x.contents.fill(0);
|
||||
});
|
||||
src("hello", { buffer: true }).forEach((x) => {
|
||||
x.isBuffer();
|
||||
x.contents.fill(0);
|
||||
});
|
||||
src("hello", { read: true, buffer: true }).forEach((x) => {
|
||||
x.isBuffer();
|
||||
x.contents.fill(0);
|
||||
});
|
||||
src("hello", { stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
src("hello", { read: true, stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
src("hello", { read: true, stream: true, buffer: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
src("hello", { read: false }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
src("hello", { read: false, stream: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
src("hello", { read: false, stream: true, buffer: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
src("hello", { cwd: "/" }).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
|
||||
src("hello").dest("hello");
|
||||
src("hello").dest("hello", { cwd: "/" });
|
||||
src("hello").dest("hello", { flag: "w+" });
|
||||
src("hello").dest("hello", { mode: 0o555 });
|
||||
src("hello").dest("hello", { originMode: true });
|
||||
src("hello").dest("hello", { originOwner: true });
|
||||
src("hello").dest("hello", { originTimes: true });
|
||||
src("hello").dest("hello", { produceFiles: true });
|
||||
src("hello").dest((file) => {
|
||||
file.contents.fill(0);
|
||||
return "a";
|
||||
});
|
||||
src("hello", { stream: true }).dest((file) => {
|
||||
file.contents.pipe(process.stdout);
|
||||
return "a";
|
||||
});
|
||||
}
|
||||
|
||||
namespace watchTests {
|
||||
const { watch } = fast;
|
||||
watch("hello").forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
watch(["hello"]).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
watch("hello", { read: false }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
watch("hello", { read: false, stream: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
watch("hello", { read: false, buffer: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
watch("hello", { stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
watch("hello", { read: true, stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
watch("hello", { read: true, stream: true, buffer: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
watch("hello", { alwaysStat: true });
|
||||
watch("hello", { followSymlinks: true });
|
||||
}
|
||||
|
||||
namespace mapTests {
|
||||
const { map } = fast;
|
||||
|
||||
map({
|
||||
from: "a",
|
||||
to: "b"
|
||||
}).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
map([{
|
||||
from: "a",
|
||||
to: "b"
|
||||
}]).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
map([]).dest({ cwd: "/" });
|
||||
map([]).dest({ flag: "w+" });
|
||||
map([]).dest({ mode: 0o677 });
|
||||
map([]).dest({ originMode: true });
|
||||
map([]).dest({ originOwner: false });
|
||||
map([]).dest({ originTimes: true });
|
||||
map([]).dest({ produceFiles: true });
|
||||
map([], { read: false }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
map([], { read: false, stream: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
map([], { read: false, stream: true, buffer: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
map([], { stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
map([], { stream: true, buffer: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
map([], { read: true, stream: true, buffer: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
map([], { buffer: true }).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
}
|
||||
|
||||
namespace watchMapTests {
|
||||
const { watchMap } = fast;
|
||||
|
||||
watchMap({
|
||||
from: "a",
|
||||
to: "b"
|
||||
}).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
watchMap([{
|
||||
from: "a",
|
||||
to: "b"
|
||||
}]).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
watchMap([], { read: false }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
watchMap([], { stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
watchMap([], { read: true, stream: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
watchMap([], { read: true, stream: true, buffer: true }).forEach((x) => {
|
||||
x.contents.pipe(process.stdout);
|
||||
});
|
||||
watchMap([], { buffer: true }).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
watchMap([], { read: true, buffer: true }).forEach((x) => {
|
||||
x.contents.fill(0);
|
||||
});
|
||||
watchMap([], { read: false, stream: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
watchMap([], { read: false, stream: true, buffer: true }).forEach((x) => {
|
||||
const a: null = x.contents;
|
||||
});
|
||||
}
|
||||
|
||||
namespace pluginsTests {
|
||||
const { src } = fast;
|
||||
namespace compressorTests {
|
||||
src("hello").compress("gz");
|
||||
src("hello").compress("brotli");
|
||||
src("hello").compress("deflate");
|
||||
src("hello").compress("lzma");
|
||||
src("hello").compress("snappy");
|
||||
src("hello").compress("xz");
|
||||
src("hello").compress("gz", {});
|
||||
src("hello").compress("gz", { rename: true });
|
||||
src("hello").decompress("gz");
|
||||
src("hello").decompress("brotli");
|
||||
src("hello").decompress("deflate");
|
||||
src("hello").decompress("lzma");
|
||||
src("hello").decompress("snappy");
|
||||
src("hello").decompress("xz");
|
||||
src("hello").decompress("gz", {});
|
||||
}
|
||||
|
||||
namespace archiveTests {
|
||||
src("hello").pack("tar");
|
||||
src("hello").pack("zip");
|
||||
src("hello").pack("tar", {});
|
||||
src("hello").unpack("tar");
|
||||
src("hello").unpack("zip");
|
||||
src("hello").unpack("tar", {});
|
||||
}
|
||||
|
||||
namespace transpileTests {
|
||||
src("hello").transpile({}); // TODO
|
||||
}
|
||||
|
||||
namespace renameTests {
|
||||
src("hello").rename("opa");
|
||||
src("hello").rename((obj) => {
|
||||
const a: string = obj.basename;
|
||||
const b: string = obj.dirname;
|
||||
const c: string = obj.extname;
|
||||
return "asd";
|
||||
});
|
||||
src("hello").rename({
|
||||
dirname: "1"
|
||||
});
|
||||
src("hello").rename({
|
||||
basename: "1"
|
||||
});
|
||||
src("hello").rename({
|
||||
extname: "1"
|
||||
});
|
||||
src("hello").rename({
|
||||
prefix: "1"
|
||||
});
|
||||
}
|
||||
|
||||
namespace concatTests {
|
||||
src("hello").concat("file");
|
||||
src("hello").concat({
|
||||
path: "file"
|
||||
});
|
||||
src("hello").concat("file", {});
|
||||
src("hello").concat("file", { newLine: "\n" });
|
||||
}
|
||||
|
||||
namespace sourcemapsTests {
|
||||
src("hello").sourcemapsInit();
|
||||
src("hello").sourcemapsInit({});
|
||||
src("hello").sourcemapsInit({ loadMaps: true });
|
||||
src("hello").sourcemapsInit({ identityMap: true });
|
||||
src("hello").sourcemapsInit({ largeFile: true });
|
||||
src("hello").sourcemapsWrite({});
|
||||
src("hello").sourcemapsWrite({ addComment: true });
|
||||
src("hello").sourcemapsWrite({ charset: "utf8" });
|
||||
src("hello").sourcemapsWrite({ clone: { deep: true } });
|
||||
src("hello").sourcemapsWrite({ clone: { contents: true } });
|
||||
src("hello").sourcemapsWrite({ destPath: "../" });
|
||||
src("hello").sourcemapsWrite({ includeContent: true });
|
||||
src("hello").sourcemapsWrite({ mapFile: (f) => f.contents.fill(0) && f.path });
|
||||
src("hello").sourcemapsWrite({ mapSources: (path: string, file) => file.contents.fill(0) && path });
|
||||
src("hello").sourcemapsWrite({ mapSourcesAbsolute: true });
|
||||
src("hello").sourcemapsWrite({ sourceMappingURL: (file) => file.contents.fill(0) && file.path });
|
||||
src("hello").sourcemapsWrite({ sourceMappingURLPrefix: "haha" });
|
||||
src("hello").sourcemapsWrite({ sourceMappingURLPrefix: (file) => file.contents.fill(0) && file.path });
|
||||
src("hello").sourcemapsWrite({ sourceRoot: "../" });
|
||||
src("hello").sourcemapsWrite("../", {});
|
||||
src("hello").sourcemapsWrite("../", { addComment: true });
|
||||
src("hello").sourcemapsWrite("../", { charset: "utf8" });
|
||||
src("hello").sourcemapsWrite("../", { clone: { deep: true } });
|
||||
src("hello").sourcemapsWrite("../", { clone: { contents: true } });
|
||||
src("hello").sourcemapsWrite("../", { destPath: "../" });
|
||||
src("hello").sourcemapsWrite("../", { includeContent: true });
|
||||
src("hello").sourcemapsWrite("../", { mapFile: (f) => f.contents.fill(0) && f.path });
|
||||
src("hello").sourcemapsWrite("../", { mapSources: (path: string, file) => file.contents.fill(0) && path });
|
||||
src("hello").sourcemapsWrite("../", { mapSourcesAbsolute: true });
|
||||
src("hello").sourcemapsWrite("../", { sourceMappingURL: (file) => file.contents.fill(0) && file.path });
|
||||
src("hello").sourcemapsWrite("../", { sourceMappingURLPrefix: "haha" });
|
||||
src("hello").sourcemapsWrite("../", { sourceMappingURLPrefix: (file) => file.contents.fill(0) && file.path });
|
||||
src("hello").sourcemapsWrite("../", { sourceRoot: "../" });
|
||||
}
|
||||
|
||||
namespace wrapTests {
|
||||
src("hello").wrap("template");
|
||||
src("hello").wrap({ src: "template path" });
|
||||
src("hello").wrap((data) => "123");
|
||||
src("hello").wrap("template", (file) => file.contents.fill(0) && { a: 1 });
|
||||
src("hello").wrap("template", { a: 1 });
|
||||
src("hello").wrap("template", undefined, { escape: /aasd/ });
|
||||
src("hello").wrap("template", undefined, { evaluate: /aa/ });
|
||||
src("hello").wrap("template", undefined, { imports: {} });
|
||||
src("hello").wrap("template", undefined, { interpolate: /a/ });
|
||||
src("hello").wrap("template", undefined, { parse: true });
|
||||
src("hello").wrap("template", undefined, { sourceURL: ".a" });
|
||||
src("hello").wrap("template", undefined, { variable: "a" });
|
||||
src("hello").wrap("template", undefined, (file) => (file.contents.fill(0) && { parse: true }));
|
||||
}
|
||||
|
||||
namespace replaceTests {
|
||||
src("hello").replace("a", "b");
|
||||
src("hello").replace("a", (x: string) => "b");
|
||||
src("hello").replace(/a/, "b");
|
||||
src("hello").replace([/a/], ["b"]);
|
||||
src("hello").replace([/a/], ["b"]);
|
||||
src("hello").replace(["a", /a/], ["b", "e"]);
|
||||
src("hello").replace(["a", /a/], [(x: string) => "b", "e"]);
|
||||
}
|
||||
|
||||
namespace revisionHashTests {
|
||||
src("hello").revisionHash();
|
||||
src("hello").revisionHash({
|
||||
manifest: {}
|
||||
});
|
||||
src("hello").revisionHash({
|
||||
manifest: {
|
||||
merge: true
|
||||
}
|
||||
});
|
||||
src("hello").revisionHash({
|
||||
manifest: {
|
||||
path: "a"
|
||||
}
|
||||
});
|
||||
src("hello").revisionHash({
|
||||
manifest: {
|
||||
transformer: JSON
|
||||
}
|
||||
});
|
||||
src("hello").revisionHash({
|
||||
manifest: {
|
||||
transformer: {
|
||||
parse: () => ({}),
|
||||
stringify: () => ""
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
namespace revisionHashReplaceTests {
|
||||
src("hello").revisionHashReplace({
|
||||
canonicalUris: true
|
||||
});
|
||||
src("hello").revisionHashReplace({
|
||||
prefix: "hello"
|
||||
});
|
||||
src("hello").revisionHashReplace({
|
||||
replaceExtensions: [".js"]
|
||||
});
|
||||
src("hello").revisionHashReplace({
|
||||
manifest: src("hello")
|
||||
});
|
||||
(async () => {
|
||||
src("hello").revisionHashReplace({
|
||||
manifest: await src("hello")
|
||||
});
|
||||
})();
|
||||
src("hello").revisionHashReplace({
|
||||
modifyReved: (p: string) => p
|
||||
});
|
||||
src("hello").revisionHashReplace({
|
||||
modifyUnreved: (p: string) => p
|
||||
});
|
||||
}
|
||||
|
||||
namespace chmodTests {
|
||||
src("hello").chmod(0o777);
|
||||
src("hello").chmod({
|
||||
group: {
|
||||
read: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
group: {
|
||||
write: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
group: {
|
||||
execute: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
owner: {
|
||||
read: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
owner: {
|
||||
write: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
owner: {
|
||||
execute: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
others: {
|
||||
read: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
others: {
|
||||
write: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod({
|
||||
others: {
|
||||
execute: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, 0o777);
|
||||
src("hello").chmod(undefined, {
|
||||
group: {
|
||||
read: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
group: {
|
||||
write: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
group: {
|
||||
execute: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
owner: {
|
||||
read: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
owner: {
|
||||
write: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
owner: {
|
||||
execute: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
others: {
|
||||
read: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
others: {
|
||||
write: true
|
||||
}
|
||||
});
|
||||
src("hello").chmod(undefined, {
|
||||
others: {
|
||||
execute: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
namespace notifyTests {
|
||||
src("hello").notify("hello");
|
||||
src("hello").notify({
|
||||
appName: "a"
|
||||
});
|
||||
src("hello").notify({
|
||||
console: true
|
||||
});
|
||||
src("hello").notify({
|
||||
debounce: {
|
||||
timeout: 100
|
||||
}
|
||||
});
|
||||
src("hello").notify({
|
||||
debounce: 100
|
||||
});
|
||||
src("hello").notify({
|
||||
debounce: {
|
||||
timeout: 100,
|
||||
leading: true
|
||||
}
|
||||
});
|
||||
src("hello").notify({
|
||||
debounce: {
|
||||
timeout: 100,
|
||||
trailing: true
|
||||
}
|
||||
});
|
||||
src("hello").notify({
|
||||
emitError: true
|
||||
});
|
||||
src("hello").notify({
|
||||
filter: (file) => file.contents.fill(0) && true
|
||||
});
|
||||
src("hello").notify({
|
||||
gui: true
|
||||
});
|
||||
src("hello").notify({
|
||||
host: "192.168.1.1"
|
||||
});
|
||||
src("hello").notify({
|
||||
message: "hello"
|
||||
});
|
||||
src("hello").notify({
|
||||
message: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notify({
|
||||
notifier: {} // TODO
|
||||
});
|
||||
src("hello").notify({
|
||||
onLast: true
|
||||
});
|
||||
src("hello").notify({
|
||||
open: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notify({
|
||||
open: "hello"
|
||||
});
|
||||
src("hello").notify({
|
||||
port: 31337
|
||||
});
|
||||
src("hello").notify({
|
||||
subtitle: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notify({
|
||||
subtitle: "hello"
|
||||
});
|
||||
src("hello").notify({
|
||||
templateOptions: {}
|
||||
});
|
||||
src("hello").notify({
|
||||
title: "hello"
|
||||
});
|
||||
src("hello").notify({
|
||||
title: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notifyError("hello");
|
||||
src("hello").notifyError({
|
||||
appName: "a"
|
||||
});
|
||||
src("hello").notifyError({
|
||||
console: true
|
||||
});
|
||||
src("hello").notifyError({
|
||||
debounce: {
|
||||
timeout: 100
|
||||
}
|
||||
});
|
||||
src("hello").notifyError({
|
||||
debounce: 100
|
||||
});
|
||||
src("hello").notifyError({
|
||||
debounce: {
|
||||
timeout: 100,
|
||||
leading: true
|
||||
}
|
||||
});
|
||||
src("hello").notifyError({
|
||||
debounce: {
|
||||
timeout: 100,
|
||||
trailing: true
|
||||
}
|
||||
});
|
||||
src("hello").notifyError({
|
||||
emitError: true
|
||||
});
|
||||
src("hello").notifyError({
|
||||
filter: (file) => file.contents.fill(0) && true
|
||||
});
|
||||
src("hello").notifyError({
|
||||
gui: true
|
||||
});
|
||||
src("hello").notifyError({
|
||||
host: "192.168.1.1"
|
||||
});
|
||||
src("hello").notifyError({
|
||||
message: "hello"
|
||||
});
|
||||
src("hello").notifyError({
|
||||
message: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notifyError({
|
||||
notifier: {} // TODO
|
||||
});
|
||||
src("hello").notifyError({
|
||||
onLast: true
|
||||
});
|
||||
src("hello").notifyError({
|
||||
open: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notifyError({
|
||||
open: "hello"
|
||||
});
|
||||
src("hello").notifyError({
|
||||
port: 31337
|
||||
});
|
||||
src("hello").notifyError({
|
||||
subtitle: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
src("hello").notifyError({
|
||||
subtitle: "hello"
|
||||
});
|
||||
src("hello").notifyError({
|
||||
templateOptions: {}
|
||||
});
|
||||
src("hello").notifyError({
|
||||
title: "hello"
|
||||
});
|
||||
src("hello").notifyError({
|
||||
title: (file) => file.contents.fill(0) && file.path
|
||||
});
|
||||
|
||||
fast.plugin.notify.onError("hello");
|
||||
fast.plugin.notify.onError({
|
||||
appName: "a"
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
console: true
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
debounce: {
|
||||
timeout: 100
|
||||
}
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
debounce: 100
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
debounce: {
|
||||
timeout: 100,
|
||||
leading: true
|
||||
}
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
debounce: {
|
||||
timeout: 100,
|
||||
trailing: true
|
||||
}
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
emitError: true
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
filter: (file) => true
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
gui: true
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
host: "192.168.1.1"
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
message: "hello"
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
message: (file) => file.path
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
notifier: {} // TODO
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
onLast: true
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
open: (file) => file.path
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
open: "hello"
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
port: 31337
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
subtitle: (file) => file.path
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
subtitle: "hello"
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
templateOptions: {}
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
title: "hello"
|
||||
});
|
||||
fast.plugin.notify.onError({
|
||||
title: (file) => file.path
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
793
types/adone/test/glosses/fs.ts
Normal file
793
types/adone/test/glosses/fs.ts
Normal file
@ -0,0 +1,793 @@
|
||||
namespace fsTests {
|
||||
const { fs, std: { url: { URL } } } = adone;
|
||||
|
||||
namespace readlinkTests {
|
||||
fs.readlink("file");
|
||||
fs.readlink(Buffer.from("file"));
|
||||
fs.readlink(new URL("file://file"));
|
||||
fs.readlink("file", {}).then((x: string) => x);
|
||||
fs.readlink("file", { encoding: "utf8" }).then((x: string) => x);
|
||||
fs.readlink("file", { encoding: null }).then((x: Buffer) => x);
|
||||
fs.readlink("file", null).then((x: Buffer) => x);
|
||||
fs.readlink("file", "hex").then((x: string) => x);
|
||||
fs.readlink("file").then((x: string) => x);
|
||||
}
|
||||
|
||||
namespace unlinkTests {
|
||||
fs.unlink("file").then(() => {});
|
||||
fs.unlink(Buffer.from("file")).then(() => {});
|
||||
fs.unlink(new URL("file://file")).then(() => {});
|
||||
fs.unlinkSync("file");
|
||||
fs.unlinkSync(Buffer.from("file"));
|
||||
fs.unlinkSync(new URL("file://file"));
|
||||
}
|
||||
|
||||
namespace chmodTests {
|
||||
fs.chmod("file", 0o333).then(() => {});
|
||||
fs.chmod(Buffer.from("file"), 0o333).then(() => {});
|
||||
fs.chmod(new URL("file://file"), 0o333).then(() => {});
|
||||
}
|
||||
|
||||
namespace chownTests {
|
||||
fs.chown("file", 0, 0).then(() => {});
|
||||
fs.chown(Buffer.from("file"), 0, 0).then(() => {});
|
||||
fs.chown(new URL("file://file"), 0, 0).then(() => {});
|
||||
}
|
||||
|
||||
namespace rmdirTests {
|
||||
fs.rmdir("file").then(() => {});
|
||||
fs.rmdir(Buffer.from("file")).then(() => {});
|
||||
fs.rmdir(new URL("file://file")).then(() => {});
|
||||
}
|
||||
|
||||
namespace readdirTests {
|
||||
fs.readdir("file");
|
||||
fs.readdir(Buffer.from("file"));
|
||||
fs.readdir(new URL("file://file"));
|
||||
fs.readdir("file").then((x: string[]) => {});
|
||||
fs.readdir("file", null).then((x: Buffer[]) => {});
|
||||
fs.readdir("file", {}).then((x: string[]) => {});
|
||||
fs.readdir("file", { encoding: "hex" }).then((x: string[]) => {});
|
||||
fs.readdir("file", { encoding: null }).then((x: Buffer[]) => {});
|
||||
|
||||
fs.readdirSync("file");
|
||||
fs.readdirSync(Buffer.from("file"));
|
||||
fs.readdirSync(new URL("file://file"));
|
||||
const a: string[] = fs.readdirSync("file");
|
||||
const b: Buffer[] = fs.readdirSync("file", null);
|
||||
const c: string[] = fs.readdirSync("file", {});
|
||||
const d: string[] = fs.readdirSync("file", { encoding: "hex" });
|
||||
const e: Buffer[] = fs.readdirSync("file", { encoding: null });
|
||||
}
|
||||
|
||||
namespace lstatTests {
|
||||
fs.lstat("file").then((x: nodestd.fs.Stats) => {});
|
||||
fs.lstat(Buffer.from("file")).then((x: nodestd.fs.Stats) => {});
|
||||
fs.lstat(new URL("file://file")).then((x: nodestd.fs.Stats) => {});
|
||||
|
||||
const a: nodestd.fs.Stats = fs.lstatSync("file");
|
||||
const b: nodestd.fs.Stats = fs.lstatSync(Buffer.from("file"));
|
||||
const c: nodestd.fs.Stats = fs.lstatSync(new URL("file://file"));
|
||||
}
|
||||
|
||||
namespace statTests {
|
||||
fs.stat("file").then((x: nodestd.fs.Stats) => {});
|
||||
fs.stat(Buffer.from("file")).then((x: nodestd.fs.Stats) => {});
|
||||
fs.stat(new URL("file://file")).then((x: nodestd.fs.Stats) => {});
|
||||
|
||||
const a: nodestd.fs.Stats = fs.statSync("file");
|
||||
const b: nodestd.fs.Stats = fs.statSync(Buffer.from("file"));
|
||||
const c: nodestd.fs.Stats = fs.statSync(new URL("file://file"));
|
||||
}
|
||||
|
||||
namespace truncateTests {
|
||||
fs.truncate("file").then(() => {});
|
||||
fs.truncate(Buffer.from("file")).then(() => {});
|
||||
fs.truncate("file", 100).then(() => {});
|
||||
}
|
||||
|
||||
namespace writeFileTests {
|
||||
fs.writeFile("file", "hello").then(() => {});
|
||||
fs.writeFile(Buffer.from("file"), "hello").then(() => {});
|
||||
fs.writeFile(10, "hello").then(() => {});
|
||||
fs.writeFile("file", Buffer.from("hello")).then(() => {});
|
||||
fs.writeFile("file", new Uint8Array(10)).then(() => {});
|
||||
fs.writeFile("file", "hello", {}).then(() => {});
|
||||
fs.writeFile("file", "hello", { encoding: "utf8" }).then(() => {});
|
||||
fs.writeFile("file", "hello", { mode: 0o755 }).then(() => {});
|
||||
fs.writeFile("file", "hello", { flag: "w" }).then(() => {});
|
||||
}
|
||||
|
||||
namespace writeFileSyncTests {
|
||||
fs.writeFileSync("file", "hello");
|
||||
fs.writeFileSync(Buffer.from("file"), "hello");
|
||||
fs.writeFileSync(10, "hello");
|
||||
fs.writeFileSync("file", Buffer.from("hello"));
|
||||
fs.writeFileSync("file", new Uint8Array(10));
|
||||
fs.writeFileSync("file", "hello", {});
|
||||
fs.writeFileSync("file", "hello", { encoding: "utf8" });
|
||||
fs.writeFileSync("file", "hello", { mode: 0o755 });
|
||||
fs.writeFileSync("file", "hello", { flag: "w" });
|
||||
}
|
||||
|
||||
namespace appendFileTests {
|
||||
fs.appendFile("file", "hello").then(() => {});
|
||||
fs.appendFile(Buffer.from("file"), "hello").then(() => {});
|
||||
fs.appendFile(10, "hello").then(() => {});
|
||||
fs.appendFile("file", Buffer.from("hello")).then(() => {});
|
||||
fs.appendFile("file", "hello", {}).then(() => {});
|
||||
fs.appendFile("file", "hello", { encoding: "utf8" }).then(() => {});
|
||||
fs.appendFile("file", "hello", { mode: 0o755 }).then(() => {});
|
||||
fs.appendFile("file", "hello", { flag: "w" }).then(() => {});
|
||||
}
|
||||
|
||||
namespace accessTests {
|
||||
fs.access("file", fs.constants.F_OK).then(() => {});
|
||||
fs.access(Buffer.from("file"), fs.constants.F_OK).then(() => {});
|
||||
fs.access(new URL("file://file"), fs.constants.F_OK).then(() => {});
|
||||
}
|
||||
|
||||
namespace accessSyncTests {
|
||||
fs.accessSync("file", fs.constants.F_OK);
|
||||
fs.accessSync(Buffer.from("file"), fs.constants.F_OK);
|
||||
fs.accessSync(new URL("file://file"), fs.constants.F_OK);
|
||||
}
|
||||
|
||||
namespace symlinkTests {
|
||||
fs.symlink("file", "another_file").then(() => {});
|
||||
fs.symlink(Buffer.from("file"), "another_file").then(() => {});
|
||||
fs.symlink(new URL("file"), "another_file").then(() => {});
|
||||
fs.symlink("file", Buffer.from("another_file")).then(() => {});
|
||||
fs.symlink("file", new URL("another_file")).then(() => {});
|
||||
fs.symlink("file", "another_file", "dir").then(() => {});
|
||||
fs.symlink("file", "another_file", "file").then(() => {});
|
||||
fs.symlink("file", "another_file", "junction").then(() => {});
|
||||
}
|
||||
|
||||
namespace rmTests {
|
||||
fs.rm("file").then((x) => {});
|
||||
fs.rm("file", {}).then((x) => {});
|
||||
fs.rm("file", { glob: true }).then((x) => {});
|
||||
fs.rm("file", { maxBusyTries: 3 }).then((x) => {});
|
||||
fs.rm("file", { emfileWait: 100 }).then((x) => {});
|
||||
fs.rm("file", { cwd: __dirname }).then((x) => {});
|
||||
}
|
||||
|
||||
namespace ModeTests {
|
||||
const stat = fs.statSync("file");
|
||||
const mode = new fs.Mode(stat);
|
||||
{ const a: number = mode.valueOf(); }
|
||||
{ const a: boolean = mode.owner.read; }
|
||||
{ const a: boolean = mode.owner.write; }
|
||||
{ const a: boolean = mode.owner.execute; }
|
||||
{ const a: boolean = mode.group.read; }
|
||||
{ const a: boolean = mode.group.write; }
|
||||
{ const a: boolean = mode.group.execute; }
|
||||
{ const a: boolean = mode.others.read; }
|
||||
{ const a: boolean = mode.others.write; }
|
||||
{ const a: boolean = mode.others.execute; }
|
||||
}
|
||||
|
||||
namespace FileTests {
|
||||
const { File } = fs;
|
||||
const f = new File("some", "file");
|
||||
f.encoding("utf8").encoding("buffer");
|
||||
f.stat().then((x: adone.fs.I.Stats) => {});
|
||||
{ const a: adone.fs.I.Stats = f.statSync(); }
|
||||
f.lstat().then((x: adone.fs.I.Stats) => {});
|
||||
{ const a: adone.fs.I.Stats = f.lstatSync(); }
|
||||
{ const a: adone.fs.Mode = f.mode(); }
|
||||
{ const a: string = f.path(); }
|
||||
{ const a: string = f.normalizedPath(); }
|
||||
{ const a: string = f.dirname(); }
|
||||
{ const a: string = f.filename(); }
|
||||
{ const a: string = f.extname(); }
|
||||
{ const a: string = f.stem(); }
|
||||
{ const a: string = f.relativePath("/tmp"); }
|
||||
{ const a: string = f.relativePath(new fs.Directory("/tmp")); }
|
||||
f.exists().then((x: boolean) => {});
|
||||
f.create().then(() => {});
|
||||
f.create({}).then(() => {});
|
||||
f.create({ mode: 0o666 }).then(() => {});
|
||||
f.write("hello").then(() => {});
|
||||
f.write(Buffer.from("hello")).then(() => {});
|
||||
f.write("hello", {}).then(() => {});
|
||||
f.write("hello", { encoding: "utf8" }).then(() => {});
|
||||
f.write("hello", { mode: 0o666 }).then(() => {});
|
||||
f.write("hello", { flag: "w" }).then(() => {});
|
||||
f.append("hello").then(() => {});
|
||||
f.append(Buffer.from("hello")).then(() => {});
|
||||
f.append("hello", {}).then(() => {});
|
||||
f.append("hello", { encoding: "utf8" }).then(() => {});
|
||||
f.append("hello", { mode: 0o666 }).then(() => {});
|
||||
f.append("hello", { flag: "w" }).then(() => {});
|
||||
f.unlink().then(() => {});
|
||||
f.contents("utf16le").then((a: string) => {});
|
||||
f.contents("buffer").then((a: Buffer) => {});
|
||||
{ const a: string = f.contentsSync("utf16le"); }
|
||||
{ const a: Buffer = f.contentsSync("buffer"); }
|
||||
f.contentsStream("utf8").on("data", (chunk) => {});
|
||||
f.chmod(0o755).then(() => {});
|
||||
f.chmod(new fs.Mode(f.statSync())).then(() => {});
|
||||
{ const a: adone.fs.SymbolicLinkFile = f.symbolicLink("another_file"); }
|
||||
{ const a: adone.fs.SymbolicLinkFile = f.symbolicLink(new File("another_file")); }
|
||||
f.size().then((x: number) => {});
|
||||
}
|
||||
|
||||
namespace DirectoryTests {
|
||||
const { Directory } = fs;
|
||||
|
||||
const d = new Directory("some", "directory");
|
||||
{ const a: string = d.dirname(); }
|
||||
{ const a: string = d.filename(); }
|
||||
{ const a: string = d.path(); }
|
||||
{ const a: string = d.normalizedPath(); }
|
||||
{ const a: string = d.relativePath("another_dir"); }
|
||||
{ const a: string = d.relativePath(new Directory("another_dir")); }
|
||||
d.stat().then((x: adone.fs.I.Stats) => {});
|
||||
d.lstat().then((x: adone.fs.I.Stats) => {});
|
||||
d.exists().then((x: boolean) => {});
|
||||
d.create().then(() => {});
|
||||
d.create({}).then(() => {});
|
||||
d.create({ mode: 0o666 }).then(() => {});
|
||||
{ const a: string = d.resolve("file", "path"); }
|
||||
{ const a: adone.fs.Directory = d.getDirectory("nested", "directory"); }
|
||||
{ const a: adone.fs.File = d.getFile("nested", "file"); }
|
||||
{ const a: adone.fs.SymbolicLinkFile = d.getSymbolicLinkFile("nested", "filelink"); }
|
||||
{ const a: adone.fs.SymbolicLinkDirectory = d.getSymbolicLinkDirectory("nester", "dirlink"); }
|
||||
d.addFile("a", "b", "c").then((x: adone.fs.File) => {});
|
||||
d.addFile("a", "b", "c", {}).then((x: adone.fs.File) => {});
|
||||
d.addFile("a", "b", "c", { contents: "hello" }).then((x: adone.fs.File) => {});
|
||||
d.addFile("a", "b", "c", { contents: Buffer.from("hello") }).then((x: adone.fs.File) => {});
|
||||
d.addFile("a", "b", "c", { encoding: "utf8" }).then((x: adone.fs.File) => {});
|
||||
d.addFile("a", "b", "c", { mode: 0o666 }).then((x: adone.fs.File) => {});
|
||||
d.addDirectory("a", "b", "c").then((x: adone.fs.Directory) => {});
|
||||
d.files().then((x: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory>) => {});
|
||||
{ const a: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory> = d.filesSync(); }
|
||||
d.clean().then(() => {});
|
||||
d.unlink().then(() => {});
|
||||
d.unlink({ delay: 100 }).then(() => {});
|
||||
d.unlink({ retries: 100 }).then(() => {});
|
||||
d.find().then((x: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory>) => {});
|
||||
d.find({}).then((x: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory>) => {});
|
||||
d.find({ dirs: true }).then((x: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory>) => {});
|
||||
d.find({ files: false }).then((x: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory>) => {});
|
||||
{ const a: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory> = d.findSync(); }
|
||||
{ const a: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory> = d.findSync({}); }
|
||||
{ const a: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory> = d.findSync({ dirs: true }); }
|
||||
{ const a: Array<adone.fs.File | adone.fs.Directory | adone.fs.SymbolicLinkFile | adone.fs.SymbolicLinkDirectory> = d.findSync({ files: false }); }
|
||||
d.rename("name").then(() => {});
|
||||
d.rename(new Directory("name")).then(() => {});
|
||||
d.symbolicLink("another").then((x: adone.fs.SymbolicLinkDirectory) => {});
|
||||
d.copyTo("another").then(() => {});
|
||||
d.copyTo("another", {}).then(() => {});
|
||||
d.copyTo("another", { cwd: "/tmp" }).then(() => {});
|
||||
d.copyTo("another", { ignoreExisting: true }).then(() => {});
|
||||
d.copyFrom("another", { cwd: "/tmp" }).then(() => {});
|
||||
d.copyFrom("another", { ignoreExisting: true }).then(() => {});
|
||||
|
||||
Directory.create("hello", "world").then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp().then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp({ dir: "/" }).then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp({ ext: ".exe" }).then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp({ name: "hello" }).then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp({ prefix: "/tmp/t-" }).then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp({ template: /XASDX/ }).then((x: adone.fs.Directory) => {});
|
||||
Directory.createTmp({ tries: 100500 }).then((x: adone.fs.Directory) => {});
|
||||
}
|
||||
|
||||
namespace SymbolicLinkFileTests {
|
||||
const s = new fs.SymbolicLinkFile("path", "to", "link");
|
||||
s.realpath().then((x: string) => {});
|
||||
s.contents("utf8").then((x: string) => {});
|
||||
s.contents("buffer").then((x: Buffer) => {});
|
||||
{ const a: string = s.contentsSync("utf8"); }
|
||||
{ const a: Buffer = s.contentsSync("buffer"); }
|
||||
s.contentsStream("utf8").on("data", (chunk) => {});
|
||||
}
|
||||
|
||||
namespace SymbolicLinkDirectoryTests {
|
||||
const s = new fs.SymbolicLinkDirectory("path", "to", "link");
|
||||
s.realpath().then((x: string) => {});
|
||||
s.unlink().then(() => {});
|
||||
}
|
||||
|
||||
namespace RandomAccessFileTests {
|
||||
new fs.RandomAccessFile("hello", {});
|
||||
new fs.RandomAccessFile("hello", { appendable: true });
|
||||
new fs.RandomAccessFile("hello", { readable: true });
|
||||
new fs.RandomAccessFile("hello", { writable: true });
|
||||
new fs.RandomAccessFile("hello", { cwd: "/tmp" });
|
||||
new fs.RandomAccessFile("hello", { mtime: 100500 });
|
||||
new fs.RandomAccessFile("hello", { atime: 100500 });
|
||||
const raf = new fs.RandomAccessFile("hello");
|
||||
raf.read(100).then((x: Buffer) => {});
|
||||
raf.read(100, 100).then((x: Buffer) => {});
|
||||
raf.write("hello").then((x: number) => {});
|
||||
raf.write(Buffer.from("hello")).then((x: number) => {});
|
||||
raf.write("hello", 100).then((x: number) => {});
|
||||
raf.close().then(() => {});
|
||||
raf.end().then(() => {});
|
||||
raf.end({}).then(() => {});
|
||||
raf.end({ atime: 100500 }).then(() => {});
|
||||
raf.end({ mtime: 100500 }).then(() => {});
|
||||
raf.truncate(0).then(() => {});
|
||||
raf.unlink().then(() => {});
|
||||
fs.RandomAccessFile.open("hello").then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", {}).then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", { appendable: true }).then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", { readable: true }).then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", { writable: true }).then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", { cwd: "/tmp" }).then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", { mtime: 100500 }).then((x: adone.fs.RandomAccessFile) => {});
|
||||
fs.RandomAccessFile.open("hello", { atime: 100500 }).then((x: adone.fs.RandomAccessFile) => {});
|
||||
}
|
||||
|
||||
namespace globTests {
|
||||
fs.glob("hello").forEach((x: string) => {});
|
||||
fs.glob(["hello"]).forEach((x: string) => {});
|
||||
fs.glob(["hello"]).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { absolute: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { cache: new Map() }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { cwd: "/" }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { dot: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { follow: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { ignore: "a" }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { ignore: ["a"] }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { mark: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { matchBase: false }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nobrace: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nocase: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nodir: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { noext: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { noglobstar: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nomount: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nonull: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nosort: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { nounique: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { patternIndex: true }).forEach((x: { patternIndex: number, path: string }) => {});
|
||||
fs.glob(["hello"], { realpath: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { realpathCache: new Map() }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { root: "/" }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { silent: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { stat: true }).forEach((x: { stat: adone.fs.I.Stats, path: string }) => {});
|
||||
fs.glob(["hello"], { statCache: new Map() }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { strict: true }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { symlinks: new Map() }).forEach((x: string) => {});
|
||||
fs.glob(["hello"], { stat: true, patternIndex: true }).forEach((x: { path: string, patternIndex: number, stat: adone.fs.I.Stats }) => {});
|
||||
new fs.glob.Core("hello").forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"]).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"]).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { absolute: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { cache: new Map() }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { cwd: "/" }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { dot: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { follow: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { ignore: "a" }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { ignore: ["a"] }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { mark: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { matchBase: false }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nobrace: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nocase: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nodir: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { noext: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { noglobstar: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nomount: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nonull: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nosort: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { nounique: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { patternIndex: true }).forEach((x: { patternIndex: number, path: string }) => {});
|
||||
new fs.glob.Core(["hello"], { realpath: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { realpathCache: new Map() }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { root: "/" }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { silent: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { stat: true }).forEach((x: { stat: adone.fs.I.Stats, path: string }) => {});
|
||||
new fs.glob.Core(["hello"], { statCache: new Map() }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { strict: true }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { symlinks: new Map() }).forEach((x: string) => {});
|
||||
new fs.glob.Core(["hello"], { stat: true, patternIndex: true }).forEach((x: { path: string, patternIndex: number, stat: adone.fs.I.Stats }) => {});
|
||||
new fs.glob.Glob("hello").on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello").on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { absolute: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { cache: new Map() }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { cwd: "/" }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { dot: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { follow: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { ignore: "a" }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { ignore: ["a"] }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { mark: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { matchBase: false }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nobrace: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nocase: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nodir: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { noext: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { noglobstar: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nomount: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nonull: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nosort: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { nounique: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { realpath: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { realpathCache: new Map() }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { root: "/" }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { silent: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { stat: true }).on("match", (path: string, stat: adone.fs.I.Stats) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { statCache: new Map() }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { strict: true }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", { symlinks: new Map() }).on("match", (path: string) => {}).on("end", (cb: string[]) => {});
|
||||
new fs.glob.Glob("hello", {}, (err: any, matches: string[]) => {}).on("end", () => {});
|
||||
new fs.glob.Glob("hello", (err: any, matches: string[]) => {}).on("end", () => {});
|
||||
new fs.glob.Glob("hello").pause();
|
||||
new fs.glob.Glob("hello").resume();
|
||||
new fs.glob.Glob("hello").abort();
|
||||
}
|
||||
|
||||
namespace WatcherTests {
|
||||
new fs.Watcher();
|
||||
new fs.Watcher({});
|
||||
new fs.Watcher({ alwaysStat: true });
|
||||
new fs.Watcher({ atomic: true });
|
||||
new fs.Watcher({ awaitWriteFinish: true });
|
||||
new fs.Watcher({ awaitWriteFinish: { pollInterval: 100 } });
|
||||
new fs.Watcher({ awaitWriteFinish: { stabilityThreshold: 100 } });
|
||||
new fs.Watcher({ binaryInterval: 100 });
|
||||
new fs.Watcher({ cwd: "/tmp" });
|
||||
new fs.Watcher({ depth: 10 });
|
||||
new fs.Watcher({ disableGlobbing: true });
|
||||
new fs.Watcher({ followSymlinks: false });
|
||||
new fs.Watcher({ ignored: ["hello"] });
|
||||
new fs.Watcher({ ignoreInitial: true });
|
||||
new fs.Watcher({ ignorePermissionErrors: false });
|
||||
new fs.Watcher({ interval: 100 });
|
||||
new fs.Watcher({ persistent: false });
|
||||
new fs.Watcher({ useFsEvents: false });
|
||||
new fs.Watcher({ usePolling: false });
|
||||
const w = new fs.Watcher();
|
||||
{ const a: adone.fs.Watcher = w.add("hello"); }
|
||||
{ const a: adone.fs.Watcher = w.add(["hello"]); }
|
||||
{
|
||||
const watched = w.getWatched();
|
||||
const a: string[] = watched["/tmp"];
|
||||
}
|
||||
w.on("add", (path: string, stat: adone.fs.I.Stats) => {});
|
||||
w.on("addDir", (path: string, stat: adone.fs.I.Stats) => {});
|
||||
w.on("all", (event: adone.fs.I.Watcher.Event, path: string, stat: adone.fs.I.Stats) => {});
|
||||
w.on("raw", (event: string, path: string, details: object) => {});
|
||||
}
|
||||
|
||||
namespace watchTests {
|
||||
{ const a: adone.fs.Watcher = fs.watch("path"); }
|
||||
{ const a: adone.fs.Watcher = fs.watch(["path"]); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", {}); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { alwaysStat: true }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { atomic: true }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { awaitWriteFinish: true }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { awaitWriteFinish: {} }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { awaitWriteFinish: { pollInterval: 100 } }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { awaitWriteFinish: { stabilityThreshold: 100 } }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { binaryInterval: 100 }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { cwd: "/tmp" }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { depth: 10 }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { disableGlobbing: true }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { followSymlinks: false }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { ignored: ["hello"] }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { ignoreInitial: false }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { ignorePermissionErrors: false }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { interval: 100 }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { persistent: false }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { useFsEvents: false }); }
|
||||
{ const a: adone.fs.Watcher = fs.watch("path", { usePolling: false }); }
|
||||
}
|
||||
|
||||
namespace isTests {
|
||||
const { is } = fs;
|
||||
is.file("hello").then((x: boolean) => {});
|
||||
{ const a: boolean = is.fileSync("hello"); }
|
||||
is.directory("hello").then((x: boolean) => {});
|
||||
{ const a: boolean = is.directorySync("hello"); }
|
||||
is.executable("hello").then((x: boolean) => {});
|
||||
{ const a: boolean = is.executableSync("hello"); }
|
||||
}
|
||||
|
||||
namespace whichTests {
|
||||
const { which } = fs;
|
||||
|
||||
which("hello").then((x: string) => {});
|
||||
which("hello", { nothrow: true }).then((x: string | null) => {});
|
||||
which("hello", { all: true }).then((x: string[]) => {});
|
||||
which("hello", { all: true, nothrow: true }).then((x: string[] | null) => {});
|
||||
which("hello", { colon: ":" }).then((x: string) => {});
|
||||
which("hello", { path: "/" }).then((x: string) => {});
|
||||
which("hello", { pathExt: "asd" }).then((x: string) => {});
|
||||
}
|
||||
|
||||
namespace whichSyncTests {
|
||||
const { whichSync } = fs;
|
||||
|
||||
{ const a: string = whichSync("hello"); }
|
||||
{ const a: string | null = whichSync("hello", { nothrow: true }); }
|
||||
{ const a: string[] = whichSync("hello", { all: true }); }
|
||||
{ const a: string[] | null = whichSync("hello", { all: true, nothrow: true }); }
|
||||
{ const a: string = whichSync("hello", { colon: ":" }); }
|
||||
{ const a: string = whichSync("hello", { path: "/" }); }
|
||||
{ const a: string = whichSync("hello", { pathExt: "asd" }); }
|
||||
}
|
||||
|
||||
namespace fdTests {
|
||||
const { fd } = fs;
|
||||
fd.open("hello", "r+").then((x: number) => {});
|
||||
fd.open(Buffer.from("hello"), "r+").then((x: number) => {});
|
||||
fd.open(new URL("file://hello"), "r+").then((x: number) => {});
|
||||
{ const a: number = fd.openSync("hello", "r+"); }
|
||||
{ const a: number = fd.openSync(Buffer.from("hello"), "r+"); }
|
||||
{ const a: number = fd.openSync(new URL("file://hello"), "r+"); }
|
||||
fd.close(10).then(() => {});
|
||||
fd.closeSync(10);
|
||||
fd.utimes(10, 100500, 100500).then(() => {});
|
||||
fd.utimesSync(10, 100500, 100500);
|
||||
fd.stat(10).then((x: adone.fs.I.Stats) => {});
|
||||
{ const a: adone.fs.I.Stats = fd.statSync(10); }
|
||||
fd.truncate(10).then(() => {});
|
||||
fd.truncate(10, 10).then(() => {});
|
||||
fd.truncateSync(10);
|
||||
fd.truncateSync(10, 10);
|
||||
fd.read(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {});
|
||||
{ const a: number = fd.readSync(10, Buffer.alloc(10), 0, 10, 10); }
|
||||
fd.write(10, Buffer.alloc(10), 0, 10, 10).then((x: number) => {});
|
||||
{ const a: number = fd.writeSync(10, Buffer.alloc(10), 0, 10, 10); }
|
||||
fd.write(10, "hello", 10, "utf8").then((x: number) => {});
|
||||
{ const a: number = fd.writeSync(10, "hello", 10, "utf8"); }
|
||||
fd.sync(10).then(() => {});
|
||||
fd.syncSync(10);
|
||||
fd.chown(10, 0, 0).then(() => {});
|
||||
fd.chownSync(10, 0, 0);
|
||||
fd.chmod(10, 0o755).then(() => {});
|
||||
fd.chmodSync(10, 0o755);
|
||||
fd.seek(10, 100, 0).then((x: number) => {});
|
||||
fd.lock(10, "sh").then(() => {});
|
||||
}
|
||||
|
||||
namespace constantsTests {
|
||||
// ?
|
||||
const a: number = fs.constants.F_OK;
|
||||
}
|
||||
|
||||
namespace realpathTests {
|
||||
fs.realpath("hello").then((x: string) => {});
|
||||
fs.realpath("hello", "utf8").then((x: string) => {});
|
||||
fs.realpath("hello", "buffer").then((x: Buffer) => {});
|
||||
fs.realpath("hello", { encoding: "buffer" }).then((x: Buffer) => {});
|
||||
fs.realpath("hello", { encoding: "utf8" }).then((x: string) => {});
|
||||
fs.realpath("hello", {}).then((x: string) => {});
|
||||
fs.realpath(Buffer.from("hello")).then((x: string) => {});
|
||||
fs.realpath(new URL("file://hello")).then((x: string) => {});
|
||||
}
|
||||
|
||||
namespace realpathSyncTests {
|
||||
{ const a: string = fs.realpathSync("hello"); }
|
||||
{ const a: string = fs.realpathSync("hello", "utf8"); }
|
||||
{ const a: Buffer = fs.realpathSync("hello", "buffer"); }
|
||||
{ const a: Buffer = fs.realpathSync("hello", { encoding: "buffer" }); }
|
||||
{ const a: string = fs.realpathSync("hello", { encoding: "utf8" }); }
|
||||
{ const a: string = fs.realpathSync("hello", {}); }
|
||||
{ const a: string = fs.realpathSync(Buffer.from("hello")); }
|
||||
{ const a: string = fs.realpathSync(new URL("file://hello")); }
|
||||
}
|
||||
|
||||
namespace readFileTests {
|
||||
fs.readFile("hello").then((x: Buffer) => {});
|
||||
fs.readFile(Buffer.from("hello")).then((x: Buffer) => {});
|
||||
fs.readFile(new URL("file://hello")).then((x: Buffer) => {});
|
||||
fs.readFile("hello", "utf8").then((x: string) => {});
|
||||
fs.readFile("hello", null).then((x: Buffer) => {});
|
||||
fs.readFile("hello", {}).then((x: Buffer) => {});
|
||||
fs.readFile("hello", { check: true }).then((x: null | Buffer) => {});
|
||||
fs.readFile("hello", { check: true, encoding: "utf8" }).then((x: null | string) => {});
|
||||
fs.readFile("hello", { encoding: "utf8" }).then((x: string) => {});
|
||||
fs.readFile("hello", { encoding: null }).then((x: Buffer) => {});
|
||||
fs.readFile("hello", { flags: "r+" }).then((x: Buffer) => {});
|
||||
}
|
||||
|
||||
namespace readFileSyncTests {
|
||||
{ const a: Buffer = fs.readFileSync("hello"); }
|
||||
{ const a: Buffer = fs.readFileSync(Buffer.from("hello")); }
|
||||
{ const a: Buffer = fs.readFileSync(new URL("file://hello")); }
|
||||
{ const a: string = fs.readFileSync("hello", "utf8"); }
|
||||
{ const a: Buffer = fs.readFileSync("hello", null); }
|
||||
{ const a: Buffer = fs.readFileSync("hello", {}); }
|
||||
{ const a: null | Buffer = fs.readFileSync("hello", { check: true }); }
|
||||
{ const a: null | string = fs.readFileSync("hello", { check: true, encoding: "utf8" }); }
|
||||
{ const a: string = fs.readFileSync("hello", { encoding: "utf8" }); }
|
||||
{ const a: Buffer = fs.readFileSync("hello", { encoding: null }); }
|
||||
{ const a: Buffer = fs.readFileSync("hello", { flags: "r+" }); }
|
||||
}
|
||||
|
||||
namespace readLinesTests {
|
||||
fs.readLines("hello").then((x: string[]) => {});
|
||||
fs.readLines(Buffer.from("hello")).then((x: string[]) => {});
|
||||
fs.readLines(new URL("file://hello")).then((x: string[]) => {});
|
||||
fs.readLines("hello", "utf8").then((x: string[]) => {});
|
||||
fs.readLines("hello", null).then((x: string[]) => {});
|
||||
fs.readLines("hello", {}).then((x: string[]) => {});
|
||||
fs.readLines("hello", { check: true }).then((x: null | string[]) => {});
|
||||
fs.readLines("hello", { encoding: "utf8" }).then((x: null | string[]) => {});
|
||||
fs.readLines("hello", { encoding: null }).then((x: null | string[]) => {});
|
||||
fs.readLines("hello", { flags: "r+" }).then((x: null | string[]) => {});
|
||||
}
|
||||
|
||||
namespace readLinesSyncTests {
|
||||
{ const a: string[] = fs.readLinesSync("hello"); }
|
||||
{ const a: string[] = fs.readLinesSync(Buffer.from("hello")); }
|
||||
{ const a: string[] = fs.readLinesSync(new URL("file://hello")); }
|
||||
{ const a: string[] = fs.readLinesSync("hello", "utf8"); }
|
||||
{ const a: string[] = fs.readLinesSync("hello", null); }
|
||||
{ const a: string[] = fs.readLinesSync("hello", {}); }
|
||||
{ const a: null | string[] = fs.readLinesSync("hello", { check: true }); }
|
||||
{ const a: string[] = fs.readLinesSync("hello", { encoding: "utf8" }); }
|
||||
{ const a: string[] = fs.readLinesSync("hello", { encoding: null }); }
|
||||
{ const a: string[] = fs.readLinesSync("hello", { flags: "r+" }); }
|
||||
}
|
||||
|
||||
namespace readWordsTests {
|
||||
fs.readWords("hello").then((x: string[]) => {});
|
||||
fs.readWords(Buffer.from("hello")).then((x: string[]) => {});
|
||||
fs.readWords(new URL("file://hello")).then((x: string[]) => {});
|
||||
fs.readWords("hello", "utf8").then((x: string[]) => {});
|
||||
fs.readWords("hello", null).then((x: string[]) => {});
|
||||
fs.readWords("hello", {}).then((x: string[]) => {});
|
||||
fs.readWords("hello", { check: true }).then((x: null | string[]) => {});
|
||||
fs.readWords("hello", { encoding: "utf8" }).then((x: null | string[]) => {});
|
||||
fs.readWords("hello", { encoding: null }).then((x: null | string[]) => {});
|
||||
fs.readWords("hello", { flags: "r+" }).then((x: null | string[]) => {});
|
||||
}
|
||||
|
||||
namespace readWordsSyncTests {
|
||||
{ const a: string[] = fs.readWordsSync("hello"); }
|
||||
{ const a: string[] = fs.readWordsSync(Buffer.from("hello")); }
|
||||
{ const a: string[] = fs.readWordsSync(new URL("file://hello")); }
|
||||
{ const a: string[] = fs.readWordsSync("hello", "utf8"); }
|
||||
{ const a: string[] = fs.readWordsSync("hello", null); }
|
||||
{ const a: string[] = fs.readWordsSync("hello", {}); }
|
||||
{ const a: null | string[] = fs.readWordsSync("hello", { check: true }); }
|
||||
{ const a: string[] = fs.readWordsSync("hello", { encoding: "utf8" }); }
|
||||
{ const a: string[] = fs.readWordsSync("hello", { encoding: null }); }
|
||||
{ const a: string[] = fs.readWordsSync("hello", { flags: "r+" }); }
|
||||
}
|
||||
|
||||
namespace existsTests {
|
||||
fs.exists("hello").then((x: boolean) => {});
|
||||
fs.exists(Buffer.from("hello")).then((x: boolean) => {});
|
||||
fs.exists(new URL("file://hello")).then((x: boolean) => {});
|
||||
}
|
||||
|
||||
namespace existsSyncTests {
|
||||
{ const a: boolean = fs.existsSync("hello"); }
|
||||
{ const a: boolean = fs.existsSync(Buffer.from("hello")); }
|
||||
{ const a: boolean = fs.existsSync(new URL("file://hello")); }
|
||||
}
|
||||
|
||||
namespace mkdirTests {
|
||||
fs.mkdir("/path/to/some/dir").then(() => {});
|
||||
fs.mkdir("/path/to/some/dir", 0o755).then(() => {});
|
||||
}
|
||||
|
||||
namespace copyTests {
|
||||
fs.copy("a", "b").then(() => {});
|
||||
fs.copy("a", "b", {}).then(() => {});
|
||||
fs.copy("a", "b", { cwd: "/tmp" }).then(() => {});
|
||||
fs.copy("a", "b", { ignoreExisting: true }).then(() => {});
|
||||
}
|
||||
|
||||
namespace renameTests {
|
||||
fs.rename("a", "b").then(() => {});
|
||||
fs.rename("a", "b", {}).then(() => {});
|
||||
fs.rename("a", "b", { delay: 100 }).then(() => {});
|
||||
fs.rename("a", "b", { retries: 100 }).then(() => {});
|
||||
}
|
||||
|
||||
namespace tailTests {
|
||||
fs.tail("file", 10).then((x: Buffer[]) => {});
|
||||
fs.tail("file", 10, {}).then((x: Buffer[]) => {});
|
||||
fs.tail("file", 10, { separator: "\n" }).then((x: Buffer[]) => {});
|
||||
fs.tail("file", 10, { chunkLength: 4096 }).then((x: Buffer[]) => {});
|
||||
}
|
||||
|
||||
namespace statVFSTests {
|
||||
fs.statVFS("/tmp").then((x) => {
|
||||
{ const a: number = x.f_namemax; }
|
||||
{ const a: number = x.f_bsize; }
|
||||
{ const a: number = x.f_frsize; }
|
||||
{ const a: number = x.f_blocks; }
|
||||
{ const a: number = x.f_bavail; }
|
||||
{ const a: number = x.f_bfree; }
|
||||
{ const a: number = x.f_files; }
|
||||
{ const a: number = x.f_favail; }
|
||||
{ const a: number = x.f_ffree; }
|
||||
});
|
||||
}
|
||||
|
||||
namespace createReadStreamTests {
|
||||
fs.createReadStream("file").on("data", (chunk) => {});
|
||||
fs.createReadStream(Buffer.from("file")).on("data", (chunk) => {});
|
||||
fs.createReadStream(new URL("file://file")).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", null).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", "utf8").on("data", (chunk) => {});
|
||||
fs.createReadStream("file", { encoding: "usc2" }).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", { encoding: null }).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", { flags: "r+" }).on("data", (chunk) => {});
|
||||
fs.createReadStream(null, { fd: 10, autoClose: false }).on("data", (chunk) => {});
|
||||
fs.createReadStream(undefined, { fd: 10 }).on("data", (chunk) => {});
|
||||
fs.createReadStream(null, { fd: 10 }).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", { mode: 0o666 }).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", { start: 100 }).on("data", (chunk) => {});
|
||||
fs.createReadStream("file", { end: 110 }).on("data", (chunk) => {});
|
||||
}
|
||||
|
||||
namespace createWriteStreamTests {
|
||||
fs.createWriteStream("file").on("data", (chunk) => {});
|
||||
fs.createWriteStream(Buffer.from("file")).on("data", (chunk) => {});
|
||||
fs.createWriteStream(new URL("file://file")).on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", null).on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", "utf8").on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", { defaultEncoding: "usc2" }).on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", { defaultEncoding: null }).on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", { flags: "r+" }).on("data", (chunk) => {});
|
||||
fs.createWriteStream(null, { fd: 10, autoClose: false }).on("data", (chunk) => {});
|
||||
fs.createWriteStream(undefined, { fd: 10 }).on("data", (chunk) => {});
|
||||
fs.createWriteStream(null, { fd: 10 }).on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", { mode: 0o666 }).on("data", (chunk) => {});
|
||||
fs.createWriteStream("file", { start: 100 }).on("data", (chunk) => {});
|
||||
}
|
||||
|
||||
namespace tmpNameTests {
|
||||
fs.tmpName().then((x: string) => {});
|
||||
fs.tmpName({}).then((x: string) => {});
|
||||
fs.tmpName({ dir: "/" }).then((x: string) => {});
|
||||
fs.tmpName({ ext: ".exe" }).then((x: string) => {});
|
||||
fs.tmpName({ name: "ad" }).then((x: string) => {});
|
||||
fs.tmpName({ prefix: "/tmp/tmp-" }).then((x: string) => {});
|
||||
fs.tmpName({ template: /XXX/ }).then((x: string) => {});
|
||||
fs.tmpName({ tries: 100 }).then((x: string) => {});
|
||||
}
|
||||
|
||||
namespace homeDirTests {
|
||||
const a: string = fs.homeDir();
|
||||
}
|
||||
|
||||
namespace lookupTests {
|
||||
// TODO
|
||||
}
|
||||
|
||||
namespace chownrTests {
|
||||
fs.chownr("hello", 1000, 1000).then(() => {});
|
||||
}
|
||||
|
||||
namespace TailWatcherTests {
|
||||
new fs.TailWatcher("file");
|
||||
new fs.TailWatcher("file", {});
|
||||
new fs.TailWatcher("file", { encoding: "utf8" });
|
||||
new fs.TailWatcher("file", { follow: true });
|
||||
new fs.TailWatcher("file", { fromBeginning: true });
|
||||
new fs.TailWatcher("file", { fsWatchOptions: {} });
|
||||
new fs.TailWatcher("file", { pos: 100 });
|
||||
new fs.TailWatcher("file", { separator: "\n" });
|
||||
new fs.TailWatcher("file", { separator: /\n/ });
|
||||
new fs.TailWatcher("file", { useWatchFile: true });
|
||||
const tw = new fs.TailWatcher("file");
|
||||
tw.unwatch();
|
||||
tw.on("line", (line: string) => {
|
||||
});
|
||||
}
|
||||
|
||||
namespace watchTailTests {
|
||||
const tw: adone.fs.TailWatcher = fs.watchTail("file");
|
||||
fs.watchTail("file", {});
|
||||
fs.watchTail("file", { encoding: "utf8" });
|
||||
fs.watchTail("file", { follow: true });
|
||||
fs.watchTail("file", { fromBeginning: true });
|
||||
fs.watchTail("file", { fsWatchOptions: {} });
|
||||
fs.watchTail("file", { pos: 100 });
|
||||
fs.watchTail("file", { separator: "\n" });
|
||||
fs.watchTail("file", { separator: /\n/ });
|
||||
fs.watchTail("file", { useWatchFile: true });
|
||||
}
|
||||
}
|
||||
115
types/adone/test/glosses/is.ts
Normal file
115
types/adone/test/glosses/is.ts
Normal file
@ -0,0 +1,115 @@
|
||||
namespace isTests {
|
||||
{ const a: boolean = adone.is.null({}); }
|
||||
{ const a: boolean = adone.is.undefined({}); }
|
||||
{ const a: boolean = adone.is.exist({}); }
|
||||
{ const a: boolean = adone.is.nil({}); }
|
||||
{ const a: boolean = adone.is.number({}); }
|
||||
{ const a: boolean = adone.is.numeral({}); }
|
||||
{ const a: boolean = adone.is.infinite({}); }
|
||||
{ const a: boolean = adone.is.odd({}); }
|
||||
{ const a: boolean = adone.is.even({}); }
|
||||
{ const a: boolean = adone.is.float({}); }
|
||||
{ const a: boolean = adone.is.negativeZero({}); }
|
||||
{ const a: boolean = adone.is.string({}); }
|
||||
{ const a: boolean = adone.is.emptyString({}); }
|
||||
{ const a: boolean = adone.is.substring("abc", "abcdef"); }
|
||||
{ const a: boolean = adone.is.substring("abc", "abcdef", 0); }
|
||||
{ const a: boolean = adone.is.prefix("abc", "abcdef"); }
|
||||
{ const a: boolean = adone.is.suffix("def", "abbdef"); }
|
||||
{ const a: boolean = adone.is.boolean({}); }
|
||||
{ const a: boolean = adone.is.json({}); }
|
||||
{ const a: boolean = adone.is.object({}); }
|
||||
{ const a: boolean = adone.is.plainObject({}); }
|
||||
{ const a: boolean = adone.is.class({}); }
|
||||
{ const a: boolean = adone.is.emptyObject({}); }
|
||||
{ const a: boolean = adone.is.propertyOwned({}, "a"); }
|
||||
{ const a: boolean = adone.is.propertyDefined({}, "a"); }
|
||||
{ const a: boolean = adone.is.conforms({}, {}); }
|
||||
{ const a: boolean = adone.is.conforms({}, {}, true); }
|
||||
{ const a: boolean = adone.is.arrayLikeObject({}); }
|
||||
{ const a: boolean = adone.is.inArray(1, [1, 2, 3]); }
|
||||
{ const a: boolean = adone.is.inArray(1, [1, 2, 3], 0); }
|
||||
{ const a: boolean = adone.is.inArray(1, [1, 2, 3], 0, (a, b) => a === b); }
|
||||
{ const a: boolean = adone.is.sameType({}, {}); }
|
||||
{ const a: boolean = adone.is.primitive({}); }
|
||||
{ const a: boolean = adone.is.equalArrays([], []); }
|
||||
{ const a: boolean = adone.is.deepEqual({}, {}); }
|
||||
{ const a: boolean = adone.is.shallowEqual({}, {}); }
|
||||
{ const a: boolean = adone.is.stream({}); }
|
||||
{ const a: boolean = adone.is.writableStream({}); }
|
||||
{ const a: boolean = adone.is.readableStream({}); }
|
||||
{ const a: boolean = adone.is.duplexStream({}); }
|
||||
{ const a: boolean = adone.is.transformStream({}); }
|
||||
{ const a: boolean = adone.is.utf8(Buffer.alloc(10)); }
|
||||
{ const a: boolean = adone.is.win32PathAbsolute("abc"); }
|
||||
{ const a: boolean = adone.is.posixPathAbsolute("abc"); }
|
||||
{ const a: boolean = adone.is.pathAbsolute("abc"); }
|
||||
{ const a: boolean = adone.is.glob("abc"); }
|
||||
{ const a: boolean = adone.is.dotfile("abc"); }
|
||||
{ const a: boolean = adone.is.function(() => { }); }
|
||||
{ const a: boolean = adone.is.asyncFunction(async () => { }); }
|
||||
{ const a: boolean = adone.is.promise({}); }
|
||||
{ const a: boolean = adone.is.validDate("07.08.2017"); }
|
||||
{ const a: boolean = adone.is.buffer({}); }
|
||||
{ const a: boolean = adone.is.callback({}); }
|
||||
{ const a: boolean = adone.is.generator({}); }
|
||||
{ const a: boolean = adone.is.nan({}); }
|
||||
{ const a: boolean = adone.is.finite({}); }
|
||||
{ const a: boolean = adone.is.integer({}); }
|
||||
{ const a: boolean = adone.is.safeInteger({}); }
|
||||
{ const a: boolean = adone.is.array({}); }
|
||||
{ const a: boolean = adone.is.uint8Array({}); }
|
||||
{ const a: boolean = adone.is.configuration({}); }
|
||||
{ const a: boolean = adone.is.long({}); }
|
||||
{ const a: boolean = adone.is.bigNumber({}); }
|
||||
{ const a: boolean = adone.is.byteArray({}); }
|
||||
{ const a: boolean = adone.is.datetime({}); }
|
||||
{ const a: boolean = adone.is.transform({}); }
|
||||
{ const a: boolean = adone.is.subsystem({}); }
|
||||
{ const a: boolean = adone.is.application({}); }
|
||||
{ const a: boolean = adone.is.logger({}); }
|
||||
{ const a: boolean = adone.is.coreStream({}); }
|
||||
{ const a: boolean = adone.is.fastStream({}); }
|
||||
{ const a: boolean = adone.is.fastLocalStream({}); }
|
||||
{ const a: boolean = adone.is.fastLocalMapStream({}); }
|
||||
{ const a: boolean = adone.is.genesisNetron({}); }
|
||||
{ const a: boolean = adone.is.genesisPeer({}); }
|
||||
{ const a: boolean = adone.is.netronAdapter({}); }
|
||||
{ const a: boolean = adone.is.netron({}); }
|
||||
{ const a: boolean = adone.is.netronPeer({}); }
|
||||
{ const a: boolean = adone.is.netronDefinition({}); }
|
||||
{ const a: boolean = adone.is.netronDefinitions({}); }
|
||||
{ const a: boolean = adone.is.netronReference({}); }
|
||||
{ const a: boolean = adone.is.netronInterface({}); }
|
||||
{ const a: boolean = adone.is.netronContext({}); }
|
||||
{ const a: boolean = adone.is.netronIMethod({}, "hello"); }
|
||||
{ const a: boolean = adone.is.netronIProperty({}, "hello"); }
|
||||
{ const a: boolean = adone.is.netronStub({}); }
|
||||
{ const a: boolean = adone.is.netronRemoteStub({}); }
|
||||
{ const a: boolean = adone.is.netronStream({}); }
|
||||
{ const a: boolean = adone.is.iterable({}); }
|
||||
{ const a: boolean = adone.is.windows; }
|
||||
{ const a: boolean = adone.is.linux; }
|
||||
{ const a: boolean = adone.is.freebsd; }
|
||||
{ const a: boolean = adone.is.darwin; }
|
||||
{ const a: boolean = adone.is.sunos; }
|
||||
{ const a: boolean = adone.is.uppercase("abc"); }
|
||||
{ const a: boolean = adone.is.lowercase("abc"); }
|
||||
{ const a: boolean = adone.is.digits("012"); }
|
||||
{ const a: boolean = adone.is.identifier("someMethod"); }
|
||||
{ const a: boolean = adone.is.binaryExtension("mp3"); }
|
||||
{ const a: boolean = adone.is.binaryPath("a.mp3"); }
|
||||
{ const a: boolean = adone.is.ip4("192.168.1.1"); }
|
||||
{ const a: boolean = adone.is.ip6("::192.168.1.1"); }
|
||||
{ const a: boolean = adone.is.arrayBuffer({}); }
|
||||
{ const a: boolean = adone.is.arrayBufferView({}); }
|
||||
{ const a: boolean = adone.is.date({}); }
|
||||
{ const a: boolean = adone.is.error({}); }
|
||||
{ const a: boolean = adone.is.map({}); }
|
||||
{ const a: boolean = adone.is.regexp({}); }
|
||||
{ const a: boolean = adone.is.set({}); }
|
||||
{ const a: boolean = adone.is.symbol({}); }
|
||||
{ const a: boolean = adone.is.validUTF8(Buffer.from("hello")); }
|
||||
{ const a: boolean = adone.is.vaultValuable({}); }
|
||||
{ const a: boolean = adone.is.task({}); }
|
||||
}
|
||||
@ -1,259 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
474
types/adone/test/glosses/math/index.ts
Normal file
474
types/adone/test/glosses/math/index.ts
Normal file
@ -0,0 +1,474 @@
|
||||
namespace mathTests {
|
||||
const { math } = adone;
|
||||
|
||||
namespace LongTests {
|
||||
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 compareTests {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace BigNumberTests {
|
||||
const { BigNumber } = math;
|
||||
type BigNumber = adone.math.BigNumber;
|
||||
|
||||
new BigNumber(10);
|
||||
new BigNumber("10");
|
||||
new BigNumber(new BigNumber(10));
|
||||
new BigNumber("10", 2);
|
||||
|
||||
{ const a: string = new BigNumber(1).toString(); }
|
||||
{ const a: string = new BigNumber(1).toString(2); }
|
||||
|
||||
{ const a: number = new BigNumber(1).toNumber(); }
|
||||
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer(); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({}); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({ endian: 1 }); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({ endian: -1 }); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({ endian: "big" }); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({ endian: "little" }); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({ size: 1 }); }
|
||||
{ const a: Buffer = new BigNumber(1).toBuffer({ size: "auto" }); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).add(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).add("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).add(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).sub(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).sub("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).sub(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).mul(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).mul("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).mul(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).div(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).div("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).div(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).abs(); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).neg(); }
|
||||
|
||||
{ const a: number = new BigNumber(10).cmp(1); }
|
||||
{ const a: number = new BigNumber(10).cmp("1"); }
|
||||
{ const a: number = new BigNumber(10).cmp(new BigNumber(1)); }
|
||||
|
||||
{ const a: boolean = new BigNumber(10).gt(1); }
|
||||
{ const a: boolean = new BigNumber(10).gt("1"); }
|
||||
{ const a: boolean = new BigNumber(10).gt(new BigNumber(10)); }
|
||||
|
||||
{ const a: boolean = new BigNumber(10).ge(1); }
|
||||
{ const a: boolean = new BigNumber(10).ge("1"); }
|
||||
{ const a: boolean = new BigNumber(10).ge(new BigNumber(10)); }
|
||||
|
||||
{ const a: boolean = new BigNumber(10).eq(1); }
|
||||
{ const a: boolean = new BigNumber(10).eq("1"); }
|
||||
{ const a: boolean = new BigNumber(10).eq(new BigNumber(10)); }
|
||||
|
||||
{ const a: boolean = new BigNumber(10).lt(1); }
|
||||
{ const a: boolean = new BigNumber(10).lt("1"); }
|
||||
{ const a: boolean = new BigNumber(10).lt(new BigNumber(10)); }
|
||||
|
||||
{ const a: boolean = new BigNumber(10).le(1); }
|
||||
{ const a: boolean = new BigNumber(10).le("1"); }
|
||||
{ const a: boolean = new BigNumber(10).le(new BigNumber(10)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).and(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).and("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).and(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).or(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).or("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).or(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).xor(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).xor("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).xor(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).mod(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).mod("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).mod(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).pow(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).pow("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).pow(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).powm(1, 1); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm("1", 1); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm(new BigNumber(1), 1); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm(1, "1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm("1", "1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm(new BigNumber(1), "1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm(1, new BigNumber(1)); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm("1", new BigNumber(1)); }
|
||||
{ const a: BigNumber = new BigNumber(10).powm(new BigNumber(1), new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).invertm(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).invertm("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).invertm(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).rand(); }
|
||||
{ const a: BigNumber = new BigNumber(10).rand(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).rand("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).rand(new BigNumber(1)); }
|
||||
|
||||
{ const a: boolean | "maybe" = new BigNumber(10).probPrime(); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).nextPrime(); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).sqrt(); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).root(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).root("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).root(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).shiftLeft(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).shiftLeft("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).shiftLeft(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).shiftRight(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).shiftRight("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).shiftRight(new BigNumber(1)); }
|
||||
|
||||
{ const a: BigNumber = new BigNumber(10).gcd(1); }
|
||||
{ const a: BigNumber = new BigNumber(10).gcd("1"); }
|
||||
{ const a: BigNumber = new BigNumber(10).gcd(new BigNumber(1)); }
|
||||
|
||||
{ const a: number = new BigNumber(10).jacobi(1); }
|
||||
{ const a: number = new BigNumber(10).jacobi("1"); }
|
||||
{ const a: number = new BigNumber(10).jacobi(new BigNumber(1)); }
|
||||
|
||||
{ const a: number = new BigNumber(10).bitLength(); }
|
||||
|
||||
{ const a: boolean = new BigNumber(10).isBitSet(10); }
|
||||
|
||||
{ const a: BigNumber = BigNumber.prime(10); }
|
||||
{ const a: BigNumber = BigNumber.prime(10, true); }
|
||||
|
||||
{ const a: BigNumber = BigNumber.fromBuffer(Buffer.alloc(10)); }
|
||||
{ const a: BigNumber = BigNumber.fromBuffer(Buffer.alloc(10), { endian: "little" }); }
|
||||
{ const a: BigNumber = BigNumber.fromBuffer(Buffer.alloc(10), { endian: -1 }); }
|
||||
{ const a: BigNumber = BigNumber.fromBuffer(Buffer.alloc(10), { endian: 1 }); }
|
||||
{ const a: BigNumber = BigNumber.fromBuffer(Buffer.alloc(10), { endian: "big" }); }
|
||||
{ const a: BigNumber = BigNumber.fromBuffer(Buffer.alloc(10), { size: "auto" }); }
|
||||
|
||||
{ const a: BigNumber = BigNumber.ONE; }
|
||||
{ const a: BigNumber = BigNumber.ZERO; }
|
||||
}
|
||||
|
||||
namespace bitSetTests {
|
||||
const { BitSet } = math;
|
||||
type BitSet = adone.math.BitSet;
|
||||
|
||||
new BitSet(10);
|
||||
new BitSet(new BitSet(10).dehydrate());
|
||||
|
||||
{ const a: boolean = new BitSet(10).get(0); }
|
||||
{ const a: boolean = new BitSet(10).set(0); }
|
||||
{ const a: boolean = new BitSet(10).setRange(0, 10); }
|
||||
{ const a: boolean = new BitSet(10).unset(0); }
|
||||
{ const a: boolean = new BitSet(10).unsetRange(0, 10); }
|
||||
{ const a: boolean = new BitSet(10).toggle(0); }
|
||||
{ const a: boolean = new BitSet(10).toggleRange(0, 10); }
|
||||
{ const a: boolean = new BitSet(10).clear(); }
|
||||
{ const a: BitSet = new BitSet(10).clone(); }
|
||||
{ const a: string = new BitSet(10).dehydrate(); }
|
||||
|
||||
{ const a: BitSet = new BitSet(10).and(1); }
|
||||
{ const a: BitSet = new BitSet(10).and(new BitSet(10)); }
|
||||
|
||||
{ const a: BitSet = new BitSet(10).or(1); }
|
||||
{ const a: BitSet = new BitSet(10).or(new BitSet(10)); }
|
||||
|
||||
{ const a: BitSet = new BitSet(10).xor(1); }
|
||||
{ const a: BitSet = new BitSet(10).xor(new BitSet(10)); }
|
||||
|
||||
new BitSet(10).forEach((x: number) => {});
|
||||
new BitSet(10).forEach((x: number) => false);
|
||||
|
||||
{ const a: BitSet = new BitSet(10).circularShift(10); }
|
||||
{ const a: number = new BitSet(10).getCardinality(); }
|
||||
{ const a: number[] = new BitSet(10).getIndices(); }
|
||||
{ const a: boolean = new BitSet(10).isSubsetOf(new BitSet(10)); }
|
||||
{ const a: boolean = new BitSet(10).isEmpty(); }
|
||||
{ const a: boolean = new BitSet(10).isEqual(new BitSet(10)); }
|
||||
{ const a: string = new BitSet(10).toString(); }
|
||||
{ const a: number = new BitSet(10).ffs(); }
|
||||
{ const a: number = new BitSet(10).ffs(1); }
|
||||
{ const a: number = new BitSet(10).ffz(); }
|
||||
{ const a: number = new BitSet(10).ffz(1); }
|
||||
{ const a: number = new BitSet(10).fls(); }
|
||||
{ const a: number = new BitSet(10).fls(1); }
|
||||
{ const a: number = new BitSet(10).flz(); }
|
||||
{ const a: number = new BitSet(10).flz(1); }
|
||||
{ const a: number = new BitSet(10).nextSetBit(1); }
|
||||
{ const a: number = new BitSet(10).nextUnsetBit(1); }
|
||||
{ const a: number = new BitSet(10).previousSetBit(1); }
|
||||
{ const a: number = new BitSet(10).previousUnsetBit(1); }
|
||||
{ const a: number = new BitSet(10).readUInt(); }
|
||||
{ const a: number = new BitSet(10).readUInt(1); }
|
||||
{ const a: number = new BitSet(10).readUInt(1, 2); }
|
||||
{ new BitSet(10).writeUInt(1); }
|
||||
{ new BitSet(10).writeUInt(1, 2); }
|
||||
{ new BitSet(10).writeUInt(1, 2, 3); }
|
||||
{ const a: BitSet = BitSet.fromLong(new adone.math.Long(10, 20)); }
|
||||
}
|
||||
|
||||
namespace randomTests {
|
||||
const { random } = math;
|
||||
random();
|
||||
random(100);
|
||||
random(0, 10);
|
||||
}
|
||||
}
|
||||
368
types/adone/test/glosses/math/matrix.ts
Normal file
368
types/adone/test/glosses/math/matrix.ts
Normal file
@ -0,0 +1,368 @@
|
||||
namespace mathTests.matrixTests {
|
||||
const {
|
||||
vec2, vec3, vec4,
|
||||
mat2, mat2d, mat3, mat4,
|
||||
quat
|
||||
} = adone.math.matrix;
|
||||
type mat2 = adone.math.matrix.I.mat2;
|
||||
type mat2d = adone.math.matrix.I.mat2d;
|
||||
type mat3 = adone.math.matrix.I.mat3;
|
||||
type mat4 = adone.math.matrix.I.mat4;
|
||||
|
||||
let outVal: number;
|
||||
let outBool: boolean;
|
||||
let outStr: string;
|
||||
|
||||
let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
|
||||
const vec2A = vec2.fromValues(1, 2);
|
||||
const vec2B = vec2.fromValues(3, 4);
|
||||
const vec3A = vec3.fromValues(1, 2, 3);
|
||||
const vec3B = vec3.fromValues(3, 4, 5);
|
||||
const vec4A = vec4.fromValues(1, 2, 3, 4);
|
||||
const vec4B = vec4.fromValues(3, 4, 5, 6);
|
||||
const mat2A = mat2.fromValues(1, 2, 3, 4);
|
||||
const mat2B = mat2.fromValues(1, 2, 3, 4);
|
||||
const mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
|
||||
const mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
|
||||
const mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
const mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
const mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
|
||||
const mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
|
||||
const quatA = quat.fromValues(1, 2, 3, 4);
|
||||
const quatB = quat.fromValues(5, 6, 7, 8);
|
||||
|
||||
let outVec2 = vec2.create();
|
||||
let outVec3 = vec3.create();
|
||||
let outVec4 = vec4.create();
|
||||
let outMat2 = mat2.create();
|
||||
let outMat2d = mat2d.create();
|
||||
let outMat3 = mat3.create();
|
||||
let outMat4 = mat4.create();
|
||||
let outQuat = quat.create();
|
||||
|
||||
let outMat2Null: mat2 | null;
|
||||
let outMat2dNull: mat2d | null;
|
||||
let outMat3Null: mat3 | null;
|
||||
let outMat4Null: mat4 | null;
|
||||
|
||||
{
|
||||
outVec2 = vec2.create();
|
||||
outVec2 = vec2.clone(vec2A);
|
||||
outVec2 = vec2.fromValues(1, 2);
|
||||
outVec2 = vec2.copy(outVec2, vec2A);
|
||||
outVec2 = vec2.set(outVec2, 1, 2);
|
||||
outVec2 = vec2.add(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.sub(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.mul(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.divide(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.div(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.ceil(outVec2, vec2A);
|
||||
outVec2 = vec2.floor(outVec2, vec2A);
|
||||
outVec2 = vec2.min(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.max(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.round(outVec2, vec2A);
|
||||
outVec2 = vec2.scale(outVec2, vec2A, 2);
|
||||
outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
|
||||
outVal = vec2.distance(vec2A, vec2B);
|
||||
outVal = vec2.dist(vec2A, vec2B);
|
||||
outVal = vec2.squaredDistance(vec2A, vec2B);
|
||||
outVal = vec2.sqrDist(vec2A, vec2B);
|
||||
outVal = vec2.length(vec2A);
|
||||
outVal = vec2.len(vec2A);
|
||||
outVal = vec2.squaredLength(vec2A);
|
||||
outVal = vec2.sqrLen(vec2A);
|
||||
outVec2 = vec2.negate(outVec2, vec2A);
|
||||
outVec2 = vec2.inverse(outVec2, vec2A);
|
||||
outVec2 = vec2.normalize(outVec2, vec2A);
|
||||
outVal = vec2.dot(vec2A, vec2B);
|
||||
outVec2 = vec2.cross(outVec2, vec2A, vec2B);
|
||||
outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
|
||||
outVec2 = vec2.random(outVec2);
|
||||
outVec2 = vec2.random(outVec2, 5.0);
|
||||
outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
|
||||
outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
|
||||
outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
|
||||
outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
|
||||
vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
|
||||
outStr = vec2.str(vec2A);
|
||||
outBool = vec2.exactEquals(vec2A, vec2B);
|
||||
outBool = vec2.equals(vec2A, vec2B);
|
||||
outVec2 = vec2.add(outVec2, [0, 1], [2, 3]); // test one method with number array input
|
||||
}
|
||||
|
||||
{
|
||||
outVec3 = vec3.create();
|
||||
outVec3 = vec3.clone(vec3A);
|
||||
outVec3 = vec3.fromValues(1, 2, 3);
|
||||
outVec3 = vec3.copy(outVec3, vec3A);
|
||||
outVec3 = vec3.set(outVec3, 1, 2, 3);
|
||||
outVec3 = vec3.add(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.sub(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.mul(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.divide(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.div(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.ceil(outVec3, vec3A);
|
||||
outVec3 = vec3.floor(outVec3, vec3A);
|
||||
outVec3 = vec3.min(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.max(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.round(outVec3, vec3A);
|
||||
outVec3 = vec3.scale(outVec3, vec3A, 2);
|
||||
outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
|
||||
outVal = vec3.distance(vec3A, vec3B);
|
||||
outVal = vec3.dist(vec3A, vec3B);
|
||||
outVal = vec3.squaredDistance(vec3A, vec3B);
|
||||
outVal = vec3.sqrDist(vec3A, vec3B);
|
||||
outVal = vec3.length(vec3A);
|
||||
outVal = vec3.len(vec3A);
|
||||
outVal = vec3.squaredLength(vec3A);
|
||||
outVal = vec3.sqrLen(vec3A);
|
||||
outVec3 = vec3.negate(outVec3, vec3A);
|
||||
outVec3 = vec3.inverse(outVec3, vec3A);
|
||||
outVec3 = vec3.normalize(outVec3, vec3A);
|
||||
outVal = vec3.dot(vec3A, vec3B);
|
||||
outVec3 = vec3.cross(outVec3, vec3A, vec3B);
|
||||
outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
|
||||
outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
|
||||
outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
|
||||
outVec3 = vec3.random(outVec3);
|
||||
outVec3 = vec3.random(outVec3, 5.0);
|
||||
outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
|
||||
outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
|
||||
outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
|
||||
outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
|
||||
outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
|
||||
outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
|
||||
vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
|
||||
outVal = vec3.angle(vec3A, vec3B);
|
||||
outStr = vec3.str(vec3A);
|
||||
outBool = vec3.exactEquals(vec3A, vec3B);
|
||||
outBool = vec3.equals(vec3A, vec3B);
|
||||
outVec3 = vec3.add(outVec3, [0, 1, 2], [3, 4, 5]); // test one method with number array input
|
||||
}
|
||||
|
||||
{
|
||||
outVec4 = vec4.create();
|
||||
outVec4 = vec4.clone(vec4A);
|
||||
outVec4 = vec4.fromValues(1, 2, 3, 4);
|
||||
outVec4 = vec4.copy(outVec4, vec4A);
|
||||
outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
|
||||
outVec4 = vec4.add(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.sub(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.mul(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.divide(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.div(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.ceil(outVec4, vec4A);
|
||||
outVec4 = vec4.floor(outVec4, vec4A);
|
||||
outVec4 = vec4.min(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.max(outVec4, vec4A, vec4B);
|
||||
outVec4 = vec4.scale(outVec4, vec4A, 2);
|
||||
outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
|
||||
outVal = vec4.distance(vec4A, vec4B);
|
||||
outVal = vec4.dist(vec4A, vec4B);
|
||||
outVal = vec4.squaredDistance(vec4A, vec4B);
|
||||
outVal = vec4.sqrDist(vec4A, vec4B);
|
||||
outVal = vec4.length(vec4A);
|
||||
outVal = vec4.len(vec4A);
|
||||
outVal = vec4.squaredLength(vec4A);
|
||||
outVal = vec4.sqrLen(vec4A);
|
||||
outVec4 = vec4.negate(outVec4, vec4A);
|
||||
outVec4 = vec4.inverse(outVec4, vec4A);
|
||||
outVec4 = vec4.normalize(outVec4, vec4A);
|
||||
outVal = vec4.dot(vec4A, vec4B);
|
||||
outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
|
||||
outVec4 = vec4.random(outVec4);
|
||||
outVec4 = vec4.random(outVec4, 5.0);
|
||||
outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
|
||||
outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
|
||||
vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
|
||||
outStr = vec4.str(vec4A);
|
||||
outBool = vec4.exactEquals(vec4A, vec4B);
|
||||
outBool = vec4.equals(vec4A, vec4B);
|
||||
outVec4 = vec4.add(outVec4, [0, 1, 2, 3], [4, 5, 6, 7]); // test one method with number array input
|
||||
}
|
||||
|
||||
{
|
||||
outMat2 = mat2.create();
|
||||
outMat2 = mat2.clone(mat2A);
|
||||
outMat2 = mat2.copy(outMat2, mat2A);
|
||||
outMat2 = mat2.identity(outMat2);
|
||||
outMat2 = mat2.fromValues(1, 2, 3, 4);
|
||||
outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
|
||||
outMat2 = mat2.transpose(outMat2, mat2A);
|
||||
outMat2Null = mat2.invert(outMat2, mat2A);
|
||||
outMat2 = mat2.adjoint(outMat2, mat2A);
|
||||
outVal = mat2.determinant(mat2A);
|
||||
outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
|
||||
outMat2 = mat2.mul(outMat2, mat2A, mat2B);
|
||||
outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
|
||||
outMat2 = mat2.scale(outMat2, mat2A, vec2A);
|
||||
outMat2 = mat2.fromRotation(outMat2, 0.5);
|
||||
outMat2 = mat2.fromScaling(outMat2, vec2A);
|
||||
outStr = mat2.str(mat2A);
|
||||
outVal = mat2.frob(mat2A);
|
||||
const L = mat2.create();
|
||||
const D = mat2.create();
|
||||
const U = mat2.create();
|
||||
outMat2 = mat2.LDU(L, D, U, mat2A);
|
||||
outMat2 = mat2.add(outMat2, mat2A, mat2B);
|
||||
outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
|
||||
outMat2 = mat2.sub(outMat2, mat2A, mat2B);
|
||||
outBool = mat2.exactEquals(mat2A, mat2B);
|
||||
outBool = mat2.equals(mat2A, mat2B);
|
||||
outMat2 = mat2.multiplyScalar(outMat2, mat2A, 2);
|
||||
outMat2 = mat2.multiplyScalarAndAdd(outMat2, mat2A, mat2B, 2);
|
||||
}
|
||||
|
||||
{
|
||||
outMat2d = mat2d.create();
|
||||
outMat2d = mat2d.clone(mat2dA);
|
||||
outMat2d = mat2d.copy(outMat2d, mat2dA);
|
||||
outMat2d = mat2d.identity(outMat2d);
|
||||
outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
|
||||
outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
|
||||
outMat2dNull = mat2d.invert(outMat2d, mat2dA);
|
||||
outVal = mat2d.determinant(mat2dA);
|
||||
outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
|
||||
outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
|
||||
outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
|
||||
outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
|
||||
outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
|
||||
outMat2d = mat2d.fromRotation(outMat2d, 0.5);
|
||||
outMat2d = mat2d.fromScaling(outMat2d, vec2A);
|
||||
outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
|
||||
outStr = mat2d.str(mat2dA);
|
||||
outVal = mat2d.frob(mat2dA);
|
||||
outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
|
||||
outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
|
||||
outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
|
||||
outMat2d = mat2d.multiplyScalar(outMat2d, mat2dA, 2);
|
||||
outMat2d = mat2d.multiplyScalarAndAdd(outMat2d, mat2dA, mat2dB, 2);
|
||||
outBool = mat2d.exactEquals(mat2dA, mat2dB);
|
||||
outBool = mat2d.equals(mat2dA, mat2dB);
|
||||
}
|
||||
|
||||
{
|
||||
outMat3 = mat3.create();
|
||||
outMat3 = mat3.fromMat4(outMat3, mat4A);
|
||||
outMat3 = mat3.clone(mat3A);
|
||||
outMat3 = mat3.copy(outMat3, mat3A);
|
||||
outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
outMat3 = mat3.identity(outMat3);
|
||||
outMat3 = mat3.transpose(outMat3, mat3A);
|
||||
outMat3Null = mat3.invert(outMat3, mat3A);
|
||||
outMat3 = mat3.adjoint(outMat3, mat3A);
|
||||
outVal = mat3.determinant(mat3A);
|
||||
outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
|
||||
outMat3 = mat3.mul(outMat3, mat3A, mat3B);
|
||||
outMat3 = mat3.translate(outMat3, mat3A, vec3A);
|
||||
outMat3 = mat3.rotate(outMat3, mat3A, Math.PI / 2);
|
||||
outMat3 = mat3.scale(outMat3, mat3A, vec2A);
|
||||
outMat3 = mat3.fromTranslation(outMat3, vec2A);
|
||||
outMat3 = mat3.fromRotation(outMat3, Math.PI);
|
||||
outMat3 = mat3.fromScaling(outMat3, vec2A);
|
||||
outMat3 = mat3.fromMat2d(outMat3, mat2dA);
|
||||
outMat3 = mat3.fromQuat(outMat3, quatA);
|
||||
outMat3Null = mat3.normalFromMat4(outMat3, mat4A);
|
||||
outStr = mat3.str(mat3A);
|
||||
outVal = mat3.frob(mat3A);
|
||||
outMat3 = mat3.add(outMat3, mat3A, mat3B);
|
||||
outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
|
||||
outMat3 = mat3.sub(outMat3, mat3A, mat3B);
|
||||
outMat3 = mat3.multiplyScalar(outMat3, mat3A, 2);
|
||||
outMat3 = mat3.multiplyScalarAndAdd(outMat3, mat3A, mat3B, 2);
|
||||
outBool = mat3.exactEquals(mat3A, mat3B);
|
||||
outBool = mat3.equals(mat3A, mat3B);
|
||||
}
|
||||
|
||||
{
|
||||
outMat4 = mat4.create();
|
||||
outMat4 = mat4.clone(mat4A);
|
||||
outMat4 = mat4.copy(outMat4, mat4A);
|
||||
outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
|
||||
outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
|
||||
outMat4 = mat4.identity(outMat4);
|
||||
outMat4 = mat4.transpose(outMat4, mat4A);
|
||||
outMat4Null = mat4.invert(outMat4, mat4A);
|
||||
outMat4 = mat4.adjoint(outMat4, mat4A);
|
||||
outVal = mat4.determinant(mat4A);
|
||||
outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
|
||||
outMat4 = mat4.mul(outMat4, mat4A, mat4B);
|
||||
outMat4 = mat4.translate(outMat4, mat4A, vec3A);
|
||||
outMat4 = mat4.scale(outMat4, mat4A, vec3A);
|
||||
outMat4Null = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
|
||||
outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
|
||||
outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
|
||||
outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
|
||||
outMat4 = mat4.fromTranslation(outMat4, vec3A);
|
||||
outMat4Null = mat4.fromRotation(outMat4, Math.PI, vec3A);
|
||||
outMat4 = mat4.fromScaling(outMat4, vec3A);
|
||||
outMat4 = mat4.fromXRotation(outMat4, Math.PI);
|
||||
outMat4 = mat4.fromYRotation(outMat4, Math.PI);
|
||||
outMat4 = mat4.fromZRotation(outMat4, Math.PI);
|
||||
outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
|
||||
outVec3 = mat4.getTranslation(outVec3, mat4A);
|
||||
outVec3 = mat4.getScaling(outVec3, mat4A);
|
||||
outQuat = mat4.getRotation(outQuat, mat4A);
|
||||
outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
|
||||
outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
|
||||
outMat4 = mat4.fromQuat(outMat4, quatB);
|
||||
outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
|
||||
outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
|
||||
outMat4 = mat4.perspectiveFromFieldOfView(outMat4, { upDegrees: Math.PI, downDegrees: -Math.PI, leftDegrees: -Math.PI, rightDegrees: Math.PI }, 1, 0);
|
||||
outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
|
||||
outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
|
||||
outStr = mat4.str(mat4A);
|
||||
outVal = mat4.frob(mat4A);
|
||||
outMat4 = mat4.add(outMat4, mat4A, mat4B);
|
||||
outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
|
||||
outMat4 = mat4.sub(outMat4, mat4A, mat4B);
|
||||
outMat4 = mat4.multiplyScalar(outMat4, mat4A, 2);
|
||||
outMat4 = mat4.multiplyScalarAndAdd(outMat4, mat4A, mat4B, 2);
|
||||
outBool = mat4.exactEquals(mat4A, mat4B);
|
||||
outBool = mat4.equals(mat4A, mat4B);
|
||||
}
|
||||
|
||||
{
|
||||
const deg90 = Math.PI / 2;
|
||||
outQuat = quat.create();
|
||||
outQuat = quat.clone(quatA);
|
||||
outQuat = quat.fromValues(1, 2, 3, 4);
|
||||
outQuat = quat.copy(outQuat, quatA);
|
||||
outQuat = quat.set(outQuat, 1, 2, 3, 4);
|
||||
outQuat = quat.identity(outQuat);
|
||||
outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
|
||||
outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
|
||||
outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
|
||||
outVal = quat.getAxisAngle(outVec3, quatA);
|
||||
outQuat = quat.add(outQuat, quatA, quatB);
|
||||
outQuat = quat.multiply(outQuat, quatA, quatB);
|
||||
outQuat = quat.mul(outQuat, quatA, quatB);
|
||||
outQuat = quat.scale(outQuat, quatA, 2);
|
||||
outVal = quat.length(quatA);
|
||||
outVal = quat.len(quatA);
|
||||
outVal = quat.squaredLength(quatA);
|
||||
outVal = quat.sqrLen(quatA);
|
||||
outQuat = quat.normalize(outQuat, quatA);
|
||||
outVal = quat.dot(quatA, quatB);
|
||||
outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
|
||||
outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
|
||||
outQuat = quat.invert(outQuat, quatA);
|
||||
outQuat = quat.conjugate(outQuat, quatA);
|
||||
outStr = quat.str(quatA);
|
||||
outQuat = quat.rotateX(outQuat, quatA, deg90);
|
||||
outQuat = quat.rotateY(outQuat, quatA, deg90);
|
||||
outQuat = quat.rotateZ(outQuat, quatA, deg90);
|
||||
outQuat = quat.fromMat3(outQuat, mat3A);
|
||||
outQuat = quat.calculateW(outQuat, quatA);
|
||||
outBool = quat.exactEquals(quatA, quatB);
|
||||
outBool = quat.equals(quatA, quatB);
|
||||
}
|
||||
}
|
||||
359
types/adone/test/glosses/math/simd.ts
Normal file
359
types/adone/test/glosses/math/simd.ts
Normal file
@ -0,0 +1,359 @@
|
||||
namespace mathTests.simdTests {
|
||||
const {
|
||||
Float32x4,
|
||||
Int32x4,
|
||||
Int16x8,
|
||||
Int8x16,
|
||||
Uint32x4,
|
||||
Uint16x8,
|
||||
Uint8x16,
|
||||
Bool32x4,
|
||||
Bool16x8,
|
||||
Bool8x16
|
||||
} = adone.math.simd;
|
||||
|
||||
const a0 = Float32x4(0, 1, 2, 3);
|
||||
const a1 = Int32x4(0, 1, 2, 3);
|
||||
const a2 = Int16x8(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
const a3 = Int8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
const a4 = Uint32x4(0, 1, 2, 3);
|
||||
const a5 = Uint16x8(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
const a6 = Uint8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
const a7 = Bool32x4(true, true, true, true);
|
||||
const a8 = Bool16x8(true, true, true, true, true, true, true, true);
|
||||
const a9 = Bool8x16(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);
|
||||
|
||||
Float32x4.length;
|
||||
Float32x4.name;
|
||||
Float32x4.arguments;
|
||||
Float32x4.caller;
|
||||
Float32x4.prototype;
|
||||
Float32x4.extractLane(a0, 3);
|
||||
Float32x4.swizzle(a0, 0, 1, 2, 3);
|
||||
Float32x4.shuffle(a0, a0, 0, 1, 2, 3);
|
||||
Float32x4.check(a0);
|
||||
Float32x4.splat(1);
|
||||
Float32x4.replaceLane(a0, 3, 1);
|
||||
Float32x4.select(Bool32x4.splat(true), a0, a0);
|
||||
Float32x4.equal(a0, a0);
|
||||
Float32x4.notEqual(a0, a0);
|
||||
Float32x4.lessThan(a0, a0);
|
||||
Float32x4.lessThanOrEqual(a0, a0);
|
||||
Float32x4.greaterThan(a0, a0);
|
||||
Float32x4.greaterThanOrEqual(a0, a0);
|
||||
Float32x4.add(a0, a0);
|
||||
Float32x4.sub(a0, a0);
|
||||
Float32x4.mul(a0, a0);
|
||||
Float32x4.div(a0, a0);
|
||||
Float32x4.neg(a0);
|
||||
Float32x4.abs(a0);
|
||||
Float32x4.min(a0, a0);
|
||||
Float32x4.max(a0, a0);
|
||||
Float32x4.minNum(a0, a0);
|
||||
Float32x4.maxNum(a0, a0);
|
||||
Float32x4.reciprocalApproximation(a0, a0);
|
||||
Float32x4.reciprocalSqrtApproximation(a0);
|
||||
Float32x4.sqrt(a0);
|
||||
Float32x4.load(new Float32Array(16), 0);
|
||||
Float32x4.load1(new Float32Array(16), 0);
|
||||
Float32x4.load2(new Float32Array(16), 0);
|
||||
Float32x4.load3(new Float32Array(16), 0);
|
||||
Float32x4.store(new Float32Array(16), 1, a0);
|
||||
Float32x4.store1(new Float32Array(16), 1, a0);
|
||||
Float32x4.store2(new Float32Array(16), 1, a0);
|
||||
Float32x4.store3(new Float32Array(16), 1, a0);
|
||||
Float32x4.fromInt32x4(Int32x4.splat(0));
|
||||
Float32x4.fromUint32x4(Uint32x4.splat(0));
|
||||
Float32x4.fromInt32x4Bits(Int32x4.splat(0));
|
||||
Float32x4.fromInt16x8Bits(Int16x8.splat(0));
|
||||
Float32x4.fromInt8x16Bits(Int8x16.splat(0));
|
||||
Float32x4.fromUint32x4Bits(Uint32x4.splat(0));
|
||||
Float32x4.fromUint16x8Bits(Uint16x8.splat(0));
|
||||
Float32x4.fromUint8x16Bits(Uint8x16.splat(0));
|
||||
Int32x4.length;
|
||||
Int32x4.name;
|
||||
Int32x4.arguments;
|
||||
Int32x4.caller;
|
||||
Int32x4.prototype;
|
||||
Int32x4.extractLane(a1, 3);
|
||||
Int32x4.swizzle(a1, 0, 1, 2, 3);
|
||||
Int32x4.shuffle(a1, a1, 0, 1, 2, 3);
|
||||
Int32x4.check(a1);
|
||||
Int32x4.splat(1);
|
||||
Int32x4.replaceLane(a1, 3, 1);
|
||||
Int32x4.select(Bool32x4.splat(true), a1, a1);
|
||||
Int32x4.equal(a1, a1);
|
||||
Int32x4.notEqual(a1, a1);
|
||||
Int32x4.lessThan(a1, a1);
|
||||
Int32x4.lessThanOrEqual(a1, a1);
|
||||
Int32x4.greaterThan(a1, a1);
|
||||
Int32x4.greaterThanOrEqual(a1, a1);
|
||||
Int32x4.and(a1, a1);
|
||||
Int32x4.or(a1, a1);
|
||||
Int32x4.xor(a1, a1);
|
||||
Int32x4.not(a1, a1);
|
||||
Int32x4.add(a1, a1);
|
||||
Int32x4.sub(a1, a1);
|
||||
Int32x4.mul(a1, a1);
|
||||
Int32x4.neg(a1);
|
||||
Int32x4.shiftLeftByScalar(a1, 1);
|
||||
Int32x4.shiftRightByScalar(a1, 1);
|
||||
Int32x4.load(new Int32Array(16), 0);
|
||||
Int32x4.load1(new Int32Array(16), 0);
|
||||
Int32x4.load2(new Int32Array(16), 0);
|
||||
Int32x4.load3(new Int32Array(16), 0);
|
||||
Int32x4.store(new Int32Array(16), 1, a1);
|
||||
Int32x4.store1(new Int32Array(16), 1, a1);
|
||||
Int32x4.store2(new Int32Array(16), 1, a1);
|
||||
Int32x4.store3(new Int32Array(16), 1, a1);
|
||||
Int32x4.fromFloat32x4(Float32x4.splat(0));
|
||||
Int32x4.fromUint32x4(Uint32x4.splat(0));
|
||||
Int32x4.fromFloat32x4Bits(Float32x4.splat(0));
|
||||
Int32x4.fromInt16x8Bits(Int16x8.splat(0));
|
||||
Int32x4.fromInt8x16Bits(Int8x16.splat(0));
|
||||
Int32x4.fromUint32x4Bits(Uint32x4.splat(0));
|
||||
Int32x4.fromUint16x8Bits(Uint16x8.splat(0));
|
||||
Int32x4.fromUint8x16Bits(Uint8x16.splat(0));
|
||||
Int16x8.length;
|
||||
Int16x8.name;
|
||||
Int16x8.arguments;
|
||||
Int16x8.caller;
|
||||
Int16x8.prototype;
|
||||
Int16x8.extractLane(a2, 7);
|
||||
Int16x8.swizzle(a2, 0, 1, 2, 3, 4, 5, 6, 7);
|
||||
Int16x8.shuffle(a2, a2, 0, 1, 2, 3, 4, 5, 6, 7);
|
||||
Int16x8.check(a2);
|
||||
Int16x8.splat(1);
|
||||
Int16x8.replaceLane(a2, 7, 1);
|
||||
Int16x8.select(Bool16x8.splat(true), a2, a2);
|
||||
Int16x8.equal(a2, a2);
|
||||
Int16x8.notEqual(a2, a2);
|
||||
Int16x8.lessThan(a2, a2);
|
||||
Int16x8.lessThanOrEqual(a2, a2);
|
||||
Int16x8.greaterThan(a2, a2);
|
||||
Int16x8.greaterThanOrEqual(a2, a2);
|
||||
Int16x8.and(a2, a2);
|
||||
Int16x8.or(a2, a2);
|
||||
Int16x8.xor(a2, a2);
|
||||
Int16x8.not(a2, a2);
|
||||
Int16x8.add(a2, a2);
|
||||
Int16x8.sub(a2, a2);
|
||||
Int16x8.mul(a2, a2);
|
||||
Int16x8.neg(a2);
|
||||
Int16x8.shiftLeftByScalar(a2, 1);
|
||||
Int16x8.shiftRightByScalar(a2, 1);
|
||||
Int16x8.addSaturate(a2, a2);
|
||||
Int16x8.subSaturate(a2, a2);
|
||||
Int16x8.load(new Int16Array(16), 0);
|
||||
Int16x8.store(new Int16Array(16), 1, a2);
|
||||
Int16x8.fromUint16x8(Uint16x8.splat(0));
|
||||
Int16x8.fromFloat32x4Bits(Float32x4.splat(0));
|
||||
Int16x8.fromInt32x4Bits(Int32x4.splat(0));
|
||||
Int16x8.fromInt8x16Bits(Int8x16.splat(0));
|
||||
Int16x8.fromUint32x4Bits(Uint32x4.splat(0));
|
||||
Int16x8.fromUint16x8Bits(Uint16x8.splat(0));
|
||||
Int16x8.fromUint8x16Bits(Uint8x16.splat(0));
|
||||
Int8x16.length;
|
||||
Int8x16.name;
|
||||
Int8x16.arguments;
|
||||
Int8x16.caller;
|
||||
Int8x16.prototype;
|
||||
Int8x16.extractLane(a3, 15);
|
||||
Int8x16.swizzle(a3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
Int8x16.shuffle(a3, a3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
Int8x16.check(a3);
|
||||
Int8x16.splat(1);
|
||||
Int8x16.replaceLane(a3, 15, 1);
|
||||
Int8x16.select(Bool8x16.splat(true), a3, a3);
|
||||
Int8x16.equal(a3, a3);
|
||||
Int8x16.notEqual(a3, a3);
|
||||
Int8x16.lessThan(a3, a3);
|
||||
Int8x16.lessThanOrEqual(a3, a3);
|
||||
Int8x16.greaterThan(a3, a3);
|
||||
Int8x16.greaterThanOrEqual(a3, a3);
|
||||
Int8x16.and(a3, a3);
|
||||
Int8x16.or(a3, a3);
|
||||
Int8x16.xor(a3, a3);
|
||||
Int8x16.not(a3, a3);
|
||||
Int8x16.add(a3, a3);
|
||||
Int8x16.sub(a3, a3);
|
||||
Int8x16.mul(a3, a3);
|
||||
Int8x16.neg(a3);
|
||||
Int8x16.shiftLeftByScalar(a3, 1);
|
||||
Int8x16.shiftRightByScalar(a3, 1);
|
||||
Int8x16.addSaturate(a3, a3);
|
||||
Int8x16.subSaturate(a3, a3);
|
||||
Int8x16.load(new Int8Array(16), 0);
|
||||
Int8x16.store(new Int8Array(16), 1, a3);
|
||||
Int8x16.fromUint8x16(Uint8x16.splat(0));
|
||||
Int8x16.fromFloat32x4Bits(Float32x4.splat(0));
|
||||
Int8x16.fromInt32x4Bits(Int32x4.splat(0));
|
||||
Int8x16.fromInt16x8Bits(Int16x8.splat(0));
|
||||
Int8x16.fromUint32x4Bits(Uint32x4.splat(0));
|
||||
Int8x16.fromUint16x8Bits(Uint16x8.splat(0));
|
||||
Int8x16.fromUint8x16Bits(Uint8x16.splat(0));
|
||||
Uint32x4.length;
|
||||
Uint32x4.name;
|
||||
Uint32x4.arguments;
|
||||
Uint32x4.caller;
|
||||
Uint32x4.prototype;
|
||||
Uint32x4.extractLane(a4, 3);
|
||||
Uint32x4.swizzle(a4, 0, 1, 2, 3);
|
||||
Uint32x4.shuffle(a4, a4, 0, 1, 2, 3);
|
||||
Uint32x4.check(a4);
|
||||
Uint32x4.splat(1);
|
||||
Uint32x4.replaceLane(a4, 3, 1);
|
||||
Uint32x4.select(Bool32x4.splat(true), a4, a4);
|
||||
Uint32x4.equal(a4, a4);
|
||||
Uint32x4.notEqual(a4, a4);
|
||||
Uint32x4.lessThan(a4, a4);
|
||||
Uint32x4.lessThanOrEqual(a4, a4);
|
||||
Uint32x4.greaterThan(a4, a4);
|
||||
Uint32x4.greaterThanOrEqual(a4, a4);
|
||||
Uint32x4.and(a4, a4);
|
||||
Uint32x4.or(a4, a4);
|
||||
Uint32x4.xor(a4, a4);
|
||||
Uint32x4.not(a4, a4);
|
||||
Uint32x4.add(a4, a4);
|
||||
Uint32x4.sub(a4, a4);
|
||||
Uint32x4.mul(a4, a4);
|
||||
Uint32x4.shiftLeftByScalar(a4, 1);
|
||||
Uint32x4.shiftRightByScalar(a4, 1);
|
||||
Uint32x4.load(new Uint32Array(16), 0);
|
||||
Uint32x4.load1(new Uint32Array(16), 0);
|
||||
Uint32x4.load2(new Uint32Array(16), 0);
|
||||
Uint32x4.load3(new Uint32Array(16), 0);
|
||||
Uint32x4.store(new Uint32Array(16), 1, a4);
|
||||
Uint32x4.store1(new Uint32Array(16), 1, a4);
|
||||
Uint32x4.store2(new Uint32Array(16), 1, a4);
|
||||
Uint32x4.store3(new Uint32Array(16), 1, a4);
|
||||
Uint32x4.fromFloat32x4(Float32x4.splat(0));
|
||||
Uint32x4.fromInt32x4(Int32x4.splat(0));
|
||||
Uint32x4.fromFloat32x4Bits(Float32x4.splat(0));
|
||||
Uint32x4.fromInt32x4Bits(Int32x4.splat(0));
|
||||
Uint32x4.fromInt16x8Bits(Int16x8.splat(0));
|
||||
Uint32x4.fromInt8x16Bits(Int8x16.splat(0));
|
||||
Uint32x4.fromUint16x8Bits(Uint16x8.splat(0));
|
||||
Uint32x4.fromUint8x16Bits(Uint8x16.splat(0));
|
||||
Uint16x8.length;
|
||||
Uint16x8.name;
|
||||
Uint16x8.arguments;
|
||||
Uint16x8.caller;
|
||||
Uint16x8.prototype;
|
||||
Uint16x8.extractLane(a5, 7);
|
||||
Uint16x8.swizzle(a5, 0, 1, 2, 3, 4, 5, 6, 7);
|
||||
Uint16x8.shuffle(a5, a5, 0, 1, 2, 3, 4, 5, 6, 7);
|
||||
Uint16x8.check(a5);
|
||||
Uint16x8.splat(1);
|
||||
Uint16x8.replaceLane(a5, 7, 1);
|
||||
Uint16x8.select(Bool16x8.splat(true), a5, a5);
|
||||
Uint16x8.equal(a5, a5);
|
||||
Uint16x8.notEqual(a5, a5);
|
||||
Uint16x8.lessThan(a5, a5);
|
||||
Uint16x8.lessThanOrEqual(a5, a5);
|
||||
Uint16x8.greaterThan(a5, a5);
|
||||
Uint16x8.greaterThanOrEqual(a5, a5);
|
||||
Uint16x8.and(a5, a5);
|
||||
Uint16x8.or(a5, a5);
|
||||
Uint16x8.xor(a5, a5);
|
||||
Uint16x8.not(a5, a5);
|
||||
Uint16x8.add(a5, a5);
|
||||
Uint16x8.sub(a5, a5);
|
||||
Uint16x8.mul(a5, a5);
|
||||
Uint16x8.shiftLeftByScalar(a5, 1);
|
||||
Uint16x8.shiftRightByScalar(a5, 1);
|
||||
Uint16x8.addSaturate(a5, a5);
|
||||
Uint16x8.subSaturate(a5, a5);
|
||||
Uint16x8.load(new Uint16Array(16), 0);
|
||||
Uint16x8.store(new Uint16Array(16), 1, a5);
|
||||
Uint16x8.fromInt16x8(Int16x8.splat(0));
|
||||
Uint16x8.fromFloat32x4Bits(Float32x4.splat(0));
|
||||
Uint16x8.fromInt32x4Bits(Int32x4.splat(0));
|
||||
Uint16x8.fromInt16x8Bits(Int16x8.splat(0));
|
||||
Uint16x8.fromInt8x16Bits(Int8x16.splat(0));
|
||||
Uint16x8.fromUint32x4Bits(Uint32x4.splat(0));
|
||||
Uint16x8.fromUint8x16Bits(Uint8x16.splat(0));
|
||||
Uint8x16.length;
|
||||
Uint8x16.name;
|
||||
Uint8x16.arguments;
|
||||
Uint8x16.caller;
|
||||
Uint8x16.prototype;
|
||||
Uint8x16.extractLane(a6, 15);
|
||||
Uint8x16.swizzle(a6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
Uint8x16.shuffle(a6, a6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
Uint8x16.check(a6);
|
||||
Uint8x16.splat(1);
|
||||
Uint8x16.replaceLane(a6, 15, 1);
|
||||
Uint8x16.select(Bool8x16.splat(true), a6, a6);
|
||||
Uint8x16.equal(a6, a6);
|
||||
Uint8x16.notEqual(a6, a6);
|
||||
Uint8x16.lessThan(a6, a6);
|
||||
Uint8x16.lessThanOrEqual(a6, a6);
|
||||
Uint8x16.greaterThan(a6, a6);
|
||||
Uint8x16.greaterThanOrEqual(a6, a6);
|
||||
Uint8x16.and(a6, a6);
|
||||
Uint8x16.or(a6, a6);
|
||||
Uint8x16.xor(a6, a6);
|
||||
Uint8x16.not(a6, a6);
|
||||
Uint8x16.add(a6, a6);
|
||||
Uint8x16.sub(a6, a6);
|
||||
Uint8x16.mul(a6, a6);
|
||||
Uint8x16.shiftLeftByScalar(a6, 1);
|
||||
Uint8x16.shiftRightByScalar(a6, 1);
|
||||
Uint8x16.addSaturate(a6, a6);
|
||||
Uint8x16.subSaturate(a6, a6);
|
||||
Uint8x16.load(new Uint8Array(16), 0);
|
||||
Uint8x16.store(new Uint8Array(16), 1, a6);
|
||||
Uint8x16.fromInt8x16(Int8x16.splat(0));
|
||||
Uint8x16.fromFloat32x4Bits(Float32x4.splat(0));
|
||||
Uint8x16.fromInt32x4Bits(Int32x4.splat(0));
|
||||
Uint8x16.fromInt16x8Bits(Int16x8.splat(0));
|
||||
Uint8x16.fromInt8x16Bits(Int8x16.splat(0));
|
||||
Uint8x16.fromUint32x4Bits(Uint32x4.splat(0));
|
||||
Uint8x16.fromUint16x8Bits(Uint16x8.splat(0));
|
||||
Bool32x4.length;
|
||||
Bool32x4.name;
|
||||
Bool32x4.arguments;
|
||||
Bool32x4.caller;
|
||||
Bool32x4.prototype;
|
||||
Bool32x4.extractLane(a7, 3);
|
||||
Bool32x4.check(a7);
|
||||
Bool32x4.splat(true);
|
||||
Bool32x4.replaceLane(a7, 3, true);
|
||||
Bool32x4.allTrue(a7);
|
||||
Bool32x4.anyTrue(a7);
|
||||
Bool32x4.and(a7, a7);
|
||||
Bool32x4.or(a7, a7);
|
||||
Bool32x4.xor(a7, a7);
|
||||
Bool32x4.not(a7, a7);
|
||||
Bool16x8.length;
|
||||
Bool16x8.name;
|
||||
Bool16x8.arguments;
|
||||
Bool16x8.caller;
|
||||
Bool16x8.prototype;
|
||||
Bool16x8.extractLane(a8, 7);
|
||||
Bool16x8.check(a8);
|
||||
Bool16x8.splat(true);
|
||||
Bool16x8.replaceLane(a8, 7, true);
|
||||
Bool16x8.allTrue(a8);
|
||||
Bool16x8.anyTrue(a8);
|
||||
Bool16x8.and(a8, a8);
|
||||
Bool16x8.or(a8, a8);
|
||||
Bool16x8.xor(a8, a8);
|
||||
Bool16x8.not(a8, a8);
|
||||
Bool8x16.length;
|
||||
Bool8x16.name;
|
||||
Bool8x16.arguments;
|
||||
Bool8x16.caller;
|
||||
Bool8x16.prototype;
|
||||
Bool8x16.extractLane(a9, 15);
|
||||
Bool8x16.check(a9);
|
||||
Bool8x16.splat(true);
|
||||
Bool8x16.replaceLane(a9, 15, true);
|
||||
Bool8x16.allTrue(a9);
|
||||
Bool8x16.anyTrue(a9);
|
||||
Bool8x16.and(a9, a9);
|
||||
Bool8x16.or(a9, a9);
|
||||
Bool8x16.xor(a9, a9);
|
||||
Bool8x16.not(a9, a9);
|
||||
}
|
||||
@ -6,7 +6,7 @@ namespace promiseTests {
|
||||
a.promise.then((x) => 2);
|
||||
a.resolve(2);
|
||||
a.reject(3);
|
||||
const b = promise.defer<string>();
|
||||
const b = promise.defer();
|
||||
b.resolve("3");
|
||||
b.reject(2);
|
||||
b.promise.then((x: string) => x);
|
||||
@ -27,6 +27,18 @@ namespace promiseTests {
|
||||
promise.nodeify(Promise.resolve(2), () => 42).then((x: number) => x);
|
||||
}
|
||||
|
||||
namespace callbackifyTests {
|
||||
const { callbackify } = promise;
|
||||
|
||||
callbackify(async () => {})((err: any, a: undefined) => {}).then((x: undefined) => {});
|
||||
callbackify(async () => 42)((err: any, a: number) => {}).then((x: number) => {});
|
||||
callbackify(async (a: number) => a)(123, (err: any, a: number) => {}).then((x: number) => {});
|
||||
callbackify(async (a: number, b: string) => b)(123, "456", (err: any, a: string) => {}).then((x: string) => {});
|
||||
callbackify(async (a: number, b: string, c: number) => c)(123, "456", 123, (err: any, a: number) => {}).then((x: number) => {});
|
||||
callbackify(async (a: number, b: string, c: number, d: string) => d)(123, "456", 123, "456", (err: any, a: string) => {}).then((x: string) => {});
|
||||
callbackify(async (a: number, b: string, c: number, d: string, e: number) => e)(123, "456", 123, "456", 123, (err: any, a: number) => {}).then((x: number) => {});
|
||||
}
|
||||
|
||||
namespace promisify {
|
||||
type Callback<T> = (err?: any, result?: T) => void;
|
||||
namespace noargs {
|
||||
|
||||
@ -177,7 +177,7 @@ namespace shaniTests {
|
||||
const check = (hook: adone.shani.I.Hook) => {
|
||||
hook.run().then((x) => x);
|
||||
hook.cause();
|
||||
hook.failed() === true;
|
||||
{ const a: boolean = hook.failed(); }
|
||||
hook.timeout() + 2;
|
||||
hook.timeout(10).timeout(10).timeout() + 2;
|
||||
};
|
||||
@ -193,9 +193,9 @@ namespace shaniTests {
|
||||
for (const hook of root.afterEachHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
root.isInclusive() === true;
|
||||
root.isExclusive() === false;
|
||||
root.hasInclusive() === true;
|
||||
{ const a: boolean = root.isInclusive(); }
|
||||
{ const a: boolean = root.isExclusive(); }
|
||||
{ const a: boolean = root.hasInclusive(); }
|
||||
root.skip().only().skip();
|
||||
const a: number | null = root.timeout();
|
||||
root.timeout(100).timeout(100);
|
||||
@ -276,23 +276,23 @@ namespace shaniTests {
|
||||
|
||||
namespace spyCallTests {
|
||||
const call = util.spy().firstCall;
|
||||
call.calledBefore(call) === true;
|
||||
call.calledAfter(call) === true;
|
||||
call.calledWithNew(call) === true;
|
||||
{ const a: boolean = call.calledBefore(call); }
|
||||
{ const a: boolean = call.calledAfter(call); }
|
||||
{ const a: boolean = call.calledWithNew(call); }
|
||||
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;
|
||||
{ const a: boolean = call.calledOn({}); }
|
||||
{ const a: boolean = call.calledWith(1, 2, 3); }
|
||||
{ const a: boolean = call.calledWithExactly(1, 2, 3); }
|
||||
{ const a: boolean = call.calledWithMatch(1, 2, 3); }
|
||||
{ const a: boolean = call.notCalledWith(1, 2, 3); }
|
||||
{ const a: boolean = call.notCalledWithMatch(1, 2, 3); }
|
||||
{ const a: boolean = call.returned(1); }
|
||||
{ const a: boolean = call.threw(); }
|
||||
{ const a: boolean = call.threw("12"); }
|
||||
{ const a: boolean = call.threw({}); }
|
||||
call.callArg(1);
|
||||
call.callArgOn(1, {});
|
||||
call.callArgWith(1, 1, 2, 3);
|
||||
@ -307,11 +307,11 @@ namespace shaniTests {
|
||||
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;
|
||||
{ const a: boolean = s.called; }
|
||||
{ const a: boolean = s.notCalled; }
|
||||
{ const a: boolean = s.calledOnce; }
|
||||
{ const a: boolean = s.calledTwice; }
|
||||
{ const a: boolean = s.calledThrice; }
|
||||
s.firstCall.args;
|
||||
s.secondCall.args;
|
||||
s.thirdCall.args;
|
||||
@ -325,24 +325,30 @@ namespace shaniTests {
|
||||
s.calledAfter(s);
|
||||
s.calledImmediatelyAfter(s);
|
||||
s.calledImmediatelyBefore(s);
|
||||
s.calledWithNew() === true;
|
||||
{ const a: boolean = s.calledWithNew(); }
|
||||
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;
|
||||
{ const a: boolean = s.alwaysCalledOn({}); }
|
||||
{ const a: boolean = s.alwaysCalledWith(1, 2, 3); }
|
||||
{ const a: boolean = s.alwaysCalledWithExactly(1, 2, 3); }
|
||||
{ const a: boolean = s.alwaysCalledWithMatch(1, 2, 3); }
|
||||
{ const a: boolean = s.neverCalledWith(1, 2, 3); }
|
||||
{ const a: boolean = s.neverCalledWithMatch(1, 2, 3); }
|
||||
{ const a: boolean = s.alwaysThrew(); }
|
||||
{ const a: boolean = s.alwaysThrew("a"); }
|
||||
{ const a: boolean = s.alwaysThrew({}); }
|
||||
{ const a: boolean = s.alwaysReturned({}); }
|
||||
s.invokeCallback(1, 2, 3);
|
||||
s.getCall(0).args;
|
||||
s.getCalls()[0].args;
|
||||
s.reset();
|
||||
s.printf("%s", "1").toLowerCase();
|
||||
s.restore();
|
||||
s.waitFor(() => true).then((x: adone.shani.util.I.SpyCall) => {});
|
||||
s.waitFor(() => true, () => 2).then((x: number) => {});
|
||||
s.waitForCall().then((x: adone.shani.util.I.SpyCall) => {});
|
||||
s.waitForNCalls(10).then((x: adone.shani.util.I.SpyCall[]) => {});
|
||||
s.waitForArg(1, "hello").then((x: adone.shani.util.I.SpyCall) => {});
|
||||
s.waitForArgs(1, 2, 3).then((x: adone.shani.util.I.SpyCall) => {});
|
||||
}
|
||||
|
||||
namespace stubTests {
|
||||
|
||||
@ -1,36 +1,4 @@
|
||||
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";
|
||||
import { adone } from "adone";
|
||||
|
||||
const { std } = adone;
|
||||
|
||||
@ -124,7 +92,7 @@ namespace stdTests {
|
||||
}
|
||||
|
||||
namespace tty {
|
||||
std.tty.isatty(1) === true;
|
||||
const a: boolean = std.tty.isatty(1);
|
||||
}
|
||||
|
||||
namespace buffer {
|
||||
|
||||
103
types/adone/test/glosses/streams.ts
Normal file
103
types/adone/test/glosses/streams.ts
Normal file
@ -0,0 +1,103 @@
|
||||
namespace streamsTests {
|
||||
const { stream } = adone;
|
||||
|
||||
namespace CoreStreamTests {
|
||||
const { CoreStream } = stream;
|
||||
|
||||
new CoreStream();
|
||||
new CoreStream(undefined);
|
||||
new CoreStream(undefined, {});
|
||||
new CoreStream(undefined, { async: true });
|
||||
new CoreStream(undefined, { sync: true });
|
||||
new CoreStream(undefined, {
|
||||
transform(x) {
|
||||
this.push(x);
|
||||
}
|
||||
});
|
||||
new CoreStream(undefined, {
|
||||
flush() {
|
||||
this.push(1);
|
||||
}
|
||||
});
|
||||
|
||||
new CoreStream([]);
|
||||
new CoreStream(new CoreStream([]));
|
||||
|
||||
{ const a: boolean = new CoreStream().write(1); }
|
||||
{ const a: boolean = new CoreStream().push(1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().end(); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().destroy(); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().pause(); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().resume(); }
|
||||
{ const a: boolean = new CoreStream().isPaused(); }
|
||||
{ const a: boolean = new CoreStream().isEnded(); }
|
||||
{ const a: nodestd.stream.Transform = new CoreStream().pipe(new adone.std.stream.Transform()); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughSync(function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughSync(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughAsync(function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().throughAsync(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = new CoreStream().through(function () { this.push(1); }, function () { this.push(1); }); }
|
||||
{ const a: adone.stream.CoreStream<number, string> = new CoreStream<number, number>([1, 2, 3]).map((x) => `${x}`); }
|
||||
{ const a: adone.stream.CoreStream<any, number | string> = new CoreStream<string, string>().mapIf((x) => x === "1", () => 1); }
|
||||
{ const a: adone.stream.CoreStream<any, number | string> = new CoreStream<number, string>().mapIf(async (x) => x === "1", () => 1); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().filter((x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().filter(async (x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1, {}); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1, { passthrough: true }); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().forEach(async (x) => x === 1, { wait: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().done(() => {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().done(() => {}, {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().done(() => {}, { passthrough: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().toArray((x: any[]) => {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().toArray((x: any[]) => {}, {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().toArray((x: any[]) => {}, { passthrough: true }); }
|
||||
{ const a: adone.stream.CoreStream<number, string> = new CoreStream<number, string>().unique(); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = new CoreStream<number, number>().unique((x) => x + 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().stash((x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().stash("hello", (x) => x === 1); }
|
||||
{ const a: adone.stream.CoreStream<number, string> = new CoreStream().unstash("hello"); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = new CoreStream().unstash(); }
|
||||
{ const a: adone.stream.CoreStream<any, string> = new CoreStream().flatten(); }
|
||||
{ const a: Promise<any[]> = new CoreStream().then(); }
|
||||
{ const a: Promise<string> = new CoreStream().then(() => "1"); }
|
||||
{ const a: Promise<number> = new CoreStream().then(() => 1, () => 2); }
|
||||
{ const a: Promise<any[]> = new CoreStream().catch(); }
|
||||
{ const a: Promise<number[] | number> = new CoreStream<number, number>().catch(() => 1); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new CoreStream()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Readable()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Transform()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Transform()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([new adone.std.stream.Duplex()]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { end: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: {} }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { async: true } }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { sync: false } }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { transform(x) { this.push(x); } } }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = CoreStream.merge([], { sourceOptions: { flush() { this.push(1); } } }); }
|
||||
(async () => {
|
||||
const res = await new CoreStream([1, 2, 3, 4, 5])
|
||||
.map((x: number) => `${x}`)
|
||||
.mapIf((x: string) => x[0] === "1", (x) => x.slice(1))
|
||||
.map((x) => [x, x, x])
|
||||
.filter((x: [string, string, string]) => x[1] === "hello");
|
||||
for (const [a, b, c] of res) {
|
||||
const d: string = a;
|
||||
const e: string = b;
|
||||
const f: string = c;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
namespace coreTests {
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(); }
|
||||
{ const a: adone.stream.CoreStream<number, number> = stream.core([1, 2, 3]); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(stream.core([])); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(undefined, {}); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(undefined, { async: true }); }
|
||||
{ const a: adone.stream.CoreStream<any, any> = stream.core(undefined, { sync: false }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = stream.core<string, number>(undefined, { transform(x) { this.push(Number(x)); } }); }
|
||||
{ const a: adone.stream.CoreStream<any, number> = stream.core(undefined, { flush() { this.push(1); } }); }
|
||||
}
|
||||
}
|
||||
@ -376,6 +376,12 @@ namespace utilTests {
|
||||
const g: string = util.uuid.v4({ nsecs: 1 });
|
||||
}
|
||||
|
||||
namespace v3 {
|
||||
const a: string = util.uuid.v3([], []);
|
||||
const b: number[] = util.uuid.v3([], [], []);
|
||||
const c: number[] = util.uuid.v3([], [], [], 1);
|
||||
}
|
||||
|
||||
namespace v5 {
|
||||
const a: string = util.uuid.v5([], []);
|
||||
const b: number[] = util.uuid.v5([], [], []);
|
||||
@ -509,7 +515,7 @@ namespace utilTests {
|
||||
}
|
||||
|
||||
const a: string = util.Editor.DEFAULT;
|
||||
new util.Editor().spawn().then((x: adone.std.child_process.ChildProcess) => { });
|
||||
new util.Editor().spawn().then((x: nodestd.child_process.ChildProcess) => { });
|
||||
new util.Editor().run().then((x: string) => { });
|
||||
new util.Editor().cleanup().then((x: undefined) => { });
|
||||
util.Editor.edit().then((x: string) => { });
|
||||
@ -658,80 +664,106 @@ namespace utilTests {
|
||||
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 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 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 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 endEnclusive {
|
||||
const a: boolean = util.ltgt.endInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace startInclusive {
|
||||
const a: boolean = util.ltgt.startInclusive({ 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 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 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 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 upperBoundKey {
|
||||
const a: number | undefined = util.ltgt.upperBoundKey({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace upperBoundExclusive {
|
||||
const a: boolean = util.ltgt.upperBoundInclusive({ lt: 2 });
|
||||
}
|
||||
namespace upperBoundExclusive {
|
||||
const a: boolean = util.ltgt.upperBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace lowerBoundExclusive {
|
||||
const a: boolean = util.ltgt.lowerBoundInclusive({ lt: 2 });
|
||||
}
|
||||
namespace lowerBoundExclusive {
|
||||
const a: boolean = util.ltgt.lowerBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace upperBoundInclusive {
|
||||
const a: boolean = util.ltgt.upperBoundInclusive({ lt: 2 });
|
||||
}
|
||||
namespace upperBoundInclusive {
|
||||
const a: boolean = util.ltgt.upperBoundInclusive({ lt: 2 });
|
||||
}
|
||||
|
||||
namespace lowerBoundInclusive {
|
||||
const a: boolean = util.ltgt.lowerBoundInclusive({ 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
namespace userid {
|
||||
const { userid } = util;
|
||||
|
||||
{ const a: number = userid.uid("someone").gid; }
|
||||
{ const a: number = userid.uid("someone").uid; }
|
||||
{ const a: number = userid.gid("someone"); }
|
||||
{ const a: string = userid.username(1000); }
|
||||
{ const a: string = userid.groupname(1000); }
|
||||
{ const gids: number[] = userid.gids("someone"); }
|
||||
}
|
||||
|
||||
namespace LogRotator {
|
||||
const { LogRotator } = util;
|
||||
new LogRotator("file.log");
|
||||
new LogRotator("file.log", {});
|
||||
new LogRotator("file.log", { checkInterval: 1000 });
|
||||
new LogRotator("file.log", { checkInterval: "10 minutes" });
|
||||
new LogRotator("file.log", { maxSize: 1000 });
|
||||
new LogRotator("file.log", { maxSize: "100kb" });
|
||||
new LogRotator("file.log", { maxFiles: 10 });
|
||||
new LogRotator("file.log", { compress: true });
|
||||
new LogRotator("file.log").rotate().then(() => {});
|
||||
new LogRotator("file.log").start();
|
||||
new LogRotator("file.log").stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import adone from "adone";
|
||||
import { adone } from "adone";
|
||||
|
||||
namespace AdoneRootImportTests {
|
||||
adone.falsely() === false;
|
||||
|
||||
@ -29,9 +29,12 @@ namespace AdoneRootTests {
|
||||
adone.lazify({});
|
||||
adone.lazify({}, {});
|
||||
adone.lazify({}, {}, () => { });
|
||||
adone.lazify({}, {}, () => { }, {});
|
||||
adone.lazify({}, {}, () => { }, { configurable: true });
|
||||
adone.lazify({}, {}, () => { }, { writable: false });
|
||||
adone.lazify({}, {}, () => { }, { mapper: (key: string, obj: any) => null });
|
||||
adone.tag.set({}, "123");
|
||||
adone.tag.has({}, "123") === true;
|
||||
{ const a: boolean = adone.tag.has({}, "123"); }
|
||||
adone.tag.define("12");
|
||||
adone.tag.define("123", "456");
|
||||
{ const a: symbol = adone.tag.SUBSYSTEM; }
|
||||
@ -59,8 +62,6 @@ namespace AdoneRootTests {
|
||||
{ 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"); }
|
||||
|
||||
@ -19,24 +19,48 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"adone.d.ts",
|
||||
"glosses/common.d.ts",
|
||||
"glosses/math.d.ts",
|
||||
"glosses/math/index.d.ts",
|
||||
"glosses/math/matrix.d.ts",
|
||||
"glosses/math/simd.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",
|
||||
"glosses/collections.d.ts",
|
||||
"glosses/events.d.ts",
|
||||
"glosses/fs.d.ts",
|
||||
"glosses/is.d.ts",
|
||||
"glosses/exceptions.d.ts",
|
||||
"glosses/streams.d.ts",
|
||||
"glosses/fast.d.ts",
|
||||
"glosses/data.d.ts",
|
||||
"glosses/datetime.d.ts",
|
||||
"glosses/compressors.d.ts",
|
||||
"glosses/archives.d.ts",
|
||||
"adone-tests.ts",
|
||||
"test/index.ts",
|
||||
"test/index-import.ts",
|
||||
"test/glosses/common.ts",
|
||||
"test/glosses/math.ts",
|
||||
"test/glosses/math/index.ts",
|
||||
"test/glosses/math/matrix.ts",
|
||||
"test/glosses/math/simd.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"
|
||||
"test/glosses/shani-global.ts",
|
||||
"test/glosses/collections.ts",
|
||||
"test/glosses/events.ts",
|
||||
"test/glosses/fs.ts",
|
||||
"test/glosses/is.ts",
|
||||
"test/glosses/exceptions.ts",
|
||||
"test/glosses/streams.ts",
|
||||
"test/glosses/fast.ts",
|
||||
"test/glosses/data.ts",
|
||||
"test/glosses/datetime.ts",
|
||||
"test/glosses/compressors.ts",
|
||||
"test/glosses/archives.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"unified-signatures": false,
|
||||
"space-before-function-paren": false
|
||||
"space-before-function-paren": false,
|
||||
"await-promise": false
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user