From 6fdf789f545fe9baa1d5cd028dc3b3eddb690937 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 6 Oct 2016 07:07:45 -0700 Subject: [PATCH 01/24] Types 2.0: Move UUID.js and add type definitions for npm package uuid (#11785) * Move UUID.js type definitions from uuid to uuidjs Issue: #10766 * Add type definitions for npm package: uuid Issue: #10766 * Minor fix in uuidjs tests file * Clean up UUID types * Convert to external module * Formatting fixes * Allow the `export = uuid` to be called as a function directly --- uuid/index.d.ts | 101 +++++++++------------------------ uuid/tsconfig.json | 2 +- uuid/uuid-tests.ts | 31 ++++++++++ {uuid => uuidjs}/UUID-tests.ts | 2 +- uuidjs/index.d.ts | 82 ++++++++++++++++++++++++++ uuidjs/tsconfig.json | 19 +++++++ 6 files changed, 161 insertions(+), 76 deletions(-) create mode 100644 uuid/uuid-tests.ts rename {uuid => uuidjs}/UUID-tests.ts (98%) create mode 100644 uuidjs/index.d.ts create mode 100644 uuidjs/tsconfig.json diff --git a/uuid/index.d.ts b/uuid/index.d.ts index 24ab5eb160..2fd5467e3e 100644 --- a/uuid/index.d.ts +++ b/uuid/index.d.ts @@ -1,82 +1,35 @@ -// Type definitions for UUID.js v3.3.0 -// Project: https://github.com/LiosK/UUID.js -// Definitions by: Jason Jarrett +// Type definitions for uuid v2.0.3 +// Project: https://github.com/defunctzombie/node-uuid +// Definitions by: Oliver Hoffmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// +declare namespace uuid { + interface V1Options { + node?: number[]; + clockseq?: number; + msecs?: number | Date; + nsecs?: number; + } -interface UUID { - intFields: UUIDArray; - bitFields: UUIDArray; - hexFields: UUIDArray; - version: number; - bitString: string; - hexString: string; - urn: string; + type V4Options = { random: number[] } | { rng: () => number[]; } + interface UuidStatic { + (options?: V4Options): string; + (options: V4Options | null, buffer: number[], offset?: number): number[]; + (options: V4Options | null, buffer: Buffer, offset?: number): Buffer; - /** - * Tests if two {@link UUID} objects are equal. - * @param {UUID} uuid - * @returns {bool} True if two {@link UUID} objects are equal. - */ - equals(uuid: UUID): boolean; - - /** - * Returns UUID string representation. - * @returns {string} {@link UUID#hexString}. - */ - toString(): string; + v1(options?: V1Options): string; + v1(options: V1Options | null, buffer: number[], offset?: number): number[]; + v1(options: V1Options | null, buffer: Buffer, offset?: number): Buffer; + v4: UuidStatic; + parse(id: string): number[]; + parse(id: string, buffer: number[], offset?: number): number[]; + parse(id: string, buffer: Buffer, offset?: number): Buffer; + unparse(buffer: number[] | Buffer, offset?: number): string; + } } -interface UUIDArray extends Array { - timeLow: string; - timeMid: string; - timeHiAndVersion: string; - clockSeqHiAndReserved: string; - clockSeqLow: string; - node: string; -} - -/** - * The simplest function to get an UUID string. - * @returns {string} A version 4 UUID string. - */ -export declare function generate(): string; - -/** - * Generates a version 4 {@link UUID}. - * @returns {UUID} A version 4 {@link UUID} object. - * @since 3.0 - */ -export declare function genV4(): UUID; - - -/** - * Generates a version 1 {@link UUID}. - * @returns {UUID} A version 1 {@link UUID} object. - * @since 3.0 - */ -export declare function genV1(): UUID; - -/** - * Converts hexadecimal UUID string to an {@link UUID} object. - * @param {string} uuid UUID hexadecimal string representation ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"). - * @returns {UUID} {@link UUID} object or null. - * @since 3.0 - */ -export declare function parse(uuid: string): UUID; - - -/** - * Re-initializes version 1 UUID state. - * @since 3.0 - */ -export declare function resetState(): void; - -/** - * Reinstalls {@link UUID.generate} method to emulate the interface of UUID.js version 2.x. - * @since 3.1 - * @deprecated Version 2.x. compatible interface is not recommended. - */ -export declare function makeBackwardCompatible(): void; +declare const uuid: uuid.UuidStatic +export = uuid diff --git a/uuid/tsconfig.json b/uuid/tsconfig.json index 07fa3344c9..02a01e4383 100644 --- a/uuid/tsconfig.json +++ b/uuid/tsconfig.json @@ -16,4 +16,4 @@ "index.d.ts", "uuid-tests.ts" ] -} \ No newline at end of file +} diff --git a/uuid/uuid-tests.ts b/uuid/uuid-tests.ts new file mode 100644 index 0000000000..2dd5ea7f46 --- /dev/null +++ b/uuid/uuid-tests.ts @@ -0,0 +1,31 @@ +import uuid = require('uuid'); + +let uuidv1: string = uuid.v1(); + +uuidv1 = uuid.v1({ + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678 +}); + +let bufferv1: number[] = new Array(32); +bufferv1 = uuid.v1(null, bufferv1); +bufferv1 = uuid.v1(null, bufferv1, 16); + +let uuidv4: string = uuid.v4(); + +const randoms = [ + 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, + 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 +]; +uuidv4 = uuid({ random: randoms }); +uuidv4 = uuid({ rng: () => randoms }) + +let bufferv4: number[] = new Array(32); +bufferv4 = uuid(null, bufferv4); +bufferv4 = uuid(null, bufferv4, 16); + +let nodeBufferv4 = Buffer.alloc(32); +nodeBufferv4 = uuid.v4(null, nodeBufferv4); +nodeBufferv4 = uuid.v4(null, nodeBufferv4, 16); diff --git a/uuid/UUID-tests.ts b/uuidjs/UUID-tests.ts similarity index 98% rename from uuid/UUID-tests.ts rename to uuidjs/UUID-tests.ts index 2ba8fa57eb..51bed1c700 100644 --- a/uuid/UUID-tests.ts +++ b/uuidjs/UUID-tests.ts @@ -1,4 +1,4 @@ -import UUID = require("uuid"); +import UUID = require("uuidjs"); const uuid1: string = UUID.generate() const uuid2: UUID.UUID = UUID.genV4() diff --git a/uuidjs/index.d.ts b/uuidjs/index.d.ts new file mode 100644 index 0000000000..24ab5eb160 --- /dev/null +++ b/uuidjs/index.d.ts @@ -0,0 +1,82 @@ +// Type definitions for UUID.js v3.3.0 +// Project: https://github.com/LiosK/UUID.js +// Definitions by: Jason Jarrett +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + + +interface UUID { + intFields: UUIDArray; + bitFields: UUIDArray; + hexFields: UUIDArray; + version: number; + bitString: string; + hexString: string; + urn: string; + + + /** + * Tests if two {@link UUID} objects are equal. + * @param {UUID} uuid + * @returns {bool} True if two {@link UUID} objects are equal. + */ + equals(uuid: UUID): boolean; + + /** + * Returns UUID string representation. + * @returns {string} {@link UUID#hexString}. + */ + toString(): string; +} + +interface UUIDArray extends Array { + timeLow: string; + timeMid: string; + timeHiAndVersion: string; + clockSeqHiAndReserved: string; + clockSeqLow: string; + node: string; +} + +/** + * The simplest function to get an UUID string. + * @returns {string} A version 4 UUID string. + */ +export declare function generate(): string; + +/** + * Generates a version 4 {@link UUID}. + * @returns {UUID} A version 4 {@link UUID} object. + * @since 3.0 + */ +export declare function genV4(): UUID; + + +/** + * Generates a version 1 {@link UUID}. + * @returns {UUID} A version 1 {@link UUID} object. + * @since 3.0 + */ +export declare function genV1(): UUID; + +/** + * Converts hexadecimal UUID string to an {@link UUID} object. + * @param {string} uuid UUID hexadecimal string representation ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"). + * @returns {UUID} {@link UUID} object or null. + * @since 3.0 + */ +export declare function parse(uuid: string): UUID; + + +/** + * Re-initializes version 1 UUID state. + * @since 3.0 + */ +export declare function resetState(): void; + +/** + * Reinstalls {@link UUID.generate} method to emulate the interface of UUID.js version 2.x. + * @since 3.1 + * @deprecated Version 2.x. compatible interface is not recommended. + */ +export declare function makeBackwardCompatible(): void; diff --git a/uuidjs/tsconfig.json b/uuidjs/tsconfig.json new file mode 100644 index 0000000000..559d117755 --- /dev/null +++ b/uuidjs/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "UUID-tests.ts" + ] +} From 026bbfeb7a0467c63cdd1df563129bb6499b6709 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 6 Oct 2016 07:37:30 -0700 Subject: [PATCH 02/24] Update Electron.WebContents (#11748) * electron: Remove WebContents.getFavicon() This was removed in electron/electron#1554 * electron: Add missing WebContents.{isDestroyed,isFocused} See http://electron.atom.io/docs/api/web-contents --- electron/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/electron/index.d.ts b/electron/index.d.ts index 3344847224..612e9e4ab0 100644 --- a/electron/index.d.ts +++ b/electron/index.d.ts @@ -3967,9 +3967,13 @@ declare namespace Electron { */ getTitle(): string; /** - * @returns The favicon of the web page. + * @returns Whether the web page is destroyed. */ - getFavicon(): NativeImage; + isDestroyed(): boolean; + /** + * @returns Whether the web page is focused. + */ + isFocused(): boolean; /** * @returns Whether web page is still loading resources. */ From 6881f23823d26e08544e2eae0776b4be45e0b1fc Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 6 Oct 2016 18:41:35 +0200 Subject: [PATCH 03/24] update lolex typings to 1.5.1 (#11762) --- lolex/index.d.ts | 7 ++++++- lolex/lolex-tests.ts | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lolex/index.d.ts b/lolex/index.d.ts index 27052b54a5..544fb88fb6 100644 --- a/lolex/index.d.ts +++ b/lolex/index.d.ts @@ -1,10 +1,12 @@ -// Type definitions for lolex 1.2.1 +// Type definitions for lolex 1.5.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface Clock { + now: number; + setTimeout(callback: () => any, timeout: number): number; setInterval(callback: () => any, timeout: number): number; setImmediate(callback: () => any): number; @@ -13,6 +15,9 @@ export interface Clock { clearInterval(id: number): void; clearImmediate(id: number): void; + setSystemTime(now: number): void; + setSystemTime(date: Date): void; + tick(ms: number): void; uninstall(): void; } diff --git a/lolex/lolex-tests.ts b/lolex/lolex-tests.ts index 8f2c96a1c7..00feecfdd6 100644 --- a/lolex/lolex-tests.ts +++ b/lolex/lolex-tests.ts @@ -57,6 +57,11 @@ clock = lolex.install(window, Date.now(), ['setTimeout', 'clearTimeout']); clock = lolex.install(Date.now()); clock = lolex.install(Date.now(), ['setTimeout', 'clearTimeout']); +/** + * clock.now + */ +var n: number = clock.now; + var id: number; /** @@ -100,6 +105,11 @@ id = clock.setImmediate(() => {}); clock.clearImmediate(id); +/** + * clock.setSystemTime + */ +clock.setSystemTime(0); +clock.setSystemTime(new Date()); /** * clock.tick(time) @@ -113,3 +123,4 @@ clock.tick(1000); */ clock.uninstall(); + From 159ba3fc8f85b39df08cf4d69fe689c78414bb6e Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 6 Oct 2016 18:42:04 +0200 Subject: [PATCH 04/24] add method privateKeyToOpenSSH() to node-forge (#11763) --- node-forge/index.d.ts | 7 +++++++ node-forge/node-forge-tests.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/node-forge/index.d.ts b/node-forge/index.d.ts index 7e0cae19df..b39ede7ac4 100644 --- a/node-forge/index.d.ts +++ b/node-forge/index.d.ts @@ -34,4 +34,11 @@ declare module "node-forge" { export function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair; } } + + export namespace ssh { + /** + * Encodes a private RSA key as an OpenSSH file. + */ + export function privateKeyToOpenSSH(privateKey?: string, passphrase?: string): string; + } } diff --git a/node-forge/node-forge-tests.ts b/node-forge/node-forge-tests.ts index 16538ad84f..7ed36e50e2 100644 --- a/node-forge/node-forge-tests.ts +++ b/node-forge/node-forge-tests.ts @@ -3,3 +3,5 @@ import * as forge from "node-forge"; let keypair = forge.pki.rsa.generateKeyPair({bits: 512}); let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey); let publicKeyPem = forge.pki.publicKeyToPem(keypair.publicKey); + +let x: string = forge.ssh.privateKeyToOpenSSH(); From dc86842627e2c900098652a43558bbccedc3dbb4 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 6 Oct 2016 09:43:47 -0700 Subject: [PATCH 05/24] Make moment dependency use open ranges (#11547) * Make moment dependency use `>` instead of fixed version * Remove unused file * Use moment.MomentFormatSpecification * Add dependency on moment --- angular-bootstrap-calendar/package.json | 2 +- bootstrap.v3.datetimepicker/package.json | 2 +- business-rules-engine/package.json | 2 +- daterangepicker/package.json | 2 +- eonasdan-bootstrap-datetimepicker/package.json | 2 +- fullcalendar/package.json | 2 +- jquery.livestampjs/package.json | 2 +- moment-jalaali/package.json | 2 +- moment-range/package.json | 2 +- moment-timezone/index.d.ts | 11 ++++------- moment-timezone/package.json | 2 +- pikaday/package.json | 2 +- react-datepicker/package.json | 2 +- react-daterange-picker/package.json | 8 ++++---- react-daterange-picker/tsconfig.json | 3 +++ twix/package.json | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/angular-bootstrap-calendar/package.json b/angular-bootstrap-calendar/package.json index 992b24d513..4c6d24a445 100644 --- a/angular-bootstrap-calendar/package.json +++ b/angular-bootstrap-calendar/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/bootstrap.v3.datetimepicker/package.json b/bootstrap.v3.datetimepicker/package.json index 992b24d513..4c6d24a445 100644 --- a/bootstrap.v3.datetimepicker/package.json +++ b/bootstrap.v3.datetimepicker/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/business-rules-engine/package.json b/business-rules-engine/package.json index c4decef904..d33ff913ce 100644 --- a/business-rules-engine/package.json +++ b/business-rules-engine/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } diff --git a/daterangepicker/package.json b/daterangepicker/package.json index 992b24d513..4c6d24a445 100644 --- a/daterangepicker/package.json +++ b/daterangepicker/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/eonasdan-bootstrap-datetimepicker/package.json b/eonasdan-bootstrap-datetimepicker/package.json index 992b24d513..4c6d24a445 100644 --- a/eonasdan-bootstrap-datetimepicker/package.json +++ b/eonasdan-bootstrap-datetimepicker/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/fullcalendar/package.json b/fullcalendar/package.json index c4decef904..d33ff913ce 100644 --- a/fullcalendar/package.json +++ b/fullcalendar/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } diff --git a/jquery.livestampjs/package.json b/jquery.livestampjs/package.json index c4decef904..d33ff913ce 100644 --- a/jquery.livestampjs/package.json +++ b/jquery.livestampjs/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } diff --git a/moment-jalaali/package.json b/moment-jalaali/package.json index 992b24d513..4c6d24a445 100644 --- a/moment-jalaali/package.json +++ b/moment-jalaali/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/moment-range/package.json b/moment-range/package.json index 992b24d513..4c6d24a445 100644 --- a/moment-range/package.json +++ b/moment-range/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/moment-timezone/index.d.ts b/moment-timezone/index.d.ts index 030c09270b..6d45938c18 100644 --- a/moment-timezone/index.d.ts +++ b/moment-timezone/index.d.ts @@ -20,19 +20,16 @@ declare namespace MomentTimezone { parse(timestamp: number): number } - type MomentFormatSpecification = - string | (() => void) | (string | (() => void))[]; - interface MomentTimezone { (): moment.Moment; (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; (date: string, timezone: string): moment.Moment; - (date: string, format: MomentFormatSpecification, timezone: string): moment.Moment; - (date: string, format: MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; - (date: string, format: MomentFormatSpecification, language: string, timezone: string): moment.Moment; - (date: string, format: MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; (date: Date, timezone: string): moment.Moment; (date: moment.Moment, timezone: string): moment.Moment; (date: Object, timezone: string): moment.Moment; diff --git a/moment-timezone/package.json b/moment-timezone/package.json index c4decef904..d33ff913ce 100644 --- a/moment-timezone/package.json +++ b/moment-timezone/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } diff --git a/pikaday/package.json b/pikaday/package.json index c4decef904..d33ff913ce 100644 --- a/pikaday/package.json +++ b/pikaday/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } diff --git a/react-datepicker/package.json b/react-datepicker/package.json index 992b24d513..4c6d24a445 100644 --- a/react-datepicker/package.json +++ b/react-datepicker/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file diff --git a/react-daterange-picker/package.json b/react-daterange-picker/package.json index bfdab7b7fe..4c6d24a445 100644 --- a/react-daterange-picker/package.json +++ b/react-daterange-picker/package.json @@ -1,5 +1,5 @@ { - "scripts": { - "postinstall": "cd ../moment-range && npm install" - } -} + "dependencies": { + "moment": ">=2.14.0" + } +} \ No newline at end of file diff --git a/react-daterange-picker/tsconfig.json b/react-daterange-picker/tsconfig.json index b0493165b7..658e569c10 100644 --- a/react-daterange-picker/tsconfig.json +++ b/react-daterange-picker/tsconfig.json @@ -8,6 +8,9 @@ "typeRoots": [ "../" ], + "paths": { + "*": ["*", "react-daterange-picker/node_modules/*"] + }, "types": ["moment-range", "react"], "noEmit": true, "forceConsistentCasingInFileNames": true, diff --git a/twix/package.json b/twix/package.json index 992b24d513..4c6d24a445 100644 --- a/twix/package.json +++ b/twix/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "moment": "2.14.*" + "moment": ">=2.14.0" } } \ No newline at end of file From 9d5fc54dd54647206ad9b83514b11a4548867216 Mon Sep 17 00:00:00 2001 From: Guilherme Oenning Date: Thu, 6 Oct 2016 13:54:55 -0300 Subject: [PATCH 06/24] headers was renamted to header. closes #11159 (#11773) --- jsonwebtoken/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonwebtoken/index.d.ts b/jsonwebtoken/index.d.ts index 4cdbf3d924..15790f7547 100644 --- a/jsonwebtoken/index.d.ts +++ b/jsonwebtoken/index.d.ts @@ -46,7 +46,7 @@ export interface SignOptions { issuer?: string; jwtid?: string; noTimestamp?: boolean; - headers?: Object; + header?: Object; encoding?: string; } From 428195bee21d60868efcb2dbcb90b7ab01b88aa4 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 6 Oct 2016 18:56:16 +0200 Subject: [PATCH 07/24] Improve temp function signatures (#11774) --- temp/index.d.ts | 45 ++++++++++++++++++++++++++++----------------- temp/temp-tests.ts | 9 +++++---- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/temp/index.d.ts b/temp/index.d.ts index bb2f1abbf7..a6b6f42ace 100644 --- a/temp/index.d.ts +++ b/temp/index.d.ts @@ -8,34 +8,45 @@ import * as temp from "temp"; import * as fs from "fs"; +export interface OpenFile { + path: string; + fd: number; +} + +export interface Stats { + files: number; + dirs: number; +} + export interface AffixOptions { - prefix?: string; - suffix?: string; - dir?: string; + prefix?: string; + suffix?: string; + dir?: string; } export declare var dir: string; export declare function track(value?: boolean): typeof temp; -export declare function mkdir(affixes: string, callback?: (err: any, dirPath: string) => void): void; -export declare function mkdir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void): void; +export declare function mkdir(affixes?: string, callback?: (err: any, dirPath: string) => void): void; +export declare function mkdir(affixes?: AffixOptions, callback?: (err: any, dirPath: string) => void): void; -export declare function mkdirSync(affixes: string): string; -export declare function mkdirSync(affixes: AffixOptions): string; +export declare function mkdirSync(affixes?: string): string; +export declare function mkdirSync(affixes?: AffixOptions): string; -export declare function open(affixes: string, callback?: (err: any, result: { path: string, fd: number }) => void): void; -export declare function open(affixes: AffixOptions, callback?: (err: any, result: { path: string, fd: number }) => void): void; +export declare function open(affixes?: string, callback?: (err: any, result: OpenFile) => void): void; +export declare function open(affixes?: AffixOptions, callback?: (err: any, result: OpenFile) => void): void; -export declare function openSync(affixes: string): { path: string, fd: number }; -export declare function openSync(affixes: AffixOptions): { path: string, fd: number }; +export declare function openSync(affixes?: string): OpenFile; +export declare function openSync(affixes?: AffixOptions): OpenFile; -export declare function path(affixes: string, defaultPrefix?: string): string; -export declare function path(affixes: AffixOptions, defaultPrefix?: string): string; +export declare function path(affixes?: string, defaultPrefix?: string): string; +export declare function path(affixes?: AffixOptions, defaultPrefix?: string): string; -export declare function cleanup(callback?: (result: boolean | { files: number, dirs?: number }) => void): void; +export declare function cleanup(callback?: (result: boolean | Stats) => void): void; -export declare function cleanupSync(): boolean | { files: number, dirs: number }; +export declare function cleanupSync(): boolean | Stats; + +export declare function createWriteStream(affixes?: string): fs.WriteStream; +export declare function createWriteStream(affixes?: AffixOptions): fs.WriteStream; -export declare function createWriteStream(affixes: string): fs.WriteStream; -export declare function createWriteStream(affixes: AffixOptions): fs.WriteStream; diff --git a/temp/temp-tests.ts b/temp/temp-tests.ts index 3f8ed01327..78eff82298 100644 --- a/temp/temp-tests.ts +++ b/temp/temp-tests.ts @@ -16,7 +16,7 @@ function testCleanup() { } function testCleanupSync() { - const cleanupResult = temp.cleanupSync() + const cleanupResult: boolean | temp.Stats = temp.cleanupSync() if (typeof cleanupResult === "boolean") { const x = cleanupResult === true; } @@ -42,13 +42,14 @@ function testOpen() { } function testOpenSync() { - const { fd: openFd1, path: openPath1 } = temp.openSync({ dir: "tempDir", prefix: "pref", suffix: "suff" }); - const { fd: openFd2, path: openPath2 } = temp.openSync("str"); + const f1: temp.OpenFile = temp.openSync({ dir: "tempDir", prefix: "pref", suffix: "suff" }); + const f2: temp.OpenFile = temp.openSync("str"); } function testCreateWriteStream() { const stream = temp.createWriteStream("HelloStreamAffix"); stream.write("data"); + const stream2 = temp.createWriteStream(); } function testMkdir() { @@ -73,4 +74,4 @@ function testTrack() { const tempChained = temp.track().track(true).track(false); tempChained.dir; tempChained.cleanupSync(); -} \ No newline at end of file +} From e3b20d93a9c3e7dacb693cccc13d9bb3ad2ec7cc Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 6 Oct 2016 18:56:44 +0200 Subject: [PATCH 08/24] Allow to use with commonjs (#11775) --- mobile-detect/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mobile-detect/index.d.ts b/mobile-detect/index.d.ts index 5e3df3377a..e85b1afc27 100644 --- a/mobile-detect/index.d.ts +++ b/mobile-detect/index.d.ts @@ -18,3 +18,6 @@ declare class MobileDetect { version(value: string): number; versionStr(value: string): string; } + +export = MobileDetect; +export as namespace MobileDetect; \ No newline at end of file From 1be288e7e16a232a4dfd38700c4ab46000e9c503 Mon Sep 17 00:00:00 2001 From: mgroenhoff Date: Thu, 6 Oct 2016 19:03:03 +0200 Subject: [PATCH 09/24] Add missing terminalWidth method to yargs. (#11779) --- yargs/index.d.ts | 2 ++ yargs/yargs-tests.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index 7fda2c8320..df84b8dc3d 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -16,6 +16,8 @@ declare namespace yargs { detectLocale(detect: boolean): Argv; + terminalWidth(): number; + alias(shortName: string, longName: string): Argv; alias(aliases: { [shortName: string]: string }): Argv; alias(aliases: { [shortName: string]: string[] }): Argv; diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index c31ce4b997..e2fedd7b66 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -270,6 +270,14 @@ function Argv$version() { .version(function () { return '1.0.0'; }, '--version', 'description'); } +function Argv$wrap() { + var argv1 = yargs + .wrap(null); + + var argv2 = yargs + .wrap(yargs.terminalWidth()); +} + function Argv$locale() { var argv = yargs .usage('./$0 - follow ye instructions true') From 086bf3e5816861d59a532f2a57d4524e9f54be1f Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 6 Oct 2016 22:32:08 +0100 Subject: [PATCH 10/24] selenium-webdriver: allow => in map (#11770) * selenium-webdriver: allow => in map Followup from https://github.com/DefinitelyTyped/DefinitelyTyped/pull/11726#issuecomment-251919529 The fix in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/11726 seems to have uncovered a bug in the `map` typings, where the return type is expected to be the same as the argument type. This is incorrect as you can map from one type to another. * Change un-inferred type to any --- selenium-webdriver/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selenium-webdriver/index.d.ts b/selenium-webdriver/index.d.ts index b8acad06d4..97722de9b6 100644 --- a/selenium-webdriver/index.d.ts +++ b/selenium-webdriver/index.d.ts @@ -2174,7 +2174,7 @@ declare namespace webdriver { * {@code fn}. * @template TYPE, SELF */ - function map(arr: Array|Promise>, fn: (self: any, type: any, index: number, array: any[]) => any, opt_self?: any): Promise + function map(arr: Array|Promise>, fn: (self: any, type: any, index: number, array: T[]) => any, opt_self?: any): Promise /** * Creates a promise that has been rejected with the given reason. @@ -2250,7 +2250,7 @@ declare namespace webdriver { * rejected. * @return {!ManagedPromise} A new promise. */ - function when(value: T|Promise, opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): Promise; + function when(value: T|Promise, opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): Promise; /** * Returns a promise that will be resolved with the input value in a From fd855bd6319fbf9d4706d5f4b586ffdab7526402 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Sat, 8 Oct 2016 02:02:27 +0900 Subject: [PATCH 11/24] TypeScript-STL & Samchon-Framework (#11818) For TS2.0 --- samchon-collection/samchon-collection.d.ts | 6 +- samchon-framework/index.d.ts | 10266 +++++++++----- typescript-stl/index.d.ts | 13713 ++++++++++--------- 3 files changed, 13963 insertions(+), 10022 deletions(-) diff --git a/samchon-collection/samchon-collection.d.ts b/samchon-collection/samchon-collection.d.ts index 5f62a81d42..6d6d7e78e2 100644 --- a/samchon-collection/samchon-collection.d.ts +++ b/samchon-collection/samchon-collection.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Samchon Collection v0.0.2 +// Type definitions for Samchon Collection v0.0.4 // Project: https://github.com/samchon/framework // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,7 +7,7 @@ declare module "samchon-collection" { - import collection = samchon.collection; - export = collection; + import collections = samchon.collections; + export = collections; } diff --git a/samchon-framework/index.d.ts b/samchon-framework/index.d.ts index b34eec8e6f..fb3e02bf53 100644 --- a/samchon-framework/index.d.ts +++ b/samchon-framework/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Samchon Framework v2.0.0-beta.8 +// Type definitions for Samchon Framework v2.0.0-gamma.4 // Project: https://github.com/samchon/framework // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,63 +7,110 @@ declare module "samchon-framework" { - export = samchon; + export = samchon; } /** *

Samchon-Framework

* - *

- *

+ * + * * - *

Samchon, a SDN (Software Defined Network) framework.

+ * Samchon, a SDN (Software Defined Network) framework. * - *

With Samchon Framework, you can implement distributed processing system within framework of OOD like - * handling S/W objects (classes). You can realize cloud and distributed system very easily with provided - * system templates and even integration with C++ is possible.

+ * With Samchon Framework, you can implement distributed processing system within framework of OOD like handling S/W + * objects (classes). You can realize cloud and distributed system very easily with provided system templates and even + * integration with C++ is possible. * - *

The goal, ultimate utilization model of Samchon Framework is, building cloud system with NodeJS and - * takING heavy works to C++ distributed systems with provided modules (those are system templates).

+ * The goal, ultimate utilization model of Samchon Framework is, building cloud system with NodeJS and taking heavy works + * to C++ distributed systems with provided modules (those are system templates). * * @git https://github.com/samchon/framework * @author Jeongho Nam */ declare namespace samchon { /** - *

Running on Node.

+ * Running on Node. * - *

Test whether the JavaScript is running on Node.

+ * Test whether the JavaScript is running on Node. * * @references http://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser */ function is_node(): boolean; } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link Vector} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
    • {@link push_back}
    • - *
    • {@link unshift}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link pop_back}
    • - *
    • {@link shift}
    • - *
    • {@link pop}
    • - *
    • {@link splice}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link sort}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - {@link push_back} + * - {@link unshift} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link pop_back} + * - {@link shift} + * - {@link pop} + * - {@link splice} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link Vector} + * {@link Vector Vectors}s are sequence containers representing arrays that can change in size. + * + * Just like arrays, {@link Vector}s use contiguous storage locations for their elements, which means that their + * elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in + * arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically + * by the container. + * + * Internally, {@link Vector}s use a dynamically allocated array to store their elements. This array may need to + * be reallocated in order to grow in size when new elements are inserted, which implies allocating a new array + * and moving all elements to it. This is a relatively expensive task in terms of processing time, and thus, + * {@link Vector}s do not reallocate each time an element is added to the container. + * + * Instead, {@link Vector} containers may allocate some extra storage to accommodate for possible growth, and + * thus the container may have an actual {@link capacity} greater than the storage strictly needed to contain its + * elements (i.e., its {@link size}). Libraries can implement different strategies for growth to balance between + * memory usage and reallocations, but in any case, reallocations should only happen at logarithmically growing + * intervals of {@link size} so that the insertion of individual elements at the end of the {@link Vector} can be + * provided with amortized constant time complexity (see {@link push_back push_back()}). + * + * Therefore, compared to arrays, {@link Vector}s consume more memory in exchange for the ability to manage + * storage and grow dynamically in an efficient way. + * + * Compared to the other dynamic sequence containers ({@link Deque}s, {@link List}s), {@link Vector Vectors} are + * very efficient accessing its elements (just like arrays) and relatively efficient adding or removing elements + * from its end. For operations that involve inserting or removing elements at positions other than the end, they + * perform worse than the others, and have less consistent iterators and references than {@link List}s. + * + * + * + * + * + *

Container properties

+ *
+ *
Sequence
+ *
+ * Elements in sequence containers are ordered in a strict linear sequence. Individual elements are + * accessed by their position in this sequence. + *
+ * + *
Dynamic array
+ *
+ * Allows direct access to any element in the sequence, even through pointer arithmetics, and provides + * relatively fast addition/removal of elements at the end of the sequence. + *
+ *
+ * + * @param Type of the elements. + * + * @reference http://www.cplusplus.com/reference/vector/vector + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class ArrayCollection extends std.Vector implements ICollection { @@ -74,7 +121,7 @@ declare namespace samchon.collection { /** * @inheritdoc */ - push(...items: U[]): number; + push(...items: T[]): number; /** * @inheritdoc */ @@ -170,6 +217,7 @@ declare namespace samchon.library { * A basic event class of Samchon Framework. * * @reference https://developer.mozilla.org/en-US/docs/Web/API/Event + * @handbook https://github.com/samchon/framework/wiki/TypeScript-Library-EventDispatcher * @author Jeongho Nam */ class BasicEvent { @@ -201,7 +249,7 @@ declare namespace samchon.library { /** * @inheritdoc */ - type: string; + readonly type: string; /** * @inheritdoc */ @@ -209,89 +257,98 @@ declare namespace samchon.library { /** * @inheritdoc */ - currentTarget: IEventDispatcher; + readonly currentTarget: IEventDispatcher; /** * @inheritdoc */ - isTrusted: boolean; + readonly isTrusted: boolean; /** * @inheritdoc */ - bubbles: boolean; + readonly bubbles: boolean; /** * @inheritdoc */ - cancelable: boolean; + readonly cancelable: boolean; /** * @inheritdoc */ - eventPhase: number; + readonly eventPhase: number; /** * @inheritdoc */ - defaultPrevented: boolean; + readonly defaultPrevented: boolean; /** * @inheritdoc */ - srcElement: Element; + readonly srcElement: Element; /** * @inheritdoc */ - cancelBubble: boolean; + readonly cancelBubble: boolean; /** * @inheritdoc */ - timeStamp: number; + readonly timeStamp: number; /** * Don't know what it is. */ - returnValue: boolean; + readonly returnValue: boolean; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * Type of function pointer for listener of {@link CollectionEvent CollectionEvents}. */ type CollectionEventListener = (event: CollectionEvent) => void; } -declare namespace samchon.collection { +declare namespace samchon.collections { /** + * An event occured in a {@link ICollection collection} object. + * + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class CollectionEvent extends library.BasicEvent { /** * @hidden */ - protected first_: std.Iterator; + private first_; + /** + * @hidden + */ + private last_; /** * @hidden */ - protected last_: std.Iterator; private temporary_container_; + /** + * @hidden + */ private origin_first_; /** * Initialization Constructor. * * @param type Type of collection event. - * @param first - * @param last + * @param first An {@link Iterator} to the initial position in this {@link CollectionEvent}. + * @param last An {@link Iterator} to the final position in this {@link CollectionEvent}. */ constructor(type: string, first: std.Iterator, last: std.Iterator); constructor(type: "insert", first: std.Iterator, last: std.Iterator); constructor(type: "erase", first: std.Iterator, last: std.Iterator); constructor(type: "refresh", first: std.Iterator, last: std.Iterator); /** - * Get associative target, the container. + * Associative target, the {@link ICollection collection}. */ - target: ICollection; + readonly target: ICollection; /** - * Get range of the first. + * An {@link Iterator} to the initial position in this {@link CollectionEvent}. */ - first: std.Iterator; + readonly first: std.Iterator; /** - * Get range of the last. + * An {@link Iterator} to the final position in this {@link CollectionEvent}. */ - last: std.Iterator; + readonly last: std.Iterator; /** * @inheritdoc */ @@ -301,34 +358,78 @@ declare namespace samchon.collection { /** * @hidden */ -declare namespace samchon.collection.CollectionEvent { +declare namespace samchon.collections.CollectionEvent { const INSERT: "insert"; const ERASE: "erase"; const REFRESH: "refresh"; } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link Deque} who can detect element I/O events. * - *

Below are list of methods who are dispatching {@link CollectionEvent}:

+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - {@link push_front} + * - {@link push_back} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link pop_front} + * - {@link pop_back} + * - *refresh* typed events: + * - {@link refresh} * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
    • {@link push_front}
    • - *
    • {@link push_back}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link pop_front}
    • - *
    • {@link pop_back}
    • - *
  • - *
+ * #### [Inherited] {@link Deque} + * {@link Deque} (usually pronounced like "*deck*") is an irregular acronym of **d**ouble-**e**nded **q**ueue. + * Double-ended queues are sequence containers with dynamic sizes that can be expanded or contracted on both ends + * (either its front or its back). * + * Specific libraries may implement deques in different ways, generally as some form of dynamic array. But in any + * case, they allow for the individual elements to be accessed directly through random access iterators, with + * storage handled automatically by expanding and contracting the container as needed. + * + * Therefore, they provide a functionality similar to vectors, but with efficient insertion and deletion of + * elements also at the beginning of the sequence, and not only at its end. But, unlike {@link Vector Vectors}, + * {@link Deque Deques} are not guaranteed to store all its elements in contiguous storage locations: accessing + * elements in a deque by offsetting a pointer to another element causes undefined behavior. + * + * Both {@link Vector}s and {@link Deque}s provide a very similar interface and can be used for similar purposes, + * but internally both work in quite different ways: While {@link Vector}s use a single array that needs to be + * occasionally reallocated for growth, the elements of a {@link Deque} can be scattered in different chunks of + * storage, with the container keeping the necessary information internally to provide direct access to any of its + * elements in constant time and with a uniform sequential interface (through iterators). Therefore, + * {@link Deque Deques} are a little more complex internally than {@link Vector}s, but this allows them to grow + * more efficiently under certain circumstances, especially with very long sequences, where reallocations become + * more expensive. + * + * For operations that involve frequent insertion or removals of elements at positions other than the beginning or + * the end, {@link Deque Deques} perform worse and have less consistent iterators and references than + * {@link List Lists}. + * + * + * + * + * + *

Container properties

+ *
+ *
Sequence
+ *
Elements in sequence containers are ordered in a strict linear sequence. Individual elements + * are accessed by their position in this sequence.
+ * + *
Dynamic array
+ *
Generally implemented as a dynamic array, it allows direct access to any element in the + * sequence and provides relatively fast addition/removal of elements at the beginning or the end + * of the sequence.
+ *
+ * + * @param Type of the elements. + * + * @reference http://www.cplusplus.com/reference/deque/deque/ + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class DequeCollection extends std.Deque implements ICollection { @@ -339,7 +440,7 @@ declare namespace samchon.collection { /** * @inheritdoc */ - push(...items: U[]): number; + push(...items: T[]): number; /** * @inheritdoc */ @@ -418,30 +519,72 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashMap} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
    • {@link set}
    • - *
    • {@link insert_or_assign}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link extract}
    • - *
  • - *
  • refresh typed events:
      - *
    • {@link set}
    • - *
    • {@link insert_or_assign}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link MapCollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link insert_or_assign} + * - {@link emplace} + * - {@link set} + * - {@link push} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link extract} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashMap} + * {@link HashMap HashMaps} are associative containers that store elements formed by the combination of a + * *key value* and a *mapped value*, and which allows for fast retrieval of individual elements based on their + * *keys*. + * + * In an {@link HashMap}, the *key value* is generally used to uniquely identify the element, while the + * *mapped value* is an object with the content associated to this *key*. Types of *key* and *mapped value* may + * differ. + * + * Internally, the elements in the {@link HashMap} are not sorted in any particular order with respect to either + * their *key* or *mapped values*, but organized into *buckets* depending on their hash values to allow for fast + * access to individual elements directly by their *key values* (with a constant average time complexity on + * average). + * + * {@link HashMap} containers are faster than {@link TreeMap} containers to access individual elements by their + * *key*, although they are generally less efficient for range iteration through a subset of their elements. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Map
+ *
Each element associates a *key* to a *mapped value*: + * *Keys* are meant to identify the elements whose main content is the *mapped value*.
+ * + *
Unique keys
+ *
No two elements in the container can have equivalent keys.
+ *
+ * + * @param Type of the key values. + * Each element in an {@link HashMap} is uniquely identified by its key value. + * @param Type of the mapped value. + * Each element in an {@link HashMap} is used to store some data as its mapped value. + * + * @reference http://www.cplusplus.com/reference/unordered_map/unordered_map + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashMapCollection extends std.HashMap implements ICollection> { @@ -507,23 +650,69 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: MapCollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashMultiMap} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link MapCollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link emplace} + * - {@link push} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashMultiMap} + * {@link HashMultiMap HashMultiMap}s are associative containers that store elements formed by the combination of + * a *key value* and a *mapped value*, much like {@link HashMultiMap} containers, but allowing different elements + * to have equivalent *keys*. + * + * In an {@link HashMultiMap}, the *key value* is generally used to uniquely identify the element, while the + * *mapped value* is an object with the content associated to this *key*. Types of *key* and *mapped value* may + * differ. + * + * Internally, the elements in the {@link HashMultiMap} are not sorted in any particular order with respect to + * either their *key* or *mapped values*, but organized into *buckets* depending on their hash values to allow for + * fast access to individual elements directly by their *key values* (with a constant average time complexity on + * average). + * + * Elements with equivalent *keys* are grouped together in the same bucket and in such a way that an iterator can + * iterate through all of them. Iterators in the container are doubly linked iterators. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Map
+ *
Each element associates a *key* to a *mapped value*: + * *Keys* are meant to identify the elements whose main content is the *mapped value*.
+ * + *
Multiple equivalent keys
+ *
The container can hold multiple elements with equivalent *keys*.
+ *
+ * + * @param Type of the key values. + * Each element in an {@link HashMultiMap} is identified by a key value. + * @param Type of the mapped value. + * Each element in an {@link HashMultiMap} is used to store some data as its mapped value. + * + * @reference http://www.cplusplus.com/reference/unordered_map/unordered_multimap + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashMultiMapCollection extends std.HashMap implements ICollection> { @@ -589,23 +778,64 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: MapCollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashMultiSet} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashMultiSet} + * {@link HashMultiSet HashMultiSets} are containers that store elements in no particular order, allowing fast + * retrieval of individual elements based on their value, much like {@link HashMultiSet} containers, but allowing + * different elements to have equivalent values. + * + * In an {@link HashMultiSet}, the value of an element is at the same time its *key*, used to identify it. *Keys* + * are immutable, therefore, the elements in an {@link HashMultiSet} cannot be modified once in the container - + * they can be inserted and removed, though. + * + * Internally, the elements in the {@link HashMultiSet} are not sorted in any particular, but organized into + * *buckets* depending on their hash values to allow for fast access to individual elements directly by their + * *values* (with a constant average time complexity on average). + * + * Elements with equivalent values are grouped together in the same bucket and in such a way that an iterator can + * iterate through all of them. Iterators in the container are doubly linked iterators. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Set
+ *
The value of an element is also the *key* used to identify it.
+ * + *
Multiple equivalent keys
+ *
The container can hold multiple elements with equivalent *keys*.
+ *
+ * + * @param Type of the elements. + * Each element in an {@link UnorderedMultiSet} is also identified by this value.. + * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_multiset + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashMultiSetCollection extends std.HashMultiSet implements ICollection { @@ -671,24 +901,65 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashSet} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link extract}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - {@link insert_or_assign} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link extract} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashSet} + * {@link HashSet HashSets} are containers that store unique elements in no particular order, and which allow for + * fast retrieval of individual elements based on their value. + * + * In an {@link HashSet}, the value of an element is at the same time its *key*, that identifies it uniquely. + * Keys are immutable, therefore, the elements in an {@link HashSet} cannot be modified once in the container - + * they can be inserted and removed, though. + * + * Internally, the elements in the {@link HashSet} are not sorted in any particular order, but organized into + * buckets depending on their hash values to allow for fast access to individual elements directly by their + * *values* (with a constant average time complexity on average). + * + * {@link HashSet} containers are faster than {@link TreeSet} containers to access individual elements by their + * *key*, although they are generally less efficient for range iteration through a subset of their elements. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Set
+ *
The value of an element is also the *key* used to identify it.
+ * + *
Unique keys
+ *
No two elements in the container can have equivalent *keys*.
+ *
+ * + * @param Type of the elements. + * Each element in an {@link HashSet} is also uniquely identified by this value. + * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_set + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashSetCollection extends std.HashSet implements ICollection { @@ -754,75 +1025,73 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * An interface for {@link IContainer containers} who can detect element I/O events. * - *

Below are list of methods who are dispatching {@link CollectionEvent}:

- * - *