diff --git a/acc-wizard/acc-wizard.ts.tscparams b/acc-wizard/acc-wizard.ts.tscparams deleted file mode 100644 index 934bc29ef..000000000 --- a/acc-wizard/acc-wizard.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny \ No newline at end of file diff --git a/amplifyjs/amplifyjs.d.ts b/amplifyjs/amplifyjs.d.ts index 961d815c6..3eb8829e4 100644 --- a/amplifyjs/amplifyjs.d.ts +++ b/amplifyjs/amplifyjs.d.ts @@ -179,4 +179,4 @@ interface amplifyStatic { } declare var amplify: amplifyStatic; - +declare module "amplify" { export =amplify; } diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index fc39bf72a..e6eb1a9f2 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -1,23 +1,53 @@ /// angular.module('app', ['ngIdle']) - .config(['$keepaliveProvider', '$idleProvider', - ($keepaliveProvider: ng.idle.IKeepAliveProvider, $idleProvider: ng.idle.IIdleProvider) => { - $idleProvider.activeOn('mousemove keydown DOMMouseScroll mousewheel mousedown'); - $idleProvider.idleDuration(5); - $idleProvider.warningDuration(5); - $idleProvider.keepalive(true) - $idleProvider.autoResume(true); - $keepaliveProvider.interval(10); + .config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider', + (keepaliveProvider: angular.idle.IKeepAliveProvider, idleProvider: angular.idle.IIdleProvider, + titleProvider: angular.idle.ITitleProvider) => { + idleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown'); + idleProvider.idle(5); + idleProvider.timeout(5); + idleProvider.keepalive(true) + idleProvider.autoResume(true); + + const config: ng.IRequestConfig = { + url: "http://google.com", + method: "GET" + }; + + keepaliveProvider.http(config.url); // should accept string and ng.IRequestConfig + keepaliveProvider.http(config); + keepaliveProvider.interval(10); + + titleProvider.enabled(true); }]) - .run(['$keepalive', '$idle', ($keepalive: ng.idle.IKeepAliveService, $idle: ng.idle.IIdleService) => { - $idle.watch(); - - if ($idle.running() || $idle.idling()) { - $idle.unwatch(); + .run(['Keepalive', 'Idle', 'Title', (Keepalive: angular.idle.IKeepAliveService, Idle: angular.idle.IIdleService, + Title: angular.idle.ITitleService) => { + Idle.setTimeout(Idle.getTimeout()); + Idle.setIdle(Idle.getIdle()); + + Idle.watch(); + Idle.interrupt(); + + const expired: boolean = Idle.isExpired(); + + if (Idle.running() || Idle.idling()) { + Idle.unwatch(); } - - $keepalive.start(); - $keepalive.ping(); - $keepalive.stop(); + + Keepalive.start(); + Keepalive.ping(); + Keepalive.stop(); + Keepalive.setInterval(10); + + Title.setEnabled(Title.isEnabled()); + Title.original(Title.original()); + Title.value(Title.value()); + Title.store(false); + Title.store(); + Title.restore(); + Title.idleMessage(Title.idleMessage()); + Title.timedOutMessage(Title.timedOutMessage()); + Title.setAsIdle(120); + Title.setAsTimedOut(); }]); \ No newline at end of file diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index 4e1e98fb5..725beac67 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ng-idle v0.3.5 +// Type definitions for ng-idle v1.1.1 // Project: http://hackedbychinese.github.io/ng-idle/ // Definitions by: mthamil // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -8,7 +8,99 @@ declare module angular.idle { /** - * Used to configure the $keepalive service. + * Used to configure the Title service. + */ + interface ITitleProvider extends IServiceProvider { + + /** + * Enables or disables the Title functionality. + * + * @param enabled Boolean, default is true. + */ + enabled(enabled: boolean): void; + } + + interface ITitleService { + + /** + * Allows the title functionality to be enabled or disabled on the fly. + */ + setEnabled(enabled: boolean): void; + + /** + * Returns whether or not the title functionality has been enabled. + */ + isEnabled(): boolean; + + /** + * Will store val as the "original" title of the document. + * + * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message. + */ + original(val: string): void; + + /** + * Returns the "original" title value that has been previously set. + * + * Tracking the original title is important when restoring the title after displaying, for example, the idle warning message. + */ + original(): string; + + /** + * Changes the actual title of the document. + */ + value(val: string): void; + + /** + * Returns the current document title. + */ + value(): string; + + /** + * If overwrite is false or unspecified, updates the "original" title with the current document title + * if it has not already been stored. If overwrite is true, the current document title is stored regardless. + */ + store(overwrite?: boolean): void; + + /** + * Sets the title to the original value (if it was stored or set previously). + */ + restore(): void; + + /** + * Sets the text to use as the message displayed when the user is idle. + */ + idleMessage(val: string): void; + + /** + * Gets the text to use as the message displayed when the user is idle. + */ + idleMessage(): string; + + /** + * Sets the text to use as the message displayed when the user is timed out. + */ + timedOutMessage(val: string): void; + + /** + * Gets the text to use as the message displayed when the user is timed out. + */ + timedOutMessage(): string; + + /** + * Stores the original title if it hasn't been already, determines the number minutes, seconds, + * and total seconds from countdown, and displays the idleMessage with the aforementioned values interpolated. + */ + setAsIdle(countdown: number): void; + + /** + * Stores the original title if it hasn't been already, and displays the timedOutMessage. + */ + setAsTimedOut(): void; + } + + /** + * Used to configure the Keepalive service. */ interface IKeepAliveProvider extends IServiceProvider { @@ -18,24 +110,24 @@ declare module angular.idle { * You can specify a string, which it will assume to be a URL to a simple GET request. * Otherwise, you can use the same options $http takes. However, cache will always be false. * - * @param value May be string or object, default is null. + * @param value May be string or IRequestConfig, default is null. */ - http(value: any): void; + http(value: string | IRequestConfig): void; /** * This specifies how often the keepalive event is triggered and the * HTTP request is issued. * - * @param seconds Integer, default is 5 minutes. Must be greater than 0. + * @param seconds Integer, default is 10 minutes. Must be greater than 0. */ interval(seconds: number): void; } /** - * $keepalive will use a timeout to periodically wake, broadcast a $keepalive event on the root scope, - * and optionally make an $http request. By default, the $idle service will stop and start $keepalive + * Keepalive will use a timeout to periodically wake, broadcast a Keepalive event on the root scope, + * and optionally make an $http request. By default, the Idle service will stop and start Keepalive * when a user becomes idle or returns from idle, respectively. It is also started automatically when - * $idle.watch() is called. This can be disabled by configuring the $idleProvider. + * Idle.watch() is called. This can be disabled by configuring the IdleProvider. */ interface IKeepAliveService { @@ -53,20 +145,25 @@ declare module angular.idle { * Performs one ping only. */ ping(): void; + + /** + * Changes the interval value at runtime. + * You will need to restart the pinging process by calling start() manually for the changes to be reflected. + */ + setInterval(seconds: number): void; } /** - * Used to configure the $idle service. + * Used to configure the Idle service. */ interface IIdleProvider extends IServiceProvider { - /** * Specifies the DOM events the service will watch to reset the idle timeout. * Multiple events should be separated by a space. * * @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown' */ - activeOn(events: string): void; + interrupt(events: string): void; /** * The idle timeout duration in seconds. After this amount of time passes without the user @@ -75,7 +172,7 @@ declare module angular.idle { * * @param seconds integer, default is 20min */ - idleDuration(seconds: number): void; + idle(seconds: number): void; /** * The amount of time the user has to respond (in seconds) before they have been considered @@ -83,19 +180,20 @@ declare module angular.idle { * * @param seconds integer, default is 30s */ - warningDuration(seconds: number): void; + timeout(seconds: number): void; /** - * When true, user activity will automatically interrupt the warning countdown and reset the - * idle state. If false, you will need to manually call watch() when you want to start - * watching for idleness again. + * When true or idle, user activity will automatically interrupt the warning countdown + * and reset the idle state. If false or off, you will need to manually call watch() + * when you want to start watching for idleness again. If notIdle, user activity will + * only automatically interrupt if the user is not yet idle. * - * @param enabled boolean, default is true + * @param enabled boolean or string, possible values: off/false, idle/true, or notIdle */ - autoResume(enabled: boolean): void; + autoResume(enabled: boolean | string): void; /** - * When true, the $keepalive service is automatically stopped and started as needed. + * When true, the Keepalive service is automatically stopped and started as needed. * * @param enabled boolean, default is true */ @@ -103,13 +201,39 @@ declare module angular.idle { } /** - * $idle, once watch() is called, will start a timeout which if expires, will enter a warning state + * Idle, once watch() is called, will start a timeout which if expires, will enter a warning state * countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the * user has timed out (where your app should log them out or whatever you like). If the user performs * an action that triggers a watched DOM event that bubbles up to document.body, this will reset the * idle/warning state and start the process over again. */ interface IIdleService { + /** + * Gets the current idle value + */ + getIdle(): number; + + /** + * Gets the current timeout value + */ + getTimeout(): number; + + /** + * Updates the idle value (see IdleProvider.idle()) and + * restarts the watch if its running. + */ + setIdle(idle: number): void; + + /** + * Updates the timeout value (see IdleProvider.timeout()) and + * restarts the watch if its running. + */ + setTimeout(timeout: number): void; + + /** + * Whether user has timed out (meaning idleDuration + timeout has passed without any activity) + */ + isExpired(): boolean; /** * Whether or not the watch() has been called and it is watching for idleness. @@ -130,5 +254,10 @@ declare module angular.idle { * Stops watching for idleness, and resets the idle/warning state. */ unwatch(): void; + + /** + * Manually trigger the idle interrupt that normally occurs during user activity. + */ + interrupt(): any; } } diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index 6df5bc63d..e536e3203 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -51,6 +51,16 @@ declare module angular.meteor { * @return This method returns this, which the the reactive context, in order to provide the ability to chain the logic. */ helpers(definitions : { [helperName : string] : () => Mongo.Cursor }): IScope; + + /** + * This method is a wrapper of Tracker.autorun and shares exactly the same API. + * The autorun method is part of the ReactiveContext, and available on every context and $scope. + * The argument of this method is a callback, which will be called each time Autorun will be used. + * The Autorun will stop automatically when when it's context ($scope) is destroyed. + * + * @param runFunc - The function to run. It receives one argument: the Computation object that will be returned. + */ + autorun(runFunc : () => void) : Tracker.Computation; } /** diff --git a/angular-toastr/angular-toastr.d.ts b/angular-toastr/angular-toastr.d.ts index 96e8e78cc..698b88634 100644 --- a/angular-toastr/angular-toastr.d.ts +++ b/angular-toastr/angular-toastr.d.ts @@ -10,27 +10,27 @@ declare module "angular-toastr" { export = _; } -interface IToastBaseConfig { - allowHtml?: boolean; - closeButton?: boolean; - closeHtml?: string; - extendedTimeOut?: number; - messageClass?: string; - onHidden?: Function; - onShown?: Function; - onTap?: Function; - progressBar?: boolean; - tapToDismiss?: boolean; - templates?: { - toast?: string; - progressbar?: string; - }; - timeOut?: number; - titleClass?: string; - toastClass?: string; -} - declare module angular.toastr { + interface IToastBaseConfig { + allowHtml?: boolean; + closeButton?: boolean; + closeHtml?: string; + extendedTimeOut?: number; + messageClass?: string; + onHidden?: Function; + onShown?: Function; + onTap?: Function; + progressBar?: boolean; + tapToDismiss?: boolean; + templates?: { + toast?: string; + progressbar?: string; + }; + timeOut?: number; + titleClass?: string; + toastClass?: string; + } + interface IToastContainerConfig { autoDismiss?: boolean; containerId?: string; diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts index a19d27ade..8ef1ab2e3 100644 --- a/angular-translate/angular-translate-tests.ts +++ b/angular-translate/angular-translate-tests.ts @@ -26,6 +26,7 @@ app.config(($translateProvider: angular.translate.ITranslateProvider) => { $translateProvider.preferredLanguage('en'); $translateProvider.useLoader('customLoader'); + $translateProvider.forceAsyncReload(true); }); interface Scope extends ng.IScope { diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 960012a57..379bd05ec 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -87,6 +87,7 @@ declare module angular.translate { fallbackLanguage(): ITranslateProvider; fallbackLanguage(language: string): ITranslateProvider; fallbackLanguage(languages: string[]): ITranslateProvider; + forceAsyncReload(value: boolean): ITranslateProvider; use(): string; use(key: string): ITranslateProvider; storageKey(): string; diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index 324ec676c..d5a52ff73 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -257,6 +257,7 @@ declare module angular.ui { transitionTo(state: string, params?: {}, options?: IStateOptions): angular.IPromise; transitionTo(state: IState, params?: {}, options?: IStateOptions): angular.IPromise; includes(state: string, params?: {}): boolean; + includes(state: string, params?: {}, options?:any): boolean; is(state:string, params?: {}): boolean; is(state: IState, params?: {}): boolean; href(state: IState, params?: {}, options?: IHrefOptions): string; diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts index da93596ca..228db1e01 100644 --- a/angularjs/angular-component-router.d.ts +++ b/angularjs/angular-component-router.d.ts @@ -36,6 +36,9 @@ declare module angular { * ``` */ interface Instruction { + component: ComponentInstruction; + child: Instruction; + auxInstruction: {[key: string]: Instruction}; urlPath(): string; diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 14ccdbf04..d1197dec1 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1876,6 +1876,7 @@ declare module angular { provider(name: string, provider: IServiceProvider): IServiceProvider; provider(name: string, serviceProviderConstructor: Function): IServiceProvider; service(name: string, constructor: Function): IServiceProvider; + service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; value(name: string, value: any): IServiceProvider; } diff --git a/any-db/any-db.d.ts b/any-db/any-db.d.ts index 04817623a..f14befb20 100644 --- a/any-db/any-db.d.ts +++ b/any-db/any-db.d.ts @@ -50,7 +50,7 @@ declare module "any-db" { /** * Result rows */ - rows: Object[]; + rows: any[]; /** * Result field descriptions */ diff --git a/autobahn/autobahn.d.ts b/autobahn/autobahn.d.ts index 6debcca7c..7d5589dad 100644 --- a/autobahn/autobahn.d.ts +++ b/autobahn/autobahn.d.ts @@ -4,7 +4,6 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// declare module autobahn { @@ -194,7 +193,7 @@ declare module autobahn { type: string; } - type DeferFactory = () => JQueryPromise; + type DeferFactory = () => When.Promise; type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise; diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index f89059463..b482cad48 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -56,6 +56,7 @@ declare module "aws-sdk" { directconnect?: any; dynamodb?: any; ec2?: any; + ecs?: any; elasticache?: any; elasticbeanstalk?: any; elastictranscoder?: any; @@ -147,7 +148,18 @@ declare module "aws-sdk" { export class S3 { constructor(options?: any); - public client: s3.Client; + putObject(params: s3.PutObjectRequest, callback: (err: any, data: any) => void): void; + getObject(params: s3.GetObjectRequest, callback: (err: any, data: any) => void): void; + } + + export class ECS { + constructor(options?: any); + + createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void; + describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void; + describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void; + registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void; + updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void; } export class DynamoDB { @@ -1042,14 +1054,7 @@ declare module "aws-sdk" { } export module s3 { - - export interface Client { - config: ClientConfig; - - putObject(params: PutObjectRequest, callback: (err: any, data: any) => void): void; - getObject(params: GetObjectRequest, callback: (err: any, data: any) => void): void; - } - + export interface PutObjectRequest { ACL?: string; Body?: any; @@ -1091,4 +1096,102 @@ declare module "aws-sdk" { } } + + export module ecs { + export interface CreateServicesParams { + desiredCount: number; + serviceName: string; + taskDefinition: string; + clientToken?: string; + cluster?: string; + deploymentConfiguration?: { + maximumPercent?: number; + minimumHealthyPercent?: number; + }; + loadBalancers?: { + containerName?: string; + containerPort?: number; + loadBalancerName?: string; + }[]; + role?: string; + } + + export interface DescribeServicesParams { + services: string[]; + cluster: string; + } + + export interface DescribeTaskDefinitionParams { + taskDefinition: string; + } + + export interface RegisterTaskDefinitionParams { + containerDefinitions: { + command?: string[], + cpu?: number, + disableNetworking?: boolean, + dnsSearchDomains?: string[], + dnsServers?: string[], + dockerLabels?: any, + dockerSecurityOptions?: string[], + entryPoint?: string[], + environment?: any[], + essential?: boolean, + extraHosts?: { + hostName: string, + ipAddress: string + }[]; + hostname?: string, + image?: string, + links?: string[], + logConfiguration?: { + logDriver: string, + options: any + }[], + memory?: number, + mountPoints?: { + containerPath: string, + readOnly: boolean, + sourceVolume: string + }[]; + name?: string, + portMappings?: { + containerPort?: number, + hostPort?: number, + protocol: string + }[]; + privileged?: boolean, + readonlyRootFilesystem?: boolean, + ulimits?: { + hardLimit: number, + name: string, + softLimit: number + }[]; + user?: string, + volumesFrom?: { + readOnly?: boolean, + sourceContainer?: string + }[], + workingDirectory?: string + }[]; + family: string; + volumes?: { + host: { + sourcePath: string + }, + name: string + }[]; + } + + export interface UpdateServiceParams { + service: string; + cluster?: string; + deploymentConfiguration?: { + maximumPercent: number; + minimumHealthyPercent: number; + }; + desiredCount?: number; + taskDefinition: string; + } + } } diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index 3f692307a..184292c92 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -8,21 +8,64 @@ interface Repository { name: string; } +interface Issue { + id: number; + title: string; +} + +axios.interceptors.request.use(config => { + console.log("Method:" + config.method + " Url:" +config.url); + return config; +}); + +axios.interceptors.response.use(config => { + console.log("Status:" + config.status); + return config; +}); + axios.get("https://api.github.com/repos/mzabriskie/axios") .then(r => console.log(r.config.method)); -axios({ +var getRepoDetails = axios({ url: "https://api.github.com/repos/mzabriskie/axios", method: HttpMethod[HttpMethod.GET], headers: {}, -}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name)); +}).then(r => { + console.log("ID:" + r.data.id + " Name: " + r.data.name); + return r; +}); axios.post("http://example.com/", {}, { transformRequest: (data: any) => data }); -axios.post("http://example.com/", {}, { +axios.post("http://example.com/", { + headers: {'X-Custom-Header': 'foobar'} +}, { transformRequest: [ (data: any) => data ] }); + +var getRepoIssue = axios.get("https://api.github.com/repos/mzabriskie/axios/issues/1"); + +var axiosInstance = axios.create({ + baseURL: "https://api.github.com/repos/mzabriskie/axios/", + timeout: 1000 +}); + +axiosInstance.request({url: "issues/1"}); + +axios.all([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => { + var sumIds = repo1.data.id + repo2.data.id; + console.log("Sum ID:" + sumIds); + return sumIds; +}); + +var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR) => { + var sumIds = repo1.data.id + repo2.data.id; + console.log("Sum ID:" + sumIds); + return sumIds; +}; + +axios.all([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum)); diff --git a/axios/axios.d.ts b/axios/axios.d.ts index 48f57a73a..7348ec651 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -1,162 +1,276 @@ -// Type definitions for axios 0.5.2 +// Type definitions for axios 0.8.1 // Project: https://github.com/mzabriskie/axios // Definitions by: Marcel Buesing // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// - declare module Axios { - /** - * - request body data type - */ - interface AxiosXHRConfigBase { + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } + + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; + } /** - * Change the request data before it is sent to the server. - * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' - * The last function in the array must return a string or an ArrayBuffer + * HTTP Basic auth details */ - transformRequest?: ((data:T) => U)|[(data:T) => U]; + interface AxiosHttpBasicAuth { + username: string; + password: string; + } /** - * change the response data to be made before it is passed to then/catch + * Common axios XHR config interface + * - request body data type */ - transformResponse?: (data:T) => U; + interface AxiosXHRConfigBase { + /** + * will be prepended to `url` unless `url` is absolute. + * It can be convenient to set `baseURL` for an instance + * of axios to pass relative URLs to methods of that instance. + */ + baseURL?: string; + + /** + * custom headers to be sent + */ + headers?: Object; + + /** + * URL parameters to be sent with the request + */ + params?: Object; + + /** + * optional function in charge of serializing `params` + * (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/) + */ + paramsSerializer?: (params: Object) => string; + + /** + * specifies the number of milliseconds before the request times out. + * If the request takes longer than `timeout`, the request will be aborted. + */ + timeout?: number; + + /** + * indicates whether or not cross-site Access-Control requests + * should be made using credentials + */ + withCredentials?: boolean; + + /** + * indicates that HTTP Basic auth should be used, and supplies + * credentials. This will set an `Authorization` header, + * overwriting any existing `Authorization` custom headers you have + * set using `headers`. + */ + auth?: AxiosHttpBasicAuth; + + /** + * indicates the type of data that the server will respond with + * options are 'arraybuffer', 'blob', 'document', 'json', 'text' + */ + responseType?: string; + + /** + * name of the cookie to use as a value for xsrf token + */ + xsrfCookieName?: string; + + /** + * name of the http header that carries the xsrf token value + */ + xsrfHeaderName?: string; + + /** + * Change the request data before it is sent to the server. + * This is only applicable for request methods 'PUT', 'POST', and 'PATCH' + * The last function in the array must return a string or an ArrayBuffer + */ + transformRequest?: ((data: T) => U) | [(data: T) => U]; + + /** + * change the response data to be made before it is passed to then/catch + */ + transformResponse?: (data: T) => U; + } /** - * custom headers to be sent + * - request body data type */ - headers?: Object; + interface AxiosXHRConfig extends AxiosXHRConfigBase { + /** + * server URL that will be used for the request, options are: + * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH + */ + url: string; + + /** + * request method to be used when making the request + */ + method?: string; + + /** + * data to be sent as the request body + * Only applicable for request methods 'PUT', 'POST', and 'PATCH' + * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash + */ + data?: T; + } /** - * URL parameters to be sent with the request + * - expected response type, + * - request body data type */ - params?: Object; + interface AxiosXHR { + /** + * Response that was provided by the server + */ + data: T; + + /** + * HTTP status code from the server response + */ + status: number; + + /** + * HTTP status message from the server response + */ + statusText: string; + + /** + * headers that the server responded with + */ + headers: Object; + + /** + * config that was provided to `axios` for the request + */ + config: AxiosXHRConfig; + } + + interface Interceptor { + /** + * intercept request before it is sent + */ + request: RequestInterceptor; + + /** + * intercept response of request when it is received. + */ + response: ResponseInterceptor + } + + interface RequestInterceptor { + /** + * - request body data type + */ + use(fn: (config: AxiosXHRConfig) => AxiosXHRConfig): void; + } + + interface ResponseInterceptor { + /** + * - expected response type + */ + use(fn: (config: AxiosXHR) => AxiosXHR): void; + } /** - * indicates whether or not cross-site Access-Control requests - * should be made using credentials + * - expected response type, + * - request body data type */ - withCredentials?: boolean; + interface AxiosInstance { + + /** + * Send request as configured + */ + (config: AxiosXHRConfig): IPromise>; + + /** + * Send request as configured + */ + new (config: AxiosXHRConfig): IPromise>; + + /** + * Send request as configured + */ + request(config: AxiosXHRConfig): IPromise>; + + /** + * intercept requests or responses before they are handled by then or catch + */ + interceptors: Interceptor; + + /** + * equivalent to `Promise.all` + */ + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>, T10 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>, T9 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>, T8 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>, T7 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>, T6 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>, T5 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>, T4 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>, T3 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR, AxiosXHR]>; + all(values: [T1 | IPromise>, T2 | IPromise>]): IPromise<[AxiosXHR, AxiosXHR]>; + + /** + * spread array parameter to `fn`. + * note: alternative to `spread`, destructuring assignment. + */ + spread(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U; + + /** + * convenience alias, method = GET + */ + get(url: string, config?: AxiosXHRConfigBase): IPromise>; + + + /** + * convenience alias, method = DELETE + */ + delete(url: string, config?: AxiosXHRConfigBase): IPromise>; + + /** + * convenience alias, method = HEAD + */ + head(url: string, config?: AxiosXHRConfigBase): IPromise>; + + /** + * convenience alias, method = POST + */ + post(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; + + /** + * convenience alias, method = PUT + */ + put(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; + + /** + * convenience alias, method = PATCH + */ + patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; + } /** - * indicates the type of data that the server will respond with - * options are 'arraybuffer', 'blob', 'document', 'json', 'text' + * - expected response type, */ - responseType?: string; - - /** - * name of the cookie to use as a value for xsrf token - */ - xsrfCookieName?: string; - - /** - * name of the http header that carries the xsrf token value - */ - xsrfHeaderName?: string; - - } - - /** - * - request body data type - */ - interface AxiosXHRConfig extends AxiosXHRConfigBase { - /** - * server URL that will be used for the request, options are: - * GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH - */ - url: string; - - /** - * request method to be used when making the request - */ - method?: string; - - /** - * data to be sent as the request body - * Only applicable for request methods 'PUT', 'POST', and 'PATCH' - * When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash - */ - data?: T; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosXHR { - /** - * Response that was provided by the server - */ - data: T; - - /** - * HTTP status code from the server response - */ - status: number; - - /** - * HTTP status message from the server response - */ - statusText: string; - - /** - * headers that the server responded with - */ - headers: Object; - - /** - * config that was provided to `axios` for the request - */ - config: AxiosXHRConfig; - } - - /** - * - expected response type, - * - request body data type - */ - interface AxiosStatic { - - (config: AxiosXHRConfig): Promise>; - - new (config: AxiosXHRConfig): Promise>; - - /** - * convenience alias, method = GET - */ - get(url: string, config?: AxiosXHRConfigBase): Promise>; - - - /** - * convenience alias, method = DELETE - */ - delete(url: string, config?: AxiosXHRConfigBase): Promise>; - - /** - * convenience alias, method = HEAD - */ - head(url: string, config?: AxiosXHRConfigBase): Promise>; - - /** - * convenience alias, method = POST - */ - post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; - - /** - * convenience alias, method = PUT - */ - put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; - - /** - * convenience alias, method = PATCH - */ - patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; - } + interface AxiosStatic extends AxiosInstance { + /** + * create a new instance of axios with a custom config + */ + create(config: AxiosXHRConfigBase): AxiosInstance; + } } declare var axios: Axios.AxiosStatic; declare module "axios" { - export = axios; + export = axios; } diff --git a/azure-mobile-apps/azure-mobile-apps-tests.ts b/azure-mobile-apps/azure-mobile-apps-tests.ts new file mode 100644 index 000000000..093932c2f --- /dev/null +++ b/azure-mobile-apps/azure-mobile-apps-tests.ts @@ -0,0 +1,87 @@ +/// + +import express = require('express'); +import mobileApps = require('azure-mobile-apps'); +import logger = require('azure-mobile-apps/src/logger'); +import queries = require('azure-mobile-apps/src/query'); + +var app = express(), + mobileApp = mobileApps(); + +// various configuration permutations +mobileApps({ + debug: true, + data: { + provider: 'mssql', + server: '', + user: '', + database: '', + password: '' + } +}); + +mobileApps({ + data: { + provider: 'memory' + } +}) + +// it would be nice to integrate with winston +mobileApps({ logging: { level: 'silly', transports: [{}] } }) + +// various custom middleware syntaxes +mobileApp.use(function (req: any, res: any, next: any) { next(); }); +mobileApp.use([function () {}, function () {}]); +mobileApp.use(function () {}, function () {}); +mobileApp.use(function () {}).use(function () {}); + +// basic syntax for tables and api +mobileApp.tables.add('todoitem'); +mobileApp.tables.add('todoitem', { authorize: true }); +mobileApp.tables.add('todoitem', mobileApps.table()); +mobileApp.tables.import('tables'); +mobileApp.api.add('api', { authorize: true, get: function () {}, delete: function () {} }); +mobileApp.api.import('api'); + +// Express.Table, instantiated from the mobile app +var table = mobileApp.table() +table.use(function (req: Express.Request, res: Express.Response, next: any) { + next(new Error()); +}); +table.use([function () {}, function () {}]); +table.read(function (context: Azure.MobileApps.Context) { + context.query.where({ p1: 'test' }); + return context.execute() + .then(function (result: any) { + return result; + }) + .catch(function (error: any) { }) + .then(function () {}); +}); +table.insert(function (context: Azure.MobileApps.Context) { + context.query.id = 'anotherId'; + context.query.single = true; + context.item.userId = context.user.id; + context.push.send('tag', {}, function (error, result) {}); + context.push.gcm.send('tag', {}, function (error, result) {}); + context.push.apns.send('tag', { payload: { } }, function (error, result) {}); + context.push.wns.sendToastText01('tag', '', { headers: { } }, function (error, result) {}); +}); +table.read.use(function () {}); +table.read.use([function () {}, function () {}]); +table.read.use(function () {}, function () {}); +table.use(function () {}).use(function () {}).read(function () {}).use(function () {}) + +// Express.Table, instantiated from the static require('azure-mobile-apps').table() +// This is going to be interesting if we ever support more than one provider +var table2 = mobileApps.table(); +table2.read(function (context: Azure.MobileApps.Context) {}) + +// Logger +logger.silly('test', 'message'); +logger.error('Something happened', new Error()); +mobileApps.logger.debug('a debug message') + +// Query +queries.create('table').where({ x: 10 }).select('col1,col2'); +mobileApps.query.create('table'); \ No newline at end of file diff --git a/azure-mobile-apps/azure-mobile-apps.d.ts b/azure-mobile-apps/azure-mobile-apps.d.ts new file mode 100644 index 000000000..5441515fe --- /dev/null +++ b/azure-mobile-apps/azure-mobile-apps.d.ts @@ -0,0 +1,279 @@ +// Type definitions for azure-mobile-apps v2.0.0-beta3 +// Project: https://github.com/Azure/azure-mobile-apps-node/ +// Definitions by: Microsoft Azure +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "azure-mobile-apps" { + interface AzureMobileApps { + (configuration?: Azure.MobileApps.Configuration): Azure.MobileApps.Platforms.Express.MobileApp; + table(): Azure.MobileApps.Platforms.Express.Table; + logger: Azure.MobileApps.Logger; + query: Azure.MobileApps.Query; + } + + var out: AzureMobileApps; + export = out; +} +declare module "azure-mobile-apps/src/logger" { + var logger: Azure.MobileApps.Logger; + export = logger; +} + +declare module "azure-mobile-apps/src/query" { + var query: Azure.MobileApps.Query; + export = query; +} + +declare module Azure.MobileApps { + // the additional Platforms namespace is required to avoid collisions with the main Express namespace + export module Platforms { + export module Express { + interface MobileApp { + configuration: Configuration; + tables: Tables; + table(): Table; + api: Api; + use(...middleware: Middleware[]): MobileApp; + use(middleware: Middleware[]): MobileApp; + } + + interface Api { + add(name: string, definition: ApiDefinition): void; + import(fileOrFolder: string): void; + } + + interface Table { + authorize?: boolean; + autoIncrement?: boolean; + dynamicSchema?: boolean; + name: string; + columns?: any; + schema: string; + + use(...middleware: Middleware[]): Table; + use(middleware: Middleware[]): Table; + read: TableOperation; + update: TableOperation; + insert: TableOperation; + delete: TableOperation; + undelete: TableOperation; + } + + interface TableOperation { + (operationHandler: (context: Context) => void): Table; + use(...middleware: Middleware[]): Table; + use(middleware: Middleware[]): Table; + } + + interface Tables { + configuration: Configuration; + add(name: string, definition?: Table | TableDefinition): void; + import(fileOrFolder: string): void; + initialize(): Thenable; + } + } + } + + export module Data { + interface Table { + read(query: QueryJs): Thenable; + update(item: any, query: QueryJs): Thenable; + insert(item: any): Thenable; + delete(query: QueryJs, version: string): Thenable; + undelete(query: QueryJs, version: string): Thenable; + truncate(): Thenable; + initialize(): Thenable; + schema(): Thenable; + } + + interface Column { + name: string; + type: string; + } + } + + // auth + interface User { + id: string; + claims: any[]; + token: string; + getIdentity(provider: string): Thenable; + } + + interface Auth { + validate(token: string): Thenable; + decode(token: string): User; + sign(payload: any): string; + } + + // configuration + interface Configuration { + platform?: string; + basePath?: string; + configFile?: string; + promiseConstructor?: (resolve: (result: any) => void, reject: (error: any) => void) => Thenable; + apiRootPath?: string; + tableRootPath?: string; + notificationRootPath?: string; + swaggerPath?: string; + authStubRoute?: string; + debug?: boolean; + version?: string; + apiVersion?: string; + homePage?: boolean; + swagger?: boolean; + maxTop?: number; + pageSize?: number; + logging?: Configuration.Logging; + data?: Configuration.Data; + auth?: Configuration.Auth; + cors?: Configuration.Cors; + notifications?: Configuration.Notifications; + } + + export module Configuration { + // it would be nice to have the config for various providers in separate interfaces, + // but this is the simplest solution to support variations of the current setup + interface Data { + provider: string; + user?: string; + password?: string; + server?: string; + port?: number; + database?: string; + connectionTimeout?: string; + options?: { encrypt: boolean }; + schema?: string; + dynamicSchema?: boolean; + } + + interface Auth { + secret: string; + validateTokens?: boolean; + } + + interface Logging { + level?: string; + transports?: LoggingTransport[]; + } + + interface LoggingTransport { } + + interface Cors { + maxAge?: number; + origins: string[]; + } + + interface Notifications { + hubName: string; + connectionString?: string; + endpoint?: string; + sharedAccessKeyName?: string; + sharedAccessKeyValue?: string; + } + } + + // query + interface Query { + create(tableName: string): QueryJs; + fromRequest(req: Express.Request): QueryJs; + toOData(query: QueryJs): OData; + } + + interface QueryJs { + includeTotalCount?: boolean; + orderBy(properties: string): QueryJs; + orderByDescending(properties: string): QueryJs; + select(properties: string): QueryJs; + skip(count: number): QueryJs; + take(count: number): QueryJs; + where(filter: any): QueryJs; + // these are properties added by the SDK + id?: string | number; + single?: boolean; + } + + interface OData { + table: string; + filters?: string; + ordering?: string; + orderClauses?: string; + skip?: number; + take?: number; + selections?: string; + includeTotalCount?: boolean; + } + + // general + var nh: Azure.ServiceBus.NotificationHubService; + interface Context { + query: QueryJs; + id: string | number; + item: any; + req: Express.Request; + res: Express.Response; + data: (table: TableDefinition) => Data.Table; + tables: (tableName: string) => Data.Table; + user: User; + push: typeof nh; + logger: Logger; + execute(): Thenable; + } + + interface TableDefinition { + authorize?: boolean; + autoIncrement?: boolean; + dynamicSchema?: boolean; + name?: string; + columns?: any; + schema?: string; + } + + interface ApiDefinition { + authorize?: boolean; + get?: Middleware | Middleware[]; + post?: Middleware | Middleware[]; + patch?: Middleware | Middleware[]; + put?: Middleware | Middleware[]; + delete?: Middleware | Middleware[]; + } + + interface Thenable { + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; + catch(onRejected?: (error: any) => U | Thenable): Thenable; + catch(onRejected?: (error: any) => void): Thenable; + } + + interface Logger { + log(level: string, ...message: any[]): void; + silly(...message: any[]): void; + debug(...message: any[]): void; + verbose(...message: any[]): void; + info(...message: any[]): void; + warn(...message: any[]): void; + error(...message: any[]): void; + } + + interface Middleware { + (req: Express.Request, res: Express.Response, next: NextMiddleware): void; + } + + interface NextMiddleware { + (error?: any): void; + } +} + +// additions to the Express modules +declare module Express { + interface Request { + azureMobile: Azure.MobileApps.Context + } + + interface Response { + results?: any; + } +} \ No newline at end of file diff --git a/azure-sb/azure-sb-tests.ts b/azure-sb/azure-sb-tests.ts new file mode 100644 index 000000000..508685181 --- /dev/null +++ b/azure-sb/azure-sb-tests.ts @@ -0,0 +1,16 @@ +/// + +var nh = new Azure.ServiceBus.NotificationHubService(); +nh.send('tag', '', function (error, result) {}); +nh.send('tag', '', { headers: {} }, function (error, result) {}); + +nh.apns.send('tag', { payload: { } }, function (error, result) {}); +nh.apns.send(['tag'], { payload: { } }, function (error, result) {}); +nh.gcm.send('tag', { }, function (error, result) {}); +nh.gcm.send(['tag'], { }, function (error, result) {}); +nh.wns.send('tag', '', 'wns/toast', function (error, result) {}); +nh.wns.send(['tag'], '', 'wns/toast', function (error, result) {}); +nh.wns.send('tag', '', 'wns/toast', { headers: {} }, function (error, result) {}); +nh.wns.sendToastText01('tag', '', function (error, result) {}); +nh.wns.sendToastText01(['tag'], '', function (error, result) {}); +nh.wns.sendToastText01('tag', '', { headers: {} }, function (error, result) {}); \ No newline at end of file diff --git a/azure-sb/azure-sb.d.ts b/azure-sb/azure-sb.d.ts new file mode 100644 index 000000000..afa4074a9 --- /dev/null +++ b/azure-sb/azure-sb.d.ts @@ -0,0 +1,173 @@ +// Type definitions for azure-sb +// Project: https://github.com/Azure/azure-sdk-for-node/tree/master/lib/services/serviceBus +// Definitions by: Microsoft Azure +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module Azure.ServiceBus { + interface Callback { + (error: any, response: any): void; + } + + interface NotificationHubRegistration { + RegistrationId: string; + ChannelUri?: string; + DeviceToken?: string; + gcmRegistrationId?: string; + Tags?: string; + BodyTemplate?: any; + WnsHeaders?: any; + MpnsHeaders?: any; + Expiry?: Date; + } + + export class NotificationHubService { + new(hubName: string, endpointOrConnectionString: string, sharedAccessKeyName?: string, sharedAccessKeyValue?: string): NotificationHubService; + hubName: string; + wns: Wns.Service; + apns: Apns.Service; + gcm: Gcm.Service; + mpns: Mpns.Service; + send(tags: string, payload: Object | string, optionsOrCallback?: { headers: Object } | Callback, callback?: Callback): void; + + createOrUpdateInstallation(installation: string, options: any, callback?: Callback): void; + patchInstallation(installationId: string, partialUpdateOperations: any[], options: any, callback?: Callback): void; + deleteInstallation(installationId: string, options: any, callback?: Callback): void; + getInstallation(installationId: string, options: any, callback?: Callback): void; + + /* + // old school? + createRegistrationId(callback?: Callback): void; + getRegistration(registrationId: string, options: any, callback?: Callback): void; + deleteRegistration(registrationId: string, options?: { etag: any }, callback?: Callback): void; + updateRegistration(registration: NotificationHubRegistration, options?: { etag: any }, callback?: Callback): void; + createOrUpdateRegistration(registration: NotificationHubRegistration, options?: { etag: any }, callback?: Callback): void; + listRegistrations(options?: { top: number, skip: number }, callback?: Callback): void; + listRegistrationsByTag(tag: string, options?: { top: number, skip: number }, callback?: Callback): void; + */ + } + + export module Apns { + interface Payload { + expiry?: Date; + aps?: Object; + badge?: number; + alert?: string; + sound?: string; + payload: Object; + } + + interface Service { + new(service: NotificationHubService): Service; + send(tags: string | string[], payload: Apns.Payload, callback?: Callback): void; + createNativeRegistration(token: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; + createOrUpdateNativeRegistration(registrationId: string, token: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; + createTemplateRegistration(token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void; + createOrUpdateTemplateRegistration(registrationId: string, token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void; + updateTemplateRegistration(registrationId: string, token: string, tags: string | string[], template: Apns.Payload, optionsOrCallback?: Object | Callback, callback?: Callback): void; + listRegistrationsByToken(token: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void; + } + } + export module Gcm { + interface Service { + new(service: NotificationHubService): Service; + send(tags: string | string[], payload: any, callback?: Callback): void; + createNativeRegistration(gcmRegistrationId: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; + createOrUpdateNativeRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], optionsOrCallback?: Object | Callback, callback?: Callback): void; + createTemplateRegistration(gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void; + createOrUpdateTemplateRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void; + updateTemplateRegistration(registrationId: string, gcmRegistrationId: string, tags: string | string[], template: any, optionsOrCallback?: Object | Callback, callback?: Callback): void; + listRegistrationsByGcmRegistrationId(gcmRegistrationId: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void; + } + } + + export module Mpns { interface Service { } } + + export module Wns { + interface Payload { + text1?: string; + text2?: string; + text3?: string; + text4?: string; + image1src?: string; + image1alt?: string; + image2src?: string; + image2alt?: string; + image3src?: string; + image3alt?: string; + image4src?: string; + image4alt?: string; + lang?: string; + type?: string; + } + + interface Options { + headers: Object; + } + + interface Service { + new(service: NotificationHubService): Service; + sendTileSquareBlock(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquareText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquareText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquareText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquareText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText07(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText08(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText09(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText10(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideText11(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquareImage(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquarePeekImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquarePeekImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquarePeekImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileSquarePeekImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideImage(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideImageCollection(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideBlockAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideBlockAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideSmallImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideSmallImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideSmallImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideSmallImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWideSmallImageAndText05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageCollection01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageCollection02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageCollection03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageCollection04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageCollection05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageCollection06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImage01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImage02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImage03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImage04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImage05(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendTileWidePeekImage06(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastImageAndText01(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastImageAndText02(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastImageAndText03(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendToastImageAndText04(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + // badges = ['none','activity','alert','available','away','busy','newMessage','paused','playing','unavailable','error', 'attention'] + sendBadge(tags: string | string[], value: string | number, optionsOrCallback?: Options | Callback, callback?: Callback): void; + sendRaw(tags: string | string[], payload: any, optionsOrCallback?: Options | Callback, callback?: Callback): void; + // types = ['wns/toast', 'wns/badge', 'wns/tile', 'wns/raw'] + send(tags: string | string[], payload: string, type: string, optionsOrCallback?: Options | Callback, callback?: Callback): void; + createNativeRegistration(channel: string, tags: string | string[], optionsOrCallback?: Options | Callback, callback?: Callback): void; + createOrUpdateNativeRegistration(registrationId: string, channel: string, tags: string | string[], optionsOrCallback?: Options | Callback, callback?: Callback): void; + listRegistrationsByChannel(channel: string, optionsOrCallback?: { top: number, skip: number } | Callback, callback?: Callback): void; + } + } +} \ No newline at end of file diff --git a/backbone/backbone-with-lodash-tests.ts b/backbone/backbone-with-lodash-tests.ts index c4f5fdf4d..dc7ebd2de 100644 --- a/backbone/backbone-with-lodash-tests.ts +++ b/backbone/backbone-with-lodash-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// /// function test_events() { diff --git a/base-x/base-x-tests.ts b/base-x/base-x-tests.ts new file mode 100644 index 000000000..3e082c45b --- /dev/null +++ b/base-x/base-x-tests.ts @@ -0,0 +1,14 @@ +/// + +import * as basex from 'base-x'; + +let bs16: BaseX.BaseConverter = basex('0123456789ABCDEF'); + +{ + let encoded: string; + + encoded = bs16.encode([255]); + encoded = bs16.encode({0: 255, length: 1}); +} + +let decoded: number[] = bs16.decode('FF'); diff --git a/base-x/base-x.d.ts b/base-x/base-x.d.ts new file mode 100644 index 000000000..681a05806 --- /dev/null +++ b/base-x/base-x.d.ts @@ -0,0 +1,28 @@ +// Type definitions for base-x v1.0.1 +// Project: https://github.com/cryptocoinjs/base-x +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace BaseX { + interface EncodeBuffer { + [index: number]: number; + length: number; + } + + interface BaseConverter { + encode: (buffer: EncodeBuffer) => string; + decode: (string: string) => number[]; + } + + interface Base { + (ALPHABET: string): BaseX.BaseConverter + } +} + +declare module "base-x" { + namespace base {} + + let base: BaseX.Base; + + export = base; +} diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index b1829c52e..00f6e951f 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -754,8 +754,8 @@ Promise.longStackTraces(); //TODO enable delay -fooProm = Promise.delay(fooThen, num); -fooProm = Promise.delay(foo, num); +fooProm = Promise.delay(num, fooThen); +fooProm = Promise.delay(num, foo); voidProm = Promise.delay(num); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 023eab7aa..2dfdcf854 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -106,8 +106,8 @@ interface PromiseConstructor { * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. */ // TODO enable more overloads - delay(value: PromiseLike, ms: number): Promise; - delay(value: T, ms: number): Promise; + delay(ms: number, value: PromiseLike): Promise; + delay(ms: number, value: T): Promise; delay(ms: number): Promise; /** diff --git a/body-parser/body-parser.d.ts b/body-parser/body-parser.d.ts index bf318d946..b7b4e7599 100644 --- a/body-parser/body-parser.d.ts +++ b/body-parser/body-parser.d.ts @@ -110,7 +110,7 @@ declare module "body-parser" { defaultCharset?: string; }): express.RequestHandler; - export function urlencoded(options?: { + export function urlencoded(options: { /** * if deflated bodies will be inflated. (default: true) */ @@ -128,11 +128,11 @@ declare module "body-parser" { */ verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void; /** - * parse extended syntax with the qs module. (default: true) + * parse extended syntax with the qs module. */ - extended?: boolean; + extended: boolean; }): express.RequestHandler; } export = bodyParser; -} \ No newline at end of file +} diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index e0278df26..5d91927db 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// +/// /// declare module 'bookshelf' { @@ -18,6 +18,7 @@ declare module 'bookshelf' { Model : typeof Bookshelf.Model; Collection : typeof Bookshelf.Collection; + plugin(name: string) : Bookshelf; transaction(callback : (transaction : knex.Transaction) => T) : Promise; } diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts index bd8a3ff54..8affae9a7 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -56,6 +56,7 @@ declare module BootstrapV3DatetimePicker { inline?: boolean; toolbarPlacement?: string; showClear?: boolean; + ignoreReadonly?: boolean; } interface Datetimepicker { diff --git a/brorand/brorand-tests.ts b/brorand/brorand-tests.ts new file mode 100644 index 000000000..1adb7b114 --- /dev/null +++ b/brorand/brorand-tests.ts @@ -0,0 +1,13 @@ +/// + +import * as brorand from 'brorand'; + +{ + let result: Buffer|Uint8Array = brorand(42); +} + +{ + let Rand = new brorand.Rand({getByte: () => 255}); + let rand: {getByte: () => number} = Rand.rand; + let result: Buffer|Uint8Array = Rand.generate(42); +} diff --git a/brorand/brorand.d.ts b/brorand/brorand.d.ts new file mode 100644 index 000000000..aa0e6ff5d --- /dev/null +++ b/brorand/brorand.d.ts @@ -0,0 +1,30 @@ +// Type definitions for Brorand v1.0.5 +// Project: https://github.com/indutny/brorand +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "brorand" { + type rand = {getByte: () => number}; + + interface RandStatic { + new (rand: rand): RandInstance; + } + + interface RandInstance { + rand: rand; + generate(len: number): Buffer|Uint8Array; + } + + interface BrorandStatic { + (len: number): Buffer|Uint8Array; + Rand: RandStatic; + } + + namespace Brorand {} + + let Brorand: BrorandStatic; + + export = Brorand; +} diff --git a/bs58/bs58-tests.ts b/bs58/bs58-tests.ts new file mode 100644 index 000000000..801646926 --- /dev/null +++ b/bs58/bs58-tests.ts @@ -0,0 +1,12 @@ +/// + +import * as bs58 from 'bs58'; + +{ + let encoded: string; + + encoded = bs58.encode([255]); + encoded = bs58.encode({0: 255, length: 1}); +} + +let decoded: number[] = bs58.decode('5Q'); diff --git a/bs58/bs58.d.ts b/bs58/bs58.d.ts new file mode 100644 index 000000000..02b1cd318 --- /dev/null +++ b/bs58/bs58.d.ts @@ -0,0 +1,14 @@ +// Type definitions for bs58 3.0.0 +// Project: https://github.com/cryptocoinjs/bs58 +// Definitions by: Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "bs58" { + namespace base58 {} + + let base58: BaseX.BaseConverter; + + export = base58; +} diff --git a/bson/bson-tests.ts b/bson/bson-tests.ts new file mode 100644 index 000000000..a454ed236 --- /dev/null +++ b/bson/bson-tests.ts @@ -0,0 +1,23 @@ +/// + +import * as bson from 'bson'; + +let BSON = new bson.BSONPure.BSON(); +let Long = bson.BSONPure.Long; + +let doc = {long: Long.fromNumber(100)} + +// Serialize a document +let data = BSON.serialize(doc, false, true, false); +console.log("data:", data); + +// Deserialize the resulting Buffer +let doc_2 = BSON.deserialize(data); +console.log("doc_2:", doc_2); + + +BSON = new bson.BSONNative.BSON(); +data = BSON.serialize(doc); +doc_2 = BSON.deserialize(data); + + diff --git a/bson/bson.d.ts b/bson/bson.d.ts new file mode 100644 index 000000000..e92801835 --- /dev/null +++ b/bson/bson.d.ts @@ -0,0 +1,133 @@ +// Type definitions for bson 0.4.21 +// Project: https://github.com/mongodb/js-bson +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +declare module 'bson' { + + module bson { + + export module BSONPure { + + export interface DeserializeOptions { + /** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. */ + evalFunctions?: boolean; + /** {Boolean, default:false}, cache evaluated functions for reuse. */ + cacheFunctions?: boolean; + /** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. */ + cacheFunctionsCrc32?: boolean; + /** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. */ + promoteBuffers?: boolean; + } + export class BSON { + /** + * @param {Object} object the Javascript object to serialize. + * @param {Boolean} checkKeys the serializer will check if keys are valid. + * @param {Boolean} asBuffer return the serialized object as a Buffer object (ignore). + * @param {Boolean} serializeFunctions serialize the javascript functions (default:false) + * @return {Buffer} returns a TypedArray or Array depending on what your browser supports + */ + serialize(object: any, checkKeys?: boolean, asBuffer?: boolean, serializeFunctions?: boolean): Buffer; + deserialize(buffer: Buffer, options?: DeserializeOptions, isArray?: boolean): any; + } + + + export interface Binary {} + export interface BinaryStatic { + SUBTYPE_DEFAULT: number; + SUBTYPE_FUNCTION: number; + SUBTYPE_BYTE_ARRAY: number; + SUBTYPE_UUID_OLD: number; + SUBTYPE_UUID: number; + SUBTYPE_MD5: number; + SUBTYPE_USER_DEFINED: number; + + new (buffer: Buffer, subType?: number): Binary; + } + export let Binary: BinaryStatic; + + export interface Code {} + export interface CodeStatic { + new (code: string | Function, scope?: any): Code; + } + export let Code: CodeStatic; + + export interface DBRef {} + export interface DBRefStatic { + new (namespace: string, oid: ObjectID, db?: string): DBRef; + } + export let DBRef: DBRefStatic; + + export interface Double {} + export interface DoubleStatic { + new (value: number): Double; + } + export let Double: DoubleStatic; + + export interface Long {} + export interface LongStatic { + new (low: number, high: number): Long; + fromInt(i: number): Long; + fromNumber(n: number): Long; + fromBits(lowBits: number, highBits: number): Long; + fromString(s: string, opt_radix?: number): Long; + } + export let Long: LongStatic; + + export interface MaxKey {} + export interface MaxKeyStatic { + new (): MaxKey; + } + export let MaxKey: MaxKeyStatic; + + export interface MinKey {} + export interface MinKeyStatic { + new (): MinKey; + } + export let MinKey: MinKeyStatic; + + export interface ObjectID {} + export interface ObjectIDStatic { + new (id?: number | string | ObjectID): ObjectID; + createPk(): ObjectID; + createFromTime(time: number): ObjectID; + createFromHexString(hexString: string): ObjectID; + isValid(id: number | string | ObjectID): boolean; + } + export let ObjectID: ObjectIDStatic; + export let ObjectId: ObjectIDStatic; + + export interface BSONRegExp {} + export interface BSONRegExpStatic { + new (pattern: string, options: string): BSONRegExp; + } + export let BSONRegExp: BSONRegExpStatic; + + export interface Symbol {} + export interface SymbolStatic { + new (value: string): Symbol; + } + export let Symbol: SymbolStatic; + + export interface Timestamp {} + export interface TimestampStatic { + new (low: number, high: number): Timestamp; + fromInt(i: number): Timestamp; + fromNumber(n: number): Timestamp; + fromBits(lowBits: number, highBits: number): Timestamp; + fromString(s: string, opt_radix?: number): Timestamp; + } + export let Timestamp: TimestampStatic; + + } + + export let BSONNative: typeof BSONPure; + + } + + export = bson; +} + diff --git a/calq/calq.d.ts b/calq/calq.d.ts index c574df58f..331b89720 100644 --- a/calq/calq.d.ts +++ b/calq/calq.d.ts @@ -19,7 +19,9 @@ declare module Calq trackSale(action:string, params:{[index:string]:any}, currency:string, amount:number):void; trackHTMLLink(action:string, params?:{[index:string]:any}):void; trackPageView(action?:string):void; - setGlobalProperty(name:string,value:any):void; + + setGlobalProperty(name:string, value:any):void; + setGlobalProperty(params: {[index:string]: any}):void; } interface User diff --git a/camelcase/camelcase-tests.ts b/camelcase/camelcase-tests.ts new file mode 100644 index 000000000..bb2ce9282 --- /dev/null +++ b/camelcase/camelcase-tests.ts @@ -0,0 +1,12 @@ +/// + +import camelCase from 'camelcase'; + +camelCase('foo-bar'); +camelCase('foo_bar'); +camelCase('Foo-Bar'); +camelCase('--foo.bar'); +camelCase('__foo__bar__'); +camelCase('foo bar'); +camelCase('foo', 'bar'); +camelCase('__foo__', '--bar'); diff --git a/camelcase/camelcase.d.ts b/camelcase/camelcase.d.ts new file mode 100644 index 000000000..c13eab8a5 --- /dev/null +++ b/camelcase/camelcase.d.ts @@ -0,0 +1,8 @@ +// Type definitions for camelcase +// Project: https://github.com/sindresorhus/camelcase +// Definitions by: Sam Verschueren +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "camelcase" { + export default function camelcase(...args: string[]): string; +} diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index 464655f78..3c7086de5 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -107,7 +107,7 @@ interface LinearInstance extends ChartInstance { getPointsAtEvent: (event: Event) => PointsAtEvent[]; update: () => void; addData: (valuesArray: number[], label: string) => void; - removeData: () => void; + removeData: (index?: number) => void; } interface CircularInstance extends ChartInstance { diff --git a/clean-css/clean-css-tests.ts b/clean-css/clean-css-tests.ts new file mode 100644 index 000000000..ffbb3d127 --- /dev/null +++ b/clean-css/clean-css-tests.ts @@ -0,0 +1,55 @@ +/// + +import * as CleanCSS from 'clean-css'; + +var source = 'a{font-weight:bold;}'; +var minified = new CleanCSS().minify(source).styles; + +var source = '@import url(http://path/to/remote/styles);'; +new CleanCSS().minify(source, function (error, minified) { + console.log(minified.styles); +}); + +const pathToOutputDirectory = 'path'; + +new CleanCSS({ sourceMap: true, target: pathToOutputDirectory }) + .minify(source, function (error, minified) { + // access minified.sourceMap for SourceMapGenerator object + // see https://github.com/mozilla/source-map/#sourcemapgenerator for more details + // see https://github.com/jakubpawlowicz/clean-css/blob/master/bin/cleancss#L114 on how it's used in clean-css' CLI + console.log(minified.sourceMap); +}); + +const inputSourceMapAsString = 'input'; +new CleanCSS({ sourceMap: inputSourceMapAsString, target: pathToOutputDirectory }) + .minify(source, function (error, minified) { + // access minified.sourceMap to access SourceMapGenerator object + // see https://github.com/mozilla/source-map/#sourcemapgenerator for more details + // see https://github.com/jakubpawlowicz/clean-css/blob/master/bin/cleancss#L114 on how it's used in clean-css' CLI + console.log(minified.sourceMap); +}); + +new CleanCSS({ sourceMap: true, target: pathToOutputDirectory }).minify({ + 'path/to/source/1': { + styles: '...styles...', + sourceMap: '...source-map...' + }, + 'path/to/source/2': { + styles: '...styles...', + sourceMap: '...source-map...' + } +}, function (error, minified) { + // access minified.sourceMap as above + console.log(minified.sourceMap); +}); + +new CleanCSS().minify(['path/to/file/one', 'path/to/file/two']); + +new CleanCSS().minify({ + 'path/to/file/one': { + styles: 'contents of file one' + }, + 'path/to/file/two': { + styles: 'contents of file two' + } +}); diff --git a/clean-css/clean-css.d.ts b/clean-css/clean-css.d.ts new file mode 100644 index 000000000..25bb2471a --- /dev/null +++ b/clean-css/clean-css.d.ts @@ -0,0 +1,109 @@ +// Type definitions for clean-css v3.4.9 +// Project: https://github.com/jakubpawlowicz/clean-css +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'clean-css' { + namespace CleanCSS { + interface Options { + // Set to false to disable advanced optimizations - selector & property merging, reduction, etc. + advanced?: boolean; + + // Set to false to disable aggressive merging of properties. + aggressiveMerging?: boolean; + + // Turns on benchmarking mode measuring time spent on cleaning up (run npm run bench to see example) + benchmark?: boolean; + + // Enables compatibility mode + compatibility?: Object; + + // Set to true to get minification statistics under stats property (see test/custom-test.js for examples) + debug?: boolean; + + // A hash of options for @import inliner, see test/protocol-imports-test.js for examples, or this comment for a proxy use case. + inliner?: Object; + + // Whether to keep line breaks (default is false) + keepBreaks?: boolean; + + // * for keeping all (default), 1 for keeping first one only, 0 for removing all + keepSpecialComments?: string | number; + + // Whether to merge @media at-rules (default is true) + mediaMerging?: boolean; + + // Whether to process @import rules + processImport?: boolean; + + // A list of @import rules, can be ['all'] (default), ['local'], ['remote'], or a blacklisted path e.g. ['!fonts.googleapis.com'] + processImportFrom?: Array; + + // Set to false to skip URL rebasing + rebase?: boolean; + + // Path to resolve relative @import rules and URLs + relativeTo?: string; + + // Set to false to disable restructuring in advanced optimizations + restructuring?: boolean; + + // Path to resolve absolute @import rules and rebase relative URLs + root?: string; + + // Rounding precision; defaults to 2; -1 disables rounding + roundingPrecision?: number; + + // Set to true to enable semantic merging mode which assumes BEM-like content (default is false as it's highly likely this will break your stylesheets - use with caution!) + semanticMerging?: boolean; + + // Set to false to skip shorthand compacting (default is true unless sourceMap is set when it's false) + shorthandCompacting?: boolean; + + // Exposes source map under sourceMap property, e.g. new CleanCSS().minify(source).sourceMap (default is false) If input styles are a product of CSS preprocessor (Less, Sass) an input source map can be passed as a string. + sourceMap?: boolean | string; + + // Set to true to inline sources inside a source map's sourcesContent field (defaults to false) It is also required to process inlined sources from input source maps. + sourceMapInlineSources?: boolean; + + // Path to a folder or an output file to which rebase all URLs + target?: string; + } + + interface Output { + // Optimized output CSS as a string + styles: string; + + // Output source map (if requested with sourceMap option) + sourceMap: string; + + // A list of errors raised + errors: Array; + + // A list of warnings raised + warnings: Array; + + // A hash of statistic information (if requested with debug option) + stats: { + // Original content size (after import inlining) + originalSize: number; + + // Optimized content size + minifiedSize: number; + + // Time spent on optimizations + timeSpent: number; + + // A ratio of output size to input size (e.g. 25% if content was reduced from 100 bytes to 75 bytes) + efficiency: number; + }; + } + } + + class CleanCSS { + constructor(options?: CleanCSS.Options); + minify(sources: string | Array | Object, callback?: (error: any, minified: CleanCSS.Output) => void): CleanCSS.Output; + } + + export = CleanCSS; +} diff --git a/clipboard/clipboard-tests.ts b/clipboard/clipboard-tests.ts new file mode 100644 index 000000000..de6e9fc1a --- /dev/null +++ b/clipboard/clipboard-tests.ts @@ -0,0 +1,22 @@ +/// + +var cb1 = new clipboard.Clipboard('.btn'); +var cb2 = new clipboard.Clipboard('.btn', { + action: elem => 'copy' +}); +var cb3 = new clipboard.Clipboard('.btn', { + text: elem => null +}); +var cb4 = new clipboard.Clipboard('.btn', { + target: elem => null +}); +var cb5 = new clipboard.Clipboard('.btn', { + action: elem => 'copy', + target: elem => null +}); + +cb1.destroy(); + +cb2.on('success', function(e) { }); +cb2.on('error', function(e) { }); + diff --git a/clipboard/clipboard.d.ts b/clipboard/clipboard.d.ts new file mode 100644 index 000000000..ddba32b06 --- /dev/null +++ b/clipboard/clipboard.d.ts @@ -0,0 +1,52 @@ +// Type definitions for clipboard.js 1.5.5 +// Project: https://github.com/zenorocha/clipboard.js +// Definitions by: Andrei Kurosh +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module clipboard { + + export class Clipboard { + constructor(selector: string, options?: IOptions); + + /** + * Subscribes to events that indicate the result of a copy/cut operation. + * @param type {String} Event type ('success' or 'error'). + * @param handler Callback function. + */ + on(type: "success", handler: (e: Event) => void): void; + on(type: "error", handler: (e: Event) => void): void; + on(type: string, handler: (e: Event) => void): void; + + /** + * Clears all event bindings. + */ + destroy(): void; + } + + interface IOptions { + /** + * Overwrites default command ('cut' or 'copy'). + * @param {Element} elem Current element + * @returns {String} Only 'cut' or 'copy'. + */ + action?: (elem: Element) => string; + + /** + * Overwrites default target input element. + * @param {Element} elem Current element + * @returns {Element} element to use. + */ + target?: (elem: Element) => Element; + + /** + * Returns the explicit text to copy. + * @param {Element} elem Current element + * @returns {String} Text to be copied. + */ + text?: (elem: Element) => string; + } +} + +declare module 'clipboard' { + export = clipboard; +} \ No newline at end of file diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 3fb29e425..81b0d8b03 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -606,7 +606,7 @@ declare module CodeMirror { /** Returns a {from, to} object (both holding document positions), indicating the current position of the marked range, or undefined if the marker is no longer in the document. */ - find(): CodeMirror.Position; + find(): CodeMirror.Range; /** Returns an object representing the options for the marker. If copyWidget is given true, it will clone the value of the replacedWith option, if any. */ getOptions(copyWidget: boolean): CodeMirror.TextMarkerOptions; @@ -650,7 +650,12 @@ declare module CodeMirror { new (line: number, ch: number): Position; (line: number, ch: number): Position; } - + + interface Range{ + from: CodeMirror.Position; + to: CodeMirror.Position; + } + interface Position { ch: number; line: number; @@ -800,9 +805,9 @@ declare module CodeMirror { viewportMargin?: number; /** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */ - lint?: boolean | LintOptions; - - /** Optional value to be used in conduction with CodeMirror’s placeholder add-on. */ + lint?: boolean | LintOptions; + + /** Optional value to be used in conduction with CodeMirror’s placeholder add-on. */ placeholder?: string; } diff --git a/confidence/confidence-tests.ts b/confidence/confidence-tests.ts new file mode 100644 index 000000000..60825e012 --- /dev/null +++ b/confidence/confidence-tests.ts @@ -0,0 +1,79 @@ +/// + +import Confidence = require('confidence'); + +let criteria = { + "env": "production", + "platform": "ios", + "xfactor": "yes", + "random": { + "a": 15 + } +}; + +/** +* The configurations in Confidence style +*/ +let config = { + "key1": "abc", + "key2": { + "$filter": "env", + "production": { + "deeper": { + "$value": "value" + } + }, + "$default": { + "$filter": "platform", + "android": 0, + "ios": 1, + "$default": 2 + } + }, + "key3": { + "sub1": 123, + "sub2": { + "$filter": "xfactor", + "yes": 6 + } + }, + "ab": { + "$filter": "random.a", + "$range": [ + { "limit": 10, "value": 4 }, + { "limit": 20, "value": 5 } + ], + "$default": 6 + }, + "$meta": { + "description": "example file" + } +}; + + +/** +* Creates an empty configuration storage container +*/ +let store = new Confidence.Store(config); + + +/** +* Validates the provided configuration, clears any existing configuration, then loads the configuration +*/ +store.load(config); + + +/** +* Retrieves a value from the configuration document after applying the provided criteria +*/ +store.get('/key1'); +//criteria - optional object +store.get('/key2', criteria); + + +/** +* Retrieves the metadata (if any) from the configuration document after applying the provided criteria +*/ +store.meta('/key1'); +//criteria - optional object +store.meta('/key2', criteria); diff --git a/confidence/confidence.d.ts b/confidence/confidence.d.ts new file mode 100644 index 000000000..4c30b4407 --- /dev/null +++ b/confidence/confidence.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Confidence v1.4.2 +// Project: https://github.com/hapijs/confidence.git +// Definitions by: Jean-Philippe Pellerin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** +* Confidence is a configuration document format, an API, and a foundation for A/B testing. +* The configuration format is designed to work with any existing JSON-based configuration, +* serving values based on object path ('/a/b/c' translates to a.b.c). In addition, +* confidence defines special $-prefixed keys used to filter values for a given criteria. +*/ +declare module 'confidence' { + + export class Store { + + /** + * @constructor + * @param {any} document - the configuration document for this document store + */ + constructor(document?: any); + + /** + * Validates the provided configuration, clears any existing configuration, then loads the configuration where: + * @param {any} document - an object containing a confidence configuration object generated from a parsed JSON document. If the document is invlaid, will throw an error. + */ + load(document: any): void; + + + /** + * Retrieves a value from the configuration document after applying the provided criteria where: + * @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document. + * @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}. + * + * @return {any} Returns the value found after applying the criteria. If the key is invalid or not found, returns undefined. + */ + get(key: string, criteria?: any): any; + + + /** + * Retrieves the metadata (if any) from the configuration document after applying the provided criteria where: + * @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document. + * @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}. + * + * @return {any} Returns the metadata found after applying the criteria. If the key is invalid or not found, or if no metadata is available, returns undefined. + */ + meta(key: string, criteria?: any): any; + } +} diff --git a/connect-timeout/connect-timeout-tests.ts b/connect-timeout/connect-timeout-tests.ts index 920c7fdc6..4f77b597d 100644 --- a/connect-timeout/connect-timeout-tests.ts +++ b/connect-timeout/connect-timeout-tests.ts @@ -3,10 +3,10 @@ /// /// -import express = require("express"); -import timeout = require("connect-timeout"); -import bodyParser = require("body-parser"); -import cookieParser = require("cookie-parser"); +import * as express from "express"; +import timeout from "connect-timeout"; +import * as bodyParser from "body-parser"; +import * as cookieParser from "cookie-parser"; // example of using this top-level; note the use of haltOnTimedout // after every middleware; it will stop the request flow on a timeout diff --git a/connect-timeout/connect-timeout.d.ts b/connect-timeout/connect-timeout.d.ts index 8494a3afb..88bafbad5 100644 --- a/connect-timeout/connect-timeout.d.ts +++ b/connect-timeout/connect-timeout.d.ts @@ -23,6 +23,10 @@ declare module Express { declare module "connect-timeout" { import express = require("express"); + /** + * @summary Interface for timeout options. + * @interface + */ interface TimeoutOptions extends Object { /** * @summary Controls if this module will "respond" in the form of forwarding an error. @@ -31,6 +35,5 @@ declare module "connect-timeout" { respond: boolean; } - function timeout(timeout: string, options?: TimeoutOptions): express.RequestHandler; - export = timeout; + export default function timeout(timeout: string, options?: TimeoutOptions): express.RequestHandler; } diff --git a/convict/convict-tests.ts b/convict/convict-tests.ts index 6cde3b38c..3bd64c592 100644 --- a/convict/convict-tests.ts +++ b/convict/convict-tests.ts @@ -6,6 +6,42 @@ import validator = require('validator'); // define a schema +// straight from the convict tests +const format : convict.Format = { + name: 'float-percent', + validate: function(val) { + if (val !== 0 && (!val || val > 1 || val < 0)) { + throw new Error('must be a float between 0 and 1, inclusive'); + } + }, + coerce: function(val) { + return +( val); + } +}; + + + + +convict.addFormat(format); +convict.addFormats({ + prime: { + validate: function(val) { + function isPrime(n: number) { + if (n <= 1) return false; // zero and one are not prime + for (var i=2; i*i <= n; i++) { + if (n % i === 0) return false; + } + return true; + } + if (!isPrime(val)) throw new Error('must be a prime number'); + }, + coerce: function(val) { + return parseInt(val, 10); + } + } + }); + + var conf = convict({ env: { doc: 'The applicaton environment.', @@ -46,7 +82,15 @@ var conf = convict({ env: 'PORT', arg: 'port', } - } + }, + primeNumber: { + format: 'prime', + default: 17 + }, + percentNumber: { + format: 'float-percent', + default: 0.5 + }, }); @@ -72,4 +116,10 @@ if (conf.has('key')) { } }); } + +conf.getSchema(); +conf.getProperties(); +conf.getSchemaString(); +conf.toString(); + // vim:et:sw=2:ts=2 diff --git a/convict/convict.d.ts b/convict/convict.d.ts index 74ed10038..14ecae8f8 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -4,30 +4,74 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "convict" { - function convict(schema: convict.Schema): convict.Config; + module convict { - module convict { - interface Schema { - [name: string]: convict.Schema | { - default: any; - doc?: string; - format?: any; - env?: string; - arg?: string; - }; - } + interface Format { + name?: string; + validate?: (val: any) => void; + coerce?: (val: any) => any; + } - interface Config { - get(name: string): any; - default(name: string): any; - has(name: string): boolean; - set(name: string, value: any): void; - load(conf: Object): void; - loadFile(file: string): void; - loadFile(files: string[]): void; - validate(): void; - } - } + interface Schema { + [name: string]: convict.Schema | { + default: any; + doc?: string; + /** + * From the implementation: + * + * format can be a: + * - predefine type, as seen below + * - an array of enumerated values, e.g. ["production", "development", "testing"] + * - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean + * - or if omitted, the Object.prototype.toString.call of the default value + * + * The docs also state that any function that validates is ok too + */ + format?: string | Array | Function; + env?: string; + arg?: string; + }; + } - export = convict; + interface Config { + get(name: string): any; + default(name: string): any; + has(name: string): boolean; + set(name: string, value: any): void; + load(conf: Object): void; + loadFile(file: string): void; + loadFile(files: string[]): void; + validate(): void; + /** + * Exports all the properties (that is the keys and their current values) as a {JSON} {Object} + * @returns {Object} A {JSON} compliant {Object} + */ + getProperties() : Object; + /** + * Exports the schema as a {JSON} {Object} + * @returns {Object} A {JSON} compliant {Object} + */ + getSchema() : Object; + + /** + * Exports all the properties (that is the keys and their current values) as a JSON string. + * @returns {String} a string representing this object + */ + toString() : string; + + /** + * Exports the schema as a JSON string. + * @returns {String} a string representing the schema of this {Config} + */ + getSchemaString() : string; + } + } + interface convict { + addFormat(format: convict.Format): void; + addFormats(formats: { [name: string]: convict.Format }): void; + (config: convict.Schema): convict.Config; + } + var convict : convict; + export = convict; } + diff --git a/copy-paste/copy-paste-tests.ts b/copy-paste/copy-paste-tests.ts new file mode 100644 index 000000000..400c32a2a --- /dev/null +++ b/copy-paste/copy-paste-tests.ts @@ -0,0 +1,16 @@ +/// +/// + +import * as CopyPaste from 'copy-paste'; + +class TestClass {} + +let strRet: string = CopyPaste.copy("content"); +strRet = CopyPaste.copy("content", (err: Error) => { return; }); + + +let objRet: TestClass = CopyPaste.copy(new TestClass()); +objRet = CopyPaste.copy(new TestClass(), (err: Error) => { return; }); + +strRet = CopyPaste.paste(); +CopyPaste.paste((err: Error, content: string) => { return; }); \ No newline at end of file diff --git a/copy-paste/copy-paste.d.ts b/copy-paste/copy-paste.d.ts new file mode 100644 index 000000000..a8a844b5b --- /dev/null +++ b/copy-paste/copy-paste.d.ts @@ -0,0 +1,46 @@ +// Type definitions for copy-paste v1.1.3 +// Project: https://github.com/xavi-/node-copy-paste +// Definitions by: Tobias Kahlert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'copy-paste' { + + export type CopyCallback = (err: Error) => void; + export type PasteCallback = (err: Error, content: string) => void; + + /** + * Asynchronously replaces the current contents of the clip board with text. + * + * @param {T} content Takes either a string, array, object, or readable stream. + * @return {T} Returns the same value passed in. + */ + export function copy(content: T): T; + + /** + * Asynchronously replaces the current contents of the clip board with text. + * + * @param {T} content Takes either a string, array, object, or readable stream. + * @param {CopyCallback} callback will fire when the copy operation is complete. + * @return {T} Returns the same value passed in. + */ + export function copy(content: T, callback: CopyCallback): T; + + + /** + * Synchronously returns the current contents of the system clip board. + * + * Note: The synchronous version of paste is not always availabled. + * An error message is shown if the synchronous version of paste is used on an unsupported platform. + * The asynchronous version of paste is always available. + * + * @return {string} Returns the current contents of the system clip board. + */ + export function paste(): string; + + /** + * Asynchronously returns the current contents of the system clip board. + * + * @param {PasteCallback} callback The contents of the system clip board are passed to the callback as the second parameter. + */ + export function paste(callback: PasteCallback): void; +} \ No newline at end of file diff --git a/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts b/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts new file mode 100644 index 000000000..63deacc98 --- /dev/null +++ b/cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts @@ -0,0 +1,43 @@ +/// + +var QRScanner: QRScanner = window.QRScanner; +QRScanner.prepare() +QRScanner.prepare((err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.scan((err, results) => { var error: Error = err; var contents: String = results; }) +QRScanner.cancelScan() +QRScanner.cancelScan((status) => {var obj: QRScannerStatus = status; }) +QRScanner.show() +QRScanner.show((status) => {var obj: QRScannerStatus = status; }) +QRScanner.hide() +QRScanner.hide((status) => {var obj: QRScannerStatus = status; }) +QRScanner.enableLight() +QRScanner.enableLight((err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.disableLight() +QRScanner.disableLight((err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.useCamera(1) +QRScanner.useCamera(1, (err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.useFrontCamera() +QRScanner.useFrontCamera((err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.useBackCamera() +QRScanner.useBackCamera((err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.pausePreview() +QRScanner.pausePreview((status) => {var obj: QRScannerStatus = status; }) +QRScanner.resumePreview() +QRScanner.resumePreview((status) => {var obj: QRScannerStatus = status; }) +QRScanner.openSettings() +QRScanner.openSettings((err, status) => { var error: Error = err; var obj: QRScannerStatus = status; }) +QRScanner.destroy() +QRScanner.destroy((status) => {var obj: QRScannerStatus = status; }) + +QRScanner.getStatus((status) => { + var obj: QRScannerStatus = status; + var bool: Boolean = status.authorized; + bool = status.prepared; + bool = status.scanning; + bool = status.previewing; + bool = status.webviewBackgroundIsTransparent; + bool = status.lightEnabled; + bool = status.canOpenSettings; + bool = status.canEnableLight; + var num: Number = status.currentCamera; +}) diff --git a/cordova-plugin-qrscanner/cordova-plugin-qrscanner.d.ts b/cordova-plugin-qrscanner/cordova-plugin-qrscanner.d.ts new file mode 100644 index 000000000..31f141188 --- /dev/null +++ b/cordova-plugin-qrscanner/cordova-plugin-qrscanner.d.ts @@ -0,0 +1,191 @@ +// Type definitions for cordova-plugin-qrscanner +// Project: https://github.com/bitpay/cordova-plugin-qrscanner +// Definitions by: Jason Dreyzehner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** +* Global object QRScanner. +*/ +interface Window { + QRScanner: QRScanner; +} + +/** +* The QRScanner object provides functions to initialize, control, utilize, and +* deallocate a native QR code scanner and video preview behind the Cordova webview. +*/ +interface QRScanner { + + /** + * Request permission to access the camera (if not already granted), prepare + * the video preview, and configure everything needed by QRScanner. This will + * only be visible if `QRScanner.show()` has already made the webview transparent. + * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. + */ + prepare: (callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Sets QRScanner to "watch" for valid QR codes. Once a valid code is + * detected, it's contents are passed to the callback, and scanning is + * toggled off. If `QRScanner.prepare()` has not been called, + * `QRScanner.scan()` performs that setup as well. The video preview does + * not need to be visible for scanning to function. + * @param {function} callback Callback that gets an error or the results string. + */ + scan: (callback: (error: Error, result: String) => any) => void; + + /** + * Cancels the current scan. The current scan() callback will not return. + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + cancelScan: (callback?: (status: QRScannerStatus) => any) => void; + + /** + * Configures the native webview to have a transparent background, then sets + * the background of the `` and parent elements to transparent, + * allowing the webview to re-render with the transparent background. + * To see the video preview, your application background must be transparent + * in the areas through which it should show. + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + show: (callback?: (status: QRScannerStatus) => any) => void; + + /** + * Configures the native webview to be opaque with a white background, + * covering the video preview. + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + hide: (callback?: (status: QRScannerStatus) => any) => void; + + + /** + * Enable the device's light (for scanning in low-light environments). + * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. + */ + enableLight: (callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Disable the device's light. + * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. + */ + disableLight: (callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Switch video capture to the `index` camera. Camera `0` is the back camera, + * camera `1` is front camera. + * @param {number} index A number representing the index of the camera to use. + * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. + */ + useCamera: (index: Number, callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Switch video capture to the device's front camera. + * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. + */ + useFrontCamera: (callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Switch video capture to the device's back camera. + * @param {function} [callback] Callback that gets an error or the QRScannerStatus object. + */ + useBackCamera: (callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Pauses the video preview on the current frame (as if a snapshot was taken). + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + pausePreview: (callback?: (status: QRScannerStatus) => any) => void; + + /** + * Resumes the video preview. + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + resumePreview: (callback?: (status: QRScannerStatus) => any) => void; + + /** + * Open the app-specific permission settings in the user's device settings. + * Here the user can enable/disable camera (and other) access for your app. + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + openSettings: (callback?: (error: Error, status: QRScannerStatus) => any) => void; + + /** + * Retrieve the status of QRScanner and provide it to the callback function. + * @param {function} callback Callback that gets the QRScannerStatus object. + */ + getStatus: (callback: (status: QRScannerStatus) => any) => void; + + /** + * Stops scanning, video capture, and the preview, and deallocates as much as + * possible. (E.g. to improve performance/battery life when the scanner is + * not likely to be used for a while.) + * Basically reverts the plugin to it's startup-state. + * @param {function} [callback] Callback that gets the QRScannerStatus object. + */ + destroy: (callback?: (status: QRScannerStatus) => any) => void; +} + + +/** +* An object representing the current status of QRScanner. +*/ +interface QRScannerStatus { + + /** + * On iOS, camera access is granted to an app by the user (by clicking "Allow" + * at the dialog). The `authorized` property is a boolean value which is true + * only when the user has allowed camera access to your app + * (`AVAuthorizationStatus.Authorized`). The `NotDetermined`, `Restricted` + * (e.g.: parental controls), and `Denied` AVAuthorizationStatus states all + * cause this value to be false. If the user has denied access to your app, + * consider asking nicely and offering a link via `QRScanner.openSettings()`. + */ + authorized: Boolean, + + /** + * A boolean value which is true if QRScanner is prepared to capture video and + * render it to the view. + */ + prepared: Boolean, + + /** + * A boolean value which is true if QRScanner is actively scanning for a QR code. + */ + scanning: Boolean, + + /** + * A boolean value which is true if QRScanner is displaying a live preview + * from the device's camera. Set to false when the preview is paused. + */ + previewing: Boolean, + + /** + * A boolean value which is true when the native webview background is transparent. + */ + webviewBackgroundIsTransparent: Boolean, + + /** + * A boolean value which is true if the light is enabled. + */ + lightEnabled: Boolean, + + /** + * A boolean value which is true only if the users' operating system is able + * to `QRScanner.openSettings()`. + */ + canOpenSettings: Boolean, + + /** + * A boolean value which is true only if the users' device can enable a light + * in the direction of the currentCamera. + */ + canEnableLight: Boolean, + + /** + * A number representing the index of the currentCamera. `0` is the back + * camera, `1` is the front. + */ + currentCamera: Number +} + +declare var QRScanner: QRScanner; diff --git a/d3-dsv/d3-dsv-tests.ts b/d3-dsv/d3-dsv-tests.ts new file mode 100644 index 000000000..44b0a6cb3 --- /dev/null +++ b/d3-dsv/d3-dsv-tests.ts @@ -0,0 +1,8 @@ +/// + +import d3dsv = require("d3-dsv"); + +var csv = d3dsv(","); + +var rows = csv.parse("a,b,c\n1,2,3\n4,5,6"); + diff --git a/d3-dsv/d3-dsv.d.ts b/d3-dsv/d3-dsv.d.ts new file mode 100644 index 000000000..09ed95491 --- /dev/null +++ b/d3-dsv/d3-dsv.d.ts @@ -0,0 +1,67 @@ +// Type definitions for d3-dsv +// Project: https://www.npmjs.com/package/d3-dsv +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +//commonjs loader +declare module "d3-dsv" { + + /** A parser and formatter for DSV (CSV and TSV) files. +Extracted from D3. */ + var loader: ( + /** the symbol used to seperate cells in the row.*/ + delimiter: string, + /** example: "text/plain" */ + encoding?: string) => _d3dsv.D3Dsv; + export = loader; +} +declare module _d3dsv { + /** A parser and formatter for DSV (CSV and TSV) files. +Extracted from D3. */ + export class D3Dsv { + /** Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows. + The string is assumed to be RFC4180-compliant. + Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names; + these column names become the attributes on the returned objects. + For example, consider the following CSV file: + +Year,Make,Model,Length +1997,Ford,E350,2.34 +2000,Mercury,Cougar,2.38 + +The resulting JavaScript array is: + +[ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"}, + {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ] + */ + public parse( + table: string, + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */ + accessor?: (row: any) => TRow + ): TRow[]; + /** Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows. The string is assumed to be RFC4180-compliant. Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header. Each row is represented as an array rather than an object. Rows may have variable length. For example, consider the following CSV file: + +1997,Ford,E350,2.34 +2000,Mercury,Cougar,2.38 +The resulting JavaScript array is: + +[ ["1997", "Ford", "E350", "2.34"], + ["2000", "Mercury", "Cougar", "2.38"] ] +Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.*/ + public parseRows( + table: string, + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/ + accessor?: (row: string[]) => TRow + ): TRow[]; + /** Converts the specified array of rows into comma-separated values format, returning a string. This operation is the reverse of parse. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. + +Each row should be an object, and all object properties will be converted into fields. For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows. */ + public format(rows: any[]): string; + /** Converts the specified array of rows into comma-separated values format, returning a string. This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. */ + public formatRows(rows: any[]): string; + + + } + +} \ No newline at end of file diff --git a/del/del-tests.ts b/del/del-tests.ts index 867781d63..d3c45c965 100644 --- a/del/del-tests.ts +++ b/del/del-tests.ts @@ -35,3 +35,5 @@ paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true}); paths = del.sync("tmp/*.js"); paths = del.sync("tmp/*.js", {force: true}); + +paths = del.sync("tmp/*.js", {dryRun: true}); diff --git a/del/del.d.ts b/del/del.d.ts index 060861d8a..88316f4f2 100644 --- a/del/del.d.ts +++ b/del/del.d.ts @@ -1,6 +1,6 @@ -// Type definitions for del v1.2.0 +// Type definitions for del v2.2.0 // Project: https://github.com/sindresorhus/del -// Definitions by: Asana +// Definitions by: Asana , Aya Morisawa // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -20,7 +20,8 @@ declare module "del" { function sync(patterns: string[], options?: Options): string[]; interface Options extends glob.IOptions { - force?: boolean + force?: boolean; + dryRun?: boolean; } } diff --git a/dot-prop/dot-prop-tests.ts b/dot-prop/dot-prop-tests.ts new file mode 100644 index 000000000..605a72de3 --- /dev/null +++ b/dot-prop/dot-prop-tests.ts @@ -0,0 +1,12 @@ +/// + +import * as dotProp from 'dot-prop'; + +dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); +dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); +dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); + +const obj = {foo: {bar: 'a'}}; +dotProp.set(obj, 'foo.bar', 'b'); +dotProp.set(obj, 'foo.baz', 'x'); +dotProp.set(obj, 'foo.dot\\.dot', 'unicorn'); diff --git a/dot-prop/dot-prop.d.ts b/dot-prop/dot-prop.d.ts new file mode 100644 index 000000000..c2f52c162 --- /dev/null +++ b/dot-prop/dot-prop.d.ts @@ -0,0 +1,9 @@ +// Type definitions for dot-prop +// Project: https://github.com/sindresorhus/dot-prop +// Definitions by: Sam Verschueren +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "dot-prop" { + export function get(object: any, path: string): any; + export function set(object: any, path: string, value: any): void; +} diff --git a/easeljs/easeljs.d.ts b/easeljs/easeljs.d.ts index 947c760e1..f18cabdcb 100644 --- a/easeljs/easeljs.d.ts +++ b/easeljs/easeljs.d.ts @@ -1,1021 +1,1022 @@ -// Type definitions for EaselJS 0.8.0 -// Project: http://www.createjs.com/#!/EaselJS -// Definitions by: Pedro Ferreira , Chris Smith -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/* - Copyright (c) 2012 Pedro Ferreira - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// Library documentation : http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html - -/// -/// - -// rename the native MouseEvent, to avoid conflict with createjs's MouseEvent -interface NativeMouseEvent extends MouseEvent { - -} - -declare module createjs { - export class AlphaMapFilter extends Filter { - constructor(alphaMap: HTMLImageElement | HTMLCanvasElement); - - // properties - alphaMap: HTMLImageElement | HTMLCanvasElement; - - // methods - clone(): AlphaMapFilter; - } - - export class AlphaMaskFilter extends Filter { - constructor(mask: HTMLImageElement | HTMLCanvasElement); - - // properties - mask: HTMLImageElement | HTMLCanvasElement; - - // methods - clone(): AlphaMaskFilter; - } - - - export class Bitmap extends DisplayObject { - constructor(imageOrUrl: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string); - - // properties - image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement; - sourceRect: Rectangle; - - // methods - clone(): Bitmap; - } - - - export class BitmapText extends DisplayObject { - constructor(text?:string, spriteSheet?:SpriteSheet); - - static maxPoolSize: number; - - // properties - letterSpacing: number; - lineHeight: number; - spaceWidth: number; - spriteSheet: SpriteSheet; - text: string; - } - - export class BlurFilter extends Filter { - constructor(blurX?: number, blurY?: number, quality?: number); - - // properties - blurX: number; - blurY: number; - quality: number; - - // methods - clone(): BlurFilter; - } - - export class ButtonHelper { - constructor(target: Sprite, outLabel?: string, overLabel?: string, downLabel?: string, play?: boolean, hitArea?: DisplayObject, hitLabel?: string); - constructor(target: MovieClip, outLabel?: string, overLabel?: string, downLabel?: string, play?: boolean, hitArea?: DisplayObject, hitLabel?: string); - - // properties - downLabel: string | number; - outLabel: string | number; - overLabel: string | number; - play: boolean; - target: MovieClip | Sprite; - enabled: boolean; - - // methods - /** - * @deprecated - use the 'enabled' property instead - */ - setEnabled(value: boolean): void; - /** - * @deprecated - use the 'enabled' property instead - */ - getEnabled(): boolean; - toString(): string; - } - - export class ColorFilter extends Filter { - constructor(redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaMultiplier?: number, redOffset?: number, greenOffset?: number, blueOffset?: number, alphaOffset?: number); - - // properties - alphaMultiplier: number; - alphaOffset: number; - blueMultiplier: number; - blueOffset: number; - greenMultiplier: number; - greenOffset: number; - redMultiplier: number; - redOffset: number; - - // methods - clone(): ColorFilter; - } - - export class ColorMatrix { - constructor(brightness?: number, contrast?: number, saturation?: number, hue?: number); - - // methods - adjustBrightness(value: number): ColorMatrix; - adjustColor(brightness: number, contrast: number, saturation: number, hue: number): ColorMatrix; - adjustContrast(value: number): ColorMatrix; - adjustHue(value: number): ColorMatrix; - adjustSaturation(value: number): ColorMatrix; - clone(): ColorMatrix; - concat(...matrix: number[]): ColorMatrix; - concat(matrix: ColorMatrix): ColorMatrix; - copy(...matrix: number[]): ColorMatrix; - copy(matrix: ColorMatrix): ColorMatrix; - reset(): ColorMatrix; - setColor( brightness: number, contrast: number, saturation: number, hue: number ): ColorMatrix; - toArray(): number[]; - toString(): string; - } - - export class ColorMatrixFilter extends Filter { - constructor(matrix: number[] | ColorMatrix); - - // properties - matrix: number[] | ColorMatrix; - - // methods - clone(): ColorMatrixFilter; - } - - - export class Container extends DisplayObject { - constructor(); - - // properties - children: DisplayObject[]; - mouseChildren: boolean; - numChildren: number; - tickChildren: boolean; - - // methods - addChild(...child: DisplayObject[]): DisplayObject; - addChildAt(child: DisplayObject, index: number): DisplayObject; // add this for the common case - addChildAt(...childOrIndex: any[]): DisplayObject; // actually (...child: DisplayObject[], index: number) - clone(recursive?: boolean): Container; - contains(child: DisplayObject): boolean; - getChildAt(index: number): DisplayObject; - getChildByName(name: string): DisplayObject; - getChildIndex(child: DisplayObject): number; - /** - * @deprecated - use numChildren property instead. - */ - getNumChildren(): number; - getObjectsUnderPoint(x: number, y: number, mode: number): DisplayObject[]; - getObjectUnderPoint(x: number, y: number, mode: number): DisplayObject; - removeAllChildren(): void; - removeChild(...child: DisplayObject[]): boolean; - removeChildAt(...index: number[]): boolean; - setChildIndex(child: DisplayObject, index: number): void; - sortChildren(sortFunction: (a: DisplayObject, b: DisplayObject) => number): void; - swapChildren(child1: DisplayObject, child2: DisplayObject): void; - swapChildrenAt(index1: number, index2: number): void; - } - - export class DisplayObject extends EventDispatcher { - constructor(); - - // properties - alpha: number; - cacheCanvas: HTMLCanvasElement | Object; - cacheID: number; - compositeOperation: string; - cursor: string; - filters: Filter[]; - hitArea: DisplayObject; - id: number; - mask: Shape; - mouseEnabled: boolean; - name: string; - parent: Container; - regX: number; - regY: number; - rotation: number; - scaleX: number; - scaleY: number; - shadow: Shadow; - skewX: number; - skewY: number; - snapToPixel: boolean; - stage: Stage; - static suppressCrossDomainErrors: boolean; - tickEnabled: boolean; - transformMatrix: Matrix2D; - visible: boolean; - x: number; - y: number; - - // methods - cache(x: number, y: number, width: number, height: number, scale?: number): void; - clone(): DisplayObject; - draw(ctx: CanvasRenderingContext2D, ignoreCache?: boolean): boolean; - getBounds(): Rectangle; - getCacheDataURL(): string; - getConcatenatedDisplayProps(props?: DisplayProps): DisplayProps; - getConcatenatedMatrix(mtx?: Matrix2D): Matrix2D; - getMatrix(matrix?: Matrix2D): Matrix2D; - /** - * @deprecated - */ - getStage(): Stage; - getTransformedBounds(): Rectangle; - globalToLocal(x: number, y: number, pt?: Point | Object): Point; - hitTest(x: number, y: number): boolean; - isVisible(): boolean; - localToGlobal(x: number, y: number, pt?: Point | Object): Point; - localToLocal(x: number, y: number, target: DisplayObject, pt?: Point | Object): Point; - set(props: Object): DisplayObject; - setBounds(x: number, y: number, width: number, height: number): void; - setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): DisplayObject; - uncache(): void; - updateCache(compositeOperation?: string): void; - updateContext(ctx: CanvasRenderingContext2D): void; - } - - export class DisplayProps { - constructor(visible?: number, alpha?: number, shadow?: number, compositeOperation?: number, matrix?: number); - - // properties - alpha: number; - compositeOperation: string; - matrix: Matrix2D; - shadow: Shadow; - visible: boolean; - - // methods - append(visible: boolean, alpha: number, shadow: Shadow, compositeOperation: string, matrix?: Matrix2D): DisplayProps; - clone(): DisplayProps; - identity(): DisplayProps; - prepend(visible: boolean, alpha: number, shadow: Shadow, compositeOperation: string, matrix?: Matrix2D): DisplayProps; - setValues(visible?: boolean, alpha?: number, shadow?: number, compositeOperation?: number, matrix?: number): DisplayProps; - } - - - export class DOMElement extends DisplayObject { - constructor(htmlElement: HTMLElement); - - // properties - htmlElement: HTMLElement; - - // methods - clone(): DisplayObject; // throw error - set(props: Object): DOMElement; - setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): DOMElement; - } - - - export class EaselJS { - // properties - static buildDate: string; - static version: string; - } - - export class Filter { - constructor(); - - // methods - applyFilter(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, targetCtx?: CanvasRenderingContext2D, targetX?: number, targetY?: number): boolean; - clone(): Filter; - getBounds(): Rectangle; - toString(): string; - } - - export class Graphics { - constructor(); - - // properties - static BASE_64: Object; - static beginCmd: Graphics.BeginPath; - command: Object; - instructions: Object[]; // array of graphics command objects (Graphics.Fill, etc) - static STROKE_CAPS_MAP: string[]; - static STROKE_JOINTS_MAP: string[]; - - // methods - append(command: Object, clean?: boolean): Graphics; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): Graphics; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics; - beginBitmapFill(image: Object, repetition?: string, matrix?: Matrix2D): Graphics; - beginBitmapStroke(image: Object, repetition?: string): Graphics; - beginFill(color: string): Graphics; - beginLinearGradientFill(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; - beginLinearGradientStroke(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; - beginRadialGradientFill(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; - beginRadialGradientStroke(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; - beginStroke(color: string): Graphics; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): Graphics; - clear(): Graphics; - clone(): Graphics; - closePath(): Graphics; - curveTo(cpx: number, cpy: number, x: number, y: number): Graphics; - decodePath(str: string): Graphics; - draw(ctx: CanvasRenderingContext2D): void; - drawAsPath(ctx: CanvasRenderingContext2D): void; - drawCircle(x: number, y: number, radius: number): Graphics; - drawEllipse(x: number, y: number, w: number, h: number): Graphics; - drawPolyStar(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number): Graphics; - drawRect(x: number, y: number, w: number, h: number): Graphics; - drawRoundRect(x: number, y: number, w: number, h: number, radius: number): Graphics; - drawRoundRectComplex(x: number, y: number, w: number, h: number, radiusTL: number, radiusTR: number, radiusBR: number, radisBL: number): Graphics; - endFill(): Graphics; - endStroke(): Graphics; - static getHSL(hue: number, saturation: number, lightness: number, alpha?: number): string; - /** - * @deprecated - use the instructions property instead - */ - getInstructions(): Object[]; - static getRGB(r: number, g: number, b: number, alpha?: number): string; - inject(callback: (data: any) => any, data: any): Graphics; // deprecated - isEmpty(): boolean; - lineTo(x: number, y: number): Graphics; - moveTo(x: number, y: number): Graphics; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): Graphics; - rect(x: number, y: number, w: number, h: number): Graphics; - setStrokeStyle(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; - setStrokeDash(segments?: number[], offset?: number): Graphics; - store(): Graphics; - toString(): string; - unstore(): Graphics; - - - // tiny API - short forms of methods above - a(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): Graphics; - at(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics; - bf(image: Object, repetition?: string, matrix?: Matrix2D): Graphics; - bs(image: Object, repetition?: string): Graphics; - f(color: string): Graphics; - lf(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; - ls(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; - rf(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; - rs(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; - s(color: string): Graphics; - bt(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): Graphics; - c(): Graphics; - cp(): Graphics; - p(str: string): Graphics; - dc(x: number, y: number, radius: number): Graphics; - de(x: number, y: number, w: number, h: number): Graphics; - dp(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number): Graphics; - dr(x: number, y: number, w: number, h: number): Graphics; - rr(x: number, y: number, w: number, h: number, radius: number): Graphics; - rc(x: number, y: number, w: number, h: number, radiusTL: number, radiusTR: number, radiusBR: number, radisBL: number): Graphics; - ef(): Graphics; - es(): Graphics; - lt(x: number, y: number): Graphics; - mt(x: number, y: number): Graphics; - qt(cpx: number, cpy: number, x: number, y: number): Graphics; - r(x: number, y: number, w: number, h: number): Graphics; - ss(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; - sd(segments?: number[], offset?: number): Graphics; - } - - - module Graphics - { - export class Arc - { - constructor(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: number); - - // properties - anticlockwise: number; - endAngle: number; - radius: number; - startAngle: number; - x: number; - y: number; - } - - export class ArcTo - { - constructor(x1: number, y1: number, x2: number, y2: number, radius: number); - - // properties - x1: number; - y1: number; - x2: number; - y2: number; - radius: number; - } - - export class BeginPath - { - - } - - export class BezierCurveTo - { - constructor(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number); - - // properties - cp1x: number; - cp1y: number; - cp2x: number; - cp2y: number; - x: number; - y: number; - } - - export class Circle - { - constructor(x: number, y: number, radius: number); - - // properties - x: number; - y: number; - radius: number; - } - - export class ClosePath - { - - } - - export class Fill - { - constructor(style: Object, matrix?: Matrix2D); - - // properties - style: Object; - matrix: Matrix2D; - - // methods - bitmap(image: HTMLImageElement, repetition?: string): Fill; - linearGradient(colors: number[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Fill; - radialGradient(colors: number[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Fill; - } - - export class LineTo - { - constructor(x: number, y: number); - - // properties - x: number; - y: number; - } - - export class MoveTo - { - constructor(x: number, y: number); - - x: number; - y: number; - } - - export class PolyStar - { - constructor(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number); - - // properties - angle: number; - pointSize: number; - radius: number; - sides: number; - x: number; - y: number; - } - - export class QuadraticCurveTo - { - constructor(cpx: number, cpy: number, x: number, y: number); - - // properties - cpx: number; - cpy: number; - x: number; - y: number; - } - - export class Rect - { - constructor(x: number, y: number, w: number, h: number); - - // properties - x: number; - y: number; - w: number; - h: number; - } - - export class RoundRect - { - constructor(x: number, y: number, w: number, h: number, radiusTL: number, radiusTR: number, radiusBR: number, radiusBL: number); - - // properties - x: number; - y: number; - w: number; - h: number; - radiusTL: number; - radiusTR: number; - radiusBR: number; - radiusBL: number; - } - - export class Stroke - { - constructor(style: Object, ignoreScale: boolean); - - // properties - style: Object; - ignoreScale: boolean; - - // methods - bitmap(image: HTMLImageElement, repetition?: string): Stroke; - linearGradient(colors: number[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Stroke; - radialGradient(colors: number[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Stroke; - } - - export class StrokeStyle - { - constructor(width: number, caps: string, joints: number, miterLimit: number); - - // properties - caps: string; - joints: string; - miterLimit: number; - width: number; - } - } - - - - export class Matrix2D { - constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number); - - // properties - a: number; - b: number; - c: number; - d: number; - static DEG_TO_RAD: number; - static identity: Matrix2D; - tx: number; - ty: number; - - // methods - append(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; - appendMatrix(matrix: Matrix2D): Matrix2D; - appendTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D; - clone(): Matrix2D; - copy(matrix: Matrix2D): Matrix2D; - decompose(): {x: number; y: number; scaleX: number; scaleY: number; rotation: number; skewX: number; skewY: number}; - decompose(target: Object): Matrix2D; - equals(matrix: Matrix2D): boolean; - identity(): Matrix2D; - invert(): Matrix2D; - isIdentity(): boolean; - prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; - prependMatrix(matrix: Matrix2D): Matrix2D; - prependTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D; - rotate(angle: number): Matrix2D; - scale(x: number, y: number): Matrix2D; - setValues(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): Matrix2D; - skew(skewX: number, skewY: number): Matrix2D; - toString(): string; - transformPoint(x: number, y: number, pt?: Point | Object): Point; - translate(x: number, y: number): Matrix2D; - } - - - export class MouseEvent extends Event { - constructor(type: string, bubbles: boolean, cancelable: boolean, stageX: number, stageY: number, nativeEvent: NativeMouseEvent, pointerID: number, primary: boolean, rawX: number, rawY: number); - - // properties - isTouch: boolean; - localX: number; - localY: number; - nativeEvent: NativeMouseEvent; - pointerID: number; - primary: boolean; - rawX: number; - rawY: number; - stageX: number; - stageY: number; - - // methods - clone(): MouseEvent; - - // EventDispatcher mixins - addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function; - addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function; - addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object; - addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object; - dispatchEvent(eventObj: Object | string | Event, target?: Object): boolean; - hasEventListener(type: string): boolean; - off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; - off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; - off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; - off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; - off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" - on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; - on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; - on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; - on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; - removeAllEventListeners(type?: string): void; - removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; - removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; - removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; - removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; - removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" - toString(): string; - willTrigger(type: string): boolean; - } - - - export class MovieClip extends Container { - constructor(mode?: string, startPosition?: number, loop?: boolean, labels?: Object); - - // properties - actionsEnabled: boolean; - autoReset: boolean; - static buildDate: string; - currentFrame: number; - currentLabel: string; - frameBounds: Rectangle[]; - framerate: number; - static INDEPENDENT: string; - labels: Object[]; - loop: boolean; - mode: string; - paused: boolean; - static SINGLE_FRAME: string; - startPosition: number; - static SYNCHED: string; - timeline: Timeline; - static version: string; - - // methods - advance(time?: number): void; - clone(): MovieClip; // not supported - /** - * @deprecated - use 'currentLabel' property instead - */ - getCurrentLabel(): string; // deprecated - /** - * @deprecated - use 'labels' property instead - */ - getLabels(): Object[]; - gotoAndPlay(positionOrLabel: string | number): void; - gotoAndStop(positionOrLabel: string | number): void; - play(): void; - stop(): void; - } - - export class MovieClipPlugin { - // methods - tween(tween: Tween, prop: string, value: string | number | boolean, startValues: any[], endValues: any[], ratio: number, wait: Object, end: Object): void; - } - - export class Point { - constructor(x?: number, y?: number); - - // properties - x: number; - y: number; - - // methods - clone(): Point; - copy(point: Point): Point; - setValues(x?: number, y?: number): Point; - toString(): string; - } - - export class Rectangle { - constructor(x?: number, y?: number, width?: number, height?: number); - - // properties - height: number; - width: number; - x: number; - y: number; - - // methods - clone(): Rectangle; - contains(x: number, y: number, width?: number, height?: number): boolean; - copy(rectangle: Rectangle): Rectangle; - extend(x: number, y: number, width?: number, height?: number): Rectangle; - intersection(rect: Rectangle): Rectangle; - intersects(rect: Rectangle): boolean; - isEmpty(): boolean; - setValues(x?: number, y?: number, width?: number, height?: number): Rectangle; - toString(): string; - union(rect: Rectangle): Rectangle; - } - - - export class Shadow { - constructor(color: string, offsetX: number, offsetY: number, blur: number); - - // properties - blur: number; - color: string; - static identity: Shadow; - offsetX: number; - offsetY: number; - - // methods - clone(): Shadow; - toString(): string; - } - - - export class Shape extends DisplayObject { - constructor(graphics?: Graphics); - - // properties - graphics: Graphics; - - // methods - clone(recursive?: boolean): Shape; - set(props: Object): Shape; - setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Shape; - } - - - export class Sprite extends DisplayObject { - constructor(spriteSheet: SpriteSheet, frameOrAnimation?: string | number); - - // properties - currentAnimation: string; - currentAnimationFrame: number; - currentFrame: number; - framerate: number; - /** - * @deprecated - */ - offset: number; - paused: boolean; - spriteSheet: SpriteSheet; - - // methods - advance(time?: number): void; - clone(): Sprite; - getBounds(): Rectangle; - gotoAndPlay(frameOrAnimation: string | number): void; - gotoAndStop(frameOrAnimation: string | number): void; - play(): void; - set(props: Object): Sprite; - setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Sprite; - stop(): void; - - } - - export class SpriteContainer extends Container - { - constructor(spriteSheet?: SpriteSheet); - - spriteSheet: SpriteSheet; - } - - // what is returned from SpriteSheet.getAnimation(string) - interface SpriteSheetAnimation { - frames: number[]; - speed: number; - name: string; - next: string; - } - - // what is returned from SpriteSheet.getFrame(number) - interface SpriteSheetFrame { - image: HTMLImageElement; - rect: Rectangle; - } - - export class SpriteSheet extends EventDispatcher { - constructor(data: Object); - - // properties - animations: string[]; - complete: boolean; - framerate: number; - - // methods - clone(): SpriteSheet; - getAnimation(name: string): SpriteSheetAnimation; - /** - * @deprecated - use the 'animations' property instead - */ - getAnimations(): string[]; - getFrame(frameIndex: number): SpriteSheetFrame; - getFrameBounds(frameIndex: number, rectangle?: Rectangle): Rectangle; - getNumFrames(animation: string): number; - } - - - export class SpriteSheetBuilder extends EventDispatcher { - constructor(); - - // properties - maxHeight: number; - maxWidth: number; - padding: number; - progress: number; - scale: number; - spriteSheet: SpriteSheet; - timeSlice: number; - - // methods - addAnimation(name: string, frames: number[], next?: string|boolean, frequency?: number): void; - addFrame(source: DisplayObject, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupData?: Object): number; - addMovieClip(source: MovieClip, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupData?: Object, labelFunction?: () => any): void; - build(): SpriteSheet; - buildAsync(timeSlice?: number): void; - clone(): void; // throw error - stopAsync(): void; - } - - export class SpriteSheetUtils { - /** - * @deprecated - */ - static addFlippedFrames(spriteSheet: SpriteSheet, horizontal?: boolean, vertical?: boolean, both?: boolean): void; // deprecated - static extractFrame(spriteSheet: SpriteSheet, frameOrAnimation: number | string): HTMLImageElement; - /** - * @deprecated - */ - static mergeAlpha(rgbImage: HTMLImageElement, alphaImage: HTMLImageElement, canvas?: HTMLCanvasElement): HTMLCanvasElement; // deprecated - } - - export class SpriteStage extends Stage - { - constructor(canvas: HTMLCanvasElement | string, preserveDrawingBuffer?: boolean, antialias?: boolean); - - // properties - static INDICES_PER_BOX: number; - isWebGL: boolean; - static MAX_BOXES_POINTS_INCREMENT: number; - static MAX_INDEX_SIZE: number; - static NUM_VERTEX_PROPERTIES: number; - static NUM_VERTEX_PROPERTIES_PER_BOX: number; - static POINTS_PER_BOX: number; - - // methods - clearImageTexture(image: Object): void; - updateViewport(width: number, height: number): void; - } - - export class Stage extends Container { - constructor(canvas: HTMLCanvasElement | string | Object); - - // properties - autoClear: boolean; - canvas: HTMLCanvasElement | Object; - drawRect: Rectangle; - handleEvent: Function; - mouseInBounds: boolean; - mouseMoveOutside: boolean; - mouseX: number; - mouseY: number; - nextStage: Stage; - /** - * @deprecated - */ - preventSelection: boolean; - snapToPixelEnabled: boolean; // deprecated - tickOnUpdate: boolean; - - // methods - clear(): void; - clone(): Stage; - enableDOMEvents(enable?: boolean): void; - enableMouseOver(frequency?: number): void; - tick(props?: Object): void; - toDataURL(backgroundColor: string, mimeType: string): string; - update(...arg: any[]): void; - - } - - - export class Text extends DisplayObject { - constructor(text?: string, font?: string, color?: string); - - // properties - color: string; - font: string; - lineHeight: number; - lineWidth: number; - maxWidth: number; - outline: number; - text: string; - textAlign: string; - textBaseline: string; - - // methods - clone(): Text; - getMeasuredHeight(): number; - getMeasuredLineHeight(): number; - getMeasuredWidth(): number; - getMetrics(): Object; - set(props: Object): Text; - setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Text; - } - - export class Ticker { - // properties - static framerate: number; - static interval: number; - static maxDelta: number; - static paused: boolean; - static RAF: string; - static RAF_SYNCHED: string; - static TIMEOUT: string; - static timingMode: string; - /** - * @deprecated - */ - static useRAF: boolean; - - // methods - static getEventTime(runTime?: boolean): number; - /** - * @deprecated - use the 'framerate' property instead - */ - static getFPS(): number; - /** - * @deprecated - use the 'interval' property instead - */ - static getInterval(): number; - static getMeasuredFPS(ticks?: number): number; - static getMeasuredTickTime(ticks?: number): number; - /** - * @deprecated - use the 'paused' property instead - */ - static getPaused(): boolean; - static getTicks(pauseable?: boolean): number; - static getTime(runTime?: boolean): number; - static init(): void; - static reset(): void; - /** - * @deprecated - use the 'framerate' property instead - */ - static setFPS(value: number): void; - /** - * @deprecated - use the 'interval' property instead - */ - static setInterval(interval: number): void; - /** - * @deprecated - use the 'paused' property instead - */ - static setPaused(value: boolean): void; - - // EventDispatcher mixins - static addEventListener(type: string, listener: Stage, useCapture?: boolean): Stage; - static addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function; - static addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function; - static addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object; - static addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object; - static dispatchEvent(eventObj: Object | string | Event, target?: Object): boolean; - static hasEventListener(type: string): boolean; - static off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; - static off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; - static off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; - static off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; - static off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" - static on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; - static on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; - static on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; - static on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; - static removeAllEventListeners(type?: string): void; - static removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; - static removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; - static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; - static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; - static removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" - static toString(): string; - static willTrigger(type: string): boolean; - } - - export class TickerEvent { - // properties - target: Object; - type: string; - paused: boolean; - delta: number; - time: number; - runTime: number; - } - - export class Touch { - // methods - static disable(stage: Stage): void; - static enable(stage: Stage, singleTouch?: boolean, allowDefault?: boolean): boolean; - static isSupported(): boolean; - } - - export class UID { - // methods - static get(): number; - } -} +// Type definitions for EaselJS 0.8.0 +// Project: http://www.createjs.com/#!/EaselJS +// Definitions by: Pedro Ferreira , Chris Smith +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + Copyright (c) 2012 Pedro Ferreira + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// Library documentation : http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html + +/// +/// + +// rename the native MouseEvent, to avoid conflict with createjs's MouseEvent +interface NativeMouseEvent extends MouseEvent { + +} + +declare module createjs { + export class AlphaMapFilter extends Filter { + constructor(alphaMap: HTMLImageElement | HTMLCanvasElement); + + // properties + alphaMap: HTMLImageElement | HTMLCanvasElement; + + // methods + clone(): AlphaMapFilter; + } + + export class AlphaMaskFilter extends Filter { + constructor(mask: HTMLImageElement | HTMLCanvasElement); + + // properties + mask: HTMLImageElement | HTMLCanvasElement; + + // methods + clone(): AlphaMaskFilter; + } + + + export class Bitmap extends DisplayObject { + constructor(imageOrUrl: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | string); + + // properties + image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement; + sourceRect: Rectangle; + + // methods + clone(): Bitmap; + } + + + export class BitmapText extends DisplayObject { + constructor(text?:string, spriteSheet?:SpriteSheet); + + static maxPoolSize: number; + + // properties + letterSpacing: number; + lineHeight: number; + spaceWidth: number; + spriteSheet: SpriteSheet; + text: string; + } + + export class BlurFilter extends Filter { + constructor(blurX?: number, blurY?: number, quality?: number); + + // properties + blurX: number; + blurY: number; + quality: number; + + // methods + clone(): BlurFilter; + } + + export class ButtonHelper { + constructor(target: Sprite, outLabel?: string, overLabel?: string, downLabel?: string, play?: boolean, hitArea?: DisplayObject, hitLabel?: string); + constructor(target: MovieClip, outLabel?: string, overLabel?: string, downLabel?: string, play?: boolean, hitArea?: DisplayObject, hitLabel?: string); + + // properties + downLabel: string | number; + outLabel: string | number; + overLabel: string | number; + play: boolean; + target: MovieClip | Sprite; + enabled: boolean; + + // methods + /** + * @deprecated - use the 'enabled' property instead + */ + setEnabled(value: boolean): void; + /** + * @deprecated - use the 'enabled' property instead + */ + getEnabled(): boolean; + toString(): string; + } + + export class ColorFilter extends Filter { + constructor(redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaMultiplier?: number, redOffset?: number, greenOffset?: number, blueOffset?: number, alphaOffset?: number); + + // properties + alphaMultiplier: number; + alphaOffset: number; + blueMultiplier: number; + blueOffset: number; + greenMultiplier: number; + greenOffset: number; + redMultiplier: number; + redOffset: number; + + // methods + clone(): ColorFilter; + } + + export class ColorMatrix { + constructor(brightness?: number, contrast?: number, saturation?: number, hue?: number); + + // methods + adjustBrightness(value: number): ColorMatrix; + adjustColor(brightness: number, contrast: number, saturation: number, hue: number): ColorMatrix; + adjustContrast(value: number): ColorMatrix; + adjustHue(value: number): ColorMatrix; + adjustSaturation(value: number): ColorMatrix; + clone(): ColorMatrix; + concat(...matrix: number[]): ColorMatrix; + concat(matrix: ColorMatrix): ColorMatrix; + copy(...matrix: number[]): ColorMatrix; + copy(matrix: ColorMatrix): ColorMatrix; + reset(): ColorMatrix; + setColor( brightness: number, contrast: number, saturation: number, hue: number ): ColorMatrix; + toArray(): number[]; + toString(): string; + } + + export class ColorMatrixFilter extends Filter { + constructor(matrix: number[] | ColorMatrix); + + // properties + matrix: number[] | ColorMatrix; + + // methods + clone(): ColorMatrixFilter; + } + + + export class Container extends DisplayObject { + constructor(); + + // properties + children: DisplayObject[]; + mouseChildren: boolean; + numChildren: number; + tickChildren: boolean; + + // methods + addChild(...child: DisplayObject[]): DisplayObject; + addChildAt(child: DisplayObject, index: number): DisplayObject; // add this for the common case + addChildAt(...childOrIndex: any[]): DisplayObject; // actually (...child: DisplayObject[], index: number) + clone(recursive?: boolean): Container; + contains(child: DisplayObject): boolean; + getChildAt(index: number): DisplayObject; + getChildByName(name: string): DisplayObject; + getChildIndex(child: DisplayObject): number; + /** + * @deprecated - use numChildren property instead. + */ + getNumChildren(): number; + getObjectsUnderPoint(x: number, y: number, mode: number): DisplayObject[]; + getObjectUnderPoint(x: number, y: number, mode: number): DisplayObject; + removeAllChildren(): void; + removeChild(...child: DisplayObject[]): boolean; + removeChildAt(...index: number[]): boolean; + setChildIndex(child: DisplayObject, index: number): void; + sortChildren(sortFunction: (a: DisplayObject, b: DisplayObject) => number): void; + swapChildren(child1: DisplayObject, child2: DisplayObject): void; + swapChildrenAt(index1: number, index2: number): void; + } + + export class DisplayObject extends EventDispatcher { + constructor(); + + // properties + alpha: number; + cacheCanvas: HTMLCanvasElement | Object; + cacheID: number; + compositeOperation: string; + cursor: string; + filters: Filter[]; + hitArea: DisplayObject; + id: number; + mask: Shape; + mouseEnabled: boolean; + name: string; + parent: Container; + regX: number; + regY: number; + rotation: number; + scaleX: number; + scaleY: number; + shadow: Shadow; + skewX: number; + skewY: number; + snapToPixel: boolean; + stage: Stage; + static suppressCrossDomainErrors: boolean; + tickEnabled: boolean; + transformMatrix: Matrix2D; + visible: boolean; + x: number; + y: number; + + // methods + cache(x: number, y: number, width: number, height: number, scale?: number): void; + clone(): DisplayObject; + draw(ctx: CanvasRenderingContext2D, ignoreCache?: boolean): boolean; + getBounds(): Rectangle; + getCacheDataURL(): string; + getConcatenatedDisplayProps(props?: DisplayProps): DisplayProps; + getConcatenatedMatrix(mtx?: Matrix2D): Matrix2D; + getMatrix(matrix?: Matrix2D): Matrix2D; + /** + * @deprecated + */ + getStage(): Stage; + getTransformedBounds(): Rectangle; + globalToLocal(x: number, y: number, pt?: Point | Object): Point; + hitTest(x: number, y: number): boolean; + isVisible(): boolean; + localToGlobal(x: number, y: number, pt?: Point | Object): Point; + localToLocal(x: number, y: number, target: DisplayObject, pt?: Point | Object): Point; + set(props: Object): DisplayObject; + setBounds(x: number, y: number, width: number, height: number): void; + setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): DisplayObject; + uncache(): void; + updateCache(compositeOperation?: string): void; + updateContext(ctx: CanvasRenderingContext2D): void; + } + + export class DisplayProps { + constructor(visible?: number, alpha?: number, shadow?: number, compositeOperation?: number, matrix?: number); + + // properties + alpha: number; + compositeOperation: string; + matrix: Matrix2D; + shadow: Shadow; + visible: boolean; + + // methods + append(visible: boolean, alpha: number, shadow: Shadow, compositeOperation: string, matrix?: Matrix2D): DisplayProps; + clone(): DisplayProps; + identity(): DisplayProps; + prepend(visible: boolean, alpha: number, shadow: Shadow, compositeOperation: string, matrix?: Matrix2D): DisplayProps; + setValues(visible?: boolean, alpha?: number, shadow?: number, compositeOperation?: number, matrix?: number): DisplayProps; + } + + + export class DOMElement extends DisplayObject { + constructor(htmlElement: HTMLElement); + + // properties + htmlElement: HTMLElement; + + // methods + clone(): DisplayObject; // throw error + set(props: Object): DOMElement; + setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): DOMElement; + } + + + export class EaselJS { + // properties + static buildDate: string; + static version: string; + } + + export class Filter { + constructor(); + + // methods + applyFilter(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, targetCtx?: CanvasRenderingContext2D, targetX?: number, targetY?: number): boolean; + clone(): Filter; + getBounds(): Rectangle; + toString(): string; + } + + export class Graphics { + constructor(); + + // properties + static BASE_64: Object; + static beginCmd: Graphics.BeginPath; + command: Object; + instructions: Object[]; // array of graphics command objects (Graphics.Fill, etc) + static STROKE_CAPS_MAP: string[]; + static STROKE_JOINTS_MAP: string[]; + + // methods + append(command: Object, clean?: boolean): Graphics; + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): Graphics; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics; + beginBitmapFill(image: Object, repetition?: string, matrix?: Matrix2D): Graphics; + beginBitmapStroke(image: Object, repetition?: string): Graphics; + beginFill(color: string): Graphics; + beginLinearGradientFill(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; + beginLinearGradientStroke(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; + beginRadialGradientFill(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; + beginRadialGradientStroke(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; + beginStroke(color: string): Graphics; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): Graphics; + clear(): Graphics; + clone(): Graphics; + closePath(): Graphics; + curveTo(cpx: number, cpy: number, x: number, y: number): Graphics; + decodePath(str: string): Graphics; + draw(ctx: CanvasRenderingContext2D): void; + drawAsPath(ctx: CanvasRenderingContext2D): void; + drawCircle(x: number, y: number, radius: number): Graphics; + drawEllipse(x: number, y: number, w: number, h: number): Graphics; + drawPolyStar(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number): Graphics; + drawRect(x: number, y: number, w: number, h: number): Graphics; + drawRoundRect(x: number, y: number, w: number, h: number, radius: number): Graphics; + drawRoundRectComplex(x: number, y: number, w: number, h: number, radiusTL: number, radiusTR: number, radiusBR: number, radisBL: number): Graphics; + endFill(): Graphics; + endStroke(): Graphics; + static getHSL(hue: number, saturation: number, lightness: number, alpha?: number): string; + /** + * @deprecated - use the instructions property instead + */ + getInstructions(): Object[]; + static getRGB(r: number, g: number, b: number, alpha?: number): string; + inject(callback: (data: any) => any, data: any): Graphics; // deprecated + isEmpty(): boolean; + lineTo(x: number, y: number): Graphics; + moveTo(x: number, y: number): Graphics; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): Graphics; + rect(x: number, y: number, w: number, h: number): Graphics; + setStrokeStyle(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; + setStrokeDash(segments?: number[], offset?: number): Graphics; + store(): Graphics; + toString(): string; + unstore(): Graphics; + + + // tiny API - short forms of methods above + a(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): Graphics; + at(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics; + bf(image: Object, repetition?: string, matrix?: Matrix2D): Graphics; + bs(image: Object, repetition?: string): Graphics; + f(color: string): Graphics; + lf(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; + ls(colors: string[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Graphics; + rf(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; + rs(colors: string[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Graphics; + s(color: string): Graphics; + bt(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): Graphics; + c(): Graphics; + cp(): Graphics; + p(str: string): Graphics; + dc(x: number, y: number, radius: number): Graphics; + de(x: number, y: number, w: number, h: number): Graphics; + dp(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number): Graphics; + dr(x: number, y: number, w: number, h: number): Graphics; + rr(x: number, y: number, w: number, h: number, radius: number): Graphics; + rc(x: number, y: number, w: number, h: number, radiusTL: number, radiusTR: number, radiusBR: number, radisBL: number): Graphics; + ef(): Graphics; + es(): Graphics; + lt(x: number, y: number): Graphics; + mt(x: number, y: number): Graphics; + qt(cpx: number, cpy: number, x: number, y: number): Graphics; + r(x: number, y: number, w: number, h: number): Graphics; + ss(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; + sd(segments?: number[], offset?: number): Graphics; + } + + + module Graphics + { + export class Arc + { + constructor(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise: number); + + // properties + anticlockwise: number; + endAngle: number; + radius: number; + startAngle: number; + x: number; + y: number; + } + + export class ArcTo + { + constructor(x1: number, y1: number, x2: number, y2: number, radius: number); + + // properties + x1: number; + y1: number; + x2: number; + y2: number; + radius: number; + } + + export class BeginPath + { + + } + + export class BezierCurveTo + { + constructor(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number); + + // properties + cp1x: number; + cp1y: number; + cp2x: number; + cp2y: number; + x: number; + y: number; + } + + export class Circle + { + constructor(x: number, y: number, radius: number); + + // properties + x: number; + y: number; + radius: number; + } + + export class ClosePath + { + + } + + export class Fill + { + constructor(style: Object, matrix?: Matrix2D); + + // properties + style: Object; + matrix: Matrix2D; + + // methods + bitmap(image: HTMLImageElement, repetition?: string): Fill; + linearGradient(colors: number[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Fill; + radialGradient(colors: number[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Fill; + } + + export class LineTo + { + constructor(x: number, y: number); + + // properties + x: number; + y: number; + } + + export class MoveTo + { + constructor(x: number, y: number); + + x: number; + y: number; + } + + export class PolyStar + { + constructor(x: number, y: number, radius: number, sides: number, pointSize: number, angle: number); + + // properties + angle: number; + pointSize: number; + radius: number; + sides: number; + x: number; + y: number; + } + + export class QuadraticCurveTo + { + constructor(cpx: number, cpy: number, x: number, y: number); + + // properties + cpx: number; + cpy: number; + x: number; + y: number; + } + + export class Rect + { + constructor(x: number, y: number, w: number, h: number); + + // properties + x: number; + y: number; + w: number; + h: number; + } + + export class RoundRect + { + constructor(x: number, y: number, w: number, h: number, radiusTL: number, radiusTR: number, radiusBR: number, radiusBL: number); + + // properties + x: number; + y: number; + w: number; + h: number; + radiusTL: number; + radiusTR: number; + radiusBR: number; + radiusBL: number; + } + + export class Stroke + { + constructor(style: Object, ignoreScale: boolean); + + // properties + style: Object; + ignoreScale: boolean; + + // methods + bitmap(image: HTMLImageElement, repetition?: string): Stroke; + linearGradient(colors: number[], ratios: number[], x0: number, y0: number, x1: number, y1: number): Stroke; + radialGradient(colors: number[], ratios: number[], x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Stroke; + } + + export class StrokeStyle + { + constructor(width: number, caps: string, joints: number, miterLimit: number); + + // properties + caps: string; + joints: string; + miterLimit: number; + width: number; + } + } + + + + export class Matrix2D { + constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number); + + // properties + a: number; + b: number; + c: number; + d: number; + static DEG_TO_RAD: number; + static identity: Matrix2D; + tx: number; + ty: number; + + // methods + append(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; + appendMatrix(matrix: Matrix2D): Matrix2D; + appendTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D; + clone(): Matrix2D; + copy(matrix: Matrix2D): Matrix2D; + decompose(): {x: number; y: number; scaleX: number; scaleY: number; rotation: number; skewX: number; skewY: number}; + decompose(target: Object): Matrix2D; + equals(matrix: Matrix2D): boolean; + identity(): Matrix2D; + invert(): Matrix2D; + isIdentity(): boolean; + prepend(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix2D; + prependMatrix(matrix: Matrix2D): Matrix2D; + prependTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D; + rotate(angle: number): Matrix2D; + scale(x: number, y: number): Matrix2D; + setValues(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): Matrix2D; + skew(skewX: number, skewY: number): Matrix2D; + toString(): string; + transformPoint(x: number, y: number, pt?: Point | Object): Point; + translate(x: number, y: number): Matrix2D; + } + + + export class MouseEvent extends Event { + constructor(type: string, bubbles: boolean, cancelable: boolean, stageX: number, stageY: number, nativeEvent: NativeMouseEvent, pointerID: number, primary: boolean, rawX: number, rawY: number); + + // properties + isTouch: boolean; + localX: number; + localY: number; + nativeEvent: NativeMouseEvent; + pointerID: number; + primary: boolean; + rawX: number; + rawY: number; + stageX: number; + stageY: number; + mouseMoveOutside: boolean; + + // methods + clone(): MouseEvent; + + // EventDispatcher mixins + addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function; + addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function; + addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object; + addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object; + dispatchEvent(eventObj: Object | string | Event, target?: Object): boolean; + hasEventListener(type: string): boolean; + off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; + off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; + off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; + off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; + off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" + on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; + on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; + on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; + on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; + removeAllEventListeners(type?: string): void; + removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; + removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; + removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; + removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; + removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" + toString(): string; + willTrigger(type: string): boolean; + } + + + export class MovieClip extends Container { + constructor(mode?: string, startPosition?: number, loop?: boolean, labels?: Object); + + // properties + actionsEnabled: boolean; + autoReset: boolean; + static buildDate: string; + currentFrame: number; + currentLabel: string; + frameBounds: Rectangle[]; + framerate: number; + static INDEPENDENT: string; + labels: Object[]; + loop: boolean; + mode: string; + paused: boolean; + static SINGLE_FRAME: string; + startPosition: number; + static SYNCHED: string; + timeline: Timeline; + static version: string; + + // methods + advance(time?: number): void; + clone(): MovieClip; // not supported + /** + * @deprecated - use 'currentLabel' property instead + */ + getCurrentLabel(): string; // deprecated + /** + * @deprecated - use 'labels' property instead + */ + getLabels(): Object[]; + gotoAndPlay(positionOrLabel: string | number): void; + gotoAndStop(positionOrLabel: string | number): void; + play(): void; + stop(): void; + } + + export class MovieClipPlugin { + // methods + tween(tween: Tween, prop: string, value: string | number | boolean, startValues: any[], endValues: any[], ratio: number, wait: Object, end: Object): void; + } + + export class Point { + constructor(x?: number, y?: number); + + // properties + x: number; + y: number; + + // methods + clone(): Point; + copy(point: Point): Point; + setValues(x?: number, y?: number): Point; + toString(): string; + } + + export class Rectangle { + constructor(x?: number, y?: number, width?: number, height?: number); + + // properties + height: number; + width: number; + x: number; + y: number; + + // methods + clone(): Rectangle; + contains(x: number, y: number, width?: number, height?: number): boolean; + copy(rectangle: Rectangle): Rectangle; + extend(x: number, y: number, width?: number, height?: number): Rectangle; + intersection(rect: Rectangle): Rectangle; + intersects(rect: Rectangle): boolean; + isEmpty(): boolean; + setValues(x?: number, y?: number, width?: number, height?: number): Rectangle; + toString(): string; + union(rect: Rectangle): Rectangle; + } + + + export class Shadow { + constructor(color: string, offsetX: number, offsetY: number, blur: number); + + // properties + blur: number; + color: string; + static identity: Shadow; + offsetX: number; + offsetY: number; + + // methods + clone(): Shadow; + toString(): string; + } + + + export class Shape extends DisplayObject { + constructor(graphics?: Graphics); + + // properties + graphics: Graphics; + + // methods + clone(recursive?: boolean): Shape; + set(props: Object): Shape; + setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Shape; + } + + + export class Sprite extends DisplayObject { + constructor(spriteSheet: SpriteSheet, frameOrAnimation?: string | number); + + // properties + currentAnimation: string; + currentAnimationFrame: number; + currentFrame: number; + framerate: number; + /** + * @deprecated + */ + offset: number; + paused: boolean; + spriteSheet: SpriteSheet; + + // methods + advance(time?: number): void; + clone(): Sprite; + getBounds(): Rectangle; + gotoAndPlay(frameOrAnimation: string | number): void; + gotoAndStop(frameOrAnimation: string | number): void; + play(): void; + set(props: Object): Sprite; + setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Sprite; + stop(): void; + + } + + export class SpriteContainer extends Container + { + constructor(spriteSheet?: SpriteSheet); + + spriteSheet: SpriteSheet; + } + + // what is returned from SpriteSheet.getAnimation(string) + interface SpriteSheetAnimation { + frames: number[]; + speed: number; + name: string; + next: string; + } + + // what is returned from SpriteSheet.getFrame(number) + interface SpriteSheetFrame { + image: HTMLImageElement; + rect: Rectangle; + } + + export class SpriteSheet extends EventDispatcher { + constructor(data: Object); + + // properties + animations: string[]; + complete: boolean; + framerate: number; + + // methods + clone(): SpriteSheet; + getAnimation(name: string): SpriteSheetAnimation; + /** + * @deprecated - use the 'animations' property instead + */ + getAnimations(): string[]; + getFrame(frameIndex: number): SpriteSheetFrame; + getFrameBounds(frameIndex: number, rectangle?: Rectangle): Rectangle; + getNumFrames(animation: string): number; + } + + + export class SpriteSheetBuilder extends EventDispatcher { + constructor(); + + // properties + maxHeight: number; + maxWidth: number; + padding: number; + progress: number; + scale: number; + spriteSheet: SpriteSheet; + timeSlice: number; + + // methods + addAnimation(name: string, frames: number[], next?: string|boolean, frequency?: number): void; + addFrame(source: DisplayObject, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupData?: Object): number; + addMovieClip(source: MovieClip, sourceRect?: Rectangle, scale?: number, setupFunction?: () => any, setupData?: Object, labelFunction?: () => any): void; + build(): SpriteSheet; + buildAsync(timeSlice?: number): void; + clone(): void; // throw error + stopAsync(): void; + } + + export class SpriteSheetUtils { + /** + * @deprecated + */ + static addFlippedFrames(spriteSheet: SpriteSheet, horizontal?: boolean, vertical?: boolean, both?: boolean): void; // deprecated + static extractFrame(spriteSheet: SpriteSheet, frameOrAnimation: number | string): HTMLImageElement; + /** + * @deprecated + */ + static mergeAlpha(rgbImage: HTMLImageElement, alphaImage: HTMLImageElement, canvas?: HTMLCanvasElement): HTMLCanvasElement; // deprecated + } + + export class SpriteStage extends Stage + { + constructor(canvas: HTMLCanvasElement | string, preserveDrawingBuffer?: boolean, antialias?: boolean); + + // properties + static INDICES_PER_BOX: number; + isWebGL: boolean; + static MAX_BOXES_POINTS_INCREMENT: number; + static MAX_INDEX_SIZE: number; + static NUM_VERTEX_PROPERTIES: number; + static NUM_VERTEX_PROPERTIES_PER_BOX: number; + static POINTS_PER_BOX: number; + + // methods + clearImageTexture(image: Object): void; + updateViewport(width: number, height: number): void; + } + + export class Stage extends Container { + constructor(canvas: HTMLCanvasElement | string | Object); + + // properties + autoClear: boolean; + canvas: HTMLCanvasElement | Object; + drawRect: Rectangle; + handleEvent: Function; + mouseInBounds: boolean; + mouseMoveOutside: boolean; + mouseX: number; + mouseY: number; + nextStage: Stage; + /** + * @deprecated + */ + preventSelection: boolean; + snapToPixelEnabled: boolean; // deprecated + tickOnUpdate: boolean; + + // methods + clear(): void; + clone(): Stage; + enableDOMEvents(enable?: boolean): void; + enableMouseOver(frequency?: number): void; + tick(props?: Object): void; + toDataURL(backgroundColor: string, mimeType: string): string; + update(...arg: any[]): void; + + } + + + export class Text extends DisplayObject { + constructor(text?: string, font?: string, color?: string); + + // properties + color: string; + font: string; + lineHeight: number; + lineWidth: number; + maxWidth: number; + outline: number; + text: string; + textAlign: string; + textBaseline: string; + + // methods + clone(): Text; + getMeasuredHeight(): number; + getMeasuredLineHeight(): number; + getMeasuredWidth(): number; + getMetrics(): Object; + set(props: Object): Text; + setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, regX?: number, regY?: number): Text; + } + + export class Ticker { + // properties + static framerate: number; + static interval: number; + static maxDelta: number; + static paused: boolean; + static RAF: string; + static RAF_SYNCHED: string; + static TIMEOUT: string; + static timingMode: string; + /** + * @deprecated + */ + static useRAF: boolean; + + // methods + static getEventTime(runTime?: boolean): number; + /** + * @deprecated - use the 'framerate' property instead + */ + static getFPS(): number; + /** + * @deprecated - use the 'interval' property instead + */ + static getInterval(): number; + static getMeasuredFPS(ticks?: number): number; + static getMeasuredTickTime(ticks?: number): number; + /** + * @deprecated - use the 'paused' property instead + */ + static getPaused(): boolean; + static getTicks(pauseable?: boolean): number; + static getTime(runTime?: boolean): number; + static init(): void; + static reset(): void; + /** + * @deprecated - use the 'framerate' property instead + */ + static setFPS(value: number): void; + /** + * @deprecated - use the 'interval' property instead + */ + static setInterval(interval: number): void; + /** + * @deprecated - use the 'paused' property instead + */ + static setPaused(value: boolean): void; + + // EventDispatcher mixins + static addEventListener(type: string, listener: Stage, useCapture?: boolean): Stage; + static addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function; + static addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function; + static addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object; + static addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object; + static dispatchEvent(eventObj: Object | string | Event, target?: Object): boolean; + static hasEventListener(type: string): boolean; + static off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; + static off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; + static off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; + static off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; + static off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" + static on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; + static on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; + static on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; + static on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object; + static removeAllEventListeners(type?: string): void; + static removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void; + static removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void; + static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void; + static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void; + static removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee" + static toString(): string; + static willTrigger(type: string): boolean; + } + + export class TickerEvent { + // properties + target: Object; + type: string; + paused: boolean; + delta: number; + time: number; + runTime: number; + } + + export class Touch { + // methods + static disable(stage: Stage): void; + static enable(stage: Stage, singleTouch?: boolean, allowDefault?: boolean): boolean; + static isSupported(): boolean; + } + + export class UID { + // methods + static get(): number; + } +} diff --git a/electron-packager/electron-packager.d.ts b/electron-packager/electron-packager.d.ts index a25e89fc8..54e816250 100644 --- a/electron-packager/electron-packager.d.ts +++ b/electron-packager/electron-packager.d.ts @@ -81,12 +81,12 @@ declare namespace ElectronPackager { /** Electron-packager done callback. */ export interface Callback { /** - * Callback wich is called when electron-packager is done. + * Callback which is called when electron-packager is done. * * @param err - Contains errors if any. - * @param appPath - Path to the newly created application. + * @param appPath - Path(s) to the newly created application(s). */ - (err: Error, appPath: string): void + (err: Error, appPath: string|string[]): void } /** Electron-packager function */ diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index 0980ac26c..ac4f92d3d 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -68,6 +68,9 @@ promiseNumber = thenWithUndefinedFullFillAndPromiseReject; var thenWithNoResultAndNoReject = promiseString.then(); promiseNumber = thenWithNoResultAndNoReject; +var catchAfterThen = promiseString.then().catch(); +promiseNumber = catchAfterThen; + var voidPromise = new Promise(function (resolve) { resolve(); }); //catch test @@ -161,31 +164,31 @@ getJSON('story.json').then(function(story: Story) { (document.querySelector('.spinner')).style.display = 'none'; }); -interface T1 { - __t1: string; -} - -interface T2 { - __t2: string; -} - -interface T3 { - __t3: string; -} - -function f1(): Promise { - return Promise.resolve({ __t1: "foo_t1" }); -} - -function f2(x: T1): T2 { - return { __t2: x.__t1 + ":foo_21" }; -} - -var x3 = f1() - .then(f2, (e: Error) => { - console.log("error 1"); - throw e; -}) - .then((x: T2) => { - return { __t3: x.__t2 + "bar" }; +interface T1 { + __t1: string; +} + +interface T2 { + __t2: string; +} + +interface T3 { + __t3: string; +} + +function f1(): Promise { + return Promise.resolve({ __t1: "foo_t1" }); +} + +function f2(x: T1): T2 { + return { __t2: x.__t1 + ":foo_21" }; +} + +var x3 = f1() + .then(f2, (e: Error) => { + console.log("error 1"); + throw e; +}) + .then((x: T2) => { + return { __t3: x.__t2 + "bar" }; }); \ No newline at end of file diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index daf7134f7..a8f8d7845 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -6,6 +6,7 @@ interface Thenable { then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; + catch(onRejected?: (error: any) => U | Thenable): Thenable; } declare class Promise implements Thenable { diff --git a/expect/expect-tests.ts b/expect/expect-tests.ts new file mode 100644 index 000000000..a0d2bf792 --- /dev/null +++ b/expect/expect-tests.ts @@ -0,0 +1,695 @@ +/// +/// + +import expect, + {Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies} + from 'expect'; + +describe('chaining assertions', function () { + it('should allow chaining for array-like applications', function () { + expect([ 1, 2, 'foo', 3 ]) + .toExist() + .toBeAn(Array) + .toInclude('foo') + .toExclude('bar') + }) + + it('should allow chaining for number checking', function () { + expect(3.14) + .toExist() + .toBeLessThan(4.2) + .toBeGreaterThan(3.0) + }) +}) +describe('createSpy', function () { + describe('when given a function', function () { + it('returns a spy function', function () { + const spy = createSpy(function () {}) + expect(spy).toBeA(Function) + }) + }) +}) + +describe('A spy', function () { + let targetContext:any, targetArguments:any; + const target = { + method: function () { + targetContext = this + targetArguments = Array.prototype.slice.call(arguments, 0) + } + } + + let spy:any; + + it('is a spy', function () { + expect(isSpy(spy)).toBe(true) + }) + + it('has a destroy method', function () { + expect(spy.destroy).toBeA(Function) + }) + + it('has a restore method', function () { + expect(spy.restore).toBeA(Function) + }) + + it('knows how many times it has been called', function () { + spy() + spy() + expect(spy.calls.length).toEqual(2) + }) + + it('knows the arguments it was called with', function () { + spy(1, 2, 3) + expect(spy).toHaveBeenCalledWith(1, 2, 3) + }) + + describe('that calls some other function', function () { + let otherContext:any, otherArguments:any; + function otherFn() { + otherContext = this + otherArguments = Array.prototype.slice.call(arguments, 0) + } + + beforeEach(function () { + spy.andCall(otherFn) + otherContext = otherArguments = null + }) + + it('calls that function', function () { + spy() + expect(otherContext).toNotBe(null) + }) + + it('uses the correct context', function () { + const context = {} + spy.call(context) + expect(otherContext).toBe(context) + }) + + it('passes the arguments through', function () { + spy(1, 2, 3) + expect(otherArguments).toEqual([ 1, 2, 3 ]) + }) + }) + + describe('that calls through', function () { + beforeEach(function () { + spy.andCallThrough() + }) + + it('calls the original function', function () { + spy() + expect(targetContext).toNotBe(null) + }) + + it('uses the correct context', function () { + const context = {} + spy.call(context) + expect(targetContext).toBe(context) + }) + + it('passes the arguments through', function () { + spy(1, 2, 3) + expect(targetArguments).toEqual([ 1, 2, 3 ]) + }) + }) + + describe('with a thrown value', function () { + beforeEach(function () { + spy.andThrow('hello') + }) + + it('throws the correct value', function () { + expect(spy).toThrow('hello') + }) + }) + + describe('with a return value', function () { + beforeEach(function () { + spy.andReturn('hello') + }) + + it('returns the correct value', function () { + expect(spy()).toEqual('hello') + }) + }) +}) +describe('expect.extend', function () { + const ColorAssertions:Extension = { + toBeAColor() { + assert( + this.actual.match(/^#[a-fA-F0-9]{6}$/), + 'expected %s to be an HTML color', + this.actual + ) + } + } + + let assertSpy:Spy; + beforeEach(function () { + extend(ColorAssertions) + assertSpy = spyOn(expect, 'assert') + }) + + afterEach(function () { + assertSpy.restore() + }) + + it('works', function () { + interface ColorExpectation extends Expectation { + toBeAColor():Expectation; + } + (expect('#ff00ff')).toBeAColor() + expect(assertSpy).toHaveBeenCalled() + }) +}) + +describe('restoreSpies', function () { + describe('with one spy', function () { + const original = function () {} + const target = { method: original } + + beforeEach(function () { + spyOn(target, 'method') + }) + + it('works with spyOn()', function () { + expect(target.method).toNotEqual(original) + restoreSpies() + expect(target.method).toEqual(original) + }) + + it('is idempotent', function () { + expect(target.method).toNotEqual(original) + restoreSpies() + restoreSpies() + expect(target.method).toEqual(original) + }) + + it('can work even on createSpy()', function () { + createSpy(original) + restoreSpies() + }) + }) + + describe('with multiple spies', function () { + const originals = [ function () {}, function () {} ] + const targets = [ + { method: originals[0] }, + { method: originals[1] } + ] + + it('still works', function () { + spyOn(targets[0], 'method') + spyOn(targets[1], 'method') + + expect(targets[0].method).toNotEqual(originals[0]) + expect(targets[1].method).toNotEqual(originals[1]) + + restoreSpies() + + expect(targets[0].method).toEqual(originals[0]) + expect(targets[1].method).toEqual(originals[1]) + }) + }) +}) + +describe('A function that was spied on', function () { + const video = { + play: function () {} + } + + let spy:Spy; + beforeEach(function () { + spy = spyOn(video, 'play') + }) + + it('tracks the number of calls', function () { + expect(spy.calls.length).toEqual(1) + }) + + it('tracks the context that was used', function () { + expect(spy.calls[0].context).toBe(video) + }) + + it('tracks the arguments that were used', function () { + expect(spy.calls[0].arguments).toEqual([ 'some', 'args' ]) + }) + + it('was called', function () { + expect(spy).toHaveBeenCalled() + }) + + it('was called with the correct args', function () { + expect(spy).toHaveBeenCalledWith('some', 'args') + }) + + it('can be restored', function () { + expect(video.play).toEqual(spy) + spy.restore() + expect(video.play).toNotEqual(spy) + }) +}) + +describe('A function that was spied on but not called', function () { + const video = { + play: function () {} + } + + let spy:Spy; + beforeEach(function () { + spy = spyOn(video, 'play') + }) + + it('number of calls to be zero', function () { + expect(spy.calls.length).toEqual(0) + }) + + it('was not called', function () { + expect(spy).toNotHaveBeenCalled() + }) +}) + +describe('toBeA', function () { + it('requires the value to be a function or string', function () { + expect(function () { + expect('actual').toBeA(4) + }).toThrow(/must be a function or a string/) + }) + + it('does not throw when the actual value is an instanceof the constructor', function () { + expect(function () { + expect(new Expectation('foo')).toBeA(Expectation) + }).toNotThrow() + }) + + it('throws when the actual value is not an instanceof the constructor', function () { + expect(function () { + expect('actual').toBeA(Expectation) + }).toThrow(/to be/) + }) + + it('does not throw when the expected value is the typeof the actual value', function () { + expect(function () { + expect(4).toBeA('number') + expect(NaN).toBeA('number') // hahaha + }).toNotThrow() + }) + + it('throws when the expected value is not the typeof the actual value', function () { + expect(function () { + expect('actual').toBeA('number') + }).toThrow(/to be/) + }) + + it('does not throw when the actual value is an array', function () { + expect(function () { + expect([]).toBeAn('array') + }).toNotThrow() + }) + + it('throws when the actual value is not an array', function () { + expect(function () { + expect('actual').toBeAn('array') + }).toThrow(/to be/) + }) +}) + +describe('toBeGreaterThan', function () { + it('does not throw when the actual value is greater than the expected value', function () { + expect(function () { + expect(3).toBeGreaterThan(2) + }).toNotThrow() + }) + + it('throws when the actual value is not greater than the expected value', function () { + expect(function () { + expect(2).toBeGreaterThan(3) + }).toThrow(/to be greater than/) + }) +}) + + +describe('toBeLessThan', function () { + it('does not throw when the actual value is less than the expected value', function () { + expect(function () { + expect(2).toBeLessThan(3) + }).toNotThrow() + }) + + it('throws when the actual value is not less than the expected value', function () { + expect(function () { + expect(3).toBeLessThan(2) + }).toThrow(/to be less than/) + }) +}) + +describe('toBeTruthy', function () { + it('does not throw on truthy actual values', function () { + expect(function () { + expect(1).toBeTruthy() + expect({ hello: 'world' }).toBeTruthy() + expect([ 1, 2, 3 ]).toBeTruthy() + }).toNotThrow() + }) + + it('throws on falsy actual values', function () { + expect(function () { + expect(0).toBeTruthy() + }).toThrow() + + expect(function () { + expect(null).toBeTruthy() + }).toThrow() + + expect(function () { + expect(undefined).toBeTruthy() + }).toThrow() + }) +}) + +describe('toBeFalsy', function () { + it('throws on truthy values', function () { + expect(function () { + expect(42).toBeFalsy() + }).toThrow() + + expect(function () { + expect({ foo: 'bar' }).toBeFalsy() + }).toThrow() + + expect(function () { + expect([]).toBeFalsy() + }).toThrow() + }) + + it('does not throw with falsy actual values', function () { + expect(function () { + expect(0).toBeFalsy() + expect(null).toBeFalsy() + expect(undefined).toBeFalsy() + }).toNotThrow() + }) +}) + +describe('toEqual', function () { + it('works', function () { + expect(function () { + expect('actual').toEqual('expected') + }).toThrow(/Expected 'actual' to equal 'expected'/) + }) + + it('works with objects that have the same keys in different order', function () { + const a = { a: 'a', b: 'b', c: 'c' } + const b = { b: 'b', c: 'c', a: 'a' } + expect(a).toEqual(b) + }) + + it('shows diff', function () { + try { + expect('actual').toEqual('expected') + } catch (err) { + expect(err.actual).toEqual('actual') + expect(err.expected).toEqual('expected') + expect(err.showDiff).toEqual(true) + } + }) +}) + +describe('toExclude', function () { + it('requires the actual value to be an array or string', function () { + expect(function () { + expect(1).toExclude(2) + }).toThrow(/must be an array or a string/) + }) + + it('does not throw when an array does not contain the expected value', function () { + expect(function () { + expect([ 1, 2, 3 ]).toExclude(4) + }).toNotThrow() + }) + + it('throws when an array contains the expected value', function () { + expect(function () { + expect([ 1, 2, 3 ]).toExclude(2) + }).toThrow(/to exclude/) + }) + + it('does not throw when an array does not contain the expected value', function () { + expect(function () { + expect('hello world').toExclude('goodbye') + }).toNotThrow() + }) + + it('throws when a string contains the expected value', function () { + expect(function () { + expect('hello world').toExclude('hello') + }).toThrow(/to exclude/) + }) +}) + +describe('toExist', function () { + it('does not throw on truthy actual values', function () { + expect(function () { + expect(1).toExist() + expect({ 'hello': 'world' }).toExist() + expect([ 1, 2, 3 ]).toExist() + }).toNotThrow() + }) + + it('throws on falsy actual values', function () { + expect(function () { + expect(0).toExist() + }).toThrow() + + expect(function () { + expect(null).toExist() + }).toThrow() + + expect(function () { + expect(undefined).toExist() + }).toThrow() + }) +}) + +describe('toNotExist', function () { + it('throws on truthy values', function () { + expect(function () { + expect(42).toNotExist() + }).toThrow() + + expect(function () { + expect({ foo: 'bar' }).toNotExist() + }).toThrow() + + expect(function () { + expect([]).toNotExist() + }).toThrow() + }) + + it('does not throw with falsy actual values', function () { + expect(function () { + expect(0).toNotExist() + expect(null).toNotExist() + expect(undefined).toNotExist() + }).toNotThrow() + }) +}) + +describe('toInclude', function () { + it('requires the actual value to be an array or string', function () { + expect(function () { + expect(1).toInclude(2) + }).toThrow(/must be an array or a string/) + }) + + it('does not throw when an array contains an expected integer', function () { + expect(function () { + expect([ 1, 2, 3 ]).toInclude(2) + expect([ { a: 1 }, { c: 2 } ]).toInclude({ c: 2 }) + }).toNotThrow() + }) + + it('does not throw when an array contains an expected object', function () { + expect(function () { + expect([ { a: 1 }, { c: 2 } ]).toInclude({ c: 2 }) + }).toNotThrow() + }) + + it('throws when an array does not contain an expected integer', function () { + expect(function () { + expect([ 1, 2, 3 ]).toInclude(4) + }).toThrow(/to include/) + }) + + it('throws when an array does not contain an expected object', function () { + expect(function () { + expect([ { a: 1 }, { c: 2 } ]).toInclude({ a: 2 }) + }).toThrow(/to include/) + }) + + it('does not throw when a string contains the expected value', function () { + expect(function () { + expect('hello world').toInclude('world') + }).toNotThrow() + }) + + it('throws when a string does not contain the expected value', function () { + expect(function () { + expect('hello world').toInclude('goodbye') + }).toThrow(/to include/) + }) +}) + +describe('toMatch', function () { + it('requires the pattern to be a RegExp', function () { + expect(function () { + expect('actual').toMatch('expected') + }).toThrow(/must be a RegExp/) + }) + + it('does not throw when the actual value matches the pattern', function () { + expect(function () { + expect('actual').toMatch(/^actual$/) + }).toNotThrow() + }) + + it('throws when the actual value does not match the pattern', function () { + expect(function () { + expect('actual').toMatch(/nope/) + }).toThrow(/to match/) + }) +}) + +describe('toNotMatch', function () { + it('requires the pattern to be a RegExp', function () { + expect(function () { + expect('actual').toNotMatch('expected') + }).toThrow(/must be a RegExp/) + }) + + it('does not throw when the actual value does not match the pattern', function () { + expect(function () { + expect('actual').toNotMatch(/nope/) + }).toNotThrow() + }) + + it('throws when the actual value matches the pattern', function () { + expect(function () { + expect('actual').toNotMatch(/^actual$/) + }).toThrow(/to not match/) + }) +}) + +describe('toNotEqual', function () { + it('works with arrays of objects', function () { + const a = [ + { + id: 0, + text: 'Array Object 0', + boo: false + }, + { + id: 1, + text: 'Array Object 1', + boo: false + } + ] + + const b = [ + { + id: 0, + text: 'Array Object 0', + boo: true // value of boo is changed to true here + }, + { + id: 1, + text: 'Array Object 1', + boo: false + } + ] + + expect(a).toNotEqual(b) + }) + + if (typeof Map !== 'undefined') { + it('works with Map', function () { + const a = new Map() + a.set('key', 'value') + + const b = new Map() + b.set('key', 'another value') + + expect(a).toNotEqual(b) + }) + } + + if (typeof Set !== 'undefined') { + it('works with Set', function () { + const a = new Set() + a.add('a') + + const b = new Set() + b.add('b') + + expect(a).toNotEqual(b) + }) + } +}) + +describe('withArgs', function () { + const fn = function (arg1:any, arg2:any) { + if (arg1 === 'first' && typeof arg2 === 'undefined') { + throw new Error('first arg found') + } + if (arg1 === 'first' && arg2 === 'second') { + throw new Error('both args found') + } + } + + it('invokes actual function with args', function () { + expect(function () { + expect(fn).withArgs('first').toThrow(/first arg found/) + }).toNotThrow() + }) + + it('can be chained', function () { + expect(function () { + expect(fn).withArgs('first').withArgs('second').toThrow(/both args found/) + }).toNotThrow() + }) + + it('throws when actual is not a function', function () { + expect(function () { + expect('not a function').withArgs('first') + }).toThrow(/must be a function/) + }) +}) + +describe('withContext', function () { + const context = { + check: true + } + const fn = function (arg:any) { + if (this.check && typeof arg === 'undefined') { + throw new Error('context found') + } + if (this.check && arg === 'good') { + throw new Error('context and args found') + } + } + + it('calls function with context', function () { + expect(function () { + expect(fn).withContext(context).toThrow(/context found/) + }).toNotThrow() + }) + + it('calls function with context and args', function () { + expect(function () { + expect(fn).withContext(context).withArgs('good').toThrow(/context and args found/) + }).toNotThrow() + }) + +}) diff --git a/expect/expect-tests.ts.tscparams b/expect/expect-tests.ts.tscparams new file mode 100644 index 000000000..a0f279051 --- /dev/null +++ b/expect/expect-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --target es6 diff --git a/expect/expect.d.ts b/expect/expect.d.ts new file mode 100644 index 000000000..2566c79fa --- /dev/null +++ b/expect/expect.d.ts @@ -0,0 +1,71 @@ +// Type definitions for Expect v1.13.4 +// Project: https://github.com/mjackson/expect +// Definitions by: Justin Reidy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "expect" { + export class Expectation { + constructor(actual:any); + toExist(message?:string):Expectation; + toBeTruthy(message?:string):Expectation; + toNotExist(message?:string):Expectation; + toBeFalsy(message?:string):Expectation; + toBe(value:any, message?:string):Expectation; + toNotBe(value:any, message?:string):Expectation; + toEqual(value:any, message?:string):Expectation; + toNotEqual(value:any, message?:string):Expectation; + toThrow(value?:any, message?:string):Expectation; + toNotThrow(value?:any, message?:string):Expectation; + toBeA(value:any, message?:string):Expectation; + toBeAn(value:any, message?:string):Expectation; + toNotBeA(value:any, message?:string):Expectation; + toNotBeAn(value:any, message?:string):Expectation; + toMatch(value:any, message?:string):Expectation; + toNotMatch(value:any, message?:string):Expectation; + toBeLessThan(value:any, message?:string):Expectation; + toBeFewerThan(value:any, message?:string):Expectation; + toBeGreaterThan(value:any, message?:string):Expectation; + toBeMoreThan(value:any, message?:string):Expectation; + toInclude(value:any, compareValues?:any, message?:string):Expectation; + toContain(value:any, compareValues?:any, message?:string):Expectation; + toExclude(value:any, compareValues?:any, message?:string):Expectation; + toNotContain(value:any, compareValues?:any, message?:string):Expectation; + toHaveBeenCalled(message?:string):Expectation; + toHaveBeenCalledWith(...args:Array):Expectation; + toNotHaveBeenCalled(message?:string):Expectation; + withContext(context:any):Expectation; + withArgs(...args:Array):Expectation; + } + + export interface Extension { + [name:string]:(args?:Array) => void; + } + + export interface Call { + context: Spy; + arguments: Array; + } + + export interface Spy { + __isSpy:Boolean; + calls:Array; + andCall(fn:Function):Spy; + andCallThrough():Spy; + andThrow(object:Object):Spy; + andReturn(value:any):Spy; + getLastCall():Call; + restore():void; + destroy():void; + } + + function expect(actual:any):Expectation; + + export function createSpy(fn?:Function, restore?:Function):Spy; + export function spyOn(object:Object, methodName:string):Spy; + export function isSpy(object:any):Boolean; + export function restoreSpies():void; + export function assert(condition:any, messageFormat:string, ...extraArgs:Array):void; + export function extend(extension:Extension):void; + + export default expect; +} diff --git a/express-brute-memcached/express-brute-memcached-tests.ts b/express-brute-memcached/express-brute-memcached-tests.ts new file mode 100644 index 000000000..a8d777090 --- /dev/null +++ b/express-brute-memcached/express-brute-memcached-tests.ts @@ -0,0 +1,18 @@ +/// +/// +/// + +import express = require("express"); +import ExpressBrute = require("express-brute"); +import MemcachedStore = require("express-brute-memcached"); + +var app = express(); +var store = new MemcachedStore("127.0.0.1"); +var bruteforce = new ExpressBrute(store); + +app.post('/auth', + bruteforce.prevent, // error 403 if we hit this route too often + function (req, res, next) { + res.send('Success!'); + } +); diff --git a/express-brute-memcached/express-brute-memcached.d.ts b/express-brute-memcached/express-brute-memcached.d.ts new file mode 100644 index 000000000..4ef41cd69 --- /dev/null +++ b/express-brute-memcached/express-brute-memcached.d.ts @@ -0,0 +1,114 @@ +// Type definitions for express-brute-memcached +// Project: https://github.com/AdamPflug/express-brute-memcached +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "express-brute-memcached" { + /** + * @summary Memcached options. + * @interface + */ + interface MemcachedStoreOptions { + prefix: string; + + /** + * @summary Maximum key size allowed. + * @type {number} + */ + maxKeySize: number; + + /** + * @summary Maximum expiration time of keys (in seconds). + * @type {number} + */ + maxExpiration: number; + + /** + * @summary Maximum size of a value. + * @type {number} + */ + maxValue: number; + + /** + * @summary Maximum size of the connection pool. + * @type {number} + */ + poolSize: number; + + /** + * @summary Hashing algorithm used to generate the hashRing values + * @type {string} + */ + algorithm: string; + + /** + * @summary Time between reconnection attempts (in milliseconds). + * @type {number} + */ + reconnect: number; + + /** + * @summary Time after which Memcached sends a connection timeout (in milliseconds). + * @type {number} + */ + timeout: number; + + /** + * @summary Number of socket allocation retries per request. + * @type {number} + */ + retries: number; + + /** + * @summary Number of failed-attempts to a server before it is regarded as 'dead'. + * @type {number} + */ + failures: number; + + /** + * @summary Time between a server failure and an attempt to set it up back in service. + * @type {number} + */ + retry: number; + + /** + * @summary If true, authorizes the automatic removal of dead servers from the pool. + * @type {boolean} + */ + remove: boolean; + + /** + * @summary An array of server_locations to replace servers that fail and that are removed from the consistent hashing scheme. + * @type {Array} + */ + failOverServers: Array; + + /** + * @summary True, whether to use md5 as hashing scheme when keys exceed maxKeySize . + * @type + */ + keyCompression: boolean; + + /** + * @summary Idle timeout for the connections. + * @type {number} + */ + idle: number; + } + + /** + * @summary A memcached store adapter. + * @class + */ + export = class MemcachedStore { + /** + * @summary Constructor. + * @constructor + * @param {string|Array} hosts The collection. + * @param {Object} options The otpions. + */ + constructor(hosts: string|Array, options?: MemcachedStoreOptions); + } +} diff --git a/express-brute/express-brute.d.ts b/express-brute/express-brute.d.ts index 7242d44dc..1e672fdfb 100644 --- a/express-brute/express-brute.d.ts +++ b/express-brute/express-brute.d.ts @@ -45,85 +45,101 @@ declare module "express-brute" { } /** - * @summary Middleware. + * @summary Options for {@link ExpressBrute} class. + * @interface + */ + interface ExpressBruteOptions { + freeRetries: number; + proxyDepth: number; + attachResetToRequest: boolean; + refreshTimeoutOnRequest: boolean; + minWait: number; + maxWait: number; + lifetime: number; + failCallback: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void; + handleStoreError: any; +} + +/** + * @summary Middleware. + * @class + */ +class ExpressBrute { + /** + * @summary Constructor. + * @constructor + * @param {any} store The store. + */ + constructor(store: any); + + /** + * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback. + * @param {Object} options The options. + */ + getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler; + + /** + * @summary Uses the current proxy trust settings to get the current IP from a request object. + * @param {Request} request The HTTP request. + * @return {RequestHandler} The Request handler. + */ + getIPFromRequest(request: express.Request): express.RequestHandler; + + /** + * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback. + * @param {Request} request The HTTP request. + * @param {Response} response The HTTP response. + * @param {Function} next The next middleware. + * @return {RequestHandler} The Request handler. + */ + prevent(request: express.Request, response: express.Response, next: Function): express.RequestHandler; + + /** + * @summary Resets the wait time between requests back to its initial value. + * @param {string} ip The IP address. + * @param {string} key The key. response. + * @param {Function} next The next middleware. + * @return {RequestHandler} The Request handler. + */ + reset(ip: string, key: string, next: Function): express.RequestHandler; +} + +module ExpressBrute { + /** + * @summary In-memory store. * @class */ - class ExpressBrute { + export class MemoryStore { /** * @summary Constructor. * @constructor - * @param {any} store The store. - */ - constructor(store: any); - - /** - * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback. * @param {Object} options The options. */ - getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler; + constructor(options?: MemoryStoreOptions); + /** + * @summary Gets key value. + * @param {string} key The key name. + * @param {Function} callbck The callback. + */ + get(key: string, callback: (error: any, data: Object) => void): void; /** - * @summary Uses the current proxy trust settings to get the current IP from a request object. - * @param {Request} request The HTTP request. - * @return {RequestHandler} The Request handler. + * @summary Sets the key value. + * @param {string} key The name. + * @param {string} value The value. + * @param {number} lifetime The lifetime. + * @param {Function} callback The callback. */ - getIPFromRequest(request: express.Request): express.RequestHandler; + set(key: string, value: any, lifetime: number, callback: (error: any) => void): void; /** - * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback. - * @param {Request} request The HTTP request. - * @param {Response} response The HTTP response. - * @param {Function} next The next middleware. - * @return {RequestHandler} The Request handler. + * @summary Deletes the key. + * @param {string} key The name. + * @param {Function} callback The callback. */ - prevent(request: express.Request, response: express.Response, next: Function): express.RequestHandler; - - /** - * @summary Resets the wait time between requests back to its initial value. - * @param {string} ip The IP address. - * @param {string} key The key. response. - * @param {Function} next The next middleware. - * @return {RequestHandler} The Request handler. - */ - reset(ip: string, key: string, next: Function): express.RequestHandler; + reset(key: string, callback: (error: any) => void): void; } +} - module ExpressBrute { - /** - * @summary In-memory store. - * @class - */ - export class MemoryStore { - /** - * @summary Constructor. - * @constructor - * @param {Object} options The options. - */ - constructor(options?: MemoryStoreOptions); - /** - * @summary Gets key value. - * @param {string} key The key name. - * @param {Function} callbck The callback. - */ - get(key: string, callback: (error: any, data: Object) => void): void; - - /** - * @summary Sets the key value. - * @param {string} key The name. - * @param {string} value The value. - * @param {number} lifetime The lifetime. - * @param {Function} callback The callback. - */ - set(key: string, value: any, lifetime: number, callback: (error: any) => void): void; - - /** - * @summary Deletes the key. - * @param {string} key The name. - * @param {Function} callback The callback. - */ - reset(key: string, callback: (error: any) => void): void; - } - } - - export = ExpressBrute; +export = ExpressBrute; } diff --git a/express/express-tests.ts b/express/express-tests.ts index 72beb0790..de39e2c8a 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -21,7 +21,25 @@ app.get('/', function(req, res){ res.send('hello world'); }); -var router = express.Router(); +const router = express.Router(); + + +const pathStr : string = 'test'; +const pathRE : RegExp = /test/; +const path = true? pathStr : pathRE; + +router.get(path); +router.put(path) +router.post(path); +router.delete(path); +router.get(pathStr); +router.put(pathStr) +router.post(pathStr); +router.delete(pathStr); +router.get(pathRE); +router.put(pathRE) +router.post(pathRE); +router.delete(pathRE); router.use((req, res, next) => { next(); }) router.route('/users') diff --git a/express/express.d.ts b/express/express.d.ts index db1981d5d..65848860b 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -44,8 +44,7 @@ declare module "express" { } interface IRouterMatcher { - (name: string, ...handlers: RequestHandler[]): T; - (name: RegExp, ...handlers: RequestHandler[]): T; + (name: string|RegExp, ...handlers: RequestHandler[]): T; } interface IRouter extends RequestHandler { @@ -103,9 +102,9 @@ declare module "express" { route(path: string): IRoute; use(...handler: RequestHandler[]): T; - use(handler: ErrorRequestHandler): T; + use(handler: ErrorRequestHandler|RequestHandler): T; use(path: string, ...handler: RequestHandler[]): T; - use(path: string, handler: ErrorRequestHandler): T; + use(path: string, handler: ErrorRequestHandler|RequestHandler): T; use(path: string[], ...handler: RequestHandler[]): T; use(path: string[], handler: ErrorRequestHandler): T; use(path: RegExp, ...handler: RequestHandler[]): T; @@ -200,20 +199,35 @@ declare module "express" { accepts(type: string[]): string; /** - * Check if the given `charset` is acceptable, - * otherwise you should respond with 406 "Not Acceptable". + * Returns the first accepted charset of the specified character sets, + * based on the request’s Accept-Charset HTTP header field. + * If none of the specified charsets is accepted, returns false. * + * For more information, or if you have issues or concerns, see accepts. * @param charset */ - acceptsCharset(charset: string): boolean; + acceptsCharsets(charset?: string|string[]): string[]; /** - * Check if the given `lang` is acceptable, - * otherwise you should respond with 406 "Not Acceptable". + * Returns the first accepted encoding of the specified encodings, + * based on the request’s Accept-Encoding HTTP header field. + * If none of the specified encodings is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + * @param encoding + */ + acceptsEncodings(encoding?: string|string[]): string[]; + + /** + * Returns the first accepted language of the specified languages, + * based on the request’s Accept-Language HTTP header field. + * If none of the specified languages is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. * * @param lang */ - acceptsLanguage(lang: string): boolean; + acceptsLanguages(lang?: string|string[]): string[]; /** * Parse Range header field, @@ -240,28 +254,6 @@ declare module "express" { */ accepted: MediaType[]; - /** - * Return an array of Accepted languages - * ordered from highest quality to lowest. - * - * Examples: - * - * Accept-Language: en;q=.5, en-us - * ['en-us', 'en'] - */ - acceptedLanguages: any[]; - - /** - * Return an array of Accepted charsets - * ordered from highest quality to lowest. - * - * Examples: - * - * Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8 - * ['unicode-1-1', 'iso-8859-5'] - */ - acceptedCharsets: any[]; - /** * Return the value of param `name` when present or `defaultValue`. * @@ -881,8 +873,7 @@ declare module "express" { set(setting: string, val: any): Application; get: { (name: string): any; // Getter - (name: string, ...handlers: RequestHandler[]): Application; - (name: RegExp, ...handlers: RequestHandler[]): Application; + (name: string|RegExp, ...handlers: RequestHandler[]): Application; }; /** diff --git a/extended-listbox/extended-listbox-tests.ts b/extended-listbox/extended-listbox-tests.ts index cc4eba3fe..8016ccee7 100644 --- a/extended-listbox/extended-listbox-tests.ts +++ b/extended-listbox/extended-listbox-tests.ts @@ -4,33 +4,43 @@ var $test = $("#test"); // Create Listbox with defaults -var rootElement: any = $test.listbox(); +var instance: ExtendedListboxInstance = $test.listbox(); // Create with options var options = {}; options.multiple = true; -options.onItemsChanged = (items: ListboxItem[]): void => { - console.log(items); -}; +options.searchBar = false; +options.searchBarWatermark = "Search"; +options.searchBarButton = { icon: "fa fa-search", visible: true, onClick: function () { alert(); } }; options.getItems = function (): any[] { return ["Test1"]; }; -options.searchBar = false; -options.searchBarWatermark = "Search"; -options.onFilterChanged = (filter): void => { - console.log(filter); +options.onItemsChanged = (event: ListboxEvent): void => { + console.log(event.eventName); + console.log(event.args); + console.log(event.target); }; -options.onValueChanged = function (value: any): void { - console.log(value); +options.onFilterChanged = (event: ListboxEvent): void => { + console.log(event.args); +}; +options.onValueChanged = function (event: ListboxEvent): void { + console.log(event.args); +}; +options.onItemDoubleClicked = function (event: ListboxEvent): void { + console.log(event.args); +}; +options.onItemEnterPressed = function (event: ListboxEvent): void { + console.log(event.args); }; -options.searchBarButton = { icon: "fa fa-search", visible: true, onClick: function () { alert(); } }; -rootElement = $test.listbox(options); +instance = $test.listbox(options); +/////// NEW API /////// + // Add string item -rootElement.listbox("addItem", "Test2"); +var id = instance.addItem("Test2"); // Add item @@ -42,36 +52,128 @@ item.groupHeader = false; item.id = "ouetioreit"; item.index = 0; item.text = "Test3"; -var id: string = rootElement.listbox("addItem", item); +id = instance.addItem(item); // Remove item -rootElement.listbox("removeItem", id); +instance.removeItem(id); // Get item -var i: ListboxItem = rootElement.listbox("getItem", id); +var i: ListboxItem = instance.getItem(id); // Get items -var allItems: ListboxItem[] = rootElement.listbox("getItems"); +var allItems: ListboxItem[] = instance.getItems(); + +// Get selected items +var allItems: ListboxItem[] = instance.getSelection(); // Move item up -var newIndex: number = rootElement.listbox("moveItemUp", i.id); +var newIndex: number = instance.moveItemUp(i.id); // Move item down -newIndex = rootElement.listbox("moveItemDown", i.id); +newIndex = instance.moveItemDown(i.id); + + +// Move item to top +var newIndex: number = instance.moveItemToTop(i.id); + + +// Move item to bottom +newIndex = instance.moveItemToBottom(i.id); // Clear selection -newIndex = rootElement.listbox("clearSelection"); +instance.clearSelection(); // Enable -newIndex = rootElement.listbox("enable", false); +instance.enable(false); // Destroy -newIndex = rootElement.listbox("destroy"); +instance.destroy(); + + +// onValueChanged +instance.onValueChanged((event: ListboxEvent) => { + console.log(event.args); +}); + + +// onItemsChanged +instance.onItemsChanged((event: ListboxEvent) => { + console.log(event.args); +}); + + +// onFilterChanged +instance.onFilterChanged((event: ListboxEvent) => { + console.log(event.args); +}); + + +// onItemEnterPressed +instance.onItemEnterPressed((event: ListboxEvent) => { + console.log(event.args); +}); + + +// onItemDoubleClicked +instance.onItemDoubleClicked((event: ListboxEvent) => { + console.log(event.args); +}); + + + +/////// LEGACY API /////// + +// Add string item +instance.target.listbox("addItem", "Test2"); + + +// Add item +var item: ListboxItem = {}; +item.selected = true; +item.disabled = false; +item.childItems = ["Test4"]; +item.groupHeader = false; +item.id = "ouetioreit"; +item.index = 0; +item.text = "Test3"; +var id: string = instance.target.listbox("addItem", item); + + +// Remove item +instance.target.listbox("removeItem", id); + + +// Get item +var i: ListboxItem = instance.target.listbox("getItem", id); + + +// Get items +var allItems: ListboxItem[] = instance.target.listbox("getItems"); + + +// Move item up +var newIndex: number = instance.target.listbox("moveItemUp", i.id); + + +// Move item down +newIndex = instance.target.listbox("moveItemDown", i.id); + + +// Clear selection +instance.target.listbox("clearSelection"); + + +// Enable +instance.target.listbox("enable", false); + + +// Destroy +instance.target.listbox("destroy"); diff --git a/extended-listbox/extended-listbox.d.ts b/extended-listbox/extended-listbox.d.ts index d3f8341f0..6b3c0b573 100644 --- a/extended-listbox/extended-listbox.d.ts +++ b/extended-listbox/extended-listbox.d.ts @@ -1,4 +1,4 @@ -// Type definitions for extended-listbox 1.0.6 +// Type definitions for extended-listbox 1.1.x // Project: https://github.com/code-chris/extended-listbox // Definitions by: Christian Kotzbauer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -59,27 +59,125 @@ interface ListBoxOptions { getItems?: () => any; /** callback for selection changes */ - onValueChanged?: (value: ListboxItem|ListboxItem[]) => void; + onValueChanged?: (event: ListboxEvent) => void; /** callback for searchBar text changes */ - onFilterChanged?: (value: string) => void; + onFilterChanged?: (event: ListboxEvent) => void; /** callback for item changes (item added, item removed, item order) */ - onItemsChanged?: (value: ListboxItem[]) => void; + onItemsChanged?: (event: ListboxEvent) => void; + + /** callback for enter keyPress event on an item */ + onItemEnterPressed?: (event: ListboxEvent) => void; + + /** callback for doubleClick event on an item */ + onItemDoubleClicked?: (event: ListboxEvent) => void; +} + +interface ListboxEvent { + /** unique event name */ + eventName: string; + + /** target object for which event is triggered */ + target: JQuery; + + /** any object */ + args: any; +} + +interface ExtendedListboxInstance { + /** DOM element of the listbox root */ + target: JQuery; + + /** Adds a new item to the list */ + addItem(item: string|ListboxItem): string; + + /** Removes a item from the list */ + removeItem(identifier: string): void; + + /** Reverts all changes from the DOM */ + destroy(): void; + + /** Resets the selection state of all items */ + clearSelection(): void; + + /** Returns a item object for the given id or display text */ + getItem(identifier: string): ListboxItem; + + /** Returns all item objects */ + getItems(): ListboxItem[]; + + /** Returns all ListboxItem's which are selected */ + getSelection(): ListboxItem[]; + + /** Decreases the index of the matching item by one */ + moveItemUp(identifier: string): number; + + /** Increases the index of the matching item by one */ + moveItemDown(identifier: string): number; + + /** Moves item to the bottom of the list */ + moveItemToBottom(identifier: string): number; + + /** Moves item to the top of the list */ + moveItemToTop(identifier: string): number; + + /** Enables or disables the whole list and all childs */ + enable(state: boolean): void; + + /** callback for selection changes */ + onValueChanged(callback: (event: ListboxEvent) => void): void; + + /** callback for item changes (item added, item removed, item order) */ + onItemsChanged(callback: (event: ListboxEvent) => void): void; + + /** callback for searchBar text changes */ + onFilterChanged(callback: (event: ListboxEvent) => void): void; + + /** callback for enter keyPress event on an item */ + onItemEnterPressed(callback: (event: ListboxEvent) => void): void; + + /** callback for doubleClick event on an item */ + onItemDoubleClicked(callback: (event: ListboxEvent) => void): void; } interface JQuery { - listbox(): JQuery; + /** constructs a new instance of Listbox on the given DOM item or returns existing */ + listbox(): ExtendedListboxInstance|ExtendedListboxInstance[]; + + /** constructs a new instance of Listbox on the given DOM item */ + listbox(options: ListBoxOptions): ExtendedListboxInstance|ExtendedListboxInstance[]; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'addItem'): string; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'removeItem'): void; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'destroy'): void; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'getItem'): ListboxItem; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'getItems'): ListboxItem[]; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'moveItemUp'): number; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'moveItemDown'): number; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'clearSelection'): void; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: 'enable'): void; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: string): any; + + /** @deprecated: use method in ExtendedListboxInstance */ listbox(methodName: string, methodParameter: any): any; - listbox(options: ListBoxOptions): JQuery; } diff --git a/fs-extra-promise/fs-extra-promise-tests.ts b/fs-extra-promise/fs-extra-promise-tests.ts new file mode 100644 index 000000000..893585d31 --- /dev/null +++ b/fs-extra-promise/fs-extra-promise-tests.ts @@ -0,0 +1,229 @@ +/// +/// + +import fs = require('fs-extra-promise'); +import stream = require('stream'); + +var stats: fs.Stats; +var str: string; +var strArr: string[]; +var bool: boolean; +var num: number; +var src: string; +var dest: string; +var file: string; +var filename: string; +var dir: string; +var path: string; +var data: any; +var object: Object; +var buffer: NodeBuffer; +var modeNum: number; +var modeStr: string; +var encoding: string; +var type: string; +var flags: string; +var srcpath: string; +var dstpath: string; +var oldPath: string; +var newPath: string; +var cache: string; +var offset: number; +var length: number; +var position: number; +var cacheBool: boolean; +var cacheStr: string; +var fd: number; +var len: number; +var uid: number; +var gid: number; +var atime: number; +var mtime: number; +var statsCallback: (err: Error, stats: fs.Stats) => void; +var errorCallback: (err: Error) => void; +var openOpts: fs.OpenOptions; +var watcher: fs.FSWatcher; +var readStreeam: stream.Readable; +var writeStream: stream.Writable; + +fs.copy(src, dest, errorCallback); +fs.copy(src, dest, (src: string) => { + return false; +}, errorCallback); +fs.copySync(src, dest); +fs.copySync(src, dest, (src: string) => { + return false; +}); +fs.createFile(file, errorCallback); +fs.createFileSync(file); + +fs.mkdirs(dir, errorCallback); +fs.mkdirsSync(dir); +fs.mkdirp(dir, errorCallback); +fs.mkdirpSync(dir); + +fs.outputFile(file, data, errorCallback); +fs.outputFileSync(file, data); +fs.outputJson(file, data, errorCallback); +fs.outputJSON(file, data, errorCallback); + +fs.outputJsonSync(file, data); +fs.outputJSONSync(file, data); + +fs.readJson(file, errorCallback); +fs.readJson(file, openOpts, errorCallback); +fs.readJSON(file, errorCallback); +fs.readJSON(file, openOpts, errorCallback); + +fs.readJsonSync(file, openOpts); +fs.readJSONSync(file, openOpts); + +fs.remove(dir, errorCallback); +fs.removeSync(dir); + +fs.writeJson(file, object, errorCallback); +fs.writeJson(file, object, openOpts, errorCallback); +fs.writeJSON(file, object, errorCallback); +fs.writeJSON(file, object, openOpts, errorCallback); + +fs.writeJsonSync(file, object, openOpts); +fs.writeJSONSync(file, object, openOpts); + +fs.rename(oldPath, newPath, errorCallback); +fs.renameSync(oldPath, newPath); +fs.truncate(fd, len, errorCallback); +fs.truncateSync(fd, len); +fs.chown(path, uid, gid, errorCallback); +fs.chownSync(path, uid, gid); +fs.fchown(fd, uid, gid, errorCallback); +fs.fchownSync(fd, uid, gid); +fs.lchown(path, uid, gid, errorCallback); +fs.lchownSync(path, uid, gid); +fs.chmod(path, modeNum, errorCallback); +fs.chmod(path, modeStr, errorCallback); +fs.chmodSync(path, modeNum); +fs.chmodSync(path, modeStr); +fs.fchmod(fd, modeNum, errorCallback); +fs.fchmod(fd, modeStr, errorCallback); +fs.fchmodSync(fd, modeNum); +fs.fchmodSync(fd, modeStr); +fs.lchmod(path, modeStr, errorCallback); +fs.lchmod(path, modeNum, errorCallback); +fs.lchmodSync(path, modeNum); +fs.lchmodSync(path, modeStr); +fs.stat(path, statsCallback); +fs.lstat(path, statsCallback); +fs.fstat(fd, statsCallback); +stats = fs.statSync(path); +stats = fs.lstatSync(path); +stats = fs.fstatSync(fd); +fs.link(srcpath, dstpath, errorCallback); +fs.linkSync(srcpath, dstpath); +fs.symlink(srcpath, dstpath, type, errorCallback); +fs.symlinkSync(srcpath, dstpath, type); +fs.readlink(path, (err: Error, linkString: string) => { + +}); +fs.realpath(path, (err: Error, resolvedPath: string) => { + +}); +fs.realpath(path, cache, (err: Error, resolvedPath: string) => { + +}); +str = fs.realpathSync(path, cacheBool); +fs.unlink(path, errorCallback); +fs.unlinkSync(path); +fs.rmdir(path, errorCallback); +fs.rmdirSync(path); +fs.mkdir(path, modeNum, errorCallback); +fs.mkdir(path, modeStr, errorCallback); +fs.mkdirSync(path, modeNum); +fs.mkdirSync(path, modeStr); +fs.readdir(path, (err: Error, files: string[]) => { + +}); +strArr = fs.readdirSync(path); +fs.close(fd, errorCallback); +fs.closeSync(fd); +fs.open(path, flags, modeStr, (err: Error, fd: number) => { + +}); +num = fs.openSync(path, flags, modeStr); +fs.utimes(path, atime, mtime, errorCallback); +fs.utimesSync(path, atime, mtime); +fs.futimes(fd, atime, mtime, errorCallback); +fs.futimesSync(fd, atime, mtime); +fs.fsync(fd, errorCallback); +fs.fsyncSync(fd); +fs.write(fd, buffer, offset, length, position, (err: Error, written: number, buffer: NodeBuffer) => { + +}); +num = fs.writeSync(fd, buffer, offset, length, position); +fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: NodeBuffer) => { + +}); +num = fs.readSync(fd, buffer, offset, length, position); +fs.readFile(filename, (err: Error, data: NodeBuffer) => { + +}); +fs.readFile(filename, encoding, (err: Error, data: string) => { + +}); +fs.readFile(filename, openOpts, (err: Error, data: string) => { + +}); +fs.readFile(filename, (err: Error, data: NodeBuffer) => { + +}); +buffer = fs.readFileSync(filename); +str = fs.readFileSync(filename, encoding); +str = fs.readFileSync(filename, openOpts); + +fs.writeFile(filename, data, errorCallback); +fs.writeFile(filename, data, encoding, errorCallback); +fs.writeFile(filename, data, openOpts, errorCallback); +fs.writeFileSync(filename, data); +fs.writeFileSync(filename, data, encoding); +fs.writeFileSync(filename, data, openOpts); + +fs.appendFile(filename, data, errorCallback); +fs.appendFile(filename, data, encoding, errorCallback); +fs.appendFile(filename, data, openOpts, errorCallback); +fs.appendFileSync(filename, data); +fs.appendFileSync(filename, data, encoding); +fs.appendFileSync(filename, data, openOpts); + +fs.watchFile(filename, { + curr: stats, + prev: stats +}); +fs.watchFile(filename, { + persistent: bool, + interval: num +}, { + curr: stats, + prev: stats +}); +fs.unwatchFile(filename); +watcher = fs.watch(filename, { persistent: bool }, (event: string, filename: string) => { + +}); +fs.exists(path, (exists: boolean) => { + +}); +bool = fs.existsSync(path); + +readStreeam = fs.createReadStream(path); +readStreeam = fs.createReadStream(path, { + flags: str, + encoding: str, + fd: num, + mode: num, + bufferSize: num +}); +writeStream = fs.createWriteStream(path); +writeStream = fs.createWriteStream(path, { + flags: str, + encoding: str, + string: str +}); diff --git a/fs-extra-promise/fs-extra-promise.d.ts b/fs-extra-promise/fs-extra-promise.d.ts new file mode 100644 index 000000000..ee7e43b26 --- /dev/null +++ b/fs-extra-promise/fs-extra-promise.d.ts @@ -0,0 +1,263 @@ +// Type definitions for fs-extra-promise +// Project: https://github.com/overlookmotel/fs-extra-promise +// Definitions by: midknight41 , Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts via TSD fs-extra definition + +/// +/// + +declare module "fs-extra-promise" { + import stream = require("stream"); + import Promise = require("bluebird"); + + export interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + } + + export interface FSWatcher { + close(): void; + } + + export class ReadStream extends stream.Readable { } + export class WriteStream extends stream.Writable { } + + //extended methods + export function copy(src: string, dest: string, callback?: (err: Error) => void): void; + export function copy(src: string, dest: string, filter: (src: string) => boolean, callback?: (err: Error) => void): void; + + export function copySync(src: string, dest: string): void; + export function copySync(src: string, dest: string, filter: (src: string) => boolean): void; + + export function createFile(file: string, callback?: (err: Error) => void): void; + export function createFileSync(file: string): void; + + export function mkdirs(dir: string, callback?: (err: Error) => void): void; + export function mkdirp(dir: string, callback?: (err: Error) => void): void; + export function mkdirsSync(dir: string): void; + export function mkdirpSync(dir: string): void; + + export function outputFile(file: string, data: any, callback?: (err: Error) => void): void; + export function outputFileSync(file: string, data: any): void; + + export function outputJson(file: string, data: any, callback?: (err: Error) => void): void; + export function outputJSON(file: string, data: any, callback?: (err: Error) => void): void; + export function outputJsonSync(file: string, data: any): void; + export function outputJSONSync(file: string, data: any): void; + + export function readJson(file: string, callback?: (err: Error) => void): void; + export function readJson(file: string, options?: OpenOptions, callback?: (err: Error) => void): void; + export function readJSON(file: string, callback?: (err: Error) => void): void; + export function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void; + + export function readJsonSync(file: string, options?: OpenOptions): void; + export function readJSONSync(file: string, options?: OpenOptions): void; + + export function remove(dir: string, callback?: (err: Error) => void): void; + export function removeSync(dir: string): void; + // export function delete(dir: string, callback?: (err: Error) => void): void; + // export function deleteSync(dir: string): void; + + export function writeJson(file: string, object: any, callback?: (err: Error) => void): void; + export function writeJson(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void; + export function writeJSON(file: string, object: any, callback?: (err: Error) => void): void; + export function writeJSON(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void; + + export function writeJsonSync(file: string, object: any, options?: OpenOptions): void; + export function writeJSONSync(file: string, object: any, options?: OpenOptions): void; + + export function rename(oldPath: string, newPath: string, callback?: (err: Error) => void): void; + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(fd: number, len: number, callback?: (err: Error) => void): void; + export function truncateSync(fd: number, len: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err: Error) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err: Error) => void): void; + export function chmod(path: string, mode: string, callback?: (err: Error) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err: Error) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err: Error) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: string, callback?: (err: Error) => void): void; + export function lchmod(path: string, mode: number, callback?: (err: Error) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: Error, stats: Stats) => void): void; + export function lstat(path: string, callback?: (err: Error, stats: Stats) => void): void; + export function fstat(fd: number, callback?: (err: Error, stats: Stats) => void): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err: Error) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err: Error) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: Error, linkString: string) => void): void; + export function realpath(path: string, callback?: (err: Error, resolvedPath: string) => void): void; + export function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) => void): void; + export function realpathSync(path: string, cache?: boolean): string; + export function unlink(path: string, callback?: (err: Error) => void): void; + export function unlinkSync(path: string): void; + export function rmdir(path: string, callback?: (err: Error) => void): void; + export function rmdirSync(path: string): void; + export function mkdir(path: string, mode?: number, callback?: (err: Error) => void): void; + export function mkdir(path: string, mode?: string, callback?: (err: Error) => void): void; + export function mkdirSync(path: string, mode?: number): void; + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: Error, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err: Error) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, mode?: string, callback?: (err: Error, fs: number) => void): void; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err: Error) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err: Error) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function fsync(fd: number, callback?: (err: Error) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void; + export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void; + export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; + export function readFile(filename: string, encoding: string, callback: (err: Error, data: string) => void): void; + export function readFile(filename: string, options: OpenOptions, callback: (err: Error, data: string) => void): void; + export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void): void; + export function readFileSync(filename: string): NodeBuffer; + export function readFileSync(filename: string, encoding: string): string; + export function readFileSync(filename: string, options: OpenOptions): string; + export function writeFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void; + export function writeFile(filename: string, data: any, options?: OpenOptions, callback?: (err: Error) => void): void; + export function writeFileSync(filename: string, data: any, encoding?: string): void; + export function writeFileSync(filename: string, data: any, option?: OpenOptions): void; + export function appendFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void; + export function appendFile(filename: string, data: any, option?: OpenOptions, callback?: (err: Error) => void): void; + export function appendFileSync(filename: string, data: any, encoding?: string): void; + export function appendFileSync(filename: string, data: any, option?: OpenOptions): void; + export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void; + export function unwatchFile(filename: string, listener?: Stats): void; + export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + export function ensureDir(path: string, cb: (err: Error) => void): void; + + export interface OpenOptions { + encoding?: string; + flag?: string; + } + + export interface ReadStreamOptions { + flags?: string; + encoding?: string; + fd?: number; + mode?: number; + bufferSize?: number; + } + export interface WriteStreamOptions { + flags?: string; + encoding?: string; + string?: string; + } + export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream; + export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream; + + + + //promisified versions + export function copyAsync(src: string, dest: string): Promise; + export function copyAsync(src: string, dest: string, filter: (src: string) => boolean): Promise; + + export function createFileAsync(file: string): Promise; + + export function mkdirsAsync(dir: string): Promise; + export function mkdirpAsync(dir: string): Promise; + + export function outputFileAsync(file: string, data: any): Promise; + + export function outputJsonAsync(file: string, data: any): Promise; + export function outputJSONAsync(file: string, data: any): Promise; + + export function readJsonAsync(file: string): Promise; + export function readJsonAsync(file: string, options?: OpenOptions): Promise; + export function readJSONAsync(file: string): Promise; + export function readJSONAsync(file: string, options?: OpenOptions): Promise; + + + export function removeAsync(dir: string): Promise; + // export function deleteAsync(dir: string):Promise; + + export function writeJsonAsync(file: string, object: any): Promise; + export function writeJsonAsync(file: string, object: any, options?: OpenOptions): Promise; + export function writeJSONAsync(file: string, object: any): Promise; + export function writeJSONAsync(file: string, object: any, options?: OpenOptions): Promise; + + export function renameAsync(oldPath: string, newPath: string): Promise; + export function truncateAsync(fd: number, len: number): Promise; + export function chownAsync(path: string, uid: number, gid: number): Promise; + export function fchownAsync(fd: number, uid: number, gid: number): Promise; + export function lchownAsync(path: string, uid: number, gid: number): Promise; + export function chmodAsync(path: string, mode: number): Promise; + export function chmodAsync(path: string, mode: string): Promise; + export function fchmodAsync(fd: number, mode: number): Promise; + export function fchmodAsync(fd: number, mode: string): Promise; + export function lchmodAsync(path: string, mode: string): Promise; + export function lchmodAsync(path: string, mode: number): Promise; + export function statAsync(path: string): Promise; + export function lstatAsync(path: string): Promise; + export function fstatAsync(fd: number): Promise; + export function linkAsync(srcpath: string, dstpath: string): Promise; + export function symlinkAsync(srcpath: string, dstpath: string, type?: string): Promise; + export function readlinkAsync(path: string): Promise; + export function realpathAsync(path: string): Promise; + export function realpathAsync(path: string, cache: string): Promise; + export function unlinkAsync(path: string): Promise; + export function rmdirAsync(path: string): Promise; + export function mkdirAsync(path: string, mode?: number): Promise; + export function mkdirAsync(path: string, mode?: string): Promise; + export function readdirAsync(path: string): Promise; + export function closeAsync(fd: number): Promise; + export function openAsync(path: string, flags: string, mode?: string): Promise; + export function utimesAsync(path: string, atime: number, mtime: number): Promise; + export function futimesAsync(fd: number, atime: number, mtime: number): Promise; + export function fsyncAsync(fd: number): Promise; + export function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; + export function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>; + export function readFileAsync(filename: string, encoding: string): Promise; + export function readFileAsync(filename: string, options: OpenOptions): Promise; + export function readFileAsync(filename: string): Promise; + export function writeFileAsync(filename: string, data: any, encoding?: string): Promise; + export function writeFileAsync(filename: string, data: any, options?: OpenOptions): Promise; + export function appendFileAsync(filename: string, data: any, encoding?: string): Promise; + export function appendFileAsync(filename: string, data: any, option?: OpenOptions): Promise; + + export function existsAsync(path: string): Promise; + export function ensureDirAsync(path: string): Promise; +} + diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index d997d12a8..e4f800185 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -70,8 +70,8 @@ declare module "fs-extra" { export function readJSON(file: string, callback?: (err: Error) => void): void; export function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void; - export function readJsonSync(file: string, options?: OpenOptions): void; - export function readJSONSync(file: string, options?: OpenOptions): void; + export function readJsonSync(file: string, options?: OpenOptions): any; + export function readJSONSync(file: string, options?: OpenOptions): any; export function remove(dir: string, callback?: (err: Error) => void): void; export function removeSync(dir: string): void; diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index fd7437a89..cf0bee0ec 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -31,7 +31,7 @@ require('crash-reporter').start(); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the javascript object is GCed. -var mainWindow: GitHubElectron.BrowserWindow = null; +var mainWindow: Electron.BrowserWindow = null; // Quit when all windows are closed. app.on('window-all-closed', () => { @@ -72,6 +72,7 @@ app.on('ready', () => { mainWindow.webContents.addWorkSpace('/path/to/workspace'); mainWindow.webContents.removeWorkSpace('/path/to/workspace'); var opened: boolean = mainWindow.webContents.isDevToolsOpened() + var focused = mainWindow.webContents.isDevToolsFocused(); // Emitted when the window is closed. mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows @@ -116,21 +117,21 @@ app.on('ready', () => { app.addRecentDocument('/Users/USERNAME/Desktop/work.type'); app.clearRecentDocuments(); var dockMenu = Menu.buildFromTemplate([ - { + { label: 'New Window', click: () => { console.log('New Window'); } }, - { + { label: 'New Window with Settings', submenu: [ - { label: 'Basic' }, - { label: 'Pro' } + { label: 'Basic' }, + { label: 'Pro' } ] }, - { label: 'New Command...' }, - { + { label: 'New Command...' }, + { label: 'Edit', submenu: [ { @@ -167,7 +168,7 @@ var dockMenu = Menu.buildFromTemplate([ app.dock.setMenu(dockMenu); app.setUserTasks([ - { + { program: process.execPath, arguments: '--new-window', iconPath: process.execPath, @@ -186,7 +187,7 @@ window.setDocumentEdited(true); // Online/Offline Event Detection // https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md -var onlineStatusWindow: GitHubElectron.BrowserWindow; +var onlineStatusWindow: Electron.BrowserWindow; app.on('ready', () => { onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }); @@ -287,12 +288,12 @@ globalShortcut.unregisterAll(); // ipcMain // https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md -ipcMain.on('asynchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { +ipcMain.on('asynchronous-message', (event: Electron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.sender.send('asynchronous-reply', 'pong'); }); -ipcMain.on('synchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { +ipcMain.on('synchronous-message', (event: Electron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.returnValue = 'pong'; }); @@ -472,7 +473,7 @@ app.on('ready', () => { // tray // https://github.com/atom/electron/blob/master/docs/api/tray.md -var appIcon: GitHubElectron.Tray = null; +var appIcon: Electron.Tray = null; app.on('ready', () => { appIcon = new Tray('/path/to/my/icon'); var contextMenu = Menu.buildFromTemplate([ diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index cf610718c..7ddd585a7 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -24,7 +24,7 @@ ipcRenderer.send('asynchronous-message', 'ping'); // remote // https://github.com/atom/electron/blob/master/docs/api/remote.md -var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window'); +var BrowserWindow: typeof Electron.BrowserWindow = remote.require('browser-window'); var win = new BrowserWindow({ width: 800, height: 600 }); win.loadURL('https://github.com'); @@ -75,7 +75,7 @@ crashReporter.start({ // nativeImage // https://github.com/atom/electron/blob/master/docs/api/native-image.md -var Tray: typeof GitHubElectron.Tray = remote.require('Tray'); +var Tray: typeof Electron.Tray = remote.require('Tray'); var appIcon2 = new Tray('/Users/somebody/images/icon.png'); var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); var image = clipboard.readImage(); @@ -85,9 +85,9 @@ var appIcon4 = new Tray('/Users/somebody/images/icon.png'); // screen // https://github.com/atom/electron/blob/master/docs/api/screen.md -var app: GitHubElectron.App = remote.require('app'); +var app: Electron.App = remote.require('app'); -var mainWindow: GitHubElectron.BrowserWindow = null; +var mainWindow: Electron.BrowserWindow = null; app.on('ready', () => { var size = screen.getPrimaryDisplay().workAreaSize; diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 290bf06aa..a02a1edb6 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -5,7 +5,7 @@ /// -declare module GitHubElectron { +declare module Electron { /** * This class is used to represent an image. */ @@ -64,6 +64,34 @@ declare module GitHubElectron { function writeImage(image: NativeImage, type?: string): void; } + interface Display { + id:number; + bounds:Bounds; + workArea:Bounds; + size:Dimension; + workAreaSize:Dimension; + scaleFactor:number; + rotation:number; + touchSupport:string; + } + + interface Bounds { + x:number; + y:number; + width:number; + height:number; + } + + interface Dimension { + width:number; + height:number; + } + + interface Point { + x:number; + y:number; + } + class Screen implements NodeJS.EventEmitter { addListener(event: string, listener: Function): Screen; on(event: string, listener: Function): Screen; @@ -78,26 +106,23 @@ declare module GitHubElectron { /** * @returns The current absolute position of the mouse pointer. */ - getCursorScreenPoint(): any; + getCursorScreenPoint(): Point; /** * @returns The primary display. */ - getPrimaryDisplay(): any; + getPrimaryDisplay(): Display; /** * @returns An array of displays that are currently available. */ - getAllDisplays(): any[]; + getAllDisplays(): Display[]; /** * @returns The display nearest the specified point. */ - getDisplayNearestPoint(point: { - x: number; - y: number; - }): any; + getDisplayNearestPoint(point: Point): Display; /** * @returns The display that most closely intersects the provided bounds. */ - getDisplayMatching(rect: Rectangle): any; + getDisplayMatching(rect: Rectangle): Display; } /** @@ -508,6 +533,7 @@ declare module GitHubElectron { subpixelFontScaling?: boolean; overlayFullscreenVideo?: boolean; titleBarStyle?: string; + backgroundColor?: string; } interface Rectangle { @@ -750,6 +776,10 @@ declare module GitHubElectron { * Returns whether the developer tools are opened. */ isDevToolsOpened(): boolean; + /** + * Returns whether the developer tools are focussed. + */ + isDevToolsFocused(): boolean; /** * Toggle the developer tools. */ @@ -884,7 +914,7 @@ declare module GitHubElectron { * Should be specified for submenu type menu item, when it's specified the * type: 'submenu' can be omitted for the menu item */ - submenu?: MenuItemOptions[]; + submenu?: Menu|MenuItemOptions[]; /** * Unique within a single menu. If defined then it can be used as a reference * to this item by the position attribute. @@ -1022,6 +1052,7 @@ declare module GitHubElectron { * of your app is running, and other instances signal this instance and exit. */ makeSingleInstance(callback: (args: string[], workingDirectory: string) => boolean): boolean; + setAppUserModelId(id: string): void; } interface CommandLine { @@ -1057,7 +1088,7 @@ declare module GitHubElectron { /** * Description of this task. */ - description: string; + description?: string; /** * The absolute path to an icon to be displayed in a JumpList, it can be * arbitrary resource file that contains an icon, usually you can specify @@ -1069,9 +1100,9 @@ declare module GitHubElectron { * icons, set this value to identify the icon. If an icon file consists of * one icon, this value is 0. */ - iconIndex: number; - commandLine: CommandLine; - dock: { + iconIndex?: number; + commandLine?: CommandLine; + dock?: { /** * When critical is passed, the dock icon will bounce until either the * application becomes active or the request is canceled. @@ -1180,6 +1211,19 @@ declare module GitHubElectron { properties?: string|string[]; } + interface SaveDialogOptions { + title?: string; + defaultPath?: string; + /** + * File types that can be displayed, see dialog.showOpenDialog for an example. + */ + + filters?: { + name: string; + extensions: string[]; + }[] + } + /** * @param browserWindow * @param options @@ -1187,18 +1231,7 @@ declare module GitHubElectron { * @returns On success, returns the path of file chosen by the user, otherwise * returns undefined. */ - export function showSaveDialog(browserWindow?: BrowserWindow, options?: { - title?: string; - defaultPath?: string; - /** - * File types that can be displayed, see dialog.showOpenDialog for an example. - */ - - filters?: { - name: string; - extensions: string[]; - }[] - }, callback?: (fileName: string) => void): string; + export function showSaveDialog(browserWindow?: BrowserWindow, options?: SaveDialogOptions, callback?: (fileName: string) => void): string; /** * Shows a message box. It will block until the message box is closed. It returns . @@ -1237,6 +1270,8 @@ declare module GitHubElectron { */ detail?: string; icon?: NativeImage; + noLink?: boolean; + cancelId?: number; } } @@ -1308,11 +1343,11 @@ declare module GitHubElectron { /** * @returns The contents of the clipboard as a NativeImage. */ - readImage: typeof GitHubElectron.Clipboard.readImage; + readImage: typeof Electron.Clipboard.readImage; /** * Writes the image into the clipboard. */ - writeImage: typeof GitHubElectron.Clipboard.writeImage; + writeImage: typeof Electron.Clipboard.writeImage; /** * Clears everything in clipboard. */ @@ -1631,19 +1666,19 @@ declare module GitHubElectron { * @returns On success, returns an array of file paths chosen by the user, * otherwise returns undefined. */ - showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog; + showOpenDialog: typeof Electron.Dialog.showOpenDialog; /** * @param callback If supplied, the API call will be asynchronous. * @returns On success, returns the path of file chosen by the user, otherwise * returns undefined. */ - showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog; + showSaveDialog: typeof Electron.Dialog.showSaveDialog; /** * Shows a message box. It will block until the message box is closed. It returns . * @param callback If supplied, the API call will be asynchronous. * @returns The index of the clicked button. */ - showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; + showMessageBox: typeof Electron.Dialog.showMessageBox; /** * Runs a modal dialog that shows an error message. This API can be called safely @@ -1773,26 +1808,26 @@ declare module GitHubElectron { } interface CommonElectron { - clipboard: GitHubElectron.Clipboard; - crashReporter: GitHubElectron.CrashReporter; - nativeImage: typeof GitHubElectron.NativeImage; - shell: GitHubElectron.Shell; + clipboard: Electron.Clipboard; + crashReporter: Electron.CrashReporter; + nativeImage: typeof Electron.NativeImage; + shell: Electron.Shell; - app: GitHubElectron.App; - autoUpdater: GitHubElectron.AutoUpdater; - BrowserWindow: typeof GitHubElectron.BrowserWindow; - contentTracing: GitHubElectron.ContentTracing; - dialog: GitHubElectron.Dialog; - ipcMain: GitHubElectron.IPCMain; - globalShortcut: GitHubElectron.GlobalShortcut; - Menu: typeof GitHubElectron.Menu; - MenuItem: typeof GitHubElectron.MenuItem; + app: Electron.App; + autoUpdater: Electron.AutoUpdater; + BrowserWindow: typeof Electron.BrowserWindow; + contentTracing: Electron.ContentTracing; + dialog: Electron.Dialog; + ipcMain: Electron.IPCMain; + globalShortcut: Electron.GlobalShortcut; + Menu: typeof Electron.Menu; + MenuItem: typeof Electron.MenuItem; powerMonitor: NodeJS.EventEmitter; - powerSaveBlocker: GitHubElectron.PowerSaveBlocker; - protocol: GitHubElectron.Protocol; - screen: GitHubElectron.Screen; - session: GitHubElectron.Session; - Tray: typeof GitHubElectron.Tray; + powerSaveBlocker: Electron.PowerSaveBlocker; + protocol: Electron.Protocol; + screen: Electron.Screen; + session: Electron.Session; + Tray: typeof Electron.Tray; hideInternalModules(): void; } @@ -1814,11 +1849,11 @@ declare module GitHubElectron { getSources(options: any, callback: (error: Error, sources: DesktopCapturerSource[]) => any): void; } - interface Electron extends CommonElectron { - desktopCapturer: GitHubElectron.DesktopCapturer; - ipcRenderer: GitHubElectron.IpcRenderer; - remote: GitHubElectron.Remote; - webFrame: GitHubElectron.WebFrame; + interface ElectronMainAndRenderer extends CommonElectron { + desktopCapturer: Electron.DesktopCapturer; + ipcRenderer: Electron.IpcRenderer; + remote: Electron.Remote; + webFrame: Electron.WebFrame; } } @@ -1827,7 +1862,7 @@ interface Window { * Creates a new window. * @returns An instance of BrowserWindowProxy class. */ - open(url: string, frameName?: string, features?: string): GitHubElectron.BrowserWindowProxy; + open(url: string, frameName?: string, features?: string): Electron.BrowserWindowProxy; } interface File { @@ -1838,10 +1873,10 @@ interface File { } declare module 'electron' { - var electron: GitHubElectron.Electron; + var electron: Electron.ElectronMainAndRenderer; export = electron; } interface NodeRequireFunction { - (id: 'electron'): GitHubElectron.Electron; + (moduleName: 'electron'): Electron.ElectronMainAndRenderer; } diff --git a/google.analytics/ga-tests.ts b/google.analytics/ga-tests.ts index ba4f80dea..acff9eb55 100644 --- a/google.analytics/ga-tests.ts +++ b/google.analytics/ga-tests.ts @@ -23,6 +23,16 @@ describe('UniversalAnalytics', () => { ga('create', 'UA-65432-1', 'auto', {some: 'config'}); ga('send', 'pageview'); ga('send', 'pageview', {some: 'details'}); + ga('send', 'event', 'Videos', 'play', 'Fall Campaign'); + ga('send', {hitType: 'event', eventCategory: 'Videos', eventAction: 'play', eventLabel: 'Fall Campaign'}); + ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {nonInteraction: true}); + ga('send', 'pageview', '/page'); + ga('send', 'social', {'socialNetwork': 'facebook', 'socialAction': 'like', 'socialTarget': 'http://foo.com'}); + ga('send', 'social', {'socialNetwork': 'google+', 'socialAction': 'plus', 'socialTarget': 'http://foo.com'}); + ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123}); + ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123, 'timingLabel': 'label'}); + ga('trackerName.send', 'event', 'load'); + ga.create('UA-65432-1', 'auto'); ga.create('UA-65432-1', {some: 'config'}); ga.create('UA-65432-1', 'auto', {some: 'config'}); @@ -30,7 +40,7 @@ describe('UniversalAnalytics', () => { ga.getByName('aNamedTracker'); }); it('should excercise Tracker APIs', () => { - var tracker: UniversalAnalytics.Tracker = ga('create', 'UA-65432-1', 'auto'); + var tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto'); var aString: string = tracker.get('aString'); var aNumber: number = tracker.get('aNumber'); var anObject: {} = tracker.get<{}>('anObject'); diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index a8e1b1e25..68d0293a4 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -38,17 +38,56 @@ interface GoogleAnalytics { declare module UniversalAnalytics { // https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference + + enum HitType { + 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing' + } interface ga { l: number; q: any[]; - (command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker; - (command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - (command: string, hitDetails: {}): void; - create(trackingId: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - create(trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; + + (command: 'send', hitType: 'event', eventCategory: string, eventAction: string, + eventLabel?: string, eventValue?: number, fieldsObject?: {}): void; + (command: 'send', hitType: 'event', fieldsObject: { + eventCategory: string, + eventAction: string, + eventLabel?: string, + eventValue?: number, + nonInteraction?: boolean}): void; + (command: 'send', fieldsObject: { + hitType: HitType, // 'event' + eventCategory: string, + eventAction: string, + eventLabel?: string, + eventValue?: number, + nonInteraction?: boolean}): void; + (command: 'send', hitType: 'pageview', page: string): void; + (command: 'send', hitType: 'social', + socialNetwork: string, socialAction: string, socialTarget: string): void; + (command: 'send', hitType: 'social', + fieldsObject: {socialNetwork: string, socialAction: string, socialTarget: string}): void; + (command: 'send', hitType: 'timing', + timingCategory: string, timingVar: string, timingValue: number): void; + (command: 'send', hitType: 'timing', + fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; + (command: 'send', fieldsObject: {}): void; + (command: string, hitType: HitType, ...fields: any[]): void; + + (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; + (command: 'remove'): void; + + (command: string, ...fields: any[]): void; + + (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; + + create(trackingId: string, cookieDomain: string, name: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, cookieDomain: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + getAll(): UniversalAnalytics.Tracker[]; getByName(name: string): UniversalAnalytics.Tracker; + remove(name:string): void; } interface Tracker { diff --git a/gulp-autoprefixer/gulp-autoprefixer.d.ts b/gulp-autoprefixer/gulp-autoprefixer.d.ts index 4ab8cf40d..d372358eb 100644 --- a/gulp-autoprefixer/gulp-autoprefixer.d.ts +++ b/gulp-autoprefixer/gulp-autoprefixer.d.ts @@ -6,15 +6,15 @@ /// declare module "gulp-autoprefixer" { - interface Options { - browsers?: string[]; - cascade?: boolean; - remove?: boolean; + namespace autoPrefixer { + interface Options { + browsers?: string[]; + cascade?: boolean; + remove?: boolean; + } } - function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream; - - namespace autoPrefixer {} + function autoPrefixer(opts?: autoPrefixer.Options): NodeJS.ReadWriteStream; export = autoPrefixer; } diff --git a/gulp-filter/gulp-filter-tests.ts b/gulp-filter/gulp-filter-tests.ts new file mode 100644 index 000000000..a542ef548 --- /dev/null +++ b/gulp-filter/gulp-filter-tests.ts @@ -0,0 +1,71 @@ +/// +/// +/// +/// +/// + +import * as gulp from 'gulp'; +import * as uglify from 'gulp-uglify'; +import * as less from 'gulp-less'; +import * as concat from 'gulp-concat'; +import * as filter from 'gulp-filter'; + +// Filter only +gulp.task('default', () => { + // create filter instance inside task function + const f = filter(['*', '!src/vendor']); + + return gulp.src('src/*.js') + // filter a subset of the files + .pipe(f) + // run them through a plugin + .pipe(uglify()) + .pipe(gulp.dest('dist')); +}); + +// Restoring filtered files +gulp.task('default', () => { + // create filter instance inside task function + const f = filter(['*', '!src/vendor'], {restore: true}); + + return gulp.src('src/*.js') + // filter a subset of the files + .pipe(f) + // run them through a plugin + .pipe(uglify()) + // bring back the previously filtered out files (optional) + .pipe(f.restore) + .pipe(gulp.dest('dist')); +}); + +// Multiple filters +gulp.task('default', () => { + const jsFilter = filter('**/*.js', {restore: true}); + const lessFilter = filter('**/*.less', {restore: true}); + + return gulp.src('assets/**') + .pipe(jsFilter) + .pipe(concat('bundle.js')) + .pipe(jsFilter.restore) + .pipe(lessFilter) + .pipe(less()) + .pipe(lessFilter.restore) + .pipe(gulp.dest('out/')); +}); + +// Restore as a file source +gulp.task('default', () => { + const f = filter(['*', '!src/vendor'], {restore: true, passthrough: false}); + + const stream = gulp.src('src/*.js') + // filter a subset of the files + .pipe(f) + // run them through a plugin + .pipe(uglify()) + .pipe(gulp.dest('dist')); + + // use filtered files as a gulp file source + f.restore.pipe(gulp.dest('vendor-dist')); + + return stream; +}); diff --git a/gulp-filter/gulp-filter.d.ts b/gulp-filter/gulp-filter.d.ts new file mode 100644 index 000000000..2e37f3bcb --- /dev/null +++ b/gulp-filter/gulp-filter.d.ts @@ -0,0 +1,33 @@ +// Type definitions for gulp-filter v3.0.1 +// Project: https://github.com/sindresorhus/gulp-filter +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// + +declare module 'gulp-filter' { + import File = require('vinyl'); + import * as Minimatch from 'minimatch'; + + namespace filter { + interface FileFunction { + (file: File): boolean; + } + + interface Options extends Minimatch.IOptions { + restore?: boolean; + passthrough?: boolean; + } + + // A transform stream with a .restore object + interface Filter extends NodeJS.ReadWriteStream { + restore: NodeJS.ReadWriteStream + } + } + + function filter(pattern: string | string[] | filter.FileFunction, options?: filter.Options): filter.Filter; + + export = filter; +} diff --git a/gulp-htmlmin/gulp-htmlmin-tests.ts b/gulp-htmlmin/gulp-htmlmin-tests.ts new file mode 100644 index 000000000..78149e787 --- /dev/null +++ b/gulp-htmlmin/gulp-htmlmin-tests.ts @@ -0,0 +1,11 @@ +/// +/// + +import * as gulp from 'gulp'; +import * as htmlmin from 'gulp-htmlmin'; + +gulp.task('minify', function() { + return gulp.src('src/*.html') + .pipe(htmlmin({collapseWhitespace: true})) + .pipe(gulp.dest('dist')) +}); diff --git a/gulp-htmlmin/gulp-htmlmin.d.ts b/gulp-htmlmin/gulp-htmlmin.d.ts new file mode 100644 index 000000000..2cf947d23 --- /dev/null +++ b/gulp-htmlmin/gulp-htmlmin.d.ts @@ -0,0 +1,18 @@ +// Type definitions for gulp-htmlmin v1.3.0 +// Project: https://github.com/jonschlinkert/gulp-htmlmin +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module 'gulp-htmlmin' { + import * as HTMLMinifier from 'html-minifier'; + + namespace htmlmin { + } + + function htmlmin(options?: HTMLMinifier.Options): NodeJS.ReadWriteStream; + + export = htmlmin; +} diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts new file mode 100644 index 000000000..d6077eae5 --- /dev/null +++ b/gulp-jade/gulp-jade-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +import * as gulp from 'gulp'; +import * as jade from 'gulp-jade'; + +gulp.task('jade', () => { + gulp.src('src/**/*.jade') + .pipe(jade()) + .pipe(gulp.dest('dist/')); +}); + +gulp.task('jade:pretty', () => { + gulp.src('src/**/*.jade') + .pipe(jade({ + pretty: '\t', + })) + .pipe(gulp.dest('dist/')) +}); + +gulp.task('jade:client', () => { + gulp.src('src/**/*.jade') + .pipe(jade({ + client: true, + pretty: true, + debug: false, + compileDebug: false, + })); +}); \ No newline at end of file diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts new file mode 100644 index 000000000..221a14db0 --- /dev/null +++ b/gulp-jade/gulp-jade.d.ts @@ -0,0 +1,87 @@ +// Type definitions for gulp-jade +// Project: https://github.com/phated/gulp-jade +// Definitions by: berwyn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "gulp-jade" { + + function GulpJade(params?: GulpJade.Params): any; + + module GulpJade { + interface Params { + /******* + * JADE API OPTIONS + *******/ + + /** + * If the doctype is not specified as part of the + * template, you can specify it here. It is sometimes + * useful to get self-closing tags and remove mirroring + * of boolean attributes. + */ + doctype?: string; + + /** + * Adds whitespace to the resulting html to make it + * easier for a human to read using ' ' as indentation. + * If a string is specified, that will be used as + * indentation instead (e.g. '\t'). + */ + pretty?: boolean|string; + + /** + * Use a self namespace to hold the locals (false by default) + */ + self?: boolean; + + /** + * If set to true, the tokens and function body is logged + * to stdout + */ + debug?: boolean; + + /** + * If set to true, the function source will be included in the + * compiled template for better error messages (sometimes useful + * in development). It is enabled by default unless used with + * express in production mode. + */ + compileDebug?:boolean; + + /** + * If set to true, compiled functions are cached. filename + * must be set as the cache key. + */ + cache?:boolean; + + /******* + * GULP-JADE OPTIONS + *******/ + + /** + * Used to set a version of jade other than this library's + * dependency, or to customise filters. + */ + jade?: any; + + /** + * Compile to JS instead of HTML. + */ + client?: boolean; + + /** + * Locals to be used while parsing jade files. Takes + * precedence over data. + */ + locals?: any; + + /** + * Data to be used while parsing jade files. Has lower + * precedence than locals. + */ + data?: any; + } + } + + export = GulpJade; +} \ No newline at end of file diff --git a/gulp-less/gulp-less.d.ts b/gulp-less/gulp-less.d.ts index 8ee0a9b48..daab47637 100644 --- a/gulp-less/gulp-less.d.ts +++ b/gulp-less/gulp-less.d.ts @@ -11,6 +11,7 @@ declare module "gulp-less" { modifyVars?: {}; paths?: string[]; plugins?: any[]; + relativeUrls?: boolean; } function less(options?: IOptions): NodeJS.ReadWriteStream; diff --git a/gulp-minify-css/gulp-minify-css-tests.ts b/gulp-minify-css/gulp-minify-css-tests.ts index d8ac4d9df..9bfe9697a 100644 --- a/gulp-minify-css/gulp-minify-css-tests.ts +++ b/gulp-minify-css/gulp-minify-css-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// import * as gulp from "gulp"; diff --git a/gulp-minify-css/gulp-minify-css.d.ts b/gulp-minify-css/gulp-minify-css.d.ts index bc990a6e0..cb0eea502 100644 --- a/gulp-minify-css/gulp-minify-css.d.ts +++ b/gulp-minify-css/gulp-minify-css.d.ts @@ -4,28 +4,12 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module "gulp-minify-css" { + import * as CleanCSS from 'clean-css'; - interface IOptions { - cache?: boolean; - advanced?: boolean; - aggressiveMerging?: boolean; - benchmark?: boolean; - compatibility?: string; - debug?: boolean; - inliner?: Object; - keepBreaks?: boolean; - keepSpecialComments?: string | number; - processImport?: boolean; - rebase?: boolean; - relativeTo?: string; - root?: string; - roundingPrecision?: number; - shorthandCompacting?: boolean; - } - - function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream; + function minifyCSS(options?: CleanCSS.Options): NodeJS.ReadWriteStream; namespace minifyCSS {} diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 2ec41e556..1b3c7639d 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -4,11 +4,13 @@ import * as gulp from 'gulp'; import * as minifyHtml from 'gulp-minify-html'; +// This package has been deprecated in favor of gulp-htmlmin, which should be faster and more comprehensive. + minifyHtml(); minifyHtml({conditionals: true, loose: true}); gulp.task('minify-html', () => { - var opts = { + var opts: minifyHtml.Options = { conditionals: true, spare: true }; diff --git a/gulp-minify-html/gulp-minify-html.d.ts b/gulp-minify-html/gulp-minify-html.d.ts index 11ce298a4..770789bbb 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -5,33 +5,36 @@ /// +// This package has been deprecated in favor of gulp-htmlmin, which should be faster and more comprehensive. + declare module 'gulp-minify-html' { - interface IOptions { - // Do not remove empty attributes - empty?: boolean; + namespace minifyHtml { + // Options from https://github.com/Swaagie/minimize#options + interface Options { + // Do not remove empty attributes + empty?: boolean; - // Do not strip CDATA from scripts - cdata?: boolean; + // Do not strip CDATA from scripts + cdata?: boolean; - // Do not remove comments - comments?: boolean; + // Do not remove comments + comments?: boolean; - // Do not remove conditional internet explorer comments - conditionals?: boolean; + // Do not remove conditional internet explorer comments + conditionals?: boolean; - // Do not remove redundant attributes - spare?: boolean; + // Do not remove redundant attributes + spare?: boolean; - // Do not remove arbitrary quotes - quotes?: boolean; + // Do not remove arbitrary quotes + quotes?: boolean; - // Preserve one whitespace - loose?: boolean; + // Preserve one whitespace + loose?: boolean; + } } - function minifyHtml(options?: IOptions): NodeJS.ReadWriteStream; - - namespace minifyHtml {} + function minifyHtml(options?: minifyHtml.Options): NodeJS.ReadWriteStream; export = minifyHtml; } diff --git a/gulp-replace/gulp-replace-tests.ts b/gulp-replace/gulp-replace-tests.ts index a914bfd44..8e043d774 100644 --- a/gulp-replace/gulp-replace-tests.ts +++ b/gulp-replace/gulp-replace-tests.ts @@ -1,11 +1,11 @@ /// /// -import gulp = require("gulp"); -import replace = require("gulp-replace"); +import * as gulp from "gulp"; +import * as replace from "gulp-replace"; gulp.task('templates', function(){ gulp.src(['file.txt']) .pipe(replace("test", "foo")) .pipe(replace(/foo(.{3})/g, '$1foo')) .pipe(gulp.dest('build/file.txt')); -}); \ No newline at end of file +}); diff --git a/gulp-replace/gulp-replace.d.ts b/gulp-replace/gulp-replace.d.ts index cf6ef7164..f32e33bbe 100644 --- a/gulp-replace/gulp-replace.d.ts +++ b/gulp-replace/gulp-replace.d.ts @@ -17,5 +17,7 @@ declare module "gulp-replace" { function replace(pattern: string, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; function replace(pattern: RegExp, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; + namespace replace {} + export = replace; -} \ No newline at end of file +} diff --git a/gulp-rev-replace/gulp-rev-replace-tests.ts b/gulp-rev-replace/gulp-rev-replace-tests.ts index e7c5d9c18..7610183d8 100644 --- a/gulp-rev-replace/gulp-rev-replace-tests.ts +++ b/gulp-rev-replace/gulp-rev-replace-tests.ts @@ -3,10 +3,10 @@ /// /// -import gulp = require('gulp'); -import revReplace = require('gulp-rev-replace'); -import rev = require('gulp-rev'); -import useref = require('gulp-useref'); +import * as gulp from 'gulp'; +import * as revReplace from 'gulp-rev-replace'; +import * as rev from 'gulp-rev'; +import * as useref from 'gulp-useref'; gulp.task("index", () => { return gulp.src("src/index.html") diff --git a/gulp-rev-replace/gulp-rev-replace.d.ts b/gulp-rev-replace/gulp-rev-replace.d.ts index 3e683d183..6c258573d 100644 --- a/gulp-rev-replace/gulp-rev-replace.d.ts +++ b/gulp-rev-replace/gulp-rev-replace.d.ts @@ -6,16 +6,18 @@ /// declare module 'gulp-rev-replace' { - interface IOptions { - canonicalUris?: boolean; - replaceInExtensions?: Array; - prefix?: string; - manifest?: NodeJS.ReadWriteStream; - modifyUnreved?: Function; - modifyReved?: Function; + namespace revReplace { + interface Options { + canonicalUris?: boolean; + replaceInExtensions?: Array; + prefix?: string; + manifest?: NodeJS.ReadWriteStream; + modifyUnreved?: Function; + modifyReved?: Function; } + } - function revReplace(options?: IOptions): NodeJS.ReadWriteStream; + function revReplace(options?: revReplace.Options): NodeJS.ReadWriteStream; - export = revReplace; + export = revReplace; } diff --git a/gulp-shell/gulp-shell.d.ts b/gulp-shell/gulp-shell.d.ts index d88f27ed6..4d18d610c 100644 --- a/gulp-shell/gulp-shell.d.ts +++ b/gulp-shell/gulp-shell.d.ts @@ -10,7 +10,7 @@ declare module "gulp-shell" { namespace shell { interface Shell { (commands: string|string[], options?: Option): NodeJS.ReadWriteStream; - task(commands: string|string[], options?: Option): () => NodeJS.ReadWriteStream; + task(commands: string|string[], options?: Option): (done: Function) => NodeJS.ReadWriteStream; } interface Option { diff --git a/gulp-size/gulp-size.d.ts b/gulp-size/gulp-size.d.ts index 022e9b171..ba13c55a2 100644 --- a/gulp-size/gulp-size.d.ts +++ b/gulp-size/gulp-size.d.ts @@ -6,20 +6,20 @@ /// declare module 'gulp-size' { - interface IOptions { - showFiles?: boolean; - gzip?: boolean; - title?: string; + namespace size { + interface Options { + showFiles?: boolean; + gzip?: boolean; + title?: string; + } + + interface SizeStream extends NodeJS.ReadWriteStream { + size: number; + prettySize: string; + } } - interface ISizeStream extends NodeJS.ReadWriteStream { - size: number; - prettySize: string; - } - - function size(options?: IOptions): ISizeStream; - - namespace size {} + function size(options?: size.Options): size.SizeStream; export = size; } diff --git a/gulp-uglify/gulp-uglify-tests.ts b/gulp-uglify/gulp-uglify-tests.ts index e4f1f0d8a..01cfb06f9 100644 --- a/gulp-uglify/gulp-uglify-tests.ts +++ b/gulp-uglify/gulp-uglify-tests.ts @@ -1,8 +1,8 @@ -/// +/// /// -import gulp = require("gulp"); -import uglify = require("gulp-uglify"); +import * as gulp from 'gulp'; +import * as uglify from 'gulp-uglify'; gulp.task('compress', function() { var tsResult = gulp.src('lib/*.ts') @@ -21,4 +21,4 @@ gulp.task('compress2', function() { } })) .pipe(gulp.dest('dist')); -}); \ No newline at end of file +}); diff --git a/gulp-uglify/gulp-uglify.d.ts b/gulp-uglify/gulp-uglify.d.ts index 05eb937ed..b070f3f35 100644 --- a/gulp-uglify/gulp-uglify.d.ts +++ b/gulp-uglify/gulp-uglify.d.ts @@ -4,172 +4,39 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module "gulp-uglify" { - function GulpUglify(options?: IGulpUglifyOptions): NodeJS.ReadWriteStream; + import * as UglifyJS from 'uglify-js'; - interface IGulpUglifyOptions { - /** - * Pass false to skip mangling names. - */ - mangle?: boolean; + namespace GulpUglify { + interface Options { + /** + * Pass false to skip mangling names. + */ + mangle?: boolean; - /** - * Pass if you wish to specify additional output options. The defaults are optimized for best compression. - */ - output?: IOutputOptions; + /** + * Pass if you wish to specify additional output options. The defaults are optimized for best compression. + */ + output?: UglifyJS.BeautifierOptions; - /** - * Pass an object to specify custom compressor options. Pass false to skip compression completely. - */ - compress?: boolean; + /** + * Pass an object to specify custom compressor options. Pass false to skip compression completely. + */ + compress?: UglifyJS.CompressorOptions | boolean; - /** - * A convenience option for options.output.comments. Defaults to preserving no comments. - * all - Preserve all comments in code blocks - * some - Preserve comments that start with a bang (!) or include a Closure Compiler directive (@preserve, @license, @cc_on) - * function - Specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either true or false. - */ - preserverComments?: string|((node: any, comment: ITokenizer) => boolean); + /** + * A convenience option for options.output.comments. Defaults to preserving no comments. + * all - Preserve all comments in code blocks + * some - Preserve comments that start with a bang (!) or include a Closure Compiler directive (@preserve, @license, @cc_on) + * function - Specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either true or false. + */ + preserverComments?: string|((node: any, comment: UglifyJS.Tokenizer) => boolean); + } } - interface IOutputOptions { - /** - * Start indentation on every line (only when `beautify`) - */ - indent_start?: number; + function GulpUglify(options?: GulpUglify.Options): NodeJS.ReadWriteStream; - /** - * Indentation level (only when `beautify`) - */ - indent_level?: number; - - /** - * Quote all keys in object literals? - */ - quote_keys?: boolean; - - /** - * Add a space after colon signs? - */ - space_colon?: boolean; - - /** - * Output ASCII-safe? (encodes Unicode characters as ASCII) - */ - ascii_only?: boolean; - - /** - * Escape " // Definitions: https://github.com/borisyankov/DefinitelyTyped -//This is a total rewrite of Hakubo's original hapi.d.ts, as it was out of date/incomplete. +//Note/Disclaimer: This .d.ts was created against hapi v8.x but has been incrementally upgraded to 12.x. Some newer features/changes may be missing. YMMV. /// declare module "hapi" { - import http = require("http"); - import stream = require("stream"); - import Events = require("events"); + import http = require("http"); + import stream = require("stream"); + import Events = require("events"); - interface IDictionary { - [key: string]: T; - } + interface IDictionary { + [key: string]: T; + } - interface IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; - } + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } - interface IPromise extends IThenable { - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; - then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; - catch(onRejected?: (error: any) => U | IThenable): IPromise; - } + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; + } /** Boom Module for errors. https://github.com/hapijs/boom * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */ - export interface IBoom extends Error { - /** if true, indicates this is a Boom object instance. */ - isBoom: boolean; - /** convenience bool indicating status code >= 500. */ - isServer: boolean; - /** the error message. */ - message: string; - /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ - output: { - /** the HTTP status code (typically 4xx or 5xx). */ - statusCode: number; - /** an object containing any HTTP headers where each key is a header name and value is the header content. */ - headers: IDictionary; - /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ - payload: { - /** the HTTP status code, derived from error.output.statusCode. */ - statusCode: number; - /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ - error: string; - /** the error message derived from error.message. */ - message: string; - }; - }; - /** reformat()rebuilds error.output using the other object properties. */ - reformat(): void; + export interface IBoom extends Error { + /** if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** convenience bool indicating status code >= 500. */ + isServer: boolean; + /** the error message. */ + message: string; + /** the formatted response.Can be directly manipulated after object construction to return a custom error response.Allowed root keys: */ + output: { + /** the HTTP status code (typically 4xx or 5xx). */ + statusCode: number; + /** an object containing any HTTP headers where each key is a header name and value is the header content. */ + headers: IDictionary; + /** the formatted object used as the response payload (stringified).Can be directly manipulated but any changes will be lost if reformat() is called.Any content allowed and by default includes the following content: */ + payload: { + /** the HTTP status code, derived from error.output.statusCode. */ + statusCode: number; + /** the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ + error: string; + /** the error message derived from error.message. */ + message: string; + }; + }; + /** reformat()rebuilds error.output using the other object properties. */ + reformat(): void; - } + } - /** cache functionality via the "CatBox" module. */ - export interface ICatBoxCacheOptions { - /** a prototype function or catbox engine object. */ - engine: any; - /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ - name?: string; - /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ - shared?: boolean; - } + /** cache functionality via the "CatBox" module. */ + export interface ICatBoxCacheOptions { + /** a prototype function or catbox engine object. */ + engine: any; + /** an identifier used later when provisioning or configuring caching for server methods or plugins. Each cache name must be unique. A single item may omit the name option which defines the default cache. If every cache includes a name, a default memory cache is provisions as well. */ + name?: string; + /** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */ + shared?: boolean; + } - /** Any connections configuration server defaults can be included to override and customize the individual connection. */ - export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { - /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ - host?: string; - /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ - address?: string; - /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ - port?: string|number; - /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ - uri?: string; - /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ - listener?: any; - /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ - autoListen?: boolean; - /** caching headers configuration: */ - cache?: { - /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ - statuses: number[]; - }; - /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ - labels?: string|string[]; - /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ - tls?: boolean|Object; + /** Any connections configuration server defaults can be included to override and customize the individual connection. */ + export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults { + /** - the public hostname or IP address. Used only to set server.info.host and server.info.uri. If not configured, defaults to the operating system hostname and if not available, to 'localhost'.*/ + host?: string; + /** - sets the host name or IP address the connection will listen on.If not configured, defaults to host if present, otherwise to all available network interfaces (i.e. '0.0.0.0').Set to 127.0.0.1 or localhost to restrict connection to only those coming from the same machine.*/ + address?: string; + /** - the TCP port the connection will listen to.Defaults to an ephemeral port (0) which uses an available port when the server is started (and assigned to server.info.port).If port is a string containing a '/' character, it is used as a UNIX domain socket path and if it starts with '\.\pipe' as a Windows named pipe.*/ + port?: string | number; + /** - the full public URI without the path (e.g. 'http://example.com:8080').If present, used as the connection info.uri otherwise constructed from the connection settings.*/ + uri?: string; + /** - optional node.js HTTP (or HTTPS) http.Server object or any compatible object.If the listener needs to be manually started, set autoListen to false.If the listener uses TLS, set tls to true.*/ + listener?: any; + /** - indicates that the connection.listener will be started manually outside the framework.Cannot be specified with a port setting.Defaults to true.*/ + autoListen?: boolean; + /** caching headers configuration: */ + cache?: { + /** - an array of HTTP response status codes (e.g. 200) which are allowed to include a valid caching directive.Defaults to [200]. */ + statuses: number[]; + }; + /** - a string or string array of labels used to server.select() specific connections matching the specified labels.Defaults to an empty array [](no labels).*/ + labels?: string | string[]; + /** - used to create an HTTPS connection.The tls object is passed unchanged as options to the node.js HTTPS server as described in the node.js HTTPS documentation.Set to true when passing a listener object that has been configured to use TLS directly. */ + tls?: boolean | { key?: string; cert?: string; pfx?: string; } | Object; - } + } - export interface IConnectionConfigurationServerDefaults { - /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ - app?: any; - /** connection load limits configuration where: */ - load?: { - /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxHeapUsedBytes: number; - /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxRssBytes: number; - /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ - maxEventLoopDelay: number; - }; - /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ - plugins?: any; - /** controls how incoming request URIs are matched against the routing table: */ - router?: { - /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ - isCaseSensitive: boolean; - /** removes trailing slashes on incoming paths. Defaults to false. */ - stripTrailingSlash: boolean; - }; - /** a route options object used to set the default configuration for every route. */ - routes?: IRouteAdditionalConfigurationOptions; - state?: IServerState; - } + export interface IConnectionConfigurationServerDefaults { + /** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */ + app?: any; + /** connection load limits configuration where: */ + load?: { + /** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxHeapUsedBytes: number; + /** maximum process RSS size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxRssBytes: number; + /** maximum event loop delay duration in milliseconds over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */ + maxEventLoopDelay: number; + }; + /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ + plugins?: any; + /** controls how incoming request URIs are matched against the routing table: */ + router?: { + /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ + isCaseSensitive: boolean; + /** removes trailing slashes on incoming paths. Defaults to false. */ + stripTrailingSlash: boolean; + }; + /** a route options object used to set the default configuration for every route. */ + routes?: IRouteAdditionalConfigurationOptions; + state?: IServerState; + } - /** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ - export interface IServerOptions { - /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ - app?: any; + /** Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on.*/ + export interface IServerOptions { + /** application-specific configuration which can later be accessed via server.settings.app. Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state. Defaults to {}. */ + app?: any; /** sets up server-side caching. Every server includes a default cache for storing application state. By default, a simple memory-based cache is created which has limited capacity and capabilities. hapi uses catbox for its cache which includes support for common storage solutions (e.g. Redis, MongoDB, Memcached, and Riak). Caching is only utilized if methods and plugins explicitly store their state in the cache. The server cache configuration only defines the storage container itself. cache can be assigned: a prototype function (usually obtained by calling require() on a catbox strategy such as require('catbox-redis')). a configuration object with the following options: @@ -132,86 +132,86 @@ declare module "hapi" { sharedif true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. other options passed to the catbox strategy used. an array of the above object for configuring multiple cache instances, each with a unique name. When an array of objects is provided, multiple cache connections are established and each array item (except one) must include a name. */ - cache?: string|ICatBoxCacheOptions|Array|any; - /** sets the default connections configuration which can be overridden by each connection where: */ - connections?: IConnectionConfigurationServerDefaults; - /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ - debug?: boolean|{ - /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ - log: string[]; - /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ - request: string[]; - }; - /** file system related settings*/ - files?: { - /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ - etagsCacheMaxSize?: number; - }; - /** process load monitoring*/ - load?: { - /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ - sampleInterval?: number; - }; + cache?: string | ICatBoxCacheOptions | Array | any; + /** sets the default connections configuration which can be overridden by each connection where: */ + connections?: IConnectionConfigurationServerDefaults; + /** determines which logged events are sent to the console (this should only be used for development and does not affect which events are actually logged internally and recorded). Set to false to disable all console logging, or to an object*/ + debug?: boolean | { + /** - a string array of server log tags to be displayed via console.error() when the events are logged via server.log() as well as internally generated server logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error. */ + log: string[]; + /** - a string array of request log tags to be displayed via console.error() when the events are logged via request.log() as well as internally generated request logs. For example, to display all errors, set the option to ['error']. To turn off all console debug messages set it to false. Defaults to uncaught errors thrown in external code (these errors are handled automatically and result in an Internal Server Error response) or runtime errors due to developer error.*/ + request: string[]; + }; + /** file system related settings*/ + files?: { + /** sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000.*/ + etagsCacheMaxSize?: number; + }; + /** process load monitoring*/ + load?: { + /** the frequency of sampling in milliseconds. Defaults to 0 (no sampling).*/ + sampleInterval?: number; + }; - /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ - mime?: any; - /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ - minimal?: boolean; - /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ - plugins?: IDictionary; + /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime.*/ + mime?: any; + /** if true, does not load the inert (file and directory support), h2o2 (proxy support), and vision (views support) plugins automatically. The plugins can be loaded manually after construction. Defaults to false (plugins loaded). */ + minimal?: boolean; + /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}.*/ + plugins?: IDictionary; - } + } - export interface IServerViewCompile { - (template: string, options: any): void; - (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; - } + export interface IServerViewCompile { + (template: string, options: any): void; + (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean) => void) => void) => void): void; + } - export interface IServerViewsAdditionalOptions { - /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ - path?: string; + export interface IServerViewsAdditionalOptions { + /** path - the root file path used to resolve and load the templates identified when calling reply.view().Defaults to current working directory.*/ + path?: string; /**partialsPath - the root file path where partials are located.Partials are small segments of template code that can be nested and reused throughout other templates.Defaults to no partials support (empty path). */ - partialsPath?: string; - /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ - helpersPath?: string; - /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ - relativeTo?: string; + partialsPath?: string; + /**helpersPath - the directory path where helpers are located.Helpers are functions used within templates to perform transformations and other data manipulations using the template context or other inputs.Each '.js' file in the helpers directory is loaded and the file name is used as the helper name.The files must export a single method with the signature function(context) and return a string.Sub - folders are not supported and are ignored.Defaults to no helpers support (empty path).Note that jade does not support loading helpers this way.*/ + helpersPath?: string; + /**relativeTo - a base path used as prefix for path and partialsPath.No default.*/ + relativeTo?: string; - /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ - layout?: boolean; - /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ - layoutPath?: string; - /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ - layoutKeywork?: string; - /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ - encoding?: string; - /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ - isCached?: boolean; - /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ - allowAbsolutePaths?: boolean; - /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ - allowInsecureAccess?: boolean; - /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ - compileOptions?: any; - /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ - runtimeOptions?: any; - /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ - contentType?: string; - /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ - compileMode?: string; - /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ - context?: any; - } + /**layout - if set to true or a layout filename, layout support is enabled.A layout is a single template file used as the parent template for other view templates in the same engine.If true, the layout template name must be 'layout.ext' where 'ext' is the engine's extension. Otherwise, the provided filename is suffixed with the engine's extension and loaded.Disable layout when using Jade as it will handle including any layout files independently.Defaults to false.*/ + layout?: boolean; + /**layoutPath - the root file path where layout templates are located (using the relativeTo prefix if present). Defaults to path.*/ + layoutPath?: string; + /**layoutKeyword - the key used by the template engine to denote where primary template content should go.Defaults to 'content'.*/ + layoutKeywork?: string; + /**encoding - the text encoding used by the templates when reading the files and outputting the result.Defaults to 'utf8'.*/ + encoding?: string; + /**isCached - if set to false, templates will not be cached (thus will be read from file on every use).Defaults to true.*/ + isCached?: boolean; + /**allowAbsolutePaths - if set to true, allows absolute template paths passed to reply.view().Defaults to false.*/ + allowAbsolutePaths?: boolean; + /**allowInsecureAccess - if set to true, allows template paths passed to reply.view() to contain '../'.Defaults to false.*/ + allowInsecureAccess?: boolean; + /**compileOptions - options object passed to the engine's compile function. Defaults to empty options {}.*/ + compileOptions?: any; + /**runtimeOptions - options object passed to the returned function from the compile operation.Defaults to empty options {}.*/ + runtimeOptions?: any; + /**contentType - the content type of the engine results.Defaults to 'text/html'.*/ + contentType?: string; + /**compileMode - specify whether the engine compile() method is 'sync' or 'async'.Defaults to 'sync'.*/ + compileMode?: string; + /**context - a global context used with all templates.The global context option can be either an object or a function that takes no arguments and returns a context object.When rendering views, the global context will be merged with any context object specified on the handler or using reply.view().When multiple context objects are used, values from the global context always have lowest precedence.*/ + context?: any; + } - export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { + export interface IServerViewsEnginesOptions extends IServerViewsAdditionalOptions { /**- the npm module used for rendering the templates.The module object must contain: "module", the rendering function. The required function signature depends on the compileMode settings. * If the compileMode is 'sync', the signature is compile(template, options), the return value is a function with signature function(context, options), and the method is allowed to throw errors.If the compileMode is 'async', the signature is compile(template, options, callback) where callback has the signature function(err, compiled) where compiled is a function with signature function(context, options, callback) and callback has the signature function(err, rendered).*/ - module: { - compile? (template: any, options: any): (context: any, options: any) => void; - compile? (template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; - }; - } + module: { + compile?(template: any, options: any): (context: any, options: any) => void; + compile?(template: any, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: any) => void) => void) => void): void; + }; + } /**Initializes the server views manager var Hapi = require('hapi'); @@ -226,12 +226,12 @@ declare module "hapi" { }); When server.views() is called within a plugin, the views manager is only available to plugins methods. */ - export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { - /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ - engines: IDictionary|IServerViewsEnginesOptions; - /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ - defaultExtension?: string; - } + export interface IServerViewsConfiguration extends IServerViewsAdditionalOptions { + /** - required object where each key is a file extension (e.g. 'html', 'hbr'), mapped to the npm module used for rendering the templates.Alternatively, the extension can be mapped to an object with the following options:*/ + engines: IDictionary | IServerViewsEnginesOptions; + /** defines the default filename extension to append to template names when multiple engines are configured and not explicit extension is provided for a given template. No default value.*/ + defaultExtension?: string; + } /** Concludes the handler activity by setting a response and returning control over to the framework where: erran optional error response. @@ -239,275 +239,280 @@ declare module "hapi" { Since an request can only have one response regardless if it is an error or success, the reply() method can only result in a single response value. This means that passing both an err and result will only use the err. There is no requirement for either err or result to be (or not) an Error object. The framework will simply use the first argument if present, otherwise the second. The method supports two arguments to be compatible with the common callback pattern of error first. FLOW CONTROL: When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */ - export interface IReply { - (err: Error, - result?: string|number|boolean|Buffer|stream.Stream | IPromise | T, - /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ - credentialData?: any - ): IBoom; - /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ - (result: string|number|boolean|Buffer|stream.Stream | IPromise | T): Response; + export interface IReply { + (err: Error, + result?: string | number | boolean | Buffer | stream.Stream | IPromise | T, + /** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */ + credentialData?: any + ): IBoom; + /** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */ + (result: string | number | boolean | Buffer | stream.Stream | IPromise | T): Response; /** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200. * The data argument is only used for passing back authentication data and is ignored elsewhere. */ - continue(credentialData?: any): void; + continue(credentialData?: any): void; - /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ - file( - /** the file path. */ - path: string, - /** optional settings: */ - options?: { - /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ - filename?: string; + /** Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. The response flow control rules do not apply. */ + file( + /** the file path. */ + path: string, + /** optional settings: */ + options?: { + /** - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; /** specifies whether to include the 'Content-Disposition' header with the response. Available values: false - header is not included. This is the default value. 'attachment' 'inline'*/ - mode?: boolean|string; - /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ - lookupCompressed: boolean; - }): void; + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + lookupCompressed: boolean; + }): void; /** Concludes the handler activity by returning control over to the router with a templatized view response. the response flow control rules apply. */ - view( - /** the template filename and path, relative to the templates path configured via the server views manager. */ - template: string, - /** optional object used by the template to render context-specific result. Defaults to no context {}. */ - context?: {}, - /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ - options?: any): Response; + view( + /** the template filename and path, relative to the templates path configured via the server views manager. */ + template: string, + /** optional object used by the template to render context-specific result. Defaults to no context {}. */ + context?: {}, + /** optional object used to override the server's views manager configuration for this response. Cannot override isCached, partialsPath, or helpersPath which are only loaded at initialization. */ + options?: any): Response; /** Concludes the handler activity by returning control over to the router and informing the router that a response has already been sent back directly via request.raw.res and that no further response action is needed The response flow control rules do not apply. */ - close(options?: { - /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ - end?: boolean; - }): void; + close(options?: { + /** if false, the router will not call request.raw.res.end()) to ensure the response was ended. Defaults to true. */ + end?: boolean; + }): void; /** Proxies the request to an upstream endpoint. the response flow control rules do not apply. */ - proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ - options: IProxyHandlerConfig): void; + proxy(/** an object including the same keys and restrictions defined by the route proxy handler options. */ + options: IProxyHandlerConfig): void; /** Redirects the client to the specified uri. Same as calling reply().redirect(uri). he response flow control rules apply. */ - redirect(uri: string): Response; - } + redirect(uri: string): ResponseRedirect; + } - export interface ISessionHandler { - (request: Request, reply: IReply): void; - } - export interface IRequestHandler { - (request: Request): T; - } + export interface ISessionHandler { + (request: Request, reply: IReply): void; + } + export interface IRequestHandler { + (request: Request): T; + } - export interface IFailAction { - (source: string, error: any, next: () => void): void - } - /** generates a reverse proxy handler */ - export interface IProxyHandlerConfig { - /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ - host?: string; - /** the upstream service port. */ - port?: number; + export interface IFailAction { + (source: string, error: any, next: () => void): void + } + /** generates a reverse proxy handler */ + export interface IProxyHandlerConfig { + /** the upstream service host to proxy requests to. The same path on the client request will be used as the path on the host.*/ + host?: string; + /** the upstream service port. */ + port?: number; /** The protocol to use when making a request to the proxied host: 'http' 'https'*/ - protocol?: string; - /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ - uri?: string; - /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ - passThrough?: boolean; - /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ - localStatePassThrough?: boolean; - /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ - acceptEncoding?: boolean; - /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ - rejectUnauthorized?: boolean; - /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ - xforward?: boolean; - /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ - redirects?: boolean|number; - /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ - timeout?: number; + protocol?: string; + /** an absolute URI used instead of the incoming host, port, protocol, path, and query. Cannot be used with host, port, protocol, or mapUri.*/ + uri?: string; + /** if true, forwards the headers sent from the client to the upstream service being proxied to, headers sent from the upstream service will also be forwarded to the client. Defaults to false.*/ + passThrough?: boolean; + /** localStatePassThrough - if false, any locally defined state is removed from incoming requests before being passed upstream. This is a security feature to prevent local state (e.g. authentication cookies) from leaking upstream to other servers along with the cookies intended for those servers. This value can be overridden on a per state basis via the server.state() passThrough option. Defaults to false.*/ + localStatePassThrough?: boolean; + /**acceptEncoding - if false, does not pass-through the 'Accept-Encoding' HTTP header which is useful when using an onResponse post-processing to avoid receiving an encoded response (e.g. gzipped). Can only be used together with passThrough. Defaults to true (passing header).*/ + acceptEncoding?: boolean; + /** rejectUnauthorized - sets the rejectUnauthorized property on the https agent making the request. This value is only used when the proxied server uses TLS/SSL. When set it will override the node.js rejectUnauthorized property. If false then ssl errors will be ignored. When true the server certificate is verified and an 500 response will be sent when verification fails. This shouldn't be used alongside the agent setting as the agent will be used instead. Defaults to the https agent default value of true.*/ + rejectUnauthorized?: boolean; + /**if true, sets the 'X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto' headers when making a request to the proxied upstream endpoint. Defaults to false.*/ + xforward?: boolean; + /** the maximum number of HTTP redirections allowed, to be followed automatically by the handler. Set to false or 0 to disable all redirections (the response will contain the redirection received from the upstream service). If redirections are enabled, no redirections (301, 302, 307, 308) will be passed along to the client, and reaching the maximum allowed redirections will return an error response. Defaults to false.*/ + redirects?: boolean | number; + /**number of milliseconds before aborting the upstream request. Defaults to 180000 (3 minutes).*/ + timeout?: number; /** a function used to map the request URI to the proxied URI. Cannot be used together with host, port, protocol, or uri. The function signature is function(request, callback) where: request - is the incoming request object. callback - is function(err, uri, headers) where: err - internal error condition. uri - the absolute proxy URI. headers - optional object where each key is an HTTP request header and the value is the header content.*/ - mapUri?: (request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void) => void; - /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ - onResponse?: ( - err: any, - res: http.ServerResponse, - req: Request, - reply: () => void, - settings: IProxyHandlerConfig, - ttl: number - ) => void; - /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ - ttl?: number; - /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ - agent?: http.Agent; - /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ - maxSockets?: boolean|number; - } - /** TODO: fill in joi definition */ - export interface IJoi { + mapUri?: (request: Request, callback: (err: any, uri: string, headers?: { [key: string]: string }) => void) => void; + /** a custom function for processing the response from the upstream service before sending to the client. Useful for custom error handling of responses from the proxied endpoint or other payload manipulation. Function signature is function(err, res, request, reply, settings, ttl) where: - err - internal or upstream error returned from attempting to contact the upstream proxy. - res - the node response object received from the upstream service. res is a readable stream (use the wreck module read method to easily convert it to a Buffer or string). - request - is the incoming request object. - reply - the reply interface function. - settings - the proxy handler configuration. - ttl - the upstream TTL in milliseconds if proxy.ttl it set to 'upstream' and the upstream response included a valid 'Cache-Control' header with 'max-age'.*/ + onResponse?: ( + err: any, + res: http.ServerResponse, + req: Request, + reply: IReply, + settings: IProxyHandlerConfig, + ttl: number + ) => void; + /** if set to 'upstream', applies the upstream response caching policy to the response using the response.ttl() method (or passed as an argument to the onResponse method if provided).*/ + ttl?: number; + /** - a node http(s) agent to be used for connections to upstream server. see https://nodejs.org/api/http.html#http_class_http_agent */ + agent?: http.Agent; + /** sets the maximum number of sockets available per outgoing proxy host connection. false means use the wreck module default value (Infinity). Does not affect non-proxy outgoing client connections. Defaults to Infinity.*/ + maxSockets?: boolean | number; + } + /** TODO: fill in joi definition */ + export interface IJoi { - } - /** a validation function using the signature function(value, options, next) */ - export interface IValidationFunction { + } + /** a validation function using the signature function(value, options, next) */ + export interface IValidationFunction { - (/** the object containing the path parameters. */ - value: any, - /** the server validation options. */ - options: any, - /** the callback function called when validation is completed. */ - next: (err: any, value: any) => void): void; - } - /** a custom error handler function with the signature 'function(request, reply, source, error)` */ - export interface IRouteFailFunction { - /** a custom error handler function with the signature 'function(request, reply, source, error)` */ - ( - /** - the [request object]. */ - request: Request, - /** the continuation reply interface. */ - reply: IReply, - /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ - source: string, - /** the error object prepared for the client response (including the validation function error under error.data). */ - error: any): void; - } + (/** the object containing the path parameters. */ + value: any, + /** the server validation options. */ + options: any, + /** the callback function called when validation is completed. */ + next: (err: any, value: any) => void): void; + } + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + export interface IRouteFailFunction { + /** a custom error handler function with the signature 'function(request, reply, source, error)` */ + ( + /** - the [request object]. */ + request: Request, + /** the continuation reply interface. */ + reply: IReply, + /** the source of the invalid field (e.g. 'path', 'query', 'payload'). */ + source: string, + /** the error object prepared for the client response (including the validation function error under error.data). */ + error: any): void; + } - /** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ - export interface IRouteAdditionalConfigurationOptions { - /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ - app?: any; + /** Each route can be customize to change the default behavior of the request lifecycle using the following options: */ + export interface IRouteAdditionalConfigurationOptions { + /** application specific configuration.Should not be used by plugins which should use plugins[name] instead. */ + app?: any; /** authentication configuration.Value can be: false to disable authentication if a default strategy is set. a string with the name of an authentication strategy registered with server.auth.strategy(). an object */ - auth?: boolean|string| - { + auth?: boolean | string | + { /** the authentication mode.Defaults to 'required' if a server authentication strategy is configured, otherwise defaults to no authentication.Available values: 'required'authentication is required. 'optional'authentication is optional (must be valid if present). 'try'same as 'optional' but allows for invalid authentication. */ - mode: string; - /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ - strategies: string | Array; + mode?: string; + /** a string array of strategy names in order they should be attempted.If only one strategy is used, strategy can be used instead with the single string value.Defaults to the default authentication strategy which is available only when a single strategy is configured. */ + strategies?: string | Array; /** if set, the payload (in requests other than 'GET' and 'HEAD') is authenticated after it is processed.Requires a strategy with payload authentication support (e.g.Hawk).Cannot be set to a value other than 'required' when the scheme sets the options.payload to true.Available values: falseno payload authentication.This is the default value. 'required'payload authentication required.This is the default value when the scheme sets options.payload to true. 'optional'payload authentication performed only when the client includes payload authentication information (e.g.hash attribute in Hawk). */ - payload?: string; - /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ - scope?: string|Array|boolean; + payload?: string; + /** the application scope required to access the route.Value can be a scope string or an array of scope strings.The authenticated credentials object scope property must contain at least one of the scopes defined to access the route.Set to false to remove scope requirements.Defaults to no scope required. */ + scope?: string | Array | boolean; /** the required authenticated entity type.If set, must match the entity value of the authentication credentials.Available values: anythe authentication can be on behalf of a user or application.This is the default value. userthe authentication must be on behalf of a user. appthe authentication must be on behalf of an application. */ - entity?: string; - }; - /** an object passed back to the provided handler (via this) when called. */ - bind?: any; - /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ - cache?: { + entity?: string; + /** + * an object or array of objects specifying the route access rules. Each rule is evaluated against an incoming + * request and access is granted if at least one rule matches. Each rule object must include at least one of: + */ + access?: IRouteAdditionalConfigurationAuthAccess | IRouteAdditionalConfigurationAuthAccess[]; + }; + /** an object passed back to the provided handler (via this) when called. */ + bind?: any; + /** if the route method is 'GET', the route can be configured to include caching directives in the response using the following options */ + cache?: { /** mines the privacy flag included in clientside caching using the 'Cache-Control' header.Values are: fault'no privacy flag.This is the default setting. 'public'mark the response as suitable for public caching. 'private'mark the response as suitable only for private caching. */ - privacy: string; - /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ - expiresIn: number; - /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ - expiresAt: string; - }; - /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ - cors?: { - /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ - origin?: Array; - /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ - matchOrigin?: boolean; - /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ - isOriginExposed?: boolean; - /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ - maxAge?: number; - /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ - headers?: string[]; - /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ - additionalHeaders?: string[]; - /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ - methods?: string[]; - /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ - additionalMethods?: string[]; - /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ - exposedHeaders?: string[]; - /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ - additionalExposedHeaders?: string[]; - /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ - credentials?: boolean; - /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ - override?: boolean; - }; - /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ - files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ - relativeTo: string; - }; + privacy: string; + /** relative expiration expressed in the number of milliseconds since the item was saved in the cache.Cannot be used together with expiresAt. */ + expiresIn: number; + /** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire.Cannot be used together with expiresIn. */ + expiresAt: string; + }; + /** the Cross- Origin Resource Sharing protocol allows browsers to make cross- origin API calls.CORS is required by web applications running inside a browser which are loaded from a different domain than the API server.CORS headers are disabled by default. To enable, set cors to true, or to an object with the following options: */ + cors?: { + /** a strings array of allowed origin servers ('Access-Control-Allow-Origin').The array can contain any combination of fully qualified origins along with origin strings containing a wildcard '' character, or a single `''origin string. Defaults to any origin['*']`. */ + origin?: Array; + /** if true, matches the value of the incoming 'Origin' header to the list of origin values ('*' matches anything) and if a match is found, uses that as the value of the 'Access-Control-Allow-Origin' response header.When false, the origin config is returned as- is.Defaults to true. */ + matchOrigin?: boolean; + /** if false, prevents the connection from returning the full list of non- wildcard origin values if the incoming origin header does not match any of the values.Has no impact if matchOrigin is set to false.Defaults to true. */ + isOriginExposed?: boolean; + /** number of seconds the browser should cache the CORS response ('Access-Control-Max-Age').The greater the value, the longer it will take before the browser checks for changes in policy.Defaults to 86400 (one day). */ + maxAge?: number; + /** a strings array of allowed headers ('Access-Control-Allow-Headers').Defaults to ['Authorization', 'Content-Type', 'If-None-Match']. */ + headers?: string[]; + /** a strings array of additional headers to headers.Use this to keep the default headers in place. */ + additionalHeaders?: string[]; + /** a strings array of allowed HTTP methods ('Access-Control-Allow-Methods').Defaults to ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']. */ + methods?: string[]; + /** a strings array of additional methods to methods.Use this to keep the default methods in place. */ + additionalMethods?: string[]; + /** a strings array of exposed headers ('Access-Control-Expose-Headers').Defaults to ['WWW-Authenticate', 'Server-Authorization']. */ + exposedHeaders?: string[]; + /** a strings array of additional headers to exposedHeaders.Use this to keep the default headers in place. */ + additionalExposedHeaders?: string[]; + /** if true, allows user credentials to be sent ('Access-Control-Allow-Credentials').Defaults to false. */ + credentials?: boolean; + /** if false, preserves existing CORS headers set manually before the response is sent.Defaults to true. */ + override?: boolean; + }; + /** defines the behavior for serving static resources using the built-in route handlers for files and directories: */ + files?: {/** determines the folder relative paths are resolved against when using the file and directory handlers. */ + relativeTo: string; + }; - /** an alternative location for the route handler option. */ - handler?: ISessionHandler | string | IRouteHandlerConfig; - /** an optional unique identifier used to look up the route using server.lookup(). */ - id?: number; - /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ - json?: { - /** the replacer function or array.Defaults to no action. */ - replacer?: Function | string[]; - /** number of spaces to indent nested object keys.Defaults to no indentation. */ - space?: number|string; - /** string suffix added after conversion to JSON string.Defaults to no suffix. */ - suffix?: string; - }; - /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ - jsonp?: string; - /** determines how the request payload is processed: */ - payload?: { + /** an alternative location for the route handler option. */ + handler?: ISessionHandler | string | IRouteHandlerConfig; + /** an optional unique identifier used to look up the route using server.lookup(). */ + id?: number; + /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ + json?: { + /** the replacer function or array.Defaults to no action. */ + replacer?: Function | string[]; + /** number of spaces to indent nested object keys.Defaults to no indentation. */ + space?: number | string; + /** string suffix added after conversion to JSON string.Defaults to no suffix. */ + suffix?: string; + }; + /** enables JSONP support by setting the value to the query parameter name containing the function name used to wrap the response payload.For example, if the value is 'callback', a request comes in with 'callback=me', and the JSON response is '{ "a":"b" }', the payload will be 'me({ "a":"b" });'.Does not work with stream responses. */ + jsonp?: string; + /** determines how the request payload is processed: */ + payload?: { /** the type of payload representation requested. The value must be one of: 'data'the incoming payload is read fully into memory.If parse is true, the payload is parsed (JSON, formdecoded, multipart) based on the 'Content- Type' header.If parse is false, the raw Buffer is returned.This is the default value except when a proxy handler is used. 'stream'the incoming payload is made available via a Stream.Readable interface.If the payload is 'multipart/form-data' and parse is true, fields values are presented as text while files are provided as streams.File streams from a 'multipart/form-data' upload will also have a property hapi containing filename and headers properties. 'file'the incoming payload in written to temporary file in the directory specified by the server's payload.uploads settings. If the payload is 'multipart/ formdata' and parse is true, fields values are presented as text while files are saved. Note that it is the sole responsibility of the application to clean up the files generated by the framework. This can be done by keeping track of which files are used (e.g. using the request.app object), and listening to the server 'response' event to perform any needed cleaup. */ - output?: string; + output?: string; /** can be true, false, or gunzip; determines if the incoming payload is processed or presented raw. true and gunzip includes gunzipping when the appropriate 'Content-Encoding' is specified on the received request. If parsing is enabled and the 'Content-Type' is known (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Defaults to true, except when a proxy handler is used. The supported mime types are: 'application/json' 'application/x-www-form-urlencoded' 'application/octet-stream' 'text/ *' 'multipart/form-data' */ - parse?: string | boolean; - /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ - allow?: string | string[]; - /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ - override?: string; - /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ - maxBytes?: number; - /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ - timeout?: number; - /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ - uploads?: string; + parse?: string | boolean; + /** a string or an array of strings with the allowed mime types for the endpoint.Defaults to any of the supported mime types listed above.Note that allowing other mime types not listed will not enable them to be parsed, and that if parsing mode is 'parse', the request will result in an error response. */ + allow?: string | string[]; + /** a mime type string overriding the 'Content-Type' header value received.Defaults to no override. */ + override?: string; + /** limits the size of incoming payloads to the specified byte count.Allowing very large payloads may cause the server to run out of memory.Defaults to 1048576 (1MB). */ + maxBytes?: number; + /** payload reception timeout in milliseconds.Sets the maximum time allowed for the client to transmit the request payload (body) before giving up and responding with a Request Timeout (408) error response.Set to false to disable.Defaults to 10000 (10 seconds). */ + timeout?: number; + /** the directory used for writing file uploads.Defaults to os.tmpDir(). */ + uploads?: string; /** determines how to handle payload parsing errors. Allowed values are: 'error'return a Bad Request (400) error response. This is the default value. 'log'report the error but continue processing the request. 'ignore'take no action and continue processing the request. */ - failAction?: string; - }; - /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ - plugins?: IDictionary; - /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ - pre?: any[]; - /** validation rules for the outgoing response payload (response body).Can only validate object response: */ - response?: { + failAction?: string; + }; + /** pluginspecific configuration.plugins is an object where each key is a plugin name and the value is the plugin configuration. */ + plugins?: IDictionary; + /** an array with [route prerequisites] methods which are executed in serial or in parallel before the handler is called. */ + pre?: any[]; + /** validation rules for the outgoing response payload (response body).Can only validate object response: */ + response?: { /** the default response object validation rules (for all non-error responses) expressed as one of: trueany payload allowed (no validation performed). This is the default. falseno payload allowed. @@ -516,55 +521,57 @@ declare module "hapi" { valuethe object containing the response object. optionsthe server validation options. next(err)the callback function called when validation is completed. */ - schema: boolean|any; - /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ - status: number; - /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ - sample: number; + schema: boolean | any; + /** HTTP status- codespecific validation rules.The status key is set to an object where each key is a 3 digit HTTP status code and the value has the same definition as schema.If a response status code is not present in the status object, the schema definition is used, expect for errors which are not validated by default. */ + status: number; + /** the percent of responses validated (0100).Set to 0 to disable all validation.Defaults to 100 (all responses). */ + sample: number; /** defines what to do when a response fails validation.Options are: errorreturn an Internal Server Error (500) error response.This is the default value. loglog the error but send the response. */ - failAction: string; - /** if true, applies the validation rule changes to the response.Defaults to false. */ - modify: boolean; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options: any; - }; - /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ - security?: boolean| { - /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ - hsts: boolean|number|{ - /** the max- age portion of the header, as a number.Default is 15768000. */ - maxAge?: number; - /** a boolean specifying whether to add the includeSubdomains flag to the header. */ - includeSubdomains?: boolean; - }; - /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ - xframe: { - /** either 'deny', 'sameorigin', or 'allow-from' */ - rule: string; - /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ - source: string; - }; - /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ - xss: boolean; - /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ - noOpen: boolean; - /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ - noSniff: boolean; - }; - /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ - state?: { - /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ - parse: boolean; + failAction: string; + /** if true, applies the validation rule changes to the response.Defaults to false. */ + modify: boolean; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options: any; + }; + /** sets common security headers (disabled by default).To enable set security to true or to an object with the following options */ + security?: boolean | { + /** controls the 'Strict-Transport-Security' header.If set to true the header will be set to max- age=15768000, if specified as a number the maxAge parameter will be set to that number.Defaults to true.You may also specify an object with the following fields: */ + hsts?: boolean | number | { + /** the max- age portion of the header, as a number.Default is 15768000. */ + maxAge?: number; + /** a boolean specifying whether to add the includeSubdomains flag to the header. */ + includeSubdomains?: boolean; + /** a boolean specifying whether to add the 'preload' flag (used to submit domains inclusion in Chrome's HTTP Strict Transport Security (HSTS) preload list) to the header. */ + preload?: boolean; + }; + /** controls the 'X-Frame-Options' header.When set to true the header will be set to DENY, you may also specify a string value of 'deny' or 'sameorigin'.To use the 'allow-from' rule, you must set this to an object with the following fields: */ + xframe?: { + /** either 'deny', 'sameorigin', or 'allow-from' */ + rule: string; + /** when rule is 'allow-from' this is used to form the rest of the header, otherwise this field is ignored.If rule is 'allow-from' but source is unset, the rule will be automatically changed to 'sameorigin'. */ + source: string; + }; + /** boolean that controls the 'X-XSS-PROTECTION' header for IE.Defaults to true which sets the header to equal '1; mode=block'.NOTE: This setting can create a security vulnerability in versions of IE below 8, as well as unpatched versions of IE8.See here and here for more information.If you actively support old versions of IE, it may be wise to explicitly set this flag to false. */ + xss?: boolean; + /** boolean controlling the 'X-Download-Options' header for IE, preventing downloads from executing in your context.Defaults to true setting the header to 'noopen'. */ + noOpen?: boolean; + /** boolean controlling the 'X-Content-Type-Options' header.Defaults to true setting the header to its only and default option, 'nosniff'. */ + noSniff?: boolean; + }; + /** HTTP state management (cookies) allows the server to store information on the client which is sent back to the server with every request (as defined in RFC 6265).state supports the following options: */ + state?: { + /** determines if incoming 'Cookie' headers are parsed and stored in the request.state object.Defaults to true. */ + parse: boolean; /** determines how to handle cookie parsing errors.Allowed values are: 'error'return a Bad Request (400) error response.This is the default value. 'log'report the error but continue processing the request. 'ignore'take no action. */ - failAction: string; - }; - /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ - validate?: { + failAction: string; + }; + /** request input validation rules for various request components.When using a Joi validation object, the values of the other inputs (i.e.headers, query, params, payload, and auth) are made available under the validation context (accessible in rules as Joi.ref('$query.key')).Note that validation is performed in order(i.e.headers, params, query, payload) and if type casting is used (converting a string to number), the value of inputs not yet validated will reflect the raw, unvalidated and unmodified values.The validate object supports: */ + validate?: { /** validation rules for incoming request headers.Values allowed: * trueany headers allowed (no validation performed).This is the default. falseno headers allowed (this will cause all valid HTTP requests to fail). @@ -574,7 +581,7 @@ declare module "hapi" { optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - headers?: boolean | IJoi | IValidationFunction; + headers?: boolean | IJoi | IValidationFunction; /** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed: @@ -585,7 +592,7 @@ declare module "hapi" { valuethe object containing the path parameters. optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - params?: boolean | IJoi | IValidationFunction; + params?: boolean | IJoi | IValidationFunction; /** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed: trueany query parameters allowed (no validation performed).This is the default. falseno query parameters allowed. @@ -594,7 +601,7 @@ declare module "hapi" { valuethe object containing the query parameters. optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - query?: boolean | IJoi | IValidationFunction; + query?: boolean | IJoi | IValidationFunction; /** validation rules for an incoming request payload (request body).Values allowed: trueany payload allowed (no validation performed).This is the default. falseno payload allowed. @@ -603,9 +610,9 @@ declare module "hapi" { valuethe object containing the payload object. optionsthe server validation options. next(err, value)the callback function called when validation is completed. */ - payload?: boolean | IJoi | IValidationFunction; - /** an optional object with error fields copied into every validation error response. */ - errorFields?: any; + payload?: boolean | IJoi | IValidationFunction; + /** an optional object with error fields copied into every validation error response. */ + errorFields?: any; /** determines how to handle invalid requests.Allowed values are: 'error'return a Bad Request (400) error response.This is the default value. 'log'log the error but continue processing the request. @@ -615,31 +622,54 @@ declare module "hapi" { replythe continuation reply interface. sourcethe source of the invalid field (e.g. 'path', 'query', 'payload'). errorthe error object prepared for the client response (including the validation function error under error.data). */ - failAction?: string | IRouteFailFunction; - /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ - options?: any; - }; - /** define timeouts for processing durations: */ - timeout?: { - /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ - server: boolean|number; - /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ - socket: boolean|number; - }; + failAction?: string | IRouteFailFunction; + /** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */ + options?: any; + }; + /** define timeouts for processing durations: */ + timeout?: { + /** response timeout in milliseconds.Sets the maximum time allowed for the server to respond to an incoming client request before giving up and responding with a Service Unavailable (503) error response.Disabled by default (false). */ + server: boolean | number; + /** by default, node sockets automatically timeout after 2 minutes.Use this option to override this behavior.Defaults to undefined which leaves the node default unchanged.Set to false to disable socket timeouts. */ + socket: boolean | number; + }; /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). *route description used for generating documentation (string). */ - description?: string; + description?: string; /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). *route notes used for generating documentation (string or array of strings). */ - notes?: string|string[]; + notes?: string | string[]; /** ONLY WHEN ADDING NEW ROUTES (not when setting defaults). *route tags used for generating documentation (array of strings). */ - tags?: string[] - } + tags?: string[] + } + + /** + * specifying the route access rules. Each rule is evaluated against an incoming request and access is granted if at least one rule matches + */ + export interface IRouteAdditionalConfigurationAuthAccess { + /** + * the application scope required to access the route. Value can be a scope string or an array of scope strings. + * The authenticated credentials object scope property must contain at least one of the scopes defined to access the route. + * If a scope string begins with a + character, that scope is required. If a scope string begins with a ! character, + * that scope is forbidden. For example, the scope ['!a', '+b', 'c', 'd'] means the incoming request credentials' + * scope must not include 'a', must include 'b', and must include on of 'c' or 'd'. You may also access properties + * on the request object (query and params} to populate a dynamic scope by using {} characters around the property name, + * such as 'user-{params.id}'. Defaults to false (no scope requirements). + */ + scope?: string | Array | boolean; + /** the required authenticated entity type. If set, must match the entity value of the authentication credentials. Available values: + * any - the authentication can be on behalf of a user or application. This is the default value. + * user - the authentication must be on behalf of a user which is identified by the presence of a user attribute in the credentials object returned by the authentication strategy. + * app - the authentication must be on behalf of an application which is identified by the lack of presence of a user attribute in the credentials object returned by the authentication strategy. + */ + entity?: string; + } + /** server.realm http://hapijs.com/api#serverrealm The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). @@ -650,33 +680,33 @@ declare module "hapi" { return next(); }; */ - export interface IServerRealm { - /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ - modifiers: { - /** routes preferences: */ - route: { - /** - the route path prefix used by any calls to server.route() from the server. */ - prefix: string; - /** the route virtual host settings used by any calls to server.route() from the server. */ - vhost: string; - }; + export interface IServerRealm { + /** when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method */ + modifiers: { + /** routes preferences: */ + route: { + /** - the route path prefix used by any calls to server.route() from the server. */ + prefix: string; + /** the route virtual host settings used by any calls to server.route() from the server. */ + vhost: string; + }; - }; - /** the active plugin name (empty string if at the server root). */ - plugin: string; - /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ - plugins: IDictionary; - /** settings overrides */ - settings: { - files: { - relativeTo: any; - }; - bind: any; - } - } + }; + /** the active plugin name (empty string if at the server root). */ + plugin: string; + /** plugin-specific state to be shared only among activities sharing the same active state. plugins is an object where each key is a plugin name and the value is the plugin state. */ + plugins: IDictionary; + /** settings overrides */ + settings: { + files: { + relativeTo: any; + }; + bind: any; + } + } /** server.state(name, [options]) http://hapijs.com/api#serverstatename-options HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions where:*/ - export interface IServerState { + export interface IServerState { /** - the cookie name string. */name: string; /** - are the optional cookie settings: */options: { @@ -688,51 +718,51 @@ declare module "hapi" { /** if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value. The value can be a function with signature function(request, next) where: request - the request object. next - the continuation function using the function(err, value) signature.*/ - autoValue: (request: Request, next: (err: any, value: any) => void) => void; + autoValue: (request: Request, next: (err: any, value: any) => void) => void; /** - encoding performs on the provided value before serialization. Options are: 'none' - no encoding. When used, the cookie value must be a string. This is the default value. 'base64' - string value is encoded using Base64. 'base64json' - object value is JSON-stringified than encoded using Base64. 'form' - object value is encoded using the x-www-form-urlencoded method. 'iron' - Encrypts and sign the value using iron.*/ - encoding: string; + encoding: string; /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are:*/sign: { /** - algorithm options.Defaults to require('iron').defaults.integrity.*/integrity: any; /** - password used for HMAC key generation.*/password: string; - }; + }; /** - password used for 'iron' encoding.*/password: string; /** - options for 'iron' encoding.Defaults to require('iron').defaults.*/iron: any; /** - if false, errors are ignored and treated as missing cookies.*/ignoreErrors: boolean; /** - if true, automatically instruct the client to remove invalid cookies.Defaults to false.*/clearInvalid: boolean; /** - if false, allows any cookie value including values in violation of RFC 6265. Defaults to true.*/strictHeader: boolean; /** - overrides the default proxy localStatePassThrough setting.*/passThrough: any; - }; - } + }; + } - export interface IFileHandlerConfig { - /** a path string or function as described above.*/ - path: string; - /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ - filename?: string; + export interface IFileHandlerConfig { + /** a path string or function as described above.*/ + path: string; + /** an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path*/ + filename?: string; /**- specifies whether to include the 'Content-Disposition' header with the response. Available values: false - header is not included. This is the default value. 'attachment' 'inline'*/ - mode?: boolean| string; - /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ - lookupCompressed: boolean; - } + mode?: boolean | string; + /** if true, looks for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false.*/ + lookupCompressed: boolean; + } /**http://hapijs.com/api#route-handler Built-in handlers The framework comes with a few built-in handler types available by setting the route handler config to an object containing one of these keys.*/ - export interface IRouteHandlerConfig { + export interface IRouteHandlerConfig { /** generates a static file endpoint for serving a single file. file can be set to: a relative or absolute file path string (relative paths are resolved based on the route files configuration). a function with the signature function(request) which returns the relative or absolute file path. an object with the following options */ - file?: string | IRequestHandler |IFileHandlerConfig; + file?: string | IRequestHandler | IFileHandlerConfig; /** directory - generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. @@ -744,111 +774,111 @@ declare module "hapi" { redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension.*/ - directory?: { - path: string |Array | IRequestHandler | IRequestHandler>; - index?: boolean; - listing?: boolean; - showHidden?: boolean; - redirectToSlash?: boolean; - lookupCompressed?: boolean; - defaultExtension?: string; - }; - proxy?: IProxyHandlerConfig; - view?: string | { - template: string; - context: { - payload: any; - params: any; - query: any; - pre: any; - } - }; - config?: { - handler: any; - bind: any; - app: any; - plugins: { - [name: string]: any; - }; - pre: Array<() => void>; - validate: { - headers: any; - params: any; - query: any; - payload: any; - errorFields?: any; - failAction?: string | IFailAction; - }; - payload: { - output: { - data: any; - stream: any; - file: any; - }; - parse?: any; - allow?: string|Array; - override?: string; - maxBytes?: number; - uploads?: number; - failAction?: string; - }; - response: { - schema: any; - sample: number; - failAction: string; - }; - cache: { - privacy: string; - expiresIn: number; - expiresAt: number; - }; - auth: string|boolean|{ - mode: string; - strategies: Array; - payload?: boolean|string; - tos?: boolean|string; - scope?: string|Array; - entity: string; - }; - cors?: boolean; - jsonp?: string; - description?: string; - notes?: string|Array; - tags?: Array; - }; - } + directory?: { + path: string | Array | IRequestHandler | IRequestHandler>; + index?: boolean | string | string[]; + listing?: boolean; + showHidden?: boolean; + redirectToSlash?: boolean; + lookupCompressed?: boolean; + defaultExtension?: string; + }; + proxy?: IProxyHandlerConfig; + view?: string | { + template: string; + context: { + payload: any; + params: any; + query: any; + pre: any; + } + }; + config?: { + handler: any; + bind: any; + app: any; + plugins: { + [name: string]: any; + }; + pre: Array<() => void>; + validate: { + headers: any; + params: any; + query: any; + payload: any; + errorFields?: any; + failAction?: string | IFailAction; + }; + payload: { + output: { + data: any; + stream: any; + file: any; + }; + parse?: any; + allow?: string | Array; + override?: string; + maxBytes?: number; + uploads?: number; + failAction?: string; + }; + response: { + schema: any; + sample: number; + failAction: string; + }; + cache: { + privacy: string; + expiresIn: number; + expiresAt: number; + }; + auth: string | boolean | { + mode: string; + strategies: Array; + payload?: boolean | string; + tos?: boolean | string; + scope?: string | Array; + entity: string; + }; + cors?: boolean; + jsonp?: string; + description?: string; + notes?: string | Array; + tags?: Array; + }; + } /** Route configuration The route configuration object*/ - export interface IRouteConfiguration { - /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ - path: string; + export interface IRouteConfiguration { + /** - (required) the absolute path used to match incoming requests (must begin with '/'). Incoming requests are compared to the configured paths based on the connection router configuration option.The path can include named parameters enclosed in {} which will be matched against literal values in the request as described in Path parameters.*/ + path: string; /** - (required) the HTTP method.Typically one of 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', or 'OPTIONS'.Any HTTP method is allowed, except for 'HEAD'.Use '*' to match against any HTTP method (only when an exact match was not found, and any match with a specific method will be given a higher priority over a wildcard match). * Can be assigned an array of methods which has the same result as adding the same route with different methods manually.*/ - method: string|string[]; - /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ - vhost?: string; - /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ - handler: ISessionHandler | string | IRouteHandlerConfig; - /** - additional route options.*/ - config?: IRouteAdditionalConfigurationOptions; - } - /** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ - export interface IRoute { + method: string | string[]; + /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ + vhost?: string; + /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ + handler: ISessionHandler | string | IRouteHandlerConfig; + /** - additional route options.*/ + config?: IRouteAdditionalConfigurationOptions; + } + /** Route public interface When route information is returned or made available as a property. http://hapijs.com/api#route-public-interface */ + export interface IRoute { - /** the route HTTP method. */ - method: string; - /** the route path. */ - path: string; - /** the route vhost option if configured. */ - vhost?: string|Array; - /** the [active realm] associated with the route.*/ - realm: IServerRealm; - /** the [route options] object with all defaults applied. */ - settings: IRouteAdditionalConfigurationOptions; - } + /** the route HTTP method. */ + method: string; + /** the route path. */ + path: string; + /** the route vhost option if configured. */ + vhost?: string | Array; + /** the [active realm] associated with the route.*/ + realm: IServerRealm; + /** the [route options] object with all defaults applied. */ + settings: IRouteAdditionalConfigurationOptions; + } - export interface IServerAuthScheme { + export interface IServerAuthScheme { /** authenticate(request, reply) - required function called on each incoming request configured with the authentication scheme where: request - the request object. reply - the reply interface the authentication method must call when done authenticating the request where: @@ -878,7 +908,7 @@ declare module "hapi" { }; }; server.auth.scheme('custom', scheme);*/ - authenticate(request: Request, reply: IReply): void; + authenticate(request: Request, reply: IReply): void; /** payload(request, reply) - optional function called to authenticate the request payload where: request - the request object. reply(err, response) - is called if authentication failed where: @@ -886,70 +916,70 @@ declare module "hapi" { response - any authentication response action such as redirection. Ignored if err is present, otherwise required. reply.continue() - is called if payload authentication succeeded. When the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'.*/ - payload? (request: Request, reply: IReply): void; + payload?(request: Request, reply: IReply): void; /** response(request, reply) - optional function called to decorate the response with authentication headers before the response headers or payload is written where: request - the request object. reply(err, response) - is called if an error occurred where: err - any authentication error. response - any authentication response to send instead of the current response. Ignored if err is present, otherwise required. reply.continue() - is called if the operation succeeded.*/ - response? (request: Request, reply: IReply): void; - /** an optional object */ - options?: { - /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ - payload: boolean; - } - } + response?(request: Request, reply: IReply): void; + /** an optional object */ + options?: { + /** if true, requires payload validation as part of the scheme and forbids routes from disabling payload auth validation. Defaults to false.*/ + payload: boolean; + } + } - export interface IServerInject { - (options: string | { - /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ - method: string; - /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ - url: string; - /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ - headers?: IDictionary; - /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ - payload?: string|{}|Buffer; - /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ - credentials?: any; - /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ - artifacts?: any; - /** sets the initial value of request.app*/ - app?: any; - /** sets the initial value of request.plugins*/ - plugins?: any; - /** allows access to routes with config.isInternal set to true. Defaults to false.*/ - allowInternals?: boolean; - /** sets the remote address for the incoming connection.*/ - remoteAddress?: boolean; + export interface IServerInject { + (options: string | { + /** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/ + method: string; + /** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/ + url: string; + /** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/ + headers?: IDictionary; + /** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/ + payload?: string | {} | Buffer; + /** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/ + credentials?: any; + /** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/ + artifacts?: any; + /** sets the initial value of request.app*/ + app?: any; + /** sets the initial value of request.plugins*/ + plugins?: any; + /** allows access to routes with config.isInternal set to true. Defaults to false.*/ + allowInternals?: boolean; + /** sets the remote address for the incoming connection.*/ + remoteAddress?: boolean; /**object with options used to simulate client request stream conditions for testing: error - if true, emits an 'error' event after payload transmission (if any). Defaults to false. close - if true, emits a 'close' event after payload transmission (if any). Defaults to false. end - if false, does not end the stream. Defaults to true.*/ - simulate?: { - error: boolean; - close: boolean; - end: boolean; - }; - }, - callback: ( - /**the response object where: - statusCode - the HTTP status code. - headers - an object containing the headers set. - payload - the response payload string. - rawPayload - the raw response payload buffer. - raw - an object with the injection request and response objects: - req - the simulated node request object. - res - the simulated node response object. - result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). - request - the request object.*/ - res: { statusCode: number; headers: IDictionary; payload: string; rawPayload: Buffer; raw: { req: http.ClientRequest; res: http.ServerResponse }; result: string; request: Request }) => void - ):void; + simulate?: { + error: boolean; + close: boolean; + end: boolean; + }; + }, + callback: ( + /**the response object where: + statusCode - the HTTP status code. + headers - an object containing the headers set. + payload - the response payload string. + rawPayload - the raw response payload buffer. + raw - an object with the injection request and response objects: + req - the simulated node request object. + res - the simulated node response object. + result - the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). + request - the request object.*/ + res: { statusCode: number; headers: IDictionary; payload: string; rawPayload: Buffer; raw: { req: http.ClientRequest; res: http.ServerResponse }; result: string; request: Request }) => void + ): void; - } + } /** host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. @@ -960,44 +990,44 @@ declare module "hapi" { settings - the route config with defaults applied. method - the HTTP method in lower case. path - the route path.*/ - export interface IConnectionTable { - info: any; - labels: any; - table: IRoute[]; - } + export interface IConnectionTable { + info: any; + labels: any; + table: IRoute[]; + } - export interface ICookieSettings { - /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ - ttl?: number; - /** - sets the 'Secure' flag.Defaults to false.*/ - isSecure?: boolean; - /** - sets the 'HttpOnly' flag.Defaults to false.*/ - isHttpOnly?: boolean; - /** - the path scope.Defaults to null (no path).*/ - path?: string; - /** - the domain scope.Defaults to null (no domain).*/ - domain?: any; + export interface ICookieSettings { + /** - time - to - live in milliseconds.Defaults to null (session time- life - cookies are deleted when the browser is closed).*/ + ttl?: number; + /** - sets the 'Secure' flag.Defaults to false.*/ + isSecure?: boolean; + /** - sets the 'HttpOnly' flag.Defaults to false.*/ + isHttpOnly?: boolean; + /** - the path scope.Defaults to null (no path).*/ + path?: string; + /** - the domain scope.Defaults to null (no domain).*/ + domain?: any; /** - if present and the cookie was not received from the client or explicitly set by the route handler, the cookie is automatically added to the response with the provided value.The value can be a function with signature function(request, next) where: request - the request object. next - the continuation function using the function(err, value) signature.*/ - autoValue?: (request: Request, next: (err: any, value: any) => void) => void; + autoValue?: (request: Request, next: (err: any, value: any) => void) => void; /** - encoding performs on the provided value before serialization.Options are: 'none' - no encoding.When used, the cookie value must be a string.This is the default value. 'base64' - string value is encoded using Base64. 'base64json' - object value is JSON- stringified than encoded using Base64. 'form' - object value is encoded using the x- www - form - urlencoded method. */ - encoding?: string; + encoding?: string; /** - an object used to calculate an HMAC for cookie integrity validation.This does not provide privacy, only a mean to verify that the cookie value was generated by the server.Redundant when 'iron' encoding is used.Options are: integrity - algorithm options.Defaults to require('iron').defaults.integrity. password - password used for HMAC key generation. */ - sign?: { integrity: any; password: string; } - password?: string; - iron?: any; - ignoreErrors?: boolean; - clearInvalid?: boolean; - strictHeader?: boolean; - passThrough?: any; - } + sign?: { integrity: any; password: string; } + password?: string; + iron?: any; + ignoreErrors?: boolean; + clearInvalid?: boolean; + strictHeader?: boolean; + passThrough?: any; + } /** method - the method function with the signature is one of: function(arg1, arg2, ..., argn, next) where: @@ -1010,26 +1040,26 @@ declare module "hapi" { arg1, arg2, etc. - the method function arguments. the callback option is set to false. the method must returns a value (result, Error, or a promise) or throw an Error.*/ - export interface IServerMethod { - //(): void; - //(next: (err: any, result: any, ttl: number) => void): void; - //(arg1: any): void; - //(arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; - //(arg1: any, arg2: any): void; - (...args: any[]): void; + export interface IServerMethod { + //(): void; + //(next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any): void; + //(arg1: any, arg2: any, next: (err: any, result: any, ttl: number) => void): void; + //(arg1: any, arg2: any): void; + (...args: any[]): void; - } + } /** options - optional configuration: bind - a context object passed back to the method function (via this) when called. Defaults to active context (set via server.bind() when the method is registered. cache - the same cache configuration used in server.cache(). callback - if false, expects the method to be a synchronous function. Note that using a synchronous function with caching will convert the method interface to require a callback as an additional argument with the signature function(err, result, cached, report) since the cache interface cannot return values synchronously. Defaults to true. generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/ - export interface IServerMethodOptions { - bind?: any; - cache?: ICatBoxCacheOptions; - callback?: boolean; - generateKey?(args: any[]): string; - } + export interface IServerMethodOptions { + bind?: any; + cache?: ICatBoxCacheOptions; + callback?: boolean; + generateKey?(args: any[]): string; + } /** Request object The request object is created internally for each incoming request. It is different from the node.js request object received from the HTTP server callback (which is available in request.raw.req). The request object methods and properties change throughout the request lifecycle. @@ -1065,114 +1095,116 @@ declare module "hapi" { return reply.continue(); });*/ - export class Request extends Events.EventEmitter { - /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ - app: any; - /** authentication information*/ - auth: { - /** true is the request has been successfully authenticated, otherwise false.*/ - isAuthenticated: boolean; - /** the credential object received during the authentication process. The presence of an object does not mean successful authentication.*/ - credentials: any; - /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ - artifacts: any; - /** the route authentication mode.*/ - mode: any; - /** the authentication error is failed and mode set to 'try'.*/ - error: any; - /** an object used by the ['cookie' authentication scheme] https://github.com/hapijs/hapi-auth-cookie */ - session: any - }; - /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ - domain: any; - /** the raw request headers (references request.raw.headers).*/ - headers: IDictionary; - /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ - id: number; - /** request information */ - info: { - /** request reception timestamp. */ - received: number; - /** request response timestamp (0 is not responded yet). */ - responded: number; - /** remote client IP address. */ + export class Request extends Events.EventEmitter { + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** authentication information*/ + auth: { + /** true is the request has been successfully authenticated, otherwise false.*/ + isAuthenticated: boolean; + /** the credential object received during the authentication process. The presence of an object does not mean successful authentication. can be set in the validate function's callback.*/ + credentials: any; + /** an artifact object received from the authentication strategy and used in authentication-related actions.*/ + artifacts: any; + /** the route authentication mode.*/ + mode: any; + /** the authentication error is failed and mode set to 'try'.*/ + error: any; + /** an object used by the ['cookie' authentication scheme] https://github.com/hapijs/hapi-auth-cookie */ + session: any + }; + /** the connection used by this request*/ + connection: ServerConnection; + /** the node domain object used to protect against exceptions thrown in extensions, handlers and route prerequisites. Can be used to manually bind callback functions otherwise bound to other domains.*/ + domain: any; + /** the raw request headers (references request.raw.headers).*/ + headers: IDictionary; + /** a unique request identifier (using the format '{now}:{connection.info.id}:{5 digits counter}').*/ + id: number; + /** request information */ + info: { + /** request reception timestamp. */ + received: number; + /** request response timestamp (0 is not responded yet). */ + responded: number; + /** remote client IP address. */ - remoteAddress: string; - /** remote client port. */ - remotePort: number; - /** content of the HTTP 'Referrer' (or 'Referer') header. */ - referrer: string; - /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ - host: string; - /** the hostname part of the 'Host' header (e.g. 'example.com').*/ - hostname: string; - }; - /** the request method in lower case (e.g. 'get', 'post'). */ - method: string; - /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ - mime: string; - /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ - orig: { - params: any; - query: any; - payload: any; - }; - /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ - params: IDictionary; - /** an array containing all the path params values in the order they appeared in the path.*/ - paramsArray: string[]; - /** the request URI's path component. */ - path: string; - /** the request payload based on the route payload.output and payload.parse settings.*/ - payload: any; - /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ - plugins: any; - /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ - pre: IDictionary; - /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ - response: Response; - /**preResponses - same as pre but represented as the response object created by the pre method.*/ - preResponses: any; - /**an object containing the query parameters.*/ - query: any; - /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ - raw: { - req: http.ClientRequest; - res: http.ServerResponse; - }; - /** the route public interface.*/ - route: IRoute; - /** the server object. */ - server: Server; - /** Special key reserved for plugins implementing session support. Plugins utilizing this key must check for null value to ensure there is no conflict with another similar server. */ - session: any; - /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ - state: any; - /** complex object contining details on the url */ - url: { - /** null when i tested */ - auth: any; - /** null when i tested */ - hash: any; - /** null when i tested */ - host: any; - /** null when i tested */ - hostname: any; - href: string; - path: string; - /** path without search*/ - pathname: string; - /** null when i tested */ - port: any; - /** null when i tested */ - protocol: any; - /** querystring parameters*/ - query: IDictionary; - /** querystring parameters as a string*/ - search: string; - /** null when i tested */ - slashes: any; - }; + remoteAddress: string; + /** remote client port. */ + remotePort: number; + /** content of the HTTP 'Referrer' (or 'Referer') header. */ + referrer: string; + /** content of the HTTP 'Host' header (e.g. 'example.com:8080'). */ + host: string; + /** the hostname part of the 'Host' header (e.g. 'example.com').*/ + hostname: string; + }; + /** the request method in lower case (e.g. 'get', 'post'). */ + method: string; + /** the parsed content-type header. Only available when payload parsing enabled and no payload error occurred. */ + mime: string; + /** an object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.*/ + orig: { + params: any; + query: any; + payload: any; + }; + /** an object where each key is a path parameter name with matching value as described in Path parameters.*/ + params: IDictionary; + /** an array containing all the path params values in the order they appeared in the path.*/ + paramsArray: string[]; + /** the request URI's path component. */ + path: string; + /** the request payload based on the route payload.output and payload.parse settings.*/ + payload: stream.Readable | Buffer | any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.*/ + plugins: any; + /** an object where each key is the name assigned by a route prerequisites function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.*/ + pre: IDictionary; + /** the response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects).*/ + response: Response; + /**preResponses - same as pre but represented as the response object created by the pre method.*/ + preResponses: any; + /**an object containing the query parameters.*/ + query: any; + /** an object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.*/ + raw: { + req: http.ClientRequest; + res: http.ServerResponse; + }; + /** the route public interface.*/ + route: IRoute; + /** the server object. */ + server: Server; + /** Special key reserved for plugins implementing session support. Plugins utilizing this key must check for null value to ensure there is no conflict with another similar server. */ + session: any; + /** an object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition. */ + state: any; + /** complex object contining details on the url */ + url: { + /** null when i tested */ + auth: any; + /** null when i tested */ + hash: any; + /** null when i tested */ + host: any; + /** null when i tested */ + hostname: any; + href: string; + path: string; + /** path without search*/ + pathname: string; + /** null when i tested */ + port: any; + /** null when i tested */ + protocol: any; + /** querystring parameters*/ + query: IDictionary; + /** querystring parameters as a string*/ + search: string; + /** null when i tested */ + slashes: any; + }; /** request.setUrl(url) Available only in 'onRequest' extension methods. @@ -1190,7 +1222,7 @@ declare module "hapi" { request.setUrl('/test'); return reply.continue(); });*/ - setUrl(url: string): void; + setUrl(url: string): void; /** request.setMethod(method) Available only in 'onRequest' extension methods. @@ -1208,7 +1240,7 @@ declare module "hapi" { request.setMethod('GET'); return reply.continue(); });*/ - setMethod(method: string): void; + setMethod(method: string): void; /** request.log(tags, [data, [timestamp]]) Always available. @@ -1236,13 +1268,13 @@ declare module "hapi" { return reply(); }; */ - log( - /** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ - tags: string|string[], - /** an optional message string or object with the application data being logged.*/ - data?: string, - /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ - timestamp?: number): void; + log( + /** a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.*/ + tags: string | string[], + /** an optional message string or object with the application data being logged.*/ + data?: string, + /** an optional timestamp expressed in milliseconds. Defaults to Date.now() (now).*/ + timestamp?: number): void; /** request.getLog([tags], [internal]) Always available. @@ -1254,11 +1286,11 @@ declare module "hapi" { request.getLog(['error'], true); request.getLog(false);*/ - getLog( - /** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ - tags?: string, - /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ - internal?: boolean): string[]; + getLog( + /** is a single tag string or array of tag strings. If no tags specified, returns all events.*/ + tags?: string, + /** filters the events to only those with a matching event.internal value. If true, only internal logs are included. If false, only user event are included. Defaults to all events (undefined).*/ + internal?: boolean): string[]; /** request.tail([name]) @@ -1295,10 +1327,10 @@ declare module "hapi" { console.log('Request completed including db activity'); });*/ - tail( - /** an optional tail name used for logging purposes.*/ - name?: string): Function; - } + tail( + /** an optional tail name used for logging purposes.*/ + name?: string): Function; + } /** Response events The response object supports the following events: @@ -1330,14 +1362,14 @@ declare module "hapi" { return reply.continue(); });*/ - export class Response extends Events.EventEmitter { - isBoom: boolean; - /** the HTTP response status code. Defaults to 200 (except for errors).*/ - statusCode: number; - /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ - headers: IDictionary; - /** the value provided using the reply interface.*/ - source: any; + export class Response extends Events.EventEmitter { + isBoom: boolean; + /** the HTTP response status code. Defaults to 200 (except for errors).*/ + statusCode: number; + /** an object containing the response headers where each key is a header field name. Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepare for transmission.*/ + headers: IDictionary; + /** the value provided using the reply interface.*/ + source: any; /** a string indicating the type of source with available values: 'plain' - a plain response such as string, number, null, or simple object (e.g. not a Stream, Buffer, or view). 'buffer' - a Buffer. @@ -1345,11 +1377,11 @@ declare module "hapi" { 'file' - a file generated with reply.file() of via the directory handler. 'stream' - a Stream. 'promise' - a Promise object. */ - variety: string; - /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ - app: any; - /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ - plugins: any; + variety: string; + /** application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name].*/ + app: any; + /** plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state. */ + plugins: any; /** settings - response handling flags: charset - the 'Content-Type' HTTP header 'charset' property. Defaults to 'utf-8'. encoding - the string encoding scheme used to serial data into the HTTP payload when source is a string or marshals into a string. Defaults to 'utf8'. @@ -1357,39 +1389,39 @@ declare module "hapi" { stringify - options used for source value requiring stringification. Defaults to no replacer and no space padding. ttl - if set, overrides the route cache expiration milliseconds value set in the route config. Defaults to no override. varyEtag - if true, a suffix will be automatically added to the 'ETag' header at transmission time (separated by a '-' character) when the HTTP 'Vary' header is present.*/ - settings: { - charset: string; - encoding: string; - passThrough: boolean; - stringify: any; - ttl: number; - varyEtag: boolean; - } + settings: { + charset: string; + encoding: string; + passThrough: boolean; + stringify: any; + ttl: number; + varyEtag: boolean; + } /** sets the HTTP 'Content-Length' header (to avoid chunked transfer encoding) where: length - the header value. Must match the actual payload size.*/ - bytes(length: number): Response; - /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ - charset(charset: string): Response; + bytes(length: number): Response; + /** sets the 'Content-Type' HTTP header 'charset' property where: charset - the charset property value.*/ + charset(charset: string): Response; /** sets the HTTP status code where: statusCode - the HTTP status code.*/ - code(statusCode: number): Response; - /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ - created(uri: string): Response; + code(statusCode: number): Response; + /** sets the HTTP status code to Created (201) and the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ + created(uri: string): Response; - /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ - encoding(encoding: string): Response; + /** encoding(encoding) - sets the string encoding scheme used to serial data into the HTTP payload where: encoding - the encoding property value (see node Buffer encoding).*/ + encoding(encoding: string): Response; /** etag(tag, options) - sets the representation entity tag where: tag - the entity tag string without the double-quote. options - optional settings where: weak - if true, the tag will be prefixed with the 'W/' weak signifier. Weak tags will fail to match identical tags for the purpose of determining 304 response status. Defaults to false. vary - if true and content encoding is set or applied to the response (e.g 'gzip' or 'deflate'), the encoding name will be automatically added to the tag at transmission time (separated by a '-' character). Ignored when weak is true. Defaults to true.*/ - etag(tag: string, options: { - weak: boolean; vary: boolean; - }): Response; + etag(tag: string, options: { + weak: boolean; vary: boolean; + }): Response; /**header(name, value, options) - sets an HTTP header where: name - the header name. @@ -1398,39 +1430,120 @@ declare module "hapi" { append - if true, the value is appended to any existing header value using separator. Defaults to false. separator - string used as separator when appending to an exiting value. Defaults to ','. override - if false, the header value is not set if an existing value present. Defaults to true.*/ - header(name: string, value: string, options?: { - append: boolean; - separator: string; - override: boolean; - }): Response; + header(name: string, value: string, options?: { + append: boolean; + separator: string; + override: boolean; + }): Response; /** location(uri) - sets the HTTP 'Location' header where: uri - an absolute or relative URI used as the 'Location' header value.*/ - location(uri: string): Response; + location(uri: string): Response; /** redirect(uri) - sets an HTTP redirection response (302) and decorates the response with additional methods listed below, where: uri - an absolute or relative URI used to redirect the client to another resource. */ - redirect(uri: string): Response; + redirect(uri: string): Response; /** replacer(method) - sets the JSON.stringify() replacer argument where: method - the replacer function or array. Defaults to none.*/ - replacer(method: Function| Array): Response; + replacer(method: Function | Array): Response; /** spaces(count) - sets the JSON.stringify() space argument where: count - the number of spaces to indent nested object keys. Defaults to no indentation. */ - spaces(count: number): Response; + spaces(count: number): Response; /**state(name, value, [options]) - sets an HTTP cookie where: name - the cookie name. value - the cookie value. If no encoding is defined, must be a string. options - optional configuration. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ - state(name: string, value: string, options?: any): Response; + state(name: string, value: string, options?: any): Response; + /** sets a string suffix when the response is process via JSON.stringify().*/ + suffix(suffix: string): void; + /** overrides the default route cache expiration rule for this response instance where: +msec - the time-to-live value in milliseconds.*/ + ttl(msec: number): void; /** type(mimeType) - sets the HTTP 'Content-Type' header where: mimeType - is the mime type. Should only be used to override the built-in default for each response type. */ - type(mimeType: string): Response; - } - + type(mimeType: string): Response; + /** clears the HTTP cookie by setting an expired value where: +name - the cookie name. +options - optional configuration for expiring cookie. If the state was previously registered with the server using server.state(), the specified keys in options override those same keys in the server definition (but not others).*/ + unstate(name: string, options?: { [key: string]: string }): void; + /** adds the provided header to the list of inputs affected the response generation via the HTTP 'Vary' header where: +header - the HTTP request header name.*/ + vary(header: string): void; + } + /** When using the redirect() method, the response object provides these additional methods */ + export class ResponseRedirect extends Response { + /** sets the status code to 302 or 307 (based on the rewritable() setting) where: +isTemporary - if false, sets status to permanent. Defaults to true.*/ + temporary(isTemporary: boolean): void; + /** sets the status code to 301 or 308 (based on the rewritable() setting) where: +isPermanent - if true, sets status to temporary. Defaults to false. */ + permanent(isPermanent: boolean): void; + /** sets the status code to 301/302 for rewritable (allows changing the request method from 'POST' to 'GET') or 307/308 for non-rewritable (does not allow changing the request method from 'POST' to 'GET'). Exact code based on the temporary() or permanent() setting. Arguments: +isRewritable - if false, sets to non-rewritable. Defaults to true. +Permanent Temporary +Rewritable 301 302(1) +Non-rewritable 308(2) 307 +Notes: 1. Default value. 2. Proposed code, not supported by all clients. */ + rewritable(isRewritable: boolean): void; + } + /** info about a server connection */ + export interface IServerConnectionInfo { + /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ + id: string; + /** - the connection creation timestamp.*/ + created: number; + /** - the connection start timestamp (0 when stopped).*/ + started: number; + /** the connection port based on the following rules: + the configured port value before the server has been started. + the actual port assigned when no port is configured or set to 0 after the server has been started.*/ + port: number; + /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ + host: string; + /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ + address: string; + /** - the protocol used: + 'http' - HTTP. + 'https' - HTTPS. + 'socket' - UNIX domain socket or Windows named pipe.*/ + protocol: string; + /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ + uri: string; + } + /** + * undocumented. The connection object constructed after calling server.connection(); + * can be accessed via server.connections; or request.connection; + */ + export class ServerConnection extends Events.EventEmitter { + domain: any; + _events: { route: Function, domain: Function, _events: Function, _eventsCount: Function, _maxListeners: Function }; + _eventsCount: number; + settings: IServerConnectionOptions; + server: Server; + /** ex: "tcp" */ + type: string; + _started: boolean; + /** dictionary of sockets */ + _connections: { [ip_port: string]: any }; + _onConnection: Function; + registrations: any; + _extensions: any; + _requestCounter: { value: number; min: number; max: number }; + _load: any; + states: { + settings: any; cookies: any; names: any[] + }; + auth: { connection: ServerConnection; _schemes: any; _strategies: any; settings: any; }; + _router: any; + MSPluginsCollection: any; + applicationCache: any; + addEventListener: any; + info: IServerConnectionInfo; + } /** Server http://hapijs.com/api#server rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080). @@ -1446,9 +1559,9 @@ declare module "hapi" { 'tail' - emitted when a request finished processing, including any registered tails. Single event per request. Note that the server object should not be used to emit application events as its internal implementation is designed to fan events out to the various plugin selections and not for application events. MORE EVENTS HERE: http://hapijs.com/api#server-events*/ - export class Server extends Events.EventEmitter { + export class Server extends Events.EventEmitter { - constructor(options?: IServerOptions); + constructor(options?: IServerOptions); /** Provides a safe place to store server-specific run-time application data without potential conflicts with the framework internals. The data can be accessed whenever the server is accessible. Initialized with an empty object. var Hapi = require('hapi'); server = new Hapi.Server(); @@ -1456,7 +1569,7 @@ declare module "hapi" { var handler = function (request, reply) { return reply(request.server.app.key); }; */ - app: any; + app: any; /** An array containing the server's connections. When the server object is returned from server.select(), the connections array only includes the connections matching the selection criteria. var server = new Hapi.Server(); server.connection({ port: 80, labels: 'a' }); @@ -1464,7 +1577,7 @@ declare module "hapi" { // server.connections.length === 2 var a = server.select('a'); // a.connections.length === 1*/ - connections: Array; + connections: Array; /** When the server contains exactly one connection, info is an object containing information about the sole connection. * When the server contains more than one connection, each server.connections array member provides its own connection.info. var server = new Hapi.Server(); @@ -1474,41 +1587,18 @@ declare module "hapi" { // server.info === null // server.connections[1].info.port === 8080 */ - info: { - /** - a unique connection identifier (using the format '{hostname}:{pid}:{now base36}').*/ - id: string; - /** - the connection creation timestamp.*/ - created: number; - /** - the connection start timestamp (0 when stopped).*/ - started: number; - /** the connection port based on the following rules: - the configured port value before the server has been started. - the actual port assigned when no port is configured or set to 0 after the server has been started.*/ - port: number; - - /** - the host name the connection was configured to. Defaults to the operating system hostname when available, otherwise 'localhost'.*/ - host: string; - /** - the active IP address the connection was bound to after starting.Set to undefined until the server has been started or when using a non TCP port (e.g. UNIX domain socket).*/ - address: string; - /** - the protocol used: - 'http' - HTTP. - 'https' - HTTPS. - 'socket' - UNIX domain socket or Windows named pipe.*/ - protocol: string; - /** a string representing the connection (e.g. 'http://example.com:8080' or 'socket:/unix/domain/socket/path'). Contains the uri setting if provided, otherwise constructed from the available settings. If no port is available or set to 0, the uri will not include a port component.*/ - uri: string; - }; + info: IServerConnectionInfo; /** An object containing the process load metrics (when load.sampleInterval is enabled): rss - RSS memory usage. var Hapi = require('hapi'); var server = new Hapi.Server({ load: { sampleInterval: 1000 } }); console.log(server.load.rss);*/ - load: { - /** - event loop delay milliseconds.*/ - eventLoopDelay: number; - /** - V8 heap usage.*/ - heapUsed: number; - }; + load: { + /** - event loop delay milliseconds.*/ + eventLoopDelay: number; + /** - V8 heap usage.*/ + heapUsed: number; + }; /** When the server contains exactly one connection, listener is the node HTTP server object of the sole connection. When the server contains more than one connection, each server.connections array member provides its own connection.listener. var Hapi = require('hapi'); @@ -1519,7 +1609,7 @@ declare module "hapi" { io.sockets.on('connection', function(socket) { socket.emit({ msg: 'welcome' }); });*/ - listener: http.Server; + listener: http.Server; /** server.methods An object providing access to the server methods where each server method name is an object property. @@ -1531,7 +1621,7 @@ declare module "hapi" { server.methods.add(1, 2, function (err, result) { // result === 3 });*/ - methods: IDictionary; + methods: IDictionary; /** server.mime Provides access to the server MIME database used for setting content-type information. The object must not be modified directly but only through the mime server setting. @@ -1551,7 +1641,7 @@ declare module "hapi" { var server = new Hapi.Server(options); // server.mime.path('code.js').type === 'application/javascript' // server.mime.path('file.npm').type === 'node/module'*/ - mime: any; + mime: any; /**server.plugins An object containing the values exposed by each plugin registered where each key is a plugin name and the values are the exposed properties by each plugin using server.expose(). Plugins may set the value of the server.plugins[name] object directly or via the server.expose() method. exports.register = function (server, options, next) { @@ -1562,7 +1652,7 @@ declare module "hapi" { exports.register.attributes = { name: 'example' };*/ - plugins: IDictionary; + plugins: IDictionary; /** server.realm The realm object contains server-wide or plugin-specific state that can be shared across various methods. For example, when calling server.bind(), the active realm settings.bind property is set which is then used by routes and extensions added at the same level (server root or plugin). Realms are a limited version of a sandbox where plugins can maintain state used by the framework when adding routes, extensions, and other properties. modifiers - when the server object is provided as an argument to the plugin register() method, modifiers provides the registration preferences passed the server.register() method and includes: @@ -1579,11 +1669,11 @@ declare module "hapi" { console.log(server.realm.modifiers.route.prefix); return next(); };*/ - realm: IServerRealm; + realm: IServerRealm; /** server.root The root server object containing all the connections and the root server methods (e.g. start(), stop(), connection()).*/ - root: Server; + root: Server; /** server.settings The server configuration object after defaults applied. var Hapi = require('hapi'); @@ -1593,14 +1683,14 @@ declare module "hapi" { } }); // server.settings.app === { key: 'value' }*/ - settings: IServerOptions; + settings: IServerOptions; /** server.version The hapi module version number. var Hapi = require('hapi'); var server = new Hapi.Server(); // server.version === '8.0.0'*/ - version: string; + version: string; /** server.after(method, [dependencies]) Adds a method to be called after all the plugin dependencies have been registered and before the server starts (only called if the server is started) where: @@ -1619,9 +1709,9 @@ declare module "hapi" { // After method already executed }); server.auth.default(options)*/ - after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string|string[]): void; + after(method: (plugin: any, next: (err: any) => void) => void, dependencies: string | string[]): void; - auth: { + auth: { /** server.auth.default(options) Sets a default strategy which is applied to every route where: options - a string with the default strategy name or an object with a specified strategy or strategies using the same format as the route auth handler options. @@ -1639,14 +1729,14 @@ declare module "hapi" { return reply(request.auth.credentials.user); } });*/ - default(options: string):void; + default(options: string): void; /** server.auth.scheme(name, scheme) Registers an authentication scheme where: name - the scheme name. scheme - the method implementing the scheme with signature function(server, options) where: server - a reference to the server object the scheme is added to. options - optional scheme settings used to instantiate a strategy.*/ - scheme(name: string, + scheme(name: string, /** When the scheme authenticate() method implementation calls reply() with an error condition, the specifics of the error affect whether additional authentication strategies will be attempted if configured for the route. If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference. n the scheme payload() method returns an error with a message, it means payload validation failed due to bad payload. If the error has no message but includes a scheme name (e.g. Boom.unauthorized(null, 'Custom')), authentication may still be successful if the route auth.payload configuration is set to 'optional'. server = new Hapi.Server(); @@ -1664,7 +1754,7 @@ declare module "hapi" { }; }; */ - scheme: (server: Server, options: any) => IServerAuthScheme): void; + scheme: (server: Server, options: any) => IServerAuthScheme): void; /** server.auth.strategy(name, scheme, [mode], [options]) Registers an authentication strategy where: @@ -1686,7 +1776,7 @@ declare module "hapi" { } } });*/ - strategy(name: string, scheme: any, mode?: boolean, options?: any):void; + strategy(name: string, scheme: any, mode?: boolean | string, options?: any): void; /** server.auth.test(strategy, request, next) Tests a request against an authentication strategy where: @@ -1712,8 +1802,8 @@ declare module "hapi" { }); } });*/ - test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; - }; + test(strategy: string, request: Request, next: (err: any, credentials: any) => void): void; + }; /** server.bind(context) Sets a global context used as the default bind object when adding a route or an extension where: context - the object used to bind this in handler and extension methods. @@ -1729,7 +1819,7 @@ declare module "hapi" { server.route({ method: 'GET', path: '/', handler: handler }); return next(); };*/ - bind(context: any): void; + bind(context: any): void; /** server.cache(options) @@ -1752,7 +1842,7 @@ declare module "hapi" { // value === { capital: 'oslo' }; }); });*/ - cache(options: ICatBoxCacheOptions): void; + cache(options: ICatBoxCacheOptions): void; /** server.connection([options]) Adds an incoming server connection @@ -1766,7 +1856,7 @@ declare module "hapi" { // server.connections.length === 2 // web.connections.length === 1 // admin.connections.length === 1 */ - connection(options: IServerConnectionOptions): Server; + connection(options: IServerConnectionOptions): Server; /** server.decorate(type, property, method) Extends various framework interfaces with custom methods where: type - the interface being decorated. Supported types: @@ -1788,7 +1878,7 @@ declare module "hapi" { return reply.success(); } });*/ - decorate(type: string, property: string, method: Function):void; + decorate(type: string, property: string, method: Function): void; /** server.dependency(dependencies, [after]) Used within a plugin to declares a required dependency on other plugins where: @@ -1805,7 +1895,7 @@ declare module "hapi" { // Additional plugin registration logic return next(); };*/ - dependency(dependencies: string|string[], after?: (server: Server, next: (err: any) => void) => void): void; + dependency(dependencies: string | string[], after?: (server: Server, next: (err: any) => void) => void): void; /** server.expose(key, value) @@ -1816,7 +1906,7 @@ declare module "hapi" { server.expose('util', function () { console.log('something'); }); return next(); };*/ - expose(key: string, value: any): void; + expose(key: string, value: any): void; /** server.expose(obj) Merges a deep copy of an object into to the existing content of server.plugins[name] where: @@ -1825,13 +1915,13 @@ declare module "hapi" { server.expose({ util: function () { console.log('something'); } }); return next(); };*/ - expose(obj: any): void; + expose(obj: any): void; /** server.ext(event, method, [options]) Registers an extension function in one of the available extension points where: event - the event name. method - a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is function(request, reply) where: - request - the request object. + request - the request object. NOTE: Access the Response via request.response reply - the reply interface which is used to return control back to the framework. To continue normal execution of the request lifecycle, reply.continue() must be called. To abort processing and return a response to the client, call reply(value) where value is an error or any other valid response. this - the object provided via options.bind or the current active context set with server.bind(). options - an optional object with the following: @@ -1852,7 +1942,7 @@ declare module "hapi" { server.route({ method: 'GET', path: '/test', handler: handler }); server.start(); // All requests will get routed to '/test'*/ - ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string|string[]; after: string|string[]; bind?: any }): void; + ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void; /** server.handler(name, method) Registers a new handler type to be used in routes where: @@ -1892,7 +1982,7 @@ declare module "hapi" { } }; server.handler('test', handler);*/ - handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; + handler(name: string, method: (route: IRoute, options: THandlerConfig) => ISessionHandler): void; /** When the server contains exactly one connection, injects a request into the sole connection simulating an incoming HTTP request without making an actual socket connection. Injection is useful for testing purposes as well as for invoking routing logic internally without the overhead or limitations of the network stack. Utilizes the [shot module | https://github.com/hapijs/shot ] for performing injections, with some additional options and response properties @@ -1908,7 +1998,7 @@ declare module "hapi" { console.log(res.result); }); */ - inject: IServerInject; + inject: IServerInject; /** server.log(tags, [data, [timestamp]]) Logs server events that cannot be associated with a specific request. When called the server emits a 'log' event which can be used by other listeners or plugins to record the information or output to the console. The arguments are: @@ -1924,7 +2014,7 @@ declare module "hapi" { } }); server.log(['test', 'error'], 'Test event');*/ - log(tags: string|string[], data?: string|any, timestamp?: number): void; + log(tags: string | string[], data?: string | any, timestamp?: number): void; /**server.lookup(id) When the server contains exactly one connection, looks up a route configuration where: id - the route identifier as set in the route options. @@ -1941,7 +2031,7 @@ declare module "hapi" { }); var route = server.lookup('root'); When the server contains more than one connection, each server.connections array member provides its own connection.lookup() method.*/ - lookup(id: string): IRoute; + lookup(id: string): IRoute; /** server.match(method, path, [host]) When the server contains exactly one connection, looks up a route configuration where: method - the HTTP method (e.g. 'GET', 'POST'). @@ -1960,7 +2050,7 @@ declare module "hapi" { }); var route = server.match('get', '/'); When the server contains more than one connection, each server.connections array member provides its own connection.match() method.*/ - match(method: string, path: string, host?: string): IRoute; + match(method: string, path: string, host?: string): IRoute; @@ -2004,11 +2094,11 @@ declare module "hapi" { server.methods.sumSync(4, 5, function (err, result) { console.log(result); }); */ - method( - /** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ - name: string, - method: IServerMethod, - options?: IServerMethodOptions):void; + method( + /** a unique method name used to invoke the method via server.methods[name]. When configured with caching enabled, server.methods[name].cache.drop(arg1, arg2, ..., argn, callback) can be used to clear the cache for a given key. Supports using nested names such as utils.users.get which will automatically create the missing path under server.methods and can be accessed for the previous example via server.methods.utils.users.get.*/ + name: string, + method: IServerMethod, + options?: IServerMethodOptions): void; /**server.method(methods) @@ -2029,11 +2119,11 @@ declare module "hapi" { } } });*/ - method(methods: { - name: string; method: IServerMethod; options?: IServerMethodOptions - }| Array<{ - name: string; method: IServerMethod; options?: IServerMethodOptions - }>):void; + method(methods: { + name: string; method: IServerMethod; options?: IServerMethodOptions + } | Array<{ + name: string; method: IServerMethod; options?: IServerMethodOptions + }>): void; /**server.path(relativeTo) Sets the path prefix used to locate static resources (files and view templates) when relative paths are used where: relativeTo - the path prefix added to any relative file path starting with '.'. @@ -2043,7 +2133,7 @@ declare module "hapi" { server.route({ path: '/file', method: 'GET', handler: { file: './test.html' } }); next(); };*/ - path(relativeTo: string): void; + path(relativeTo: string): void; /**server.register(plugins, [options], callback) Registers a plugin where: plugins - an object or array of objects where each one is either: @@ -2068,15 +2158,15 @@ declare module "hapi" { console.log('Failed loading plugin'); } });*/ - register(plugins: any|any[], options: { - select: string|string[]; - routes: { - prefix: string; vhost?: string|string[] - }; - } - , callback: (err: any) => void):void; + register(plugins: any | any[], options: { + select: string | string[]; + routes: { + prefix: string; vhost?: string | string[] + }; + } + , callback: (err: any) => void): void; - register(plugins: any|any[], callback: (err: any) => void):void; + register(plugins: any | any[], callback: (err: any) => void): void; /**server.render(template, context, [options], callback) Utilizes the server views manager to render a template where: @@ -2101,7 +2191,7 @@ declare module "hapi" { server.render('hello', context, function (err, rendered, config) { console.log(rendered); });*/ - render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void):void; + render(template: string, context: any, options: any, callback: (err: any, rendered: any, config: any) => void): void; /** server.route(options) Adds a connection route where: options - a route configuration object or an array of configuration objects. @@ -2113,8 +2203,8 @@ declare module "hapi" { { method: 'GET', path: '/1', handler: function (request, reply) { return reply('ok'); } }, { method: 'GET', path: '/2', handler: function (request, reply) { return reply('ok'); } } ]);*/ - route(options: IRouteConfiguration):void; - route(options: IRouteConfiguration[]):void; + route(options: IRouteConfiguration): void; + route(options: IRouteConfiguration[]): void; /**server.select(labels) Selects a subset of the server's connections where: labels - a single string or array of strings of labels used as a logical OR statement to select all the connections with matching labels in their configuration. @@ -2128,7 +2218,7 @@ declare module "hapi" { var a = server.select('a'); // The server with port 80 var ab = server.select(['a','b']); // A list of servers containing the server with port 80 and the server with port 8080 var c = server.select('c'); // A list of servers containing the server with port 8081 and the server with port 8082 */ - select(labels: string|string[]): Server|Server[]; + select(labels: string | string[]): Server | Server[]; /** server.start([callback]) Starts the server connections by listening for incoming requests on the configured port of each listener (unless the connection was configured with autoListen set to false), where: callback - optional callback when server startup is completed or failed with the signature function(err) where: @@ -2139,7 +2229,7 @@ declare module "hapi" { server.start(function (err) { console.log('Server started at: ' + server.info.uri); });*/ - start(callback?: (err: any) => void): void; + start(callback?: (err: any) => void): void; /** server.state(name, [options]) HTTP state management uses client cookies to persist a state across multiple requests. Registers a cookie definitions State defaults can be modified via the server connections.routes.state configuration option. @@ -2171,7 +2261,7 @@ declare module "hapi" { console.error(event); } }); */ - state(name: string, options?: ICookieSettings): void; + state(name: string, options?: ICookieSettings): void; /** server.stop([options], [callback]) Stops the server's connections by refusing to accept any new connections or requests (existing connections will continue until closed or timeout), where: @@ -2184,7 +2274,7 @@ declare module "hapi" { server.stop({ timeout: 60 * 1000 }, function () { console.log('Server stopped'); });*/ - stop(options?: { timeout: number }, callback?: () => void): void; + stop(options?: { timeout: number }, callback?: () => void): void; /**server.table([host]) Returns a copy of the routing table where: host - optional host to filter routes matching a specific virtual host. Defaults to all virtual hosts. @@ -2215,7 +2305,7 @@ declare module "hapi" { // } //] */ - table(host?: any): IConnectionTable; + table(host?: any): IConnectionTable; /**server.views(options) Initializes the server views manager @@ -2229,7 +2319,7 @@ declare module "hapi" { path: '/static/templates' }); When server.views() is called within a plugin, the views manager is only available to plugins methods.*/ - views(options: IServerViewsConfiguration): void; + views(options: IServerViewsConfiguration): void; - } + } } diff --git a/helmet/helmet-tests.ts b/helmet/helmet-tests.ts index d2509a022..83fd224a7 100644 --- a/helmet/helmet-tests.ts +++ b/helmet/helmet-tests.ts @@ -15,11 +15,45 @@ function helmetTest() { /** * @summary Test for {@see helmet#xssFilter} function. */ -function contentSecurityPolicyTest() { +function xssFilterTest() { app.use(helmet.xssFilter()); app.use(helmet.xssFilter({ setOnOldIE: true })); } +/** + * @summary Test for {@see helmet#csp} function + */ + +function contentSecurityPolicyTest() { + + // taken directly from helmet-csp docs + const config = { + // Specify directives as normal. + directives: { + defaultSrc: ["'self'", 'default.com'], + scriptSrc: ["'self'", "'unsafe-inline'"], + styleSrc: ['style.com'], + imgSrc: ['img.com', 'data:'], + sandbox: ['allow-forms', 'allow-scripts'], + reportUri: '/report-violation', + + objectSrc: ["'self'"], // An empty array allows nothing through + }, + + // Set to true if you only want browsers to report errors, not block them + reportOnly: false, + + // Set to true if you want to blindly set all headers: Content-Security-Policy, + // X-WebKit-CSP, and X-Content-Security-Policy. + setAllHeaders: false, + + // Set to true if you want to disable CSP on Android where it can be buggy. + disableAndroid: false + } + app.use(helmet.csp()); + app.use(helmet.contentSecurityPolicy(config)); +} + /** * @summary Test for {@see helmet#frameguard} function. */ diff --git a/helmet/helmet.d.ts b/helmet/helmet.d.ts index 35d9bf3ae..4d07730db 100644 --- a/helmet/helmet.d.ts +++ b/helmet/helmet.d.ts @@ -7,7 +7,24 @@ declare module "helmet" { import express = require("express"); - + + interface IHelmetCspDirectives { + defaultSrc? : string[]; + scriptSrc? : string[]; + styleSrc? : string[]; + imgSrc? : string[]; + sandbox? : string[]; + reportUri? : string; + objectSrc? : string[]; + } + + interface IHelmetCspConfiguration { + reportOnly? : boolean; + setAllHeaders? : boolean; + disableAndroid? : boolean; + directives? : IHelmetCspDirectives + } + /** * @summary Interface for helmet class. * @interface @@ -70,6 +87,19 @@ declare module "helmet" { * @param {Object} options The options. */ xssFilter(options ?: Object):express.RequestHandler; + + /** + * @summary Set policy around third-party content via headers + * @return {RequestHandler} The Request handler + * @param {Object} options The options + */ + csp(options ?: IHelmetCspConfiguration): express.RequestHandler; + + /** + * @see csp + */ + contentSecurityPolicy(options ?: IHelmetCspConfiguration): express.RequestHandler; + } var helmet: Helmet; diff --git a/highlightjs/highlightjs.d.ts b/highlightjs/highlightjs.d.ts index dc7606d88..8a0eceab5 100644 --- a/highlightjs/highlightjs.d.ts +++ b/highlightjs/highlightjs.d.ts @@ -3,152 +3,152 @@ // Definitions by: Niklas Mollenhauer , Jeremy Hull // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "highlight.js" +declare module 'highlight.js' { + export = hljs; +} + +declare module hljs { - module hljs + export function highlight( + name: string, + value: string, + ignore_illegals?: boolean, + continuation?: boolean) : IHighlightResult; + export function highlightAuto( + value: string, + languageSubset?: string[]) : IAutoHighlightResult; + + export function fixMarkup(value: string) : string; + + export function highlightBlock(block: Node) : void; + + export function configure(options: IOptions): void; + + export function initHighlighting(): void; + export function initHighlightingOnLoad(): void; + + export function registerLanguage( + name: string, + language: (hljs?: HLJSStatic) => IModeBase): void; + export function listLanguages(): string[]; + export function getLanguage(name: string): IMode; + + export function inherit(parent: Object, obj: Object): Object; + + // Common regexps + export var IDENT_RE: string; + export var UNDERSCORE_IDENT_RE: string; + export var NUMBER_RE: string; + export var C_NUMBER_RE: string; + export var BINARY_NUMBER_RE: string; + export var RE_STARTERS_RE: string; + + // Common modes + export var BACKSLASH_ESCAPE : IMode; + export var APOS_STRING_MODE : IMode; + export var QUOTE_STRING_MODE : IMode; + export var PHRASAL_WORDS_MODE : IMode; + export var C_LINE_COMMENT_MODE : IMode; + export var C_BLOCK_COMMENT_MODE : IMode; + export var HASH_COMMENT_MODE : IMode; + export var NUMBER_MODE : IMode; + export var C_NUMBER_MODE : IMode; + export var BINARY_NUMBER_MODE : IMode; + export var CSS_NUMBER_MODE : IMode; + export var REGEX_MODE : IMode; + export var TITLE_MODE : IMode; + export var UNDERSCORE_TITLE_MODE : IMode; + + export interface IHighlightResultBase { - export function highlight( - name: string, - value: string, - ignore_illegals?: boolean, - continuation?: boolean) : IHighlightResult; - export function highlightAuto( - value: string, - languageSubset?: string[]) : IAutoHighlightResult; + relevance: number; + language: string; + value: string; + } - export function fixMarkup(value: string) : string; + export interface IAutoHighlightResult extends IHighlightResultBase + { + second_best?: IAutoHighlightResult; + } - export function highlightBlock(block: Node) : void; + export interface IHighlightResult extends IHighlightResultBase + { + top: ICompiledMode; + } - export function configure(options: IOptions): void; - - export function initHighlighting(): void; - export function initHighlightingOnLoad(): void; - - export function registerLanguage( - name: string, - language: (hljs?: HLJSStatic) => IModeBase): void; - export function listLanguages(): string[]; - export function getLanguage(name: string): IMode; - - export function inherit(parent: Object, obj: Object): Object; + export interface HLJSStatic + { + inherit(parent: Object, obj: Object): Object; // Common regexps - export var IDENT_RE: string; - export var UNDERSCORE_IDENT_RE: string; - export var NUMBER_RE: string; - export var C_NUMBER_RE: string; - export var BINARY_NUMBER_RE: string; - export var RE_STARTERS_RE: string; + IDENT_RE: string; + UNDERSCORE_IDENT_RE: string; + NUMBER_RE: string; + C_NUMBER_RE: string; + BINARY_NUMBER_RE: string; + RE_STARTERS_RE: string; // Common modes - export var BACKSLASH_ESCAPE : IMode; - export var APOS_STRING_MODE : IMode; - export var QUOTE_STRING_MODE : IMode; - export var PHRASAL_WORDS_MODE : IMode; - export var C_LINE_COMMENT_MODE : IMode; - export var C_BLOCK_COMMENT_MODE : IMode; - export var HASH_COMMENT_MODE : IMode; - export var NUMBER_MODE : IMode; - export var C_NUMBER_MODE : IMode; - export var BINARY_NUMBER_MODE : IMode; - export var CSS_NUMBER_MODE : IMode; - export var REGEX_MODE : IMode; - export var TITLE_MODE : IMode; - export var UNDERSCORE_TITLE_MODE : IMode; - - export interface IHighlightResultBase - { - relevance: number; - language: string; - value: string; - } - - export interface IAutoHighlightResult extends IHighlightResultBase - { - second_best?: IAutoHighlightResult; - } - - export interface IHighlightResult extends IHighlightResultBase - { - top: ICompiledMode; - } - - export interface HLJSStatic - { - inherit(parent: Object, obj: Object): Object; - - // Common regexps - IDENT_RE: string; - UNDERSCORE_IDENT_RE: string; - NUMBER_RE: string; - C_NUMBER_RE: string; - BINARY_NUMBER_RE: string; - RE_STARTERS_RE: string; - - // Common modes - BACKSLASH_ESCAPE : IMode; - APOS_STRING_MODE : IMode; - QUOTE_STRING_MODE : IMode; - PHRASAL_WORDS_MODE : IMode; - C_LINE_COMMENT_MODE : IMode; - C_BLOCK_COMMENT_MODE : IMode; - HASH_COMMENT_MODE : IMode; - NUMBER_MODE : IMode; - C_NUMBER_MODE : IMode; - BINARY_NUMBER_MODE : IMode; - CSS_NUMBER_MODE : IMode; - REGEX_MODE : IMode; - TITLE_MODE : IMode; - UNDERSCORE_TITLE_MODE : IMode; - } - - // Reference: - // https://github.com/isagalaev/highlight.js/blob/master/docs/reference.rst - export interface IModeBase - { - className?: string; - aliases?: string[]; - begin?: string; - end?: string; - case_insensitive?: boolean; - beginKeyword?: string; - endsWithParent?: boolean; - lexems?: string; - illegal?: string; - excludeBegin?: boolean; - excludeEnd?: boolean; - returnBegin?: boolean; - returnEnd?: boolean; - starts?: string; - subLanguage?: string; - subLanguageMode?: string; - relevance?: number; - variants?: IMode[]; - } - - export interface IMode extends IModeBase - { - keywords?: any; - contains?: IMode[]; - } - - export interface ICompiledMode extends IModeBase - { - compiled: boolean; - contains?: ICompiledMode[]; - keywords?: Object; - terminators: RegExp; - terminator_end?: string; - } - - export interface IOptions - { - classPrefix?: string; - tabReplace?: string; - useBR?: boolean; - languages?: string[]; - } + BACKSLASH_ESCAPE : IMode; + APOS_STRING_MODE : IMode; + QUOTE_STRING_MODE : IMode; + PHRASAL_WORDS_MODE : IMode; + C_LINE_COMMENT_MODE : IMode; + C_BLOCK_COMMENT_MODE : IMode; + HASH_COMMENT_MODE : IMode; + NUMBER_MODE : IMode; + C_NUMBER_MODE : IMode; + BINARY_NUMBER_MODE : IMode; + CSS_NUMBER_MODE : IMode; + REGEX_MODE : IMode; + TITLE_MODE : IMode; + UNDERSCORE_TITLE_MODE : IMode; + } + + // Reference: + // https://github.com/isagalaev/highlight.js/blob/master/docs/reference.rst + export interface IModeBase + { + className?: string; + aliases?: string[]; + begin?: string; + end?: string; + case_insensitive?: boolean; + beginKeyword?: string; + endsWithParent?: boolean; + lexems?: string; + illegal?: string; + excludeBegin?: boolean; + excludeEnd?: boolean; + returnBegin?: boolean; + returnEnd?: boolean; + starts?: string; + subLanguage?: string; + subLanguageMode?: string; + relevance?: number; + variants?: IMode[]; + } + + export interface IMode extends IModeBase + { + keywords?: any; + contains?: IMode[]; + } + + export interface ICompiledMode extends IModeBase + { + compiled: boolean; + contains?: ICompiledMode[]; + keywords?: Object; + terminators: RegExp; + terminator_end?: string; + } + + export interface IOptions + { + classPrefix?: string; + tabReplace?: string; + useBR?: boolean; + languages?: string[]; } - export = hljs; } diff --git a/html-minifier/html-minifier-tests.ts b/html-minifier/html-minifier-tests.ts new file mode 100644 index 000000000..b02ecea19 --- /dev/null +++ b/html-minifier/html-minifier-tests.ts @@ -0,0 +1,9 @@ +/// + +import * as HTMLMinifier from 'html-minifier'; +const minify = HTMLMinifier.minify; + +var result = minify('

foo

', { + removeAttributeQuotes: true +}); +result; // '

foo

' diff --git a/html-minifier/html-minifier.d.ts b/html-minifier/html-minifier.d.ts new file mode 100644 index 000000000..9557de890 --- /dev/null +++ b/html-minifier/html-minifier.d.ts @@ -0,0 +1,115 @@ +// Type definitions for HTMLMinifier v1.1.1 +// Project: https://github.com/kangax/html-minifier +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// + +declare module 'html-minifier' { + import * as UglifyJS from 'uglify-js'; + import * as CleanCSS from 'clean-css'; + import * as RelateUrl from 'relateurl'; + + namespace HTMLMinifier { + function minify(text: string, options?: Options): string; + + interface Options { + // Strip HTML comments + removeComments?: boolean; + + // Strip HTML comments from scripts and styles + removeCommentsFromCDATA?: boolean; + + // Remove CDATA sections from script and style elements + removeCDATASectionsFromCDATA?: boolean; + + // Collapse white space that contributes to text nodes in a document tree + collapseWhitespace?: boolean; + + // Always collapse to 1 space (never remove it entirely). Must be used in conjunction with collapseWhitespace=true + conservativeCollapse?: boolean; + + // Don't leave any spaces between display:inline; elements when collapsing. Must be used in conjunction with collapseWhitespace=true + collapseInlineTagWhitespace?: boolean; + + // Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break. Must be used in conjunction with collapseWhitespace=true + preserveLineBreaks?: boolean; + + // Omit attribute values from boolean attributes + collapseBooleanAttributes?: boolean; + + // Remove quotes around attributes when possible + removeAttributeQuotes?: boolean; + + // Remove attributes when value matches default + removeRedundantAttributes?: boolean; + + // Prevents the escaping of the values of attributes. + preventAttributesEscaping?: boolean; + + // Replaces the doctype with the short (HTML5) doctype + useShortDoctype?: boolean; + + // Remove all attributes with whitespace-only values + removeEmptyAttributes?: boolean; + + // Remove type="text/javascript" from script tags. Other type attribute values are left intact. + removeScriptTypeAttributes?: boolean; + + // Remove type="text/css" from style and link tags. Other type attribute values are left intact. + removeStyleLinkTypeAttributes?: boolean; + + // Remove unrequired tags + removeOptionalTags?: boolean; + + // Remove all elements with empty contents + removeEmptyElements?: boolean; + + // Toggle linting + lint?: boolean; + + // Keep the trailing slash on singleton elements + keepClosingSlash?: boolean; + + // Treat attributes in case sensitive manner (useful for custom HTML tags.) + caseSensitive?: boolean; + + // Minify Javascript in script elements and on* attributes (uses UglifyJS) + minifyJS?: boolean | UglifyJS.MinifyOptions; + + // Minify CSS in style elements and style attributes (uses clean-css) + minifyCSS?: boolean | CleanCSS.Options; + + // Minify URLs in various attributes (uses relateurl) + minifyURLs?: boolean | RelateUrl.Options; + + // Array of regex'es that allow to ignore certain comments, when matched + ignoreCustomComments?: Array; + + // Array of regex'es that allow to ignore certain fragments, when matched (e.g. , {{ ... }}, etc.) + ignoreCustomFragments?: Array; + + // Array of strings corresponding to types of script elements to process through minifier (e.g. text/ng-template, text/x-handlebars-template, etc.) + processScripts?: Array; + + // Specify a maximum line length. Compressed output will be split by newlines at valid HTML split-points + maxLineLength?: number; + + // Arrays of regex'es that allow to support custom attribute assign expressions (e.g. '
') + customAttrAssign?: Array; + + // Arrays of regex'es that allow to support custom attribute surround expressions (e.g. ) + customAttrSurround?: Array; + + // Regex that specifies custom attribute to strip newlines from (e.g. /ng\-class/) + customAttrCollapse?: RegExp; + + // Type of quote to use for attribute values (' or ") + quoteCharacter?: string; + } + } + + export = HTMLMinifier; +} diff --git a/http-status-codes/http-status-codes-tests.ts b/http-status-codes/http-status-codes-tests.ts new file mode 100644 index 000000000..02c2a104b --- /dev/null +++ b/http-status-codes/http-status-codes-tests.ts @@ -0,0 +1,109 @@ +/// + +import HttpStatusCodes = require("http-status-codes"); + +var ACCEPTED = HttpStatusCodes.ACCEPTED; +var BAD_GATEWAY = HttpStatusCodes.BAD_GATEWAY; +var BAD_REQUEST = HttpStatusCodes.BAD_REQUEST; +var CONFLICT = HttpStatusCodes.CONFLICT; +var CONTINUE = HttpStatusCodes.CONTINUE; +var CREATED = HttpStatusCodes.CREATED; +var EXPECTATION_FAILED = HttpStatusCodes.EXPECTATION_FAILED; +var FAILED_DEPENDENCY = HttpStatusCodes.FAILED_DEPENDENCY ; +var FORBIDDEN = HttpStatusCodes.FORBIDDEN; +var GATEWAY_TIMEOUT = HttpStatusCodes.GATEWAY_TIMEOUT; +var GONE = HttpStatusCodes.GONE; +var HTTP_VERSION_NOT_SUPPORTED = HttpStatusCodes.HTTP_VERSION_NOT_SUPPORTED; +var INSUFFICIENT_SPACE_ON_RESOURCE = HttpStatusCodes.INSUFFICIENT_SPACE_ON_RESOURCE; +var INSUFFICIENT_STORAGE = HttpStatusCodes.INSUFFICIENT_STORAGE; +var INTERNAL_SERVER_ERROR = HttpStatusCodes.INTERNAL_SERVER_ERROR; +var LENGTH_REQUIRED = HttpStatusCodes.LENGTH_REQUIRED; +var LOCKED = HttpStatusCodes.LOCKED; +var METHOD_FAILURE = HttpStatusCodes.METHOD_FAILURE; +var METHOD_NOT_ALLOWED = HttpStatusCodes.METHOD_NOT_ALLOWED; +var MOVED_PERMANENTLY = HttpStatusCodes.MOVED_PERMANENTLY; +var MOVED_TEMPORARILY = HttpStatusCodes.MOVED_TEMPORARILY; +var MULTI_STATUS = HttpStatusCodes.MULTI_STATUS; +var MULTIPLE_CHOICES = HttpStatusCodes.MULTIPLE_CHOICES; +var NETWORK_AUTHENTICATION_REQUIRED = HttpStatusCodes.NETWORK_AUTHENTICATION_REQUIRED; +var NO_CONTENT = HttpStatusCodes.NO_CONTENT; +var NON_AUTHORITATIVE_INFORMATION = HttpStatusCodes.NON_AUTHORITATIVE_INFORMATION; +var NOT_ACCEPTABLE = HttpStatusCodes.NOT_ACCEPTABLE; +var NOT_FOUND = HttpStatusCodes.NOT_FOUND; +var NOT_IMPLEMENTED = HttpStatusCodes.NOT_IMPLEMENTED; +var NOT_MODIFIED = HttpStatusCodes.NOT_MODIFIED; +var OK = HttpStatusCodes.OK; +var PARTIAL_CONTENT = HttpStatusCodes.PARTIAL_CONTENT; +var PAYMENT_REQUIRED = HttpStatusCodes.PAYMENT_REQUIRED; +var PRECONDITION_FAILED = HttpStatusCodes.PRECONDITION_FAILED; +var PRECONDITION_REQUIRED = HttpStatusCodes.PRECONDITION_REQUIRED; +var PROCESSING = HttpStatusCodes.PROCESSING; +var PROXY_AUTHENTICATION_REQUIRED = HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED; +var REQUEST_HEADER_FIELDS_TOO_LARGE = HttpStatusCodes.REQUEST_HEADER_FIELDS_TOO_LARGE; +var REQUEST_TIMEOUT = HttpStatusCodes.REQUEST_TIMEOUT; +var REQUEST_TOO_LONG = HttpStatusCodes.REQUEST_TOO_LONG; +var REQUEST_URI_TOO_LONG = HttpStatusCodes.REQUEST_URI_TOO_LONG; +var REQUESTED_RANGE_NOT_SATISFIABLE = HttpStatusCodes.REQUESTED_RANGE_NOT_SATISFIABLE; +var RESET_CONTENT = HttpStatusCodes.RESET_CONTENT; +var SEE_OTHER = HttpStatusCodes.SEE_OTHER; +var SERVICE_UNAVAILABLE = HttpStatusCodes.SERVICE_UNAVAILABLE; +var SWITCHING_PROTOCOLS = HttpStatusCodes.SWITCHING_PROTOCOLS; +var TEMPORARY_REDIRECT = HttpStatusCodes.TEMPORARY_REDIRECT; +var TOO_MANY_REQUESTS = HttpStatusCodes.TOO_MANY_REQUESTS; +var UNAUTHORIZED = HttpStatusCodes.UNAUTHORIZED; +var UNPROCESSABLE_ENTITY = HttpStatusCodes.UNPROCESSABLE_ENTITY; +var UNSUPPORTED_MEDIA_TYPE = HttpStatusCodes.UNSUPPORTED_MEDIA_TYPE; +var USE_PROXY = HttpStatusCodes.USE_PROXY; + +var ACCEPTED_Text = HttpStatusCodes.getStatusText(202); +var BAD_GATEWAY_Text = HttpStatusCodes.getStatusText(502); +var BAD_REQUEST_Text = HttpStatusCodes.getStatusText(400); +var CONFLICT_Text = HttpStatusCodes.getStatusText(409); +var CONTINUE_Text = HttpStatusCodes.getStatusText(100); +var CREATED_Text = HttpStatusCodes.getStatusText(201); +var EXPECTATION_FAILED_Text = HttpStatusCodes.getStatusText(417); +var FAILED_DEPENDENCY_Text = HttpStatusCodes.getStatusText(424); +var FORBIDDEN_Text = HttpStatusCodes.getStatusText(403); +var GATEWAY_TIMEOUT_Text = HttpStatusCodes.getStatusText(504); +var GONE_Text = HttpStatusCodes.getStatusText(410); +var HTTP_VERSION_NOT_SUPPORTED_Text = HttpStatusCodes.getStatusText(505); +var INSUFFICIENT_SPACE_ON_RESOURCE_Text = HttpStatusCodes.getStatusText(419); +var INSUFFICIENT_STORAGE_Text = HttpStatusCodes.getStatusText(507); +var INTERNAL_SERVER_ERROR_Text = HttpStatusCodes.getStatusText(500); +var LENGTH_REQUIRED_Text = HttpStatusCodes.getStatusText(411); +var LOCKED_Text = HttpStatusCodes.getStatusText(423); +var METHOD_FAILURE_Text = HttpStatusCodes.getStatusText(420); +var METHOD_NOT_ALLOWED_Text = HttpStatusCodes.getStatusText(405); +var MOVED_PERMANENTLY_Text = HttpStatusCodes.getStatusText(301); +var MOVED_TEMPORARILY_Text = HttpStatusCodes.getStatusText(302); +var MULTI_STATUS_Text = HttpStatusCodes.getStatusText(207); +var MULTIPLE_CHOICES_Text = HttpStatusCodes.getStatusText(300); +var NETWORK_AUTHENTICATION_REQUIRED_Text = HttpStatusCodes.getStatusText(511); +var NO_CONTENT_Text = HttpStatusCodes.getStatusText(204); +var NON_AUTHORITATIVE_INFORMATION_Text = HttpStatusCodes.getStatusText(203); +var NOT_ACCEPTABLE_Text = HttpStatusCodes.getStatusText(406); +var NOT_FOUND_Text = HttpStatusCodes.getStatusText(404); +var NOT_IMPLEMENTED_Text = HttpStatusCodes.getStatusText(501); +var NOT_MODIFIED_Text = HttpStatusCodes.getStatusText(304); +var OK_Text = HttpStatusCodes.getStatusText(200); +var PARTIAL_CONTENT_Text = HttpStatusCodes.getStatusText(206); +var PAYMENT_REQUIRED_Text = HttpStatusCodes.getStatusText(402); +var PRECONDITION_FAILED_Text = HttpStatusCodes.getStatusText(412); +var PRECONDITION_REQUIRED_Text = HttpStatusCodes.getStatusText(428); +var PROCESSING_Text = HttpStatusCodes.getStatusText(102); +var PROXY_AUTHENTICATION_REQUIRED_Text = HttpStatusCodes.getStatusText(407); +var REQUEST_HEADER_FIELDS_TOO_LARGE_Text = HttpStatusCodes.getStatusText(431); +var REQUEST_TIMEOUT_Text = HttpStatusCodes.getStatusText(408); +var REQUEST_TOO_LONG_Text = HttpStatusCodes.getStatusText(413); +var REQUEST_URI_TOO_LONG_Text = HttpStatusCodes.getStatusText(414); +var REQUESTED_RANGE_NOT_SATISFIABLE_Text = HttpStatusCodes.getStatusText(416); +var RESET_CONTENT_Text = HttpStatusCodes.getStatusText(205); +var SEE_OTHER_Text = HttpStatusCodes.getStatusText(303); +var SERVICE_UNAVAILABLE_Text = HttpStatusCodes.getStatusText(503); +var SWITCHING_PROTOCOLS_Text = HttpStatusCodes.getStatusText(101); +var TEMPORARY_REDIRECT_Text = HttpStatusCodes.getStatusText(307); +var TOO_MANY_REQUESTS_Text = HttpStatusCodes.getStatusText(429); +var UNAUTHORIZED_Text = HttpStatusCodes.getStatusText(401); +var UNPROCESSABLE_ENTITY_Text = HttpStatusCodes.getStatusText(422); +var UNSUPPORTED_MEDIA_TYPE_Text = HttpStatusCodes.getStatusText(415); +var USE_PROXY_Text = HttpStatusCodes.getStatusText(305); \ No newline at end of file diff --git a/http-status-codes/http-status-codes.d.ts b/http-status-codes/http-status-codes.d.ts new file mode 100644 index 000000000..ebea4d75b --- /dev/null +++ b/http-status-codes/http-status-codes.d.ts @@ -0,0 +1,61 @@ +// Type definitions for Node.JS package http-status-codes v1.0.5 +// Project: https://github.com/prettymuchbryce/node-http-status +// Definitions by: Josh McCullough +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "http-status-codes" { + export var ACCEPTED: number; + export var BAD_GATEWAY: number; + export var BAD_REQUEST: number; + export var CONFLICT: number; + export var CONTINUE: number; + export var CREATED: number; + export var EXPECTATION_FAILED: number; + export var FAILED_DEPENDENCY: number; + export var FORBIDDEN: number; + export var GATEWAY_TIMEOUT: number; + export var GONE: number; + export var HTTP_VERSION_NOT_SUPPORTED: number; + export var INSUFFICIENT_SPACE_ON_RESOURCE: number; + export var INSUFFICIENT_STORAGE: number; + export var INTERNAL_SERVER_ERROR: number; + export var LENGTH_REQUIRED: number; + export var LOCKED: number; + export var METHOD_FAILURE: number; + export var METHOD_NOT_ALLOWED: number; + export var MOVED_PERMANENTLY: number; + export var MOVED_TEMPORARILY: number; + export var MULTI_STATUS: number; + export var MULTIPLE_CHOICES: number; + export var NETWORK_AUTHENTICATION_REQUIRED: number; + export var NO_CONTENT: number; + export var NON_AUTHORITATIVE_INFORMATION: number; + export var NOT_ACCEPTABLE: number; + export var NOT_FOUND: number; + export var NOT_IMPLEMENTED: number; + export var NOT_MODIFIED: number; + export var OK: number; + export var PARTIAL_CONTENT: number; + export var PAYMENT_REQUIRED: number; + export var PRECONDITION_FAILED: number; + export var PRECONDITION_REQUIRED: number; + export var PROCESSING: number; + export var PROXY_AUTHENTICATION_REQUIRED: number; + export var REQUEST_HEADER_FIELDS_TOO_LARGE: number; + export var REQUEST_TIMEOUT: number; + export var REQUEST_TOO_LONG: number; + export var REQUEST_URI_TOO_LONG: number; + export var REQUESTED_RANGE_NOT_SATISFIABLE: number; + export var RESET_CONTENT: number; + export var SEE_OTHER: number; + export var SERVICE_UNAVAILABLE: number; + export var SWITCHING_PROTOCOLS: number; + export var TEMPORARY_REDIRECT: number; + export var TOO_MANY_REQUESTS: number; + export var UNAUTHORIZED: number; + export var UNPROCESSABLE_ENTITY: number; + export var UNSUPPORTED_MEDIA_TYPE: number; + export var USE_PROXY: number; + + export function getStatusText(statusCode: number): string; +} \ No newline at end of file diff --git a/i18next-express-middleware/i18next-express-middleware-tests.ts b/i18next-express-middleware/i18next-express-middleware-tests.ts new file mode 100644 index 000000000..a696f4f8a --- /dev/null +++ b/i18next-express-middleware/i18next-express-middleware-tests.ts @@ -0,0 +1,48 @@ +/// +/// + +import * as express from "express"; +import * as i18next from "i18next"; +import middleware = require("i18next-express-middleware"); + +function requestObjectTest() { + var i18nextOptions = {}; + i18next + .use(middleware.LanguageDetector) + .init(i18nextOptions); + + var app = express(); + app.use(middleware.handle(i18next, { + ignoreRoutes: ["/foo"], + removeLngFromUrl: false + })); +} + +function detectorOptionsTest() { + var options = { + // order and from where user language should be detected + order: [/*'path', 'session', */ 'querystring', 'cookie', 'header'], + + // keys or params to lookup language from + lookupQuerystring: 'lng', + lookupCookie: 'i18next', + lookupSession: 'lng', + lookupFromPathIndex: 0, + + // cache user language + caches: false, // ['cookie'] + + // optional expire and domain for set cookie + cookieExpirationDate: new Date(), + cookieDomain: 'myDomain' + }; + + i18next + .use(middleware.LanguageDetector) + .init({ + detection: options + }); + + var lngDetector = new middleware.LanguageDetector(null, options); + lngDetector.init(options); +} diff --git a/i18next-express-middleware/i18next-express-middleware.d.ts b/i18next-express-middleware/i18next-express-middleware.d.ts new file mode 100644 index 000000000..fe51928bf --- /dev/null +++ b/i18next-express-middleware/i18next-express-middleware.d.ts @@ -0,0 +1,96 @@ +// Type definitions for i18next-express-middleware +// Project: http://i18next.com/ +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +/** + * @summary Interface for Language detector options. + * @interface + */ +interface LanguageDetectorOptions { + caches?: boolean; + cookieDomain?: string; + cookieExpirationDate?: Date; + lookupCookie?: string; + lookupFromPathIndex?: number; + lookupQuerystring?: string; + lookupSession?: string; + order?: Array; +} + +declare module "i18next-express-middleware" { + import express = require("express"); + import i18next = require("i18next"); + + /** + * @summary Interface for middleware to use i18next in express.js. + * @interface + */ + export interface i18nextExpressMiddleware { + LanguageDetector(): express.Handler; + missingKeyHandler(): express.Handler; + } + + /** + * @summary Interface for own detection functionality. + */ + export interface i18nextCustomDetection { + name: string; + lookup: (req: express.Request, res: express.Response, options?: Object) => void; + cacheUserLanguage: (req: express.Request, res: express.Response, lng?: any, options?: Object) => void; + } + + /** + * @summary Detects user language from current request. + * @class + */ + export class LanguageDetector { + /** + * @summary Constructor. + * @constructor + * @param {any} services The services. + * @param {Object} options The options. + * @param {Object} allOptions The all options. + */ + constructor(services?: any, options?: Object, allOptions?: Object); + + /** + * @summary Adds detector. + * @param {i18nextCustomDetection} detector The detector to add. + */ + addDetector(detector: i18nextCustomDetection): void; + + // NOTE: add documentation + cacheUserLanguage(req: express.Request, res: express.Response, detectionOrder: any): void; + + /** + * @summary Detects the language. + * @param {Request} req The HTTP request. + * @param {Response} res The HTTP response. + * @param {detectionOrder} detectionOrder The detection order. + */ + detect(req: express.Request, res: express.Response, detectionOrder: any): void; + + /** + * @summary Initializes class. + * @param {any} services The services. + * @param {Object} options The options. + * @param {Object} allOptions The all options. + */ + init(services: any, options?: Object, allOptions?: Object): void; + } + + export function getResourcesHandler(i18next: I18nextStatic, options: Object): express.Handler; + export function handle(i18next: I18nextStatic, options?: Object): express.Handler; + + /** + * @summary Gets handler for missing key. + * @param {I18nextStatic} i18next The i18next. + * @param {Object} options The options. + * @return {express.Handler} The express handler. + */ + export function missingKeyHandler(i18next: I18nextStatic, options: Object): express.Handler; +} diff --git a/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor-tests.ts b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor-tests.ts new file mode 100644 index 000000000..b2bdf3b8d --- /dev/null +++ b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor-tests.ts @@ -0,0 +1,10 @@ +/// + +import * as i18next from "i18next"; +import sprintf from "i18next-sprintf-postprocessor"; + +function initTest() { + const i18nextOptions = {}; + i18next.use(sprintf).init(i18nextOptions); + i18next.init({ overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler }); +} diff --git a/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts new file mode 100644 index 000000000..7983e46aa --- /dev/null +++ b/i18next-sprintf-postprocessor/i18next-sprintf-postprocessor.d.ts @@ -0,0 +1,20 @@ +// Type definitions for i18next-sprintf-postProcessor +// Project: https://github.com/i18next/i18next-sprintf-postProcessor +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "i18next-sprintf-postprocessor" { + import i18next = require("i18next"); + + interface i18nextSprintfPostProcessor { + (): any; + process(value: any, key: string, options: Object): void; + overloadTranslationOptionHandler(args: Array): void; + } + + var sprintf: i18nextSprintfPostProcessor; + export default sprintf; +} diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts index 38d91b603..c9a215953 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -1,11 +1,14 @@ -// Type definitions for i18next v1.5.10 +// Type definitions for i18next v2.0.17 // Project: http://i18next.com // Definitions by: Maarten Docter // Definitions: https://github.com/borisyankov/DefinitelyTyped // Sources: https://github.com/jamuhl/i18next/ +/// /// +/// +/// interface IResourceStore { [language: string]: IResourceStoreLanguage; @@ -27,7 +30,12 @@ interface I18nTranslateOptions extends I18nextOptions { context?: any; } -interface I18nextOptions { +interface i18nextSprintfPostProcessorStatic { + overloadTranslationOptionHandler?(args: Array): void; + process?(value: any, key: string, options: Object): void; +} + +interface I18nextOptions extends i18nextSprintfPostProcessorStatic { lng?: string; // Default value: undefined load?: string; // Default value: 'all' preload?: string[]; // Default value: [] @@ -99,7 +107,7 @@ interface I18nextStatic { regexEscape(str: string): string; }; init(callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred; - init(options?: I18nextOptions, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred; + init(options?: I18nextOptions|any, callback?: (err: any, t: (key: string, options?: any) => string) => void ): JQueryDeferred; // NOTE: remove any for 'options' parameter. lng(): string; loadNamespace(namespace: string, callback?: () => void ): void; loadNamespaces(namespaces: string[], callback?: () => void ): void; @@ -124,6 +132,7 @@ interface I18nextStatic { t(key: string, options?: I18nTranslateOptions): string; translate(key: string, options?: I18nTranslateOptions): string; exists(key: string, options?: any): boolean; + use(module: any): I18nextStatic; } // jQuery extensions diff --git a/iban/iban.d.ts b/iban/iban.d.ts index 6a7bd803d..14c6ae764 100644 --- a/iban/iban.d.ts +++ b/iban/iban.d.ts @@ -55,4 +55,8 @@ interface IBANStatic { toBBAN(iban: string, separator: string[]): string; } -declare var IBAN: IBANStatic; \ No newline at end of file +declare var IBAN: IBANStatic; + +declare module 'iban' { + export = IBAN; +} diff --git a/ibm-mobilefirst/ibm-mobilefirst-tests.ts b/ibm-mobilefirst/ibm-mobilefirst-tests.ts new file mode 100644 index 000000000..c45b630d7 --- /dev/null +++ b/ibm-mobilefirst/ibm-mobilefirst-tests.ts @@ -0,0 +1,169 @@ +/// +/// +// Tests + +// Test WL.Client +WL.Client.connect({ + onSuccess: function (response: WL.ResponseBase) { + var title: string = response.responseJSON["title"]; + console.log(response.status + ' ' + title); + }, + onFailure: function (response: WL.FailureResponse) { + }, + timeout: 30 +}); + +WL.Client.invokeProcedure({ adapter: "", procedure: ""}).then(function(response) { + response.responseJSON; +}, function(response) { + response.status; +}); + +// Test WL.Device +WL.Device.getNetworkInfo(function(networkInfo) { + var addrs = networkInfo.Ipv4Addresses; + addrs[0].wifiAddress; +}) + +// Test user delete certificate +WL.UserAuth.deleteCertificate("entity").then(function() { + console.log('WL.UserAuth.deleteCertificate success'); +}, function(error: string) { + console.log('WL.UserAuth.deleteCertificate failure ' + error); +}); + +// Test Auhorization Manager +var xhr = new XMLHttpRequest(); +WLAuthorizationManager.addCachedAuthorizationHeader(xhr).always( + function(response: WLAuthorizationManager.RequestObject) { + // success or failure flow + } +); +WLAuthorizationManager.getAppIdentity().then(function(data) { + // success flow with application identity +}, function(error: string) { + // failure flow with error +}); +WLAuthorizationManager.getCachedAuthorizationHeader().then(function(response) { + // success flow +}, function(error) { + // error flow +}); +WLAuthorizationManager.getDeviceIdentity().then(function(data) { + // success flow with device identity +}, function(error) { + // failure flow with error +}); + +// Test WL.JSONStore +var arr: any[]; +arr = WL.JSONStore.QueryPart().between('gpa', [3.0, 4.0]); + //arr = [{$between: [{ gpa : [3.0, 4.0] }]}] +arr = WL.JSONStore.QueryPart().equal('age', 35); + //arr = [{$equal: [{ age : 35 }]}] +arr = WL.JSONStore.QueryPart().greaterOrEqualThan('age', 40); + //arr = [{$greaterOrEqualThan: [{ age : 40 }]}] +arr = WL.JSONStore.QueryPart().greaterThan('age', 40); + //arr = [{$greaterThan: [{ age : 40 }]}] +arr = WL.JSONStore.QueryPart().inside('gpa', [3.0, 4.0]); + //arr = [{$inside: [{ gpa : [3.0, 4.0] }]}] +arr = WL.JSONStore.QueryPart().leftLike('name', 'ca'); + //arr = [{$leftLike: [{ name : 'ca' }]}] +arr = WL.JSONStore.QueryPart().lessOrEqualThan('age', 40); + //arr = [{$lessOrEqualThan: [{ age : 40 }]}] +arr = WL.JSONStore.QueryPart().lessThan('age', 40); + //arr = [{$lessThan: [{ age : 40 }]}] +arr = WL.JSONStore.QueryPart().like('name', 'ca'); + //arr = [{$like: [{ name : 'ca' }]}] +arr = WL.JSONStore.QueryPart().notBetween('gpa', [3.0, 4.0]); + //arr = [{$notBetween: [{ gpa : [3.0, 4.0] }]}] +arr = WL.JSONStore.QueryPart().notEqual('name', 'ca'); + //arr = [{$notEqual: [{ name : 'ca' }]}] + +// Test WL.Logger +WL.Logger.config(); +var logger = WL.Logger.create({pkg: 'myapp'}); +logger.debug('Hello world'); +logger.error('Hello world'); +logger.fatal('Hello world'); +logger.info('Hello world'); +logger.trace('Hello world'); +logger.warn('Hello world'); +WL.Logger.ctx({pkg: 'hello'}).debug('Hello world'); //Package name context passed +WL.Logger.debug('Hello world'); +WL.Logger.error('Hello world'); +WL.Logger.fatal('Hello world'); +WL.Logger.info('Hello world'); +WL.Logger.log('Hello world'); +WL.Logger.trace('Hello world'); +WL.Logger.warn('Hello world'); +WL.Logger.metadata( { hi : 'world' } ).info('hello'); +WL.Logger.setNativeOptions({ + maxFileSize : 100000, + level : 'debug', + capture : true, + filters : { jsonstore : 'debug' } + }); +WL.Logger.status().then(function (state) { + //{ enabled : true, stringify: true, filters : {}, + // level : 'info', pkg : '', tag: {level: false, pkg: true} } +}).fail(function (errMsg) { + //errMsg = error message +}); + +// Test WL.SecurityUtils +WL.SecurityUtils.base64Encode('input string').then(function(result: string) { + console.log('Base64 Encoded: ' + result); +}, function() { + console.log('An error occurred'); +}); + +// Test WL.SimpleDialog +WL.SimpleDialog.show( + 'My Title', 'My Text', [{ + text: 'First Button', + handler: function() { + WL.Logger.debug("First button pressed"); + } + }]); + +// Test WL.TabBar +// iOS +var creditTab = WL.TabBar.addItem("CREDIT", function() { + alert("the CREDIT tab was selected!"); +}, "Visa", { + image:"images/credit.png", + badge: "2" +}); +creditTab.setEnabled(false); +creditTab.updateBadge("3"); +creditTab.updateBadge(null); +// Android +var tabFeeds = WL.TabBar.addItem ('tab2', function() { + console.log('handler'); +}, 'Engadget Feeds', { + image: 'images/feed.png', + imageSelected: 'images/feed.png' +}); +tabFeeds.setEnabled(true); + +// Test WLResourceRequest +var request1 = new WLResourceRequest('/adapters/sampleAdapter/multiplyNumbers', WLResourceRequest.GET); +request1.setQueryParameter('params', [5, 6]); +request1.send().then(function(response: WL.Response) { + console.log('Success ' + response.responseJSON); +}, function(error: WL.ResponseBase) { + console.log('Error ' + error.errorCode + ' ' + error.errorMsg); +}); +var request2 = new WLResourceRequest('url', WLResourceRequest.POST, 30000); +request2.send('content').then(function(response: WL.Response) { + console.log('Success ' + response.responseJSON); +}, function(error: WL.ResponseBase) { + console.log('Error ' + error.errorCode + ' ' + error.errorMsg); +}); +var request3 = new WLResourceRequest('url', 'METHOD', 50000); +request3.send({ data: 'content', more_data: 'more_content' }).then(function(response: WL.Response) { + console.log('Success ' + response.responseJSON); +}, function(error: WL.ResponseBase) { + console.log('Error ' + error.errorCode + ' ' + error.errorMsg); +}); diff --git a/ibm-mobilefirst/ibm-mobilefirst-tests.ts.tscparams b/ibm-mobilefirst/ibm-mobilefirst-tests.ts.tscparams new file mode 100644 index 000000000..4169d3605 --- /dev/null +++ b/ibm-mobilefirst/ibm-mobilefirst-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --target es5 \ No newline at end of file diff --git a/ibm-mobilefirst/ibm-mobilefirst.d.ts b/ibm-mobilefirst/ibm-mobilefirst.d.ts new file mode 100644 index 000000000..e9b0157db --- /dev/null +++ b/ibm-mobilefirst/ibm-mobilefirst.d.ts @@ -0,0 +1,908 @@ +// Type definitions for IBM MobileFirst Platform Foundation +// Project: http://www.ibm.com/software/products/en/mobilefirstfoundation +// Definitions by: Guillermo Ignacio Enriquez Gutierrez +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module WL.Events { + var WORKLIGHT_IS_CONNECTED: string; + var WORKLIGHT_IS_DISCONNECTED: string; +} +declare module WL.AppProperty { + var AIR_ICON_16x16_PATH: string; + var AIR_ICON_128x128_PATH: string; + var DOWNLOAD_APP_LINK: string; + var APP_DISPLAY_NAME: string; + var APP_LOGIN_TYPE: string; + var APP_VERSION: string; + var LATEST_VERSION: string; + var MAIN_FILE_PATH: string; + var SHOW_IN_TASKBAR: string; + var THUMBNAIL_IMAGE_URL: string; +} +declare module WL.Environment { + var ADOBE_AIR: string; + var ANDROID: string; + var EMBEDDED: string; + var IPAD: string; + var IPHONE: string; + var MOBILE_WEB: string; + var PREVIEW: string; + var WINDOWS_PHONE_8: string; + var WINDOWS8: string; +} +declare module WL { + interface IResponse { + invocationContext?: any; + } + interface Headers { + [key: string]: string; + } + class ResponseBase { + invocationContext: any; + headerJSON: {[key: string]: any}; // JSON Object + readyState: number; + request: any; + responseJSON: {[key: string]: any}; // JSON Object + responseText: string; + responseXML: string; + status: number; + statusText: string; + errorCode: number; + errorMsg: string; + } + class FailureResponse extends ResponseBase { + } + class Response extends ResponseBase { + getHeaderNames(): string[]; + getAllHeaders(): Headers; + getHeader(name: any): string; + } + interface Options { + onSuccess?: (response: IResponse) => void; + onFailure?: (response: IResponse) => void; + invocationContext?: any; + } + interface ResponseHandler { + (response: T): void; + } +} +declare module WL.Analytics { + function disable(): void; + function enable(): void; + function log(message: string, name: string): void; + /** + * @deprecated since version 6.2. WL.Analytics.restart is now a NOP. + */ + function restart(): void; + function send(): void; + function state(): void; +} +declare module WL.App { + interface ActionReceiverCallback { + (action: any): void; + } + interface Callback { + (): void; + } + interface OpenURLOptions { + status?: number; + toolbar?: number; + location?: number; + menubar?: number; + directories?: number; + resizable?: number; + scrollbars?: number; + } + interface Data { + } + interface KeepAliveInBackgroundOptions { + tickerText?: string; + contentTitle?: string; + contentTextText?: string; + icon?: string; + notificationId?: number; + className?: string; + } + function addActionReceiver(id: string, callback: ActionReceiverCallback): void; + /** + * @deprecate Deprecated. + */ + function close(): void; + function copyToClipboard(stringToCopy: string, callback?: Callback): void; + function getDeviceLanguage(): string; + function getDeviceLocale(): string; + /** + * TODO: declare exception type. (Exceptions that are thrown by the IBM® Worklight® client runtime framework) + */ + function getErrorMessage(exception: any): string; + function hideSplashScreen(): void; + function openURL(url: string, target?: string, options?: OpenURLOptions): void; + function overrideBackButton(callback: Callback): void; + function removeActionReceiver(id: string): void; + /** + * @deprecated since version 6.0.0 + */ + function resetBackButton(): void; + function sendActionToNative(action: string, data?: Data): void; + function setKeepAliveInBackground(enabled: boolean, options?: KeepAliveInBackgroundOptions): void; + function showSplashScreen(): void; +} +declare module WL.App.BackgroundHandler { + interface Handler { + (): void; + } + function setOnAppEnteringBackground(handler: Handler): void; + var hideView: Handler; + var defaultIOSBehavior: Handler; + /** + * @deprecated since version 6.0.0 + */ + var hideElements: Handler; +} +declare module WL.Badge { + function setNumber(badgeNumber: number): void; +} +declare module WL { + interface BusyIndicatorOptions { + tickerText?: string; + contentTitle?: string; + contentTextText?: string; + icon?: string; + notificationId?: number; + className?: string; + } + class BusyIndicator { + constructor(containerId?: string, options?: BusyIndicator); + hide(): void; + show(): void; + } +} +declare module WL.Client { + interface SharedTokenObject { + key: string; + } + interface ConnectOptions { + onSuccess: (response: ResponseBase) => void; + onFailure: (response: FailureResponse) => void; + timeout?: number; + } + interface ChallengehandlerInvocationData { + adapter: string; + procedure: string; + parameters: any[]; + } + interface ChallengeHandlerAuthenticationOptions { + } + interface ChallengeHandlerSubmitLoginFormOptions { + timeout?: number; + headers?: Object; + parameters?: Object; + } + class AbstractChallengeHandler { + handleChallenge(challenge: any): boolean; + isCustomResponse(transport: any): boolean; + submitAdapterAuthentication(invocationData: ChallengehandlerInvocationData, options: ChallengeHandlerAuthenticationOptions): void; + submitFailure(error: string): void; + submitLoginForm(reqURL: string, options: ChallengeHandlerSubmitLoginFormOptions, submitLoginFormCallback: (transport: any) => void): void; + submitSuccess(): void; + } + interface InitOptions extends Options { + timeout?: number; + /** + * @deprecated since version 6.2. Use WL.Logger.config function with an object specifying the level instead. + */ + enableLogger?: boolean; + messages?: string; + authenticator?: Object; + heartBeatIntervalInSecs?: number; + /** + * @deprecated. If you would like your application to connect to the Worklight Server, use WL.Client.connect(). + */ + connectOnStartup?: boolean; + onConnectionFailure?: (response: WL.FailureResponse) => void; + onUnsupportedVersion?: (response: WL.FailureResponse) => void; + onRequestTimeout?: (response: WL.FailureResponse) => void; + onUnsupportedBrowser?: (response: WL.FailureResponse) => void; + onDisabledCookies?: (response: WL.FailureResponse) => void; + onUserInstanceAccessViolation?: (response: WL.FailureResponse) => void; + onErrorRemoteDisableDenial?: (response: WL.FailureResponse) => void; + /** + * @deprecated since version 5.0.6. Instead, use onErrorRemoteDisableDenial. + */ + onErrorAppVersionAccessDenial?: (response: WL.FailureResponse) => void; + validateArguments?: boolean; + autoHideSplash?: boolean; + onGetCustomDeviceProvisioningProperties: (resumeDeviceProvisioningProcess: (data: any) => void) => void; + } + interface ProcedureInvocationData { + adapter: string; + procedure: string; + parameters?: any[]; + compressResponse?: boolean; + } + interface ProcedureInvocationResult { + isSuccessful: boolean; + errors?: string[]; + } + interface ProcedureResponse extends ResponseBase { + invocationResult?: ProcedureInvocationResult; + parameters?: any[]; + } + interface ProcedureInvocationOptions extends Options { + timeout: number; + onSuccess: (response: ProcedureResponse) => void; + } + function addGlobalHeader(headerName: string, headerValue: string): void; + function checkForDirectUpdate(options: Options): void; + function clearSharedToken(object: SharedTokenObject): JQueryDeferred; + function close(): void; + function connect(options?: ConnectOptions): void; + function createChallengeHandler(realmName: string): AbstractChallengeHandler; + function createProvisioningChallengeHandler(realmName: string): AbstractChallengeHandler; + function createWLChallengeHandler(realName: string): AbstractChallengeHandler; + function deleteUserPref(key: string, options?: Options): void; + /** + * See WL.AppProperty for possible results + */ + function getAppProperty(property: any): any; + /** + * See WL.Environment for possible results + */ + function getEnvironment(): string; + function getLanguage(): string; + function getLastAccessToken(scope?: string): string; + function getLoginName(realmName: string): string; + /** + * @deprecated since version 7.0 + */ + function getRequiredAccessTokenScope(status: number, header: string): string; + function getSharedToken(object: SharedTokenObject): JQueryDeferred; + function getUserInfo(realm: string, key: string): any; + function getUserName(realm: any): string; + function getUserPref(key: any): any; + function hasUserPref(key: any): boolean; + function init(options: InitOptions): void; + function invokeProcedure(invocationData: ProcedureInvocationData, options?: ProcedureInvocationOptions): JQueryDeferred; + /** + * @deprecated since version 4.1.3. Use WL.Device.getNetworkInfo instead. + */ + function isConnected(): void; + function isUserAuthenticated(realm: string): boolean; + /** + * @deprecated since version 7.0. Use WL.Logger instead. + */ + function logActivity(activityType: string): void; + function login(realm: string, options?: Options): void; + function logout(realm: string, options?: Options): void; + function minimize(): void; + /** + * @deprecated since version 7.0 + */ + function obtainAccessToken(scope: string, onSuccess: ResponseHandler, onFailure: ResponseHandler): void; + function purgeEventTransmissionBuffer(): void; + function reloadApp(): void; + function removeGlobalHeader(headerName: string): void; + interface EventTransmissionPolicy { + eventStorageEnabled?: boolean; + interval?: number; + } + function setEventTransmissionPolicy(policy: EventTransmissionPolicy): void; + function setHeartBeatInterval(interval: number): void; + function setSharedToken(token: SharedTokenObject): void; + function setUserPref(key: string, value: string, options?: Options): void; + interface UserPreferences { + [key: string]: string; + } + function setUserPrefs(userPrefsHash: UserPreferences, options?: Options): void; + function transmitEvent(event: any, immediate?: boolean): void; + function updateUserInfo(options: Options): void; +} +declare module WL.Device { + interface AddressPair { + wifiAddress: string; + "3GAddress": string; + } + interface NetworkInfo { + isNetworkConnected?: boolean; + isAirplaneMode?: boolean; + isRoaming?: boolean; + networkConnectionType?: string; + wifiName?: string; + telephonyNetworkType?: string; + carrierName?: string; + ipAddress?: string; + Ipv4Addresses?: AddressPair[]; + Ipv6Addresses?: AddressPair[]; + } + function getNetworkInfo(callback: (networkInfo: NetworkInfo) => void): void; +} +declare module WL.EncryptedCache { + var OK: number; + var ERROR_COULD_NOT_GENERATE_KEY: number; + var ERROR_CREDENTIALS_MISMATCH: number; + var ERROR_EOC_CLOSED: number; + var ERROR_EOC_DELETED: number; + var ERROR_EOC_TO_BE_DELETED: number; + var ERROR_INVALID_PARAMETER: number; + var ERROR_KEY_CREATION_IN_PROGRESS: number; + var ERROR_LOCAL_STORAGE_NOT_SUPPORTED: number; + var ERROR_MIGRATION: number; + var ERROR_NO_EOC: number; + var ERROR_NO_SUCH_KEY: number; + var ERROR_SECURE_RANDOM_GENERATOR_UNAVAILABLE: number; + var ERROR_UNKNOWN: number; + var ERROR_UNSAFE_CREDENTIALS: number; + /** + * See above statuses for possible values + */ + interface StatusHandler { + (status: number): void; + } + function close(successHandler: StatusHandler, failureHandler: StatusHandler): void; + function destroy(successHandler: StatusHandler, failureHandler: StatusHandler): void; + function open(credentials: string, createIfNone: boolean, successHandler: StatusHandler, failureHandler: StatusHandler): void; + function read(key: string, successHandler: StatusHandler, failureHandler: StatusHandler): void; + function remove(key: string, successHandler: StatusHandler, failureHandler: StatusHandler): void; + function write(key: string, value: string, successHandler: StatusHandler, failureHandler: StatusHandler): void; +} +declare module WL.Geo { + interface Coordinate { + latitute: number; + longitude: number; + } + interface Circle extends Coordinate { + radius: number; + } + interface DistanceOptions { + bufferZoneWidth: number; + } + interface InsideOutsideOptions { + /** + * confidenceLevel can be 'low', 'medium', 'high' + */ + confidenceLevel: string; + } + function getDistanceBetweenCoordinates(coordinate1: Coordinate, coordinate2: Coordinate): number; + function getDistanceToCircle(coordinate: Coordinate, circle: Circle, options: DistanceOptions): number; + function getDistanceToPolygon(coordinate: Coordinate, polygon: Coordinate[], options: DistanceOptions): number; + function isInsideCircle(coordinate: Coordinate, circle: Circle, options: InsideOutsideOptions): boolean; + function isInsidePolygon(coordinate: Coordinate, polygon: Coordinate[], options: InsideOutsideOptions): boolean; + function isOutsideCircle(coordinate: Coordinate, circle: Circle, options: InsideOutsideOptions): boolean; + function isOutsidePolygon(coordinate: Coordinate, polygon: Coordinate[], options: InsideOutsideOptions): boolean; +} +declare module WL { + class Item { + setEnabled(isEnable: string): void; + setImagePath(imagePath: string): void; + setTitle(title: string): void; + } +} +declare module WL.JSONStore { + /** + * Changes the password for the internal storage. You must have an initialized collection before calling WL.JSONStore.changePassword. + */ + function changePassword(oldPassword: string, newPassword: string, username: string, options: WL.Options): JQueryDeferred; + /** + * @deprecated since version 5.0.6, it is no longer needed if you use WL.JSONStore.init + */ + function clearPassword(): boolean; + /** + * Locks access to all the collections until WL.JSONStore.init is called. + */ + function closeAll(options?: WL.Options): JQueryDeferred; + /** + * Commit a transaction. + */ + function commitTransaction(): JQueryDeferred; + /** + * Completely wipes data for all users, destroys the internal storage, and clears security artifacts. + * @parameters options is @deprecated + */ + function destroy(username: string, options?: WL.Options): JQueryDeferred; + /** + * @deprecated since version 6.2.0. + */ + function documentify(id: number, data: any): any; + /** + * Returns information about the file that is used to persist data in the store. The following key value pairs are returned: + * name - name of the store + * size - the total size, in bytes, of the store + * isEncrypted - boolean that is true when encrypted and false otherwise. + */ + function fileInfo(): JQueryDeferred; + /** + * Provides an accessor to the collection if the collection exists, otherwise it returns undefined. + */ + function get(collectionName: string): JSONStoreInstance; + /** + * Returns the message that is associated with a JSONStore error code. + */ + function getErrorMessage(errorCode: number): string; + interface InitOptions { + username?: string; + password?: string; + clear?: boolean; + localKeyGen?: boolean; + analytics?: boolean; + } + function init(collections: any, options?: InitOptions): JQueryDeferred; + /** + * @deprecated since version 5.0.6, it is no longer needed if you use WL.JSONStore.init + */ + function initCollection(name: string, searchFields: any, options?: InitOptions): WL.JSONStore.JSONStoreInstance; + /** + * Creates a query for advanced find. See WL.JSONStore.QueryPart for more information. + */ + function QueryPart(): QueryPartObj; + /** + * Roll back a transaction + */ + function rollbackTransaction(): JQueryDeferred; + /** + * Initiates a transaction + */ + function startTransaction(): JQueryDeferred; + /** + * Sets the password that is used to generate keys to encrypt data that is stored locally on the device. + * @deprecated since version 5.0.6, it is no longer needed if you use WL.JSONStore.init + */ + function usePassword(pwd: string): boolean; + interface AddOptions extends WL.Options { + additionalSearchFields?: any; + markDirty?: boolean; + /** + * @deprecated + */ + push?: boolean; + } + interface BasicFindOptions extends WL.Options { + filter?: string[]; + sort?: string[]; + } + interface AdvancedFindOptions extends BasicFindOptions { + limit?: number; + offset?: number; + } + interface FindOptions extends BasicFindOptions { + exact?: boolean; + limit?: number; + offset?: number; + } + interface EraseOptions extends WL.Options { + push?: boolean; + } + interface RefreshOptions extends WL.Options { + push: boolean; + } + interface ChangeOptions extends WL.Options { + addNew?: boolean; + markDirty?: boolean; + replaceCriteria?: string[]; + } + interface RemoveOptions extends WL.Options { + markDirty?: boolean; + /** + * @deprecated + */ + push?: boolean; + exact?: boolean; + } + interface ReplaceOptions extends WL.Options { + markDirty?: boolean; + /** + * @deprecated + */ + push?: boolean; + } + interface StoreOptions extends WL.Options { + additionalSearchFields?: Object; + push?: boolean; + } + class JSONStoreInstance { + add(data: any, options?: AddOptions): JQueryDeferred; + advancedFind(query: any[], options?: AdvancedFindOptions): JQueryDeferred; + change(data: any, options?: ChangeOptions): JQueryDeferred; + clear(options?: WL.Options): JQueryDeferred; + count(query?: any, options?: WL.Options): JQueryDeferred; + countAllDirty(options?: WL.Options): JQueryDeferred; + enhance(name: string, fn: Function): number; + /** + * @deprecated since version 5.0.6, it is no longer needed if you use WL.JSONStore.JSONStoreInstance.remove with {push: false}. + */ + erase(doc: any, options?: EraseOptions): void; + find(query: Object | Object[], options?: FindOptions): JQueryDeferred; + findAll(options?: BasicFindOptions): JQueryDeferred; + findById(options?: WL.Options): JQueryDeferred; + isDirty(doc: any, options?: WL.Options): JQueryDeferred; + /** + * @deprecated since version 6.2.0. + */ + load(options?: WL.Options): JQueryDeferred; + markClean(docs: any[], options?: WL.Options): JQueryDeferred; + /** + * @deprecated since version 6.2.0. + */ + push(options?: any): JQueryDeferred; + /** + * @deprecated since version 5.0.6, it is no longer needed if you use WL.JSONStore.JSONStoreInstance.push. + */ + pushSelected(doc: any, options?: WL.Options): JQueryDeferred; + /** + * @deprecated since version 5.0.6. It is no longer needed if you use WL.JSONStore.JSONStoreInstance.replace with {push: false}. + */ + refresh(doc: any, options?: RefreshOptions): JQueryDeferred; + remove(doc: any, options?: RemoveOptions): JQueryDeferred; + /** + * Deletes all the documents that are stored inside a collection. + */ + removeCollection(options?: WL.Options): JQueryDeferred; + replace(doc: Object | Object[], options?: ReplaceOptions): JQueryDeferred; + /** + * Writes data to a collection. + * @deprecated since version 5.0.6, it is no longer needed if you use WL.JSONStore.JSONStoreInstance.add with {push: false}. + */ + store(data: Object | Object[], options?: StoreOptions): void; + toString(limit?: number, offset?: number): JQueryDeferred; + } + class QueryPartObj { + /** + * Add a between clause to a query for advanced find. + */ + between(searchField: any, value: any): any[]; + /** + * Add an equal to clause to a query for advanced find. + */ + equal(searchField: any, value: any): any[]; + /** + * Add a greater or equal thanclause to a query for advanced find. + */ + greaterOrEqualThan(searchField: any, value: any): any[]; + /** + * Add a greater than clause to a query for advanced find. + */ + greaterThan(searchField: any, value: any): any[]; + /** + * Add an in clause to a query for advanced find. + */ + inside(searchField: any, value: any): any[]; + /** + * Add a left clause to a query for advanced find. + */ + leftLike(searchField: any, value: any): any[]; + /** + * Add a less or equal than clause to a query for advanced find. + */ + lessOrEqualThan(searchField: any, value: any): any[]; + /** + * Add a less than clause to a query for advanced find. + */ + lessThan(searchField: any, value: any): any[]; + /** + * Add a like clause to a query for advanced find. + */ + like(searchField: any, value: any): any[]; + /** + * Add a not between clause to a query for advanced find. + */ + notBetween(searchField: any, value: any): any[]; + /** + * Add a not equal to clause to a query for advanced find. + */ + notEqual(searchField: any, value: any): any[]; + /** + * Add a not in clause to a query for advanced find. + */ + notInside(searchField: any, value: any): any[]; + /** + * Add a not left clause to a query for advanced find. + */ + notLeftLike(searchField: any, value: any): any[]; + /** + * Add a not like clause to a query for advanced find. + */ + notLike(searchField: any, value: any): any[]; + /** + * Add a not right clause to a query for advanced find. + */ + notRightLike(searchField: any, value: any): any[]; + /** + * Add a right clause to a query for advanced find. + */ + rightLike(searchField: any, value: any): any[]; + } +} +declare module WL.LocalStorage { + function getValue(key: string): string; + function setValue(key: string, value: string): void; + function clear(key: string): void; + function clearAll(): void; +} +declare module WL { + var Logger: LoggerObject; + interface LoggerCallback { + (message: string | string[], level: string, package: string): void; + } + interface Tag { + level?: boolean; + tag?: boolean; + } + interface Filter { + [name: string]: string; + } + interface LoggerOptions { + stringify?: boolean; + pretty?: boolean; + stacktrace?: boolean; + callback?: LoggerCallback; + pkg?: string; + tag?: Tag; + /** + * @deprecated since version 6.2. use filters instead. + */ + whitelist?: string[]; + /** + * @deprecated since version 6.2. use filters instead. + */ + blacklist?: string[]; + filters?: Filter; + capture?: boolean; + autoSendLogs?: boolean; + maxFileSize?: number; + level?: string[] | string | number; + } + interface NativeOptions { + maxFileSize?: number; + level?: string; + capture?: boolean; + autoSendLogs?: boolean; + autoUpdateConfig?: boolean; + filters?: Filter; + } + /** + * Artifact to allow chaining of Logger class as: WL.Logger.ctx({pkg: 'something'}).debug('Hello world'); + */ + class LoggerObject { + /** + * Configures the logger globally. + */ + config(options?: LoggerOptions): LoggerObject; + /** + * Creates an instance of a logger with its own context (also called status or state). + */ + create(options?: LoggerOptions): LogInstance; + /** + * Updates the state (also called context or status) of the logger. + */ + ctx(options?: LoggerOptions): WL.LoggerObject; + /** + * Prints arguments to the console. + */ + debug(message: string): void; + /** + * Prints arguments to the console. + */ + error(message: string): void; + /** + * Prints arguments to the console. + */ + fatal(message: string): void; + /** + * Prints arguments to the console. + */ + info(message: string): void; + /** + * Prints arguments to the console. + */ + log(message: string): void; + /** + * Attach additional metadata to the next logger instance call. + */ + metadata(options: any): LoggerObject; + /** + * @deprecated since version 6.2. WL.Logger.on is now a no-op. WL.Logger is always enabled. Use WL.Logger.config with {'level': 'FATAL'} to reduce verbosity. + */ + off(): WL.LoggerObject; + /** + * @deprecated since version 6.2. WL.Logger.on is now a no-op. WL.Logger is always enabled. Use WL.Logger.config with {'level': 'FATAL'} to reduce verbosity. + */ + on(options: any): WL.LoggerObject; + /** + * Send any logs collected up to this point to the IBM® Worklight® server. + */ + send(): JQueryDeferred; + /** + * @deprecated since version 6.2. Use WL.Logger.config instead. Sets options in native application layer (iOS and Android only) + */ + setNativeOptions(options?: NativeOptions): void; + /** + * Shows the status (current configuration) of the logger. + */ + status(): JQueryDeferred; + /** + * Prints arguments to the console. + */ + trace(message: string): void; + /** + * Retrieves and applies any matching configuration profile from the IBM® Worklight® Server. + */ + updateConfigFromServer(): JQueryDeferred; + /** + * Prints arguments to the console. + */ + warn(message: string): void; + } + /** + * Class which defines instances created via: WL.Logger.create({pkg: 'something'}); + * Actual definition is outside of WL namespace. For easier d.ts file compiling it is here + */ + class LogInstance { + debug(message: string): void; + error(message: string): void; + fatal(message: string): void; + info(message: string): void; + trace(message: string): void; + warn(message: string): void; + } +} +declare module WL.NativePage { + function show(className: string, callback: (data: any) => void, data: any): void; +} +declare module WL.SecurityUtils { + interface DecryptOptions { + key: string; + ct: string; + lv: string; + src: string; + v: string; + } + interface EncryptOptions { + key: string; + text: string; + } + interface KeygenOptions { + password: string; + salt: string; + iterations: number; + } + function base64Decode(input: string): JQueryDeferred; + function base64Encode(input: string): JQueryDeferred; + function decrypt(options: DecryptOptions): JQueryDeferred; + function encrypt(options: EncryptOptions): JQueryDeferred; + function keygen(options: KeygenOptions): JQueryDeferred; + function localRandomString(bytes?: number): JQueryDeferred; + function remoteRandomString(bytes?: number): JQueryDeferred; +} +declare module WL.SimpleDialog { + interface Button { + text: string; + handler?: Function; + } + interface Options { + title: string; + text: string; + } + function show(title: string, text: string, buttons: Button[], options?: Options): void; +} + +declare module WL.TabBar { + interface ItemOptions { + image: string; + badge?: string; // for iOS + imageSelected?: string; // for Android + } + function addItem(id: string, callback: Function, title: string, options: ItemOptions): WL.TabBarItem; + function init(): void; + function isVisible(): boolean; + function RemoveAllItems(): void; + function setEnabled(isEnabled: boolean): void; + /** + * @deprecated + */ + function setParentDivId(parentId: string): void; + function setSelectedItem(id: string): void; + function setVisible(isVisible: boolean): void; +} + +declare module WL { + class TabBarItem { + setEnabled(isEnabled: boolean): void; + updateBadge(badge?: string): void; + } +} + +declare module WL.Toast { + function show(): void; +} +declare module WL.Trusteer { + interface AssesmentRisk { + value: number; + additionalData: string; + lastCalculated: number; + name: string; + } + interface AssetmentRisks { + device_key: string; + 'malware.any'?: AssesmentRisk; + 'network.wifi'?: AssesmentRisk; + 'os.rooted'?: AssesmentRisk; + 'os.rooted.native'?: AssesmentRisk; + 'os.rooted.hiders'?: AssesmentRisk; + 'os.ver_up_to_date'?: AssesmentRisk; + 'plat.android.dumpsys'?: AssesmentRisk; + 'plat.android.apprestrict'?: AssesmentRisk; + 'total.risk.generic'?: AssesmentRisk; + 'tas.config_update'?: AssesmentRisk; + } + function getRiskAssessment(onSuccess: ResponseHandler, onFailure: ResponseHandler): AssetmentRisks; +} +declare module WL.UserAuth { + function deleteCertificate(provisioningEntity?: string): JQueryDeferred; +} +declare module WLAuthorizationManager { + /** + * AuthorizationPersistencePolicy possible values + */ + var ALWAYS: string; + var NEVER: string; + interface RequestObject { + setRequestHeader: (header: string, value: string) => void; + } + function addCachedAuthorizationHeader(request: RequestObject): JQueryDeferred; + function getAppIdentity(): JQueryDeferred; + function getAuthorizationScope(responseAuthenticationHeader: string): string; + /** + * TODO: Set Promise types. Should be something like: JQueryDeferred() + */ + function getCachedAuthorizationHeader(): JQueryDeferred; + /** + * TODO: Set Promise types. Should be something like: JQueryDeferred() + */ + function getDeviceIdentity(): JQueryDeferred; + /** + * TODO: Set Promise types. Should be something like: JQueryDeferred() + */ + function getUserIdentity(): JQueryDeferred; + function isAuthorizationRequired(responseStatus: number, responseAuthenticationHeader: string): boolean; + /** + * TODO: Set Promise types. Should be something like: JQueryDeferred() + */ + function obtainAuthorizationHeader(scope: string): JQueryDeferred; + /** + * See WLAuthorizarionManager.NEVER and WLAuthorizarionManager.ALWAYS + */ + function setAuthorizationPersistencePolicy(authorizationPersistencePolicy: string): void; +} + +declare module WL { + var ClientMessages: { [name: string]: string }; +} + +declare class WLResourceRequest { + constructor(url: string, method: string, timeout?: number); + addHeader(name: string, value: string|number|boolean): void; + getHeader(name: string): string; + getHeaderNames(): string[]; + getHeaders(name: string): string[]; + getMethod(): string; + getQueryParameters(): any; // JSON + getTimeout(): number; + getUrl(): string; + send(content?: any): JQueryDeferred; + sendFormParameters(json: Object): JQueryDeferred; + setHeader(name: string, value: string|number|boolean): void; + setHeaders(requestHeaders?: { [name: string]: string|string[] }): void; + setQueryParameter(name: string, value: string|number|boolean|Object): void; + setQueryParameters(parameters?: { [name: string]: string|number|boolean|Object }): void; + setTimeout(requestTimeout: number): void; + + static GET: string; + static POST: string; + static PUT: string; + static DELETE: string; + static HEAD: string; + static OPTIONS: string; + static TRACE: string; + static CONNECT: string; +} diff --git a/invariant/invariant-tests.ts b/invariant/invariant-tests.ts new file mode 100644 index 000000000..06a4e9b4e --- /dev/null +++ b/invariant/invariant-tests.ts @@ -0,0 +1,22 @@ +/// + +// will throw in dev mode (process.env.NODE_ENV !== 'production') +invariant(true); + +// will pass in production (process.env.NODE_ENV === 'production') +invariant(true); + +// will pass in dev mode and production mode +invariant(true, 'Error, error, read all about it'); + +// will throw in dev mode, and production mode +invariant(false, 'Some other error'); + +// will throw in dev mode, and production mode +invariant(0, 'Some other error'); + +// will throw in dev mode, and production mode +invariant('', 'Some other error'); + +// handles extra variables +invariant(true, 'Error, error, read all about it', 37, {}, 'hello'); diff --git a/invariant/invariant.d.ts b/invariant/invariant.d.ts new file mode 100644 index 000000000..6ca967c68 --- /dev/null +++ b/invariant/invariant.d.ts @@ -0,0 +1,17 @@ +// Type definitions for invariant 2.2.0 +// Project: https://github.com/zertosh/invariant +// Definitions by: MichaelBennett +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare let invariant:invariant.InvariantStatic; + +declare module "invariant" { + export = invariant; +} + +declare module invariant { + interface InvariantStatic { + (testValue:any, format?:string, ...extra:any[]):void; + } +} + diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index a767b851b..6cadd0f87 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -125,7 +125,7 @@ declare module ionic { } module gestures { interface IonicGestureService { - on(eventType: string, callback: (e: any)=>any, $element: ng.IAugmentedJQuery, options: any): IonicGesture; + on(eventType: string, callback: (e: any)=>any, $element: angular.IAugmentedJQuery, options: any): IonicGesture; off(gesture: IonicGesture, eventType: string, callback: (e: any)=>any): void; } @@ -167,14 +167,14 @@ declare module ionic { module modal { interface IonicModalService { fromTemplate(templateString: string, options?: IonicModalOptions): IonicModalController; - fromTemplateUrl(templateUrl: string, options?: IonicModalOptions): ng.IPromise; + fromTemplateUrl(templateUrl: string, options?: IonicModalOptions): angular.IPromise; } interface IonicModalController { initialize(options: IonicModalOptions): void; - show(): ng.IPromise; - hide(): ng.IPromise; - remove(): ng.IPromise; + show(): angular.IPromise; + hide(): angular.IPromise; + remove(): angular.IPromise; isShown(): boolean; } @@ -210,7 +210,7 @@ declare module ionic { goBack(backCount?: number): void; clearHistory(): void; - clearCache(): ng.IPromise; + clearCache(): angular.IPromise; nextViewOptions(options: IonicHistoryNextViewOptions): void; } interface IonicHistoryNextViewOptions { @@ -225,20 +225,20 @@ declare module ionic { offHardwareBackButton(callback: Function): void; registerBackButtonAction(callback: Function, priority: number, actionId?: any): Function; on(type: string, callback: Function): Function; - ready(callback?: Function): ng.IPromise; + ready(callback?: Function): angular.IPromise; } } module popover { interface IonicPopoverService { fromTemplate(templateString: string, options: IonicPopoverOptions): IonicPopoverController; - fromTemplateUrl(templateUrl: string, options: IonicPopoverOptions): ng.IPromise; + fromTemplateUrl(templateUrl: string, options: IonicPopoverOptions): angular.IPromise; } interface IonicPopoverController { initialize(options: IonicPopoverOptions): void; - show($event?: any): ng.IPromise; - hide(): ng.IPromise; + show($event?: any): angular.IPromise; + hide(): angular.IPromise; isShown(): boolean; - remove(): ng.IPromise; + remove(): angular.IPromise; } interface IonicPopoverOptions { scope?: any; @@ -255,10 +255,10 @@ declare module ionic { prompt(options: IonicPopupPromptOptions): IonicPopupPromise; } - interface IonicPopupConfirmPromise extends ng.IPromise { + interface IonicPopupConfirmPromise extends angular.IPromise { close(value?: boolean): void; } - interface IonicPopupPromise extends ng.IPromise { + interface IonicPopupPromise extends angular.IPromise { close(value?: any): any; } interface IonicPopupBaseOptions { diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 378c6d293..e9f402380 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1441,6 +1441,7 @@ function test_dialog() { $(".selector").dialog({ buttons: [ { text: "Ok", click: function () { $(this).dialog("close"); } } ] } ); $(".selector").dialog({ closeOnEscape: false }); $(".selector").dialog({ closeText: "hide" }); + $(".selector").dialog({ appendTo: "appendTo" }); $(".selector").dialog({ dialogClass: "alert" }); $(".selector").dialog({ disabled: true }); $(".selector").dialog({ draggable: false }); @@ -1490,7 +1491,8 @@ function test_slider() { value: 123, range: "min", animate: true, - orientation: "vertical" + orientation: "vertical", + highlight: true }); $("#slider-range").slider({ range: true, diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index bd494d496..b3edd5954 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -345,6 +345,7 @@ declare module JQueryUI { buttons?: { [buttonText: string]: (event?: Event) => void } | DialogButtonOptions[]; closeOnEscape?: boolean; closeText?: string; + appendTo?: string; dialogClass?: string; disabled?: boolean; draggable?: boolean; @@ -635,6 +636,7 @@ declare module JQueryUI { step?: number; value?: number; values?: number[]; + highlight?: boolean; } interface SliderUIParams { diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index 5168cdb84..a39438d6b 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kendo UI Professional v2015.3.1111 +// Type definitions for Kendo UI Professional v2016.1.112 // Project: http://www.telerik.com/kendo-ui // Definitions by: Telerik // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -1375,6 +1375,17 @@ declare module kendo.ui { interface GridColumn { editor?(container: JQuery, options: GridColumnEditorOptions): void; } + + interface TreeListEditorOptions { + field?: string; + format?: string; + model?: kendo.data.Model; + values?: any[]; + } + + interface TreeListColumn { + editor?(container: JQuery, options: TreeListEditorOptions): void; + } } declare module kendo.mobile { @@ -1459,712 +1470,6 @@ declare module kendo.drawing.pdf { proxyUrl?: string, callback?: Function): void; } -declare module kendo.drawing { - class Arc extends kendo.drawing.Element { - - - options: ArcOptions; - - - constructor(geometry: kendo.geometry.Arc, options?: ArcOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - geometry(): kendo.geometry.Arc; - geometry(value: kendo.geometry.Arc): void; - fill(color: string, opacity?: number): kendo.drawing.Arc; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface ArcOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface ArcEvent { - sender: Arc; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Circle extends kendo.drawing.Element { - - - options: CircleOptions; - - - constructor(geometry: kendo.geometry.Circle, options?: CircleOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - geometry(): kendo.geometry.Circle; - geometry(value: kendo.geometry.Circle): void; - fill(color: string, opacity?: number): kendo.drawing.Circle; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface CircleOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface CircleEvent { - sender: Circle; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Element extends kendo.Class { - - - options: ElementOptions; - - - constructor(options?: ElementOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - opacity(): number; - opacity(opacity: number): void; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface ElementOptions { - name?: string; - clip?: kendo.drawing.Path; - opacity?: number; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface ElementEvent { - sender: Element; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - interface FillOptions { - - - - color: string; - opacity: number; - - - - - } - - - - class Gradient extends kendo.Class { - - - options: GradientOptions; - - stops: any; - - constructor(options?: GradientOptions); - - - addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; - removeStop(stop: kendo.drawing.GradientStop): void; - - } - - interface GradientOptions { - name?: string; - stops?: any; - } - interface GradientEvent { - sender: Gradient; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class GradientStop extends kendo.Class { - - - options: GradientStopOptions; - - - constructor(options?: GradientStopOptions); - - - - } - - interface GradientStopOptions { - name?: string; - offset?: number; - color?: string; - opacity?: number; - } - interface GradientStopEvent { - sender: GradientStop; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Group extends kendo.drawing.Element { - - - options: GroupOptions; - - children: any; - - constructor(options?: GroupOptions); - - - append(element: kendo.drawing.Element): void; - clear(): void; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - insert(position: number, element: kendo.drawing.Element): void; - opacity(): number; - opacity(opacity: number): void; - remove(element: kendo.drawing.Element): void; - removeAt(index: number): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface GroupOptions { - name?: string; - clip?: kendo.drawing.Path; - opacity?: number; - pdf?: kendo.drawing.PDFOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface GroupEvent { - sender: Group; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Image extends kendo.drawing.Element { - - - options: ImageOptions; - - - constructor(src: string, rect: kendo.geometry.Rect); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - opacity(): number; - opacity(opacity: number): void; - src(): string; - src(value: string): void; - rect(): kendo.geometry.Rect; - rect(value: kendo.geometry.Rect): void; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface ImageOptions { - name?: string; - clip?: kendo.drawing.Path; - opacity?: number; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface ImageEvent { - sender: Image; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Layout extends kendo.drawing.Group { - - - options: LayoutOptions; - - - constructor(rect: kendo.geometry.Rect, options?: LayoutOptions); - - - rect(): kendo.geometry.Rect; - rect(rect: kendo.geometry.Rect): void; - reflow(): void; - - } - - interface LayoutOptions { - name?: string; - alignContent?: string; - alignItems?: string; - justifyContent?: string; - lineSpacing?: number; - spacing?: number; - orientation?: string; - wrap?: boolean; - } - interface LayoutEvent { - sender: Layout; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class LinearGradient extends kendo.drawing.Gradient { - - - options: LinearGradientOptions; - - stops: any; - - constructor(options?: LinearGradientOptions); - - - addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; - end(): kendo.geometry.Point; - end(end: any): void; - end(end: kendo.geometry.Point): void; - start(): kendo.geometry.Point; - start(start: any): void; - start(start: kendo.geometry.Point): void; - removeStop(stop: kendo.drawing.GradientStop): void; - - } - - interface LinearGradientOptions { - name?: string; - stops?: any; - } - interface LinearGradientEvent { - sender: LinearGradient; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class MultiPath extends kendo.drawing.Element { - - - options: MultiPathOptions; - - paths: any; - - constructor(options?: MultiPathOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - close(): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - fill(color: string, opacity?: number): kendo.drawing.MultiPath; - lineTo(x: number, y?: number): kendo.drawing.MultiPath; - lineTo(x: any, y?: number): kendo.drawing.MultiPath; - lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; - moveTo(x: number, y?: number): kendo.drawing.MultiPath; - moveTo(x: any, y?: number): kendo.drawing.MultiPath; - moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface MultiPathOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface MultiPathEvent { - sender: MultiPath; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class OptionsStore extends kendo.Class { - - - options: OptionsStoreOptions; - - observer: any; - - constructor(options?: OptionsStoreOptions); - - - get(field: string): any; - set(field: string, value: any): void; - - } - - interface OptionsStoreOptions { - name?: string; - } - interface OptionsStoreEvent { - sender: OptionsStore; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - interface PDFOptions { - - - - creator: string; - date: Date; - keywords: string; - landscape: boolean; - margin: any; - paperSize: any; - subject: string; - title: string; - - - - - } - - - - class Path extends kendo.drawing.Element { - - - options: PathOptions; - - segments: any; - - constructor(options?: PathOptions); - - static fromPoints(points: any): kendo.drawing.Path; - static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; - static parse(svgPath: string, options?: any): kendo.drawing.Path; - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - close(): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; - fill(color: string, opacity?: number): kendo.drawing.Path; - lineTo(x: number, y?: number): kendo.drawing.Path; - lineTo(x: any, y?: number): kendo.drawing.Path; - lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; - moveTo(x: number, y?: number): kendo.drawing.Path; - moveTo(x: any, y?: number): kendo.drawing.Path; - moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface PathOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface PathEvent { - sender: Path; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class RadialGradient extends kendo.drawing.Gradient { - - - options: RadialGradientOptions; - - stops: any; - - constructor(options?: RadialGradientOptions); - - - addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; - center(): kendo.geometry.Point; - center(center: any): void; - center(center: kendo.geometry.Point): void; - radius(): number; - radius(value: number): void; - removeStop(stop: kendo.drawing.GradientStop): void; - - } - - interface RadialGradientOptions { - name?: string; - center?: any|kendo.geometry.Point; - radius?: number; - stops?: any; - } - interface RadialGradientEvent { - sender: RadialGradient; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Rect extends kendo.drawing.Element { - - - options: RectOptions; - - - constructor(geometry: kendo.geometry.Rect, options?: RectOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - geometry(): kendo.geometry.Rect; - geometry(value: kendo.geometry.Rect): void; - fill(color: string, opacity?: number): kendo.drawing.Rect; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Rect; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface RectOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface RectEvent { - sender: Rect; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Segment extends kendo.Class { - - - options: SegmentOptions; - - - constructor(anchor: kendo.geometry.Point, controlIn: kendo.geometry.Point, controlOut: kendo.geometry.Point); - - - anchor(): kendo.geometry.Point; - anchor(value: kendo.geometry.Point): void; - controlIn(): kendo.geometry.Point; - controlIn(value: kendo.geometry.Point): void; - controlOut(): kendo.geometry.Point; - controlOut(value: kendo.geometry.Point): void; - - } - - interface SegmentOptions { - name?: string; - } - interface SegmentEvent { - sender: Segment; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - interface StrokeOptions { - - - - color: string; - dashType: string; - lineCap: string; - lineJoin: string; - opacity: number; - width: number; - - - - - } - - - - class Surface extends kendo.Observable { - - - options: SurfaceOptions; - - - constructor(options?: SurfaceOptions); - - static create(element: JQuery, options?: any): kendo.drawing.Surface; - static create(element: Element, options?: any): kendo.drawing.Surface; - - clear(): void; - draw(element: kendo.drawing.Element): void; - eventTarget(e: any): kendo.drawing.Element; - resize(force?: boolean): void; - - } - - interface SurfaceOptions { - name?: string; - type?: string; - height?: string; - width?: string; - click?(e: SurfaceClickEvent): void; - mouseenter?(e: SurfaceMouseenterEvent): void; - mouseleave?(e: SurfaceMouseleaveEvent): void; - } - interface SurfaceEvent { - sender: Surface; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - interface SurfaceClickEvent extends SurfaceEvent { - element?: kendo.drawing.Element; - originalEvent?: any; - } - - interface SurfaceMouseenterEvent extends SurfaceEvent { - element?: kendo.drawing.Element; - originalEvent?: any; - } - - interface SurfaceMouseleaveEvent extends SurfaceEvent { - element?: kendo.drawing.Element; - originalEvent?: any; - } - - - class Text extends kendo.drawing.Element { - - - options: TextOptions; - - - constructor(content: string, position: kendo.geometry.Point, options?: TextOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - content(): string; - content(value: string): void; - fill(color: string, opacity?: number): kendo.drawing.Text; - opacity(): number; - opacity(opacity: number): void; - position(): kendo.geometry.Point; - position(value: kendo.geometry.Point): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface TextOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - font?: string; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface TextEvent { - sender: Text; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - -} declare module kendo.geometry { class Arc extends Observable { @@ -2430,6 +1735,721 @@ declare module kendo.geometry { } +} +declare module kendo.drawing { + class Arc extends kendo.drawing.Element { + + + options: ArcOptions; + + + constructor(geometry: kendo.geometry.Arc, options?: ArcOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Arc; + geometry(value: kendo.geometry.Arc): void; + fill(color: string, opacity?: number): kendo.drawing.Arc; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface ArcOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ArcEvent { + sender: Arc; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Circle extends kendo.drawing.Element { + + + options: CircleOptions; + + + constructor(geometry: kendo.geometry.Circle, options?: CircleOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Circle; + geometry(value: kendo.geometry.Circle): void; + fill(color: string, opacity?: number): kendo.drawing.Circle; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface CircleOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface CircleEvent { + sender: Circle; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Element extends kendo.Class { + + + options: ElementOptions; + + + constructor(options?: ElementOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface ElementOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ElementEvent { + sender: Element; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + interface FillOptions { + + + + color?: string; + opacity?: number; + + + + + } + + + + class Gradient extends kendo.Class { + + + options: GradientOptions; + + stops: any; + + constructor(options?: GradientOptions); + + + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + removeStop(stop: kendo.drawing.GradientStop): void; + + } + + interface GradientOptions { + name?: string; + stops?: any; + } + interface GradientEvent { + sender: Gradient; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class GradientStop extends kendo.Class { + + + options: GradientStopOptions; + + + constructor(options?: GradientStopOptions); + + + + } + + interface GradientStopOptions { + name?: string; + offset?: number; + color?: string; + opacity?: number; + } + interface GradientStopEvent { + sender: GradientStop; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Group extends kendo.drawing.Element { + + + options: GroupOptions; + + children: any; + + constructor(options?: GroupOptions); + + + append(element: kendo.drawing.Element): void; + clear(): void; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + insert(position: number, element: kendo.drawing.Element): void; + opacity(): number; + opacity(opacity: number): void; + remove(element: kendo.drawing.Element): void; + removeAt(index: number): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface GroupOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + opacity?: number; + pdf?: kendo.drawing.PDFOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface GroupEvent { + sender: Group; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Image extends kendo.drawing.Element { + + + options: ImageOptions; + + + constructor(src: string, rect: kendo.geometry.Rect); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + src(): string; + src(value: string): void; + rect(): kendo.geometry.Rect; + rect(value: kendo.geometry.Rect): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface ImageOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ImageEvent { + sender: Image; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Layout extends kendo.drawing.Group { + + + options: LayoutOptions; + + + constructor(rect: kendo.geometry.Rect, options?: LayoutOptions); + + + rect(): kendo.geometry.Rect; + rect(rect: kendo.geometry.Rect): void; + reflow(): void; + + } + + interface LayoutOptions { + name?: string; + alignContent?: string; + alignItems?: string; + justifyContent?: string; + lineSpacing?: number; + spacing?: number; + orientation?: string; + wrap?: boolean; + } + interface LayoutEvent { + sender: Layout; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class LinearGradient extends kendo.drawing.Gradient { + + + options: LinearGradientOptions; + + stops: any; + + constructor(options?: LinearGradientOptions); + + + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + end(): kendo.geometry.Point; + end(end: any): void; + end(end: kendo.geometry.Point): void; + start(): kendo.geometry.Point; + start(start: any): void; + start(start: kendo.geometry.Point): void; + removeStop(stop: kendo.drawing.GradientStop): void; + + } + + interface LinearGradientOptions { + name?: string; + stops?: any; + } + interface LinearGradientEvent { + sender: LinearGradient; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class MultiPath extends kendo.drawing.Element { + + + options: MultiPathOptions; + + paths: any; + + constructor(options?: MultiPathOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + fill(color: string, opacity?: number): kendo.drawing.MultiPath; + lineTo(x: number, y?: number): kendo.drawing.MultiPath; + lineTo(x: any, y?: number): kendo.drawing.MultiPath; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + moveTo(x: number, y?: number): kendo.drawing.MultiPath; + moveTo(x: any, y?: number): kendo.drawing.MultiPath; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface MultiPathOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface MultiPathEvent { + sender: MultiPath; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class OptionsStore extends kendo.Class { + + + options: OptionsStoreOptions; + + observer: any; + + constructor(options?: OptionsStoreOptions); + + + get(field: string): any; + set(field: string, value: any): void; + + } + + interface OptionsStoreOptions { + name?: string; + } + interface OptionsStoreEvent { + sender: OptionsStore; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + interface PDFOptions { + + + + creator?: string; + date?: Date; + keywords?: string; + landscape?: boolean; + margin?: any; + paperSize?: any; + subject?: string; + title?: string; + + + + + } + + + + class Path extends kendo.drawing.Element { + + + options: PathOptions; + + segments: any; + + constructor(options?: PathOptions); + + static fromPoints(points: any): kendo.drawing.Path; + static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; + static parse(svgPath: string, options?: any): kendo.drawing.Path; + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; + fill(color: string, opacity?: number): kendo.drawing.Path; + lineTo(x: number, y?: number): kendo.drawing.Path; + lineTo(x: any, y?: number): kendo.drawing.Path; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + moveTo(x: number, y?: number): kendo.drawing.Path; + moveTo(x: any, y?: number): kendo.drawing.Path; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface PathOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface PathEvent { + sender: Path; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class RadialGradient extends kendo.drawing.Gradient { + + + options: RadialGradientOptions; + + stops: any; + + constructor(options?: RadialGradientOptions); + + + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + center(): kendo.geometry.Point; + center(center: any): void; + center(center: kendo.geometry.Point): void; + radius(): number; + radius(value: number): void; + removeStop(stop: kendo.drawing.GradientStop): void; + + } + + interface RadialGradientOptions { + name?: string; + center?: any|kendo.geometry.Point; + radius?: number; + stops?: any; + } + interface RadialGradientEvent { + sender: RadialGradient; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Rect extends kendo.drawing.Element { + + + options: RectOptions; + + + constructor(geometry: kendo.geometry.Rect, options?: RectOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Rect; + geometry(value: kendo.geometry.Rect): void; + fill(color: string, opacity?: number): kendo.drawing.Rect; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Rect; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface RectOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface RectEvent { + sender: Rect; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Segment extends kendo.Class { + + + options: SegmentOptions; + + + constructor(anchor: kendo.geometry.Point, controlIn: kendo.geometry.Point, controlOut: kendo.geometry.Point); + + + anchor(): kendo.geometry.Point; + anchor(value: kendo.geometry.Point): void; + controlIn(): kendo.geometry.Point; + controlIn(value: kendo.geometry.Point): void; + controlOut(): kendo.geometry.Point; + controlOut(value: kendo.geometry.Point): void; + + } + + interface SegmentOptions { + name?: string; + } + interface SegmentEvent { + sender: Segment; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + interface StrokeOptions { + + + + color?: string; + dashType?: string; + lineCap?: string; + lineJoin?: string; + opacity?: number; + width?: number; + + + + + } + + + + class Surface extends kendo.Observable { + + + options: SurfaceOptions; + + + constructor(options?: SurfaceOptions); + + static create(element: JQuery, options?: any): kendo.drawing.Surface; + static create(element: Element, options?: any): kendo.drawing.Surface; + + clear(): void; + draw(element: kendo.drawing.Element): void; + eventTarget(e: any): kendo.drawing.Element; + resize(force?: boolean): void; + + } + + interface SurfaceOptions { + name?: string; + type?: string; + height?: string; + width?: string; + click?(e: SurfaceClickEvent): void; + mouseenter?(e: SurfaceMouseenterEvent): void; + mouseleave?(e: SurfaceMouseleaveEvent): void; + } + interface SurfaceEvent { + sender: Surface; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + interface SurfaceClickEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseenterEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseleaveEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + + class Text extends kendo.drawing.Element { + + + options: TextOptions; + + + constructor(content: string, position: kendo.geometry.Point, options?: TextOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + content(): string; + content(value: string): void; + fill(color: string, opacity?: number): kendo.drawing.Text; + opacity(): number; + opacity(opacity: number): void; + position(): kendo.geometry.Point; + position(value: kendo.geometry.Point): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface TextOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + font?: string; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface TextEvent { + sender: Text; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + } declare module kendo.ui { class AutoComplete extends kendo.ui.Widget { @@ -2627,6 +2647,7 @@ declare module kendo.ui { culture?: string; dates?: any; depth?: string; + disableDates?: any|Function; footer?: string|Function; format?: string; max?: Date; @@ -2905,27 +2926,15 @@ declare module kendo.ui { enable(element: string, enable: boolean): kendo.ui.ContextMenu; enable(element: Element, enable: boolean): kendo.ui.ContextMenu; enable(element: JQuery, enable: boolean): kendo.ui.ContextMenu; - insertAfter(item: string, referenceItem: string): kendo.ui.ContextMenu; - insertAfter(item: string, referenceItem: Element): kendo.ui.ContextMenu; - insertAfter(item: string, referenceItem: JQuery): kendo.ui.ContextMenu; - insertAfter(item: Element, referenceItem: string): kendo.ui.ContextMenu; - insertAfter(item: Element, referenceItem: Element): kendo.ui.ContextMenu; - insertAfter(item: Element, referenceItem: JQuery): kendo.ui.ContextMenu; - insertAfter(item: JQuery, referenceItem: string): kendo.ui.ContextMenu; - insertAfter(item: JQuery, referenceItem: Element): kendo.ui.ContextMenu; - insertAfter(item: JQuery, referenceItem: JQuery): kendo.ui.ContextMenu; - insertBefore(item: string, referenceItem: string): kendo.ui.ContextMenu; - insertBefore(item: string, referenceItem: Element): kendo.ui.ContextMenu; - insertBefore(item: string, referenceItem: JQuery): kendo.ui.ContextMenu; - insertBefore(item: Element, referenceItem: string): kendo.ui.ContextMenu; - insertBefore(item: Element, referenceItem: Element): kendo.ui.ContextMenu; - insertBefore(item: Element, referenceItem: JQuery): kendo.ui.ContextMenu; - insertBefore(item: JQuery, referenceItem: string): kendo.ui.ContextMenu; - insertBefore(item: JQuery, referenceItem: Element): kendo.ui.ContextMenu; - insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.ContextMenu; - open(x: number, y: number): kendo.ui.ContextMenu; - open(x: Element, y: number): kendo.ui.ContextMenu; - open(x: JQuery, y: number): kendo.ui.ContextMenu; + insertAfter(item: any, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: any, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: any, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: any, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: any, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: any, referenceItem: JQuery): kendo.ui.ContextMenu; + open(x: number, y?: number): kendo.ui.ContextMenu; + open(x: Element, y?: number): kendo.ui.ContextMenu; + open(x: JQuery, y?: number): kendo.ui.ContextMenu; remove(element: string): kendo.ui.ContextMenu; remove(element: Element): kendo.ui.ContextMenu; remove(element: JQuery): kendo.ui.ContextMenu; @@ -3065,6 +3074,7 @@ declare module kendo.ui { culture?: string; dates?: any; depth?: string; + disableDates?: any|Function; footer?: string|Function; format?: string; max?: Date; @@ -3154,6 +3164,7 @@ declare module kendo.ui { culture?: string; dates?: any; depth?: string; + disableDates?: any|Function; footer?: string; format?: string; interval?: number; @@ -3207,6 +3218,7 @@ declare module kendo.ui { close(): void; + dataItem(index?: JQuery): any; dataItem(index?: number): any; destroy(): void; focus(): void; @@ -4165,6 +4177,8 @@ declare module kendo.ui { dataSource?: any|any|kendo.data.DataSource; checkAll?: boolean; itemTemplate?: Function; + search?: boolean; + ignoreCase?: boolean; ui?: string|Function; } @@ -4237,6 +4251,8 @@ declare module kendo.ui { interface GridFilterableOperatorsDate { eq?: string; neq?: string; + isnull?: string; + isnotnull?: string; gte?: string; gt?: string; lte?: string; @@ -4246,11 +4262,15 @@ declare module kendo.ui { interface GridFilterableOperatorsEnums { eq?: string; neq?: string; + isnull?: string; + isnotnull?: string; } interface GridFilterableOperatorsNumber { eq?: string; neq?: string; + isnull?: string; + isnotnull?: string; gte?: string; gt?: string; lte?: string; @@ -4260,6 +4280,10 @@ declare module kendo.ui { interface GridFilterableOperatorsString { eq?: string; neq?: string; + isnull?: string; + isnotnull?: string; + isempty?: string; + isnotempty?: string; startswith?: string; contains?: string; doesnotcontain?: string; @@ -4686,24 +4710,12 @@ declare module kendo.ui { enable(element: string, enable: boolean): kendo.ui.Menu; enable(element: Element, enable: boolean): kendo.ui.Menu; enable(element: JQuery, enable: boolean): kendo.ui.Menu; - insertAfter(item: string, referenceItem: string): kendo.ui.Menu; - insertAfter(item: string, referenceItem: Element): kendo.ui.Menu; - insertAfter(item: string, referenceItem: JQuery): kendo.ui.Menu; - insertAfter(item: Element, referenceItem: string): kendo.ui.Menu; - insertAfter(item: Element, referenceItem: Element): kendo.ui.Menu; - insertAfter(item: Element, referenceItem: JQuery): kendo.ui.Menu; - insertAfter(item: JQuery, referenceItem: string): kendo.ui.Menu; - insertAfter(item: JQuery, referenceItem: Element): kendo.ui.Menu; - insertAfter(item: JQuery, referenceItem: JQuery): kendo.ui.Menu; - insertBefore(item: string, referenceItem: string): kendo.ui.Menu; - insertBefore(item: string, referenceItem: Element): kendo.ui.Menu; - insertBefore(item: string, referenceItem: JQuery): kendo.ui.Menu; - insertBefore(item: Element, referenceItem: string): kendo.ui.Menu; - insertBefore(item: Element, referenceItem: Element): kendo.ui.Menu; - insertBefore(item: Element, referenceItem: JQuery): kendo.ui.Menu; - insertBefore(item: JQuery, referenceItem: string): kendo.ui.Menu; - insertBefore(item: JQuery, referenceItem: Element): kendo.ui.Menu; - insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.Menu; + insertAfter(item: any, referenceItem: string): kendo.ui.Menu; + insertAfter(item: any, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: any, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: any, referenceItem: string): kendo.ui.Menu; + insertBefore(item: any, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: any, referenceItem: JQuery): kendo.ui.Menu; open(element: string): kendo.ui.Menu; open(element: Element): kendo.ui.Menu; open(element: JQuery): kendo.ui.Menu; @@ -5631,11 +5643,11 @@ declare module kendo.ui { } interface RangeSliderChangeEvent extends RangeSliderEvent { - value?: number; + value?: any; } interface RangeSliderSlideEvent extends RangeSliderEvent { - value?: number; + value?: any; } @@ -6363,7 +6375,10 @@ declare module kendo.ui { activeSheet(): kendo.spreadsheet.Sheet; activeSheet(sheet?: kendo.spreadsheet.Sheet): void; sheets(): any; + fromFile(blob: Blob): JQueryPromise; + fromFile(blob: File): JQueryPromise; saveAsExcel(): void; + saveAsPDF(): JQueryPromise; sheetByName(name: string): kendo.spreadsheet.Sheet; sheetIndex(sheet: kendo.spreadsheet.Sheet): number; sheetByIndex(index: number): kendo.spreadsheet.Sheet; @@ -6372,7 +6387,7 @@ declare module kendo.ui { removeSheet(sheet: kendo.spreadsheet.Sheet): void; renameSheet(sheet: kendo.spreadsheet.Sheet, newSheetName: string): kendo.spreadsheet.Sheet; toJSON(): any; - fromJSON(options: any): void; + fromJSON(data: any): void; } @@ -6382,6 +6397,34 @@ declare module kendo.ui { proxyURL?: string; } + interface SpreadsheetPdfMargin { + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; + } + + interface SpreadsheetPdf { + area?: string; + author?: string; + creator?: string; + date?: Date; + fileName?: string; + fitWidth?: boolean; + forceProxy?: boolean; + guidelines?: boolean; + hCenter?: boolean; + keywords?: string; + landscape?: boolean; + margin?: SpreadsheetPdfMargin; + paperSize?: string|any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + vCenter?: boolean; + } + interface SpreadsheetSheetColumn { index?: number; width?: number; @@ -6428,11 +6471,12 @@ declare module kendo.ui { } interface SpreadsheetSheetRowCellValidation { + type?: string; comparerType?: string; dataType?: string; from?: string; to?: string; - allowNulls?: string; + allowNulls?: boolean; messageTemplate?: string; titleTemplate?: string; } @@ -6448,6 +6492,7 @@ declare module kendo.ui { fontSize?: number; italic?: boolean; bold?: boolean; + enable?: boolean; format?: string; formula?: string; index?: number; @@ -6497,6 +6542,7 @@ declare module kendo.ui { headerHeight?: number; headerWidth?: number; dataSource?: kendo.data.DataSource; + data?: any; } interface SpreadsheetOptions { @@ -6507,12 +6553,16 @@ declare module kendo.ui { headerHeight?: number; headerWidth?: number; excel?: SpreadsheetExcel; + pdf?: SpreadsheetPdf; rowHeight?: number; rows?: number; sheets?: SpreadsheetSheet[]; + sheetsbar?: boolean; toolbar?: boolean; render?(e: SpreadsheetRenderEvent): void; excelExport?(e: SpreadsheetExcelExportEvent): void; + excelImport?(e: SpreadsheetExcelImportEvent): void; + pdfExport?(e: SpreadsheetPdfExportEvent): void; } interface SpreadsheetEvent { sender: Spreadsheet; @@ -6528,6 +6578,15 @@ declare module kendo.ui { workbook?: kendo.ooxml.Workbook; } + interface SpreadsheetExcelImportEvent extends SpreadsheetEvent { + file?: Blob|File; + progress?: JQueryPromise; + } + + interface SpreadsheetPdfExportEvent extends SpreadsheetEvent { + promise?: JQueryPromise; + } + class TabStrip extends kendo.ui.Widget { @@ -6535,6 +6594,7 @@ declare module kendo.ui { options: TabStripOptions; + dataSource: kendo.data.DataSource; tabGroup: JQuery; element: JQuery; @@ -6581,12 +6641,14 @@ declare module kendo.ui { reload(element: JQuery): kendo.ui.TabStrip; remove(element: string): kendo.ui.TabStrip; remove(element: number): kendo.ui.TabStrip; + remove(element: JQuery): kendo.ui.TabStrip; select(): JQuery; select(element: string): void; select(element: Element): void; select(element: JQuery): void; select(element: number): void; - setDataSource(): void; + setDataSource(dataSource: any): void; + setDataSource(dataSource: kendo.data.DataSource): void; } @@ -6617,6 +6679,7 @@ declare module kendo.ui { dataContentField?: string; dataContentUrlField?: string; dataImageUrlField?: string; + dataSource?: any|any|kendo.data.DataSource; dataSpriteCssClass?: string; dataTextField?: string; dataUrlField?: string; @@ -7739,6 +7802,7 @@ declare module kendo.ui { } interface ValidatorValidateEvent extends ValidatorEvent { + valid?: boolean; } @@ -7952,6 +8016,7 @@ declare module kendo.dataviz.ui { options: ChartOptions; dataSource: kendo.data.DataSource; + surface: kendo.drawing.Surface; element: JQuery; wrapper: JQuery; @@ -14387,6 +14452,214 @@ declare module kendo.dataviz.ui { } +} +declare module kendo.dataviz.map { + class BingLayer extends kendo.dataviz.map.TileLayer { + + + options: BingLayerOptions; + + map: kendo.dataviz.ui.Map; + + constructor(map: kendo.dataviz.ui.Map, options?: BingLayerOptions); + + + show(): void; + hide(): void; + imagerySet(): void; + + } + + interface BingLayerOptions { + name?: string; + baseUrl?: string; + imagerySet?: string; + } + interface BingLayerEvent { + sender: BingLayer; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Extent extends kendo.Class { + + + options: ExtentOptions; + + nw: kendo.dataviz.map.Location; + se: kendo.dataviz.map.Location; + + constructor(nw: kendo.dataviz.map.Location, se: kendo.dataviz.map.Location); + + static create(a: kendo.dataviz.map.Location, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; + static create(a: kendo.dataviz.map.Location, b?: any): kendo.dataviz.map.Extent; + static create(a: any, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; + static create(a: any, b?: any): kendo.dataviz.map.Extent; + + contains(location: kendo.dataviz.map.Location): boolean; + containsAny(locations: any): boolean; + center(): kendo.dataviz.map.Location; + include(location: kendo.dataviz.map.Location): void; + includeAll(locations: any): void; + edges(): any; + toArray(): any; + overlaps(extent: kendo.dataviz.map.Extent): boolean; + + } + + interface ExtentOptions { + name?: string; + } + interface ExtentEvent { + sender: Extent; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Layer extends kendo.Class { + + + options: LayerOptions; + + map: kendo.dataviz.ui.Map; + + constructor(map: kendo.dataviz.ui.Map, options?: LayerOptions); + + + show(): void; + hide(): void; + + } + + interface LayerOptions { + name?: string; + } + interface LayerEvent { + sender: Layer; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Location extends kendo.Class { + + + options: LocationOptions; + + lat: number; + lng: number; + + constructor(lat: number, lng: number); + + static create(lat: number, lng?: number): kendo.dataviz.map.Location; + static create(lat: any, lng?: number): kendo.dataviz.map.Location; + static create(lat: kendo.dataviz.map.Location, lng?: number): kendo.dataviz.map.Location; + static fromLngLat(lnglat: any): kendo.dataviz.map.Location; + static fromLatLng(lnglat: any): kendo.dataviz.map.Location; + + clone(): kendo.dataviz.map.Location; + destination(destination: kendo.dataviz.map.Location, bearing: number): number; + distanceTo(distance: number, bearing: number): kendo.dataviz.map.Location; + equals(location: kendo.dataviz.map.Location): boolean; + round(digits: number): kendo.dataviz.map.Location; + toArray(): any; + toString(): string; + wrap(): kendo.dataviz.map.Location; + + } + + interface LocationOptions { + name?: string; + } + interface LocationEvent { + sender: Location; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class MarkerLayer extends kendo.dataviz.map.Layer { + + + options: MarkerLayerOptions; + + map: kendo.dataviz.ui.Map; + + constructor(map: kendo.dataviz.ui.Map, options?: MarkerLayerOptions); + + + show(): void; + hide(): void; + setDataSource(): void; + + } + + interface MarkerLayerOptions { + name?: string; + } + interface MarkerLayerEvent { + sender: MarkerLayer; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class ShapeLayer extends kendo.dataviz.map.Layer { + + + options: ShapeLayerOptions; + + map: kendo.dataviz.ui.Map; + + constructor(map: kendo.dataviz.ui.Map, options?: ShapeLayerOptions); + + + show(): void; + hide(): void; + setDataSource(): void; + + } + + interface ShapeLayerOptions { + name?: string; + } + interface ShapeLayerEvent { + sender: ShapeLayer; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class TileLayer extends kendo.dataviz.map.Layer { + + + options: TileLayerOptions; + + map: kendo.dataviz.ui.Map; + + constructor(map: kendo.dataviz.ui.Map, options?: TileLayerOptions); + + + show(): void; + hide(): void; + + } + + interface TileLayerOptions { + name?: string; + urlTemplate?: string; + subdomains?: any; + tileSize?: number; + } + interface TileLayerEvent { + sender: TileLayer; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + } declare module kendo.dataviz { class ChartAxis extends Observable { @@ -14749,6 +15022,101 @@ declare module kendo.dataviz.diagram { } + class Path extends Observable { + + + options: PathOptions; + + + constructor(options?: PathOptions); + + + data(): string; + data(path: string): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface PathEndCapFill { + color?: string; + opacity?: number; + } + + interface PathEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface PathEndCap { + fill?: PathEndCapFill; + stroke?: PathEndCapStroke; + type?: string; + } + + interface PathFillGradientStop { + offset?: number; + color?: string; + opacity?: number; + } + + interface PathFillGradient { + type?: string; + center?: any; + radius?: number; + start?: any; + end?: any; + stops?: PathFillGradientStop[]; + } + + interface PathFill { + color?: string; + opacity?: number; + gradient?: PathFillGradient; + } + + interface PathStartCapFill { + color?: string; + opacity?: number; + } + + interface PathStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface PathStartCap { + fill?: PathStartCapFill; + stroke?: PathStartCapStroke; + type?: string; + } + + interface PathStroke { + color?: string; + width?: number; + } + + interface PathOptions { + name?: string; + data?: string; + endCap?: PathEndCap; + fill?: PathFill; + height?: number; + startCap?: PathStartCap; + stroke?: PathStroke; + width?: number; + x?: number; + y?: number; + } + interface PathEvent { + sender: Path; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + class Point extends Observable { @@ -14773,6 +15141,96 @@ declare module kendo.dataviz.diagram { } + class Polyline extends Observable { + + + options: PolylineOptions; + + + constructor(options?: PolylineOptions); + + + points(): any; + points(points: any): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface PolylineEndCapFill { + color?: string; + opacity?: number; + } + + interface PolylineEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface PolylineEndCap { + fill?: PolylineEndCapFill; + stroke?: PolylineEndCapStroke; + type?: string; + } + + interface PolylineFillGradientStop { + offset?: number; + color?: string; + opacity?: number; + } + + interface PolylineFillGradient { + type?: string; + center?: any; + radius?: number; + start?: any; + end?: any; + stops?: PolylineFillGradientStop[]; + } + + interface PolylineFill { + color?: string; + opacity?: number; + gradient?: PolylineFillGradient; + } + + interface PolylineStartCapFill { + color?: string; + opacity?: number; + } + + interface PolylineStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface PolylineStartCap { + fill?: PolylineStartCapFill; + stroke?: PolylineStartCapStroke; + type?: string; + } + + interface PolylineStroke { + color?: string; + width?: number; + } + + interface PolylineOptions { + name?: string; + endCap?: PolylineEndCap; + fill?: PolylineFill; + startCap?: PolylineStartCap; + stroke?: PolylineStroke; + } + interface PolylineEvent { + sender: Polyline; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + class Rect extends Observable { @@ -15071,6 +15529,8 @@ declare module kendo { function parseFloat(value: string, culture?: string): number; function parseInt(value: string, culture?: string): number; function parseColor(color: string, noerror: boolean): kendo.Color; + function proxyModelSetters(): void; + function proxyModelSetters(data: kendo.data.Model): void; function resize(element: string, force: boolean): void; function resize(element: JQuery, force: boolean): void; function resize(element: Element, force: boolean): void; @@ -15140,6 +15600,10 @@ declare module kendo.spreadsheet { + background(): string; + background(value?: string): void; + bold(): boolean; + bold(value?: boolean): void; borderBottom(): any; borderBottom(value?: any): void; borderLeft(): any; @@ -15148,11 +15612,21 @@ declare module kendo.spreadsheet { borderRight(value?: any): void; borderTop(): any; borderTop(value?: any): void; + color(): string; + color(value?: string): void; clear(options?: any): void; clearFilter(indices: any): void; clearFilter(indices: number): void; + enable(): boolean; + enable(value?: boolean): void; + fillFrom(srcRange: Range, direction?: number): void; + fillFrom(srcRange: string, direction?: number): void; filter(filter: boolean): void; filter(filter: any): void; + fontFamily(): string; + fontFamily(value?: string): void; + fontSize(): number; + fontSize(value?: number): void; format(): string; format(format?: string): void; formula(): string; @@ -15164,10 +15638,14 @@ declare module kendo.spreadsheet { input(value?: Date): void; isSortable(): boolean; isFilterable(): boolean; + italic(): boolean; + italic(value?: boolean): void; merge(): void; select(): void; sort(sort: number): void; sort(sort: any): void; + textAlign(): string; + textAlign(value?: string): void; unmerge(): void; values(values: any): void; validation(): any; @@ -15176,6 +15654,8 @@ declare module kendo.spreadsheet { value(value?: string): void; value(value?: number): void; value(value?: Date): void; + verticalAlign(): string; + verticalAlign(value?: string): void; wrap(): boolean; wrap(value?: boolean): void; @@ -15281,158 +15761,6 @@ declare module kendo.spreadsheet { } -} -declare module kendo.dataviz.map { - class Extent extends kendo.Class { - - - options: ExtentOptions; - - nw: kendo.dataviz.map.Location; - se: kendo.dataviz.map.Location; - - constructor(nw: kendo.dataviz.map.Location, se: kendo.dataviz.map.Location); - - static create(a: kendo.dataviz.map.Location, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; - static create(a: kendo.dataviz.map.Location, b?: any): kendo.dataviz.map.Extent; - static create(a: any, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; - static create(a: any, b?: any): kendo.dataviz.map.Extent; - - contains(location: kendo.dataviz.map.Location): boolean; - containsAny(locations: any): boolean; - center(): kendo.dataviz.map.Location; - include(location: kendo.dataviz.map.Location): void; - includeAll(locations: any): void; - edges(): any; - toArray(): any; - overlaps(extent: kendo.dataviz.map.Extent): boolean; - - } - - interface ExtentOptions { - name?: string; - } - interface ExtentEvent { - sender: Extent; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Layer extends kendo.Class { - - - options: LayerOptions; - - map: kendo.dataviz.ui.Map; - - constructor(map: kendo.dataviz.ui.Map, options?: LayerOptions); - - - show(): void; - hide(): void; - - } - - interface LayerOptions { - name?: string; - } - interface LayerEvent { - sender: Layer; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Location extends kendo.Class { - - - options: LocationOptions; - - lat: number; - lng: number; - - constructor(lat: number, lng: number); - - static create(lat: number, lng?: number): kendo.dataviz.map.Location; - static create(lat: any, lng?: number): kendo.dataviz.map.Location; - static create(lat: kendo.dataviz.map.Location, lng?: number): kendo.dataviz.map.Location; - static fromLngLat(lnglat: any): kendo.dataviz.map.Location; - static fromLatLng(lnglat: any): kendo.dataviz.map.Location; - - clone(): kendo.dataviz.map.Location; - destination(destination: kendo.dataviz.map.Location): number; - distanceTo(distance: number, bearing: number): kendo.dataviz.map.Location; - equals(location: kendo.dataviz.map.Location): boolean; - round(digits: number): kendo.dataviz.map.Location; - toArray(): any; - toString(): string; - wrap(): kendo.dataviz.map.Location; - - } - - interface LocationOptions { - name?: string; - } - interface LocationEvent { - sender: Location; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class MarkerLayer extends kendo.dataviz.map.Layer { - - - options: MarkerLayerOptions; - - map: kendo.dataviz.ui.Map; - - constructor(map: kendo.dataviz.ui.Map, options?: MarkerLayerOptions); - - - show(): void; - hide(): void; - setDataSource(): void; - - } - - interface MarkerLayerOptions { - name?: string; - } - interface MarkerLayerEvent { - sender: MarkerLayer; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class ShapeLayer extends kendo.dataviz.map.Layer { - - - options: ShapeLayerOptions; - - map: kendo.dataviz.ui.Map; - - constructor(map: kendo.dataviz.ui.Map, options?: ShapeLayerOptions); - - - show(): void; - hide(): void; - setDataSource(): void; - - } - - interface ShapeLayerOptions { - name?: string; - } - interface ShapeLayerEvent { - sender: ShapeLayer; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - } declare module kendo.mobile.ui { class ActionSheet extends kendo.mobile.ui.Widget { @@ -15906,7 +16234,7 @@ declare module kendo.mobile.ui { close(): void; destroy(): void; - open(target: JQuery): void; + open(target?: JQuery): void; } @@ -16444,8 +16772,32 @@ declare module kendo.ooxml { rowSplit?: number; } + interface WorkbookSheetRowCellBorderBottom { + color?: string; + size?: string; + } + + interface WorkbookSheetRowCellBorderLeft { + color?: string; + size?: string; + } + + interface WorkbookSheetRowCellBorderRight { + color?: string; + size?: string; + } + + interface WorkbookSheetRowCellBorderTop { + color?: string; + size?: string; + } + interface WorkbookSheetRowCell { background?: string; + borderBottom?: WorkbookSheetRowCellBorderBottom; + borderLeft?: WorkbookSheetRowCellBorderLeft; + borderTop?: WorkbookSheetRowCellBorderTop; + borderRight?: WorkbookSheetRowCellBorderRight; bold?: boolean; color?: string; colSpan?: number; @@ -16497,712 +16849,6 @@ declare module kendo.ooxml { } -declare module kendo.dataviz.drawing { - class Arc extends kendo.drawing.Element { - - - options: ArcOptions; - - - constructor(geometry: kendo.geometry.Arc, options?: ArcOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - geometry(): kendo.geometry.Arc; - geometry(value: kendo.geometry.Arc): void; - fill(color: string, opacity?: number): kendo.drawing.Arc; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface ArcOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface ArcEvent { - sender: Arc; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Circle extends kendo.drawing.Element { - - - options: CircleOptions; - - - constructor(geometry: kendo.geometry.Circle, options?: CircleOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - geometry(): kendo.geometry.Circle; - geometry(value: kendo.geometry.Circle): void; - fill(color: string, opacity?: number): kendo.drawing.Circle; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface CircleOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface CircleEvent { - sender: Circle; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Element extends kendo.Class { - - - options: ElementOptions; - - - constructor(options?: ElementOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - opacity(): number; - opacity(opacity: number): void; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface ElementOptions { - name?: string; - clip?: kendo.drawing.Path; - opacity?: number; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface ElementEvent { - sender: Element; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - interface FillOptions { - - - - color: string; - opacity: number; - - - - - } - - - - class Gradient extends kendo.Class { - - - options: GradientOptions; - - stops: any; - - constructor(options?: GradientOptions); - - - addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; - removeStop(stop: kendo.drawing.GradientStop): void; - - } - - interface GradientOptions { - name?: string; - stops?: any; - } - interface GradientEvent { - sender: Gradient; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class GradientStop extends kendo.Class { - - - options: GradientStopOptions; - - - constructor(options?: GradientStopOptions); - - - - } - - interface GradientStopOptions { - name?: string; - offset?: number; - color?: string; - opacity?: number; - } - interface GradientStopEvent { - sender: GradientStop; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Group extends kendo.drawing.Element { - - - options: GroupOptions; - - children: any; - - constructor(options?: GroupOptions); - - - append(element: kendo.drawing.Element): void; - clear(): void; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - insert(position: number, element: kendo.drawing.Element): void; - opacity(): number; - opacity(opacity: number): void; - remove(element: kendo.drawing.Element): void; - removeAt(index: number): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface GroupOptions { - name?: string; - clip?: kendo.drawing.Path; - opacity?: number; - pdf?: kendo.drawing.PDFOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface GroupEvent { - sender: Group; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Image extends kendo.drawing.Element { - - - options: ImageOptions; - - - constructor(src: string, rect: kendo.geometry.Rect); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - opacity(): number; - opacity(opacity: number): void; - src(): string; - src(value: string): void; - rect(): kendo.geometry.Rect; - rect(value: kendo.geometry.Rect): void; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface ImageOptions { - name?: string; - clip?: kendo.drawing.Path; - opacity?: number; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface ImageEvent { - sender: Image; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Layout extends kendo.drawing.Group { - - - options: LayoutOptions; - - - constructor(rect: kendo.geometry.Rect, options?: LayoutOptions); - - - rect(): kendo.geometry.Rect; - rect(rect: kendo.geometry.Rect): void; - reflow(): void; - - } - - interface LayoutOptions { - name?: string; - alignContent?: string; - alignItems?: string; - justifyContent?: string; - lineSpacing?: number; - spacing?: number; - orientation?: string; - wrap?: boolean; - } - interface LayoutEvent { - sender: Layout; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class LinearGradient extends kendo.drawing.Gradient { - - - options: LinearGradientOptions; - - stops: any; - - constructor(options?: LinearGradientOptions); - - - addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; - end(): kendo.geometry.Point; - end(end: any): void; - end(end: kendo.geometry.Point): void; - start(): kendo.geometry.Point; - start(start: any): void; - start(start: kendo.geometry.Point): void; - removeStop(stop: kendo.drawing.GradientStop): void; - - } - - interface LinearGradientOptions { - name?: string; - stops?: any; - } - interface LinearGradientEvent { - sender: LinearGradient; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class MultiPath extends kendo.drawing.Element { - - - options: MultiPathOptions; - - paths: any; - - constructor(options?: MultiPathOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - close(): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; - fill(color: string, opacity?: number): kendo.drawing.MultiPath; - lineTo(x: number, y?: number): kendo.drawing.MultiPath; - lineTo(x: any, y?: number): kendo.drawing.MultiPath; - lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; - moveTo(x: number, y?: number): kendo.drawing.MultiPath; - moveTo(x: any, y?: number): kendo.drawing.MultiPath; - moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface MultiPathOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface MultiPathEvent { - sender: MultiPath; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class OptionsStore extends kendo.Class { - - - options: OptionsStoreOptions; - - observer: any; - - constructor(options?: OptionsStoreOptions); - - - get(field: string): any; - set(field: string, value: any): void; - - } - - interface OptionsStoreOptions { - name?: string; - } - interface OptionsStoreEvent { - sender: OptionsStore; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - interface PDFOptions { - - - - creator: string; - date: Date; - keywords: string; - landscape: boolean; - margin: any; - paperSize: any; - subject: string; - title: string; - - - - - } - - - - class Path extends kendo.drawing.Element { - - - options: PathOptions; - - segments: any; - - constructor(options?: PathOptions); - - static fromPoints(points: any): kendo.drawing.Path; - static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; - static parse(svgPath: string, options?: any): kendo.drawing.Path; - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - close(): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; - curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; - fill(color: string, opacity?: number): kendo.drawing.Path; - lineTo(x: number, y?: number): kendo.drawing.Path; - lineTo(x: any, y?: number): kendo.drawing.Path; - lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; - moveTo(x: number, y?: number): kendo.drawing.Path; - moveTo(x: any, y?: number): kendo.drawing.Path; - moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface PathOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface PathEvent { - sender: Path; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class RadialGradient extends kendo.drawing.Gradient { - - - options: RadialGradientOptions; - - stops: any; - - constructor(options?: RadialGradientOptions); - - - addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; - center(): kendo.geometry.Point; - center(center: any): void; - center(center: kendo.geometry.Point): void; - radius(): number; - radius(value: number): void; - removeStop(stop: kendo.drawing.GradientStop): void; - - } - - interface RadialGradientOptions { - name?: string; - center?: any|kendo.geometry.Point; - radius?: number; - stops?: any; - } - interface RadialGradientEvent { - sender: RadialGradient; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Rect extends kendo.drawing.Element { - - - options: RectOptions; - - - constructor(geometry: kendo.geometry.Rect, options?: RectOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - geometry(): kendo.geometry.Rect; - geometry(value: kendo.geometry.Rect): void; - fill(color: string, opacity?: number): kendo.drawing.Rect; - opacity(): number; - opacity(opacity: number): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Rect; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface RectOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface RectEvent { - sender: Rect; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - class Segment extends kendo.Class { - - - options: SegmentOptions; - - - constructor(anchor: kendo.geometry.Point, controlIn: kendo.geometry.Point, controlOut: kendo.geometry.Point); - - - anchor(): kendo.geometry.Point; - anchor(value: kendo.geometry.Point): void; - controlIn(): kendo.geometry.Point; - controlIn(value: kendo.geometry.Point): void; - controlOut(): kendo.geometry.Point; - controlOut(value: kendo.geometry.Point): void; - - } - - interface SegmentOptions { - name?: string; - } - interface SegmentEvent { - sender: Segment; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - - interface StrokeOptions { - - - - color: string; - dashType: string; - lineCap: string; - lineJoin: string; - opacity: number; - width: number; - - - - - } - - - - class Surface extends kendo.Observable { - - - options: SurfaceOptions; - - - constructor(options?: SurfaceOptions); - - static create(element: JQuery, options?: any): kendo.drawing.Surface; - static create(element: Element, options?: any): kendo.drawing.Surface; - - clear(): void; - draw(element: kendo.drawing.Element): void; - eventTarget(e: any): kendo.drawing.Element; - resize(force?: boolean): void; - - } - - interface SurfaceOptions { - name?: string; - type?: string; - height?: string; - width?: string; - click?(e: SurfaceClickEvent): void; - mouseenter?(e: SurfaceMouseenterEvent): void; - mouseleave?(e: SurfaceMouseleaveEvent): void; - } - interface SurfaceEvent { - sender: Surface; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - interface SurfaceClickEvent extends SurfaceEvent { - element?: kendo.drawing.Element; - originalEvent?: any; - } - - interface SurfaceMouseenterEvent extends SurfaceEvent { - element?: kendo.drawing.Element; - originalEvent?: any; - } - - interface SurfaceMouseleaveEvent extends SurfaceEvent { - element?: kendo.drawing.Element; - originalEvent?: any; - } - - - class Text extends kendo.drawing.Element { - - - options: TextOptions; - - - constructor(content: string, position: kendo.geometry.Point, options?: TextOptions); - - - bbox(): kendo.geometry.Rect; - clip(): kendo.drawing.Path; - clip(clip: kendo.drawing.Path): void; - clippedBBox(): kendo.geometry.Rect; - content(): string; - content(value: string): void; - fill(color: string, opacity?: number): kendo.drawing.Text; - opacity(): number; - opacity(opacity: number): void; - position(): kendo.geometry.Point; - position(value: kendo.geometry.Point): void; - stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; - transform(): kendo.geometry.Transformation; - transform(transform: kendo.geometry.Transformation): void; - visible(): boolean; - visible(visible: boolean): void; - - } - - interface TextOptions { - name?: string; - clip?: kendo.drawing.Path; - fill?: kendo.drawing.FillOptions; - font?: string; - opacity?: number; - stroke?: kendo.drawing.StrokeOptions; - transform?: kendo.geometry.Transformation; - visible?: boolean; - } - interface TextEvent { - sender: Text; - preventDefault: Function; - isDefaultPrevented(): boolean; - } - - -} declare module kendo.dataviz.geometry { class Arc extends Observable { @@ -17468,6 +17114,721 @@ declare module kendo.dataviz.geometry { } +} +declare module kendo.dataviz.drawing { + class Arc extends kendo.drawing.Element { + + + options: ArcOptions; + + + constructor(geometry: kendo.geometry.Arc, options?: ArcOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Arc; + geometry(value: kendo.geometry.Arc): void; + fill(color: string, opacity?: number): kendo.drawing.Arc; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface ArcOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ArcEvent { + sender: Arc; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Circle extends kendo.drawing.Element { + + + options: CircleOptions; + + + constructor(geometry: kendo.geometry.Circle, options?: CircleOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Circle; + geometry(value: kendo.geometry.Circle): void; + fill(color: string, opacity?: number): kendo.drawing.Circle; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface CircleOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface CircleEvent { + sender: Circle; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Element extends kendo.Class { + + + options: ElementOptions; + + + constructor(options?: ElementOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface ElementOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ElementEvent { + sender: Element; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + interface FillOptions { + + + + color?: string; + opacity?: number; + + + + + } + + + + class Gradient extends kendo.Class { + + + options: GradientOptions; + + stops: any; + + constructor(options?: GradientOptions); + + + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + removeStop(stop: kendo.drawing.GradientStop): void; + + } + + interface GradientOptions { + name?: string; + stops?: any; + } + interface GradientEvent { + sender: Gradient; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class GradientStop extends kendo.Class { + + + options: GradientStopOptions; + + + constructor(options?: GradientStopOptions); + + + + } + + interface GradientStopOptions { + name?: string; + offset?: number; + color?: string; + opacity?: number; + } + interface GradientStopEvent { + sender: GradientStop; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Group extends kendo.drawing.Element { + + + options: GroupOptions; + + children: any; + + constructor(options?: GroupOptions); + + + append(element: kendo.drawing.Element): void; + clear(): void; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + insert(position: number, element: kendo.drawing.Element): void; + opacity(): number; + opacity(opacity: number): void; + remove(element: kendo.drawing.Element): void; + removeAt(index: number): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface GroupOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + opacity?: number; + pdf?: kendo.drawing.PDFOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface GroupEvent { + sender: Group; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Image extends kendo.drawing.Element { + + + options: ImageOptions; + + + constructor(src: string, rect: kendo.geometry.Rect); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + src(): string; + src(value: string): void; + rect(): kendo.geometry.Rect; + rect(value: kendo.geometry.Rect): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface ImageOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ImageEvent { + sender: Image; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Layout extends kendo.drawing.Group { + + + options: LayoutOptions; + + + constructor(rect: kendo.geometry.Rect, options?: LayoutOptions); + + + rect(): kendo.geometry.Rect; + rect(rect: kendo.geometry.Rect): void; + reflow(): void; + + } + + interface LayoutOptions { + name?: string; + alignContent?: string; + alignItems?: string; + justifyContent?: string; + lineSpacing?: number; + spacing?: number; + orientation?: string; + wrap?: boolean; + } + interface LayoutEvent { + sender: Layout; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class LinearGradient extends kendo.drawing.Gradient { + + + options: LinearGradientOptions; + + stops: any; + + constructor(options?: LinearGradientOptions); + + + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + end(): kendo.geometry.Point; + end(end: any): void; + end(end: kendo.geometry.Point): void; + start(): kendo.geometry.Point; + start(start: any): void; + start(start: kendo.geometry.Point): void; + removeStop(stop: kendo.drawing.GradientStop): void; + + } + + interface LinearGradientOptions { + name?: string; + stops?: any; + } + interface LinearGradientEvent { + sender: LinearGradient; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class MultiPath extends kendo.drawing.Element { + + + options: MultiPathOptions; + + paths: any; + + constructor(options?: MultiPathOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.MultiPath; + fill(color: string, opacity?: number): kendo.drawing.MultiPath; + lineTo(x: number, y?: number): kendo.drawing.MultiPath; + lineTo(x: any, y?: number): kendo.drawing.MultiPath; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + moveTo(x: number, y?: number): kendo.drawing.MultiPath; + moveTo(x: any, y?: number): kendo.drawing.MultiPath; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface MultiPathOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface MultiPathEvent { + sender: MultiPath; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class OptionsStore extends kendo.Class { + + + options: OptionsStoreOptions; + + observer: any; + + constructor(options?: OptionsStoreOptions); + + + get(field: string): any; + set(field: string, value: any): void; + + } + + interface OptionsStoreOptions { + name?: string; + } + interface OptionsStoreEvent { + sender: OptionsStore; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + interface PDFOptions { + + + + creator?: string; + date?: Date; + keywords?: string; + landscape?: boolean; + margin?: any; + paperSize?: any; + subject?: string; + title?: string; + + + + + } + + + + class Path extends kendo.drawing.Element { + + + options: PathOptions; + + segments: any; + + constructor(options?: PathOptions); + + static fromPoints(points: any): kendo.drawing.Path; + static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; + static parse(svgPath: string, options?: any): kendo.drawing.Path; + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any, endPoint: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point, endPoint: kendo.geometry.Point): kendo.drawing.Path; + fill(color: string, opacity?: number): kendo.drawing.Path; + lineTo(x: number, y?: number): kendo.drawing.Path; + lineTo(x: any, y?: number): kendo.drawing.Path; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + moveTo(x: number, y?: number): kendo.drawing.Path; + moveTo(x: any, y?: number): kendo.drawing.Path; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface PathOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface PathEvent { + sender: Path; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class RadialGradient extends kendo.drawing.Gradient { + + + options: RadialGradientOptions; + + stops: any; + + constructor(options?: RadialGradientOptions); + + + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + center(): kendo.geometry.Point; + center(center: any): void; + center(center: kendo.geometry.Point): void; + radius(): number; + radius(value: number): void; + removeStop(stop: kendo.drawing.GradientStop): void; + + } + + interface RadialGradientOptions { + name?: string; + center?: any|kendo.geometry.Point; + radius?: number; + stops?: any; + } + interface RadialGradientEvent { + sender: RadialGradient; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Rect extends kendo.drawing.Element { + + + options: RectOptions; + + + constructor(geometry: kendo.geometry.Rect, options?: RectOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Rect; + geometry(value: kendo.geometry.Rect): void; + fill(color: string, opacity?: number): kendo.drawing.Rect; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Rect; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface RectOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface RectEvent { + sender: Rect; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + class Segment extends kendo.Class { + + + options: SegmentOptions; + + + constructor(anchor: kendo.geometry.Point, controlIn: kendo.geometry.Point, controlOut: kendo.geometry.Point); + + + anchor(): kendo.geometry.Point; + anchor(value: kendo.geometry.Point): void; + controlIn(): kendo.geometry.Point; + controlIn(value: kendo.geometry.Point): void; + controlOut(): kendo.geometry.Point; + controlOut(value: kendo.geometry.Point): void; + + } + + interface SegmentOptions { + name?: string; + } + interface SegmentEvent { + sender: Segment; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + + interface StrokeOptions { + + + + color?: string; + dashType?: string; + lineCap?: string; + lineJoin?: string; + opacity?: number; + width?: number; + + + + + } + + + + class Surface extends kendo.Observable { + + + options: SurfaceOptions; + + + constructor(options?: SurfaceOptions); + + static create(element: JQuery, options?: any): kendo.drawing.Surface; + static create(element: Element, options?: any): kendo.drawing.Surface; + + clear(): void; + draw(element: kendo.drawing.Element): void; + eventTarget(e: any): kendo.drawing.Element; + resize(force?: boolean): void; + + } + + interface SurfaceOptions { + name?: string; + type?: string; + height?: string; + width?: string; + click?(e: SurfaceClickEvent): void; + mouseenter?(e: SurfaceMouseenterEvent): void; + mouseleave?(e: SurfaceMouseleaveEvent): void; + } + interface SurfaceEvent { + sender: Surface; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + interface SurfaceClickEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseenterEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseleaveEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + + class Text extends kendo.drawing.Element { + + + options: TextOptions; + + + constructor(content: string, position: kendo.geometry.Point, options?: TextOptions); + + + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + content(): string; + content(value: string): void; + fill(color: string, opacity?: number): kendo.drawing.Text; + opacity(): number; + opacity(opacity: number): void; + position(): kendo.geometry.Point; + position(value: kendo.geometry.Point): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + + } + + interface TextOptions { + name?: string; + clip?: kendo.drawing.Path; + cursor?: string; + fill?: kendo.drawing.FillOptions; + font?: string; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface TextEvent { + sender: Text; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + } interface HTMLElement { diff --git a/keyboardjs/keyboardjs.d.ts b/keyboardjs/keyboardjs.d.ts index dfafd30a8..0d6783ee8 100644 --- a/keyboardjs/keyboardjs.d.ts +++ b/keyboardjs/keyboardjs.d.ts @@ -1,50 +1,136 @@ -// Type definitions for KeyboardJS +// Type definitions for KeyboardJS v2.2.0 // Project: https://github.com/RobertWHurst/KeyboardJS -// Definitions by: Vincent Bortone +// Definitions by: Vincent Bortone , +// David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped -// A JavaScript library for binding keyboard combos without the pain of key codes and key combo conflicts. +// KeyboardJS is a library for use in the browser (node.js compatible). +// It Allows developers to easily setup key bindings. Use key combos to setup complex bindings. +// KeyboardJS also provides contexts. Contexts are great for single page applications. +// They allow you to scope your bindings to various parts of your application. +// Out of the box keyboardJS uses a US keyboard locale. If you need support for +// a different type of keyboard KeyboardJS provides custom locale support so you can create +// with a locale that better matches your needs. -interface KeyboardJSSubBinding { - clear(): void; +declare module keyboardjs { + + /** + * Information and functions in the current callback. + */ + interface KeyEvent{ + preventRepeat(): void; + } + + /** + * Callback function when a keyCombo is triggered. + * @see KeyEvent + */ + interface Callback { + /** + * Keyevent + */ + (e: KeyEvent): void; + } + + // ---------- Key Binding ---------- // + + /** + * Binds a keyCombo to specific callback functions. + * @param keyCombo String of keys to be pressed to execute callbacks. + * @param pressed Callback that gets executed when the keyComboState is 'pressed', can be null. + * @param released Callback that gets executed when the keyComboState is 'released' + */ + export function bind(keyCombo: string, pressed: Callback, released: Callback): void; + /** + * Binds a keyCombo to specific callback functions. + * @param keyCombo String of keys to be pressed to execute callbacks. + * @param pressed Callback that gets executed when the keyComboState is 'pressed' + */ + export function bind(keyCombo: string, pressed: Callback): void; + + + /** + * Unbinds a keyCombo + * @param keyCombo String of keys to be pressed to execute callbacks. + */ + export function unbind(keyCombo: string): void; + + // ---------- Context ---------- // + + /** + * Sets the context KeyboardJS operates in. Default is global context. + * Bindings in global context will execute in all contexts. + * @param identifier The name of the context. If the context doesn't exists, it will be created. + * Use 'global' to switch to global context. + */ + export function setContext(identifier: string): void; + /** + * Executes a Callback without loosing the current context. + * @param identifier The name of the context the callback should be in. If the context doesn't exists, it will be created. + * @param inContextCallBack The callback function. Will be executed in the given context. + */ + export function withContext(identifier: string, inContextCallBack: () => void): void; + /** + * Returns the context KeyboardJS currently operates in. + */ + export function getContext(): string; + + // ---------- KeyboardJS Control ---------- // + + /** + * The keyboard will no longer trigger bindings. + */ + export function pause(): void; + /** + * The keyboard will once again trigger bindings. + */ + export function resume(): void; + /** + * All active bindings will released and unbound. + */ + export function reset(): void; + + // ---------- Virtual Key Press ---------- // + + /** + * Triggers a key press. Stays in pressed state until released. + * @param keyCombo String of keys to be pressed to execute 'pressed' callbacks. + */ + export function pressKey(keyCombo: string): void + /** + * Triggers a key release. + * @param keyCombo String of keys to be released to execute 'released' callbacks. + */ + export function releaseKey(keyCombo: string): void; + /** + * Releases all keys. + */ + export function releaseAllKeys(): void; + + // ---------- Attachment ---------- // + + /** + * Attaches keyboardJS a specific window and a specific document or form. + * @param myWin The window to attach to. + * @param myDoc The document or form to attach to. + */ + export function watch(myWin: Window, myDoc: Document | HTMLFormElement): void; + /** + * Attaches keyboardJS to the current window and a specific document or form. + * @param myDoc The document or form to attach to. + */ + export function watch(myDoc: Document | HTMLFormElement): void; + /** + * Attaches keyboardJS to the current window an document. + */ + export function watch(): void; + + /** + * Detaches KeyboardJS from the window and document/element + */ + export function stop(): void; } -interface KeyboardJSBinding { - clear(): void; - on(eventName: string, callbacks?: any): KeyboardJSSubBinding; -} - -interface KeyboardJSLocale { - map: any; - macros: any[]; -} - -interface KeyboardJSStatic { - enable(): void; - disable(): void; - activeKeys(): string[]; - on(keyCombo:string, onDownCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => void, onUpCallback?: (keyEvent: Event, keysPressed: string[], keyCombo: string) => void): KeyboardJSBinding; - clear: { - (keyCombo: string): void; // Call signature - key(keyName: string): void; // Method - }; - locale: { - (localeName: string): KeyboardJSLocale; // Call signature - register(localeName: string, localeDefinition: KeyboardJSLocale): void; // Method - }; - macro: { - (keyCombo:string , keyNames: string[]): void; // Call signature - remove(keyCombo: string): void; // Method - }; - key: { - name(keyCode: number): string[]; - code(keyName: string): any; - }; - combo: { - active(keyCombo: string): boolean; - parse(keyCombo: any): any[]; - stringify(keyComboArray: any): string; - }; -} - -declare var KeyboardJS: KeyboardJSStatic; +declare module 'keyboardjs' { + export = keyboardjs; +} \ No newline at end of file diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 1d468b260..83b476b16 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// import Knex = require('knex'); import _ = require('lodash'); 'use strict'; diff --git a/koa/koa-tests.ts b/koa/koa-tests.ts new file mode 100644 index 000000000..e98436497 --- /dev/null +++ b/koa/koa-tests.ts @@ -0,0 +1,20 @@ +/// +import * as Koa from "koa"; + +const app = new Koa(); + +app.use((ctx, next) => { + const start: any = new Date(); + return next().then(() => { + const end: any = new Date(); + const ms = end - start; + console.log(`${ctx.method} ${ctx.url} - ${ms}ms`); + }); +}); + +// response +app.use(ctx => { + ctx.body = "Hello World"; +}); + +app.listen(3000); diff --git a/koa/koa.d.ts b/koa/koa.d.ts new file mode 100644 index 000000000..450134278 --- /dev/null +++ b/koa/koa.d.ts @@ -0,0 +1,136 @@ +// Type definitions for Koa 2.x +// Project: http://koajs.com +// Definitions by: DavidCai1993 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import * as Koa from "koa" + const app = new Koa() + + =============================================== */ +/// + +declare module "koa" { + import { EventEmitter } from "events"; + import * as http from "http"; + import * as net from "net"; + + interface IContext extends IRequest, IResponse { + body?: any; + request?: IRequest; + response?: IResponse; + originalUrl?: string; + state?: any; + name?: string; + cookies?: any; + writable?: Boolean; + respond?: Boolean; + app?: Koa; + req?: http.IncomingMessage; + res?: http.ServerResponse; + onerror(err: any): void; + toJSON(): any; + inspect(): any; + throw(): void; + assert(): void; + } + + interface IRequest { + _querycache?: string; + app?: Koa; + req?: http.IncomingMessage; + res?: http.ServerResponse; + response?: IResponse; + ctx?: IContext; + headers?: any; + header?: any; + method?: string; + length?: any; + url?: string; + origin?: string; + originalUrl?: string; + href?: string; + path?: string; + querystring?: string; + query?: any; + search?: string; + idempotent?: Boolean; + socket?: net.Socket; + protocol?: string; + host?: string; + hostname?: string; + fresh?: Boolean; + stale?: Boolean; + charset?: string; + secure?: Boolean; + ips?: Array; + ip?: string; + subdomains?: Array; + accept?: any; + type?: string; + accepts?: () => any; + acceptsEncodings?: () => any; + acceptsCharsets?: () => any; + acceptsLanguages?: () => any; + is?: (types: any) => any; + toJSON?: () => any; + inspect?: () => any; + get?: (field: string) => string; + } + + interface IResponse { + _body?: any; + _explicitStatus?: Boolean; + app?: Koa; + res?: http.ServerResponse; + req?: http.IncomingMessage; + ctx?: IContext; + request?: IRequest; + socket?: net.Socket; + header?: any; + headers?: any; + status?: number; + message?: string; + type?: string; + body?: any; + length?: any; + headerSent?: Boolean; + lastModified?: Date; + etag?: string; + writable?: Boolean; + is?: (types: any) => any; + redirect?: (url: string, alt: string) => void; + attachment?: (filename?: string) => void; + vary?: (field: string) => void; + get?: (field: string) => string; + set?: (field: any, val: any) => void; + remove?: (field: string) => void; + append?: (field: string, val: any) => void; + toJSON?: () => any; + inspect?: () => any; + } + + class Koa extends EventEmitter { + keys: Array; + subdomainOffset: number; + proxy: Boolean; + server: http.Server; + env: string; + context: IContext; + request: IRequest; + response: IResponse; + silent: Boolean; + constructor(); + use(middleware: (ctx: IContext, next: Function) => any): Koa; + callback(): (req: http.IncomingMessage, res: http.ServerResponse) => void; + listen(port: number, callback?: Function): http.Server; + toJSON(): any; + inspect(): any; + onerror(err: any): void; + } + + namespace Koa {} + + export = Koa; +} diff --git a/konami.js/konami-tests.ts b/konami.js/konami-tests.ts new file mode 100644 index 000000000..05dff67b6 --- /dev/null +++ b/konami.js/konami-tests.ts @@ -0,0 +1,5 @@ +/// + +let urlEasteEgg = new Konami("www.example.com"); + +let actionEasteEgg = new Konami(() => alert("Konami !")); diff --git a/konami.js/konami.d.ts b/konami.js/konami.d.ts new file mode 100644 index 000000000..aeaa9ed6f --- /dev/null +++ b/konami.js/konami.d.ts @@ -0,0 +1,8 @@ +// Type definitions for Konami-js 1.4.3 +// Project: https://github.com/snaptortoise/konami-js +// Definitions by: Matthieu Mourisson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Konami { + constructor(action: string | Function); +} \ No newline at end of file diff --git a/leaflet-markercluster/leaflet-markercluster-tests.ts b/leaflet-markercluster/leaflet-markercluster-tests.ts new file mode 100644 index 000000000..8c1a4721c --- /dev/null +++ b/leaflet-markercluster/leaflet-markercluster-tests.ts @@ -0,0 +1,19 @@ +/// + +var map: L.Map; +var markerClusterGroup: L.MarkerClusterGroup; + +// CircleMarker +var circleMarker: L.CircleMarker = new L.CircleMarker(new L.LatLng(0, 0)); + +markerClusterGroup.addLayer(circleMarker); +map.addLayer(markerClusterGroup); +map.removeLayer(markerClusterGroup); + +// Marker +var marker = new L.Marker(new L.LatLng(0, 0)); + +markerClusterGroup.addLayers([circleMarker, marker]); +map.addLayer(markerClusterGroup); +markerClusterGroup.refreshClusters(); +map.removeLayer(markerClusterGroup); diff --git a/leaflet-markercluster/leaflet-markercluster.d.ts b/leaflet-markercluster/leaflet-markercluster.d.ts new file mode 100644 index 000000000..cffa7cb40 --- /dev/null +++ b/leaflet-markercluster/leaflet-markercluster.d.ts @@ -0,0 +1,125 @@ +// Type definitions for Leaflet.markercluster v0.4.0 +// Project: https://github.com/Leaflet/Leaflet.markercluster +// Definitions by: Robert Imig +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module L { + export interface MarkerClusterGroupOptions { + + /* + * When you mouse over a cluster it shows the bounds of its markers. + */ + showCoverageOnHover?: boolean; + + /* + * When you click a cluster we zoom to its bounds. + */ + zoomToBoundsOnClick?: boolean; + + /* + * When you click a cluster at the bottom zoom level we spiderfy it + * so you can see all of its markers. + */ + spiderfyOnMaxZoom?: boolean; + + /* + * Clusters and markers too far from the viewport are removed from the map + * for performance. + */ + removeOutsideVisibleBounds?: boolean; + + /* + * Smoothly split / merge cluster children when zooming and spiderfying. + * If L.DomUtil.TRANSITION is false, this option has no effect (no animation is possible). + */ + animate?: boolean; + + /* + * If set to true (and animate option is also true) then adding individual markers to the + * MarkerClusterGroup after it has been added to the map will add the marker and animate it + * into the cluster. Defaults to false as this gives better performance when bulk adding markers. + * addLayers does not support this, only addLayer with individual Markers. + */ + animateAddingMarkers?: boolean; + + /* + * If set, at this zoom level and below markers will not be clustered. This defaults to disabled. + */ + disableClusteringAtZoom?: number; + + /* + * The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. + * Decreasing will make more, smaller clusters. + */ + maxClusterRadius?: number; + + /* + * Options to pass when creating the L.Polygon(points, options) to show the bounds of a cluster. + * Defaults to empty + */ + polygonOptions?: PolylineOptions; + + /* + * If set to true, overrides the icon for all added markers to make them appear as a 1 size cluster. + */ + singleMarkerMode?: boolean; + + /* + * Allows you to specify PolylineOptions to style spider legs. + * By default, they are { weight: 1.5, color: '#222', opacity: 0.5 }. + */ + spiderLegPolylineOptions?: PolylineOptions; + + /* + * Increase from 1 to increase the distance away from the center that spiderfied markers are placed. + * Use if you are using big marker icons (Default: 1). + */ + spiderfyDistanceMultiplier?: number; + + /* + * Function used to create the cluster icon + */ + iconCreateFunction?: any; + } + + export class MarkerClusterGroup extends FeatureGroup { + initialize(): void; + initialize(options: MarkerClusterGroupOptions): void; + + /* + * Bulk methods for adding and removing markers and should be favoured over the + * single versions when doing bulk addition/removal of markers. + */ + addLayers(layers:ILayer[]):MarkerClusterGroup; + removeLayers(layers:ILayer[]):MarkerClusterGroup; + + clearLayers():MarkerClusterGroup; + + /* + * If you have a marker in your MarkerClusterGroup and you want to get the visible + * parent of it + */ + getVisibleParent(marker: Marker): Marker; + + /* + * If you have customized the clusters icon to use some data from the contained markers, + * and later that data changes, use this method to force a refresh of the cluster icons. + */ + refreshClusters():MarkerClusterGroup; + refreshClusters(layerGroup:LayerGroup):MarkerClusterGroup; + refreshClusters(marker: Marker):MarkerClusterGroup; + refreshClusters(markers: Marker[]):MarkerClusterGroup; + + /* + * Returns the total number of markers contained within that cluster. + */ + getChildCount(): number; + + /* + * Returns the array of total markers contained within that cluster. + */ + getAllChildMarkers(): Marker[]; + } +} diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index cd12bb4f3..ad25fd9f5 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -91,6 +91,6 @@ interface LocalForage { } declare module "localforage" { - var localforage: LocalForage; - export default localforage; + export var localforage: LocalForage; + export default localforage; } \ No newline at end of file diff --git a/lodash-decorators/lodash-decorators-tests.ts b/lodash-decorators/lodash-decorators-tests.ts index 60a659c8d..1ab2cad55 100644 --- a/lodash-decorators/lodash-decorators-tests.ts +++ b/lodash-decorators/lodash-decorators-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// // // With Arguments diff --git a/lodash-decorators/lodash-decorators.d.ts b/lodash-decorators/lodash-decorators.d.ts index ac01c5cf6..586413899 100644 --- a/lodash-decorators/lodash-decorators.d.ts +++ b/lodash-decorators/lodash-decorators.d.ts @@ -3,7 +3,7 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module "lodash-decorators" { diff --git a/lodash/lodash-3.10.d.ts b/lodash/lodash-3.10.d.ts new file mode 100644 index 000000000..c570cc11c --- /dev/null +++ b/lodash/lodash-3.10.d.ts @@ -0,0 +1,14991 @@ +// Type definitions for Lo-Dash +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var _: _.LoDashStatic; + +declare module _ { + interface LoDashStatic { + /** + * Creates a lodash object which wraps the given value to enable intuitive method chaining. + * + * In addition to Lo-Dash methods, wrappers also have the following Array methods: + * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift + * + * Chaining is supported in custom builds as long as the value method is implicitly or + * explicitly included in the build. + * + * The chainable wrapper functions are: + * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, + * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, + * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, + * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, + * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip + * + * The non-chainable wrapper functions are: + * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, + * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, + * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, + * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, + * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, + * sortedIndex, runInContext, template, unescape, uniqueId, and value + * + * The wrapper functions first and last return wrapped values when n is provided, otherwise + * they return unwrapped values. + * + * Explicit chaining can be enabled by using the _.chain method. + **/ + (value: number): LoDashImplicitWrapper; + (value: string): LoDashImplicitStringWrapper; + (value: boolean): LoDashImplicitWrapper; + (value: Array): LoDashImplicitNumberArrayWrapper; + (value: Array): LoDashImplicitArrayWrapper; + (value: T): LoDashImplicitObjectWrapper; + (value: any): LoDashImplicitWrapper; + + /** + * The semantic version number. + **/ + VERSION: string; + + /** + * An object used to flag environments features. + **/ + support: Support; + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + templateSettings: TemplateSettings; + } + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + interface TemplateSettings { + /** + * The "escape" delimiter. + **/ + escape?: RegExp; + + /** + * The "evaluate" delimiter. + **/ + evaluate?: RegExp; + + /** + * An object to import into the template as local variables. + **/ + imports?: Dictionary; + + /** + * The "interpolate" delimiter. + **/ + interpolate?: RegExp; + + /** + * Used to reference the data object in the template text. + **/ + variable?: string; + } + + /** + * Creates a cache object to store key/value pairs. + */ + interface MapCache { + /** + * Removes `key` and its value from the cache. + * @param key The key of the value to remove. + * @return Returns `true` if the entry was removed successfully, else `false`. + */ + delete(key: string): boolean; + + /** + * Gets the cached value for `key`. + * @param key The key of the value to get. + * @return Returns the cached value. + */ + get(key: string): any; + + /** + * Checks if a cached value for `key` exists. + * @param key The key of the entry to check. + * @return Returns `true` if an entry for `key` exists, else `false`. + */ + has(key: string): boolean; + + /** + * Sets `value` to `key` of the cache. + * @param key The key of the value to cache. + * @param value The value to cache. + * @return Returns the cache object. + */ + set(key: string, value: any): _.Dictionary; + } + + /** + * An object used to flag environments features. + **/ + interface Support { + /** + * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). + **/ + argsClass: boolean; + + /** + * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). + **/ + argsObject: boolean; + + /** + * Detect if name or message properties of Error.prototype are enumerable by default. + * (IE < 9, Safari < 5.1) + **/ + enumErrorProps: boolean; + + /** + * Detect if prototype properties are enumerable by default. + * + * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 (if the prototype or a property on the + * prototype has been set) incorrectly set the [[Enumerable]] value of a function’s prototype property to true. + **/ + enumPrototypes: boolean; + + /** + * Detect if Function#bind exists and is inferred to be fast (all but V8). + **/ + fastBind: boolean; + + /** + * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera + * mobile browsers & avoided in Windows 8 apps). + **/ + funcDecomp: boolean; + + /** + * Detect if Function#name is supported (all but IE). + **/ + funcNames: boolean; + + /** + * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, + * Safari < 5.1). + **/ + nonEnumArgs: boolean; + + /** + * Detect if properties shadowing those on Object.prototype are non-enumerable. + * + * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made + * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). + **/ + nonEnumShadows: boolean; + + /** + * Detect if own properties are iterated after inherited properties (all but IE < 9). + **/ + ownLast: boolean; + + /** + * Detect if Array#shift and Array#splice augment array-like objects correctly. + * + * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() + * functions that fail to remove the last element, value[0], of array-like objects even + * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility + * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode + * in IE 9. + **/ + spliceObjects: boolean; + + /** + * Detect lack of support for accessing string characters by index. + * + * IE < 8 can't access characters by index and IE 8 can only access characters by index on + * string literals. + **/ + unindexedChars: boolean; + } + + interface LoDashWrapperBase { } + + interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashExplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { } + + interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } + + interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { + join(seperator?: string): string; + pop(): T; + push(...items: T[]): LoDashImplicitArrayWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; + splice(start: number): LoDashImplicitArrayWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper; + unshift(...items: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } + + interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } + + /********* + * Array * + *********/ + + //_.chunk + interface LoDashStatic { + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + chunk( + array: List, + size?: number + ): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + //_.compact + interface LoDashStatic { + /** + * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are + * falsey. + * + * @param array The array to compact. + * @return (Array) Returns the new array of filtered values. + */ + compact(array?: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + //_.difference + interface LoDashStatic { + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + difference( + array: T[]|List, + ...values: (T[]|List)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.drop + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + drop(array: T[]|List, n?: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + dropRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRightWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.dropWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.fill + interface LoDashStatic { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + fill( + array: any[], + value: T, + start?: number, + end?: number + ): T[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: T, + start?: number, + end?: number + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitObjectWrapper>; + } + + //_.findIndex + interface LoDashStatic { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the index of the found element, else -1. + */ + findIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.findLastIndex + interface LoDashStatic { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The function invoked per iteration. + * @return Returns the index of the found element, else -1. + */ + findLastIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.first + interface LoDashStatic { + /** + * Gets the first element of array. + * + * @alias _.head + * + * @param array The array to query. + * @return Returns the first element of array. + */ + first(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + first(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + first(): TResult; + } + + interface RecursiveArray extends Array> {} + interface ListOfRecursiveArraysOrValues extends List> {} + + //_.flatten + interface LoDashStatic { + /** + * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only + * flattened a single level. + * + * @param array The array to flatten. + * @param isDeep Specify a deep flatten. + * @return Returns the new flattened array. + */ + flatten(array: ListOfRecursiveArraysOrValues, isDeep: boolean): T[]; + + /** + * @see _.flatten + */ + flatten(array: List): T[]; + + /** + * @see _.flatten + */ + flatten(array: ListOfRecursiveArraysOrValues): RecursiveArray; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + //_.flattenDeep + interface LoDashStatic { + /** + * Recursively flattens a nested array. + * + * @param array The array to recursively flatten. + * @return Returns the new flattened array. + */ + flattenDeep(array: ListOfRecursiveArraysOrValues): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + //_.head + interface LoDashStatic { + /** + * @see _.first + */ + head(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + head(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + head(): TResult; + } + + //_.indexOf + interface LoDashStatic { + /** + * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality + * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted + * providing true for fromIndex performs a faster binary search. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return The index to search from or true to perform a binary search on a sorted array. + */ + indexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.initial + interface LoDashStatic { + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + initial(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + //_.intersection + interface LoDashStatic { + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + intersection(...arrays: (T[]|List)[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.last + interface LoDashStatic { + /** + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + last(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitObjectWrapper; + } + + //_.lastIndexOf + interface LoDashStatic { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + lastIndexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.object + interface LoDashStatic { + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.pull + interface LoDashStatic { + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + pull( + array: T[], + ...values: T[] + ): T[]; + + /** + * @see _.pull + */ + pull( + array: List, + ...values: T[] + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashExplicitObjectWrapper>; + } + + //_.pullAt + interface LoDashStatic { + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + pullAt( + array: List, + ...indexes: (number|number[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + //_.remove + interface LoDashStatic { + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + remove( + array: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: string, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: W + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + //_.rest + interface LoDashStatic { + /** + * Gets all but the first element of array. + * + * @alias _.tail + * + * @param array The array to query. + * @return Returns the slice of array. + */ + rest(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + //_.slice + interface LoDashStatic { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + slice( + array: T[], + start?: number, + end?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + //_.sortedIndex + interface LoDashStatic { + /** + * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @return The this binding of iteratee. + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.sortedLastIndex + interface LoDashStatic { + /** + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.tail + interface LoDashStatic { + /** + * @see _.rest + */ + tail(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + //_.take + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + take( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + takeRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRightWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.takeWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.union + interface LoDashStatic { + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + union(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.uniq + interface LoDashStatic { + /** + * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only + * the first occurrence of each element is kept. Providing true for isSorted performs a faster search + * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the + * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and + * invoked with three arguments: (value, index, array). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.unique + * + * @param array The array to inspect. + * @param isSorted Specify the array is sorted. + * @param iteratee The function invoked per iteration. + * @param thisArg iteratee + * @return Returns the new duplicate-value-free array. + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unique + interface LoDashStatic { + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unzip + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an array of grouped elements and creates an array + * regrouping the elements to their pre-zip configuration. + * + * @param array The array of grouped elements to process. + * @return Returns the new array of regrouped elements. + */ + unzip(array: List>): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + //_.unzipWith + interface LoDashStatic { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + unzipWith( + array: List>, + iteratee?: MemoIterator, + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.without + interface LoDashStatic { + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + without( + array: List, + ...values: T[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + //_.xor + interface LoDashStatic { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + xor(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.zip + interface LoDashStatic { + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + zip(...arrays: List[]): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + //_.zipObject + interface LoDashStatic { + /** + * The inverse of _.pairs; this method returns an object composed from arrays of property names and values. + * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of + * property names and one of corresponding values. + * + * @alias _.object + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.zipWith + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + zipWith(...args: any[]): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipWith + */ + zipWith(...args: any[]): LoDashImplicitArrayWrapper; + } + + /********* + * Chain * + *********/ + + //_.chain + interface LoDashStatic { + /** + * Creates a lodash object that wraps value with explicit method chaining enabled. + * + * @param value The value to wrap. + * @return Returns the new lodash wrapper instance. + */ + chain(value: number): LoDashExplicitWrapper; + chain(value: string): LoDashExplicitWrapper; + chain(value: boolean): LoDashExplicitWrapper; + chain(value: T[]): LoDashExplicitArrayWrapper; + chain(value: T): LoDashExplicitObjectWrapper; + chain(value: any): LoDashExplicitWrapper; + } + + interface LoDashImplicitWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.chain + */ + chain(): TWrapper; + } + + //_.tap + interface LoDashStatic { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + tap( + value: T, + interceptor: (value: T) => void, + thisArg?: any + ): T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + //_.thru + interface LoDashStatic { + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + thru( + value: T, + interceptor: (value: T) => TResult, + thisArg?: any + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + //_.prototype.commit + interface LoDashImplicitWrapperBase { + /** + * Executes the chained sequence and returns the wrapped result. + * + * @return Returns the new lodash wrapper instance. + */ + commit(): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.commit + */ + commit(): TWrapper; + } + + //_.prototype.concat + interface LoDashImplicitWrapperBase { + /** + * Creates a new array joining a wrapped array with any additional arrays and/or values. + * + * @param items + * @return Returns the new concatenated array. + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + } + + //_.prototype.plant + interface LoDashImplicitWrapperBase { + /** + * Creates a clone of the chained sequence planting value as the wrapped value. + * @param value The value to plant as the wrapped value. + * @return Returns the new lodash wrapper instance. + */ + plant(value: number): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashImplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashImplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashImplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashImplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.plant + */ + plant(value: number): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashExplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashExplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashExplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashExplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashExplicitWrapper; + } + + //_.prototype.reverse + interface LoDashImplicitArrayWrapper { + /** + * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to + * last, and so on. + * + * Note: This method mutates the wrapped array. + * + * @return Returns the new reversed lodash wrapper instance. + */ + reverse(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reverse + */ + reverse(): LoDashExplicitArrayWrapper; + } + + //_.prototype.run + interface LoDashWrapperBase { + /** + * @see _.value + */ + run(): T; + } + + //_.prototype.toJSON + interface LoDashWrapperBase { + /** + * @see _.value + */ + toJSON(): T; + } + + //_.prototype.toString + interface LoDashWrapperBase { + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @return Returns the coerced string value. + */ + toString(): string; + } + + //_.prototype.value + interface LoDashWrapperBase { + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @alias _.run, _.toJSON, _.valueOf + * + * @return Returns the resolved unwrapped value. + */ + value(): T; + } + + //_.valueOf + interface LoDashWrapperBase { + /** + * @see _.value + */ + valueOf(): T; + } + + /************** + * Collection * + **************/ + + //_.all + interface LoDashStatic { + /** + * @see _.every + */ + all( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.any + interface LoDashStatic { + /** + * @see _.some + */ + any( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.at + interface LoDashStatic { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param collection The collection to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + at( + collection: List|Dictionary, + ...props: (number|string|(number|string)[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + //_.collect + interface LoDashStatic { + /** + * @see _.map + */ + collect( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.contains + interface LoDashStatic { + /** + * @see _.includes + */ + contains( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + contains( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.countBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + countBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + //_.detect + interface LoDashStatic { + /** + * @see _.find + */ + detect( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): TResult; + } + + //_.each + interface LoDashStatic { + /** + * @see _.forEach + */ + each( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + each( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + each( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.eachRight + interface LoDashStatic { + /** + * @see _.forEachRight + */ + eachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + eachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + eachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.every + interface LoDashStatic { + /** + * Checks if predicate returns truthy for all elements of collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.all + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if all elements pass the predicate check, else false. + */ + every( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.filter + interface LoDashStatic { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.select + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + filter( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.find + interface LoDashStatic { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.detect + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the matched element, else undefined. + */ + find( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): TResult; + } + + //_.findWhere + interface LoDashStatic { + /** + * @see _.find + **/ + findWhere( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Dictionary, + pluckValue: string): T; + } + + //_.findLast + interface LoDashStatic { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return The found element, else undefined. + **/ + findLast( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Dictionary, + pluckValue: string): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLast + */ + findLast( + callback: ListIterator, + thisArg?: any): T; + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + whereValue: W): T; + + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + pluckValue: string): T; + } + + //_.forEach + interface LoDashStatic { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + forEach( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + forEach( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + forEach( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.forEachRight + interface LoDashStatic { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + forEachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.groupBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: TValue + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: TWhere + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.include + interface LoDashStatic { + /** + * @see _.includes + */ + include( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + include( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.includes + interface LoDashStatic { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @alias _.contains, _.include + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + includes( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + includes( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.indexBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + indexBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.invoke + interface LoDashStatic { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + invoke( + collection: Array, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Array, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + method: Function, + ...args: any[]): any; + } + + //_.map + interface LoDashStatic { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @alias _.collect + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + map( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.partition + interface LoDashStatic { + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + partition( + collection: List, + callback: ListIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + pluckValue: string): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + pluckValue: string): T[][]; + } + + interface LoDashImplicitStringWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + callback: DictionaryIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + //_.pluck + interface LoDashStatic { + /** + * Gets the property value of path from all elements in collection. + * + * @param collection The collection to iterate over. + * @param path The path of the property to pluck. + * @return A new array of property values. + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): any[]; + + /** + * @see _.pluck + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + //_.reduce + interface LoDashStatic { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return Returns the accumulated value. + **/ + reduce( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reduceRight + interface LoDashStatic { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return The accumulated value. + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reject + interface LoDashStatic { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + reject( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.sample + interface LoDashStatic { + /** + * Retrieves a random element or n random elements from a collection. + * @param collection The collection to sample. + * @return Returns the random sample(s) of collection. + **/ + sample(collection: Array): T; + + /** + * @see _.sample + **/ + sample(collection: List): T; + + /** + * @see _.sample + **/ + sample(collection: Dictionary): T; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Array, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: List, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Dictionary, n: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sample + **/ + sample(n: number): LoDashImplicitArrayWrapper; + + /** + * @see _.sample + **/ + sample(): LoDashImplicitWrapper; + } + + //_.select + interface LoDashStatic { + /** + * @see _.filter + */ + select( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.shuffle + interface LoDashStatic { + /** + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + shuffle(collection: List|Dictionary): T[]; + + /** + * @see _.shuffle + */ + shuffle(collection: string): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + //_.size + interface LoDashStatic { + /** + * Gets the size of collection by returning its length for array-like values or the number of own enumerable + * properties for objects. + * + * @param collection The collection to inspect. + * @return Returns the size of collection. + */ + size(collection: List|Dictionary): number; + + /** + * @see _.size + */ + size(collection: string): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + //_.some + interface LoDashStatic { + /** + * Checks if predicate returns truthy for any element of collection. The function returns as soon as it finds + * a passing value and does not iterate over the entire collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.any + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if any element passes the predicate check, else false. + */ + some( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.sortBy + interface LoDashStatic { + /** + * Creates an array of elements, sorted in ascending order by the results of running each element in a + * collection through iteratee. This method performs a stable sort, that is, it preserves the original sort + * order of equal elements. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * valueof the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new sorted array. + */ + sortBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + iteratee: string + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + whereValue: W + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + //_.sortByAll + interface LoDashStatic { + /** + * This method is like "_.sortBy" except that it can sort by multiple iteratees or + * property names. + * + * If a property name is provided for an iteratee the created "_.property" style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created "_.matchesProperty" style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for an iteratee the created "_.matches" style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return A new array of sorted elements. + **/ + sortByAll( + collection: Array, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: Array, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll( + collection: (Array|List), + ...args: (ListIterator|Object|string)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + } + + //_.sortByOrder + interface LoDashStatic { + /** + * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort + * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created _.property style callback returns the property + * value of the given element. + * + * If an object is provided for an iteratee the created _.matches style callback returns true for elements + * that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratees The iteratees to sort by. + * @param orders The sort orders of iteratees. + * @return Returns the new sorted array. + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + //_.where + interface LoDashStatic { + /** + * Performs a deep comparison of each element in a collection to the given properties + * object, returning an array of all elements that have equivalent property values. + * @param collection The collection to iterate over. + * @param properties The object of property values to filter by. + * @return A new array of elements that have the given properties. + **/ + where( + list: Array, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: List, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: Dictionary, + properties: U): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.where + **/ + where(properties: U): LoDashImplicitArrayWrapper; + } + + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ + now(): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.now + */ + now(): number; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.now + */ + now(): LoDashExplicitWrapper; + } + + /************* + * Functions * + *************/ + + //_.after + interface LoDashStatic { + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + after( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.ary + interface LoDashStatic { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + ary( + func: Function, + n?: number + ): TResult; + + ary( + func: T, + n?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashExplicitObjectWrapper; + } + + //_.backflow + interface LoDashStatic { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.before + interface LoDashStatic { + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + before( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.bind + interface FunctionBind { + placeholder: any; + + ( + func: T, + thisArg: any, + ...partials: any[] + ): TResult; + + ( + func: Function, + thisArg: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bind: FunctionBind; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.bindAll + interface LoDashStatic { + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + bindAll( + object: T, + ...methodNames: (string|string[])[] + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper; + } + + //_.bindKey + interface FunctionBindKey { + placeholder: any; + + ( + object: T, + key: any, + ...partials: any[] + ): TResult; + + ( + object: Object, + key: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bindKey: FunctionBindKey; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.compose + interface LoDashStatic { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.createCallback + interface LoDashStatic { + /** + * Produces a callback bound to an optional thisArg. If func is a property name the created + * callback will return the property value for a given element. If func is an object the created + * callback will return true for elements that contain the equivalent object properties, + * otherwise it will return false. + * @param func The value to convert to a callback. + * @param thisArg The this binding of the created callback. + * @param argCount The number of arguments the callback accepts. + * @return A callback function. + **/ + createCallback( + func: string, + thisArg?: any, + argCount?: number): () => any; + + /** + * @see _.createCallback + **/ + createCallback( + func: Dictionary, + thisArg?: any, + argCount?: number): () => boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + //_.curry + interface LoDashStatic { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1) => R): + CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curry( + func: Function, + arity?: number): TResult; + } + + interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; + } + + interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: T1, t2: T2): R; + } + + interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; + } + + interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curry + **/ + curry(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.curryRight + interface LoDashStatic { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1) => R): + CurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curryRight( + func: Function, + arity?: number): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.debounce + interface DebounceSettings { + /** + * Specify invoking on the leading edge of the timeout. + */ + leading?: boolean; + + /** + * The maximum time func is allowed to be delayed before it’s invoked. + */ + maxWait?: number; + + /** + * Specify invoking on the trailing edge of the timeout. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations. Provide an options object to indicate that func should be invoked on the + * leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the + * result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + debounce( + func: T, + wait?: number, + options?: DebounceSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashExplicitObjectWrapper; + } + + //_.defer + interface LoDashStatic { + /** + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + + //_.delay + interface LoDashStatic { + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + delay( + func: T, + wait: number, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashExplicitWrapper; + } + + //_.flow + interface LoDashStatic { + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.flowRight + interface LoDashStatic { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @alias _.backflow, _.compose + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flowRight(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + + //_.memoize + interface MemoizedFunction extends Function { + cache: MapCache; + } + + interface LoDashStatic { + /** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * @param func The function to have its output memoized. + * @param resolver The function to resolve the cache key. + * @return Returns the new memoizing function. + */ + memoize( + func: Function, + resolver?: Function): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.memoize + */ + memoize(resolver?: Function): LoDashImplicitObjectWrapper; + } + + //_.modArgs + interface LoDashStatic { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + modArgs( + func: T, + ...transforms: Function[] + ): TResult; + + /** + * @see _.modArgs + */ + modArgs( + func: T, + transforms: Function[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + } + + //_.negate + interface LoDashStatic { + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + negate(predicate: T): (...args: any[]) => boolean; + + /** + * @see _.negate + */ + negate(predicate: T): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper; + } + + //_.once + interface LoDashStatic { + /** + * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value + * of the first call. The func is invoked with the this binding and arguments of the created function. + * + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + once(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashExplicitObjectWrapper; + } + + //_.partial + interface LoDashStatic { + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partial: Partial; + } + + type PH = LoDashStatic; + + interface Function0 { + (): R; + } + interface Function1 { + (t1: T1): R; + } + interface Function2 { + (t1: T1, t2: T2): R; + } + interface Function3 { + (t1: T1, t2: T2, t3: T3): R; + } + interface Function4 { + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface Partial { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1): Function1< T2, R>; + (func: Function2, plc1: PH, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1): Function2< T2, T3, R>; + (func: Function3, plc1: PH, arg2: T2): Function2; + (func: Function3, arg1: T1, arg2: T2): Function1< T3, R>; + (func: Function3, plc1: PH, plc2: PH, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, plc1: PH, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1): Function3< T2, T3, T4, R>; + (func: Function4, plc1: PH, arg2: T2): Function3; + (func: Function4, arg1: T1, arg2: T2): Function2< T3, T4, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3): Function2< T2, T4, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3): Function1< T4, R>; + (func: Function4, plc1: PH, plc2: PH, plc3: PH, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, plc1: PH, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.partialRight + interface LoDashStatic { + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partialRight: PartialRight + } + + interface PartialRight { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1, plc2: PH): Function1< T2, R>; + (func: Function2, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1, plc2: PH, plc3: PH): Function2< T2, T3, R>; + (func: Function3, arg2: T2, plc3: PH): Function2; + (func: Function3, arg1: T1, arg2: T2, plc3: PH): Function1< T3, R>; + (func: Function3, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, plc4: PH): Function3< T2, T3, T4, R>; + (func: Function4, arg2: T2, plc3: PH, plc4: PH): Function3; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, plc4: PH): Function2< T3, T4, R>; + (func: Function4, arg3: T3, plc4: PH): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, plc4: PH): Function2< T2, T4, R>; + (func: Function4, arg2: T2, arg3: T3, plc4: PH): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, plc4: PH): Function1< T4, R>; + (func: Function4, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.rearg + interface LoDashStatic { + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + rearg(func: Function, indexes: number[]): TResult; + + /** + * @see _.rearg + */ + rearg(func: Function, ...indexes: number[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rearg + */ + rearg(indexes: number[]): LoDashImplicitObjectWrapper; + + /** + * @see _.rearg + */ + rearg(...indexes: number[]): LoDashImplicitObjectWrapper; + } + + //_.restParam + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + restParam( + func: Function, + start?: number + ): TResult; + + /** + * @see _.restParam + */ + restParam( + func: TFunc, + start?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashExplicitObjectWrapper; + } + + //_.spread + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + spread(func: F): T; + + /** + * @see _.spread + */ + spread(func: Function): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashExplicitObjectWrapper; + } + + //_.throttle + interface ThrottleSettings { + /** + * If you'd like to disable the leading-edge call, pass this as false. + */ + leading?: boolean; + + /** + * If you'd like to disable the execution on the trailing-edge, pass false. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate + * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to + * the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + throttle( + func: T, + wait?: number, + options?: ThrottleSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashExplicitObjectWrapper; + } + + //_.wrap + interface LoDashStatic { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + wrap( + value: V, + wrapper: W + ): R; + + /** + * @see _.wrap + */ + wrap( + value: V, + wrapper: Function + ): R; + + /** + * @see _.wrap + */ + wrap( + value: any, + wrapper: Function + ): R; + } + + interface LoDashImplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + /******** + * Lang * + ********/ + + //_.clone + interface LoDashStatic { + /** + * Creates a clone of value. If isDeep is true nested objects are cloned, otherwise they are assigned by + * reference. If customizer is provided it’s invoked to produce the cloned values. If customizer returns + * undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with up + * to three argument; (value [, index|key, object]). + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments + * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty + * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * @param value The value to clone. + * @param isDeep Specify a deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the cloned value. + */ + clone( + value: T, + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T; + + /** + * @see _.clone + */ + clone( + value: T, + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clone + */ + clone( + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T; + + /** + * @see _.clone + */ + clone( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.clone + */ + clone( + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T[]; + + /** + * @see _.clone + */ + clone( + customizer?: (value: any) => any, + thisArg?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.clone + */ + clone( + isDeep?: boolean, + customizer?: (value: any) => any, + thisArg?: any): T; + + /** + * @see _.clone + */ + clone( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + //_.cloneDeep + interface LoDashStatic { + /** + * Creates a deep clone of value. If customizer is provided it’s invoked to produce the cloned values. If + * customizer returns undefined cloning is handled by the method instead. The customizer is bound to thisArg + * and invoked with up to three argument; (value [, index|key, object]). + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments + * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty + * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * @param value The value to deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the deep cloned value. + */ + cloneDeep( + value: T, + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer?: (value: any) => any, + thisArg?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer?: (value: any) => any, + thisArg?: any): T; + } + + //_.eq + interface LoDashStatic { + /** + * @see _.isEqual + */ + eq( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.gt + interface LoDashStatic { + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + gt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): LoDashExplicitWrapper; + } + + //_.gte + interface LoDashStatic { + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + gte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): LoDashExplicitWrapper; + } + + //_.isArguments + interface LoDashStatic { + /** + * Checks if value is classified as an arguments object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isArguments(value?: any): value is IArguments; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): LoDashExplicitWrapper; + } + + //_.isArray + interface LoDashStatic { + /** + * Checks if value is classified as an Array object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isArray(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): LoDashExplicitWrapper; + } + + //_.isBoolean + interface LoDashStatic { + /** + * Checks if value is classified as a boolean primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isBoolean(value?: any): value is boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + + //_.isDate + interface LoDashStatic { + /** + * Checks if value is classified as a Date object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isDate(value?: any): value is Date; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): LoDashExplicitWrapper; + } + + //_.isElement + interface LoDashStatic { + /** + * Checks if value is a DOM element. + * + * @param value The value to check. + * @return Returns true if value is a DOM element, else false. + */ + isElement(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): LoDashExplicitWrapper; + } + + //_.isEmpty + interface LoDashStatic { + /** + * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or + * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. + * @param value The value to inspect. + * @return Returns true if value is empty, else false. + **/ + isEmpty(value?: any[]|Dictionary|string|any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): boolean; + } + + //_.isEqual + interface IsEqualCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between two values to determine if they are equivalent. If customizer is + * provided it’s invoked to compare values. If customizer returns undefined comparisons are handled by the + * method instead. The customizer is bound to thisArg and invoked with up to three arguments: (value, other + * [, index|key]). + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, + * and strings. Objects are compared by their own, not inherited, enumerable properties. Functions and DOM + * nodes are not supported. Provide a customizer function to extend support for comparing other values. + * + * @alias _.eq + * + * @param value The value to compare. + * @param other The other value to compare. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if the values are equivalent, else false. + */ + isEqual( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.isError + interface LoDashStatic { + /** + * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError + * object. + * + * @param value The value to check. + * @return Returns true if value is an error object, else false. + */ + isError(value: any): value is Error; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isError + */ + isError(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isError + */ + isError(): LoDashExplicitWrapper; + } + + //_.isFinite + interface LoDashStatic { + /** + * Checks if value is a finite primitive number. + * + * Note: This method is based on Number.isFinite. + * + * @param value The value to check. + * @return Returns true if value is a finite number, else false. + */ + isFinite(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): LoDashExplicitWrapper; + } + + //_.isFunction + interface LoDashStatic { + /** + * Checks if value is classified as a Function object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isFunction(value?: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): LoDashExplicitWrapper; + } + + //_.isMatch + interface isMatchCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between object and source to determine if object contains equivalent property + * values. If customizer is provided it’s invoked to compare values. If customizer returns undefined + * comparisons are handled by the method instead. The customizer is bound to thisArg and invoked with three + * arguments: (value, other, index|key). + * @param object The object to inspect. + * @param source The object of property values to match. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if object is a match, else false. + */ + isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.isMatch + */ + isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + //_.isNaN + interface LoDashStatic { + /** + * Checks if value is NaN. + * + * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * + * @param value The value to check. + * @return Returns true if value is NaN, else false. + */ + isNaN(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + + //_.isNative + interface LoDashStatic { + /** + * Checks if value is a native function. + * @param value The value to check. + * + * @retrun Returns true if value is a native function, else false. + */ + isNative(value: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): LoDashExplicitWrapper; + } + + //_.isNull + interface LoDashStatic { + /** + * Checks if value is null. + * + * @param value The value to check. + * @return Returns true if value is null, else false. + */ + isNull(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): LoDashExplicitWrapper; + } + + //_.isNumber + interface LoDashStatic { + /** + * Checks if value is classified as a Number primitive or object. + * + * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isNumber(value?: any): value is number; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): LoDashExplicitWrapper; + } + + //_.isObject + interface LoDashStatic { + /** + * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), + * and new String('')) + * + * @param value The value to check. + * @return Returns true if value is an object, else false. + */ + isObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): LoDashExplicitWrapper; + } + + //_.isPlainObject + interface LoDashStatic { + /** + * Checks if value is a plain object, that is, an object created by the Object constructor or one with a + * [[Prototype]] of null. + * + * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. + * + * @param value The value to check. + * @return Returns true if value is a plain object, else false. + */ + isPlainObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): LoDashExplicitWrapper; + } + + //_.isRegExp + interface LoDashStatic { + /** + * Checks if value is classified as a RegExp object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isRegExp(value?: any): value is RegExp; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + + //_.isString + interface LoDashStatic { + /** + * Checks if value is classified as a String primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isString(value?: any): value is string; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isString + */ + isString(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isString + */ + isString(): LoDashExplicitWrapper; + } + + //_.isTypedArray + interface LoDashStatic { + /** + * Checks if value is classified as a typed array. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isTypedArray(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): LoDashExplicitWrapper; + } + + //_.isUndefined + interface LoDashStatic { + /** + * Checks if value is undefined. + * + * @param value The value to check. + * @return Returns true if value is undefined, else false. + */ + isUndefined(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): LoDashExplicitWrapper; + } + + //_.lt + interface LoDashStatic { + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + lt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): LoDashExplicitWrapper; + } + + //_.lte + interface LoDashStatic { + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + lte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): LoDashExplicitWrapper; + } + + //_.toArray + interface LoDashStatic { + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + toArray(value: List|Dictionary|NumericDictionary): T[]; + + /** + * @see _.toArray + */ + toArray(value: TValue): TResult[]; + + /** + * @see _.toArray + */ + toArray(value?: any): TResult[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + //_.toPlainObject + interface LoDashStatic { + /** + * Converts value to a plain object flattening inherited enumerable properties of value to own properties + * of the plain object. + * + * @param value The value to convert. + * @return Returns the converted plain object. + */ + toPlainObject(value?: any): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPlainObject + */ + toPlainObject(): LoDashImplicitObjectWrapper; + } + + /******** + * Math * + ********/ + + //_.add + interface LoDashStatic { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + add( + augend: number, + addend: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.add + */ + add(addend: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.add + */ + add(addend: number): LoDashExplicitWrapper; + } + + //_.ceil + interface LoDashStatic { + /** + * Calculates n rounded up to precision. + * + * @param n The number to round up. + * @param precision The precision to round up to. + * @return Returns the rounded up number. + */ + ceil( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): LoDashExplicitWrapper; + } + + //_.floor + interface LoDashStatic { + /** + * Calculates n rounded down to precision. + * + * @param n The number to round down. + * @param precision The precision to round down to. + * @return Returns the rounded down number. + */ + floor( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): LoDashExplicitWrapper; + } + + //_.max + interface LoDashStatic { + /** + * Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the maximum value. + */ + max( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + //_.min + interface LoDashStatic { + /** + * Gets the minimum value of collection. If collection is empty or falsey Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the minimum value. + */ + min( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + //_.round + interface LoDashStatic { + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + round( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): LoDashExplicitWrapper; + } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + */ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum( + collection: List|Dictionary, + iteratee: string + ): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + /********** + * Number * + **********/ + + //_.inRange + interface LoDashStatic { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + inRange( + n: number, + start: number, + end: number + ): boolean; + + + /** + * @see _.inRange + */ + inRange( + n: number, + end: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): boolean; + + /** + * @see _.inRange + */ + inRange(end: number): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): LoDashExplicitWrapper; + + /** + * @see _.inRange + */ + inRange(end: number): LoDashExplicitWrapper; + } + + //_.random + interface LoDashStatic { + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + random( + min?: number, + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random( + min?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): LoDashExplicitWrapper; + + /** + * @see _.random + */ + random(floating?: boolean): LoDashExplicitWrapper; + } + + /********** + * Object * + **********/ + + //_.assign + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources + * overwrite property assignments of previous sources. If customizer is provided it’s invoked to produce the + * assigned values. The customizer is bound to thisArg and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * Note: This method mutates object and is based on Object.assign. + * + * @alias _.extend + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of callback. + * @return The destination object. + */ + assign( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + assign(object: TObject): TObject; + + /** + * @see _.assign + */ + assign( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.create + interface LoDashStatic { + /** + * Creates an object that inherits from the given prototype object. If a properties object is provided its own + * enumerable properties are assigned to the created object. + * + * @param prototype The object to inherit from. + * @param properties The properties to assign to the object. + * @return Returns the new object. + */ + create( + prototype: T, + properties?: U + ): T & U; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashExplicitObjectWrapper; + } + + //_.defaults + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + defaults( + object: Obj, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: {}, + ...sources: {}[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashExplicitObjectWrapper; + } + + //_.defaultsDeep + interface LoDashStatic { + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + defaultsDeep( + object: T, + ...sources: any[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaultsDeep + **/ + defaultsDeep(...sources: any[]): LoDashImplicitObjectWrapper + } + + //_.extend + interface LoDashStatic { + /** + * @see assign + */ + extend( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + extend(object: TObject): TObject; + + /** + * @see _.assign + */ + extend( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.findKey + interface LoDashStatic { + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.findLastKey + interface LoDashStatic { + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findLastKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.forIn + interface LoDashStatic { + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forIn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forIn + */ + forIn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forInRight + interface LoDashStatic { + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forInRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forInRight + */ + forInRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwn + interface LoDashStatic { + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwn + */ + forOwn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwnRight + interface LoDashStatic { + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwnRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwnRight + */ + forOwnRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.functions + interface LoDashStatic { + /** + * Creates an array of function property names from all enumerable properties, own and inherited, of object. + * + * @alias _.methods + * + * @param object The object to inspect. + * @return Returns the new array of property names. + */ + functions(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashExplicitArrayWrapper; + } + + //_.get + interface LoDashStatic { + /** + * Gets the property value at path of object. If the resolved + * value is undefined the defaultValue is used in its place. + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + **/ + get(object: Object, + path: string|number|boolean|Array, + defaultValue?:TResult + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.get + **/ + get(path: string|number|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.has + interface LoDashStatic { + /** + * Checks if path is a direct property. + * + * @param object The object to query. + * @param path The path to check. + * @return Returns true if path is a direct property, else false. + */ + has( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + + //_.invert + interface LoDashStatic { + /** + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + invert( + object: T, + multiValue?: boolean + ): TResult; + + /** + * @see _.invert + */ + invert( + object: Object, + multiValue?: boolean + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashExplicitObjectWrapper; + } + + //_.keys + interface LoDashStatic { + /** + * Creates an array of the own enumerable property names of object. + * + * Note: Non-object values are coerced to objects. See the ES spec for more details. + * + * @param object The object to query. + * @return Returns the array of property names. + */ + keys(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashExplicitArrayWrapper; + } + + //_.keysIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property names of object. + * + * Note: Non-object values are coerced to objects. + * + * @param object The object to query. + * @return An array of property names. + */ + keysIn(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashExplicitArrayWrapper; + } + + //_.mapKeys + interface LoDashStatic { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + mapKeys( + object: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: TObject + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + //_.mapValues + interface LoDashStatic { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Object} [thisArg] The `this` binding of `iteratee`. + * @return {Object} Returns the new mapped object. + */ + mapValues(obj: Dictionary, callback: ObjectIterator, thisArg?: any): Dictionary; + mapValues(obj: Dictionary, where: Dictionary): Dictionary; + mapValues(obj: T, pluck: string): TMapped; + mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapValues + * TValue is the type of the property values of T. + * TResult is the type output by the ObjectIterator function + */ + mapValues(callback: ObjectIterator, thisArg?: any): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * T should be a Dictionary> + */ + mapValues(pluck: string): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties on the object specified by pluck. + * T should be a Dictionary>> + */ + mapValues(pluck: string, where: Dictionary): LoDashImplicitArrayWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties of each object in the values of T + * T should be a Dictionary> + */ + mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + } + + //_.merge + interface MergeCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + + interface LoDashStatic { + /** + * Recursively merges own enumerable properties of the source object(s), that don’t resolve to undefined into + * the destination object. Subsequent sources overwrite property assignments of previous sources. If customizer + * is provided it’s invoked to produce the merged values of the destination and source properties. If + * customizer returns undefined merging is handled by the method instead. The customizer is bound to thisArg + * and invoked with five arguments: (objectValue, sourceValue, key, object, source). + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of customizer. + * @return Returns object. + */ + merge( + object: TObject, + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + + /** + * @see _.merge + */ + merge( + object: any, + ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashImplicitObjectWrapper; + } + + //_.methods + interface LoDashStatic { + /** + * @see _.functions + */ + methods(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashExplicitArrayWrapper; + } + + //_.omit + interface LoDashStatic { + /** + * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable + * properties of object that are not omitted. + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to omit, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + omit( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.omit + */ + omit( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.pairs + interface LoDashStatic { + /** + * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + pairs(object?: T): any[][]; + + pairs(object?: T): TResult[][]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashExplicitArrayWrapper; + } + + //_.pick + interface LoDashStatic { + /** + * Creates an object composed of the picked object properties. Property names may be specified as individual + * arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object + * picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with + * three arguments: (value, key, object). + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to pick, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + pick( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.pick + */ + pick( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.result + interface LoDashStatic { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + result( + object: TObject, + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.result + */ + result( + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.set + interface LoDashStatic { + /** + * Sets the property value of path on object. If a portion of path does not exist it’s created. + * + * @param object The object to augment. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + set( + object: T, + path: StringRepresentable|StringRepresentable[], + value: any + ): T; + + /** + * @see _.set + */ + set( + object: T, + path: StringRepresentable|StringRepresentable[], + value: V + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashExplicitObjectWrapper; + } + + //_.transform + interface LoDashStatic { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + + /** + * @see _.transform + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.values + interface LoDashStatic { + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + values(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashExplicitArrayWrapper; + } + + //_.valuesIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ + valuesIn(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashExplicitArrayWrapper; + } + + /********** + * String * + **********/ + + //_.camelCase + interface LoDashStatic { + /** + * Converts string to camel case. + * + * @param string The string to convert. + * @return Returns the camel cased string. + */ + camelCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): LoDashExplicitWrapper; + } + + //_.capitalize + interface LoDashStatic { + capitalize(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): LoDashExplicitWrapper; + } + + //_.deburr + interface LoDashStatic { + /** + * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining + * diacritical marks. + * + * @param string The string to deburr. + * @return Returns the deburred string. + */ + deburr(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.deburr + */ + deburr(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.deburr + */ + deburr(): LoDashExplicitWrapper; + } + + //_.endsWith + interface LoDashStatic { + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + endsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + // _.escape + interface LoDashStatic { + /** + * Converts the characters "&", "<", ">", '"', "'", and "`", in string to their corresponding HTML entities. + * + * Note: No other characters are escaped. To escape additional characters use a third-party library like he. + * + * Though the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML + * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s + * article (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in Internet Explorer < 9, they can break out of attribute values or HTML + * comments. See #59, #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. + * + * When working with HTML you should always quote attribute values to reduce XSS vectors. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escape + */ + escape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escape + */ + escape(): LoDashExplicitWrapper; + } + + // _.escapeRegExp + interface LoDashStatic { + /** + * Escapes the RegExp special characters "\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "[", "]", + * "{" and "}" in string. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escapeRegExp(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): LoDashExplicitWrapper; + } + + //_.kebabCase + interface LoDashStatic { + /** + * Converts string to kebab case. + * + * @param string The string to convert. + * @return Returns the kebab cased string. + */ + kebabCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): LoDashExplicitWrapper; + } + + //_.pad + interface LoDashStatic { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + pad( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padLeft + interface LoDashStatic { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padLeft( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padRight + interface LoDashStatic { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padRight( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.parseInt + interface LoDashStatic { + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + parseInt( + string: string, + radix?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): LoDashExplicitWrapper; + } + + //_.repeat + interface LoDashStatic { + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + repeat( + string?: string, + n?: number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): LoDashExplicitWrapper; + } + + //_.snakeCase + interface LoDashStatic { + /** + * Converts string to snake case. + * + * @param string The string to convert. + * @return Returns the snake cased string. + */ + snakeCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): LoDashExplicitWrapper; + } + + //_.startCase + interface LoDashStatic { + /** + * Converts string to start case. + * + * @param string The string to convert. + * @return Returns the start cased string. + */ + startCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startCase + */ + startCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startCase + */ + startCase(): LoDashExplicitWrapper; + } + + //_.startsWith + interface LoDashStatic { + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + startsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + //_.template + interface TemplateOptions extends TemplateSettings { + /** + * The sourceURL of the template's compiled source. + */ + sourceURL?: string; + } + + interface TemplateExecutor { + (data?: Object): string; + source: string; + } + + interface LoDashStatic { + /** + * Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, + * HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" + * delimiters. Data properties may be accessed as free variables in the template. If a setting object is + * provided it takes precedence over _.templateSettings values. + * + * Note: In the development build _.template utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier + * debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @param string The template string. + * @param options The options object. + * @param options.escape The HTML "escape" delimiter. + * @param options.evaluate The "evaluate" delimiter. + * @param options.imports An object to import into the template as free variables. + * @param options.interpolate The "interpolate" delimiter. + * @param options.sourceURL The sourceURL of the template's compiled source. + * @param options.variable The data object variable name. + * @return Returns the compiled template function. + */ + template( + string: string, + options?: TemplateOptions + ): TemplateExecutor; + } + + interface LoDashImplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): TemplateExecutor; + } + + interface LoDashExplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): LoDashExplicitObjectWrapper; + } + + //_.trim + interface LoDashStatic { + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trim( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): LoDashExplicitWrapper; + } + + //_.trimLeft + interface LoDashStatic { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimLeft( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): LoDashExplicitWrapper; + } + + //_.trimRight + interface LoDashStatic { + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimRight( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): LoDashExplicitWrapper; + } + + //_.trunc + interface TruncOptions { + /** The maximum string length. */ + length?: number; + /** The string to indicate text is omitted. */ + omission?: string; + /** The separator pattern to truncate to. */ + separator?: string|RegExp; + } + + interface LoDashStatic { + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + trunc( + string?: string, + options?: TruncOptions|number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + } + + //_.unescape + interface LoDashStatic { + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + unescape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.unescape + */ + unescape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unescape + */ + unescape(): LoDashExplicitWrapper; + } + + //_.words + interface LoDashStatic { + /** + * Splits string into an array of its words. + * + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of string. + */ + words( + string?: string, + pattern?: string|RegExp + ): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): string[]; + } + + interface LoDashExplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): LoDashExplicitArrayWrapper; + } + + /*********** + * Utility * + ***********/ + + //_.attempt + interface LoDashStatic { + /** + * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments + * are provided to func when it’s invoked. + * + * @param func The function to attempt. + * @return Returns the func result or error object. + */ + attempt(func: (...args: any[]) => TResult): TResult|Error; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(): TResult|Error; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(): LoDashExplicitObjectWrapper; + } + + //_.callback + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. + * If func is a property name the created callback returns the property value for a given element. If func is + * an object the created callback returns true for elements that contain the equivalent object properties, + * otherwise it returns false. + * + * @param func The value to convert to a callback. + * @param thisArg The this binding of func. + * @result Returns the callback. + */ + callback( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + callback( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + callback( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + callback(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.constant + interface LoDashStatic { + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + constant(value: T): () => T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashImplicitObjectWrapper<() => TResult>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashExplicitObjectWrapper<() => TResult>; + } + + //_.identity + interface LoDashStatic { + /** + * This method returns the first argument provided to it. + * @param value Any value. + * @return Returns value. + */ + identity(value?: T): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.identity + */ + identity(): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + //_.iteratee + interface LoDashStatic { + /** + * @see _.callback + */ + iteratee( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + iteratee(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.matches + interface LoDashStatic { + /** + * Creates a function that performs a deep comparison between a given object and source, returning true if the + * given object has equivalent property values, else false. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own + * or inherited property value see _.matchesProperty. + * + * @param source The object of property values to match. + * @return Returns the new function. + */ + matches(source: T): (value: any) => boolean; + + /** + * @see _.matches + */ + matches(source: T): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashImplicitObjectWrapper<(value: V) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashExplicitObjectWrapper<(value: V) => boolean>; + } + + //_.matchesProperty + interface LoDashStatic { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: any) => boolean; + + /** + * @see _.matchesProperty + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: Value) => boolean>; + } + + //_.method + interface LoDashStatic { + /** + * Creates a function that invokes the method at path on a given object. Any additional arguments are provided + * to the invoked method. + * + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: TObject) => TResult; + + /** + * @see _.method + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: any) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + //_.methodOf + interface LoDashStatic { + /** + * The opposite of _.method; this method creates a function that invokes the method at a given path on object. + * Any additional arguments are provided to the invoked method. + * + * @param object The object to query. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + methodOf( + object: TObject, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + + /** + * @see _.methodOf + */ + methodOf( + object: {}, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashImplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashExplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + //_.mixin + interface MixinOptions { + chain?: boolean; + } + + interface LoDashStatic { + /** + * Adds all own enumerable function properties of a source object to the destination object. If object is a + * function then methods are added to its prototype as well. + * + * Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying + * the original. + * + * @param object The destination object. + * @param source The object of functions to add. + * @param options The options object. + * @param options.chain Specify whether the functions added are chainable. + * @return Returns object. + */ + mixin( + object: TObject, + source: Dictionary, + options?: MixinOptions + ): TResult; + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + } + + //_.noConflict + interface LoDashStatic { + /** + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + noConflict(): typeof _; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noConflict + */ + noConflict(): typeof _; + } + + //_.noop + interface LoDashStatic { + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * + * @return undefined + */ + noop(...args: any[]): void; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): void; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): _.LoDashExplicitWrapper; + } + + //_.property + interface LoDashStatic { + /** + * Creates a function that returns the property value at path on a given object. + * + * @param path The path of the property to get. + * @return Returns the new function. + */ + property(path: StringRepresentable|StringRepresentable[]): (obj: TObj) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + //_.propertyOf + interface LoDashStatic { + /** + * The opposite of _.property; this method creates a function that returns the property value at a given path + * on object. + * + * @param object The object to query. + * @return Returns the new function. + */ + propertyOf(object: T): (path: string|string[]) => any; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + } + + //_.range + interface LoDashStatic { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + range( + start: number, + end: number, + step?: number + ): number[]; + + /** + * @see _.range + */ + range( + end: number, + step?: number + ): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashExplicitArrayWrapper; + } + + //_.runInContext + interface LoDashStatic { + /** + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + runInContext(context?: Object): typeof _; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.runInContext + */ + runInContext(): typeof _; + } + + //_.times + interface LoDashStatic { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee is + * bound to thisArg and invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the array of results. + */ + times( + n: number, + iteratee: (num: number) => TResult, + thisArg?: any + ): TResult[]; + + /** + * @see _.times + */ + times(n: number): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashExplicitArrayWrapper; + } + + //_.uniqueId + interface LoDashStatic { + /** + * Generates a unique ID. If prefix is provided the ID is appended to it. + * + * @param prefix The value to prefix the ID with. + * @return Returns the unique ID. + */ + uniqueId(prefix?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): LoDashExplicitWrapper; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface NumericDictionaryIterator { + (value: T, key?: number, collection?: Dictionary): TResult; + } + + interface ObjectIterator { + (element: T, key?: string, collection?: any): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MemoVoidIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; + } + interface MemoIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; + } + + interface MemoVoidArrayIterator { + (acc: TResult, curr: T, index?: number, arr?: T[]): void; + } + interface MemoVoidDictionaryIterator { + (acc: TResult, curr: T, key?: string, dict?: Dictionary): void; + } + + //interface Collection {} + + // Common interface between Arrays and jQuery objects + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface NumericDictionary { + [index: number]: T; + } + + interface StringRepresentable { + toString(): string; + } + + interface Cancelable { + cancel(): void; + } +} + +declare module "lodash" { + export = _; +} diff --git a/lodash/lodash-tests-3.10.ts b/lodash/lodash-tests-3.10.ts new file mode 100644 index 000000000..efe2e1b3e --- /dev/null +++ b/lodash/lodash-tests-3.10.ts @@ -0,0 +1,10016 @@ +/// + +declare var $: any, jQuery: any; + +interface IFoodOrganic { + name: string; + organic: boolean; +} + +interface IFoodType { + name: string; + type: string; +} + +interface IFoodCombined { + name: string; + organic: boolean; + type: string; +} + +interface IStoogesQuote { + name: string; + quotes: string[]; +} + +interface IStoogesAge { + name: string; + age: number; +} + +interface IStoogesCombined { + name: string; + age: number; + quotes: string[]; +} + +interface IKey { + dir: string; + code: number; +} + +interface IDictionary { + [index: string]: T; +} + +var foodsOrganic: IFoodOrganic[] = [ + { name: 'banana', organic: true }, + { name: 'beet', organic: false }, +]; +var foodsType: IFoodType[] = [ + { name: 'apple', type: 'fruit' }, + { name: 'banana', type: 'fruit' }, + { name: 'beet', type: 'vegetable' } +]; +var foodsCombined: IFoodCombined[] = [ + { 'name': 'apple', 'organic': false, 'type': 'fruit' }, + { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } +]; + +var stoogesQuotes: IStoogesQuote[] = [ + { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, + { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] } +]; +var stoogesAges: IStoogesAge[] = [ + { 'name': 'moe', 'age': 40 }, + { 'name': 'larry', 'age': 50 } +]; +var stoogesAgesDict: IDictionary = { + first: { 'name': 'moe', 'age': 40 }, + second: { 'name': 'larry', 'age': 50 } +}; +var stoogesCombined: IStoogesCombined[] = [ + { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, + { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } +]; + +var keys: IKey[] = [ + { 'dir': 'left', 'code': 97 }, + { 'dir': 'right', 'code': 100 } +]; + +class Dog { + constructor(public name: string) { } + + public bark() { + console.log('Woof, woof!'); + } +} + +var result: any; + +var any: any; + +interface TResult { + a: number; + b: string; + c: boolean; +} + +// _.MapCache +var testMapCache: _.MapCache; +result = <(key: string) => boolean>testMapCache.delete; +result = <(key: string) => any>testMapCache.get; +result = <(key: string) => boolean>testMapCache.has; +result = <(key: string, value: any) => _.Dictionary>testMapCache.set; + +// _ +module TestWrapper { + { + let result: _.LoDashImplicitWrapper; + result = _(''); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(42); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(['']); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + result = _<{a: string}>({a: ''}); + } +} + +//Wrapped array shortcut methods +result = _([1, 2, 3, 4]).join(','); +result = _([1, 2, 3, 4]).pop(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).push(5, 6, 7); +result = _([1, 2, 3, 4]).shift(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6); + +/********* + * Array * + *********/ + +// _.chunk +module TestChunk { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[][]; + + result = _.chunk(array); + result = _.chunk(array, 42); + + result = _.chunk(list); + result = _.chunk(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).chunk(); + result = _(array).chunk(42); + + result = _(list).chunk(); + result = _(list).chunk(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().chunk(); + result = _(array).chain().chunk(42); + + result = _(list).chain().chunk(); + result = _(list).chain().chunk(42); + } +} + +// _.compact +module TestCompact { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.compact(); + result = _.compact(array); + result = _.compact(list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).compact(); + result = _(list).compact(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().compact(); + result = _(list).chain().compact(); + } +} + +// _.difference +module TestDifference { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.difference(array); + result = _.difference(array, array); + result = _.difference(array, list, array); + result = _.difference(array, array, list, array); + + result = _.difference(list); + result = _.difference(list, list); + result = _.difference(list, array, list); + result = _.difference(list, list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).difference(); + result = _(array).difference(array); + result = _(array).difference(list, array); + result = _(array).difference(array, list, array); + + result = _(list).difference(); + result = _(list).difference(list); + result = _(list).difference(array, list); + result = _(list).difference(list, array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().difference(); + result = _(array).chain().difference(array); + result = _(array).chain().difference(list, array); + result = _(array).chain().difference(array, list, array); + + result = _(list).chain().difference(); + result = _(list).chain().difference(list); + result = _(list).chain().difference(array, list); + result = _(list).chain().difference(list, array, list); + } +} + +// _.drop +{ + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + result = _.drop(array); + result = _.drop(array, 42); + + result = _.drop(list); + result = _.drop(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).drop(); + result = _(array).drop(42); + + result = _(list).drop(); + result = _(list).drop(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().drop(); + result = _(array).chain().drop(42); + + result = _(list).chain().drop(); + result = _(list).chain().drop(42); + } +} + +// _.dropRight +module TestDropRight { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.dropRight(array); + result = _.dropRight(array, 42); + + result = _.dropRight(list); + result = _.dropRight(list, 42); + + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).dropRight(); + result = _(array).dropRight(42); + + result = _(list).dropRight(); + result = _(list).dropRight(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().dropRight(); + result = _(array).chain().dropRight(42); + + result = _(list).chain().dropRight(); + result = _(list).chain().dropRight(42); + } +} + +// _.dropRightWhile +module TestDropRightWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.dropRightWhile(array); + result = _.dropRightWhile(array, predicateFn); + result = _.dropRightWhile(array, predicateFn, any); + result = _.dropRightWhile(array, ''); + result = _.dropRightWhile(array, '', any); + result = _.dropRightWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.dropRightWhile(list); + result = _.dropRightWhile(list, predicateFn); + result = _.dropRightWhile(list, predicateFn, any); + result = _.dropRightWhile(list, ''); + result = _.dropRightWhile(list, '', any); + result = _.dropRightWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).dropRightWhile(); + result = _(array).dropRightWhile(predicateFn); + result = _(array).dropRightWhile(predicateFn, any); + result = _(array).dropRightWhile(''); + result = _(array).dropRightWhile('', any); + result = _(array).dropRightWhile<{a: number;}>({a: 42}); + + result = _(list).dropRightWhile(); + result = _(list).dropRightWhile(predicateFn); + result = _(list).dropRightWhile(predicateFn, any); + result = _(list).dropRightWhile(''); + result = _(list).dropRightWhile('', any); + result = _(list).dropRightWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().dropRightWhile(); + result = _(array).chain().dropRightWhile(predicateFn); + result = _(array).chain().dropRightWhile(predicateFn, any); + result = _(array).chain().dropRightWhile(''); + result = _(array).chain().dropRightWhile('', any); + result = _(array).chain().dropRightWhile<{a: number;}>({a: 42}); + + result = _(list).chain().dropRightWhile(); + result = _(list).chain().dropRightWhile(predicateFn); + result = _(list).chain().dropRightWhile(predicateFn, any); + result = _(list).chain().dropRightWhile(''); + result = _(list).chain().dropRightWhile('', any); + result = _(list).chain().dropRightWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.dropWhile +module TestDropWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.dropWhile(array); + result = _.dropWhile(array, predicateFn); + result = _.dropWhile(array, predicateFn, any); + result = _.dropWhile(array, ''); + result = _.dropWhile(array, '', any); + result = _.dropWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.dropWhile(list); + result = _.dropWhile(list, predicateFn); + result = _.dropWhile(list, predicateFn, any); + result = _.dropWhile(list, ''); + result = _.dropWhile(list, '', any); + result = _.dropWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).dropWhile(); + result = _(array).dropWhile(predicateFn); + result = _(array).dropWhile(predicateFn, any); + result = _(array).dropWhile(''); + result = _(array).dropWhile('', any); + result = _(array).dropWhile<{a: number;}>({a: 42}); + + result = _(list).dropWhile(); + result = _(list).dropWhile(predicateFn); + result = _(list).dropWhile(predicateFn, any); + result = _(list).dropWhile(''); + result = _(list).dropWhile('', any); + result = _(list).dropWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().dropWhile(); + result = _(array).chain().dropWhile(predicateFn); + result = _(array).chain().dropWhile(predicateFn, any); + result = _(array).chain().dropWhile(''); + result = _(array).chain().dropWhile('', any); + result = _(array).chain().dropWhile<{a: number;}>({a: 42}); + + result = _(list).chain().dropWhile(); + result = _(list).chain().dropWhile(predicateFn); + result = _(list).chain().dropWhile(predicateFn, any); + result = _(list).chain().dropWhile(''); + result = _(list).chain().dropWhile('', any); + result = _(list).chain().dropWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.fill +module TestFill { + let array: number[]; + let list: _.List; + + { + let result: number[]; + + result = _.fill(array, 42); + result = _.fill(array, 42, 0); + result = _.fill(array, 42, 0, 10); + } + + { + let result: _.List; + + result = _.fill(list, 42); + result = _.fill(list, 42, 0); + result = _.fill(list, 42, 0, 10); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).fill(42); + result = _(array).fill(42, 0); + result = _(array).fill(42, 0, 10); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + result = _(list).fill(42); + result = _(list).fill(42, 0); + result = _(list).fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().fill(42); + result = _(array).chain().fill(42, 0); + result = _(array).chain().fill(42, 0, 10); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().fill(42); + result = _(list).chain().fill(42, 0); + result = _(list).chain().fill(42, 0, 10); + } +} + +// _.findIndex +module TestFindIndex { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + + { + let result: number; + + result = _.findIndex(array); + result = _.findIndex(array, predicateFn); + result = _.findIndex(array, predicateFn, any); + result = _.findIndex(array, ''); + result = _.findIndex(array, '', any); + result = _.findIndex<{a: number}, TResult>(array, {a: 42}); + + result = _.findIndex(list); + result = _.findIndex(list, predicateFn); + result = _.findIndex(list, predicateFn, any); + result = _.findIndex(list, ''); + result = _.findIndex(list, '', any); + result = _.findIndex<{a: number}, TResult>(list, {a: 42}); + + result = _(array).findIndex(); + result = _(array).findIndex(predicateFn); + result = _(array).findIndex(predicateFn, any); + result = _(array).findIndex(''); + result = _(array).findIndex('', any); + result = _(array).findIndex<{a: number}>({a: 42}); + + result = _(list).findIndex(); + result = _(list).findIndex(predicateFn); + result = _(list).findIndex(predicateFn, any); + result = _(list).findIndex(''); + result = _(list).findIndex('', any); + result = _(list).findIndex<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().findIndex(); + result = _(array).chain().findIndex(predicateFn); + result = _(array).chain().findIndex(predicateFn, any); + result = _(array).chain().findIndex(''); + result = _(array).chain().findIndex('', any); + result = _(array).chain().findIndex<{a: number}>({a: 42}); + + result = _(list).chain().findIndex(); + result = _(list).chain().findIndex(predicateFn); + result = _(list).chain().findIndex(predicateFn, any); + result = _(list).chain().findIndex(''); + result = _(list).chain().findIndex('', any); + result = _(list).chain().findIndex<{a: number}>({a: 42}); + } +} + +// _.findLastIndex +module TestFindLastIndex { + let array: TResult[]; + let list: _.List; + + let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + + { + let result: number; + + result = _.findLastIndex(array); + result = _.findLastIndex(array, predicateFn); + result = _.findLastIndex(array, predicateFn, any); + result = _.findLastIndex(array, ''); + result = _.findLastIndex(array, '', any); + result = _.findLastIndex<{a: number}, TResult>(array, {a: 42}); + + result = _.findLastIndex(list); + result = _.findLastIndex(list, predicateFn); + result = _.findLastIndex(list, predicateFn, any); + result = _.findLastIndex(list, ''); + result = _.findLastIndex(list, '', any); + result = _.findLastIndex<{a: number}, TResult>(list, {a: 42}); + + result = _(array).findLastIndex(); + result = _(array).findLastIndex(predicateFn); + result = _(array).findLastIndex(predicateFn, any); + result = _(array).findLastIndex(''); + result = _(array).findLastIndex('', any); + result = _(array).findLastIndex<{a: number}>({a: 42}); + + result = _(list).findLastIndex(); + result = _(list).findLastIndex(predicateFn); + result = _(list).findLastIndex(predicateFn, any); + result = _(list).findLastIndex(''); + result = _(list).findLastIndex('', any); + result = _(list).findLastIndex<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().findLastIndex(); + result = _(array).chain().findLastIndex(predicateFn); + result = _(array).chain().findLastIndex(predicateFn, any); + result = _(array).chain().findLastIndex(''); + result = _(array).chain().findLastIndex('', any); + result = _(array).chain().findLastIndex<{a: number}>({a: 42}); + + result = _(list).chain().findLastIndex(); + result = _(list).chain().findLastIndex(predicateFn); + result = _(list).chain().findLastIndex(predicateFn, any); + result = _(list).chain().findLastIndex(''); + result = _(list).chain().findLastIndex('', any); + result = _(list).chain().findLastIndex<{a: number}>({a: 42}); + } +} + +// _.first +module TestFirst { + let array: TResult[]; + let list: _.List; + let result: TResult; + result = _.first(array); + result = _.first(list); + result = _(array).first(); + result = _(list).first(); +} + +// _.flatten +module TestFlatten { + { + let result: string[]; + + result = _.flatten('abc'); + } + + { + let result: number[]; + + result = _.flatten([1, 2, 3]); + result = _.flatten([1, [2, 3]]); + result = _.flatten([1, [2, [3]]], true); + result = _.flatten([1, [2, [3]], [[4]]], true); + + result = _.flatten({0: 1, 1: 2, 2: 3, length: 3}); + result = _.flatten({0: 1, 1: [2, 3], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], length: 2}, true); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}, true); + } + + { + let result: _.RecursiveArray; + + result = _.flatten([1, [2, [3]]]); + result = _.flatten([1, [2, [3]], [[4]]]); + + result = _.flatten({0: 1, 1: [2, [3]], length: 2}); + result = _.flatten({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').flatten(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).flatten(); + result = _([1, [2, 3]]).flatten(); + result = _([1, [2, [3]]]).flatten(true); + result = _([1, [2, [3]], [[4]]]).flatten(true); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).flatten(); + result = _({0: 1, 1: [2, 3], length: 2}).flatten(); + result = _({0: 1, 1: [2, [3]], length: 2}).flatten(true); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, [2, [3]]]).flatten(); + result = _([1, [2, [3]], [[4]]]).flatten(); + + result = _({0: 1, 1: [2, [3]], length: 2}).flatten(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flatten(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().flatten(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().flatten(); + result = _([1, [2, 3]]).chain().flatten(); + result = _([1, [2, [3]]]).chain().flatten(true); + result = _([1, [2, [3]], [[4]]]).chain().flatten(true); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flatten(); + result = _({0: 1, 1: [2, 3], length: 2}).chain().flatten(); + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(true); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(true); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, [2, [3]]]).chain().flatten(); + result = _([1, [2, [3]], [[4]]]).chain().flatten(); + + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flatten(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flatten(); + } +} + +// _.flattenDeep +module TestFlattenDeep { + { + let result: string[]; + + result = _.flattenDeep('abc'); + } + + { + let result: number[]; + + result = _.flattenDeep([1, 2, 3]); + result = _.flattenDeep([1, [2, 3]]); + result = _.flattenDeep([1, [2, [3]]]); + result = _.flattenDeep([1, [2, [3]], [[4]]]); + + result = _.flattenDeep({0: 1, 1: 2, 2: 3, length: 3}); + result = _.flattenDeep({0: 1, 1: [2, 3], length: 2}); + result = _.flattenDeep({0: 1, 1: [2, [3]], length: 2}); + result = _.flattenDeep({0: 1, 1: [2, [3]], 2: [[4]], length: 3}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').flattenDeep(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).flattenDeep(); + result = _([1, [2, 3]]).flattenDeep(); + result = _([1, [2, [3]]]).flattenDeep(); + result = _([1, [2, [3]], [[4]]]).flattenDeep(); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).flattenDeep(); + result = _({0: 1, 1: [2, 3], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, [2, [3]]]).flattenDeep(); + result = _([1, [2, [3]], [[4]]]).flattenDeep(); + + result = _({0: 1, 1: [2, [3]], length: 2}).flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().flattenDeep(); + result = _([1, [2, 3]]).chain().flattenDeep(); + result = _([1, [2, [3]]]).chain().flattenDeep(); + result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); + + result = _({0: 1, 1: 2, 2: 3, length: 3}).chain().flattenDeep(); + result = _({0: 1, 1: [2, 3], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, [2, [3]]]).chain().flattenDeep(); + result = _([1, [2, [3]], [[4]]]).chain().flattenDeep(); + + result = _({0: 1, 1: [2, [3]], length: 2}).chain().flattenDeep(); + result = _({0: 1, 1: [2, [3]], 2: [[4]], length: 3}).chain().flattenDeep(); + } +} + +// _.head +module TestHead { + let array: TResult[]; + let list: _.List; + let result: TResult; + result = _.head(array); + result = _.head(list); + result = _(array).head(); + result = _(list).head(); +} + +// _.indexOf +module TestIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: number; + + result = _.indexOf(array, value); + result = _.indexOf(array, value, true); + result = _.indexOf(array, value, 42); + + result = _.indexOf(list, value); + result = _.indexOf(list, value, true); + result = _.indexOf(list, value, 42); + + result = _(array).indexOf(value); + result = _(array).indexOf(value, true); + result = _(array).indexOf(value, 42); + + result = _(list).indexOf(value); + result = _(list).indexOf(value, true); + result = _(list).indexOf(value, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().indexOf(value); + result = _(array).chain().indexOf(value, true); + result = _(array).chain().indexOf(value, 42); + + result = _(list).chain().indexOf(value); + result = _(list).chain().indexOf(value, true); + result = _(list).chain().indexOf(value, 42); + } +} + +//_.initial +module TestInitial { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.initial(array); + result = _.initial(list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).initial(); + result = _(list).initial(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().initial(); + result = _(list).chain().initial(); + } +} + +// _.intersection +module TestIntersection { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.intersection(array, list); + result = _.intersection(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).intersection(array); + result = _(array).intersection(list, array); + + result = _(list).intersection(array); + result = _(list).intersection(list, array); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().intersection(array); + result = _(array).chain().intersection(list, array); + + result = _(list).chain().intersection(array); + result = _(list).chain().intersection(list, array); + } +} + +// _.last +module TestLast { + let array: TResult[]; + let list: _.List; + + { + let result: TResult; + + result = _.last(array); + result = _.last(list); + + result = _(array).last(); + result = _(list).last(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().last(); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().last<_.List>(); + } +} + +// _.lastIndexOf +module TestLastIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: number; + + result = _.lastIndexOf(array, value); + result = _.lastIndexOf(array, value, true); + result = _.lastIndexOf(array, value, 42); + + result = _.lastIndexOf(list, value); + result = _.lastIndexOf(list, value, true); + result = _.lastIndexOf(list, value, 42); + + result = _(array).lastIndexOf(value); + result = _(array).lastIndexOf(value, true); + result = _(array).lastIndexOf(value, 42); + + result = _(list).lastIndexOf(value); + result = _(list).lastIndexOf(value, true); + result = _(list).lastIndexOf(value, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().lastIndexOf(value); + result = _(array).chain().lastIndexOf(value, true); + result = _(array).chain().lastIndexOf(value, 42); + + result = _(list).chain().lastIndexOf(value); + result = _(list).chain().lastIndexOf(value, true); + result = _(list).chain().lastIndexOf(value, 42); + } +} + +// _.object +module TestObject { + let arrayOfKeys: string[]; + let arrayOfValues: number[]; + let arrayOfKeyValuePairs: (string|number)[][] + + let listOfKeys: _.List; + let listOfValues: _.List; + let listOfKeyValuePairs: _.List<_.List>; + + { + let result: _.Dictionary; + + result = _.object<_.Dictionary>(arrayOfKeys); + result = _.object<_.Dictionary>(listOfKeys); + } + + { + let result: _.Dictionary; + + result = _.object<_.Dictionary>(arrayOfKeys, arrayOfValues); + result = _.object<_.Dictionary>(arrayOfKeys, listOfValues); + result = _.object<_.Dictionary>(listOfKeys, listOfValues); + result = _.object<_.Dictionary>(listOfKeys, arrayOfValues); + + result = _.object>(arrayOfKeys, arrayOfValues); + result = _.object>(arrayOfKeys, listOfValues); + result = _.object>(listOfKeys, listOfValues); + result = _.object>(listOfKeys, arrayOfValues); + + result = _.object<_.Dictionary>(arrayOfKeyValuePairs); + result = _.object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.Dictionary; + + result = _.object(arrayOfKeys); + result = _.object(arrayOfKeys, arrayOfValues); + result = _.object(arrayOfKeys, listOfValues); + + result = _.object(listOfKeys); + result = _.object(listOfKeys, listOfValues); + result = _.object(listOfKeys, arrayOfValues); + + result = _.object<_.Dictionary>(arrayOfKeyValuePairs); + result = _.object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).object<_.Dictionary>(); + result = _(listOfKeys).object<_.Dictionary>(); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).object<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).object<_.Dictionary>(listOfValues); + result = _(listOfKeys).object<_.Dictionary>(listOfValues); + result = _(listOfKeys).object<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).object>(arrayOfValues); + result = _(arrayOfKeys).object>(listOfValues); + result = _(listOfKeys).object>(listOfValues); + result = _(listOfKeys).object>(arrayOfValues); + + result = _(listOfKeys).object<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).object(); + result = _(arrayOfKeys).object(arrayOfValues); + result = _(arrayOfKeys).object(listOfValues); + + result = _(listOfKeys).object(); + result = _(listOfKeys).object(listOfValues); + result = _(listOfKeys).object(arrayOfValues); + + result = _(listOfKeys).object(arrayOfKeyValuePairs); + result = _(listOfKeys).object(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().object<_.Dictionary>(); + result = _(listOfKeys).chain().object<_.Dictionary>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().object<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).chain().object<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().object<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).chain().object>(arrayOfValues); + result = _(arrayOfKeys).chain().object>(listOfValues); + result = _(listOfKeys).chain().object>(listOfValues); + result = _(listOfKeys).chain().object>(arrayOfValues); + + result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().object<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().object(); + result = _(arrayOfKeys).chain().object(arrayOfValues); + result = _(arrayOfKeys).chain().object(listOfValues); + + result = _(listOfKeys).chain().object(); + result = _(listOfKeys).chain().object(listOfValues); + result = _(listOfKeys).chain().object(arrayOfValues); + + result = _(listOfKeys).chain().object(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().object(listOfKeyValuePairs); + } +} + +// _.pull +module TestPull { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: TResult[]; + + result = _.pull(array); + result = _.pull(array, value); + result = _.pull(array, value, value); + result = _.pull(array, value, value, value); + } + + { + let result: _.List; + + result = _.pull(list); + result = _.pull(list, value); + result = _.pull(list, value, value); + result = _.pull(list, value, value, value); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).pull(); + result = _(array).pull(value); + result = _(array).pull(value, value); + result = _(array).pull(value, value, value); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + result = _(list).pull(); + result = _(list).pull(value); + result = _(list).pull(value, value); + result = _(list).pull(value, value, value); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().pull(); + result = _(array).chain().pull(value); + result = _(array).chain().pull(value, value); + result = _(array).chain().pull(value, value, value); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + result = _(list).chain().pull(); + result = _(list).chain().pull(value); + result = _(list).chain().pull(value, value); + result = _(list).chain().pull(value, value, value); + } +} + +// _.pullAt +module TestPullAt { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.pullAt(array); + result = _.pullAt(array, 1); + result = _.pullAt(array, [2, 3], 1); + result = _.pullAt(array, 4, [2, 3], 1); + + result = _.pullAt(list); + result = _.pullAt(list, 1); + result = _.pullAt(list, [2, 3], 1); + result = _.pullAt(list, 4, [2, 3], 1); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).pullAt(); + result = _(array).pullAt(1); + result = _(array).pullAt([2, 3], 1); + result = _(array).pullAt(4, [2, 3], 1); + + result = _(list).pullAt(); + result = _(list).pullAt(1); + result = _(list).pullAt([2, 3], 1); + result = _(list).pullAt(4, [2, 3], 1); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().pullAt(); + result = _(array).chain().pullAt(1); + result = _(array).chain().pullAt([2, 3], 1); + result = _(array).chain().pullAt(4, [2, 3], 1); + + result = _(list).chain().pullAt(); + result = _(list).chain().pullAt(1); + result = _(list).chain().pullAt([2, 3], 1); + result = _(list).chain().pullAt(4, [2, 3], 1); + } +} + +// _.remove +module TestRemove { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + + { + let result: TResult[]; + + result = _.remove(array); + result = _.remove(array, predicateFn); + result = _.remove(array, predicateFn, any); + result = _.remove(array, ''); + result = _.remove(array, '', any); + result = _.remove<{a: number}, TResult>(array, {a: 42}); + + result = _.remove(list); + result = _.remove(list, predicateFn); + result = _.remove(list, predicateFn, any); + result = _.remove(list, ''); + result = _.remove(list, '', any); + result = _.remove<{a: number}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).remove(); + result = _(array).remove(predicateFn); + result = _(array).remove(predicateFn, any); + result = _(array).remove(''); + result = _(array).remove('', any); + result = _(array).remove<{a: number}>({a: 42}); + + result = _(list).remove(); + result = _(list).remove(predicateFn); + result = _(list).remove(predicateFn, any); + result = _(list).remove(''); + result = _(list).remove('', any); + result = _(list).remove<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().remove(); + result = _(array).chain().remove(predicateFn); + result = _(array).chain().remove(predicateFn, any); + result = _(array).chain().remove(''); + result = _(array).chain().remove('', any); + result = _(array).chain().remove<{a: number}>({a: 42}); + + result = _(list).chain().remove(); + result = _(list).chain().remove(predicateFn); + result = _(list).chain().remove(predicateFn, any); + result = _(list).chain().remove(''); + result = _(list).chain().remove('', any); + result = _(list).chain().remove<{a: number}, TResult>({a: 42}); + } +} + +// _.rest +module TestRest { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.rest(array); + result = _.rest(list); + + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).rest(); + result = _(list).rest(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().rest(); + result = _(list).chain().rest(); + } +} + +// _.slice +module TestSlice { + let array: TResult[]; + + { + let result: TResult[]; + + result = _.slice(array); + result = _.slice(array, 42); + result = _.slice(array, 42, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).slice(); + result = _(array).slice(42); + result = _(array).slice(42, 42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().slice(); + result = _(array).chain().slice(42); + result = _(array).chain().slice(42, 42); + } +} + +// _.sortedIndex +module TestSortedIndex { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedIndex('', ''); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + result = _.sortedIndex('', '', stringIterator); + result = _.sortedIndex('', '', stringIterator, any); + + result = _.sortedIndex(array, value); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex(array, value, ''); + result = _.sortedIndex(array, value, {a: 42}); + result = _.sortedIndex(array, value, arrayIterator); + result = _.sortedIndex(array, value, arrayIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedIndex(list, value); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex(list, value, ''); + result = _.sortedIndex(list, value, {a: 42}); + result = _.sortedIndex(list, value, listIterator); + result = _.sortedIndex(list, value, listIterator, any); + result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedIndex(''); + result = _('').sortedIndex('', stringIterator); + result = _('').sortedIndex('', stringIterator, any); + + result = _(array).sortedIndex(value); + result = _(array).sortedIndex(value, arrayIterator); + result = _(array).sortedIndex(value, arrayIterator, any); + result = _(array).sortedIndex(value, ''); + result = _(array).sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedIndex(value); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex(value, ''); + result = _(list).sortedIndex(value, {a: 42}); + result = _(list).sortedIndex(value, listIterator); + result = _(list).sortedIndex(value, listIterator, any); + result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedIndex(''); + result = _('').chain().sortedIndex('', stringIterator); + result = _('').chain().sortedIndex('', stringIterator, any); + + result = _(array).chain().sortedIndex(value); + result = _(array).chain().sortedIndex(value, arrayIterator); + result = _(array).chain().sortedIndex(value, arrayIterator, any); + result = _(array).chain().sortedIndex(value, ''); + result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedIndex(value); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex(value, ''); + result = _(list).chain().sortedIndex(value, {a: 42}); + result = _(list).chain().sortedIndex(value, listIterator); + result = _(list).chain().sortedIndex(value, listIterator, any); + result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } +} + +// _.sortedLastIndex +module TestSortedLastIndex { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndex('', ''); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + + result = _.sortedLastIndex(array, value); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex(array, value, ''); + result = _.sortedLastIndex(array, value, {a: 42}); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndex(list, value); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex(list, value, ''); + result = _.sortedLastIndex(list, value, {a: 42}); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndex(''); + result = _('').sortedLastIndex('', stringIterator); + result = _('').sortedLastIndex('', stringIterator, any); + + result = _(array).sortedLastIndex(value); + result = _(array).sortedLastIndex(value, arrayIterator); + result = _(array).sortedLastIndex(value, arrayIterator, any); + result = _(array).sortedLastIndex(value, ''); + result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndex(value); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex(value, ''); + result = _(list).sortedLastIndex(value, {a: 42}); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndex(''); + result = _('').chain().sortedLastIndex('', stringIterator); + result = _('').chain().sortedLastIndex('', stringIterator, any); + + result = _(array).chain().sortedLastIndex(value); + result = _(array).chain().sortedLastIndex(value, arrayIterator); + result = _(array).chain().sortedLastIndex(value, arrayIterator, any); + result = _(array).chain().sortedLastIndex(value, ''); + result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndex(value); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex(value, ''); + result = _(list).chain().sortedLastIndex(value, {a: 42}); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } +} + +// _.tail +module TestTail { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.tail(array); + result = _.tail(list); + + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).tail(); + result = _(list).tail(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().tail(); + result = _(list).chain().tail(); + } +} + +// _.take +module TestTake { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.take(array); + result = _.take(array, 42); + + result = _.take(list); + result = _.take(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).take(); + result = _(array).take(42); + + result = _(list).take(); + result = _(list).take(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().take(); + result = _(array).chain().take(42); + + result = _(list).chain().take(); + result = _(list).chain().take(42); + } +} + +// _.takeRight +module TestTakeRight { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.takeRight(array); + result = _.takeRight(array, 42); + + result = _.takeRight(list); + result = _.takeRight(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeRight(); + result = _(array).takeRight(42); + + result = _(list).takeRight(); + result = _(list).takeRight(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeRight(); + result = _(array).chain().takeRight(42); + + result = _(list).chain().takeRight(); + result = _(list).chain().takeRight(42); + } +} + +// _.takeRightWhile +module TestTakeRightWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.takeRightWhile(array); + result = _.takeRightWhile(array, predicateFn); + result = _.takeRightWhile(array, predicateFn, any); + result = _.takeRightWhile(array, ''); + result = _.takeRightWhile(array, '', any); + result = _.takeRightWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.takeRightWhile(list); + result = _.takeRightWhile(list, predicateFn); + result = _.takeRightWhile(list, predicateFn, any); + result = _.takeRightWhile(list, ''); + result = _.takeRightWhile(list, '', any); + result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeRightWhile(); + result = _(array).takeRightWhile(predicateFn); + result = _(array).takeRightWhile(predicateFn, any); + result = _(array).takeRightWhile(''); + result = _(array).takeRightWhile('', any); + result = _(array).takeRightWhile<{a: number;}>({a: 42}); + + result = _(list).takeRightWhile(); + result = _(list).takeRightWhile(predicateFn); + result = _(list).takeRightWhile(predicateFn, any); + result = _(list).takeRightWhile(''); + result = _(list).takeRightWhile('', any); + result = _(list).takeRightWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeRightWhile(); + result = _(array).chain().takeRightWhile(predicateFn); + result = _(array).chain().takeRightWhile(predicateFn, any); + result = _(array).chain().takeRightWhile(''); + result = _(array).chain().takeRightWhile('', any); + result = _(array).chain().takeRightWhile<{a: number;}>({a: 42}); + + result = _(list).chain().takeRightWhile(); + result = _(list).chain().takeRightWhile(predicateFn); + result = _(list).chain().takeRightWhile(predicateFn, any); + result = _(list).chain().takeRightWhile(''); + result = _(list).chain().takeRightWhile('', any); + result = _(list).chain().takeRightWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.takeWhile +module TestTakeWhile { + let array: TResult[]; + let list: _.List; + let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + + { + let result: TResult[]; + + result = _.takeWhile(array); + result = _.takeWhile(array, predicateFn); + result = _.takeWhile(array, predicateFn, any); + result = _.takeWhile(array, ''); + result = _.takeWhile(array, '', any); + result = _.takeWhile<{a: number;}, TResult>(array, {a: 42}); + + result = _.takeWhile(list); + result = _.takeWhile(list, predicateFn); + result = _.takeWhile(list, predicateFn, any); + result = _.takeWhile(list, ''); + result = _.takeWhile(list, '', any); + result = _.takeWhile<{a: number;}, TResult>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeWhile(); + result = _(array).takeWhile(predicateFn); + result = _(array).takeWhile(predicateFn, any); + result = _(array).takeWhile(''); + result = _(array).takeWhile('', any); + result = _(array).takeWhile<{a: number;}>({a: 42}); + + result = _(list).takeWhile(); + result = _(list).takeWhile(predicateFn); + result = _(list).takeWhile(predicateFn, any); + result = _(list).takeWhile(''); + result = _(list).takeWhile('', any); + result = _(list).takeWhile<{a: number;}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeWhile(); + result = _(array).chain().takeWhile(predicateFn); + result = _(array).chain().takeWhile(predicateFn, any); + result = _(array).chain().takeWhile(''); + result = _(array).chain().takeWhile('', any); + result = _(array).chain().takeWhile<{a: number;}>({a: 42}); + + result = _(list).chain().takeWhile(); + result = _(list).chain().takeWhile(predicateFn); + result = _(list).chain().takeWhile(predicateFn, any); + result = _(list).chain().takeWhile(''); + result = _(list).chain().takeWhile('', any); + result = _(list).chain().takeWhile<{a: number;}, TResult>({a: 42}); + } +} + +// _.union +module TestUnion { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.union(); + + result = _.union(array); + result = _.union(array, list); + result = _.union(array, list, array); + + result = _.union(list); + result = _.union(list, array); + result = _.union(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).union(); + result = _(array).union(list); + result = _(array).union(list, array); + + result = _(array).union(); + result = _(array).union(list); + result = _(array).union(list, array); + + result = _(list).union(); + result = _(list).union(array); + result = _(list).union(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().union(); + result = _(array).chain().union(list); + result = _(array).chain().union(list, array); + + result = _(array).chain().union(); + result = _(array).chain().union(list); + result = _(array).chain().union(list, array); + + result = _(list).chain().union(); + result = _(list).chain().union(array); + result = _(list).chain().union(array, list); + } +} + +// _.uniq +module TestUniq { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.uniq('abc'); + result = _.uniq('abc', true); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.uniq(array); + result = _.uniq(array, true); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, true, 'a'); + result = _.uniq(array, true, 'a', any); + result = _.uniq(array, 'a'); + result = _.uniq(array, 'a', any); + result = _.uniq(array, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.uniq(array, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, {a: 42}); + + result = _.uniq(list); + result = _.uniq(list, true); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, true, 'a'); + result = _.uniq(list, true, 'a', any); + result = _.uniq(list, 'a'); + result = _.uniq(list, 'a', any); + result = _.uniq(list, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.uniq(list, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').uniq(); + result = _('abc').uniq(true); + result = _('abc').uniq(true, stringIterator); + result = _('abc').uniq(true, stringIterator, any); + result = _('abc').uniq(stringIterator); + result = _('abc').uniq(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).uniq(); + result = _(array).uniq(true); + result = _(array).uniq(true, listIterator); + result = _(array).uniq(true, listIterator, any); + result = _(array).uniq(listIterator); + result = _(array).uniq(listIterator, any); + result = _(array).uniq(true, 'a'); + result = _(array).uniq(true, 'a', any); + result = _(array).uniq('a'); + result = _(array).uniq('a', any); + result = _(array).uniq<{a: number}>(true, {a: 42}); + result = _(array).uniq<{a: number}>({a: 42}); + + result = _(list).uniq(); + result = _(list).uniq(true); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(true, 'a'); + result = _(list).uniq(true, 'a', any); + result = _(list).uniq('a'); + result = _(list).uniq('a', any); + result = _(list).uniq(true, {a: 42}); + result = _(list).uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).uniq({a: 42}); + result = _(list).uniq<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().uniq(); + result = _('abc').chain().uniq(true); + result = _('abc').chain().uniq(true, stringIterator); + result = _('abc').chain().uniq(true, stringIterator, any); + result = _('abc').chain().uniq(stringIterator); + result = _('abc').chain().uniq(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().uniq(); + result = _(array).chain().uniq(true); + result = _(array).chain().uniq(true, listIterator); + result = _(array).chain().uniq(true, listIterator, any); + result = _(array).chain().uniq(listIterator); + result = _(array).chain().uniq(listIterator, any); + result = _(array).chain().uniq(true, 'a'); + result = _(array).chain().uniq(true, 'a', any); + result = _(array).chain().uniq('a'); + result = _(array).chain().uniq('a', any); + result = _(array).chain().uniq<{a: number}>(true, {a: 42}); + result = _(array).chain().uniq<{a: number}>({a: 42}); + + result = _(list).chain().uniq(); + result = _(list).chain().uniq(true); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(true, 'a'); + result = _(list).chain().uniq(true, 'a', any); + result = _(list).chain().uniq('a'); + result = _(list).chain().uniq('a', any); + result = _(list).chain().uniq(true, {a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().uniq({a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>({a: 42}); + } +} + +// _.unique +module TestUnique { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.unique('abc'); + result = _.unique('abc', true); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.unique(array); + result = _.unique(array, true); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, true, 'a'); + result = _.unique(array, true, 'a', any); + result = _.unique(array, 'a'); + result = _.unique(array, 'a', any); + result = _.unique(array, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.unique(array, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, {a: 42}); + + result = _.unique(list); + result = _.unique(list, true); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, true, 'a'); + result = _.unique(list, true, 'a', any); + result = _.unique(list, 'a'); + result = _.unique(list, 'a', any); + result = _.unique(list, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.unique(list, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').unique(); + result = _('abc').unique(true); + result = _('abc').unique(true, stringIterator); + result = _('abc').unique(true, stringIterator, any); + result = _('abc').unique(stringIterator); + result = _('abc').unique(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).unique(); + result = _(array).unique(true); + result = _(array).unique(true, listIterator); + result = _(array).unique(true, listIterator, any); + result = _(array).unique(listIterator); + result = _(array).unique(listIterator, any); + result = _(array).unique(true, 'a'); + result = _(array).unique(true, 'a', any); + result = _(array).unique('a'); + result = _(array).unique('a', any); + result = _(array).unique<{a: number}>(true, {a: 42}); + result = _(array).unique<{a: number}>({a: 42}); + + result = _(list).unique(); + result = _(list).unique(true); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(true, 'a'); + result = _(list).unique(true, 'a', any); + result = _(list).unique('a'); + result = _(list).unique('a', any); + result = _(list).unique(true, {a: 42}); + result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).unique({a: 42}); + result = _(list).unique<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().unique(); + result = _('abc').chain().unique(true); + result = _('abc').chain().unique(true, stringIterator); + result = _('abc').chain().unique(true, stringIterator, any); + result = _('abc').chain().unique(stringIterator); + result = _('abc').chain().unique(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().unique(); + result = _(array).chain().unique(true); + result = _(array).chain().unique(true, listIterator); + result = _(array).chain().unique(true, listIterator, any); + result = _(array).chain().unique(listIterator); + result = _(array).chain().unique(listIterator, any); + result = _(array).chain().unique(true, 'a'); + result = _(array).chain().unique(true, 'a', any); + result = _(array).chain().unique('a'); + result = _(array).chain().unique('a', any); + result = _(array).chain().unique<{a: number}>(true, {a: 42}); + result = _(array).chain().unique<{a: number}>({a: 42}); + + result = _(list).chain().unique(); + result = _(list).chain().unique(true); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(true, 'a'); + result = _(list).chain().unique(true, 'a', any); + result = _(list).chain().unique('a'); + result = _(list).chain().unique('a', any); + result = _(list).chain().unique(true, {a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().unique({a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); + } +} + +// _.upzip +module TestUnzip { + let array = [['a', 'b'], [1, 2], [true, false]]; + + let list: _.List<_.List> = { + 0: {0: 'a', 1: 'b', length: 2}, + 1: {0: 1, 1: 2, length: 2}, + 2: {0: true, 1: false, length: 2}, + length: 3 + }; + + { + let result: (string|number|boolean)[][]; + + result = _.unzip(array); + result = _.unzip(list); + } + + { + let result: _.LoDashImplicitArrayWrapper<(string|number|boolean)[]>; + + result = _(array).unzip(); + result = _(list).unzip(); + } + + { + let result: _.LoDashExplicitArrayWrapper<(string|number|boolean)[]>; + + result = _(array).chain().unzip(); + result = _(list).chain().unzip(); + } +} + +// _.unzipWith +{ + let testUnzipWithArray: (number[]|_.List)[]; + let testUnzipWithList: _.List>; + let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult}; + let result: TResult[]; + result = _.unzipWith(testUnzipWithArray); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator, any); + result = _.unzipWith(testUnzipWithList); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator); + result = _.unzipWith(testUnzipWithList, testUnzipWithIterator, any); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator, any).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator).value(); + result = _(testUnzipWithList).unzipWith(testUnzipWithIterator, any).value(); +} + +// _.without +module TestWithout { + let array: number[]; + let list: _.List; + + { + let result: number[]; + + result = _.without(array); + result = _.without(array, 1); + result = _.without(array, 1, 2); + result = _.without(array, 1, 2, 3); + + result = _.without(list); + result = _.without(list, 1); + result = _.without(list, 1, 2); + result = _.without(list, 1, 2, 3); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).without(); + result = _(array).without(1); + result = _(array).without(1, 2); + result = _(array).without(1, 2, 3); + result = _(list).without(); + result = _(list).without(1); + result = _(list).without(1, 2); + result = _(list).without(1, 2, 3); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().without(); + result = _(array).chain().without(1); + result = _(array).chain().without(1, 2); + result = _(array).chain().without(1, 2, 3); + + result = _(list).chain().without(); + result = _(list).chain().without(1); + result = _(list).chain().without(1, 2); + result = _(list).chain().without(1, 2, 3); + } +} + +// _.xor +module TestXor { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.xor(); + + result = _.xor(array); + result = _.xor(array, list); + result = _.xor(array, list, array); + + result = _.xor(list); + result = _.xor(list, array); + result = _.xor(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).xor(); + result = _(array).xor(list); + result = _(array).xor(list, array); + + result = _(list).xor(); + result = _(list).xor(array); + result = _(list).xor(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().xor(); + result = _(array).chain().xor(list); + result = _(array).chain().xor(list, array); + + result = _(list).chain().xor(); + result = _(list).chain().xor(array); + result = _(list).chain().xor(array, list); + } +} + +// _.zip +module TestZip { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[][]; + + result = _.zip(array); + result = _.zip(array, list); + result = _.zip(array, list, array); + + result = _.zip(list); + result = _.zip(list, array); + result = _.zip(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).zip(list); + result = _(array).zip(list, array); + + result = _(list).zip(array); + result = _(list).zip(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().zip(list); + result = _(array).chain().zip(list, array); + + result = _(list).chain().zip(array); + result = _(list).chain().zip(array, list); + } +} + +// _.zipObject +module TestZipObject { + let arrayOfKeys: string[]; + let arrayOfValues: number[]; + let arrayOfKeyValuePairs: (string|number)[][] + + let listOfKeys: _.List; + let listOfValues: _.List; + let listOfKeyValuePairs: _.List<_.List>; + + { + let result: _.Dictionary; + + result = _.zipObject<_.Dictionary>(arrayOfKeys); + result = _.zipObject<_.Dictionary>(listOfKeys); + } + + { + let result: _.Dictionary; + + result = _.zipObject<_.Dictionary>(arrayOfKeys, arrayOfValues); + result = _.zipObject<_.Dictionary>(arrayOfKeys, listOfValues); + result = _.zipObject<_.Dictionary>(listOfKeys, listOfValues); + result = _.zipObject<_.Dictionary>(listOfKeys, arrayOfValues); + + result = _.zipObject>(arrayOfKeys, arrayOfValues); + result = _.zipObject>(arrayOfKeys, listOfValues); + result = _.zipObject>(listOfKeys, listOfValues); + result = _.zipObject>(listOfKeys, arrayOfValues); + + result = _.zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _.zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.Dictionary; + + result = _.zipObject(arrayOfKeys); + result = _.zipObject(arrayOfKeys, arrayOfValues); + result = _.zipObject(arrayOfKeys, listOfValues); + + result = _.zipObject(listOfKeys); + result = _.zipObject(listOfKeys, listOfValues); + result = _.zipObject(listOfKeys, arrayOfValues); + + result = _.zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _.zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).zipObject<_.Dictionary>(); + result = _(listOfKeys).zipObject<_.Dictionary>(); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).zipObject<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).zipObject>(arrayOfValues); + result = _(arrayOfKeys).zipObject>(listOfValues); + result = _(listOfKeys).zipObject>(listOfValues); + result = _(listOfKeys).zipObject>(arrayOfValues); + + result = _(listOfKeys).zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).zipObject(); + result = _(arrayOfKeys).zipObject(arrayOfValues); + result = _(arrayOfKeys).zipObject(listOfValues); + + result = _(listOfKeys).zipObject(); + result = _(listOfKeys).zipObject(listOfValues); + result = _(listOfKeys).zipObject(arrayOfValues); + + result = _(listOfKeys).zipObject(arrayOfKeyValuePairs); + result = _(listOfKeys).zipObject(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfValues); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfValues); + + result = _(arrayOfKeys).chain().zipObject>(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject>(listOfValues); + result = _(listOfKeys).chain().zipObject>(listOfValues); + result = _(listOfKeys).chain().zipObject>(arrayOfValues); + + result = _(listOfKeys).chain().zipObject<_.Dictionary>(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().zipObject<_.Dictionary>(listOfKeyValuePairs); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(arrayOfKeys).chain().zipObject(); + result = _(arrayOfKeys).chain().zipObject(arrayOfValues); + result = _(arrayOfKeys).chain().zipObject(listOfValues); + + result = _(listOfKeys).chain().zipObject(); + result = _(listOfKeys).chain().zipObject(listOfValues); + result = _(listOfKeys).chain().zipObject(arrayOfValues); + + result = _(listOfKeys).chain().zipObject(arrayOfKeyValuePairs); + result = _(listOfKeys).chain().zipObject(listOfKeyValuePairs); + } +} + +// _.zipWith +interface TestZipWithFn { + (a1: number, a2: number): number; +} +var testZipWithFn: TestZipWithFn; +result = _.zipWith([1, 2]); +result = _.zipWith([1, 2], testZipWithFn); +result = _.zipWith([1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any); +result = _([1, 2]).zipWith().value(); +result = _([1, 2]).zipWith(testZipWithFn).value(); +result = _([1, 2]).zipWith(testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value(); + +/********* + * Chain * + *********/ + +// _.chain +module TestChain { + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(''); + result = _('').chain(); + + result = _.chain('').chain(); + result = _('').chain().chain(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(42); + result = _(42).chain(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _.chain(true); + result = _(true).chain(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _.chain(['']); + result = _(['']).chain(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _.chain<{a: string}>({a: ''}); + result = _<{a: string}>({a: ''}).chain(); + } +} + +// _.tap +module TestTap { + { + let interceptor: (value: string) => void; + let result: string; + + _.tap('', interceptor); + _.tap('', interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashImplicitArrayWrapper; + + _.tap([''], interceptor); + _.tap([''], interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + _.tap({a: ''}, interceptor); + _.tap({a: ''}, interceptor, any); + } + + { + let interceptor: (value: string) => void; + let result: _.LoDashImplicitWrapper; + + _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor, any); + + _('').tap(interceptor); + _('').tap(interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashImplicitArrayWrapper; + + _.chain(['']).tap(interceptor); + _.chain(['']).tap(interceptor, any); + + _(['']).tap(interceptor); + _(['']).tap(interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + _.chain({a: ''}).tap(interceptor); + _.chain({a: ''}).tap(interceptor, any); + + _({a: ''}).tap(interceptor); + _({a: ''}).tap(interceptor, any); + } + + { + let interceptor: (value: string) => void; + let result: _.LoDashExplicitWrapper; + + _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor, any); + + _('').chain().tap(interceptor); + _('').chain().tap(interceptor, any); + } + + { + let interceptor: (value: string[]) => void; + let result: _.LoDashExplicitArrayWrapper; + + _.chain(['']).tap(interceptor); + _.chain(['']).tap(interceptor, any); + + _(['']).chain().tap(interceptor); + _(['']).chain().tap(interceptor, any); + } + + { + let interceptor: (value: {a: string}) => void; + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + _.chain({a: ''}).tap(interceptor); + _.chain({a: ''}).tap(interceptor, any); + + _({a: ''}).chain().tap(interceptor); + _({a: ''}).chain().tap(interceptor, any); + } +} + +// _.thru +module TestThru { + interface Interceptor { + (value: T): T; + } + + { + let interceptor: Interceptor; + let result: number; + + result = _.thru(1, interceptor); + result = _.thru(1, interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _(1).thru(interceptor); + result = _(1).thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _('').thru(interceptor); + result = _('').thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitWrapper; + + result = _(true).thru(interceptor); + result = _(true).thru(interceptor, any); + } + + { + let interceptor: Interceptor<{a: string}>; + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + result = _({a: ''}).thru<{a: string}>(interceptor); + result = _({a: ''}).thru<{a: string}>(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashImplicitArrayWrapper; + + result = _([1, 2, 3]).thru(interceptor); + result = _([1, 2, 3]).thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().thru(interceptor); + result = _(1).chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _('').chain().thru(interceptor); + result = _('').chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitWrapper; + + result = _(true).chain().thru(interceptor); + result = _(true).chain().thru(interceptor, any); + } + + { + let interceptor: Interceptor<{a: string}>; + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _({a: ''}).chain().thru<{a: string}>(interceptor); + result = _({a: ''}).chain().thru<{a: string}>(interceptor, any); + } + + { + let interceptor: Interceptor; + let result: _.LoDashExplicitArrayWrapper; + + result = _([1, 2, 3]).chain().thru(interceptor); + result = _([1, 2, 3]).chain().thru(interceptor, any); + } +} + +// _.prototype.commit +module TestCommit { + { + let result: _.LoDashImplicitWrapper; + result = _(42).commit(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _([]).commit(); + } + + { + let result: _.LoDashImplicitObjectWrapper; + result = _({}).commit(); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(42).chain().commit(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _([]).chain().commit(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + result = _({}).chain().commit(); + } +} + +// _.prototype.concat +module TestConcat { + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + + result = _(1).concat(2); + result = _(1).concat(2, 3); + result = _(1).concat(2, 3, 4); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + + result = _(['']).concat(['']); + result = _(['']).concat([''], ['']); + result = _(['']).concat([''], [''], ['']); + } + + { + let result: _.LoDashImplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).concat<{a: string}>({a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).concat({a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}); + result = _({a: ''}).concat({a: ''}, {a: ''}, {a: ''}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + + result = _(1).chain().concat(2); + result = _(1).chain().concat(2, 3); + result = _(1).chain().concat(2, 3, 4); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + + result = _(['']).chain().concat(['']); + result = _(['']).chain().concat([''], ['']); + result = _(['']).chain().concat([''], [''], ['']); + } + + { + let result: _.LoDashExplicitArrayWrapper<{a: string}>; + + result = _({a: ''}).chain().concat<{a: string}>({a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}, {a: ''}); + + result = _({a: ''}).chain().concat({a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}); + result = _({a: ''}).chain().concat({a: ''}, {a: ''}, {a: ''}); + } +} + +// _.prototype.plant +module TestPlant { + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(42); + } + + { + let result: _.LoDashImplicitStringWrapper; + result = _(any).plant(''); + } + + { + let result: _.LoDashImplicitWrapper; + result = _(any).plant(true); + } + + { + let result: _.LoDashImplicitNumberArrayWrapper; + result = _(any).plant([42]); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(any).plant([]); + } + + { + let result: _.LoDashImplicitObjectWrapper<{}>; + result = _(any).plant<{}>({}); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(42); + } + + { + let result: _.LoDashExplicitStringWrapper; + result = _(any).chain().plant(''); + } + + { + let result: _.LoDashExplicitWrapper; + result = _(any).chain().plant(true); + } + + { + let result: _.LoDashExplicitNumberArrayWrapper; + result = _(any).chain().plant([42]); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _(any).chain().plant([]); + } + + { + let result: _.LoDashExplicitObjectWrapper<{}>; + result = _(any).chain().plant<{}>({}); + } +} + +// _.prototype.reverse +module TestReverse { + { + let result: _.LoDashImplicitArrayWrapper; + result: _([42]).reverse(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result: _([42]).chain().reverse(); + } +} + +// _.prototype.run +module TestRun { + { + let result: string; + + result = _('').run(); + result = _('').chain().run(); + } + + { + let result: number; + + result = _(42).run(); + result = _(42).chain().run(); + } + + { + let result: boolean; + + result = _(true).run(); + result = _(true).chain().run(); + } + + { + let result: string[]; + + result = _([]).run(); + result = _([]).chain().run(); + } + + { + let result: {a: string}; + + result = _({a: ''}).run(); + result = _({a: ''}).chain().run(); + } +} + +// _.prototype.toJSON +module TestToJSON { + { + let result: string; + + result = _('').toJSON(); + result = _('').chain().toJSON(); + } + + { + let result: number; + + result = _(42).toJSON(); + result = _(42).chain().toJSON(); + } + + { + let result: boolean; + + result = _(true).toJSON(); + result = _(true).chain().toJSON(); + } + + { + let result: string[]; + + result = _([]).toJSON(); + result = _([]).chain().toJSON(); + } + + { + let result: {a: string}; + + result = _({a: ''}).toJSON(); + result = _({a: ''}).chain().toJSON(); + } +} + +// _.prototype.toString +module TestToString { + let result: string; + + result = _('').toString(); + result = _(42).toString(); + result = _(true).toString(); + result = _(['']).toString(); + result = _({}).toString(); + + result = _('').chain().toString(); + result = _(42).chain().toString(); + result = _(true).chain().toString(); + result = _(['']).chain().toString(); + result = _({}).chain().toString(); +} + +// _.prototype.value +module TestValue { + { + let result: string; + + result = _('').value(); + result = _('').chain().value(); + } + + { + let result: number; + + result = _(42).value(); + result = _(42).chain().value(); + } + + { + let result: boolean; + + result = _(true).value(); + result = _(true).chain().value(); + } + + { + let result: string[]; + + result = _([]).value(); + result = _([]).chain().value(); + } + + { + let result: {a: string}; + + result = _({a: ''}).value(); + result = _({a: ''}).chain().value(); + } +} + +// _.prototype.valueOf +module TestValueOf { + { + let result: string; + + result = _('').valueOf(); + result = _('').chain().valueOf(); + } + + { + let result: number; + + result = _(42).valueOf(); + result = _(42).chain().valueOf(); + } + + { + let result: boolean; + + result = _(true).valueOf(); + result = _(true).chain().valueOf(); + } + + { + let result: string[]; + + result = _([]).valueOf(); + result = _([]).chain().valueOf(); + } + + { + let result: {a: string}; + + result = _({a: ''}).valueOf(); + result = _({a: ''}).chain().valueOf(); + } +} + +/************** + * Collection * + **************/ + +// _.all +module TestAll { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + { + let result: boolean; + + result = _.all(array); + result = _.all(array, listIterator); + result = _.all(array, listIterator, any); + result = _.all(array, ''); + result = _.all<{a: number}, TResult>(array, {a: 42}); + + result = _.all(list); + result = _.all(list, listIterator); + result = _.all(list, listIterator, any); + result = _.all(list, ''); + result = _.all<{a: number}, TResult>(list, {a: 42}); + + result = _.all(dictionary); + result = _.all(dictionary, dictionaryIterator); + result = _.all(dictionary, dictionaryIterator, any); + result = _.all(dictionary, ''); + result = _.all<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).all(); + result = _(array).all(listIterator); + result = _(array).all(listIterator, any); + result = _(array).all(''); + result = _(array).all<{a: number}>({a: 42}); + + result = _(list).all(); + result = _(list).all(listIterator); + result = _(list).all(listIterator, any); + result = _(list).all(''); + result = _(list).all<{a: number}>({a: 42}); + + result = _(dictionary).all(); + result = _(dictionary).all(dictionaryIterator); + result = _(dictionary).all(dictionaryIterator, any); + result = _(dictionary).all(''); + result = _(dictionary).all<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().all(); + result = _(array).chain().all(listIterator); + result = _(array).chain().all(listIterator, any); + result = _(array).chain().all(''); + result = _(array).chain().all<{a: number}>({a: 42}); + + result = _(list).chain().all(); + result = _(list).chain().all(listIterator); + result = _(list).chain().all(listIterator, any); + result = _(list).chain().all(''); + result = _(list).chain().all<{a: number}>({a: 42}); + + result = _(dictionary).chain().all(); + result = _(dictionary).chain().all(dictionaryIterator); + result = _(dictionary).chain().all(dictionaryIterator, any); + result = _(dictionary).chain().all(''); + result = _(dictionary).chain().all<{a: number}>({a: 42}); + } +} + +// _.any +module TestAny { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; + + { + let result: boolean; + + result = _.any(array); + result = _.any(array, listIterator); + result = _.any(array, listIterator, any); + result = _.any(array, ''); + result = _.any<{a: number}, TResult>(array, {a: 42}); + + result = _.any(list); + result = _.any(list, listIterator); + result = _.any(list, listIterator, any); + result = _.any(list, ''); + result = _.any<{a: number}, TResult>(list, {a: 42}); + + result = _.any(dictionary); + result = _.any(dictionary, dictionaryIterator); + result = _.any(dictionary, dictionaryIterator, any); + result = _.any(dictionary, ''); + result = _.any<{a: number}, TResult>(dictionary, {a: 42}); + + result = _.any(numericDictionary); + result = _.any(numericDictionary, numericDictionaryIterator); + result = _.any(numericDictionary, numericDictionaryIterator, any); + result = _.any(numericDictionary, ''); + result = _.any<{a: number}, TResult>(numericDictionary, {a: 42}); + + result = _(array).any(); + result = _(array).any(listIterator); + result = _(array).any(listIterator, any); + result = _(array).any(''); + result = _(array).any<{a: number}>({a: 42}); + + result = _(list).any(); + result = _(list).any(listIterator); + result = _(list).any(listIterator, any); + result = _(list).any(''); + result = _(list).any<{a: number}>({a: 42}); + + result = _(dictionary).any(); + result = _(dictionary).any(dictionaryIterator); + result = _(dictionary).any(dictionaryIterator, any); + result = _(dictionary).any(''); + result = _(dictionary).any<{a: number}>({a: 42}); + + result = _(numericDictionary).any(); + result = _(numericDictionary).any(numericDictionaryIterator); + result = _(numericDictionary).any(numericDictionaryIterator, any); + result = _(numericDictionary).any(''); + result = _(numericDictionary).any<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().any(); + result = _(array).chain().any(listIterator); + result = _(array).chain().any(listIterator, any); + result = _(array).chain().any(''); + result = _(array).chain().any<{a: number}>({a: 42}); + + result = _(list).chain().any(); + result = _(list).chain().any(listIterator); + result = _(list).chain().any(listIterator, any); + result = _(list).chain().any(''); + result = _(list).chain().any<{a: number}>({a: 42}); + + result = _(dictionary).chain().any(); + result = _(dictionary).chain().any(dictionaryIterator); + result = _(dictionary).chain().any(dictionaryIterator, any); + result = _(dictionary).chain().any(''); + result = _(dictionary).chain().any<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().any(); + result = _(numericDictionary).chain().any(numericDictionaryIterator); + result = _(numericDictionary).chain().any(numericDictionaryIterator, any); + result = _(numericDictionary).chain().any(''); + result = _(numericDictionary).chain().any<{a: number}>({a: 42}); + } +} + +// _.at +module TestAt { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: TResult[]; + + result = _.at(array, 0, '1', [2], ['3'], [4, '5']); + result = _.at(list, 0, '1', [2], ['3'], [4, '5']); + result = _.at(dictionary, 0, '1', [2], ['3'], [4, '5']); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).at(0, '1', [2], ['3'], [4, '5']); + result = _(list).at(0, '1', [2], ['3'], [4, '5']); + result = _(dictionary).at(0, '1', [2], ['3'], [4, '5']); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().at(0, '1', [2], ['3'], [4, '5']); + result = _(list).chain().at(0, '1', [2], ['3'], [4, '5']); + result = _(dictionary).chain().at(0, '1', [2], ['3'], [4, '5']); + } +} + +// _.collect +module TestCollect { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => TResult; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; + + { + let result: TResult[]; + + result = _.collect(array); + result = _.collect(array, listIterator); + result = _.collect(array, listIterator, any); + result = _.collect(array, ''); + + result = _.collect(list); + result = _.collect(list, listIterator); + result = _.collect(list, listIterator, any); + result = _.collect(list, ''); + + result = _.collect(dictionary); + result = _.collect(dictionary, dictionaryIterator); + result = _.collect(dictionary, dictionaryIterator, any); + result = _.collect(dictionary, ''); + } + + { + let result: boolean[]; + + result = _.collect(array, {}); + result = _.collect(list, {}); + result = _.collect(dictionary, {}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).collect(); + result = _(array).collect(listIterator); + result = _(array).collect(listIterator, any); + result = _(array).collect(''); + + result = _(list).collect(); + result = _(list).collect(listIterator); + result = _(list).collect(listIterator, any); + result = _(list).collect(''); + + result = _(dictionary).collect(); + result = _(dictionary).collect(dictionaryIterator); + result = _(dictionary).collect(dictionaryIterator, any); + result = _(dictionary).collect(''); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).collect<{}>({}); + result = _(list).collect<{}>({}); + result = _(dictionary).collect<{}>({}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().collect(); + result = _(array).chain().collect(listIterator); + result = _(array).chain().collect(listIterator, any); + result = _(array).chain().collect(''); + + result = _(list).chain().collect(); + result = _(list).chain().collect(listIterator); + result = _(list).chain().collect(listIterator, any); + result = _(list).chain().collect(''); + + result = _(dictionary).chain().collect(); + result = _(dictionary).chain().collect(dictionaryIterator); + result = _(dictionary).chain().collect(dictionaryIterator, any); + result = _(dictionary).chain().collect(''); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().collect<{}>({}); + result = _(list).chain().collect<{}>({}); + result = _(dictionary).chain().collect<{}>({}); + } +} + +// _.contains +module TestContains { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let target: SampleType; + + { + let result: boolean; + + result = _.contains(array, target); + result = _.contains(array, target, 42); + + result = _.contains(list, target); + result = _.contains(list, target, 42); + + result = _.contains(dictionary, target); + result = _.contains(dictionary, target, 42); + + result = _(array).contains(target); + result = _(array).contains(target, 42); + + result = _(list).contains(target); + result = _(list).contains(target, 42); + + result = _(dictionary).contains(target); + result = _(dictionary).contains(target, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().contains(target); + result = _(array).chain().contains(target, 42); + + result = _(list).chain().contains(target); + result = _(list).chain().contains(target, 42); + + result = _(dictionary).chain().contains(target); + result = _(dictionary).chain().contains(target, 42); + } +} + +// _.countBy +module TestCountBy { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let stringIterator: (value: string, index: number, collection: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => any; + + { + let result: _.Dictionary; + + result = _.countBy(''); + result = _.countBy('', stringIterator); + result = _.countBy('', stringIterator, any); + + result = _.countBy(array); + result = _.countBy(array, listIterator); + result = _.countBy(array, listIterator, any); + result = _.countBy(array, ''); + result = _.countBy(array, '', any); + result = _.countBy<{a: number}, TResult>(array, {a: 42}); + result = _.countBy(array, {a: 42}); + + result = _.countBy(list); + result = _.countBy(list, listIterator); + result = _.countBy(list, listIterator, any); + result = _.countBy(list, ''); + result = _.countBy(list, '', any); + result = _.countBy<{a: number}, TResult>(list, {a: 42}); + result = _.countBy(list, {a: 42}); + + result = _.countBy(dictionary); + result = _.countBy(dictionary, dictionaryIterator); + result = _.countBy(dictionary, dictionaryIterator, any); + result = _.countBy(dictionary, ''); + result = _.countBy(dictionary, '', any); + result = _.countBy<{a: number}, TResult>(dictionary, {a: 42}); + result = _.countBy(dictionary, {a: 42}); + + result = _.countBy(numericDictionary); + result = _.countBy(numericDictionary, numericDictionaryIterator); + result = _.countBy(numericDictionary, numericDictionaryIterator, any); + result = _.countBy(numericDictionary, ''); + result = _.countBy(numericDictionary, '', any); + result = _.countBy<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _.countBy(numericDictionary, {a: 42}); + } + + { + let resutl: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').countBy(); + result = _('').countBy(stringIterator); + result = _('').countBy(stringIterator, any); + + result = _(array).countBy(); + result = _(array).countBy(listIterator); + result = _(array).countBy(listIterator, any); + result = _(array).countBy(''); + result = _(array).countBy('', any); + result = _(array).countBy<{a: number}>({a: 42}); + result = _(array).countBy({a: 42}); + + result = _(list).countBy(); + result = _(list).countBy(listIterator); + result = _(list).countBy(listIterator, any); + result = _(list).countBy(''); + result = _(list).countBy('', any); + result = _(list).countBy<{a: number}>({a: 42}); + result = _(list).countBy({a: 42}); + + result = _(dictionary).countBy(); + result = _(dictionary).countBy(dictionaryIterator); + result = _(dictionary).countBy(dictionaryIterator, any); + result = _(dictionary).countBy(''); + result = _(dictionary).countBy('', any); + result = _(dictionary).countBy<{a: number}>({a: 42}); + result = _(dictionary).countBy({a: 42}); + + result = _(numericDictionary).countBy(); + result = _(numericDictionary).countBy(numericDictionaryIterator); + result = _(numericDictionary).countBy(numericDictionaryIterator, any); + result = _(numericDictionary).countBy(''); + result = _(numericDictionary).countBy('', any); + result = _(numericDictionary).countBy<{a: number}>({a: 42}); + result = _(numericDictionary).countBy({a: 42}); + } + + { + let resutl: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().countBy(); + result = _('').chain().countBy(stringIterator); + result = _('').chain().countBy(stringIterator, any); + + result = _(array).chain().countBy(); + result = _(array).chain().countBy(listIterator); + result = _(array).chain().countBy(listIterator, any); + result = _(array).chain().countBy(''); + result = _(array).chain().countBy('', any); + result = _(array).chain().countBy<{a: number}>({a: 42}); + result = _(array).chain().countBy({a: 42}); + + result = _(list).chain().countBy(); + result = _(list).chain().countBy(listIterator); + result = _(list).chain().countBy(listIterator, any); + result = _(list).chain().countBy(''); + result = _(list).chain().countBy('', any); + result = _(list).chain().countBy<{a: number}>({a: 42}); + result = _(list).chain().countBy({a: 42}); + + result = _(dictionary).chain().countBy(); + result = _(dictionary).chain().countBy(dictionaryIterator); + result = _(dictionary).chain().countBy(dictionaryIterator, any); + result = _(dictionary).chain().countBy(''); + result = _(dictionary).chain().countBy('', any); + result = _(dictionary).chain().countBy<{a: number}>({a: 42}); + result = _(dictionary).chain().countBy({a: 42}); + + result = _(numericDictionary).chain().countBy(); + result = _(numericDictionary).chain().countBy(numericDictionaryIterator); + result = _(numericDictionary).chain().countBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().countBy(''); + result = _(numericDictionary).chain().countBy('', any); + result = _(numericDictionary).chain().countBy<{a: number}>({a: 42}); + result = _(numericDictionary).chain().countBy({a: 42}); + } +} + +// _.detect +module TestDetect { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + let result: TResult; + + result = _.detect(array); + result = _.detect(array, listIterator); + result = _.detect(array, listIterator, any); + result = _.detect(array, ''); + result = _.detect<{a: number}, TResult>(array, {a: 42}); + + result = _.detect(list); + result = _.detect(list, listIterator); + result = _.detect(list, listIterator, any); + result = _.detect(list, ''); + result = _.detect<{a: number}, TResult>(list, {a: 42}); + + result = _.detect(dictionary); + result = _.detect(dictionary, dictionaryIterator); + result = _.detect(dictionary, dictionaryIterator, any); + result = _.detect(dictionary, ''); + result = _.detect<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).detect(); + result = _(array).detect(listIterator); + result = _(array).detect(listIterator, any); + result = _(array).detect(''); + result = _(array).detect<{a: number}>({a: 42}); + + result = _(list).detect(); + result = _(list).detect(listIterator); + result = _(list).detect(listIterator, any); + result = _(list).detect(''); + result = _(list).detect<{a: number}, TResult>({a: 42}); + + result = _(dictionary).detect(); + result = _(dictionary).detect(dictionaryIterator); + result = _(dictionary).detect(dictionaryIterator, any); + result = _(dictionary).detect(''); + result = _(dictionary).detect<{a: number}, TResult>({a: 42}); +} + +// _.each +module TestEach { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.each('', stringIterator); + _.each('', stringIterator, any); + } + + { + let result: TResult[]; + + _.each(array, listIterator); + _.each(array, listIterator, any); + } + + { + let result: _.List; + + _.each(list, listIterator); + _.each(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.each(dictionary, dictionaryIterator); + _.each(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').each(stringIterator); + _('').each(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).each(listIterator); + _(array).each(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).each(listIterator); + _(list).each(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).each(dictionaryIterator); + _(dictionary).each(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().each(stringIterator); + _('').chain().each(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().each(listIterator); + _(array).chain().each(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().each(listIterator); + _(list).chain().each(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().each(dictionaryIterator); + _(dictionary).chain().each(dictionaryIterator, any); + } +} + +// _.eachRight +module TestEachRight { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.eachRight('', stringIterator); + _.eachRight('', stringIterator, any); + } + + { + let result: TResult[]; + + _.eachRight(array, listIterator); + _.eachRight(array, listIterator, any); + } + + { + let result: _.List; + + _.eachRight(list, listIterator); + _.eachRight(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.eachRight(dictionary, dictionaryIterator); + _.eachRight(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').eachRight(stringIterator); + _('').eachRight(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).eachRight(listIterator); + _(array).eachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).eachRight(listIterator); + _(list).eachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).eachRight(dictionaryIterator); + _(dictionary).eachRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().eachRight(stringIterator); + _('').chain().eachRight(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().eachRight(listIterator); + _(array).chain().eachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().eachRight(listIterator); + _(list).chain().eachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().eachRight(dictionaryIterator); + _(dictionary).chain().eachRight(dictionaryIterator, any); + } +} + +// _.every +module TestEvery { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + { + let result: boolean; + + result = _.every(array); + result = _.every(array, listIterator); + result = _.every(array, listIterator, any); + result = _.every(array, ''); + result = _.every<{a: number}, TResult>(array, {a: 42}); + + result = _.every(list); + result = _.every(list, listIterator); + result = _.every(list, listIterator, any); + result = _.every(list, ''); + result = _.every<{a: number}, TResult>(list, {a: 42}); + + result = _.every(dictionary); + result = _.every(dictionary, dictionaryIterator); + result = _.every(dictionary, dictionaryIterator, any); + result = _.every(dictionary, ''); + result = _.every<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).every(); + result = _(array).every(listIterator); + result = _(array).every(listIterator, any); + result = _(array).every(''); + result = _(array).every<{a: number}>({a: 42}); + + result = _(list).every(); + result = _(list).every(listIterator); + result = _(list).every(listIterator, any); + result = _(list).every(''); + result = _(list).every<{a: number}>({a: 42}); + + result = _(dictionary).every(); + result = _(dictionary).every(dictionaryIterator); + result = _(dictionary).every(dictionaryIterator, any); + result = _(dictionary).every(''); + result = _(dictionary).every<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().every(); + result = _(array).chain().every(listIterator); + result = _(array).chain().every(listIterator, any); + result = _(array).chain().every(''); + result = _(array).chain().every<{a: number}>({a: 42}); + + result = _(list).chain().every(); + result = _(list).chain().every(listIterator); + result = _(list).chain().every(listIterator, any); + result = _(list).chain().every(''); + result = _(list).chain().every<{a: number}>({a: 42}); + + result = _(dictionary).chain().every(); + result = _(dictionary).chain().every(dictionaryIterator); + result = _(dictionary).chain().every(dictionaryIterator, any); + result = _(dictionary).chain().every(''); + result = _(dictionary).chain().every<{a: number}>({a: 42}); + } +} + +// _.filter +module TestFilter { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string[]; + + result = _.filter('', stringIterator); + result = _.filter('', stringIterator, any); + } + + { + let result: TResult[]; + + result = _.filter(array, listIterator); + result = _.filter(array, listIterator, any); + result = _.filter(array, ''); + result = _.filter(array, '', any); + result = _.filter<{a: number}, TResult>(array, {a: 42}); + + result = _.filter(list, listIterator); + result = _.filter(list, listIterator, any); + result = _.filter(list, ''); + result = _.filter(list, '', any); + result = _.filter<{a: number}, TResult>(list, {a: 42}); + + result = _.filter(dictionary, dictionaryIterator); + result = _.filter(dictionary, dictionaryIterator, any); + result = _.filter(dictionary, ''); + result = _.filter(dictionary, '', any); + result = _.filter<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('').filter(stringIterator); + result = _('').filter(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).filter(listIterator); + result = _(array).filter(listIterator, any); + result = _(array).filter(''); + result = _(array).filter('', any); + result = _(array).filter<{a: number}>({a: 42}); + + result = _(list).filter(listIterator); + result = _(list).filter(listIterator, any); + result = _(list).filter(''); + result = _(list).filter('', any); + result = _(list).filter<{a: number}, TResult>({a: 42}); + + result = _(dictionary).filter(dictionaryIterator); + result = _(dictionary).filter(dictionaryIterator, any); + result = _(dictionary).filter(''); + result = _(dictionary).filter('', any); + result = _(dictionary).filter<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('').chain().filter(stringIterator); + result = _('').chain().filter(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().filter(listIterator); + result = _(array).chain().filter(listIterator, any); + result = _(array).chain().filter(''); + result = _(array).chain().filter('', any); + result = _(array).chain().filter<{a: number}>({a: 42}); + + result = _(list).chain().filter(listIterator); + result = _(list).chain().filter(listIterator, any); + result = _(list).chain().filter(''); + result = _(list).chain().filter('', any); + result = _(list).chain().filter<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().filter(dictionaryIterator); + result = _(dictionary).chain().filter(dictionaryIterator, any); + result = _(dictionary).chain().filter(''); + result = _(dictionary).chain().filter('', any); + result = _(dictionary).chain().filter<{a: number}, TResult>({a: 42}); + } +} + +// _.find +module TestFind { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + + let result: TResult; + + result = _.find(array); + result = _.find(array, listIterator); + result = _.find(array, listIterator, any); + result = _.find(array, ''); + result = _.find<{a: number}, TResult>(array, {a: 42}); + + result = _.find(list); + result = _.find(list, listIterator); + result = _.find(list, listIterator, any); + result = _.find(list, ''); + result = _.find<{a: number}, TResult>(list, {a: 42}); + + result = _.find(dictionary); + result = _.find(dictionary, dictionaryIterator); + result = _.find(dictionary, dictionaryIterator, any); + result = _.find(dictionary, ''); + result = _.find<{a: number}, TResult>(dictionary, {a: 42}); + + result = _(array).find(); + result = _(array).find(listIterator); + result = _(array).find(listIterator, any); + result = _(array).find(''); + result = _(array).find<{a: number}>({a: 42}); + + result = _(list).find(); + result = _(list).find(listIterator); + result = _(list).find(listIterator, any); + result = _(list).find(''); + result = _(list).find<{a: number}, TResult>({a: 42}); + + result = _(dictionary).find(); + result = _(dictionary).find(dictionaryIterator); + result = _(dictionary).find(dictionaryIterator, any); + result = _(dictionary).find(''); + result = _(dictionary).find<{a: number}, TResult>({a: 42}); +} + +result = _.findWhere([1, 2, 3, 4], function (num) { + return num % 2 == 0; +}); +result = _.findWhere(foodsCombined, { 'type': 'vegetable' }); +result = _.findWhere(foodsCombined, 'organic'); + +result = _.findLast([1, 2, 3, 4], function (num) { + return num % 2 == 0; +}); +result = _.findLast(foodsCombined, { 'type': 'vegetable' }); +result = _.findLast(foodsCombined, 'organic'); + +result = _([1, 2, 3, 4]).findLast(function (num) { + return num % 2 == 0; +}); +result = _(foodsCombined).findLast({ 'type': 'vegetable' }); +result = _(foodsCombined).findLast('organic'); + +// _.forEach +module TestForEach { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.forEach('', stringIterator); + _.forEach('', stringIterator, any); + } + + { + let result: TResult[]; + + _.forEach(array, listIterator); + _.forEach(array, listIterator, any); + } + + { + let result: _.List; + + _.forEach(list, listIterator); + _.forEach(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.forEach(dictionary, dictionaryIterator); + _.forEach(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').forEach(stringIterator); + _('').forEach(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).forEach(listIterator); + _(array).forEach(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).forEach(listIterator); + _(list).forEach(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).forEach(dictionaryIterator); + _(dictionary).forEach(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().forEach(stringIterator); + _('').chain().forEach(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().forEach(listIterator); + _(array).chain().forEach(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().forEach(listIterator); + _(list).chain().forEach(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().forEach(dictionaryIterator); + _(dictionary).chain().forEach(dictionaryIterator, any); + } +} + +// _.forEachRight +module TestForEachRight { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string; + + _.forEachRight('', stringIterator); + _.forEachRight('', stringIterator, any); + } + + { + let result: TResult[]; + + _.forEachRight(array, listIterator); + _.forEachRight(array, listIterator, any); + } + + { + let result: _.List; + + _.forEachRight(list, listIterator); + _.forEachRight(list, listIterator, any); + } + + { + let result: _.Dictionary; + + _.forEachRight(dictionary, dictionaryIterator); + _.forEachRight(dictionary, dictionaryIterator, any); + } + + { + let result: _.LoDashImplicitWrapper; + + _('').forEachRight(stringIterator); + _('').forEachRight(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + _(array).forEachRight(listIterator); + _(array).forEachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.List>; + + _(list).forEachRight(listIterator); + _(list).forEachRight(listIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + _(dictionary).forEachRight(dictionaryIterator); + _(dictionary).forEachRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitWrapper; + + _('').chain().forEachRight(stringIterator); + _('').chain().forEachRight(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + _(array).chain().forEachRight(listIterator); + _(array).chain().forEachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.List>; + + _(list).chain().forEachRight(listIterator); + _(list).chain().forEachRight(listIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + _(dictionary).chain().forEachRight(dictionaryIterator); + _(dictionary).chain().forEachRight(dictionaryIterator, any); + } +} + +// _.groupBy +module TestGroupBy { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => number; + let listIterator: (value: SampleType, index: number, collection: _.List) => number; + let dictionaryIterator: (value: SampleType, key: string, collection: _.Dictionary) => number; + + { + let result: _.Dictionary; + + result = _.groupBy(''); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + result = _.groupBy('', stringIterator); + result = _.groupBy('', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.groupBy(array); + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, ''); + result = _.groupBy(array, '', any); + result = _.groupBy(array, {a: 42}); + + result = _.groupBy(array, listIterator); + result = _.groupBy(array, listIterator, any); + result = _.groupBy(array, '', true); + result = _.groupBy<{a: number}, SampleType>(array, {a: 42}); + + result = _.groupBy(list); + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, ''); + result = _.groupBy(list, '', any); + result = _.groupBy(list, {a: 42}); + + result = _.groupBy(list, listIterator); + result = _.groupBy(list, listIterator, any); + result = _.groupBy(list, '', true); + result = _.groupBy<{a: number}, SampleType>(list, {a: 42}); + + result = _.groupBy(dictionary); + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, ''); + result = _.groupBy(dictionary, '', any); + result = _.groupBy(dictionary, {a: 42}); + + result = _.groupBy(dictionary, dictionaryIterator); + result = _.groupBy(dictionary, dictionaryIterator, any); + result = _.groupBy(dictionary, '', true); + result = _.groupBy<{a: number}, SampleType>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('').groupBy(); + result = _('').groupBy(stringIterator); + result = _('').groupBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).groupBy(); + result = _(array).groupBy(listIterator); + result = _(array).groupBy(listIterator, any); + result = _(array).groupBy(''); + result = _(array).groupBy('', true); + result = _(array).groupBy<{a: number}>({a: 42}); + + result = _(list).groupBy(); + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy(''); + result = _(list).groupBy('', any); + result = _(list).groupBy({a: 42}); + + result = _(list).groupBy(listIterator); + result = _(list).groupBy(listIterator, any); + result = _(list).groupBy('', true); + result = _(list).groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).groupBy(); + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy(''); + result = _(dictionary).groupBy('', any); + result = _(dictionary).groupBy({a: 42}); + + result = _(dictionary).groupBy(dictionaryIterator); + result = _(dictionary).groupBy(dictionaryIterator, any); + result = _(dictionary).groupBy('', true); + result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('').chain().groupBy(); + result = _('').chain().groupBy(stringIterator); + result = _('').chain().groupBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().groupBy(); + result = _(array).chain().groupBy(listIterator); + result = _(array).chain().groupBy(listIterator, any); + result = _(array).chain().groupBy(''); + result = _(array).chain().groupBy('', true); + result = _(array).chain().groupBy<{a: number}>({a: 42}); + + result = _(list).chain().groupBy(); + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy(''); + result = _(list).chain().groupBy('', any); + result = _(list).chain().groupBy({a: 42}); + + result = _(list).chain().groupBy(listIterator); + result = _(list).chain().groupBy(listIterator, any); + result = _(list).chain().groupBy('', true); + result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42}); + + result = _(dictionary).chain().groupBy(); + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy(''); + result = _(dictionary).chain().groupBy('', any); + result = _(dictionary).chain().groupBy({a: 42}); + + result = _(dictionary).chain().groupBy(dictionaryIterator); + result = _(dictionary).chain().groupBy(dictionaryIterator, any); + result = _(dictionary).chain().groupBy('', true); + result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42}); + } +} + +// _.include +module TestInclude { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let target: SampleType; + + { + let result: boolean; + + result = _.include(array, target); + result = _.include(array, target, 42); + + result = _.include(list, target); + result = _.include(list, target, 42); + + result = _.include(dictionary, target); + result = _.include(dictionary, target, 42); + + result = _(array).include(target); + result = _(array).include(target, 42); + + result = _(list).include(target); + result = _(list).include(target, 42); + + result = _(dictionary).include(target); + result = _(dictionary).include(target, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().include(target); + result = _(array).chain().include(target, 42); + + result = _(list).chain().include(target); + result = _(list).chain().include(target, 42); + + result = _(dictionary).chain().include(target); + result = _(dictionary).chain().include(target, 42); + } +} + +// _.includes +module TestIncludes { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + let target: SampleType; + + { + let result: boolean; + + result = _.includes(array, target); + result = _.includes(array, target, 42); + + result = _.includes(list, target); + result = _.includes(list, target, 42); + + result = _.includes(dictionary, target); + result = _.includes(dictionary, target, 42); + + result = _(array).includes(target); + result = _(array).includes(target, 42); + + result = _(list).includes(target); + result = _(list).includes(target, 42); + + result = _(dictionary).includes(target); + result = _(dictionary).includes(target, 42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().includes(target); + result = _(array).chain().includes(target, 42); + + result = _(list).chain().includes(target); + result = _(list).chain().includes(target, 42); + + result = _(dictionary).chain().includes(target); + result = _(dictionary).chain().includes(target, 42); + } +} + +// _.indexBy +module TestIndexBy { + type SampleObject = {a: number; b: string; c: boolean;}; + + let array: SampleObject[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let stringIterator: (value: string, index: number, collection: string) => any; + let listIterator: (value: SampleObject, index: number, collection: _.List) => any; + let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any; + let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any; + + { + let result: _.Dictionary; + + result = _.indexBy('abcd'); + result = _.indexBy('abcd', stringIterator); + result = _.indexBy('abcd', stringIterator, any); + } + + { + let result: _.Dictionary; + + result = _.indexBy(array); + result = _.indexBy(array, listIterator); + result = _.indexBy(array, listIterator, any); + result = _.indexBy(array, 'a'); + result = _.indexBy(array, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(array, {a: 42}); + result = _.indexBy(array, {a: 42}); + + result = _.indexBy(list); + result = _.indexBy(list, listIterator); + result = _.indexBy(list, listIterator, any); + result = _.indexBy(list, 'a'); + result = _.indexBy(list, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(list, {a: 42}); + result = _.indexBy(list, {a: 42}); + + result = _.indexBy(numericDictionary); + result = _.indexBy(numericDictionary, numericDictionaryIterator); + result = _.indexBy(numericDictionary, numericDictionaryIterator, any); + result = _.indexBy(numericDictionary, 'a'); + result = _.indexBy(numericDictionary, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.indexBy(numericDictionary, {a: 42}); + + result = _.indexBy(dictionary); + result = _.indexBy(dictionary, dictionaryIterator); + result = _.indexBy(dictionary, dictionaryIterator, any); + result = _.indexBy(dictionary, 'a'); + result = _.indexBy(dictionary, 'a', any); + result = _.indexBy<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.indexBy(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _('abcd').indexBy(); + result = _('abcd').indexBy(stringIterator); + result = _('abcd').indexBy(stringIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).indexBy(); + result = _(array).indexBy(listIterator); + result = _(array).indexBy(listIterator, any); + result = _(array).indexBy('a'); + result = _(array).indexBy('a', any); + result = _(array).indexBy<{a: number}>({a: 42}); + + result = _(list).indexBy(); + result = _(list).indexBy(listIterator); + result = _(list).indexBy(listIterator, any); + result = _(list).indexBy('a'); + result = _(list).indexBy('a', any); + result = _(list).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(list).indexBy({a: 42}); + + result = _(numericDictionary).indexBy(); + result = _(numericDictionary).indexBy(numericDictionaryIterator); + result = _(numericDictionary).indexBy(numericDictionaryIterator, any); + result = _(numericDictionary).indexBy('a'); + result = _(numericDictionary).indexBy('a', any); + result = _(numericDictionary).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).indexBy({a: 42}); + + result = _(dictionary).indexBy(); + result = _(dictionary).indexBy(dictionaryIterator); + result = _(dictionary).indexBy(dictionaryIterator, any); + result = _(dictionary).indexBy('a'); + result = _(dictionary).indexBy('a', any); + result = _(dictionary).indexBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).indexBy({a: 42}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _('abcd').chain().indexBy(); + result = _('abcd').chain().indexBy(stringIterator); + result = _('abcd').chain().indexBy(stringIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().indexBy(); + result = _(array).chain().indexBy(listIterator); + result = _(array).chain().indexBy(listIterator, any); + result = _(array).chain().indexBy('a'); + result = _(array).chain().indexBy('a', any); + result = _(array).chain().indexBy<{a: number}>({a: 42}); + + result = _(list).chain().indexBy(); + result = _(list).chain().indexBy(listIterator); + result = _(list).chain().indexBy(listIterator, any); + result = _(list).chain().indexBy('a'); + result = _(list).chain().indexBy('a', any); + result = _(list).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(list).chain().indexBy({a: 42}); + + result = _(numericDictionary).chain().indexBy(); + result = _(numericDictionary).chain().indexBy(numericDictionaryIterator); + result = _(numericDictionary).chain().indexBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().indexBy('a'); + result = _(numericDictionary).chain().indexBy('a', any); + result = _(numericDictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).chain().indexBy({a: 42}); + + result = _(dictionary).chain().indexBy(); + result = _(dictionary).chain().indexBy(dictionaryIterator); + result = _(dictionary).chain().indexBy(dictionaryIterator, any); + result = _(dictionary).chain().indexBy('a'); + result = _(dictionary).chain().indexBy('a', any); + result = _(dictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).chain().indexBy({a: 42}); + } +} + +result = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); +result = _.invoke([123, 456], String.prototype.split, ''); + +// _.map +module TestMap { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => TResult; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; + + { + let result: TResult[]; + + result = _.map(array); + result = _.map(array, listIterator); + result = _.map(array, listIterator, any); + result = _.map(array, ''); + + result = _.map(list); + result = _.map(list, listIterator); + result = _.map(list, listIterator, any); + result = _.map(list, ''); + + result = _.map(dictionary); + result = _.map(dictionary, dictionaryIterator); + result = _.map(dictionary, dictionaryIterator, any); + result = _.map(dictionary, ''); + } + + { + let result: boolean[]; + + result = _.map(array, {}); + result = _.map(list, {}); + result = _.map(dictionary, {}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).map(); + result = _(array).map(listIterator); + result = _(array).map(listIterator, any); + result = _(array).map(''); + + result = _(list).map(); + result = _(list).map(listIterator); + result = _(list).map(listIterator, any); + result = _(list).map(''); + + result = _(dictionary).map(); + result = _(dictionary).map(dictionaryIterator); + result = _(dictionary).map(dictionaryIterator, any); + result = _(dictionary).map(''); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).map<{}>({}); + result = _(list).map<{}>({}); + result = _(dictionary).map<{}>({}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().map(); + result = _(array).chain().map(listIterator); + result = _(array).chain().map(listIterator, any); + result = _(array).chain().map(''); + + result = _(list).chain().map(); + result = _(list).chain().map(listIterator); + result = _(list).chain().map(listIterator, any); + result = _(list).chain().map(''); + + result = _(dictionary).chain().map(); + result = _(dictionary).chain().map(dictionaryIterator); + result = _(dictionary).chain().map(dictionaryIterator, any); + result = _(dictionary).chain().map(''); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().map<{}>({}); + result = _(list).chain().map<{}>({}); + result = _(dictionary).chain().map<{}>({}); + } +} + +// _.partition +result = _.partition('abcd', (n) => n < 'c'); +result = _.partition(['a', 'b', 'c', 'd'], (n) => n < 'c'); +result = _.partition([1, 2, 3, 4], (n) => n < 3); +result = _.partition({0: 1, 1: 2, 2: 3, 3: 4, length: 4}, (n) => n < 3); +result = _.partition({a: 1, b: 2, c: 3, d: 4}, (n) => n < 3); +result = <{a: number}[][]>_.partition<{a: number}, {a: number}>([{a: 1}, {a: 2}], {a: 2}); +result = <{a: number}[][]>_.partition<{a: number}, {a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, {a: 2}); +result = <{a: number}[][]>_.partition<{a: number}, {a: number}>({0: {a: 1}, 1: {a: 2}}, {a: 2}); +result = <{a: number}[][]>_.partition<{a: number}>([{a: 1}, {a: 2}], 'a'); +result = <{a: number}[][]>_.partition<{a: number}>([{a: 1}, {a: 2}], 'a', 2); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a'); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a', 2); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a'); +result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a', 2); +result = _('abcd').partition((n) => n < 'c').value(); +result = _(['a', 'b', 'c', 'd']).partition((n) => n < 'c').value(); +result = _([1, 2, 3, 4]).partition((n) => n < 3).value(); +result = _({0: 1, 1: 2, 2: 3, 3: 4, length: 4}).partition((n) => n < 3).value(); +result = _({a: 1, b: 2, c: 3, d: 4}).partition((n) => n < 3).value(); +result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition<{a: number}>({a: 2}).value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}, length: 2}).partition<{a: number}, {a: number}>({a: 2}).value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}, {a: number}>({a: 2}).value(); +result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a').value(); +result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a', 2).value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a').value(); +result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', 2).value(); + +// _.pluck +module TestPluck { + interface SampleObject { + d: {b: TResult}[]; + } + + let array: SampleObject[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: any[]; + + result = _.pluck(array, 'd.0.b'); + result = _.pluck(array, ['d', 0, 'b']); + + result = _.pluck(list, 'd.0.b'); + result = _.pluck(list, ['d', 0, 'b']); + + result = _.pluck(dictionary, 'd.0.b'); + result = _.pluck(dictionary, ['d', 0, 'b']); + } + + { + let result: TResult[]; + + result = _.pluck(array, 'd.0.b'); + result = _.pluck(array, ['d', 0, 'b']); + + result = _.pluck(list, 'd.0.b'); + result = _.pluck(list, ['d', 0, 'b']); + + result = _.pluck(dictionary, 'd.0.b'); + result = _.pluck(dictionary, ['d', 0, 'b']); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).pluck('d.0.b'); + result = _(array).pluck(['d', 0, 'b']); + + result = _(list).pluck('d.0.b'); + result = _(list).pluck(['d', 0, 'b']); + + result = _(dictionary).pluck('d.0.b'); + result = _(dictionary).pluck(['d', 0, 'b']); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().pluck('d.0.b'); + result = _(array).chain().pluck(['d', 0, 'b']); + + result = _(list).chain().pluck('d.0.b'); + result = _(list).chain().pluck(['d', 0, 'b']); + + result = _(dictionary).chain().pluck('d.0.b'); + result = _(dictionary).chain().pluck(['d', 0, 'b']); + } +} + +interface ABC { + [index: string]: number; + a: number; + b: number; + c: number; +} + +result = _.reduce([1, 2, 3], function (sum: number, num: number) { + return sum + num; +}); +result = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _.foldl([1, 2, 3], function (sum: number, num: number) { + return sum + num; +}); +result = _.foldl({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _.inject([1, 2, 3], function (sum: number, num: number) { + return sum + num; +}); +result = _.inject({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _([1, 2, 3]).reduce(function (sum: number, num: number) { + return sum + num; +}); +result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce(function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _([1, 2, 3]).foldl(function (sum: number, num: number) { + return sum + num; +}); +result = _({ 'a': 1, 'b': 2, 'c': 3 }).foldl(function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _([1, 2, 3]).inject(function (sum: number, num: number) { + return sum + num; +}); +result = _({ 'a': 1, 'b': 2, 'c': 3 }).inject(function (r: ABC, num: number, key: string) { + r[key] = num * 3; + return r; +}, {}); + +result = _.reduceRight([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); +result = _.foldr([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); + +// _.reject +module TestReject { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string[]; + + result = _.reject('', stringIterator); + result = _.reject('', stringIterator, any); + } + + { + let result: TResult[]; + + result = _.reject(array, listIterator); + result = _.reject(array, listIterator, any); + result = _.reject(array, ''); + result = _.reject(array, '', any); + result = _.reject<{a: number}, TResult>(array, {a: 42}); + + result = _.reject(list, listIterator); + result = _.reject(list, listIterator, any); + result = _.reject(list, ''); + result = _.reject(list, '', any); + result = _.reject<{a: number}, TResult>(list, {a: 42}); + + result = _.reject(dictionary, dictionaryIterator); + result = _.reject(dictionary, dictionaryIterator, any); + result = _.reject(dictionary, ''); + result = _.reject(dictionary, '', any); + result = _.reject<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('').reject(stringIterator); + result = _('').reject(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).reject(listIterator); + result = _(array).reject(listIterator, any); + result = _(array).reject(''); + result = _(array).reject('', any); + result = _(array).reject<{a: number}>({a: 42}); + + result = _(list).reject(listIterator); + result = _(list).reject(listIterator, any); + result = _(list).reject(''); + result = _(list).reject('', any); + result = _(list).reject<{a: number}, TResult>({a: 42}); + + result = _(dictionary).reject(dictionaryIterator); + result = _(dictionary).reject(dictionaryIterator, any); + result = _(dictionary).reject(''); + result = _(dictionary).reject('', any); + result = _(dictionary).reject<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('').chain().reject(stringIterator); + result = _('').chain().reject(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().reject(listIterator); + result = _(array).chain().reject(listIterator, any); + result = _(array).chain().reject(''); + result = _(array).chain().reject('', any); + result = _(array).chain().reject<{a: number}>({a: 42}); + + result = _(list).chain().reject(listIterator); + result = _(list).chain().reject(listIterator, any); + result = _(list).chain().reject(''); + result = _(list).chain().reject('', any); + result = _(list).chain().reject<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().reject(dictionaryIterator); + result = _(dictionary).chain().reject(dictionaryIterator, any); + result = _(dictionary).chain().reject(''); + result = _(dictionary).chain().reject('', any); + result = _(dictionary).chain().reject<{a: number}, TResult>({a: 42}); + } +} + +result = _.sample([1, 2, 3, 4]); +result = _.sample([1, 2, 3, 4], 2); +result = <_.LoDashImplicitWrapper>_([1, 2, 3, 4]).sample(); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sample(2); +result = _([1, 2, 3, 4]).sample().value(); +result = _([1, 2, 3, 4]).sample(2).value(); + +// _.select +module TestSelect { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let stringIterator: (char: string, index: number, string: string) => any; + let listIterator: (value: TResult, index: number, collection: _.List) => any; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + + { + let result: string[]; + + result = _.select('', stringIterator); + result = _.select('', stringIterator, any); + } + + { + let result: TResult[]; + + result = _.select(array, listIterator); + result = _.select(array, listIterator, any); + result = _.select(array, ''); + result = _.select(array, '', any); + result = _.select<{a: number}, TResult>(array, {a: 42}); + + result = _.select(list, listIterator); + result = _.select(list, listIterator, any); + result = _.select(list, ''); + result = _.select(list, '', any); + result = _.select<{a: number}, TResult>(list, {a: 42}); + + result = _.select(dictionary, dictionaryIterator); + result = _.select(dictionary, dictionaryIterator, any); + result = _.select(dictionary, ''); + result = _.select(dictionary, '', any); + result = _.select<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('').select(stringIterator); + result = _('').select(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).select(listIterator); + result = _(array).select(listIterator, any); + result = _(array).select(''); + result = _(array).select('', any); + result = _(array).select<{a: number}>({a: 42}); + + result = _(list).select(listIterator); + result = _(list).select(listIterator, any); + result = _(list).select(''); + result = _(list).select('', any); + result = _(list).select<{a: number}, TResult>({a: 42}); + + result = _(dictionary).select(dictionaryIterator); + result = _(dictionary).select(dictionaryIterator, any); + result = _(dictionary).select(''); + result = _(dictionary).select('', any); + result = _(dictionary).select<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('').chain().select(stringIterator); + result = _('').chain().select(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().select(listIterator); + result = _(array).chain().select(listIterator, any); + result = _(array).chain().select(''); + result = _(array).chain().select('', any); + result = _(array).chain().select<{a: number}>({a: 42}); + + result = _(list).chain().select(listIterator); + result = _(list).chain().select(listIterator, any); + result = _(list).chain().select(''); + result = _(list).chain().select('', any); + result = _(list).chain().select<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().select(dictionaryIterator); + result = _(dictionary).chain().select(dictionaryIterator, any); + result = _(dictionary).chain().select(''); + result = _(dictionary).chain().select('', any); + result = _(dictionary).chain().select<{a: number}, TResult>({a: 42}); + } +} + +// _.shuffle +module TestShuffle { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: string[]; + + result = _.shuffle('abc'); + } + + { + let result: TResult[]; + + result = _.shuffle(array); + result = _.shuffle(list); + result = _.shuffle(dictionary); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').shuffle(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).shuffle(); + result = _(list).shuffle(); + result = _(dictionary).shuffle(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().shuffle(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().shuffle(); + result = _(list).chain().shuffle(); + result = _(dictionary).chain().shuffle(); + } +} + +// _.size +module TestSize { + type SampleType = {a: string; b: number; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: number; + + result = _.size(array); + result = _.size(list); + result = _.size(dictionary); + result = _.size(''); + + result = _(array).size(); + result = _(list).size(); + result = _(dictionary).size(); + result = _('').size(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().size(); + result = _(list).chain().size(); + result = _(dictionary).chain().size(); + result = _('').chain().size(); + } +} + +// _.some +module TestSome { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => boolean; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; + + { + let result: boolean; + + result = _.some(array); + result = _.some(array, listIterator); + result = _.some(array, listIterator, any); + result = _.some(array, ''); + result = _.some<{a: number}, TResult>(array, {a: 42}); + + result = _.some(list); + result = _.some(list, listIterator); + result = _.some(list, listIterator, any); + result = _.some(list, ''); + result = _.some<{a: number}, TResult>(list, {a: 42}); + + result = _.some(dictionary); + result = _.some(dictionary, dictionaryIterator); + result = _.some(dictionary, dictionaryIterator, any); + result = _.some(dictionary, ''); + result = _.some<{a: number}, TResult>(dictionary, {a: 42}); + + result = _.some(numericDictionary); + result = _.some(numericDictionary, numericDictionaryIterator); + result = _.some(numericDictionary, numericDictionaryIterator, any); + result = _.some(numericDictionary, ''); + result = _.some<{a: number}, TResult>(numericDictionary, {a: 42}); + + result = _(array).some(); + result = _(array).some(listIterator); + result = _(array).some(listIterator, any); + result = _(array).some(''); + result = _(array).some<{a: number}>({a: 42}); + + result = _(list).some(); + result = _(list).some(listIterator); + result = _(list).some(listIterator, any); + result = _(list).some(''); + result = _(list).some<{a: number}>({a: 42}); + + result = _(dictionary).some(); + result = _(dictionary).some(dictionaryIterator); + result = _(dictionary).some(dictionaryIterator, any); + result = _(dictionary).some(''); + result = _(dictionary).some<{a: number}>({a: 42}); + + result = _(numericDictionary).some(); + result = _(numericDictionary).some(numericDictionaryIterator); + result = _(numericDictionary).some(numericDictionaryIterator, any); + result = _(numericDictionary).some(''); + result = _(numericDictionary).some<{a: number}>({a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().some(); + result = _(array).chain().some(listIterator); + result = _(array).chain().some(listIterator, any); + result = _(array).chain().some(''); + result = _(array).chain().some<{a: number}>({a: 42}); + + result = _(list).chain().some(); + result = _(list).chain().some(listIterator); + result = _(list).chain().some(listIterator, any); + result = _(list).chain().some(''); + result = _(list).chain().some<{a: number}>({a: 42}); + + result = _(dictionary).chain().some(); + result = _(dictionary).chain().some(dictionaryIterator); + result = _(dictionary).chain().some(dictionaryIterator, any); + result = _(dictionary).chain().some(''); + result = _(dictionary).chain().some<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().some(); + result = _(numericDictionary).chain().some(numericDictionaryIterator); + result = _(numericDictionary).chain().some(numericDictionaryIterator, any); + result = _(numericDictionary).chain().some(''); + result = _(numericDictionary).chain().some<{a: number}>({a: 42}); + } +} + +// _.sortBy +module TestSortBy { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => number; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => number; + + { + let result: TResult[]; + + result = _.sortBy(array); + result = _.sortBy(array, listIterator); + result = _.sortBy(array, listIterator, any); + result = _.sortBy(array, ''); + result = _.sortBy<{a: number}, TResult>(array, {a: 42}); + + result = _.sortBy(list); + result = _.sortBy(list, listIterator); + result = _.sortBy(list, listIterator, any); + result = _.sortBy(list, ''); + result = _.sortBy<{a: number}, TResult>(list, {a: 42}); + + result = _.sortBy(dictionary); + result = _.sortBy(dictionary, dictionaryIterator); + result = _.sortBy(dictionary, dictionaryIterator, any); + result = _.sortBy(dictionary, ''); + result = _.sortBy<{a: number}, TResult>(dictionary, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortBy(); + result = _(array).sortBy(listIterator); + result = _(array).sortBy(listIterator, any); + result = _(array).sortBy(''); + result = _(array).sortBy<{a: number}>({a: 42}); + + result = _(list).sortBy(); + result = _(list).sortBy(listIterator); + result = _(list).sortBy(listIterator, any); + result = _(list).sortBy(''); + result = _(list).sortBy<{a: number}, TResult>({a: 42}); + + result = _(dictionary).sortBy(); + result = _(dictionary).sortBy(dictionaryIterator); + result = _(dictionary).sortBy(dictionaryIterator, any); + result = _(dictionary).sortBy(''); + result = _(dictionary).sortBy<{a: number}, TResult>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortBy(); + result = _(array).chain().sortBy(listIterator); + result = _(array).chain().sortBy(listIterator, any); + result = _(array).chain().sortBy(''); + result = _(array).chain().sortBy<{a: number}>({a: 42}); + + result = _(list).chain().sortBy(); + result = _(list).chain().sortBy(listIterator); + result = _(list).chain().sortBy(listIterator, any); + result = _(list).chain().sortBy(''); + result = _(list).chain().sortBy<{a: number}, TResult>({a: 42}); + + result = _(dictionary).chain().sortBy(); + result = _(dictionary).chain().sortBy(dictionaryIterator); + result = _(dictionary).chain().sortBy(dictionaryIterator, any); + result = _(dictionary).chain().sortBy(''); + result = _(dictionary).chain().sortBy<{a: number}, TResult>({a: 42}); + } +} + +result = _.sortByAll(stoogesAges, function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }); +result = _.sortByAll(stoogesAges, ['name', 'age']); +result = _.sortByAll(stoogesAges, 'name', function(stooge) { return Math.sin(stooge.age); }); + +result = _(foodsOrganic).sortByAll('organic', (food) => food.name, { organic: true }).value(); + +// _.sortByOrder +module TestSortByOrder { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + let numericDictionary: _.NumericDictionary; + let dictionary: _.Dictionary; + let orders: boolean|string|(boolean|string)[]; + + { + let iteratees: (value: string) => any|((value: string) => any)[]; + let result: string[]; + + result = _.sortByOrder('acbd', iteratees); + result = _.sortByOrder('acbd', iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: SampleObject[]; + + result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees, orders); + result = _.sortByOrder(array, iteratees); + result = _.sortByOrder(array, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees, orders); + result = _.sortByOrder(list, iteratees); + result = _.sortByOrder(list, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees, orders); + result = _.sortByOrder(numericDictionary, iteratees); + result = _.sortByOrder(numericDictionary, iteratees, orders); + + result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees); + result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees, orders); + result = _.sortByOrder(dictionary, iteratees); + result = _.sortByOrder(dictionary, iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortByOrder<{a: number}>(iteratees); + result = _(array).sortByOrder<{a: number}>(iteratees, orders); + + result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(list).sortByOrder(iteratees); + result = _(list).sortByOrder(iteratees, orders); + + result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).sortByOrder(iteratees); + result = _(numericDictionary).sortByOrder(iteratees, orders); + + result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).sortByOrder(iteratees); + result = _(dictionary).sortByOrder(iteratees, orders); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortByOrder<{a: number}>(iteratees); + result = _(array).chain().sortByOrder<{a: number}>(iteratees, orders); + + result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(list).chain().sortByOrder(iteratees); + result = _(list).chain().sortByOrder(iteratees, orders); + + result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).chain().sortByOrder(iteratees); + result = _(numericDictionary).chain().sortByOrder(iteratees, orders); + + result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); + result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).chain().sortByOrder(iteratees); + result = _(dictionary).chain().sortByOrder(iteratees, orders); + } +} + +result = _.where(stoogesCombined, { 'age': 40 }); +result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); + +result = _(stoogesCombined).where({ 'age': 40 }).value(); +result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); + +/******** + * Date * + ********/ + +module TestNow { + { + let result: number; + + result = _.now(); + result = _(42).now(); + result = _([]).now(); + result = _({}).now(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().now(); + result = _([]).chain().now(); + result = _({}).chain().now(); + } +} + +/************* + * Functions * + *************/ + +// _after +module TestAfter { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.after(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).after(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().after(func); + } +} + +// _.ary +module TestAry { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: SampleFunc; + + result = _.ary(func); + result = _.ary(func, 2); + result = _.ary(func); + result = _.ary(func, 2); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).ary(); + result = _(func).ary(2); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().ary(); + result = _(func).chain().ary(2); + } +} + +// _.backflow +module TestBackflow { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.backflow<(m: number, n: number) => number>(Fn1, Fn2); + result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).backflow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +// _.before +module TestBefore { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.before(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).before(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().before(func); + } +} + +// _.bind +module TestBind { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: SampleResult; + + result = _.bind(func, any); + result = _.bind(func, any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: SampleResult; + + result = _.bind(func, any, 42); + result = _.bind(func, any, 42); + } + + { + type SampleResult = () => boolean; + + let result: SampleResult; + + result = _.bind(func, any, 42, ''); + result = _.bind(func, any, 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any, 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).bind(any, 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any, 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().bind(any, 42, ''); + } +} + +// _.bindAll +module TestBindAll { + interface SampleObject { + a: Function; + b: Function; + c: Function; + } + + let object: SampleObject; + + { + let result: SampleObject; + + result = _.bindAll(object); + result = _.bindAll(object, 'c'); + result = _.bindAll(object, ['b'], 'c'); + result = _.bindAll(object, 'a', ['b'], 'c'); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindAll(); + result = _(object).bindAll('c'); + result = _(object).bindAll(['b'], 'c'); + result = _(object).bindAll('a', ['b'], 'c'); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindAll(); + result = _(object).chain().bindAll('c'); + result = _(object).chain().bindAll(['b'], 'c'); + result = _(object).chain().bindAll('a', ['b'], 'c'); + } +} + +// _.bindKey +module TestBindKey { + let object: { + foo: (a: number, b: string) => boolean; + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo'); + result = _.bindKey(object, 'foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo', 42); + result = _.bindKey(object, 'foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: SampleResult; + + result = _.bindKey(object, 'foo', 42, ''); + result = _.bindKey(object, 'foo', 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindKey('foo', 42, ''); + } + + { + type SampleResult = (a: number, b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo'); + } + + { + type SampleResult = (b: string) => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo', 42); + } + + { + type SampleResult = () => boolean; + + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindKey('foo', 42, ''); + } +} + +// _.compose +module TestCompose { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.compose<(m: number, n: number) => number>(Fn1, Fn2); + result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).compose<(m: number, n: number) => number>(Fn2); + result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +var createCallbackObj: { [index: string]: string; } = { name: 'Joe' }; +result = <() => any>_.createCallback('name'); +result = <() => boolean>_.createCallback(createCallbackObj); +result = <_.LoDashImplicitObjectWrapper<() => any>>_('name').createCallback(); +result = <_.LoDashImplicitObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); + +// _.curry +var testCurryFn = (a: number, b: number, c: number) => [a, b, c]; +let curryResult0: number[] +let curryResult1: _.CurriedFunction1 +let curryResult2: _.CurriedFunction2 + +curryResult0 = _.curry(testCurryFn)(1, 2, 3); +curryResult1 = _.curry(testCurryFn)(1, 2); +curryResult0 = _.curry(testCurryFn)(1, 2)(3); +curryResult0 = _.curry(testCurryFn)(1)(2)(3); +curryResult2 = _.curry(testCurryFn)(1); +curryResult1 = _.curry(testCurryFn)(1)(2); +curryResult0 = _.curry(testCurryFn)(1)(2)(3); +curryResult0 = _.curry(testCurryFn)(1)(2, 3); +curryResult0 = _(testCurryFn).curry().value()(1, 2, 3); +curryResult2 = _(testCurryFn).curry().value()(1); + +declare function testCurry2(a: string, b: number, c: boolean): [string, number, boolean]; +let curryResult3: [string, number, boolean]; +let curryResult4: _.CurriedFunction1; +let curryResult5: _.CurriedFunction2; +let curryResult6: _.CurriedFunction3; +curryResult3 = _.curry(testCurry2)("1", 2, true); +curryResult3 = _.curry(testCurry2)("1", 2)(true); +curryResult3 = _.curry(testCurry2)("1")(2, true); +curryResult3 = _.curry(testCurry2)("1")(2)(true); +curryResult4 = _.curry(testCurry2)("1", 2); +curryResult4 = _.curry(testCurry2)("1")(2); +curryResult5 = _.curry(testCurry2)("1"); +curryResult6 = _.curry(testCurry2); + +// _.curryRight +var testCurryRightFn = (a: number, b: number, c: number) => [a, b, c]; +curryResult0 = _.curryRight(testCurryRightFn)(1, 2, 3); +curryResult2 = _.curryRight(testCurryRightFn)(1); +curryResult0 = _(testCurryRightFn).curryRight().value()(1, 2, 3); +curryResult2 = _(testCurryRightFn).curryRight().value()(1); + +let curryResult7: _.CurriedFunction1; +let curryResult8: _.CurriedFunction2; +let curryResult9: _.CurriedFunction3; +curryResult3 = _.curryRight(testCurry2)(true, 2, "1"); +curryResult3 = _.curryRight(testCurry2)(true, 2)("1"); +curryResult3 = _.curryRight(testCurry2)(true)(2, "1"); +curryResult3 = _.curryRight(testCurry2)(true)(2)("1"); +curryResult7 = _.curryRight(testCurry2)(true, 2); +curryResult7 = _.curryRight(testCurry2)(true)(2); +curryResult8 = _.curryRight(testCurry2)(true); +curryResult9 = _.curryRight(testCurry2); + +// _.debounce +module TestDebounce { + interface SampleFunc { + (n: number, s: string): boolean; + } + + interface Options { + leading?: boolean; + maxWait?: number; + trailing?: boolean; + } + + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } + + let func: SampleFunc; + let options: Options; + + { + let result: ResultFunc; + + result = _.debounce(func); + result = _.debounce(func, 42); + result = _.debounce(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).debounce(); + result = _(func).debounce(42); + result = _(func).debounce(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().debounce(); + result = _(func).chain().debounce(42); + result = _(func).chain().debounce(42, options); + } +} + +// _.defer +module TestDefer { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.defer(func); + result = _.defer(func, any); + result = _.defer(func, any, any); + result = _.defer(func, any, any, any); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).defer(); + result = _(func).defer(any); + result = _(func).defer(any, any); + result = _(func).defer(any, any, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().defer(); + result = _(func).chain().defer(any); + result = _(func).chain().defer(any, any); + result = _(func).chain().defer(any, any, any); + } +} + +// _.delay +module TestDelay { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.delay(func, 1); + result = _.delay(func, 1, 2); + result = _.delay(func, 1, 2, ''); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).delay(1); + result = _(func).delay(1, 2); + result = _(func).delay(1, 2, ''); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().delay(1); + result = _(func).chain().delay(1, 2); + result = _(func).chain().delay(1, 2, ''); + } +} + +// _.flow +module TestFlow { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +// _.flowRight +module TestFlowRight { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} + +// _.memoize +var testMemoizedFunction: _.MemoizedFunction; +result = <_.MapCache>testMemoizedFunction.cache; +interface TestMemoizedResultFn extends _.MemoizedFunction { + (...args: any[]): any; +} +var testMemoizeFn: (...args: any[]) => any; +var testMemoizeResolverFn: (...args: any[]) => any; +result = _.memoize(testMemoizeFn); +result = _.memoize(testMemoizeFn, testMemoizeResolverFn); +result = (_(testMemoizeFn).memoize().value()); +result = (_(testMemoizeFn).memoize(testMemoizeResolverFn).value()); + +// _.modArgs +module TestModArgs { + type Func1 = (a: boolean) => boolean; + type Func2 = (a: boolean, b: boolean) => boolean; + + let func1: Func1; + let func2: Func2; + + let transform1: (a: string) => boolean; + let transform2: (b: number) => boolean; + + { + let result: (a: string) => boolean; + + result = _.modArgs boolean>(func1, transform1); + result = _.modArgs boolean>(func1, [transform1]); + } + + { + let result: (a: string, b: number) => boolean; + + result = _.modArgs boolean>(func2, transform1, transform2); + result = _.modArgs boolean>(func2, [transform1, transform2]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; + + result = _(func1).modArgs<(a: string) => boolean>(transform1); + result = _(func1).modArgs<(a: string) => boolean>([transform1]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; + + result = _(func2).modArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + } + + { + let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; + + result = _(func1).chain().modArgs<(a: string) => boolean>(transform1); + result = _(func1).chain().modArgs<(a: string) => boolean>([transform1]); + } + + { + let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; + + result = _(func2).chain().modArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).chain().modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + } +} + +// _.negate +module TestNegate { + interface PredicateFn { + (a1: number, a2: number): boolean; + } + + interface ResultFn { + (a1: number, a2: number): boolean; + } + + var predicate = (a1: number, a2: number) => a1 > a2; + + { + let result: ResultFn; + + result = _.negate(predicate); + result = _.negate(predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(predicate).negate(); + result = _(predicate).negate(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(predicate).chain().negate(); + result = _(predicate).chain().negate(); + } +} + +// _.once +module TestOnce { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.once(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).once(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().once(); + } +} + +var greetPartial = function (greeting: string, name: string) { return greeting + ' ' + name; }; +var hi = _.partial(greetPartial, 'hi'); +hi('moe'); + + +var defaultsDeep = _.partialRight(_.merge, _.defaults); + +var optionsPartialRight = { + 'variable': 'data', + 'imports': { 'jq': $ } +}; + +defaultsDeep(optionsPartialRight, _.templateSettings); + +//_.rearg +var testReargFn = (a: string, b: string, c: string) => [a, b, c]; +interface TestReargResultFn { + (b: string, c: string, a: string): string[]; +} +result = (_.rearg(testReargFn, 2, 0, 1))('b', 'c', 'a'); +result = (_.rearg(testReargFn, [2, 0, 1]))('b', 'c', 'a'); +result = (_(testReargFn).rearg(2, 0, 1).value())('b', 'c', 'a'); +result = (_(testReargFn).rearg([2, 0, 1]).value())('b', 'c', 'a'); + +// _.restParam +module TestRestParam { + type Func = (a: string, b: number[]) => boolean; + type ResultFunc = (a: string, ...b: number[]) => boolean; + + let func: Func; + + { + let result: ResultFunc; + + result = _.restParam(func); + result = _.restParam(func, 1); + + result = _.restParam(func); + result = _.restParam(func, 1); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).restParam(); + result = _(func).restParam(1); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().restParam(); + result = _(func).chain().restParam(1); + } +} + +//_.spread +module TestSpread { + type SampleFunc = (args: (number|string)[]) => boolean; + type SampleResult = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: SampleResult; + + result = _.spread(func); + result = _.spread(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).spread(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().spread(); + } +} + +// _.throttle +module TestThrottle { + interface SampleFunc { + (n: number, s: string): boolean; + } + + interface Options { + leading?: boolean; + trailing?: boolean; + } + + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } + + let func: SampleFunc; + let options: Options; + + { + let result: ResultFunc; + + result = _.throttle(func); + result = _.throttle(func, 42); + result = _.throttle(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).throttle(); + result = _(func).throttle(42); + result = _(func).throttle(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().throttle(); + result = _(func).chain().throttle(42); + result = _(func).chain().throttle(42, options); + } +} + +// _.wrap +module TestWrap { + type SampleValue = {a: number; b: string; c: boolean} + type SampleResult = (arg2: number, arg3: string) => boolean; + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: SampleResult; + + result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); + result = _.wrap(value, wrapper); + } + + { + type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; + + let value: number; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; + + let value: number[]; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: _.LoDashImplicitObjectWrapper; + + result = _(value).wrap(wrapper); + result = _(value).wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; + + let value: number; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } + + { + type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; + + let value: number[]; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } + + { + type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; + + let value: SampleValue; + let wrapper: SampleWrapper; + let result: _.LoDashExplicitObjectWrapper; + + result = _(value).chain().wrap(wrapper); + result = _(value).chain().wrap(wrapper); + } +} + +/******** + * Lang * + ********/ + +// _.clone +interface TestCloneCustomizerFn { + (value: any): any; +} +var testCloneCustomizerFn: TestCloneCustomizerFn; +{ + let result: number; + result = _.clone(42); + result = _.clone(42, false); + result = _.clone(42, false, testCloneCustomizerFn); + result = _.clone(42, false, testCloneCustomizerFn, any); + result = _.clone(42, testCloneCustomizerFn); + result = _.clone(42, testCloneCustomizerFn, any); + result = _(42).clone(); + result = _(42).clone(false); + result = _(42).clone(false, testCloneCustomizerFn); + result = _(42).clone(false, testCloneCustomizerFn, any); + result = _(42).clone(testCloneCustomizerFn); + result = _(42).clone(testCloneCustomizerFn, any); +} +{ + let result: string[]; + result = _.clone([]); + result = _.clone([], false); + result = _.clone([], false, testCloneCustomizerFn); + result = _.clone([], false, testCloneCustomizerFn, any); + result = _.clone([], testCloneCustomizerFn); + result = _.clone([], testCloneCustomizerFn, any); + result = _([]).clone(); + result = _([]).clone(false); + result = _([]).clone(false, testCloneCustomizerFn); + result = _([]).clone(false, testCloneCustomizerFn, any); + result = _([]).clone(testCloneCustomizerFn); + result = _([]).clone(testCloneCustomizerFn, any); +} +{ + let result: {a: {b: number;}}; + result = _.clone<{a: {b: number;}}>({a: {b: 2}}); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn, any); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn); + result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn, any); + result = _({a: {b: 2}}).clone(); + result = _({a: {b: 2}}).clone(false); + result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn); + result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn, any); + result = _({a: {b: 2}}).clone(testCloneCustomizerFn); + result = _({a: {b: 2}}).clone(testCloneCustomizerFn, any); +} + +// _.cloneDeep +interface TestCloneDeepCustomizerFn { + (value: any): any; +} +var testCloneDeepCustomizerFn: TestCloneDeepCustomizerFn; +{ + let result: number; + result = _.cloneDeep(42); + result = _.cloneDeep(42, testCloneDeepCustomizerFn); + result = _.cloneDeep(42, testCloneDeepCustomizerFn, any); + result = _(42).cloneDeep(); + result = _(42).cloneDeep(testCloneDeepCustomizerFn); + result = _(42).cloneDeep(testCloneDeepCustomizerFn, any); +} +{ + let result: string[]; + result = _.cloneDeep([]); + result = _.cloneDeep([], testCloneDeepCustomizerFn); + result = _.cloneDeep([], testCloneDeepCustomizerFn, any); + result = _([]).cloneDeep(); + result = _([]).cloneDeep(testCloneDeepCustomizerFn); + result = _([]).cloneDeep(testCloneDeepCustomizerFn, any); +} +{ + let result: {a: {b: number;}}; + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}); + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn); + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn, any); + result = _({a: {b: 2}}).cloneDeep(); + result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn); + result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn, any); +} + +// _.eq +module TestEq { + let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + + { + let result: boolean; + + result = _.eq(any, any); + result = _.eq(any, any, customizer); + result = _.eq(any, any, customizer, any); + + result = _(any).eq(any); + result = _(any).eq(any, customizer); + result = _(any).eq(any, customizer, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(any).chain().eq(any); + result = _(any).chain().eq(any, customizer); + result = _(any).chain().eq(any, customizer, any); + } +} + +// _.gt +module TestGt { + { + let result: boolean; + + result = _.gt(any, any); + result = _(1).gt(any); + result = _([]).gt(any); + result = _({}).gt(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().gt(any); + result = _([]).chain().gt(any); + result = _({}).chain().gt(any); + } +} + +// _.gte +module TestGte { + { + let result: boolean; + + result = _.gte(any, any); + result = _(1).gte(any); + result = _([]).gte(any); + result = _({}).gte(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().gte(any); + result = _([]).chain().gte(any); + result = _({}).chain().gte(any); + } +} + +// _.isArguments +module TestisArguments { + { + let value: number|IArguments; + + if (_.isArguments(value)) { + let result: IArguments = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isArguments(any); + result = _(1).isArguments(); + result = _([]).isArguments(); + result = _({}).isArguments(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArguments(); + result = _([]).chain().isArguments(); + result = _({}).chain().isArguments(); + } +} + +// _.isArray +module TestIsArray { + { + let value: number|string[]|boolean[]; + + if (_.isArray(value)) { + let result: string[] = value; + } + else { + if (_.isArray(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArray(any); + result = _(1).isArray(); + result = _([]).isArray(); + result = _({}).isArray(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArray(); + result = _([]).chain().isArray(); + result = _({}).chain().isArray(); + } +} + +// _.isBoolean +module TestIsBoolean { + { + let value: number|boolean; + + if (_.isBoolean(value)) { + let result: boolean = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isBoolean(any); + result = _(1).isBoolean(); + result = _([]).isBoolean(); + result = _({}).isBoolean(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isBoolean(); + result = _([]).chain().isBoolean(); + result = _({}).chain().isBoolean(); + } +} + +// _.isDate +module TestIsBoolean { + { + let value: number|Date; + + if (_.isDate(value)) { + let result: Date = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isDate(any); + result = _(42).isDate(); + result = _([]).isDate(); + result = _({}).isDate(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().isDate(); + result = _([]).chain().isDate(); + result = _({}).chain().isDate(); + } +} + +// _.isElement +module TestIsElement { + { + let result: boolean; + + result = _.isElement(any); + + result = _(42).isElement(); + result = _([]).isElement(); + result = _({}).isElement(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().isElement(); + result = _([]).chain().isElement(); + result = _({}).chain().isElement(); + } +} + +// _.isEmpty +result = _.isEmpty([1, 2, 3]); +result = _.isEmpty({}); +result = _.isEmpty(''); +result = _([1, 2, 3]).isEmpty(); +result = _({}).isEmpty(); +result = _('').isEmpty(); + +// _.isEqual +module TestIsEqual { + let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + + { + let result: boolean; + + result = _.isEqual(any, any); + result = _.isEqual(any, any, customizer); + result = _.isEqual(any, any, customizer, any); + + result = _(any).isEqual(any); + result = _(any).isEqual(any, customizer); + result = _(any).isEqual(any, customizer, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(any).chain().isEqual(any); + result = _(any).chain().isEqual(any, customizer); + result = _(any).chain().isEqual(any, customizer, any); + } +} + +// _.isError +module TestIsError { + { + let value: number|Error; + + if (_.isError(value)) { + let result: Error = value; + } + else { + let result: number = value; + } + } + + { + class CustomError extends Error {} + + let value: number|CustomError; + + if (_.isError(value)) { + let result: CustomError = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isError(any); + result = _(1).isError(); + result = _([]).isError(); + result = _({}).isError(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isError(); + result = _([]).chain().isError(); + result = _({}).chain().isError(); + } +} + +// _.isFinite +module TestIsFinite { + { + let result: boolean; + + result = _.isFinite(any); + result = _(1).isFinite(); + result = _([]).isFinite(); + result = _({}).isFinite(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFinite(); + result = _([]).chain().isFinite(); + result = _({}).chain().isFinite(); + } +} + +// _.isFunction +module TestIsFunction { + { + let value: number|Function; + + if (_.isFunction(value)) { + let result: Function = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isFunction(any); + result = _(1).isFunction(); + result = _([]).isFunction(); + result = _({}).isFunction(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFunction(); + result = _([]).chain().isFunction(); + result = _({}).chain().isFunction(); + } +} + +// _.isMatch +var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; +result = _.isMatch({}, {}); +result = _.isMatch({}, {}, testIsMatchCustiomizerFn); +result = _.isMatch({}, {}, testIsMatchCustiomizerFn, {}); +result = _({}).isMatch({}); +result = _({}).isMatch({}, testIsMatchCustiomizerFn); +result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); + +// _.isNaN +module TestIsNaN { + { + let result: boolean; + + result = _.isNaN(any); + + result = _(1).isNaN(); + result = _([]).isNaN(); + result = _({}).isNaN(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNaN(); + result = _([]).chain().isNaN(); + result = _({}).chain().isNaN(); + } +} + +// _.isNative +module TestIsNative { + { + let value: number|Function; + + if (_.isNative(value)) { + let result: Function = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isNative(any); + + result = _(1).isNative(); + result = _([]).isNative(); + result = _({}).isNative(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNative(); + result = _([]).chain().isNative(); + result = _({}).chain().isNative(); + } +} + +// _.isNull +module TestIsNull { + { + let result: boolean; + + result = _.isNull(any); + + result = _(1).isNull(); + result = _([]).isNull(); + result = _({}).isNull(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNull(); + result = _([]).chain().isNull(); + result = _({}).chain().isNull(); + } +} + +// _.isNumber +module TestIsNumber { + { + let value: string|number; + + if (_.isNumber(value)) { + let result: number = value; + } + else { + let result: string = value; + } + } + + { + let result: boolean; + + result = _.isNumber(any); + + result = _(1).isNumber(); + result = _([]).isNumber(); + result = _({}).isNumber(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNumber(); + result = _([]).chain().isNumber(); + result = _({}).chain().isNumber(); + } +} + +// _.isObject +module TestIsObject { + { + let result: boolean; + + result = _.isObject(any); + result = _(1).isObject(); + result = _([]).isObject(); + result = _({}).isObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isObject(); + result = _([]).chain().isObject(); + result = _({}).chain().isObject(); + } +} + +// _.isPlainObject +module TestIsPlainObject { + { + let result: boolean; + + result = _.isPlainObject(any); + result = _(1).isPlainObject(); + result = _([]).isPlainObject(); + result = _({}).isPlainObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isPlainObject(); + result = _([]).chain().isPlainObject(); + result = _({}).chain().isPlainObject(); + } +} + +// _.isRegExp +module TestIsRegExp { + { + let value: number|RegExp; + + if (_.isRegExp(value)) { + let result: RegExp = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isRegExp(any); + result = _(1).isRegExp(); + result = _([]).isRegExp(); + result = _({}).isRegExp(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isRegExp(); + result = _([]).chain().isRegExp(); + result = _({}).chain().isRegExp(); + } +} + +// _.isString +module TestIsString { + { + let value: number|string; + + if (_.isString(value)) { + let result: string = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isString(any); + result = _(1).isString(); + result = _([]).isString(); + result = _({}).isString(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isString(); + result = _([]).chain().isString(); + result = _({}).chain().isString(); + } +} + +// _.isTypedArray +module TestIsTypedArray { + { + let result: boolean; + + result = _.isTypedArray([]); + result = _([]).isTypedArray(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _([]).chain().isTypedArray(); + } +} + +// _.isUndefined +module TestIsUndefined { + { + let result: boolean; + + result = _.isUndefined(any); + + result = _(1).isUndefined(); + result = _([]).isUndefined(); + result = _({}).isUndefined(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isUndefined(); + result = _([]).chain().isUndefined(); + result = _({}).chain().isUndefined(); + } +} + +// _.lt +module TestLt { + { + let result: boolean; + + result = _.lt(any, any); + result = _(1).lt(any); + result = _([]).lt(any); + result = _({}).lt(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().lt(any); + result = _([]).chain().lt(any); + result = _({}).chain().lt(any); + } +} + +// _.lte +module TestLte { + { + let result: boolean; + + result = _.lte(any, any); + result = _(1).lte(any); + result = _([]).lte(any); + result = _({}).lte(any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().lte(any); + result = _([]).chain().lte(any); + result = _({}).chain().lte(any); + } +} + +// _.toArray +module TestToArray { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; + + { + let result: string[]; + + result = _.toArray(''); + result = _.toArray(''); + } + + { + let result: TResult[]; + + result = _.toArray(array); + result = _.toArray(list); + result = _.toArray(dictionary); + result = _.toArray(numericDictionary); + + result = _.toArray(array); + result = _.toArray(list); + result = _.toArray(dictionary); + result = _.toArray(numericDictionary); + } + + { + let result: any[]; + + result = _.toArray(); + result = _.toArray(42); + result = _.toArray(true); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).toArray(); + result = _(list).toArray(); + result = _(dictionary).toArray(); + result = _(numericDictionary).toArray(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().toArray(); + result = _(list).chain().toArray(); + result = _(dictionary).chain().toArray(); + result = _(numericDictionary).chain().toArray(); + } +} + +// _.toPlainObject +module TestToPlainObject { + let result: TResult; + + result = _.toPlainObject(); + result = _.toPlainObject(true); + result = _.toPlainObject(1); + result = _.toPlainObject('a'); + result = _.toPlainObject([]); + result = _.toPlainObject({}); + + result = _(true).toPlainObject().value(); + result = _(1).toPlainObject().value(); + result = _('a').toPlainObject().value(); + result = _([1]).toPlainObject().value(); + result = _([]).toPlainObject().value(); + result = _({}).toPlainObject().value(); +} + +/******** + * Math * + ********/ + +// _.add +module TestAdd { + { + let result: number; + + result = _.add(1, 1); + result = _(1).add(1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().add(1); + } +} + +// _.ceil +module TestCeil { + { + let result: number; + + result = _.ceil(6.004); + result = _.ceil(6.004, 2); + + result = _(6.004).ceil(); + result = _(6.004).ceil(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(6.004).chain().ceil(); + result = _(6.004).chain().ceil(2); + } +} + +// _.floor +module TestFloor { + { + let result: number; + + result = _.floor(4.006); + result = _.floor(0.046, 2); + result = _.floor(4060, -2); + + result = _(4.006).floor(); + result = _(0.046).floor(2); + result = _(4060).floor(-2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(4.006).chain().floor(); + result = _(0.046).chain().floor(2); + result = _(4060).chain().floor(-2); + } +} + +// _.max +module TestMax { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + let result: number; + + result = _.max(array); + result = _.max(array, listIterator); + result = _.max(array, listIterator, any); + result = _.max(array, ''); + result = _.max<{a: number}, number>(array, {a: 42}); + + result = _.max(list); + result = _.max(list, listIterator); + result = _.max(list, listIterator, any); + result = _.max(list, ''); + result = _.max<{a: number}, number>(list, {a: 42}); + + result = _.max(dictionary); + result = _.max(dictionary, dictionaryIterator); + result = _.max(dictionary, dictionaryIterator, any); + result = _.max(dictionary, ''); + result = _.max<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).max(); + result = _(array).max(listIterator); + result = _(array).max(listIterator, any); + result = _(array).max(''); + result = _(array).max<{a: number}>({a: 42}); + + result = _(list).max(); + result = _(list).max(listIterator); + result = _(list).max(listIterator, any); + result = _(list).max(''); + result = _(list).max<{a: number}, number>({a: 42}); + + result = _(dictionary).max(); + result = _(dictionary).max(dictionaryIterator); + result = _(dictionary).max(dictionaryIterator, any); + result = _(dictionary).max(''); + result = _(dictionary).max<{a: number}, number>({a: 42}); +} + +// _.min +module TestMin { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + let result: number; + + result = _.min(array); + result = _.min(array, listIterator); + result = _.min(array, listIterator, any); + result = _.min(array, ''); + result = _.min<{a: number}, number>(array, {a: 42}); + + result = _.min(list); + result = _.min(list, listIterator); + result = _.min(list, listIterator, any); + result = _.min(list, ''); + result = _.min<{a: number}, number>(list, {a: 42}); + + result = _.min(dictionary); + result = _.min(dictionary, dictionaryIterator); + result = _.min(dictionary, dictionaryIterator, any); + result = _.min(dictionary, ''); + result = _.min<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).min(); + result = _(array).min(listIterator); + result = _(array).min(listIterator, any); + result = _(array).min(''); + result = _(array).min<{a: number}>({a: 42}); + + result = _(list).min(); + result = _(list).min(listIterator); + result = _(list).min(listIterator, any); + result = _(list).min(''); + result = _(list).min<{a: number}, number>({a: 42}); + + result = _(dictionary).min(); + result = _(dictionary).min(dictionaryIterator); + result = _(dictionary).min(dictionaryIterator, any); + result = _(dictionary).min(''); + result = _(dictionary).min<{a: number}, number>({a: 42}); +} + +// _.round +module TestRound { + { + let result: number; + + result = _.round(4.006); + result = _.round(4.006, 2); + + result = _(4.006).round(); + result = _(4.006).round(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(4.006).chain().round(); + result = _(4.006).chain().round(2); + } +} + +// _.sum +module TestSum { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + { + let result: number; + + result = _.sum(array); + result = _.sum(array); + result = _.sum(array, listIterator); + result = _.sum(array, listIterator, any); + result = _.sum(array, ''); + + + result = _.sum(list); + result = _.sum(list); + result = _.sum(list, listIterator); + result = _.sum(list, listIterator, any); + result = _.sum(list, ''); + + result = _.sum(dictionary); + result = _.sum(dictionary); + result = _.sum(dictionary, dictionaryIterator); + result = _.sum(dictionary, dictionaryIterator, any); + result = _.sum(dictionary, ''); + + result = _(array).sum(); + result = _(array).sum(listIterator); + result = _(array).sum(listIterator, any); + result = _(array).sum(''); + + + result = _(list).sum(); + result = _(list).sum(listIterator); + result = _(list).sum(listIterator, any); + result = _(list).sum(''); + + result = _(dictionary).sum(); + result = _(dictionary).sum(dictionaryIterator); + result = _(dictionary).sum(dictionaryIterator, any); + result = _(dictionary).sum(''); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().sum(); + result = _(array).chain().sum(listIterator); + result = _(array).chain().sum(listIterator, any); + result = _(array).chain().sum(''); + + + result = _(list).chain().sum(); + result = _(list).chain().sum(listIterator); + result = _(list).chain().sum(listIterator, any); + result = _(list).chain().sum(''); + + result = _(dictionary).chain().sum(); + result = _(dictionary).chain().sum(dictionaryIterator); + result = _(dictionary).chain().sum(dictionaryIterator, any); + result = _(dictionary).chain().sum(''); + } +} + +/********** + * Number * + **********/ + +// _.inRange +module TestInRange { + { + let result: boolean; + + result = _.inRange(3, 2, 4); + result = _.inRange(4, 8); + + result = _(3).inRange(2, 4); + result = _(4).inRange(8); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(3).chain().inRange(2, 4); + result = _(4).chain().inRange(8); + } +} + +// _.random +module TestRandom { + { + let result: number; + + result = _.random(); + result = _.random(1); + result = _.random(1, 2); + result = _.random(1, 2, true); + result = _.random(1, true); + result = _.random(true); + + result = _(1).random(); + result = _(1).random(2); + result = _(1).random(2, true); + result = _(1).random(true); + result = _(true).random(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().random(); + result = _(1).chain().random(2); + result = _(1).chain().random(2, true); + result = _(1).chain().random(true); + result = _(true).chain().random(); + } +} + +/********** + * Object * + **********/ + +// _.assign +module TestAssign { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assign(obj); + } + + { + let result: {a: number}; + + result = _.assign(obj, s1); + result = _.assign(obj, s1, customizer); + result = _.assign(obj, s1, customizer, any); + } + + { + let result: {a: number, b: number}; + + result = _.assign(obj, s1, s2); + result = _.assign(obj, s1, s2, customizer); + result = _.assign(obj, s1, s2, customizer, any); + } + + { + let result: {a: number, b: number, c: number}; + + result = _.assign(obj, s1, s2, s3); + result = _.assign(obj, s1, s2, s3, customizer); + result = _.assign(obj, s1, s2, s3, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number}; + + result = _.assign(obj, s1, s2, s3, s4); + result = _.assign(obj, s1, s2, s3, s4, customizer); + result = _.assign(obj, s1, s2, s3, s4, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + + result = _.assign(obj, s1, s2, s3, s4, s5); + result = _.assign(obj, s1, s2, s3, s4, s5, customizer); + result = _.assign(obj, s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assign(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + + result = _(obj).assign(s1); + result = _(obj).assign(s1, customizer); + result = _(obj).assign(s1, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).assign(s1, s2); + result = _(obj).assign(s1, s2, customizer); + result = _(obj).assign(s1, s2, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).assign(s1, s2, s3); + result = _(obj).assign(s1, s2, s3, customizer); + result = _(obj).assign(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).assign(s1, s2, s3, s4); + result = _(obj).assign(s1, s2, s3, s4, customizer); + result = _(obj).assign(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assign(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + + result = _(obj).chain().assign(s1); + result = _(obj).chain().assign(s1, customizer); + result = _(obj).chain().assign(s1, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).chain().assign(s1, s2); + result = _(obj).chain().assign(s1, s2, customizer); + result = _(obj).chain().assign(s1, s2, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).chain().assign(s1, s2, s3); + result = _(obj).chain().assign(s1, s2, s3, customizer); + result = _(obj).chain().assign(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).chain().assign(s1, s2, s3, s4); + result = _(obj).chain().assign(s1, s2, s3, s4, customizer); + result = _(obj).chain().assign(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); + } +} + +// _.create +module TestCreate { + type SampleProto = {a: number}; + type SampleProps = {b: string}; + + let prototype: SampleProto; + let properties: SampleProps; + + { + let result: {a: number; b: string}; + + result = _.create(prototype, properties); + result = _.create(prototype, properties); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number; b: string}>; + + result = _(prototype).create(properties); + result = _(prototype).create(properties); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number; b: string}>; + + result = _(prototype).chain().create(properties); + result = _(prototype).chain().create(properties); + } +} + +// _.defaults +module TestDefaults { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + { + let result: Obj; + + result = _.defaults(obj); + } + + { + let result: {a: string}; + + result = _.defaults(obj, s1); + } + + { + let result: {a: string, b: number}; + + result = _.defaults(obj, s1, s2); + } + + { + let result: {a: string, b: number, c: number}; + + result = _.defaults(obj, s1, s2, s3); + } + + { + let result: {a: string, b: number, c: number, d: number}; + + result = _.defaults(obj, s1, s2, s3, s4); + } + + { + let result: {a: string, b: number, c: number, d: number, e: number}; + + result = _.defaults(obj, s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).defaults(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string}>; + + result = _(obj).defaults(s1); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number}>; + + result = _(obj).defaults(s1, s2); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number, c: number}>; + + result = _(obj).defaults(s1, s2, s3); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number, c: number, d: number}>; + + result = _(obj).defaults(s1, s2, s3, s4); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: string, b: number, c: number, d: number, e: number}>; + + result = _(obj).defaults<{a: string, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().defaults(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}>; + + result = _(obj).chain().defaults(s1); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number}>; + + result = _(obj).chain().defaults(s1, s2); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number, c: number}>; + + result = _(obj).chain().defaults(s1, s2, s3); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number, c: number, d: number}>; + + result = _(obj).chain().defaults(s1, s2, s3, s4); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().defaults<{a: string, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } +} + +//_.defaultsDeep +interface DefaultsDeepResult { + user: { + name: string; + age: number; + } +} +var TestDefaultsDeepObject = {'user': {'name': 'barney'}}; +var TestDefaultsDeepSource = {'user': {'name': 'fred', 'age': 36}}; +result = _.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource); +result = _(TestDefaultsDeepObject).defaultsDeep(TestDefaultsDeepSource).value(); + +// _.extend +module TestExtend { + type Obj = {a: string}; + type S1 = {a: number}; + type S2 = {b: number}; + type S3 = {c: number}; + type S4 = {d: number}; + type S5 = {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.extend(obj); + } + + { + let result: {a: number}; + + result = _.extend(obj, s1); + result = _.extend(obj, s1, customizer); + result = _.extend(obj, s1, customizer, any); + } + + { + let result: {a: number, b: number}; + + result = _.extend(obj, s1, s2); + result = _.extend(obj, s1, s2, customizer); + result = _.extend(obj, s1, s2, customizer, any); + } + + { + let result: {a: number, b: number, c: number}; + + result = _.extend(obj, s1, s2, s3); + result = _.extend(obj, s1, s2, s3, customizer); + result = _.extend(obj, s1, s2, s3, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number}; + + result = _.extend(obj, s1, s2, s3, s4); + result = _.extend(obj, s1, s2, s3, s4, customizer); + result = _.extend(obj, s1, s2, s3, s4, customizer, any); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + + result = _.extend(obj, s1, s2, s3, s4, s5); + result = _.extend(obj, s1, s2, s3, s4, s5, customizer); + result = _.extend(obj, s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).extend(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + + result = _(obj).extend(s1); + result = _(obj).extend(s1, customizer); + result = _(obj).extend(s1, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).extend(s1, s2); + result = _(obj).extend(s1, s2, customizer); + result = _(obj).extend(s1, s2, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).extend(s1, s2, s3); + result = _(obj).extend(s1, s2, s3, customizer); + result = _(obj).extend(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).extend(s1, s2, s3, s4); + result = _(obj).extend(s1, s2, s3, s4, customizer); + result = _(obj).extend(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).extend(s1, s2, s3, s4, s5); + result = _(obj).extend(s1, s2, s3, s4, s5, customizer); + result = _(obj).extend(s1, s2, s3, s4, s5, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().extend(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + + result = _(obj).chain().extend(s1); + result = _(obj).chain().extend(s1, customizer); + result = _(obj).chain().extend(s1, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).chain().extend(s1, s2); + result = _(obj).chain().extend(s1, s2, customizer); + result = _(obj).chain().extend(s1, s2, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).chain().extend(s1, s2, s3); + result = _(obj).chain().extend(s1, s2, s3, customizer); + result = _(obj).chain().extend(s1, s2, s3, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).chain().extend(s1, s2, s3, s4); + result = _(obj).chain().extend(s1, s2, s3, s4, customizer); + result = _(obj).chain().extend(s1, s2, s3, s4, customizer, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().extend(s1, s2, s3, s4, s5); + result = _(obj).chain().extend(s1, s2, s3, s4, s5, customizer); + result = _(obj).chain().extend(s1, s2, s3, s4, s5, customizer, any); + } +} + +// _.findKey +module TestFindKey { + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; + + result = _.findKey<{a: string;}>({a: ''}); + + result = _.findKey<{a: string;}>({a: ''}, predicateFn); + result = _.findKey<{a: string;}>({a: ''}, predicateFn, any); + + + result = _.findKey<{a: string;}>({a: ''}, ''); + result = _.findKey<{a: string;}>({a: ''}, '', any); + + result = _.findKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); + + result = _<{a: string;}>({a: ''}).findKey(); + + result = _<{a: string;}>({a: ''}).findKey(predicateFn); + result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).findKey(''); + result = _<{a: string;}>({a: ''}).findKey('', any); + + result = _<{a: string;}>({a: ''}).findKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; + + result = _.findKey({a: ''}, predicateFn); + result = _.findKey({a: ''}, predicateFn, any); + + result = _<{a: string;}>({a: ''}).findKey(predicateFn); + result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); + } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(); + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findKey(''); + result = _<{a: string;}>({a: ''}).chain().findKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); + } +} + +// _.findLastKey +module TestFindLastKey { + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: string; + + result = _.findLastKey<{a: string;}>({a: ''}); + + result = _.findLastKey<{a: string;}>({a: ''}, predicateFn); + result = _.findLastKey<{a: string;}>({a: ''}, predicateFn, any); + + + result = _.findLastKey<{a: string;}>({a: ''}, ''); + result = _.findLastKey<{a: string;}>({a: ''}, '', any); + + result = _.findLastKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); + + result = _<{a: string;}>({a: ''}).findLastKey(); + + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).findLastKey(''); + result = _<{a: string;}>({a: ''}).findLastKey('', any); + + result = _<{a: string;}>({a: ''}).findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: string; + + result = _.findLastKey({a: ''}, predicateFn); + result = _.findLastKey({a: ''}, predicateFn, any); + + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); + } + + { + let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(); + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + + + result = _<{a: string;}>({a: ''}).chain().findLastKey(''); + result = _<{a: string;}>({a: ''}).chain().findLastKey('', any); + + result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); + } + + { + let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let result: _.LoDashExplicitWrapper; + + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); + result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); + } +} + +// _.forIn +module TestForIn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forIn(dictionary); + result = _.forIn(dictionary, dictionaryIterator); + result = _.forIn(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forIn(object); + result = _.forIn(object, objectIterator); + result = _.forIn(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forIn(); + result = _(dictionary).forIn(dictionaryIterator); + result = _(dictionary).forIn(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forIn(); + result = _(dictionary).chain().forIn(dictionaryIterator); + result = _(dictionary).chain().forIn(dictionaryIterator, any); + } +} + +// _.forInRight +module TestForInRight { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forInRight(dictionary); + result = _.forInRight(dictionary, dictionaryIterator); + result = _.forInRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forInRight(object); + result = _.forInRight(object, objectIterator); + result = _.forInRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forInRight(); + result = _(dictionary).forInRight(dictionaryIterator); + result = _(dictionary).forInRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forInRight(); + result = _(dictionary).chain().forInRight(dictionaryIterator); + result = _(dictionary).chain().forInRight(dictionaryIterator, any); + } +} + +// _.forOwn +module TestForOwn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forOwn(dictionary); + result = _.forOwn(dictionary, dictionaryIterator); + result = _.forOwn(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forOwn(object); + result = _.forOwn(object, objectIterator); + result = _.forOwn(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forOwn(); + result = _(dictionary).forOwn(dictionaryIterator); + result = _(dictionary).forOwn(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forOwn(); + result = _(dictionary).chain().forOwn(dictionaryIterator); + result = _(dictionary).chain().forOwn(dictionaryIterator, any); + } +} + +// _.forOwnRight +module TestForOwnRight { + type SampleObject = {a: number; b: string; c: boolean;}; + + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forOwnRight(dictionary); + result = _.forOwnRight(dictionary, dictionaryIterator); + result = _.forOwnRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forOwnRight(object); + result = _.forOwnRight(object, objectIterator); + result = _.forOwnRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forOwnRight(); + result = _(dictionary).forOwnRight(dictionaryIterator); + result = _(dictionary).forOwnRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forOwnRight(); + result = _(dictionary).chain().forOwnRight(dictionaryIterator); + result = _(dictionary).chain().forOwnRight(dictionaryIterator, any); + } +} + +// _.functions +module TestFunctions { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: string[]; + + result = _.functions(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).functions(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().functions(); + } +} + +// _.get +result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); + +{ + let result: TResult; + result = _.get({}, ''); + result = _.get({}, 42); + result = _.get({}, true); + result = _.get({}, ['', 42, true]); + result = _({}).get(''); + result = _({}).get(42); + result = _({}).get(true); + result = _({}).get(['', 42, true]); +} + +// _.has +module TestHas { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: boolean; + + result = _.has(object, ''); + result = _.has(object, 42); + result = _.has(object, true); + result = _.has(object, ['', 42, true]); + + result = _(object).has(''); + result = _(object).has(42); + result = _(object).has(true); + result = _(object).has(['', 42, true]); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(object).chain().has(''); + result = _(object).chain().has(42); + result = _(object).chain().has(true); + result = _(object).chain().has(['', 42, true]); + } +} + +// _.invert +module TestInvert { + { + let result: TResult; + + result = _.invert({}); + result = _.invert({}, true); + + result = _.invert({}); + result = _.invert({}, true); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).invert(); + result = _({}).invert(true); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().invert(); + result = _({}).chain().invert(true); + } +} + +// _.keys +module TestKeys { + let object: _.Dictionary; + + { + let result: string[]; + + result = _.keys(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keys(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keys(); + } +} + +// _.keysIn +module TestKeysIn { + let object: _.Dictionary; + + { + let result: string[]; + + result = _.keysIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).keysIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().keysIn(); + } +} + +// _.mapKeys +module TestMapKeys { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: TResult, index: number, collection: _.List) => string; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => string; + + { + let result: _.Dictionary; + + result = _.mapKeys(array); + result = _.mapKeys(array, listIterator); + result = _.mapKeys(array, listIterator, any); + result = _.mapKeys(array, ''); + result = _.mapKeys(array, '', any); + result = _.mapKeys(array, {}); + + result = _.mapKeys(list); + result = _.mapKeys(list, listIterator); + result = _.mapKeys(list, listIterator, any); + result = _.mapKeys(list, ''); + result = _.mapKeys(list, '', any); + result = _.mapKeys(list, {}); + + result = _.mapKeys(dictionary); + result = _.mapKeys(dictionary, dictionaryIterator); + result = _.mapKeys(dictionary, dictionaryIterator, any); + result = _.mapKeys(dictionary, ''); + result = _.mapKeys(dictionary, '', any); + result = _.mapKeys(dictionary, {}); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(array).mapKeys(); + result = _(array).mapKeys(listIterator); + result = _(array).mapKeys(listIterator, any); + result = _(array).mapKeys(''); + result = _(array).mapKeys('', any); + result = _(array).mapKeys<{}>({}); + + result = _(list).mapKeys(); + result = _(list).mapKeys(listIterator); + result = _(list).mapKeys(listIterator, any); + result = _(list).mapKeys(''); + result = _(list).mapKeys('', any); + result = _(list).mapKeys({}); + + result = _(dictionary).mapKeys(); + result = _(dictionary).mapKeys(dictionaryIterator); + result = _(dictionary).mapKeys(dictionaryIterator, any); + result = _(dictionary).mapKeys(''); + result = _(dictionary).mapKeys('', any); + result = _(dictionary).mapKeys({}); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(array).chain().mapKeys(); + result = _(array).chain().mapKeys(listIterator); + result = _(array).chain().mapKeys(listIterator, any); + result = _(array).chain().mapKeys(''); + result = _(array).chain().mapKeys('', any); + result = _(array).chain().mapKeys<{}>({}); + + result = _(list).chain().mapKeys(); + result = _(list).chain().mapKeys(listIterator); + result = _(list).chain().mapKeys(listIterator, any); + result = _(list).chain().mapKeys(''); + result = _(list).chain().mapKeys('', any); + result = _(list).chain().mapKeys({}); + + result = _(dictionary).chain().mapKeys(); + result = _(dictionary).chain().mapKeys(dictionaryIterator); + result = _(dictionary).chain().mapKeys(dictionaryIterator, any); + result = _(dictionary).chain().mapKeys(''); + result = _(dictionary).chain().mapKeys('', any); + result = _(dictionary).chain().mapKeys({}); + } +} + +// _.merge +module TestMerge { + type InitialValue = { a : number }; + type MergingValue = { b : string }; + + var initialValue = { a : 1 }; + var mergingValue = { b : "hi" }; + + type ExpectedResult = { a: number, b: string }; + let result: ExpectedResult; + + let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; + + // Test for basic merging + + result = _.merge(initialValue, mergingValue); + result = _.merge(initialValue, mergingValue, customizer); + result = _.merge(initialValue, mergingValue, customizer, any); + + result = _.merge(initialValue, {}, mergingValue); + result = _.merge(initialValue, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, mergingValue, customizer, any); + + result = _.merge(initialValue, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, mergingValue, customizer, any); + + result = _.merge(initialValue, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer, any); + + // Once we get to the varargs version, you have to specify the result explicitly + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer); + result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer, any); + + // Test for multiple combinations of many types + + type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; + + var complicatedResult: ComplicatedExpectedType = _.merge({ a: 1 }, + { b: "string" }, + { c: {} }, + { d: [1] }, + { e: true }); + // Test for type overriding + + type ExpectedTypeAfterOverriding = { a: boolean }; + + var overriddenResult: ExpectedTypeAfterOverriding = _.merge({ a: 1 }, + { a: "string" }, + { a: {} }, + { a: [1] }, + { a: true }); + + // Tests for basic chaining with merge + + result = _(initialValue).merge(mergingValue).value(); + result = _(initialValue).merge(mergingValue, customizer).value(); + result = _(initialValue).merge(mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, mergingValue).value(); + result = _(initialValue).merge({}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, mergingValue, customizer, any).value(); + + result = _(initialValue).merge({}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, {}, mergingValue, customizer, any).value(); + + // Once we get to the varargs version, you have to specify the result explicitly + result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer).value(); + result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer, any).value(); + + // Test complex multiple combinations with chaining + + var complicatedResult: ComplicatedExpectedType = _({ a: 1 }).merge({ b: "string" }, + { c: {} }, + { d: [1] }, + { e: true }).value(); + + // Test for type overriding with chaining + + var overriddenResult: ExpectedTypeAfterOverriding = _({ a: 1 }).merge({ a: "string" }, + { a: {} }, + { a: [1] }, + { a: true }).value(); + +} + +// _.methods +module TestFunctions { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: string[]; + + result = _.methods(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).methods(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().methods(); + } +} + +// _.omit +module TestOmit { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.omit({}, 'a'); + result = _.omit({}, 0, 'a'); + result = _.omit({}, true, 0, 'a'); + result = _.omit({}, ['b', 1, false], true, 0, 'a'); + result = _.omit({}, predicate); + result = _.omit({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).omit('a'); + result = _({}).omit(0, 'a'); + result = _({}).omit(true, 0, 'a'); + result = _({}).omit(['b', 1, false], true, 0, 'a'); + result = _({}).omit(predicate); + result = _({}).omit(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().omit('a'); + result = _({}).chain().omit(0, 'a'); + result = _({}).chain().omit(true, 0, 'a'); + result = _({}).chain().omit(['b', 1, false], true, 0, 'a'); + result = _({}).chain().omit(predicate); + result = _({}).chain().omit(predicate, any); + } +} + +// _.pairs +module TestPairs { + let object: _.Dictionary; + + { + let result: any[][]; + + result = _.pairs<_.Dictionary>(object); + } + + { + let result: string[][]; + + result = _.pairs<_.Dictionary, string>(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).pairs(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).pairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().pairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().pairs(); + } +} + +// _.pick +module TestPick { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.pick({}, 'a'); + result = _.pick({}, 0, 'a'); + result = _.pick({}, true, 0, 'a'); + result = _.pick({}, ['b', 1, false], true, 0, 'a'); + result = _.pick({}, predicate); + result = _.pick({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).pick('a'); + result = _({}).pick(0, 'a'); + result = _({}).pick(true, 0, 'a'); + result = _({}).pick(['b', 1, false], true, 0, 'a'); + result = _({}).pick(predicate); + result = _({}).pick(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().pick('a'); + result = _({}).chain().pick(0, 'a'); + result = _({}).chain().pick(true, 0, 'a'); + result = _({}).chain().pick(['b', 1, false], true, 0, 'a'); + result = _({}).chain().pick(predicate); + result = _({}).chain().pick(predicate, any); + } +} + +// _.result +{ + let testResultPath: number|string|boolean|Array; + let testResultDefaultValue: TResult; + let result: TResult; + result = _.result<{}, TResult>({}, testResultPath); + result = _.result<{}, TResult>({}, testResultPath, testResultDefaultValue); + result = _({}).result(testResultPath); + result = _({}).result(testResultPath, testResultDefaultValue); +} + +// _.set +module TestSet { + type SampleValue = {a: number; b: string; c: boolean;}; + + let object: TResult; + let value = {a: 1, b: '', c: true}; + + { + let result: TResult; + + result = _.set(object, '', any); + result = _.set(object, ['a', 'b', 1], any); + + result = _.set(object, '', value); + result = _.set(object, ['a', 'b', 1], value); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).set('', any); + result = _(object).set(['a', 'b', 1], any); + + result = _(object).set('', value); + result = _(object).set(['a', 'b', 1], value); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().set('', any); + result = _(object).chain().set(['a', 'b', 1], any); + + result = _(object).chain().set('', value); + result = _(object).chain().set(['a', 'b', 1], value); + } +} + +// _.transform +module TestTransform { + let array: number[]; + let dictionary: _.Dictionary; + + { + let iterator: (acc: TResult[], curr: number, index?: number, arr?: number[]) => void; + let accumulator: TResult[]; + let result: TResult[]; + + result = _.transform(array); + result = _.transform(array, iterator); + result = _.transform(array, iterator, accumulator); + result = _.transform(array, iterator, accumulator, any); + + result = _(array).transform().value(); + result = _(array).transform(iterator).value(); + result = _(array).transform(iterator, accumulator).value(); + result = _(array).transform(iterator, accumulator, any).value(); + } + + { + let iterator: (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => void; + let accumulator: _.Dictionary; + let result: _.Dictionary; + + result = _.transform(array, iterator); + result = _.transform(array, iterator, accumulator); + result = _.transform(array, iterator, accumulator, any); + + result = _(array).transform(iterator).value(); + result = _(array).transform(iterator, accumulator).value(); + result = _(array).transform(iterator, accumulator, any).value(); + } + + { + let iterator: (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => void; + let accumulator: _.Dictionary; + let result: _.Dictionary; + + result = _.transform(dictionary); + result = _.transform(dictionary, iterator); + result = _.transform(dictionary, iterator, accumulator); + result = _.transform(dictionary, iterator, accumulator, any); + + result = _(dictionary).transform().value(); + result = _(dictionary).transform(iterator).value(); + result = _(dictionary).transform(iterator, accumulator).value(); + result = _(dictionary).transform(iterator, accumulator, any).value(); + } + + { + let iterator: (acc: TResult[], curr: number, key?: string, dict?: _.Dictionary) => void; + let accumulator: TResult[]; + let result: TResult[]; + + result = _.transform(dictionary, iterator); + result = _.transform(dictionary, iterator, accumulator); + result = _.transform(dictionary, iterator, accumulator, any); + + result = _(dictionary).transform(iterator).value(); + result = _(dictionary).transform(iterator, accumulator).value(); + result = _(dictionary).transform(iterator, accumulator, any).value(); + } +} + +// _.values +module TestValues { + let object: _.Dictionary; + + { + let result: TResult[]; + + result = _.values(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).values(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().values(); + } +} + +// _.valuesIn +module TestValuesIn { + let object: _.Dictionary; + + { + let result: TResult[]; + + result = _.valuesIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).valuesIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().valuesIn(); + } +} + +/********** + * String * + **********/ + +// _.camelCase +module TestCamelCase { + { + let result: string; + + result = _.camelCase('Foo Bar'); + result = _('Foo Bar').camelCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().camelCase(); + } +} + +// _.capitalize +module TestCapitalize { + { + let result: string; + + result = _.capitalize('fred'); + result = _('fred').capitalize(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred').chain().capitalize(); + } +} + +// _.deburr +module TestDeburr { + { + let result: string; + + result = _.deburr('déjà vu'); + result = _('déjà vu').deburr(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('déjà vu').chain().deburr(); + } +} + +// _.endsWith +module TestEndsWith { + { + let result: boolean; + + result = _.endsWith('abc', 'c'); + result = _.endsWith('abc', 'c', 1); + + result = _('abc').endsWith('c'); + result = _('abc').endsWith('c', 1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().endsWith('c'); + result = _('abc').chain().endsWith('c', 1); + } +} + +// _.escape +module TestEscape { + { + let result: string; + + result = _.escape('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').escape(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().escape(); + } +} + +// _.escapeRegExp +module TestEscapeRegExp { + { + let result: string; + + result = _.escapeRegExp('[lodash](https://lodash.com/)'); + result = _('[lodash](https://lodash.com/)').escapeRegExp(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('[lodash](https://lodash.com/)').chain().escapeRegExp(); + } +} + +// _.kebabCase +module TestKebabCase { + { + let result: string; + + result = _.kebabCase('Foo Bar'); + result = _('Foo Bar').kebabCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().kebabCase(); + } +} + +// _.pad +module TestPad { + { + let result: string; + + result = _.pad('abd'); + result = _.pad('abc', 8); + result = _.pad('abc', 8, '_-'); + + result = _('abc').pad(); + result = _('abc').pad(8); + result = _('abc').pad(8, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().pad(); + result = _('abc').chain().pad(8); + result = _('abc').chain().pad(8, '_-'); + } +} + +// _.padLeft +module TestPadLeft { + { + let result: string; + + result = _.padLeft('abc'); + result = _.padLeft('abc', 6); + result = _.padLeft('abc', 6, '_-'); + + result = _('abc').padLeft(); + result = _('abc').padLeft(6); + result = _('abc').padLeft(6, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().padLeft(); + result = _('abc').chain().padLeft(6); + result = _('abc').chain().padLeft(6, '_-'); + } +} + +// _.padRight +module TestPadRight { + { + let result: string; + + result = _.padRight('abc'); + result = _.padRight('abc', 6); + result = _.padRight('abc', 6, '_-'); + + result = _('abc').padRight(); + result = _('abc').padRight(6); + result = _('abc').padRight(6, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().padRight(); + result = _('abc').chain().padRight(6); + result = _('abc').chain().padRight(6, '_-'); + } +} + + +// _.parseInt +module TestParseInt { + { + let result: number; + + result = _.parseInt('08'); + result = _.parseInt('08', 10); + + result = _('08').parseInt(); + result = _('08').parseInt(10); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('08').chain().parseInt(); + result = _('08').chain().parseInt(10); + } +} + +// _.repeat +module TestRepeat { + { + let result: string; + result = _.repeat('*'); + result = _.repeat('*', 3); + + result = _('*').repeat(); + result = _('*').repeat(3); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('*').chain().repeat(); + result = _('*').chain().repeat(3); + } +} + +// _.snakeCase +module TestSnakeCase { + { + let result: string; + + result = _.snakeCase('Foo Bar'); + result = _('Foo Bar').snakeCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().snakeCase(); + } +} + +// _.startCase +module TestStartCase { + { + let result: string; + + result = _.startCase('--foo-bar'); + result = _('--foo-bar').startCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('--foo-bar').chain().startCase(); + } +} + +// _.startsWith +module TestStartsWith { + { + let result: boolean; + + result = _.startsWith('abc', 'a'); + result = _.startsWith('abc', 'a', 1); + + result = _('abc').startsWith('a'); + result = _('abc').startsWith('a', 1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().startsWith('a'); + result = _('abc').chain().startsWith('a', 1); + } +} + +// _.template +module TestTemplate { + interface TemplateExecutor { + (obj?: Object): string; + source: string; + } + + let options: { + escape?: RegExp; + evaluate?: RegExp; + imports?: _.Dictionary; + interpolate?: RegExp; + sourceURL?: string; + variable?: string; + }; + + { + let result: TemplateExecutor; + + result = _.template(''); + result = _.template('', options); + + result = _('').template(); + result = _('').template(options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _('').chain().template(); + result = _('').chain().template(options); + } +} + +// _.trim +module TestTrim { + { + let result: string; + + result = _.trim(); + result = _.trim(' abc '); + result = _.trim('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trim(); + result = _('-_-abc-_-').trim('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trim(); + result = _('-_-abc-_-').chain().trim('_-'); + } +} + +// _.trimLeft +module TestTrimLeft { + { + let result: string; + + result = _.trimLeft(); + result = _.trimLeft(' abc '); + result = _.trimLeft('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trimLeft(); + result = _('-_-abc-_-').trimLeft('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trimLeft(); + result = _('-_-abc-_-').chain().trimLeft('_-'); + } +} + +// _.trimRight + +module TestTrimRight { + { + let result: string; + + result = _.trimRight(); + result = _.trimRight(' abc '); + result = _.trimRight('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trimRight(); + result = _('-_-abc-_-').trimRight('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trimRight(); + result = _('-_-abc-_-').chain().trimRight('_-'); + } +} + +// _.trunc +module TestTrunc { + { + let result: string; + + result = _.trunc('hi-diddly-ho there, neighborino'); + result = _.trunc('hi-diddly-ho there, neighborino', 24); + result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); + result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); + result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); + + result = _('hi-diddly-ho there, neighborino').trunc(); + result = _('hi-diddly-ho there, neighborino').trunc(24); + result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' }); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('hi-diddly-ho there, neighborino').chain().trunc(); + result = _('hi-diddly-ho there, neighborino').chain().trunc(24); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'omission': ' […]' }); + } +} + +// _.unescape +module TestUnescape { + { + let result: string; + + result = _.unescape('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').unescape(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().unescape(); + } +} + +// _.words +module TestWords { + { + let result: string[]; + + result = _.words('fred, barney, & pebbles'); + result = _.words('fred, barney, & pebbles', /[^, ]+/g); + + result = _('fred, barney, & pebbles').words(); + result = _('fred, barney, & pebbles').words(/[^, ]+/g); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('fred, barney, & pebbles').chain().words(); + result = _('fred, barney, & pebbles').chain().words(/[^, ]+/g); + } +} + +/*********** + * Utility * + ***********/ + +// _.attempt +module TestAttempt { + let func: (...args: any[]) => {a: string}; + + { + let result: {a: string}|Error; + + result = _.attempt<{a: string}>(func); + result = _(func).attempt<{a: string}>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: string}|Error>; + + result = _(func).chain().attempt<{a: string}>(); + } +} + +// _.callback +module TestCallback { + { + let result: (...args: any[]) => TResult; + + result = _.callback(Function); + result = _.callback(Function, any); + } + + { + let result: (object: any) => TResult; + + result = _.callback(''); + result = _.callback('', any); + } + + { + let result: (object: any) => boolean; + + result = _.callback({}); + result = _.callback({}, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).callback(); + result = _(Function).callback(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; + + result = _('').callback(); + result = _('').callback(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).callback(); + result = _({}).callback(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).chain().callback(); + result = _(Function).chain().callback(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; + + result = _('').chain().callback(); + result = _('').chain().callback(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).chain().callback(); + result = _({}).chain().callback(any); + } +} + +// _.constant +module TestConstant { + { + let result: () => number; + result: _.constant(42); + } + + { + let result: () => string; + result: _.constant('a'); + } + + { + let result: () => boolean; + result: _.constant(true); + } + + { + let result: () => string[]; + result: _.constant(['a']); + } + + { + let result: () => {a: string}; + result: _.constant<{a: string}>({a: 'a'}); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => number>; + result: _(42).constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => string>; + result: _('a').constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => boolean>; + result: _(true).constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => string[]>; + result: _(['a']).constant(); + } + + { + let result: _.LoDashImplicitObjectWrapper<() => {a: string}>; + result: _({a: 'a'}).constant<{a: string}>(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => number>; + result: _(42).chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => string>; + result: _('a').chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => boolean>; + result: _(true).chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => string[]>; + result: _(['a']).chain().constant(); + } + + { + let result: _.LoDashExplicitObjectWrapper<() => {a: string}>; + result: _({a: 'a'}).chain().constant<{a: string}>(); + } +} + +// _.identity +{ + let testIdentityValue: TResult; + let result: TResult; + result = _.identity(testIdentityValue); + result = _(testIdentityValue).identity(); +} +{ + let result: number; + result = _(42).identity(); +} +{ + let result: boolean[]; + result = _([]).identity(); +} + +// _.iteratee +module TestIteratee { + { + let result: (...args: any[]) => TResult; + + result = _.iteratee(Function); + result = _.iteratee(Function, any); + } + + { + let result: (object: any) => TResult; + + result = _.iteratee(''); + result = _.iteratee('', any); + } + + { + let result: (object: any) => boolean; + + result = _.iteratee({}); + result = _.iteratee({}, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).iteratee(); + result = _(Function).iteratee(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; + + result = _('').iteratee(); + result = _('').iteratee(any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).iteratee(); + result = _({}).iteratee(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + + result = _(Function).chain().iteratee(); + result = _(Function).chain().iteratee(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; + + result = _('').chain().iteratee(); + result = _('').chain().iteratee(any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; + + result = _({}).chain().iteratee(); + result = _({}).chain().iteratee(any); + } +} + +// _.matches +module TestMatches { + let source: TResult; + + { + let result: (value: any) => boolean; + result = _.matches(source); + } + + { + let result: (value: TResult) => boolean; + result = _.matches(source); + } + + { + let result: _.LoDashImplicitObjectWrapper<(value: TResult) => boolean>; + result = _(source).matches(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(value: TResult) => boolean>; + result = _(source).chain().matches(); + } +} + +// _.matchesProperty +module TestMatches { + let path: {toString(): string;}|{toString(): string;}[]; + let source: TResult; + + { + let result: (value: any) => boolean; + + result = _.matchesProperty(path, source); + } + + { + let result: (value: TResult) => boolean; + + result = _.matchesProperty(path, source); + } + + { + let result: _.LoDashImplicitObjectWrapper<(value: any) => boolean>; + + result = _(path).matchesProperty(source); + } + + { + let result: _.LoDashImplicitObjectWrapper<(value: TResult) => boolean>; + + result = _(path).matchesProperty(source); + } + + { + let result: _.LoDashExplicitObjectWrapper<(value: any) => boolean>; + + result = _(path).chain().matchesProperty(source); + } + + { + let result: _.LoDashExplicitObjectWrapper<(value: TResult) => boolean>; + + result = _(path).chain().matchesProperty(source); + } +} + +// _.method +module TestMethod { + { + let result: (object: any) => {a: string}; + + result = _.method<{a: string}>('a.0'); + result = _.method<{a: string}>('a.0', any); + result = _.method<{a: string}>('a.0', any, any); + result = _.method<{a: string}>('a.0', any, any, any); + + result = _.method<{a: string}>(['a', 0]); + result = _.method<{a: string}>(['a', 0], any); + result = _.method<{a: string}>(['a', 0], any, any); + result = _.method<{a: string}>(['a', 0], any, any, any); + } + + { + let result: (object: {a: string}) => {b: string}; + + result = _.method<{a: string}, {b: string}>('a.0'); + result = _.method<{a: string}, {b: string}>('a.0', any); + result = _.method<{a: string}, {b: string}>('a.0', any, any); + result = _.method<{a: string}, {b: string}>('a.0', any, any, any); + + result = _.method<{a: string}, {b: string}>(['a', 0]); + result = _.method<{a: string}, {b: string}>(['a', 0], any); + result = _.method<{a: string}, {b: string}>(['a', 0], any, any); + result = _.method<{a: string}, {b: string}>(['a', 0], any, any, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: any) => {a: string}>; + + result = _('a.0').method<{a: string}>(); + result = _('a.0').method<{a: string}>(any); + result = _('a.0').method<{a: string}>(any, any); + result = _('a.0').method<{a: string}>(any, any, any); + + result = _(['a', 0]).method<{a: string}>(); + result = _(['a', 0]).method<{a: string}>(any); + result = _(['a', 0]).method<{a: string}>(any, any); + result = _(['a', 0]).method<{a: string}>(any, any, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: {a: string}) => {b: string}>; + + result = _('a.0').method<{a: string}, {b: string}>(); + result = _('a.0').method<{a: string}, {b: string}>(any); + result = _('a.0').method<{a: string}, {b: string}>(any, any); + result = _('a.0').method<{a: string}, {b: string}>(any, any, any); + + result = _(['a', 0]).method<{a: string}, {b: string}>(); + result = _(['a', 0]).method<{a: string}, {b: string}>(any); + result = _(['a', 0]).method<{a: string}, {b: string}>(any, any); + result = _(['a', 0]).method<{a: string}, {b: string}>(any, any, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: any) => {a: string}>; + + result = _('a.0').chain().method<{a: string}>(); + result = _('a.0').chain().method<{a: string}>(any); + result = _('a.0').chain().method<{a: string}>(any, any); + result = _('a.0').chain().method<{a: string}>(any, any, any); + + result = _(['a', 0]).chain().method<{a: string}>(); + result = _(['a', 0]).chain().method<{a: string}>(any); + result = _(['a', 0]).chain().method<{a: string}>(any, any); + result = _(['a', 0]).chain().method<{a: string}>(any, any, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: {a: string}) => {b: string}>; + + result = _('a.0').chain().method<{a: string}, {b: string}>(); + result = _('a.0').chain().method<{a: string}, {b: string}>(any); + result = _('a.0').chain().method<{a: string}, {b: string}>(any, any); + result = _('a.0').chain().method<{a: string}, {b: string}>(any, any, any); + + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(); + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any); + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any, any); + result = _(['a', 0]).chain().method<{a: string}, {b: string}>(any, any, any); + } +} + +// _.methodOf +module TestMethodOf { + type SampleObject = {a: {b: () => TResult}[]}; + type ResultFn = (path: _.StringRepresentable|_.StringRepresentable[]) => TResult; + + let object: SampleObject; + + { + let result: ResultFn; + + result = _.methodOf(object); + result = _.methodOf(object, any); + result = _.methodOf(object, any, any); + result = _.methodOf(object, any, any, any); + + result = _.methodOf(object); + result = _.methodOf(object, any); + result = _.methodOf(object, any, any); + result = _.methodOf(object, any, any, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).methodOf(); + result = _(object).methodOf(any); + result = _(object).methodOf(any, any); + result = _(object).methodOf(any, any, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().methodOf(); + result = _(object).chain().methodOf(any); + result = _(object).chain().methodOf(any, any); + result = _(object).chain().methodOf(any, any, any); + } +} + +// _.mixin +module TestMixin { + let source: _.Dictionary; + let options: {chain?: boolean}; + + { + let result: TResult; + + result = _.mixin({}, source); + result = _.mixin({}, source, options); + result = _.mixin(source); + result = _.mixin(source, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).mixin(source); + result = _({}).mixin(source, options); + result = _(source).mixin(); + result = _(source).mixin(options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().mixin(source); + result = _({}).chain().mixin(source, options); + result = _(source).chain().mixin(); + result = _(source).chain().mixin(options); + } +} + +// _.noConflict +{ + let result: typeof _; + result = _.noConflict(); + result = _(42).noConflict(); + result = _([]).noConflict(); + result = _({}).noConflict(); +} + +// _.noop +module TestNoop { + { + let result: void; + + result = _.noop(); + result = _.noop(1); + result = _.noop('a', 1); + result = _.noop(true, 'a', 1); + + result = _('a').noop(true, 'a', 1); + result = _([1]).noop(true, 'a', 1); + result = _([]).noop(true, 'a', 1); + result = _({}).noop(true, 'a', 1); + result = _(any).noop(true, 'a', 1); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('a').chain().noop(true, 'a', 1); + result = _([1]).chain().noop(true, 'a', 1); + result = _([]).chain().noop(true, 'a', 1); + result = _({}).chain().noop(true, 'a', 1); + result = _(any).chain().noop(true, 'a', 1); + } +} + +// _.property +module TestProperty { + interface SampleObject { + a: { + b: number[]; + } + } + + { + let result: (object: SampleObject) => number; + + result = _.property('a.b[0]'); + result = _.property(['a', 'b', 0]); + } + + { + let result: _.LoDashImplicitObjectWrapper<(object: SampleObject) => number>; + + result = _('a.b[0]').property(); + result = _(['a', 'b', 0]).property(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(object: SampleObject) => number>; + + result = _('a.b[0]').chain().property(); + result = _(['a', 'b', 0]).chain().property(); + } +} + +// _.propertyOf +module TestPropertyOf { + interface SampleObject { + a: { + b: number[]; + } + } + + let object: SampleObject; + + { + let result: (path: string|string[]) => any; + + result = _.propertyOf({}); + result = _.propertyOf(object); + } + + { + let result: _.LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + + result = _({}).propertyOf(); + } + + { + let result: _.LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + + result = _({}).chain().propertyOf(); + } +} + +// _.range +module TestRange { + { + let result: number[]; + + result = _.range(10); + result = _.range(1, 11); + result = _.range(0, 30, 5); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(10).range(); + result = _(1).range(11); + result = _(0).range(30, 5); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(10).chain().range(); + result = _(1).chain().range(11); + result = _(0).chain().range(30, 5); + } +} + +// _.runInContext +{ + let result: typeof _; + result = _.runInContext(); + result = _.runInContext({}); + result = _({}).runInContext(); +} + +// _.times +module TestTimes { + let iteratee: (num: number) => TResult; + + { + let result: number[]; + + result = _.times(42); + } + + { + let result: TResult[]; + + result = _.times(42, iteratee); + result = _.times(42, iteratee, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).times(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).times(iteratee); + result = _(42).times(iteratee, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().times(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().times(iteratee); + result = _(42).chain().times(iteratee, any); + } +} + +// _.uniqueId +module TestUniqueId { + { + let result: string; + + result = _.uniqueId(); + result = _.uniqueId(''); + + result = _('').uniqueId(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().uniqueId(); + } +} + +result = _.VERSION; +result = <_.Support>_.support; +result = <_.TemplateSettings>_.templateSettings; + +// _.partial & _.partialRight +{ + function func0(): number { + return 42; + } + function func1(arg1: number): number { + return arg1 * 2; + } + function func2(arg1: number, arg2: string): number { + return arg1 * arg2.length; + } + function func3(arg1: number, arg2: string, arg3: boolean): number { + return arg1 * arg2.length + (arg3 ? 1 : 0); + } + function func4(arg1: number, arg2: string, arg3: boolean, arg4: number): number { + return arg1 * arg2.length + (arg3 ? 1 : 0) - arg4; + } + let res____: () => number; + let res1___: (arg1: number ) => number; + let res_2__: ( arg2: string ) => number; + let res__3_: ( arg3: boolean ) => number; + let res___4: ( arg4: number) => number; + let res12__: (arg1: number, arg2: string ) => number; + let res1_3_: (arg1: number, arg3: boolean ) => number; + let res1__4: (arg1: number, arg4: number) => number; + let res_23_: ( arg2: string, arg3: boolean ) => number; + let res_2_4: ( arg2: string, arg4: number) => number; + let res__34: ( arg3: boolean, arg4: number) => number; + let res123_: (arg1: number, arg2: string, arg3: boolean ) => number; + let res12_4: (arg1: number, arg2: string, arg4: number) => number; + let res1_34: (arg1: number, arg3: boolean, arg4: number) => number; + let res_234: ( arg2: string, arg3: boolean, arg4: number) => number; + let res1234: (arg1: number, arg2: string, arg3: boolean, arg4: number) => number; + + // + // _.partial + // + // with arity 0 function + res____ = _.partial(func0); + // with arity 1 function + res____ = _.partial(func1, 42 ); + res1___ = _.partial(func1 ); + // with arity 2 function + res12__ = _.partial(func2 ); + res_2__ = _.partial(func2, 42 ); + res1___ = _.partial(func2, _, "foo"); + res____ = _.partial(func2, 42, "foo"); + // with arity 3 function + res123_ = _.partial(func3 ); + res_23_ = _.partial(func3, 42 ); + res1_3_ = _.partial(func3, _, "foo" ); + res__3_ = _.partial(func3, 42, "foo" ); + res12__ = _.partial(func3, _, _, true); + res_2__ = _.partial(func3, 42, _, true); + res1___ = _.partial(func3, _, "foo", true); + res____ = _.partial(func3, 42, "foo", true); + // with arity 4 function + res1234 = _.partial(func4 ); + res_234 = _.partial(func4, 42 ); + res1_34 = _.partial(func4, _, "foo" ); + res__34 = _.partial(func4, 42, "foo" ); + res12_4 = _.partial(func4, _, _, true ); + res_2_4 = _.partial(func4, 42, _, true ); + res1__4 = _.partial(func4, _, "foo", true ); + res___4 = _.partial(func4, 42, "foo", true ); + res123_ = _.partial(func4, _, _, _, 100); + res_23_ = _.partial(func4, 42, _, _, 100); + res1_3_ = _.partial(func4, _, "foo", _, 100); + res__3_ = _.partial(func4, 42, "foo", _, 100); + res12__ = _.partial(func4, _, _, true, 100); + res_2__ = _.partial(func4, 42, _, true, 100); + res1___ = _.partial(func4, _, "foo", true, 100); + res____ = _.partial(func4, 42, "foo", true, 100); + + // + // _.partialRight + // + // with arity 0 function + res____ = _.partialRight(func0); + // with arity 1 function + res____ = _.partialRight(func1, 42 ); + res1___ = _.partialRight(func1 ); + // with arity 2 function + res12__ = _.partialRight(func2 ); + res_2__ = _.partialRight(func2, 42, _); + res1___ = _.partialRight(func2, "foo"); + res____ = _.partialRight(func2, 42, "foo"); + // with arity 3 function + res123_ = _.partialRight(func3 ); + res_23_ = _.partialRight(func3, 42, _, _); + res1_3_ = _.partialRight(func3, "foo", _); + res__3_ = _.partialRight(func3, 42, "foo", _); + res12__ = _.partialRight(func3, true); + res_2__ = _.partialRight(func3, 42, _, true); + res1___ = _.partialRight(func3, "foo", true); + res____ = _.partialRight(func3, 42, "foo", true); + // with arity 4 function + res1234 = _.partialRight(func4 ); + res_234 = _.partialRight(func4, 42, _, _, _); + res1_34 = _.partialRight(func4, "foo", _, _); + res__34 = _.partialRight(func4, 42, "foo", _, _); + res12_4 = _.partialRight(func4, true, _); + res_2_4 = _.partialRight(func4, 42, _, true, _); + res1__4 = _.partialRight(func4, "foo", true, _); + res___4 = _.partialRight(func4, 42, "foo", true, _); + res123_ = _.partialRight(func4, 100); + res_23_ = _.partialRight(func4, 42, _, _, 100); + res1_3_ = _.partialRight(func4, "foo", _, 100); + res__3_ = _.partialRight(func4, 42, "foo", _, 100); + res12__ = _.partialRight(func4, true, 100); + res_2__ = _.partialRight(func4, 42, _, true, 100); + res1___ = _.partialRight(func4, "foo", true, 100); + res____ = _.partialRight(func4, 42, "foo", true, 100); +} diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4dfaa33f1..af33b66ac 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -858,6 +858,29 @@ module TestIndexOf { } } +// _.sortedIndexOf +module TestIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + + { + let result: number; + + result = _.sortedIndexOf(array, value); + result = _.sortedIndexOf(list, value); + result = _(array).sortedIndexOf(value); + result = _(list).sortedIndexOf(value); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().sortedIndexOf(value); + result = _(list).chain().sortedIndexOf(value); + } +} + //_.initial module TestInitial { let array: TResult[]; @@ -985,134 +1008,6 @@ module TestLastIndexOf { } } -// _.object -module TestObject { - let arrayOfKeys: string[]; - let arrayOfValues: number[]; - let arrayOfKeyValuePairs: (string|number)[][] - - let listOfKeys: _.List; - let listOfValues: _.List; - let listOfKeyValuePairs: _.List<_.List>; - - { - let result: _.Dictionary; - - result = _.object<_.Dictionary>(arrayOfKeys); - result = _.object<_.Dictionary>(listOfKeys); - } - - { - let result: _.Dictionary; - - result = _.object<_.Dictionary>(arrayOfKeys, arrayOfValues); - result = _.object<_.Dictionary>(arrayOfKeys, listOfValues); - result = _.object<_.Dictionary>(listOfKeys, listOfValues); - result = _.object<_.Dictionary>(listOfKeys, arrayOfValues); - - result = _.object>(arrayOfKeys, arrayOfValues); - result = _.object>(arrayOfKeys, listOfValues); - result = _.object>(listOfKeys, listOfValues); - result = _.object>(listOfKeys, arrayOfValues); - - result = _.object<_.Dictionary>(arrayOfKeyValuePairs); - result = _.object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.Dictionary; - - result = _.object(arrayOfKeys); - result = _.object(arrayOfKeys, arrayOfValues); - result = _.object(arrayOfKeys, listOfValues); - - result = _.object(listOfKeys); - result = _.object(listOfKeys, listOfValues); - result = _.object(listOfKeys, arrayOfValues); - - result = _.object<_.Dictionary>(arrayOfKeyValuePairs); - result = _.object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).object<_.Dictionary>(); - result = _(listOfKeys).object<_.Dictionary>(); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).object<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).object<_.Dictionary>(listOfValues); - result = _(listOfKeys).object<_.Dictionary>(listOfValues); - result = _(listOfKeys).object<_.Dictionary>(arrayOfValues); - - result = _(arrayOfKeys).object>(arrayOfValues); - result = _(arrayOfKeys).object>(listOfValues); - result = _(listOfKeys).object>(listOfValues); - result = _(listOfKeys).object>(arrayOfValues); - - result = _(listOfKeys).object<_.Dictionary>(arrayOfKeyValuePairs); - result = _(listOfKeys).object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).object(); - result = _(arrayOfKeys).object(arrayOfValues); - result = _(arrayOfKeys).object(listOfValues); - - result = _(listOfKeys).object(); - result = _(listOfKeys).object(listOfValues); - result = _(listOfKeys).object(arrayOfValues); - - result = _(listOfKeys).object(arrayOfKeyValuePairs); - result = _(listOfKeys).object(listOfKeyValuePairs); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().object<_.Dictionary>(); - result = _(listOfKeys).chain().object<_.Dictionary>(); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().object<_.Dictionary>(arrayOfValues); - result = _(arrayOfKeys).chain().object<_.Dictionary>(listOfValues); - result = _(listOfKeys).chain().object<_.Dictionary>(listOfValues); - result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfValues); - - result = _(arrayOfKeys).chain().object>(arrayOfValues); - result = _(arrayOfKeys).chain().object>(listOfValues); - result = _(listOfKeys).chain().object>(listOfValues); - result = _(listOfKeys).chain().object>(arrayOfValues); - - result = _(listOfKeys).chain().object<_.Dictionary>(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().object<_.Dictionary>(listOfKeyValuePairs); - } - - { - let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - - result = _(arrayOfKeys).chain().object(); - result = _(arrayOfKeys).chain().object(arrayOfValues); - result = _(arrayOfKeys).chain().object(listOfValues); - - result = _(listOfKeys).chain().object(); - result = _(listOfKeys).chain().object(listOfValues); - result = _(listOfKeys).chain().object(arrayOfValues); - - result = _(listOfKeys).chain().object(arrayOfKeyValuePairs); - result = _(listOfKeys).chain().object(listOfKeyValuePairs); - } -} - // _.pull module TestPull { let array: TResult[]; @@ -1283,31 +1178,31 @@ module TestRemove { } } -// _.rest -module TestRest { +// _.tail +module TestTail { let array: TResult[]; let list: _.List; { let result: TResult[]; - result = _.rest(array); - result = _.rest(list); + result = _.tail(array); + result = _.tail(list); } { let result: _.LoDashImplicitArrayWrapper; - result = _(array).rest(); - result = _(list).rest(); + result = _(array).tail(); + result = _(list).tail(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().rest(); - result = _(list).chain().rest(); + result = _(array).chain().tail(); + result = _(list).chain().tail(); } } @@ -1357,70 +1252,89 @@ module TestSortedIndex { let result: number; result = _.sortedIndex('', ''); - result = _.sortedIndex('', '', stringIterator); - result = _.sortedIndex('', '', stringIterator, any); - result = _.sortedIndex('', '', stringIterator); - result = _.sortedIndex('', '', stringIterator, any); result = _.sortedIndex(array, value); - result = _.sortedIndex(array, value, arrayIterator); - result = _.sortedIndex(array, value, arrayIterator, any); - result = _.sortedIndex(array, value, ''); - result = _.sortedIndex(array, value, {a: 42}); - result = _.sortedIndex(array, value, arrayIterator); - result = _.sortedIndex(array, value, arrayIterator, any); - result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42}); result = _.sortedIndex(list, value); - result = _.sortedIndex(list, value, listIterator); - result = _.sortedIndex(list, value, listIterator, any); - result = _.sortedIndex(list, value, ''); - result = _.sortedIndex(list, value, {a: 42}); - result = _.sortedIndex(list, value, listIterator); - result = _.sortedIndex(list, value, listIterator, any); - result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42}); result = _('').sortedIndex(''); - result = _('').sortedIndex('', stringIterator); - result = _('').sortedIndex('', stringIterator, any); result = _(array).sortedIndex(value); - result = _(array).sortedIndex(value, arrayIterator); - result = _(array).sortedIndex(value, arrayIterator, any); - result = _(array).sortedIndex(value, ''); - result = _(array).sortedIndex<{a: number}>(value, {a: 42}); result = _(list).sortedIndex(value); - result = _(list).sortedIndex(value, listIterator); - result = _(list).sortedIndex(value, listIterator, any); - result = _(list).sortedIndex(value, ''); - result = _(list).sortedIndex(value, {a: 42}); - result = _(list).sortedIndex(value, listIterator); - result = _(list).sortedIndex(value, listIterator, any); - result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42}); + } { let result: _.LoDashExplicitWrapper; result = _('').chain().sortedIndex(''); - result = _('').chain().sortedIndex('', stringIterator); - result = _('').chain().sortedIndex('', stringIterator, any); result = _(array).chain().sortedIndex(value); - result = _(array).chain().sortedIndex(value, arrayIterator); - result = _(array).chain().sortedIndex(value, arrayIterator, any); - result = _(array).chain().sortedIndex(value, ''); - result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42}); result = _(list).chain().sortedIndex(value); - result = _(list).chain().sortedIndex(value, listIterator); - result = _(list).chain().sortedIndex(value, listIterator, any); - result = _(list).chain().sortedIndex(value, ''); - result = _(list).chain().sortedIndex(value, {a: 42}); - result = _(list).chain().sortedIndex(value, listIterator); - result = _(list).chain().sortedIndex(value, listIterator, any); - result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42}); + + } +} + +// _.sortedIndexBy +module TestSortedIndexBy { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedIndexBy('', '', stringIterator); + result = _.sortedIndexBy('', '', stringIterator); + + result = _.sortedIndexBy(array, value, arrayIterator); + result = _.sortedIndexBy(array, value, ''); + result = _.sortedIndexBy(array, value, {a: 42}); + result = _.sortedIndexBy(array, value, arrayIterator); + result = _.sortedIndexBy<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedIndexBy(list, value, listIterator); + result = _.sortedIndexBy(list, value, ''); + result = _.sortedIndexBy(list, value, {a: 42}); + result = _.sortedIndexBy(list, value, listIterator); + result = _.sortedIndexBy<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedIndexBy('', stringIterator); + + result = _(array).sortedIndexBy(value, arrayIterator); + result = _(array).sortedIndexBy(value, ''); + result = _(array).sortedIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).sortedIndexBy(value, listIterator); + result = _(list).sortedIndexBy(value, ''); + result = _(list).sortedIndexBy(value, {a: 42}); + result = _(list).sortedIndexBy(value, listIterator); + result = _(list).sortedIndexBy<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedIndexBy('', stringIterator); + + result = _(array).chain().sortedIndexBy(value, arrayIterator); + result = _(array).chain().sortedIndexBy(value, ''); + result = _(array).chain().sortedIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedIndexBy(value, listIterator); + result = _(list).chain().sortedIndexBy(value, ''); + result = _(list).chain().sortedIndexBy(value, {a: 42}); + result = _(list).chain().sortedIndexBy(value, listIterator); + result = _(list).chain().sortedIndexBy<{a: number}, SampleType>(value, {a: 42}); } } @@ -1441,70 +1355,87 @@ module TestSortedLastIndex { let result: number; result = _.sortedLastIndex('', ''); - result = _.sortedLastIndex('', '', stringIterator); - result = _.sortedLastIndex('', '', stringIterator, any); - result = _.sortedLastIndex('', '', stringIterator); - result = _.sortedLastIndex('', '', stringIterator, any); result = _.sortedLastIndex(array, value); - result = _.sortedLastIndex(array, value, arrayIterator); - result = _.sortedLastIndex(array, value, arrayIterator, any); - result = _.sortedLastIndex(array, value, ''); - result = _.sortedLastIndex(array, value, {a: 42}); - result = _.sortedLastIndex(array, value, arrayIterator); - result = _.sortedLastIndex(array, value, arrayIterator, any); - result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); result = _.sortedLastIndex(list, value); - result = _.sortedLastIndex(list, value, listIterator); - result = _.sortedLastIndex(list, value, listIterator, any); - result = _.sortedLastIndex(list, value, ''); - result = _.sortedLastIndex(list, value, {a: 42}); - result = _.sortedLastIndex(list, value, listIterator); - result = _.sortedLastIndex(list, value, listIterator, any); - result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); result = _('').sortedLastIndex(''); - result = _('').sortedLastIndex('', stringIterator); - result = _('').sortedLastIndex('', stringIterator, any); result = _(array).sortedLastIndex(value); - result = _(array).sortedLastIndex(value, arrayIterator); - result = _(array).sortedLastIndex(value, arrayIterator, any); - result = _(array).sortedLastIndex(value, ''); - result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); result = _(list).sortedLastIndex(value); - result = _(list).sortedLastIndex(value, listIterator); - result = _(list).sortedLastIndex(value, listIterator, any); - result = _(list).sortedLastIndex(value, ''); - result = _(list).sortedLastIndex(value, {a: 42}); - result = _(list).sortedLastIndex(value, listIterator); - result = _(list).sortedLastIndex(value, listIterator, any); - result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); } { let result: _.LoDashExplicitWrapper; result = _('').chain().sortedLastIndex(''); - result = _('').chain().sortedLastIndex('', stringIterator); - result = _('').chain().sortedLastIndex('', stringIterator, any); result = _(array).chain().sortedLastIndex(value); - result = _(array).chain().sortedLastIndex(value, arrayIterator); - result = _(array).chain().sortedLastIndex(value, arrayIterator, any); - result = _(array).chain().sortedLastIndex(value, ''); - result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); result = _(list).chain().sortedLastIndex(value); - result = _(list).chain().sortedLastIndex(value, listIterator); - result = _(list).chain().sortedLastIndex(value, listIterator, any); - result = _(list).chain().sortedLastIndex(value, ''); - result = _(list).chain().sortedLastIndex(value, {a: 42}); - result = _(list).chain().sortedLastIndex(value, listIterator); - result = _(list).chain().sortedLastIndex(value, listIterator, any); - result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } +} + +// _.sortedLastIndexBy +module TestSortedLastIndexBy { + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndexBy('', '', stringIterator); + result = _.sortedLastIndexBy('', '', stringIterator); + + result = _.sortedLastIndexBy(array, value, arrayIterator); + result = _.sortedLastIndexBy(array, value, ''); + result = _.sortedLastIndexBy(array, value, {a: 42}); + result = _.sortedLastIndexBy(array, value, arrayIterator); + result = _.sortedLastIndexBy<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndexBy(list, value, listIterator); + result = _.sortedLastIndexBy(list, value, ''); + result = _.sortedLastIndexBy(list, value, {a: 42}); + result = _.sortedLastIndexBy(list, value, listIterator); + result = _.sortedLastIndexBy<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndexBy('', stringIterator); + + result = _(array).sortedLastIndexBy(value, arrayIterator); + result = _(array).sortedLastIndexBy(value, ''); + result = _(array).sortedLastIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndexBy(value, listIterator); + result = _(list).sortedLastIndexBy(value, ''); + result = _(list).sortedLastIndexBy(value, {a: 42}); + result = _(list).sortedLastIndexBy(value, listIterator); + result = _(list).sortedLastIndexBy<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndexBy('', stringIterator); + + result = _(array).chain().sortedLastIndexBy(value, arrayIterator); + result = _(array).chain().sortedLastIndexBy(value, ''); + result = _(array).chain().sortedLastIndexBy<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndexBy(value, listIterator); + result = _(list).chain().sortedLastIndexBy(value, ''); + result = _(list).chain().sortedLastIndexBy(value, {a: 42}); + result = _(list).chain().sortedLastIndexBy(value, listIterator); + result = _(list).chain().sortedLastIndexBy<{a: number}, SampleType>(value, {a: 42}); } } @@ -1794,158 +1725,46 @@ module TestUniq { { let result: string[]; - result = _.uniq('abc'); - result = _.uniq('abc', true); - result = _.uniq('abc', true, stringIterator); - result = _.uniq('abc', true, stringIterator, any); - result = _.uniq('abc', true, stringIterator); - result = _.uniq('abc', true, stringIterator, any); - result = _.uniq('abc', stringIterator); - result = _.uniq('abc', stringIterator, any); - result = _.uniq('abc', stringIterator); - result = _.uniq('abc', stringIterator, any); } { let result: SampleObject[]; result = _.uniq(array); - result = _.uniq(array, true); - result = _.uniq(array, true, listIterator); - result = _.uniq(array, true, listIterator, any); - result = _.uniq(array, true, listIterator); - result = _.uniq(array, true, listIterator, any); - result = _.uniq(array, listIterator); - result = _.uniq(array, listIterator, any); - result = _.uniq(array, listIterator); - result = _.uniq(array, listIterator, any); - result = _.uniq(array, true, 'a'); - result = _.uniq(array, true, 'a', any); - result = _.uniq(array, 'a'); - result = _.uniq(array, 'a', any); - result = _.uniq(array, true, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(array, true, {a: 42}); - result = _.uniq(array, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(array, {a: 42}); - result = _.uniq(list); - result = _.uniq(list, true); - result = _.uniq(list, true, listIterator); - result = _.uniq(list, true, listIterator, any); - result = _.uniq(list, true, listIterator); - result = _.uniq(list, true, listIterator, any); - result = _.uniq(list, listIterator); - result = _.uniq(list, listIterator, any); - result = _.uniq(list, listIterator); - result = _.uniq(list, listIterator, any); - result = _.uniq(list, true, 'a'); - result = _.uniq(list, true, 'a', any); - result = _.uniq(list, 'a'); - result = _.uniq(list, 'a', any); - result = _.uniq(list, true, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(list, true, {a: 42}); - result = _.uniq(list, {a: 42}); - result = _.uniq<{a: number}, SampleObject>(list, {a: 42}); } { let result: _.LoDashImplicitArrayWrapper; - result = _('abc').uniq(); - result = _('abc').uniq(true); - result = _('abc').uniq(true, stringIterator); - result = _('abc').uniq(true, stringIterator, any); - result = _('abc').uniq(stringIterator); - result = _('abc').uniq(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; result = _(array).uniq(); - result = _(array).uniq(true); - result = _(array).uniq(true, listIterator); - result = _(array).uniq(true, listIterator, any); - result = _(array).uniq(listIterator); - result = _(array).uniq(listIterator, any); - result = _(array).uniq(true, 'a'); - result = _(array).uniq(true, 'a', any); - result = _(array).uniq('a'); - result = _(array).uniq('a', any); - result = _(array).uniq<{a: number}>(true, {a: 42}); - result = _(array).uniq<{a: number}>({a: 42}); - result = _(list).uniq(); - result = _(list).uniq(true); - result = _(list).uniq(true, listIterator); - result = _(list).uniq(true, listIterator, any); - result = _(list).uniq(true, listIterator); - result = _(list).uniq(true, listIterator, any); - result = _(list).uniq(listIterator); - result = _(list).uniq(listIterator, any); - result = _(list).uniq(listIterator); - result = _(list).uniq(listIterator, any); - result = _(list).uniq(true, 'a'); - result = _(list).uniq(true, 'a', any); - result = _(list).uniq('a'); - result = _(list).uniq('a', any); - result = _(list).uniq(true, {a: 42}); - result = _(list).uniq<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).uniq({a: 42}); - result = _(list).uniq<{a: number}, SampleObject>({a: 42}); } { let result: _.LoDashExplicitArrayWrapper; result = _('abc').chain().uniq(); - result = _('abc').chain().uniq(true); - result = _('abc').chain().uniq(true, stringIterator); - result = _('abc').chain().uniq(true, stringIterator, any); - result = _('abc').chain().uniq(stringIterator); - result = _('abc').chain().uniq(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; result = _(array).chain().uniq(); - result = _(array).chain().uniq(true); - result = _(array).chain().uniq(true, listIterator); - result = _(array).chain().uniq(true, listIterator, any); - result = _(array).chain().uniq(listIterator); - result = _(array).chain().uniq(listIterator, any); - result = _(array).chain().uniq(true, 'a'); - result = _(array).chain().uniq(true, 'a', any); - result = _(array).chain().uniq('a'); - result = _(array).chain().uniq('a', any); - result = _(array).chain().uniq<{a: number}>(true, {a: 42}); - result = _(array).chain().uniq<{a: number}>({a: 42}); - result = _(list).chain().uniq(); - result = _(list).chain().uniq(true); - result = _(list).chain().uniq(true, listIterator); - result = _(list).chain().uniq(true, listIterator, any); - result = _(list).chain().uniq(true, listIterator); - result = _(list).chain().uniq(true, listIterator, any); - result = _(list).chain().uniq(listIterator); - result = _(list).chain().uniq(listIterator, any); - result = _(list).chain().uniq(listIterator); - result = _(list).chain().uniq(listIterator, any); - result = _(list).chain().uniq(true, 'a'); - result = _(list).chain().uniq(true, 'a', any); - result = _(list).chain().uniq('a'); - result = _(list).chain().uniq('a', any); - result = _(list).chain().uniq(true, {a: 42}); - result = _(list).chain().uniq<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).chain().uniq({a: 42}); - result = _(list).chain().uniq<{a: number}, SampleObject>({a: 42}); + } } -// _.unique -module TestUnique { + +// _.uniqBy +module TestUniqBy { type SampleObject = {a: number; b: string; c: boolean}; let array: SampleObject[]; @@ -1957,152 +1776,182 @@ module TestUnique { { let result: string[]; - result = _.unique('abc'); - result = _.unique('abc', true); - result = _.unique('abc', true, stringIterator); - result = _.unique('abc', true, stringIterator, any); - result = _.unique('abc', true, stringIterator); - result = _.unique('abc', true, stringIterator, any); - result = _.unique('abc', stringIterator); - result = _.unique('abc', stringIterator, any); - result = _.unique('abc', stringIterator); - result = _.unique('abc', stringIterator, any); + result = _.uniqBy('abc', stringIterator); + result = _.uniqBy('abc', stringIterator); } { let result: SampleObject[]; - result = _.unique(array); - result = _.unique(array, true); - result = _.unique(array, true, listIterator); - result = _.unique(array, true, listIterator, any); - result = _.unique(array, true, listIterator); - result = _.unique(array, true, listIterator, any); - result = _.unique(array, listIterator); - result = _.unique(array, listIterator, any); - result = _.unique(array, listIterator); - result = _.unique(array, listIterator, any); - result = _.unique(array, true, 'a'); - result = _.unique(array, true, 'a', any); - result = _.unique(array, 'a'); - result = _.unique(array, 'a', any); - result = _.unique(array, true, {a: 42}); - result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); - result = _.unique(array, {a: 42}); - result = _.unique<{a: number}, SampleObject>(array, {a: 42}); + result = _.uniqBy(array, listIterator); + result = _.uniqBy(array, listIterator); + result = _.uniqBy(array, 'a'); + result = _.uniqBy(array, {a: 42}); + result = _.uniqBy<{a: number}, SampleObject>(array, {a: 42}); - result = _.unique(list); - result = _.unique(list, true); - result = _.unique(list, true, listIterator); - result = _.unique(list, true, listIterator, any); - result = _.unique(list, true, listIterator); - result = _.unique(list, true, listIterator, any); - result = _.unique(list, listIterator); - result = _.unique(list, listIterator, any); - result = _.unique(list, listIterator); - result = _.unique(list, listIterator, any); - result = _.unique(list, true, 'a'); - result = _.unique(list, true, 'a', any); - result = _.unique(list, 'a'); - result = _.unique(list, 'a', any); - result = _.unique(list, true, {a: 42}); - result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); - result = _.unique(list, {a: 42}); - result = _.unique<{a: number}, SampleObject>(list, {a: 42}); + result = _.uniqBy(list, listIterator); + result = _.uniqBy(list, listIterator); + result = _.uniqBy(list, 'a'); + result = _.uniqBy(list, {a: 42}); + result = _.uniqBy<{a: number}, SampleObject>(list, {a: 42}); } { let result: _.LoDashImplicitArrayWrapper; - result = _('abc').unique(); - result = _('abc').unique(true); - result = _('abc').unique(true, stringIterator); - result = _('abc').unique(true, stringIterator, any); - result = _('abc').unique(stringIterator); - result = _('abc').unique(stringIterator, any); + result = _('abc').uniqBy(stringIterator); } { let result: _.LoDashImplicitArrayWrapper; - result = _(array).unique(); - result = _(array).unique(true); - result = _(array).unique(true, listIterator); - result = _(array).unique(true, listIterator, any); - result = _(array).unique(listIterator); - result = _(array).unique(listIterator, any); - result = _(array).unique(true, 'a'); - result = _(array).unique(true, 'a', any); - result = _(array).unique('a'); - result = _(array).unique('a', any); - result = _(array).unique<{a: number}>(true, {a: 42}); - result = _(array).unique<{a: number}>({a: 42}); + result = _(array).uniqBy(listIterator); + result = _(array).uniqBy('a'); + result = _(array).uniqBy<{a: number}>({a: 42}); - result = _(list).unique(); - result = _(list).unique(true); - result = _(list).unique(true, listIterator); - result = _(list).unique(true, listIterator, any); - result = _(list).unique(true, listIterator); - result = _(list).unique(true, listIterator, any); - result = _(list).unique(listIterator); - result = _(list).unique(listIterator, any); - result = _(list).unique(listIterator); - result = _(list).unique(listIterator, any); - result = _(list).unique(true, 'a'); - result = _(list).unique(true, 'a', any); - result = _(list).unique('a'); - result = _(list).unique('a', any); - result = _(list).unique(true, {a: 42}); - result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).unique({a: 42}); - result = _(list).unique<{a: number}, SampleObject>({a: 42}); + result = _(list).uniqBy(listIterator); + result = _(list).uniqBy(listIterator); + result = _(list).uniqBy('a'); + result = _(list).uniqBy({a: 42}); + result = _(list).uniqBy<{a: number}, SampleObject>({a: 42}); } { let result: _.LoDashExplicitArrayWrapper; - result = _('abc').chain().unique(); - result = _('abc').chain().unique(true); - result = _('abc').chain().unique(true, stringIterator); - result = _('abc').chain().unique(true, stringIterator, any); - result = _('abc').chain().unique(stringIterator); - result = _('abc').chain().unique(stringIterator, any); + result = _('abc').chain().uniqBy(stringIterator); } { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().unique(); - result = _(array).chain().unique(true); - result = _(array).chain().unique(true, listIterator); - result = _(array).chain().unique(true, listIterator, any); - result = _(array).chain().unique(listIterator); - result = _(array).chain().unique(listIterator, any); - result = _(array).chain().unique(true, 'a'); - result = _(array).chain().unique(true, 'a', any); - result = _(array).chain().unique('a'); - result = _(array).chain().unique('a', any); - result = _(array).chain().unique<{a: number}>(true, {a: 42}); - result = _(array).chain().unique<{a: number}>({a: 42}); + result = _(array).chain().uniqBy(listIterator); + result = _(array).chain().uniqBy('a'); + result = _(array).chain().uniqBy<{a: number}>({a: 42}); - result = _(list).chain().unique(); - result = _(list).chain().unique(true); - result = _(list).chain().unique(true, listIterator); - result = _(list).chain().unique(true, listIterator, any); - result = _(list).chain().unique(true, listIterator); - result = _(list).chain().unique(true, listIterator, any); - result = _(list).chain().unique(listIterator); - result = _(list).chain().unique(listIterator, any); - result = _(list).chain().unique(listIterator); - result = _(list).chain().unique(listIterator, any); - result = _(list).chain().unique(true, 'a'); - result = _(list).chain().unique(true, 'a', any); - result = _(list).chain().unique('a'); - result = _(list).chain().unique('a', any); - result = _(list).chain().unique(true, {a: 42}); - result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); - result = _(list).chain().unique({a: 42}); - result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); + result = _(list).chain().uniqBy(listIterator); + result = _(list).chain().uniqBy(listIterator); + result = _(list).chain().uniqBy('a'); + result = _(list).chain().uniqBy({a: 42}); + result = _(list).chain().uniqBy<{a: number}, SampleObject>({a: 42}); + } +} + +// _.sortedUniq +module TestSortedUniq { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + result = _.sortedUniq('abc'); + } + + { + let result: SampleObject[]; + result = _.sortedUniq(array); + result = _.sortedUniq(list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _('abc').sortedUniq(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + result = _(array).sortedUniq(); + result = _(list).sortedUniq(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _('abc').chain().sortedUniq(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + result = _(array).chain().sortedUniq(); + result = _(list).chain().sortedUniq(); + } +} + +// _.sortedUniqBy +module TestSortedUniqBy { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.sortedUniqBy('abc', stringIterator); + result = _.sortedUniqBy('abc', stringIterator); + } + + { + let result: SampleObject[]; + + result = _.sortedUniqBy(array, listIterator); + result = _.sortedUniqBy(array, listIterator); + result = _.sortedUniqBy(array, 'a'); + result = _.sortedUniqBy(array, {a: 42}); + result = _.sortedUniqBy<{a: number}, SampleObject>(array, {a: 42}); + + result = _.sortedUniqBy(list, listIterator); + result = _.sortedUniqBy(list, listIterator); + result = _.sortedUniqBy(list, 'a'); + result = _.sortedUniqBy(list, {a: 42}); + result = _.sortedUniqBy<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').sortedUniqBy(stringIterator); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortedUniqBy(listIterator); + result = _(array).sortedUniqBy('a'); + result = _(array).sortedUniqBy<{a: number}>({a: 42}); + + result = _(list).sortedUniqBy(listIterator); + result = _(list).sortedUniqBy(listIterator); + result = _(list).sortedUniqBy('a'); + result = _(list).sortedUniqBy({a: 42}); + result = _(list).sortedUniqBy<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().sortedUniqBy(stringIterator); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortedUniqBy(listIterator); + result = _(array).chain().sortedUniqBy('a'); + result = _(array).chain().sortedUniqBy<{a: number}>({a: 42}); + + result = _(list).chain().sortedUniqBy(listIterator); + result = _(list).chain().sortedUniqBy(listIterator); + result = _(list).chain().sortedUniqBy('a'); + result = _(list).chain().sortedUniqBy({a: 42}); + result = _(list).chain().sortedUniqBy<{a: number}, SampleObject>({a: 42}); } } @@ -2847,44 +2696,6 @@ module TestReverse { } } -// _.prototype.run -module TestRun { - { - let result: string; - - result = _('').run(); - result = _('').chain().run(); - } - - { - let result: number; - - result = _(42).run(); - result = _(42).chain().run(); - } - - { - let result: boolean; - - result = _(true).run(); - result = _(true).chain().run(); - } - - { - let result: string[]; - - result = _([]).run(); - result = _([]).chain().run(); - } - - { - let result: {a: string}; - - result = _({a: ''}).run(); - result = _({a: ''}).chain().run(); - } -} - // _.prototype.toJSON module TestToJSON { { @@ -3020,170 +2831,6 @@ module TestValueOf { * Collection * **************/ -// _.all -module TestAll { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - - { - let result: boolean; - - result = _.all(array); - result = _.all(array, listIterator); - result = _.all(array, listIterator, any); - result = _.all(array, ''); - result = _.all<{a: number}, TResult>(array, {a: 42}); - - result = _.all(list); - result = _.all(list, listIterator); - result = _.all(list, listIterator, any); - result = _.all(list, ''); - result = _.all<{a: number}, TResult>(list, {a: 42}); - - result = _.all(dictionary); - result = _.all(dictionary, dictionaryIterator); - result = _.all(dictionary, dictionaryIterator, any); - result = _.all(dictionary, ''); - result = _.all<{a: number}, TResult>(dictionary, {a: 42}); - - result = _(array).all(); - result = _(array).all(listIterator); - result = _(array).all(listIterator, any); - result = _(array).all(''); - result = _(array).all<{a: number}>({a: 42}); - - result = _(list).all(); - result = _(list).all(listIterator); - result = _(list).all(listIterator, any); - result = _(list).all(''); - result = _(list).all<{a: number}>({a: 42}); - - result = _(dictionary).all(); - result = _(dictionary).all(dictionaryIterator); - result = _(dictionary).all(dictionaryIterator, any); - result = _(dictionary).all(''); - result = _(dictionary).all<{a: number}>({a: 42}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().all(); - result = _(array).chain().all(listIterator); - result = _(array).chain().all(listIterator, any); - result = _(array).chain().all(''); - result = _(array).chain().all<{a: number}>({a: 42}); - - result = _(list).chain().all(); - result = _(list).chain().all(listIterator); - result = _(list).chain().all(listIterator, any); - result = _(list).chain().all(''); - result = _(list).chain().all<{a: number}>({a: 42}); - - result = _(dictionary).chain().all(); - result = _(dictionary).chain().all(dictionaryIterator); - result = _(dictionary).chain().all(dictionaryIterator, any); - result = _(dictionary).chain().all(''); - result = _(dictionary).chain().all<{a: number}>({a: 42}); - } -} - -// _.any -module TestAny { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; - - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; - - { - let result: boolean; - - result = _.any(array); - result = _.any(array, listIterator); - result = _.any(array, listIterator, any); - result = _.any(array, ''); - result = _.any<{a: number}, TResult>(array, {a: 42}); - - result = _.any(list); - result = _.any(list, listIterator); - result = _.any(list, listIterator, any); - result = _.any(list, ''); - result = _.any<{a: number}, TResult>(list, {a: 42}); - - result = _.any(dictionary); - result = _.any(dictionary, dictionaryIterator); - result = _.any(dictionary, dictionaryIterator, any); - result = _.any(dictionary, ''); - result = _.any<{a: number}, TResult>(dictionary, {a: 42}); - - result = _.any(numericDictionary); - result = _.any(numericDictionary, numericDictionaryIterator); - result = _.any(numericDictionary, numericDictionaryIterator, any); - result = _.any(numericDictionary, ''); - result = _.any<{a: number}, TResult>(numericDictionary, {a: 42}); - - result = _(array).any(); - result = _(array).any(listIterator); - result = _(array).any(listIterator, any); - result = _(array).any(''); - result = _(array).any<{a: number}>({a: 42}); - - result = _(list).any(); - result = _(list).any(listIterator); - result = _(list).any(listIterator, any); - result = _(list).any(''); - result = _(list).any<{a: number}>({a: 42}); - - result = _(dictionary).any(); - result = _(dictionary).any(dictionaryIterator); - result = _(dictionary).any(dictionaryIterator, any); - result = _(dictionary).any(''); - result = _(dictionary).any<{a: number}>({a: 42}); - - result = _(numericDictionary).any(); - result = _(numericDictionary).any(numericDictionaryIterator); - result = _(numericDictionary).any(numericDictionaryIterator, any); - result = _(numericDictionary).any(''); - result = _(numericDictionary).any<{a: number}>({a: 42}); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().any(); - result = _(array).chain().any(listIterator); - result = _(array).chain().any(listIterator, any); - result = _(array).chain().any(''); - result = _(array).chain().any<{a: number}>({a: 42}); - - result = _(list).chain().any(); - result = _(list).chain().any(listIterator); - result = _(list).chain().any(listIterator, any); - result = _(list).chain().any(''); - result = _(list).chain().any<{a: number}>({a: 42}); - - result = _(dictionary).chain().any(); - result = _(dictionary).chain().any(dictionaryIterator); - result = _(dictionary).chain().any(dictionaryIterator, any); - result = _(dictionary).chain().any(''); - result = _(dictionary).chain().any<{a: number}>({a: 42}); - - result = _(numericDictionary).chain().any(); - result = _(numericDictionary).chain().any(numericDictionaryIterator); - result = _(numericDictionary).chain().any(numericDictionaryIterator, any); - result = _(numericDictionary).chain().any(''); - result = _(numericDictionary).chain().any<{a: number}>({a: 42}); - } -} - // _.at module TestAt { let array: TResult[]; @@ -3215,143 +2862,6 @@ module TestAt { } } -// _.collect -module TestCollect { - let array: number[]; - let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: number, index: number, collection: _.List) => TResult; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; - - { - let result: TResult[]; - - result = _.collect(array); - result = _.collect(array, listIterator); - result = _.collect(array, listIterator, any); - result = _.collect(array, ''); - - result = _.collect(list); - result = _.collect(list, listIterator); - result = _.collect(list, listIterator, any); - result = _.collect(list, ''); - - result = _.collect(dictionary); - result = _.collect(dictionary, dictionaryIterator); - result = _.collect(dictionary, dictionaryIterator, any); - result = _.collect(dictionary, ''); - } - - { - let result: boolean[]; - - result = _.collect(array, {}); - result = _.collect(list, {}); - result = _.collect(dictionary, {}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).collect(); - result = _(array).collect(listIterator); - result = _(array).collect(listIterator, any); - result = _(array).collect(''); - - result = _(list).collect(); - result = _(list).collect(listIterator); - result = _(list).collect(listIterator, any); - result = _(list).collect(''); - - result = _(dictionary).collect(); - result = _(dictionary).collect(dictionaryIterator); - result = _(dictionary).collect(dictionaryIterator, any); - result = _(dictionary).collect(''); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).collect<{}>({}); - result = _(list).collect<{}>({}); - result = _(dictionary).collect<{}>({}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().collect(); - result = _(array).chain().collect(listIterator); - result = _(array).chain().collect(listIterator, any); - result = _(array).chain().collect(''); - - result = _(list).chain().collect(); - result = _(list).chain().collect(listIterator); - result = _(list).chain().collect(listIterator, any); - result = _(list).chain().collect(''); - - result = _(dictionary).chain().collect(); - result = _(dictionary).chain().collect(dictionaryIterator); - result = _(dictionary).chain().collect(dictionaryIterator, any); - result = _(dictionary).chain().collect(''); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().collect<{}>({}); - result = _(list).chain().collect<{}>({}); - result = _(dictionary).chain().collect<{}>({}); - } -} - -// _.contains -module TestContains { - type SampleType = {a: string; b: number; c: boolean;}; - - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; - - let target: SampleType; - - { - let result: boolean; - - result = _.contains(array, target); - result = _.contains(array, target, 42); - - result = _.contains(list, target); - result = _.contains(list, target, 42); - - result = _.contains(dictionary, target); - result = _.contains(dictionary, target, 42); - - result = _(array).contains(target); - result = _(array).contains(target, 42); - - result = _(list).contains(target); - result = _(list).contains(target, 42); - - result = _(dictionary).contains(target); - result = _(dictionary).contains(target, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().contains(target); - result = _(array).chain().contains(target, 42); - - result = _(list).chain().contains(target); - result = _(list).chain().contains(target, 42); - - result = _(dictionary).chain().contains(target); - result = _(dictionary).chain().contains(target, 42); - } -} - // _.countBy module TestCountBy { let array: TResult[]; @@ -3485,54 +2995,6 @@ module TestCountBy { } } -// _.detect -module TestDetect { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; - - let result: TResult; - - result = _.detect(array); - result = _.detect(array, listIterator); - result = _.detect(array, listIterator, any); - result = _.detect(array, ''); - result = _.detect<{a: number}, TResult>(array, {a: 42}); - - result = _.detect(list); - result = _.detect(list, listIterator); - result = _.detect(list, listIterator, any); - result = _.detect(list, ''); - result = _.detect<{a: number}, TResult>(list, {a: 42}); - - result = _.detect(dictionary); - result = _.detect(dictionary, dictionaryIterator); - result = _.detect(dictionary, dictionaryIterator, any); - result = _.detect(dictionary, ''); - result = _.detect<{a: number}, TResult>(dictionary, {a: 42}); - - result = _(array).detect(); - result = _(array).detect(listIterator); - result = _(array).detect(listIterator, any); - result = _(array).detect(''); - result = _(array).detect<{a: number}>({a: 42}); - - result = _(list).detect(); - result = _(list).detect(listIterator); - result = _(list).detect(listIterator, any); - result = _(list).detect(''); - result = _(list).detect<{a: number}, TResult>({a: 42}); - - result = _(dictionary).detect(); - result = _(dictionary).detect(dictionaryIterator); - result = _(dictionary).detect(dictionaryIterator, any); - result = _(dictionary).detect(''); - result = _(dictionary).detect<{a: number}, TResult>({a: 42}); -} - // _.each module TestEach { let array: TResult[]; @@ -3941,12 +3403,6 @@ module TestFind { result = _(dictionary).find<{a: number}, TResult>({a: 42}); } -result = _.findWhere([1, 2, 3, 4], function (num) { - return num % 2 == 0; -}); -result = _.findWhere(foodsCombined, { 'type': 'vegetable' }); -result = _.findWhere(foodsCombined, 'organic'); - result = _.findLast([1, 2, 3, 4], function (num) { return num % 2 == 0; }); @@ -4298,52 +3754,6 @@ module TestGroupBy { } } -// _.include -module TestInclude { - type SampleType = {a: string; b: number; c: boolean;}; - - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; - - let target: SampleType; - - { - let result: boolean; - - result = _.include(array, target); - result = _.include(array, target, 42); - - result = _.include(list, target); - result = _.include(list, target, 42); - - result = _.include(dictionary, target); - result = _.include(dictionary, target, 42); - - result = _(array).include(target); - result = _(array).include(target, 42); - - result = _(list).include(target); - result = _(list).include(target, 42); - - result = _(dictionary).include(target); - result = _(dictionary).include(target, 42); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _(array).chain().include(target); - result = _(array).chain().include(target, 42); - - result = _(list).chain().include(target); - result = _(list).chain().include(target, 42); - - result = _(dictionary).chain().include(target); - result = _(dictionary).chain().include(target, 42); - } -} - // _.includes module TestIncludes { type SampleType = {a: string; b: number; c: boolean;}; @@ -4390,8 +3800,8 @@ module TestIncludes { } } -// _.indexBy -module TestIndexBy { +// _.keyBy +module TestKeyBy { type SampleObject = {a: number; b: string; c: boolean;}; let array: SampleObject[]; @@ -4407,136 +3817,136 @@ module TestIndexBy { { let result: _.Dictionary; - result = _.indexBy('abcd'); - result = _.indexBy('abcd', stringIterator); - result = _.indexBy('abcd', stringIterator, any); + result = _.keyBy('abcd'); + result = _.keyBy('abcd', stringIterator); + result = _.keyBy('abcd', stringIterator, any); } { let result: _.Dictionary; - result = _.indexBy(array); - result = _.indexBy(array, listIterator); - result = _.indexBy(array, listIterator, any); - result = _.indexBy(array, 'a'); - result = _.indexBy(array, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(array, {a: 42}); - result = _.indexBy(array, {a: 42}); + result = _.keyBy(array); + result = _.keyBy(array, listIterator); + result = _.keyBy(array, listIterator, any); + result = _.keyBy(array, 'a'); + result = _.keyBy(array, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(array, {a: 42}); + result = _.keyBy(array, {a: 42}); - result = _.indexBy(list); - result = _.indexBy(list, listIterator); - result = _.indexBy(list, listIterator, any); - result = _.indexBy(list, 'a'); - result = _.indexBy(list, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(list, {a: 42}); - result = _.indexBy(list, {a: 42}); + result = _.keyBy(list); + result = _.keyBy(list, listIterator); + result = _.keyBy(list, listIterator, any); + result = _.keyBy(list, 'a'); + result = _.keyBy(list, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(list, {a: 42}); + result = _.keyBy(list, {a: 42}); - result = _.indexBy(numericDictionary); - result = _.indexBy(numericDictionary, numericDictionaryIterator); - result = _.indexBy(numericDictionary, numericDictionaryIterator, any); - result = _.indexBy(numericDictionary, 'a'); - result = _.indexBy(numericDictionary, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); - result = _.indexBy(numericDictionary, {a: 42}); + result = _.keyBy(numericDictionary); + result = _.keyBy(numericDictionary, numericDictionaryIterator); + result = _.keyBy(numericDictionary, numericDictionaryIterator, any); + result = _.keyBy(numericDictionary, 'a'); + result = _.keyBy(numericDictionary, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); + result = _.keyBy(numericDictionary, {a: 42}); - result = _.indexBy(dictionary); - result = _.indexBy(dictionary, dictionaryIterator); - result = _.indexBy(dictionary, dictionaryIterator, any); - result = _.indexBy(dictionary, 'a'); - result = _.indexBy(dictionary, 'a', any); - result = _.indexBy<{a: number}, SampleObject>(dictionary, {a: 42}); - result = _.indexBy(dictionary, {a: 42}); + result = _.keyBy(dictionary); + result = _.keyBy(dictionary, dictionaryIterator); + result = _.keyBy(dictionary, dictionaryIterator, any); + result = _.keyBy(dictionary, 'a'); + result = _.keyBy(dictionary, 'a', any); + result = _.keyBy<{a: number}, SampleObject>(dictionary, {a: 42}); + result = _.keyBy(dictionary, {a: 42}); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _('abcd').indexBy(); - result = _('abcd').indexBy(stringIterator); - result = _('abcd').indexBy(stringIterator, any); + result = _('abcd').keyBy(); + result = _('abcd').keyBy(stringIterator); + result = _('abcd').keyBy(stringIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - result = _(array).indexBy(); - result = _(array).indexBy(listIterator); - result = _(array).indexBy(listIterator, any); - result = _(array).indexBy('a'); - result = _(array).indexBy('a', any); - result = _(array).indexBy<{a: number}>({a: 42}); + result = _(array).keyBy(); + result = _(array).keyBy(listIterator); + result = _(array).keyBy(listIterator, any); + result = _(array).keyBy('a'); + result = _(array).keyBy('a', any); + result = _(array).keyBy<{a: number}>({a: 42}); - result = _(list).indexBy(); - result = _(list).indexBy(listIterator); - result = _(list).indexBy(listIterator, any); - result = _(list).indexBy('a'); - result = _(list).indexBy('a', any); - result = _(list).indexBy<{a: number}, SampleObject>({a: 42}); - result = _(list).indexBy({a: 42}); + result = _(list).keyBy(); + result = _(list).keyBy(listIterator); + result = _(list).keyBy(listIterator, any); + result = _(list).keyBy('a'); + result = _(list).keyBy('a', any); + result = _(list).keyBy<{a: number}, SampleObject>({a: 42}); + result = _(list).keyBy({a: 42}); - result = _(numericDictionary).indexBy(); - result = _(numericDictionary).indexBy(numericDictionaryIterator); - result = _(numericDictionary).indexBy(numericDictionaryIterator, any); - result = _(numericDictionary).indexBy('a'); - result = _(numericDictionary).indexBy('a', any); - result = _(numericDictionary).indexBy<{a: number}, SampleObject>({a: 42}); - result = _(numericDictionary).indexBy({a: 42}); + result = _(numericDictionary).keyBy(); + result = _(numericDictionary).keyBy(numericDictionaryIterator); + result = _(numericDictionary).keyBy(numericDictionaryIterator, any); + result = _(numericDictionary).keyBy('a'); + result = _(numericDictionary).keyBy('a', any); + result = _(numericDictionary).keyBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).keyBy({a: 42}); - result = _(dictionary).indexBy(); - result = _(dictionary).indexBy(dictionaryIterator); - result = _(dictionary).indexBy(dictionaryIterator, any); - result = _(dictionary).indexBy('a'); - result = _(dictionary).indexBy('a', any); - result = _(dictionary).indexBy<{a: number}, SampleObject>({a: 42}); - result = _(dictionary).indexBy({a: 42}); + result = _(dictionary).keyBy(); + result = _(dictionary).keyBy(dictionaryIterator); + result = _(dictionary).keyBy(dictionaryIterator, any); + result = _(dictionary).keyBy('a'); + result = _(dictionary).keyBy('a', any); + result = _(dictionary).keyBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).keyBy({a: 42}); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _('abcd').chain().indexBy(); - result = _('abcd').chain().indexBy(stringIterator); - result = _('abcd').chain().indexBy(stringIterator, any); + result = _('abcd').chain().keyBy(); + result = _('abcd').chain().keyBy(stringIterator); + result = _('abcd').chain().keyBy(stringIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - result = _(array).chain().indexBy(); - result = _(array).chain().indexBy(listIterator); - result = _(array).chain().indexBy(listIterator, any); - result = _(array).chain().indexBy('a'); - result = _(array).chain().indexBy('a', any); - result = _(array).chain().indexBy<{a: number}>({a: 42}); + result = _(array).chain().keyBy(); + result = _(array).chain().keyBy(listIterator); + result = _(array).chain().keyBy(listIterator, any); + result = _(array).chain().keyBy('a'); + result = _(array).chain().keyBy('a', any); + result = _(array).chain().keyBy<{a: number}>({a: 42}); - result = _(list).chain().indexBy(); - result = _(list).chain().indexBy(listIterator); - result = _(list).chain().indexBy(listIterator, any); - result = _(list).chain().indexBy('a'); - result = _(list).chain().indexBy('a', any); - result = _(list).chain().indexBy<{a: number}, SampleObject>({a: 42}); - result = _(list).chain().indexBy({a: 42}); + result = _(list).chain().keyBy(); + result = _(list).chain().keyBy(listIterator); + result = _(list).chain().keyBy(listIterator, any); + result = _(list).chain().keyBy('a'); + result = _(list).chain().keyBy('a', any); + result = _(list).chain().keyBy<{a: number}, SampleObject>({a: 42}); + result = _(list).chain().keyBy({a: 42}); - result = _(numericDictionary).chain().indexBy(); - result = _(numericDictionary).chain().indexBy(numericDictionaryIterator); - result = _(numericDictionary).chain().indexBy(numericDictionaryIterator, any); - result = _(numericDictionary).chain().indexBy('a'); - result = _(numericDictionary).chain().indexBy('a', any); - result = _(numericDictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); - result = _(numericDictionary).chain().indexBy({a: 42}); + result = _(numericDictionary).chain().keyBy(); + result = _(numericDictionary).chain().keyBy(numericDictionaryIterator); + result = _(numericDictionary).chain().keyBy(numericDictionaryIterator, any); + result = _(numericDictionary).chain().keyBy('a'); + result = _(numericDictionary).chain().keyBy('a', any); + result = _(numericDictionary).chain().keyBy<{a: number}, SampleObject>({a: 42}); + result = _(numericDictionary).chain().keyBy({a: 42}); - result = _(dictionary).chain().indexBy(); - result = _(dictionary).chain().indexBy(dictionaryIterator); - result = _(dictionary).chain().indexBy(dictionaryIterator, any); - result = _(dictionary).chain().indexBy('a'); - result = _(dictionary).chain().indexBy('a', any); - result = _(dictionary).chain().indexBy<{a: number}, SampleObject>({a: 42}); - result = _(dictionary).chain().indexBy({a: 42}); + result = _(dictionary).chain().keyBy(); + result = _(dictionary).chain().keyBy(dictionaryIterator); + result = _(dictionary).chain().keyBy(dictionaryIterator, any); + result = _(dictionary).chain().keyBy('a'); + result = _(dictionary).chain().keyBy('a', any); + result = _(dictionary).chain().keyBy<{a: number}, SampleObject>({a: 42}); + result = _(dictionary).chain().keyBy({a: 42}); } } -result = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); -result = _.invoke([123, 456], String.prototype.split, ''); +result = _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); +result = _.invokeMap([123, 456], String.prototype.split, ''); // _.map module TestMap { @@ -4657,68 +4067,69 @@ result = <{a: number}[][]>_([{a: 1}, {a: 2}]).partition('a', 2).value(); result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a').value(); result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', 2).value(); -// _.pluck -module TestPluck { - interface SampleObject { - d: {b: TResult}[]; - } - - let array: SampleObject[]; - let list: _.List; - let dictionary: _.Dictionary; - - { - let result: any[]; - - result = _.pluck(array, 'd.0.b'); - result = _.pluck(array, ['d', 0, 'b']); - - result = _.pluck(list, 'd.0.b'); - result = _.pluck(list, ['d', 0, 'b']); - - result = _.pluck(dictionary, 'd.0.b'); - result = _.pluck(dictionary, ['d', 0, 'b']); - } - - { - let result: TResult[]; - - result = _.pluck(array, 'd.0.b'); - result = _.pluck(array, ['d', 0, 'b']); - - result = _.pluck(list, 'd.0.b'); - result = _.pluck(list, ['d', 0, 'b']); - - result = _.pluck(dictionary, 'd.0.b'); - result = _.pluck(dictionary, ['d', 0, 'b']); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).pluck('d.0.b'); - result = _(array).pluck(['d', 0, 'b']); - - result = _(list).pluck('d.0.b'); - result = _(list).pluck(['d', 0, 'b']); - - result = _(dictionary).pluck('d.0.b'); - result = _(dictionary).pluck(['d', 0, 'b']); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().pluck('d.0.b'); - result = _(array).chain().pluck(['d', 0, 'b']); - - result = _(list).chain().pluck('d.0.b'); - result = _(list).chain().pluck(['d', 0, 'b']); - - result = _(dictionary).chain().pluck('d.0.b'); - result = _(dictionary).chain().pluck(['d', 0, 'b']); - } -} +// TODO +// _.map with iteratee shorthand +// module TestMapInsteadOfPluck { +// interface SampleObject { +// d: {b: TResult}[]; +// } +// +// let array: SampleObject[]; +// let list: _.List; +// let dictionary: _.Dictionary; +// +// { +// let result: any[]; +// +// result = _.map(array, 'd.0.b'); +// result = _.map(array, ['d', 0, 'b']); +// +// result = _.map(list, 'd.0.b'); +// result = _.map(list, ['d', 0, 'b']); +// +// result = _.map(dictionary, 'd.0.b'); +// result = _.map(dictionary, ['d', 0, 'b']); +// } +// +// { +// let result: TResult[]; +// +// result = _.map(array, 'd.0.b'); +// result = _.map(array, ['d', 0, 'b']); +// +// result = _.map(list, 'd.0.b'); +// result = _.map(list, ['d', 0, 'b']); +// +// result = _.map(dictionary, 'd.0.b'); +// result = _.map(dictionary, ['d', 0, 'b']); +// } +// +// { +// let result: _.LoDashImplicitArrayWrapper; +// +// result = _(array).map('d.0.b'); +// result = _(array).map(['d', 0, 'b']); +// +// result = _(list).map('d.0.b'); +// result = _(list).map(['d', 0, 'b']); +// +// result = _(dictionary).map('d.0.b'); +// result = _(dictionary).map(['d', 0, 'b']); +// } +// +// { +// let result: _.LoDashExplicitArrayWrapper; +// +// result = _(array).chain().map('d.0.b'); +// result = _(array).chain().map(['d', 0, 'b']); +// +// result = _(list).chain().map('d.0.b'); +// result = _(list).chain().map(['d', 0, 'b']); +// +// result = _(dictionary).chain().map('d.0.b'); +// result = _(dictionary).chain().map(['d', 0, 'b']); +// } +// } interface ABC { [index: string]: number; @@ -4735,22 +4146,6 @@ result = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number return r; }, {}); -result = _.foldl([1, 2, 3], function (sum: number, num: number) { - return sum + num; -}); -result = _.foldl({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - -result = _.inject([1, 2, 3], function (sum: number, num: number) { - return sum + num; -}); -result = _.inject({ 'a': 1, 'b': 2, 'c': 3 }, function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - result = _([1, 2, 3]).reduce(function (sum: number, num: number) { return sum + num; }); @@ -4759,24 +4154,7 @@ result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce(function (r: ABC return r; }, {}); -result = _([1, 2, 3]).foldl(function (sum: number, num: number) { - return sum + num; -}); -result = _({ 'a': 1, 'b': 2, 'c': 3 }).foldl(function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - -result = _([1, 2, 3]).inject(function (sum: number, num: number) { - return sum + num; -}); -result = _({ 'a': 1, 'b': 2, 'c': 3 }).inject(function (r: ABC, num: number, key: string) { - r[key] = num * 3; - return r; -}, {}); - result = _.reduceRight([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); -result = _.foldr([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); // _.reject module TestReject { @@ -4876,110 +4254,15 @@ module TestReject { } } +// _.sample result = _.sample([1, 2, 3, 4]); -result = _.sample([1, 2, 3, 4], 2); result = <_.LoDashImplicitWrapper>_([1, 2, 3, 4]).sample(); -result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sample(2); result = _([1, 2, 3, 4]).sample().value(); -result = _([1, 2, 3, 4]).sample(2).value(); -// _.select -module TestSelect { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; - - { - let result: string[]; - - result = _.select('', stringIterator); - result = _.select('', stringIterator, any); - } - - { - let result: TResult[]; - - result = _.select(array, listIterator); - result = _.select(array, listIterator, any); - result = _.select(array, ''); - result = _.select(array, '', any); - result = _.select<{a: number}, TResult>(array, {a: 42}); - - result = _.select(list, listIterator); - result = _.select(list, listIterator, any); - result = _.select(list, ''); - result = _.select(list, '', any); - result = _.select<{a: number}, TResult>(list, {a: 42}); - - result = _.select(dictionary, dictionaryIterator); - result = _.select(dictionary, dictionaryIterator, any); - result = _.select(dictionary, ''); - result = _.select(dictionary, '', any); - result = _.select<{a: number}, TResult>(dictionary, {a: 42}); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _('').select(stringIterator); - result = _('').select(stringIterator, any); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).select(listIterator); - result = _(array).select(listIterator, any); - result = _(array).select(''); - result = _(array).select('', any); - result = _(array).select<{a: number}>({a: 42}); - - result = _(list).select(listIterator); - result = _(list).select(listIterator, any); - result = _(list).select(''); - result = _(list).select('', any); - result = _(list).select<{a: number}, TResult>({a: 42}); - - result = _(dictionary).select(dictionaryIterator); - result = _(dictionary).select(dictionaryIterator, any); - result = _(dictionary).select(''); - result = _(dictionary).select('', any); - result = _(dictionary).select<{a: number}, TResult>({a: 42}); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _('').chain().select(stringIterator); - result = _('').chain().select(stringIterator, any); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().select(listIterator); - result = _(array).chain().select(listIterator, any); - result = _(array).chain().select(''); - result = _(array).chain().select('', any); - result = _(array).chain().select<{a: number}>({a: 42}); - - result = _(list).chain().select(listIterator); - result = _(list).chain().select(listIterator, any); - result = _(list).chain().select(''); - result = _(list).chain().select('', any); - result = _(list).chain().select<{a: number}, TResult>({a: 42}); - - result = _(dictionary).chain().select(dictionaryIterator); - result = _(dictionary).chain().select(dictionaryIterator, any); - result = _(dictionary).chain().select(''); - result = _(dictionary).chain().select('', any); - result = _(dictionary).chain().select<{a: number}, TResult>({a: 42}); - } -} +// _.sampleSize +result = _.sampleSize([1, 2, 3, 4], 2); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sampleSize(2); +result = _([1, 2, 3, 4]).sampleSize(2).value(); // _.shuffle module TestShuffle { @@ -5168,19 +4451,16 @@ module TestSortBy { result = _.sortBy(array); result = _.sortBy(array, listIterator); - result = _.sortBy(array, listIterator, any); result = _.sortBy(array, ''); result = _.sortBy<{a: number}, TResult>(array, {a: 42}); result = _.sortBy(list); result = _.sortBy(list, listIterator); - result = _.sortBy(list, listIterator, any); result = _.sortBy(list, ''); result = _.sortBy<{a: number}, TResult>(list, {a: 42}); result = _.sortBy(dictionary); result = _.sortBy(dictionary, dictionaryIterator); - result = _.sortBy(dictionary, dictionaryIterator, any); result = _.sortBy(dictionary, ''); result = _.sortBy<{a: number}, TResult>(dictionary, {a: 42}); } @@ -5190,19 +4470,16 @@ module TestSortBy { result = _(array).sortBy(); result = _(array).sortBy(listIterator); - result = _(array).sortBy(listIterator, any); result = _(array).sortBy(''); result = _(array).sortBy<{a: number}>({a: 42}); result = _(list).sortBy(); result = _(list).sortBy(listIterator); - result = _(list).sortBy(listIterator, any); result = _(list).sortBy(''); result = _(list).sortBy<{a: number}, TResult>({a: 42}); result = _(dictionary).sortBy(); result = _(dictionary).sortBy(dictionaryIterator); - result = _(dictionary).sortBy(dictionaryIterator, any); result = _(dictionary).sortBy(''); result = _(dictionary).sortBy<{a: number}, TResult>({a: 42}); } @@ -5212,32 +4489,30 @@ module TestSortBy { result = _(array).chain().sortBy(); result = _(array).chain().sortBy(listIterator); - result = _(array).chain().sortBy(listIterator, any); result = _(array).chain().sortBy(''); result = _(array).chain().sortBy<{a: number}>({a: 42}); result = _(list).chain().sortBy(); result = _(list).chain().sortBy(listIterator); - result = _(list).chain().sortBy(listIterator, any); result = _(list).chain().sortBy(''); result = _(list).chain().sortBy<{a: number}, TResult>({a: 42}); result = _(dictionary).chain().sortBy(); result = _(dictionary).chain().sortBy(dictionaryIterator); - result = _(dictionary).chain().sortBy(dictionaryIterator, any); result = _(dictionary).chain().sortBy(''); result = _(dictionary).chain().sortBy<{a: number}, TResult>({a: 42}); } } -result = _.sortByAll(stoogesAges, function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }); -result = _.sortByAll(stoogesAges, ['name', 'age']); -result = _.sortByAll(stoogesAges, 'name', function(stooge) { return Math.sin(stooge.age); }); +result = _.sortBy(stoogesAges, function(stooge) { return Math.sin(stooge.age); }, function(stooge) { return stooge.name.slice(1); }); +result = _.sortBy(stoogesAges, ['name', 'age']); +result = _.sortBy(stoogesAges, 'name', function(stooge) { return Math.sin(stooge.age); }); -result = _(foodsOrganic).sortByAll('organic', (food) => food.name, { organic: true }).value(); +result = _(foodsOrganic).sortBy('organic', (food) => food.name, { organic: true }).value(); -// _.sortByOrder -module TestSortByOrder { + +// _.orderBy +module TestorderBy { type SampleObject = {a: number; b: string; c: boolean}; let array: SampleObject[]; @@ -5250,88 +4525,82 @@ module TestSortByOrder { let iteratees: (value: string) => any|((value: string) => any)[]; let result: string[]; - result = _.sortByOrder('acbd', iteratees); - result = _.sortByOrder('acbd', iteratees, orders); + result = _.orderBy('acbd', iteratees); + result = _.orderBy('acbd', iteratees, orders); } { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; let result: SampleObject[]; - result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(array, iteratees, orders); - result = _.sortByOrder(array, iteratees); - result = _.sortByOrder(array, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(array, iteratees); + result = _.orderBy<{a: number}, SampleObject>(array, iteratees, orders); + result = _.orderBy(array, iteratees); + result = _.orderBy(array, iteratees, orders); - result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(list, iteratees, orders); - result = _.sortByOrder(list, iteratees); - result = _.sortByOrder(list, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(list, iteratees); + result = _.orderBy<{a: number}, SampleObject>(list, iteratees, orders); + result = _.orderBy(list, iteratees); + result = _.orderBy(list, iteratees, orders); - result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(numericDictionary, iteratees, orders); - result = _.sortByOrder(numericDictionary, iteratees); - result = _.sortByOrder(numericDictionary, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(numericDictionary, iteratees); + result = _.orderBy<{a: number}, SampleObject>(numericDictionary, iteratees, orders); + result = _.orderBy(numericDictionary, iteratees); + result = _.orderBy(numericDictionary, iteratees, orders); - result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees); - result = _.sortByOrder<{a: number}, SampleObject>(dictionary, iteratees, orders); - result = _.sortByOrder(dictionary, iteratees); - result = _.sortByOrder(dictionary, iteratees, orders); + result = _.orderBy<{a: number}, SampleObject>(dictionary, iteratees); + result = _.orderBy<{a: number}, SampleObject>(dictionary, iteratees, orders); + result = _.orderBy(dictionary, iteratees); + result = _.orderBy(dictionary, iteratees, orders); } { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; let result: _.LoDashImplicitArrayWrapper; - result = _(array).sortByOrder<{a: number}>(iteratees); - result = _(array).sortByOrder<{a: number}>(iteratees, orders); + result = _(array).orderBy<{a: number}>(iteratees); + result = _(array).orderBy<{a: number}>(iteratees, orders); - result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(list).sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(list).sortByOrder(iteratees); - result = _(list).sortByOrder(iteratees, orders); + result = _(list).orderBy<{a: number}, SampleObject>(iteratees); + result = _(list).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(list).orderBy(iteratees); + result = _(list).orderBy(iteratees, orders); - result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(numericDictionary).sortByOrder(iteratees); - result = _(numericDictionary).sortByOrder(iteratees, orders); + result = _(numericDictionary).orderBy<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).orderBy(iteratees); + result = _(numericDictionary).orderBy(iteratees, orders); - result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(dictionary).sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(dictionary).sortByOrder(iteratees); - result = _(dictionary).sortByOrder(iteratees, orders); + result = _(dictionary).orderBy<{a: number}, SampleObject>(iteratees); + result = _(dictionary).orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).orderBy(iteratees); + result = _(dictionary).orderBy(iteratees, orders); } { let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().sortByOrder<{a: number}>(iteratees); - result = _(array).chain().sortByOrder<{a: number}>(iteratees, orders); + result = _(array).chain().orderBy<{a: number}>(iteratees); + result = _(array).chain().orderBy<{a: number}>(iteratees, orders); - result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(list).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(list).chain().sortByOrder(iteratees); - result = _(list).chain().sortByOrder(iteratees, orders); + result = _(list).chain().orderBy<{a: number}, SampleObject>(iteratees); + result = _(list).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(list).chain().orderBy(iteratees); + result = _(list).chain().orderBy(iteratees, orders); - result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(numericDictionary).chain().sortByOrder(iteratees); - result = _(numericDictionary).chain().sortByOrder(iteratees, orders); + result = _(numericDictionary).chain().orderBy<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(numericDictionary).chain().orderBy(iteratees); + result = _(numericDictionary).chain().orderBy(iteratees, orders); - result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees); - result = _(dictionary).chain().sortByOrder<{a: number}, SampleObject>(iteratees, orders); - result = _(dictionary).chain().sortByOrder(iteratees); - result = _(dictionary).chain().sortByOrder(iteratees, orders); + result = _(dictionary).chain().orderBy<{a: number}, SampleObject>(iteratees); + result = _(dictionary).chain().orderBy<{a: number}, SampleObject>(iteratees, orders); + result = _(dictionary).chain().orderBy(iteratees); + result = _(dictionary).chain().orderBy(iteratees, orders); } } -result = _.where(stoogesCombined, { 'age': 40 }); -result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); - -result = _(stoogesCombined).where({ 'age': 40 }).value(); -result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); - /******** * Date * ********/ @@ -5358,8 +4627,7 @@ module TestNow { /************* * Functions * *************/ - -// _after +// _.after module TestAfter { interface Func { (a: string, b: number): boolean; @@ -5416,36 +4684,6 @@ module TestAry { } } -// _.backflow -module TestBackflow { - let Fn1: (n: number) => number; - let Fn2: (m: number, n: number) => number; - - { - let result: (m: number, n: number) => number; - - result = _.backflow<(m: number, n: number) => number>(Fn1, Fn2); - result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _.backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).backflow<(m: number, n: number) => number>(Fn2); - result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn2); - result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).chain().backflow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } -} - // _.before module TestBefore { interface Func { @@ -5675,36 +4913,6 @@ module TestBindKey { } } -// _.compose -module TestCompose { - let Fn1: (n: number) => number; - let Fn2: (m: number, n: number) => number; - - { - let result: (m: number, n: number) => number; - - result = _.compose<(m: number, n: number) => number>(Fn1, Fn2); - result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - result = _.compose<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).compose<(m: number, n: number) => number>(Fn2); - result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } - - { - let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; - - result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn2); - result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn2); - result = _(Fn1).chain().compose<(m: number, n: number) => number>(Fn1, Fn1, Fn2); - } -} - var createCallbackObj: { [index: string]: string; } = { name: 'Joe' }; result = <() => any>_.createCallback('name'); result = <() => boolean>_.createCallback(createCallbackObj); @@ -5871,6 +5079,33 @@ module TestDelay { } } +// _.flip +module TestFlip { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.flip(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).flip(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().flip(); + } +} + // _.flow module TestFlow { let Fn1: (n: number) => number; @@ -5944,8 +5179,8 @@ result = _.memoize(testMemoizeFn, te result = (_(testMemoizeFn).memoize().value()); result = (_(testMemoizeFn).memoize(testMemoizeResolverFn).value()); -// _.modArgs -module TestModArgs { +// _.overArgs +module TestOverArgs { type Func1 = (a: boolean) => boolean; type Func2 = (a: boolean, b: boolean) => boolean; @@ -5958,43 +5193,43 @@ module TestModArgs { { let result: (a: string) => boolean; - result = _.modArgs boolean>(func1, transform1); - result = _.modArgs boolean>(func1, [transform1]); + result = _.overArgs boolean>(func1, transform1); + result = _.overArgs boolean>(func1, [transform1]); } { let result: (a: string, b: number) => boolean; - result = _.modArgs boolean>(func2, transform1, transform2); - result = _.modArgs boolean>(func2, [transform1, transform2]); + result = _.overArgs boolean>(func2, transform1, transform2); + result = _.overArgs boolean>(func2, [transform1, transform2]); } { let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>; - result = _(func1).modArgs<(a: string) => boolean>(transform1); - result = _(func1).modArgs<(a: string) => boolean>([transform1]); + result = _(func1).overArgs<(a: string) => boolean>(transform1); + result = _(func1).overArgs<(a: string) => boolean>([transform1]); } { let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>; - result = _(func2).modArgs<(a: string, b: number) => boolean>(transform1, transform2); - result = _(func2).modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + result = _(func2).overArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).overArgs<(a: string, b: number) => boolean>([transform1, transform2]); } { let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>; - result = _(func1).chain().modArgs<(a: string) => boolean>(transform1); - result = _(func1).chain().modArgs<(a: string) => boolean>([transform1]); + result = _(func1).chain().overArgs<(a: string) => boolean>(transform1); + result = _(func1).chain().overArgs<(a: string) => boolean>([transform1]); } { let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>; - result = _(func2).chain().modArgs<(a: string, b: number) => boolean>(transform1, transform2); - result = _(func2).chain().modArgs<(a: string, b: number) => boolean>([transform1, transform2]); + result = _(func2).chain().overArgs<(a: string, b: number) => boolean>(transform1, transform2); + result = _(func2).chain().overArgs<(a: string, b: number) => boolean>([transform1, transform2]); } } @@ -6083,8 +5318,8 @@ result = (_.rearg(testReargFn, [2, 0, 1]))('b', 'c' result = (_(testReargFn).rearg(2, 0, 1).value())('b', 'c', 'a'); result = (_(testReargFn).rearg([2, 0, 1]).value())('b', 'c', 'a'); -// _.restParam -module TestRestParam { +// _.rest +module TestRest { type Func = (a: string, b: number[]) => boolean; type ResultFunc = (a: string, ...b: number[]) => boolean; @@ -6093,25 +5328,25 @@ module TestRestParam { { let result: ResultFunc; - result = _.restParam(func); - result = _.restParam(func, 1); + result = _.rest(func); + result = _.rest(func, 1); - result = _.restParam(func); - result = _.restParam(func, 1); + result = _.rest(func); + result = _.rest(func, 1); } { let result: _.LoDashImplicitObjectWrapper; - result = _(func).restParam(); - result = _(func).restParam(1); + result = _(func).rest(); + result = _(func).rest(1); } { let result: _.LoDashExplicitObjectWrapper; - result = _(func).chain().restParam(); - result = _(func).chain().restParam(1); + result = _(func).chain().rest(); + result = _(func).chain().rest(1); } } @@ -6186,6 +5421,33 @@ module TestThrottle { } } +// _.unary +module TestUnary { + interface Func { + (a: number, b: string): boolean; + } + + let func: Func; + + { + let result: Func; + + result = _.unary(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).unary(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().unary(); + } +} + // _.wrap module TestWrap { type SampleValue = {a: number; b: string; c: boolean} @@ -6275,87 +5537,79 @@ module TestWrap { ********/ // _.clone +{ + let result: number; + result = _.clone(42); + result = _(42).clone(); +} +{ + let result: string[]; + result = _.clone([]); + result = _([]).clone(); +} +{ + let result: {a: {b: number;}}; + result = _.clone<{a: {b: number;}}>({a: {b: 2}}); + result = _({a: {b: 2}}).clone(); +} + +// _.cloneDeep +{ + let result: number; + result = _.cloneDeep(42); + result = _(42).cloneDeep(); +} +{ + let result: string[]; + result = _.cloneDeep([]); + result = _([]).cloneDeep(); +} +{ + let result: {a: {b: number;}}; + result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}); + result = _({a: {b: 2}}).cloneDeep(); +} + +// _.cloneWith interface TestCloneCustomizerFn { (value: any): any; } var testCloneCustomizerFn: TestCloneCustomizerFn; { let result: number; - result = _.clone(42); - result = _.clone(42, false); - result = _.clone(42, false, testCloneCustomizerFn); - result = _.clone(42, false, testCloneCustomizerFn, any); result = _.clone(42, testCloneCustomizerFn); - result = _.clone(42, testCloneCustomizerFn, any); - result = _(42).clone(); - result = _(42).clone(false); - result = _(42).clone(false, testCloneCustomizerFn); - result = _(42).clone(false, testCloneCustomizerFn, any); result = _(42).clone(testCloneCustomizerFn); - result = _(42).clone(testCloneCustomizerFn, any); } { let result: string[]; - result = _.clone([]); - result = _.clone([], false); - result = _.clone([], false, testCloneCustomizerFn); - result = _.clone([], false, testCloneCustomizerFn, any); result = _.clone([], testCloneCustomizerFn); - result = _.clone([], testCloneCustomizerFn, any); - result = _([]).clone(); - result = _([]).clone(false); - result = _([]).clone(false, testCloneCustomizerFn); - result = _([]).clone(false, testCloneCustomizerFn, any); result = _([]).clone(testCloneCustomizerFn); - result = _([]).clone(testCloneCustomizerFn, any); } { let result: {a: {b: number;}}; - result = _.clone<{a: {b: number;}}>({a: {b: 2}}); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, false, testCloneCustomizerFn, any); result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn); - result = _.clone<{a: {b: number;}}>({a: {b: 2}}, testCloneCustomizerFn, any); - result = _({a: {b: 2}}).clone(); - result = _({a: {b: 2}}).clone(false); - result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn); - result = _({a: {b: 2}}).clone(false, testCloneCustomizerFn, any); result = _({a: {b: 2}}).clone(testCloneCustomizerFn); - result = _({a: {b: 2}}).clone(testCloneCustomizerFn, any); } -// _.cloneDeep +// _.cloneDeepWith interface TestCloneDeepCustomizerFn { (value: any): any; } var testCloneDeepCustomizerFn: TestCloneDeepCustomizerFn; { let result: number; - result = _.cloneDeep(42); result = _.cloneDeep(42, testCloneDeepCustomizerFn); - result = _.cloneDeep(42, testCloneDeepCustomizerFn, any); - result = _(42).cloneDeep(); result = _(42).cloneDeep(testCloneDeepCustomizerFn); - result = _(42).cloneDeep(testCloneDeepCustomizerFn, any); } { let result: string[]; - result = _.cloneDeep([]); result = _.cloneDeep([], testCloneDeepCustomizerFn); - result = _.cloneDeep([], testCloneDeepCustomizerFn, any); - result = _([]).cloneDeep(); result = _([]).cloneDeep(testCloneDeepCustomizerFn); - result = _([]).cloneDeep(testCloneDeepCustomizerFn, any); } { let result: {a: {b: number;}}; - result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}); result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn); - result = _.cloneDeep<{a: {b: number;}}>({a: {b: 2}}, testCloneDeepCustomizerFn, any); - result = _({a: {b: 2}}).cloneDeep(); result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn); - result = _({a: {b: 2}}).cloneDeep(testCloneDeepCustomizerFn, any); } // _.eq @@ -6366,20 +5620,14 @@ module TestEq { let result: boolean; result = _.eq(any, any); - result = _.eq(any, any, customizer); - result = _.eq(any, any, customizer, any); result = _(any).eq(any); - result = _(any).eq(any, customizer); - result = _(any).eq(any, customizer, any); } { let result: _.LoDashExplicitWrapper; result = _(any).chain().eq(any); - result = _(any).chain().eq(any, customizer); - result = _(any).chain().eq(any, customizer, any); } } @@ -6490,6 +5738,78 @@ module TestIsArray { } } +// _.isArrayLike +module TestIsArrayLike { + { + let value: number|string[]|boolean[]; + + if (_.isArrayLike(value)) { + let result: string[] = value; + } + else { + if (_.isArrayLike(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArrayLike(any); + result = _(1).isArrayLike(); + result = _([]).isArrayLike(); + result = _({}).isArrayLike(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArrayLike(); + result = _([]).chain().isArrayLike(); + result = _({}).chain().isArrayLike(); + } +} + +// _.isArrayLikeObject +module TestIsArrayLikeObject { + { + let value: number|string[]|boolean[]; + + if (_.isArrayLikeObject(value)) { + let result: string[] = value; + } + else { + if (_.isArrayLikeObject(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArrayLikeObject(any); + result = _(1).isArrayLikeObject(); + result = _([]).isArrayLikeObject(); + result = _({}).isArrayLikeObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArrayLikeObject(); + result = _([]).chain().isArrayLikeObject(); + result = _({}).chain().isArrayLikeObject(); + } +} + // _.isBoolean module TestIsBoolean { { @@ -6589,20 +5909,33 @@ module TestIsEqual { let result: boolean; result = _.isEqual(any, any); - result = _.isEqual(any, any, customizer); - result = _.isEqual(any, any, customizer, any); result = _(any).isEqual(any); - result = _(any).isEqual(any, customizer); - result = _(any).isEqual(any, customizer, any); } { let result: _.LoDashExplicitWrapper; result = _(any).chain().isEqual(any); - result = _(any).chain().isEqual(any, customizer); - result = _(any).chain().isEqual(any, customizer, any); + } +} + +// _.isEqualWith +module TestIsEqualWith { + let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + + { + let result: boolean; + + result = _.isEqualWith(any, any, customizer); + + result = _(any).isEqualWith(any, customizer); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(any).chain().isEqualWith(any, customizer); } } @@ -6701,14 +6034,69 @@ module TestIsFunction { } } +// _.isInteger +module TestIsInteger { + { + let result: boolean; + + result = _.isInteger(any); + + result = _(1).isInteger(); + result = _([]).isInteger(); + result = _({}).isInteger(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isInteger(); + result = _([]).chain().isInteger(); + result = _({}).chain().isInteger(); + } +} + +// _.isLength +module TestIsLength { + { + let result: boolean; + + result = _.isLength(any); + + result = _(1).isLength(); + result = _([]).isLength(); + result = _({}).isLength(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isLength(); + result = _([]).chain().isLength(); + result = _({}).chain().isLength(); + } +} + // _.isMatch -var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; -result = _.isMatch({}, {}); -result = _.isMatch({}, {}, testIsMatchCustiomizerFn); -result = _.isMatch({}, {}, testIsMatchCustiomizerFn, {}); -result = _({}).isMatch({}); -result = _({}).isMatch({}, testIsMatchCustiomizerFn); -result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); +module TestIsMatch { + let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; + + let result: boolean; + + result = _.isMatch({}, {}); + result = _({}).isMatch({}); +} + + +// _.isMatchWith +module TestIsMatchWith { + let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; + + let result: boolean; + + result = _.isMatchWith({}, {}, testIsMatchCustiomizerFn); + result = _({}).isMatchWith({}, testIsMatchCustiomizerFn); + +} // _.isNaN module TestIsNaN { @@ -6763,6 +6151,27 @@ module TestIsNative { } } +// _.isNil +module TestIsNil { + { + let result: boolean; + + result = _.isNil(any); + + result = _(1).isNil(); + result = _([]).isNil(); + result = _({}).isNil(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNil(); + result = _([]).chain().isNil(); + result = _({}).chain().isNil(); + } +} + // _.isNull module TestIsNull { { @@ -6836,6 +6245,26 @@ module TestIsObject { } } +// _.isObjectLike +module TestIsObjectLike { + { + let result: boolean; + + result = _.isObjectLike(any); + result = _(1).isObjectLike(); + result = _([]).isObjectLike(); + result = _({}).isObjectLike(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isObjectLike(); + result = _([]).chain().isObjectLike(); + result = _({}).chain().isObjectLike(); + } +} + // _.isPlainObject module TestIsPlainObject { { @@ -6887,6 +6316,27 @@ module TestIsRegExp { } } +// _.isSafeInteger +module TestIsSafeInteger { + { + let result: boolean; + + result = _.isSafeInteger(any); + + result = _(1).isSafeInteger(); + result = _([]).isSafeInteger(); + result = _({}).isSafeInteger(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isSafeInteger(); + result = _([]).chain().isSafeInteger(); + result = _({}).chain().isSafeInteger(); + } +} + // _.isString module TestIsString { { @@ -6918,6 +6368,27 @@ module TestIsString { } } +// _.isSymbol +module TestIsSymbol { + { + let result: boolean; + + result = _.isSymbol(any); + + result = _(1).isSymbol(); + result = _([]).isSymbol(); + result = _({}).isSymbol(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isSymbol(); + result = _([]).chain().isSymbol(); + result = _({}).chain().isSymbol(); + } +} + // _.isTypedArray module TestIsTypedArray { { @@ -7052,21 +6523,119 @@ module TestToArray { // _.toPlainObject module TestToPlainObject { - let result: TResult; - result = _.toPlainObject(); - result = _.toPlainObject(true); - result = _.toPlainObject(1); - result = _.toPlainObject('a'); - result = _.toPlainObject([]); - result = _.toPlainObject({}); + { + let result: TResult; + result = _.toPlainObject(); + result = _.toPlainObject(true); + result = _.toPlainObject(1); + result = _.toPlainObject('a'); + result = _.toPlainObject([]); + result = _.toPlainObject({}); + } - result = _(true).toPlainObject().value(); - result = _(1).toPlainObject().value(); - result = _('a').toPlainObject().value(); - result = _([1]).toPlainObject().value(); - result = _([]).toPlainObject().value(); - result = _({}).toPlainObject().value(); + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(true).toPlainObject(); + result = _(1).toPlainObject(); + result = _('a').toPlainObject(); + result = _([1]).toPlainObject(); + result = _([]).toPlainObject(); + result = _({}).toPlainObject(); + } +} + +// _.toInteger +module TestToInteger { + { + let result: number; + result = _.toInteger(true); + result = _.toInteger(1); + result = _.toInteger('a'); + result = _.toInteger([]); + result = _.toInteger({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toInteger(); + result = _(1).toInteger(); + result = _('a').toInteger(); + result = _([1]).toInteger(); + result = _([]).toInteger(); + result = _({}).toInteger(); + } +} + +// _.toLength +module TestToLength { + { + let result: number; + result = _.toLength(true); + result = _.toLength(1); + result = _.toLength('a'); + result = _.toLength([]); + result = _.toLength({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toLength(); + result = _(1).toLength(); + result = _('a').toLength(); + result = _([1]).toLength(); + result = _([]).toLength(); + result = _({}).toLength(); + } +} + +// _.toNumber +module TestToNumber { + { + let result: number; + result = _.toNumber(true); + result = _.toNumber(1); + result = _.toNumber('a'); + result = _.toNumber([]); + result = _.toNumber({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toNumber(); + result = _(1).toNumber(); + result = _('a').toNumber(); + result = _([1]).toNumber(); + result = _([]).toNumber(); + result = _({}).toNumber(); + } +} + +// _.toSafeInteger +module TestToSafeInteger { + { + let result: number; + result = _.toSafeInteger(true); + result = _.toSafeInteger(1); + result = _.toSafeInteger('a'); + result = _.toSafeInteger([]); + result = _.toSafeInteger({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toSafeInteger(); + result = _(1).toSafeInteger(); + result = _('a').toSafeInteger(); + result = _([1]).toSafeInteger(); + result = _([]).toSafeInteger(); + result = _({}).toSafeInteger(); + } } /******** @@ -7136,52 +6705,18 @@ module TestFloor { module TestMax { let array: number[]; let list: _.List; - let dictionary: _.Dictionary; - - let listIterator: (value: number, index: number, collection: _.List) => number; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; let result: number; result = _.max(array); - result = _.max(array, listIterator); - result = _.max(array, listIterator, any); - result = _.max(array, ''); - result = _.max<{a: number}, number>(array, {a: 42}); - result = _.max(list); - result = _.max(list, listIterator); - result = _.max(list, listIterator, any); - result = _.max(list, ''); - result = _.max<{a: number}, number>(list, {a: 42}); - - result = _.max(dictionary); - result = _.max(dictionary, dictionaryIterator); - result = _.max(dictionary, dictionaryIterator, any); - result = _.max(dictionary, ''); - result = _.max<{a: number}, number>(dictionary, {a: 42}); result = _(array).max(); - result = _(array).max(listIterator); - result = _(array).max(listIterator, any); - result = _(array).max(''); - result = _(array).max<{a: number}>({a: 42}); - result = _(list).max(); - result = _(list).max(listIterator); - result = _(list).max(listIterator, any); - result = _(list).max(''); - result = _(list).max<{a: number}, number>({a: 42}); - - result = _(dictionary).max(); - result = _(dictionary).max(dictionaryIterator); - result = _(dictionary).max(dictionaryIterator, any); - result = _(dictionary).max(''); - result = _(dictionary).max<{a: number}, number>({a: 42}); } -// _.min -module TestMin { +// _.maxBy +module TestMaxBy { let array: number[]; let list: _.List; let dictionary: _.Dictionary; @@ -7191,41 +6726,104 @@ module TestMin { let result: number; + result = _.maxBy(array); + result = _.maxBy(array, listIterator); + result = _.maxBy(array, ''); + result = _.maxBy<{a: number}, number>(array, {a: 42}); + + result = _.maxBy(list); + result = _.maxBy(list, listIterator); + result = _.maxBy(list, ''); + result = _.maxBy<{a: number}, number>(list, {a: 42}); + + result = _.maxBy(dictionary); + result = _.maxBy(dictionary, dictionaryIterator); + result = _.maxBy(dictionary, ''); + result = _.maxBy<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).maxBy(); + result = _(array).maxBy(listIterator); + result = _(array).maxBy(''); + result = _(array).maxBy<{a: number}>({a: 42}); + + result = _(list).maxBy(); + result = _(list).maxBy(listIterator); + result = _(list).maxBy(''); + result = _(list).maxBy<{a: number}, number>({a: 42}); + + result = _(dictionary).maxBy(); + result = _(dictionary).maxBy(dictionaryIterator); + result = _(dictionary).maxBy(''); + result = _(dictionary).maxBy<{a: number}, number>({a: 42}); +} + +// _.mean +module TestMean { + let array: number[]; + + let result: number; + + result = _.mean(array); + + result = _(array).mean(); + +} + +// _.min +module TestMin { + let array: number[]; + let list: _.List; + + let result: number; + result = _.min(array); - result = _.min(array, listIterator); - result = _.min(array, listIterator, any); - result = _.min(array, ''); - result = _.min<{a: number}, number>(array, {a: 42}); - result = _.min(list); - result = _.min(list, listIterator); - result = _.min(list, listIterator, any); - result = _.min(list, ''); - result = _.min<{a: number}, number>(list, {a: 42}); - - result = _.min(dictionary); - result = _.min(dictionary, dictionaryIterator); - result = _.min(dictionary, dictionaryIterator, any); - result = _.min(dictionary, ''); - result = _.min<{a: number}, number>(dictionary, {a: 42}); result = _(array).min(); - result = _(array).min(listIterator); - result = _(array).min(listIterator, any); - result = _(array).min(''); - result = _(array).min<{a: number}>({a: 42}); - result = _(list).min(); - result = _(list).min(listIterator); - result = _(list).min(listIterator, any); - result = _(list).min(''); - result = _(list).min<{a: number}, number>({a: 42}); - result = _(dictionary).min(); - result = _(dictionary).min(dictionaryIterator); - result = _(dictionary).min(dictionaryIterator, any); - result = _(dictionary).min(''); - result = _(dictionary).min<{a: number}, number>({a: 42}); +} + +// _.minBy +module TestMinBy { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + let result: number; + + result = _.minBy(array); + result = _.minBy(array, listIterator); + result = _.minBy(array, ''); + result = _.minBy<{a: number}, number>(array, {a: 42}); + + result = _.minBy(list); + result = _.minBy(list, listIterator); + result = _.minBy(list, ''); + result = _.minBy<{a: number}, number>(list, {a: 42}); + + result = _.minBy(dictionary); + result = _.minBy(dictionary, dictionaryIterator); + result = _.minBy(dictionary, ''); + result = _.minBy<{a: number}, number>(dictionary, {a: 42}); + + result = _(array).minBy(); + result = _(array).minBy(listIterator); + result = _(array).minBy(''); + result = _(array).minBy<{a: number}>({a: 42}); + + result = _(list).minBy(); + result = _(list).minBy(listIterator); + result = _(list).minBy(''); + result = _(list).minBy<{a: number}, number>({a: 42}); + + result = _(dictionary).minBy(); + result = _(dictionary).minBy(dictionaryIterator); + result = _(dictionary).minBy(''); + result = _(dictionary).minBy<{a: number}, number>({a: 42}); } // _.round @@ -7262,58 +6860,74 @@ module TestSum { result = _.sum(array); result = _.sum(array); - result = _.sum(array, listIterator); - result = _.sum(array, listIterator, any); - result = _.sum(array, ''); - result = _.sum(list); result = _.sum(list); - result = _.sum(list, listIterator); - result = _.sum(list, listIterator, any); - result = _.sum(list, ''); - - result = _.sum(dictionary); - result = _.sum(dictionary); - result = _.sum(dictionary, dictionaryIterator); - result = _.sum(dictionary, dictionaryIterator, any); - result = _.sum(dictionary, ''); result = _(array).sum(); - result = _(array).sum(listIterator); - result = _(array).sum(listIterator, any); - result = _(array).sum(''); - result = _(list).sum(); - result = _(list).sum(listIterator); - result = _(list).sum(listIterator, any); - result = _(list).sum(''); result = _(dictionary).sum(); - result = _(dictionary).sum(dictionaryIterator); - result = _(dictionary).sum(dictionaryIterator, any); - result = _(dictionary).sum(''); } { let result: _.LoDashExplicitWrapper; result = _(array).chain().sum(); - result = _(array).chain().sum(listIterator); - result = _(array).chain().sum(listIterator, any); - result = _(array).chain().sum(''); - result = _(list).chain().sum(); - result = _(list).chain().sum(listIterator); - result = _(list).chain().sum(listIterator, any); - result = _(list).chain().sum(''); result = _(dictionary).chain().sum(); - result = _(dictionary).chain().sum(dictionaryIterator); - result = _(dictionary).chain().sum(dictionaryIterator, any); - result = _(dictionary).chain().sum(''); + } +} + +// _.sumBy +module TestSumBy { + let array: number[]; + let list: _.List; + let dictionary: _.Dictionary; + + let listIterator: (value: number, index: number, collection: _.List) => number; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + + { + let result: number; + + result = _.sumBy(array); + result = _.sumBy(array, listIterator); + result = _.sumBy(array, ''); + + + result = _.sumBy(list); + result = _.sumBy(list, listIterator); + result = _.sumBy(list, ''); + + result = _.sumBy(dictionary); + result = _.sumBy(dictionary, dictionaryIterator); + result = _.sumBy(dictionary, ''); + + result = _(array).sumBy(listIterator); + result = _(array).sumBy(''); + + result = _(list).sumBy(listIterator); + result = _(list).sumBy(''); + + result = _(dictionary).sumBy(dictionaryIterator); + result = _(dictionary).sumBy(''); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().sumBy(listIterator); + result = _(array).chain().sumBy(''); + + result = _(list).chain().sumBy(listIterator); + result = _(list).chain().sumBy(''); + + result = _(dictionary).chain().sumBy(dictionaryIterator); + result = _(dictionary).chain().sumBy(''); } } @@ -7321,6 +6935,40 @@ module TestSum { * Number * **********/ + // _.subtract + module subtract { + { + let result: number; + + result = _.subtract(3, 2); + + result = _(3).subtract(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(3).chain().subtract(2); + } + } + +// _.clamp +module TestInClamp { + { + let result: number; + + result = _.clamp(3, 2, 4); + + result = _(3).clamp(2, 4); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(3).chain().clamp(2, 4); + } +} + // _.inRange module TestInRange { { @@ -7403,40 +7051,30 @@ module TestAssign { let result: {a: number}; result = _.assign(obj, s1); - result = _.assign(obj, s1, customizer); - result = _.assign(obj, s1, customizer, any); } { let result: {a: number, b: number}; result = _.assign(obj, s1, s2); - result = _.assign(obj, s1, s2, customizer); - result = _.assign(obj, s1, s2, customizer, any); } { let result: {a: number, b: number, c: number}; result = _.assign(obj, s1, s2, s3); - result = _.assign(obj, s1, s2, s3, customizer); - result = _.assign(obj, s1, s2, s3, customizer, any); } { let result: {a: number, b: number, c: number, d: number}; result = _.assign(obj, s1, s2, s3, s4); - result = _.assign(obj, s1, s2, s3, s4, customizer); - result = _.assign(obj, s1, s2, s3, s4, customizer, any); } { let result: {a: number, b: number, c: number, d: number, e: number}; result = _.assign(obj, s1, s2, s3, s4, s5); - result = _.assign(obj, s1, s2, s3, s4, s5, customizer); - result = _.assign(obj, s1, s2, s3, s4, s5, customizer, any); } { @@ -7449,40 +7087,30 @@ module TestAssign { let result: _.LoDashImplicitObjectWrapper<{a: number}>; result = _(obj).assign(s1); - result = _(obj).assign(s1, customizer); - result = _(obj).assign(s1, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; result = _(obj).assign(s1, s2); - result = _(obj).assign(s1, s2, customizer); - result = _(obj).assign(s1, s2, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; result = _(obj).assign(s1, s2, s3); - result = _(obj).assign(s1, s2, s3, customizer); - result = _(obj).assign(s1, s2, s3, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; result = _(obj).assign(s1, s2, s3, s4); - result = _(obj).assign(s1, s2, s3, s4, customizer); - result = _(obj).assign(s1, s2, s3, s4, customizer, any); } { let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); - result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); - result = _(obj).assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); } { @@ -7495,40 +7123,381 @@ module TestAssign { let result: _.LoDashExplicitObjectWrapper<{a: number}>; result = _(obj).chain().assign(s1); - result = _(obj).chain().assign(s1, customizer); - result = _(obj).chain().assign(s1, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; result = _(obj).chain().assign(s1, s2); - result = _(obj).chain().assign(s1, s2, customizer); - result = _(obj).chain().assign(s1, s2, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; result = _(obj).chain().assign(s1, s2, s3); - result = _(obj).chain().assign(s1, s2, s3, customizer); - result = _(obj).chain().assign(s1, s2, s3, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; result = _(obj).chain().assign(s1, s2, s3, s4); - result = _(obj).chain().assign(s1, s2, s3, s4, customizer); - result = _(obj).chain().assign(s1, s2, s3, s4, customizer, any); } { let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); - result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); - result = _(obj).chain().assign<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer, any); + } +} + +// _.assignWith +module TestAssignWith { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assignWith(obj); + } + + { + let result: {a: number}; + result = _.assignWith(obj, s1, customizer); + } + + { + let result: {a: number, b: number}; + result = _.assignWith(obj, s1, s2, customizer); + } + + { + let result: {a: number, b: number, c: number}; + result = _.assignWith(obj, s1, s2, s3, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number}; + result = _.assignWith(obj, s1, s2, s3, s4, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + result = _.assignWith(obj, s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assignWith(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + result = _(obj).assignWith(s1, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).assignWith(s1, s2, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).assignWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).assignWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).assignWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assignWith(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + result = _(obj).chain().assignWith(s1, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).chain().assignWith(s1, s2, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).chain().assignWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).chain().assignWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).chain().assignWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + } +} + +// _.assignIn +module TestAssignIn { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assignIn(obj); + } + + { + let result: {a: number}; + + result = _.assignIn(obj, s1); + } + + { + let result: {a: number, b: number}; + + result = _.assignIn(obj, s1, s2); + } + + { + let result: {a: number, b: number, c: number}; + + result = _.assignIn(obj, s1, s2, s3); + } + + { + let result: {a: number, b: number, c: number, d: number}; + + result = _.assignIn(obj, s1, s2, s3, s4); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + + result = _.assignIn(obj, s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assignIn(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + + result = _(obj).assignIn(s1); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).assignIn(s1, s2); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).assignIn(s1, s2, s3); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).assignIn(s1, s2, s3, s4); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).assignIn<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assignIn(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + + result = _(obj).chain().assignIn(s1); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + + result = _(obj).chain().assignIn(s1, s2); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + + result = _(obj).chain().assignIn(s1, s2, s3); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + + result = _(obj).chain().assignIn(s1, s2, s3, s4); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + + result = _(obj).chain().assignIn<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5); + } +} + +// _.assignInWith +module TestAssignInWith { + interface Obj {a: string}; + interface S1 {a: number}; + interface S2 {b: number}; + interface S3 {c: number}; + interface S4 {d: number}; + interface S5 {e: number}; + + let obj: Obj; + let s1: S1; + let s2: S2; + let s3: S3; + let s4: S4; + let s5: S5; + + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + + { + let result: Obj; + + result = _.assignInWith(obj); + } + + { + let result: {a: number}; + result = _.assignInWith(obj, s1, customizer); + } + + { + let result: {a: number, b: number}; + result = _.assignInWith(obj, s1, s2, customizer); + } + + { + let result: {a: number, b: number, c: number}; + result = _.assignInWith(obj, s1, s2, s3, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number}; + result = _.assignInWith(obj, s1, s2, s3, s4, customizer); + } + + { + let result: {a: number, b: number, c: number, d: number, e: number}; + result = _.assignInWith(obj, s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(obj).assignInWith(); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number}>; + result = _(obj).assignInWith(s1, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).assignInWith(s1, s2, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).assignInWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).assignInWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashImplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).assignInWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(obj).chain().assignInWith(); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number}>; + result = _(obj).chain().assignInWith(s1, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number}>; + result = _(obj).chain().assignInWith(s1, s2, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number}>; + result = _(obj).chain().assignInWith(s1, s2, s3, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number}>; + result = _(obj).chain().assignInWith(s1, s2, s3, s4, customizer); + } + + { + let result: _.LoDashExplicitObjectWrapper<{a: number, b: number, c: number, d: number, e: number}>; + result = _(obj).chain().assignInWith<{a: number, b: number, c: number, d: number, e: number}>(s1, s2, s3, s4, s5, customizer); } } @@ -8183,6 +8152,31 @@ module TestFunctions { } } +// _.functionsIn +module TestFunctionsIn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: string[]; + + result = _.functionsIn(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).functionsIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().functionsIn(); + } +} + // _.get result = _.get({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c'); @@ -8228,6 +8222,36 @@ module TestHas { } } +// _.hasIn +module TestHasIn { + type SampleObject = {a: number; b: string; c: boolean;}; + + let object: SampleObject; + + { + let result: boolean; + + result = _.hasIn(object, ''); + result = _.hasIn(object, 42); + result = _.hasIn(object, true); + result = _.hasIn(object, ['', 42, true]); + + result = _(object).hasIn(''); + result = _(object).hasIn(42); + result = _(object).hasIn(true); + result = _(object).hasIn(['', 42, true]); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(object).chain().hasIn(''); + result = _(object).chain().hasIn(42); + result = _(object).chain().hasIn(true); + result = _(object).chain().hasIn(['', 42, true]); + } +} + // _.invert module TestInvert { { @@ -8397,32 +8421,19 @@ module TestMerge { type ExpectedResult = { a: number, b: string }; let result: ExpectedResult; - let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; - // Test for basic merging result = _.merge(initialValue, mergingValue); - result = _.merge(initialValue, mergingValue, customizer); - result = _.merge(initialValue, mergingValue, customizer, any); result = _.merge(initialValue, {}, mergingValue); - result = _.merge(initialValue, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, mergingValue, customizer, any); result = _.merge(initialValue, {}, {}, mergingValue); - result = _.merge(initialValue, {}, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, {}, mergingValue, customizer, any); result = _.merge(initialValue, {}, {}, {}, mergingValue); - result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, {}, {}, mergingValue, customizer, any); // Once we get to the varargs version, you have to specify the result explicitly result = _.merge(initialValue, {}, {}, {}, {}, mergingValue); - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer); - result = _.merge(initialValue, {}, {}, {}, {}, mergingValue, customizer, any); - // Test for multiple combinations of many types type ComplicatedExpectedType = { a: number, b: string, c: {}, d: number[], e: boolean }; @@ -8444,25 +8455,15 @@ module TestMerge { // Tests for basic chaining with merge result = _(initialValue).merge(mergingValue).value(); - result = _(initialValue).merge(mergingValue, customizer).value(); - result = _(initialValue).merge(mergingValue, customizer, any).value(); result = _(initialValue).merge({}, mergingValue).value(); - result = _(initialValue).merge({}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, mergingValue, customizer, any).value(); result = _(initialValue).merge({}, {}, mergingValue).value(); - result = _(initialValue).merge({}, {}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, {}, mergingValue, customizer, any).value(); result = _(initialValue).merge({}, {}, {}, mergingValue).value(); - result = _(initialValue).merge({}, {}, {}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, {}, {}, mergingValue, customizer, any).value(); // Once we get to the varargs version, you have to specify the result explicitly result = _(initialValue).merge({}, {}, {}, {}, mergingValue).value(); - result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer).value(); - result = _(initialValue).merge({}, {}, {}, {}, mergingValue, customizer, any).value(); // Test complex multiple combinations with chaining @@ -8478,31 +8479,58 @@ module TestMerge { { a: [1] }, { a: true }).value(); + { + let result: _.LoDashExplicitObjectWrapper; + // result = _(initialValue).chain().merge(mergingValue); + // result = _(initialValue).chain().merge({}, mergingValue); + // result = _(initialValue).chain().merge({}, {}, mergingValue); + // result = _(initialValue).chain().merge({}, {}, {}, mergingValue); + // result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + //result = _({ a: 1 }).chain().merge({ b: "string" }, { c: {} }, { d: [1] }, { e: true }); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + //result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); + } } -// _.methods -module TestFunctions { - type SampleObject = {a: number; b: string; c: boolean;}; +// _.mergeWith +module TestMergeWith { + type InitialValue = { a : number }; + type MergingValue = { b : string }; - let object: SampleObject; + var initialValue = { a : 1 }; + var mergingValue = { b : "hi" }; - { - let result: string[]; + type ExpectedResult = { a: number, b: string }; + let result: ExpectedResult; - result = _.methods(object); - } + let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; - { - let result: _.LoDashImplicitArrayWrapper; + // Test for basic merging + result = _.mergeWith(initialValue, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, {}, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, {}, {}, mergingValue, customizer); - result = _(object).methods(); - } + // Once we get to the varargs version, you have to specify the result explicitl + result = _.mergeWith(initialValue, {}, {}, {}, {}, mergingValue, customizer); - { - let result: _.LoDashExplicitArrayWrapper; + // Tests for basic chaining with mergeWith + result = _(initialValue).mergeWith(mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, {}, mergingValue, customizer).value(); + result = _(initialValue).mergeWith({}, {}, {}, mergingValue, customizer).value(); - result = _(object).chain().methods(); - } + // Once we get to the varargs version, you have to specify the result explicitl + result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); } // _.omit @@ -8516,8 +8544,6 @@ module TestOmit { result = _.omit({}, 0, 'a'); result = _.omit({}, true, 0, 'a'); result = _.omit({}, ['b', 1, false], true, 0, 'a'); - result = _.omit({}, predicate); - result = _.omit({}, predicate, any); } { @@ -8527,8 +8553,6 @@ module TestOmit { result = _({}).omit(0, 'a'); result = _({}).omit(true, 0, 'a'); result = _({}).omit(['b', 1, false], true, 0, 'a'); - result = _({}).omit(predicate); - result = _({}).omit(predicate, any); } { @@ -8538,49 +8562,70 @@ module TestOmit { result = _({}).chain().omit(0, 'a'); result = _({}).chain().omit(true, 0, 'a'); result = _({}).chain().omit(['b', 1, false], true, 0, 'a'); - result = _({}).chain().omit(predicate); - result = _({}).chain().omit(predicate, any); } } -// _.pairs -module TestPairs { +// _.omitBy +module TestOmitBy { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.omitBy({}, predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).omitBy(predicate); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().omitBy(predicate); + } +} + +// _.toPairs +module TestToPairs { let object: _.Dictionary; { let result: any[][]; - result = _.pairs<_.Dictionary>(object); + result = _.toPairs<_.Dictionary>(object); } { let result: string[][]; - result = _.pairs<_.Dictionary, string>(object); + result = _.toPairs<_.Dictionary, string>(object); } { let result: _.LoDashImplicitArrayWrapper; - result = _(object).pairs(); + result = _(object).toPairs(); } { let result: _.LoDashImplicitArrayWrapper; - result = _(object).pairs(); + result = _(object).toPairs(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(object).chain().pairs(); + result = _(object).chain().toPairs(); } { let result: _.LoDashExplicitArrayWrapper; - result = _(object).chain().pairs(); + result = _(object).chain().toPairs(); } } @@ -8595,8 +8640,6 @@ module TestPick { result = _.pick({}, 0, 'a'); result = _.pick({}, true, 0, 'a'); result = _.pick({}, ['b', 1, false], true, 0, 'a'); - result = _.pick({}, predicate); - result = _.pick({}, predicate, any); } { @@ -8606,8 +8649,6 @@ module TestPick { result = _({}).pick(0, 'a'); result = _({}).pick(true, 0, 'a'); result = _({}).pick(['b', 1, false], true, 0, 'a'); - result = _({}).pick(predicate); - result = _({}).pick(predicate, any); } { @@ -8617,8 +8658,29 @@ module TestPick { result = _({}).chain().pick(0, 'a'); result = _({}).chain().pick(true, 0, 'a'); result = _({}).chain().pick(['b', 1, false], true, 0, 'a'); - result = _({}).chain().pick(predicate); - result = _({}).chain().pick(predicate, any); + } +} + +// _.pickBy +module TestPickBy { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.pickBy({}, predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).pickBy(predicate); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().pickBy(predicate); } } @@ -8903,6 +8965,38 @@ module TestKebabCase { } } +// _.lowerCase +module TestLowerCase { + { + let result: string; + + result = _.lowerCase('Foo Bar'); + result = _('Foo Bar').lowerCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().lowerCase(); + } +} + +// _.lowerFirst +module TestLowerFirst { + { + let result: string; + + result = _.lowerFirst('Foo Bar'); + result = _('Foo Bar').lowerFirst(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Foo Bar').chain().lowerFirst(); + } +} + // _.pad module TestPad { { @@ -8926,49 +9020,49 @@ module TestPad { } } -// _.padLeft -module TestPadLeft { +// _.padStart +module TestPadStart { { let result: string; - result = _.padLeft('abc'); - result = _.padLeft('abc', 6); - result = _.padLeft('abc', 6, '_-'); + result = _.padStart('abc'); + result = _.padStart('abc', 6); + result = _.padStart('abc', 6, '_-'); - result = _('abc').padLeft(); - result = _('abc').padLeft(6); - result = _('abc').padLeft(6, '_-'); + result = _('abc').padStart(); + result = _('abc').padStart(6); + result = _('abc').padStart(6, '_-'); } { let result: _.LoDashExplicitWrapper; - result = _('abc').chain().padLeft(); - result = _('abc').chain().padLeft(6); - result = _('abc').chain().padLeft(6, '_-'); + result = _('abc').chain().padStart(); + result = _('abc').chain().padStart(6); + result = _('abc').chain().padStart(6, '_-'); } } -// _.padRight -module TestPadRight { +// _.padEnd +module TestPadEnd { { let result: string; - result = _.padRight('abc'); - result = _.padRight('abc', 6); - result = _.padRight('abc', 6, '_-'); + result = _.padEnd('abc'); + result = _.padEnd('abc', 6); + result = _.padEnd('abc', 6, '_-'); - result = _('abc').padRight(); - result = _('abc').padRight(6); - result = _('abc').padRight(6, '_-'); + result = _('abc').padEnd(); + result = _('abc').padEnd(6); + result = _('abc').padEnd(6, '_-'); } { let result: _.LoDashExplicitWrapper; - result = _('abc').chain().padRight(); - result = _('abc').chain().padRight(6); - result = _('abc').chain().padRight(6, '_-'); + result = _('abc').chain().padEnd(); + result = _('abc').chain().padEnd(6); + result = _('abc').chain().padEnd(6, '_-'); } } @@ -9098,6 +9192,38 @@ module TestTemplate { } } +// _.toLower +module TestToLower { + { + let result: string; + + result = _.toLower('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').toLower(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().toLower(); + } +} + +// _.toUpper +module TestToUpper { + { + let result: string; + + result = _.toUpper('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').toUpper(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().toUpper(); + } +} + // _.trim module TestTrim { { @@ -9119,75 +9245,106 @@ module TestTrim { } } -// _.trimLeft -module TestTrimLeft { +// _.trimStart +module TestTrimStart { { let result: string; - result = _.trimLeft(); - result = _.trimLeft(' abc '); - result = _.trimLeft('-_-abc-_-', '_-'); + result = _.trimStart(); + result = _.trimStart(' abc '); + result = _.trimStart('-_-abc-_-', '_-'); - result = _('-_-abc-_-').trimLeft(); - result = _('-_-abc-_-').trimLeft('_-'); + result = _('-_-abc-_-').trimStart(); + result = _('-_-abc-_-').trimStart('_-'); } { let result: _.LoDashExplicitWrapper; - result = _('-_-abc-_-').chain().trimLeft(); - result = _('-_-abc-_-').chain().trimLeft('_-'); + result = _('-_-abc-_-').chain().trimStart(); + result = _('-_-abc-_-').chain().trimStart('_-'); } } -// _.trimRight - -module TestTrimRight { +// _.trimEnd +module TestTrimEnd { { let result: string; - result = _.trimRight(); - result = _.trimRight(' abc '); - result = _.trimRight('-_-abc-_-', '_-'); + result = _.trimEnd(); + result = _.trimEnd(' abc '); + result = _.trimEnd('-_-abc-_-', '_-'); - result = _('-_-abc-_-').trimRight(); - result = _('-_-abc-_-').trimRight('_-'); + result = _('-_-abc-_-').trimEnd(); + result = _('-_-abc-_-').trimEnd('_-'); } { let result: _.LoDashExplicitWrapper; - result = _('-_-abc-_-').chain().trimRight(); - result = _('-_-abc-_-').chain().trimRight('_-'); + result = _('-_-abc-_-').chain().trimEnd(); + result = _('-_-abc-_-').chain().trimEnd('_-'); } } -// _.trunc -module TestTrunc { +// _.truncate +module Testtruncate { { let result: string; - result = _.trunc('hi-diddly-ho there, neighborino'); - result = _.trunc('hi-diddly-ho there, neighborino', 24); - result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); - result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); - result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); + result = _.truncate('hi-diddly-ho there, neighborino'); + result = _.truncate('hi-diddly-ho there, neighborino', 24); + result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); + result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); + result = _.truncate('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); - result = _('hi-diddly-ho there, neighborino').trunc(); - result = _('hi-diddly-ho there, neighborino').trunc(24); - result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' }); - result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ }); - result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' }); + result = _('hi-diddly-ho there, neighborino').truncate(); + result = _('hi-diddly-ho there, neighborino').truncate(24); + result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').truncate({ 'omission': ' […]' }); } { let result: _.LoDashExplicitWrapper; - result = _('hi-diddly-ho there, neighborino').chain().trunc(); - result = _('hi-diddly-ho there, neighborino').chain().trunc(24); - result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': ' ' }); - result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': /,? +/ }); - result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'omission': ' […]' }); + result = _('hi-diddly-ho there, neighborino').chain().truncate(); + result = _('hi-diddly-ho there, neighborino').chain().truncate(24); + result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'omission': ' […]' }); + } +} + +// _.upperCase +module TestUpperCase { + { + let result: string; + + result = _.upperCase('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').upperCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().upperCase(); + } +} + +// _.upperFirst +module TestUpperFirst { + { + let result: string; + + result = _.upperFirst('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').upperFirst(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().upperFirst(); } } @@ -9249,72 +9406,6 @@ module TestAttempt { } } -// _.callback -module TestCallback { - { - let result: (...args: any[]) => TResult; - - result = _.callback(Function); - result = _.callback(Function, any); - } - - { - let result: (object: any) => TResult; - - result = _.callback(''); - result = _.callback('', any); - } - - { - let result: (object: any) => boolean; - - result = _.callback({}); - result = _.callback({}, any); - } - - { - let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; - - result = _(Function).callback(); - result = _(Function).callback(any); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; - - result = _('').callback(); - result = _('').callback(any); - } - - { - let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).callback(); - result = _({}).callback(any); - } - - { - let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; - - result = _(Function).chain().callback(); - result = _(Function).chain().callback(any); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; - - result = _('').chain().callback(); - result = _('').chain().callback(any); - } - - { - let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; - - result = _({}).chain().callback(); - result = _({}).chain().callback(any); - } -} - // _.constant module TestConstant { { @@ -9826,6 +9917,33 @@ module TestRange { } } +// _.rangeRight +module TestRangeRight { + { + let result: number[]; + + result = _.rangeRight(10); + result = _.rangeRight(1, 11); + result = _.rangeRight(0, 30, 5); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(10).rangeRight(); + result = _(1).rangeRight(11); + result = _(0).rangeRight(30, 5); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(10).chain().rangeRight(); + result = _(1).chain().rangeRight(11); + result = _(0).chain().rangeRight(30, 5); + } +} + // _.runInContext { let result: typeof _; @@ -9878,6 +9996,29 @@ module TestTimes { } } +// _.toPath +module TestToPath { + { + let result: string[]; + result = _.toPath(true); + result = _.toPath(1); + result = _.toPath('a'); + result = _.toPath(["a"]); + result = _.toPath({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toPath(); + result = _(1).toPath(); + result = _('a').toPath(); + result = _([1]).toPath(); + result = _(["a"]).toPath(); + result = _({}).toPath(); + } +} + // _.uniqueId module TestUniqueId { { @@ -9897,7 +10038,6 @@ module TestUniqueId { } result = _.VERSION; -result = <_.Support>_.support; result = <_.TemplateSettings>_.templateSettings; // _.partial & _.partialRight diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5f0c07777..f9249d16b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3,6 +3,239 @@ // Definitions by: Brian Zengel , Ilya Mochalov // Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** +### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) + +#### TODO: +removed: +- [x] Removed _.support +- [x] Removed _.findWhere in favor of _.find with iteratee shorthand +- [x] Removed _.where in favor of _.filter with iteratee shorthand +- [x] Removed _.pluck in favor of _.map with iteratee shorthand + +renamed: +- [x] Renamed _.first to _.head +- [x] Renamed _.indexBy to _.keyBy +- [x] Renamed _.invoke to _.invokeMap +- [x] Renamed _.overArgs to _.overArgs +- [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd +- [x] Renamed _.pairs to _.toPairs +- [x] Renamed _.rest to _.tail +- [x] Renamed _.restParam to _.rest +- [x] Renamed _.sortByOrder to _.orderBy +- [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd +- [x] Renamed _.trunc to _.truncate + +split: +- [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf +- [x] Split _.max & _.min into _.maxBy & _.minBy +- [x] Split _.omit & _.pick into _.omitBy & _.pickBy +- [x] Split _.sample into _.sampleSize +- [x] Split _.sortedIndex into _.sortedIndexBy +- [x] Split _.sortedLastIndex into _.sortedLastIndexBy +- [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy + +changes: +- [x] Absorbed _.sortByAll into _.sortBy +- [x] Changed the category of _.at to “Object” +- [x] Changed the category of _.bindAll to “Utility” +- [x] Made _.capitalize uppercase the first character & lowercase the rest +- [x] Made _.functions return only own method names + + +added 23 array methods: +- [x] _.concat +- [x] _.differenceBy +- [x] _.differenceWith +- [x] _.flatMap +- [x] _.fromPairs +- [x] _.intersectionBy +- [x] _.intersectionWith +- [x] _.join +- [x] _.pullAll +- [x] _.pullAllBy +- [x] _.reverse +- [x] _.sortedIndexBy +- [x] _.sortedIndexOf +- [x] _.sortedLastIndexBy +- [x] _.sortedLastIndexOf +- [x] _.sortedUniq +- [x] _.sortedUniqBy +- [x] _.unionBy +- [x] _.unionWith +- [x] _.uniqBy +- [x] _.uniqWith +- [x] _.xorBy +- [x] _.xorWith + +added 18 lang methods: +- [x] _.cloneDeepWith +- [x] _.cloneWith +- [x] _.eq +- [x] _.isArrayLike +- [x] _.isArrayLikeObject +- [x] _.isEqualWith +- [x] _.isInteger +- [x] _.isLength +- [x] _.isMatchWith +- [x] _.isNil +- [x] _.isObjectLike +- [x] _.isSafeInteger +- [x] _.isSymbol +- [x] _.toInteger +- [x] _.toLength +- [x] _.toNumber +- [x] _.toSafeInteger +- [x] _.toString + +added 13 object methods: +- [x] _.assignIn +- [x] _.assignInWith +- [x] _.assignWith +- [x] _.functionsIn +- [x] _.hasIn +- [x] _.mergeWith +- [x] _.omitBy +- [x] _.pickBy + + +added 8 string methods: +- [x] _.lowerCase +- [x] _.lowerFirst +- [x] _.upperCase +- [x] _.upperFirst +- [x] _.toLower +- [x] _.toUpper + +added 8 utility methods: +- [x] _.toPath + +added 4 math methods: +- [x] _.maxBy +- [x] _.mean +- [x] _.minBy +- [x] _.sumBy + +added 2 function methods: +- [x] _.flip +- [x] _.unary + +added 2 number methods: +- [x] _.clamp +- [x] _.subtract + +added collection method: +- [x] _.sampleSize + +Added 3 aliases + +- [x] _.first as an alias of _.head + +Removed 17 aliases +- [x] Removed aliase _.all +- [x] Removed aliase _.any +- [x] Removed aliase _.backflow +- [x] Removed aliase _.callback +- [x] Removed aliase _.collect +- [x] Removed aliase _.compose +- [x] Removed aliase _.contains +- [x] Removed aliase _.detect +- [x] Removed aliase _.foldl +- [x] Removed aliase _.foldr +- [x] Removed aliase _.include +- [x] Removed aliase _.inject +- [x] Removed aliase _.methods +- [x] Removed aliase _.object +- [x] Removed aliase _.run +- [x] Removed aliase _.select +- [x] Removed aliase _.unique + +Other changes +- [x] Added support for array buffers to _.isEqual +- [x] Added support for converting iterators to _.toArray +- [x] Added support for deep paths to _.zipObject +- [x] Changed UMD to export to window or self when available regardless of other exports +- [x] Ensured debounce cancel clears args & thisArg references +- [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values +- [x] Ensured _.clone treats generators like functions +- [x] Ensured _.clone produces clones with the source’s [[Prototype]] +- [x] Ensured _.defaults assigns properties that shadow Object.prototype +- [x] Ensured _.defaultsDeep doesn’t merge a string into an array +- [x] Ensured _.defaultsDeep & _.merge don’t modify sources +- [x] Ensured _.defaultsDeep works with circular references +- [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 +- [x] Ensured _.merge doesn’t convert strings to arrays +- [x] Ensured _.merge merges plain-objects onto non plain-objects +- [x] Ensured _#plant resets iterator data of cloned sequences +- [x] Ensured _.random swaps min & max if min is greater than max +- [x] Ensured _.range preserves the sign of start of -0 +- [x] Ensured _.reduce & _.reduceRight use getIteratee in their array branch +- [x] Fixed rounding issue with the precision param of _.floor + +** LATER ** +Misc: +- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence +- [ ] Removed thisArg params from most methods +- [ ] Made “By” methods provide a single param to iteratees +- [ ] Made _.words chainable by default +- [ ] Removed isDeep params from _.clone & _.flatten +- [ ] Removed _.bindAll support for binding all methods when no names are provided +- [ ] Removed func-first param signature from _.before & _.after +- [ ] _.extend as an alias of _.assignIn +- [ ] _.extendWith as an alias of _.assignInWith +- [ ] Added clear method to _.memoize.Cache +- [ ] Added flush method to debounced & throttled functions +- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray +- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [ ] Ensured “Collection” methods treat functions as objects +- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects +- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator +- [ ] Ensured _.isFunction returns true for generator functions +- [ ] Ensured _.merge assigns typed arrays directly +- [ ] Made _(...) an iterator & iterable +- [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0 + +Methods: +- [ ] _.concat +- [ ] _.differenceBy +- [ ] _.differenceWith +- [ ] _.flatMap +- [ ] _.fromPairs +- [ ] _.intersectionBy +- [ ] _.intersectionWith +- [ ] _.join +- [ ] _.pullAll +- [ ] _.pullAllBy +- [ ] _.reverse +- [ ] _.sortedLastIndexOf +- [ ] _.unionBy +- [ ] _.unionWith +- [ ] _.uniqWith +- [ ] _.xorBy +- [ ] _.xorWith +- [ ] _.toString + +- [ ] _.invoke +- [ ] _.setWith +- [ ] _.toPairs +- [ ] _.toPairsIn +- [ ] _.unset + +- [ ] _.replace +- [ ] _.split + +- [ ] _.cond +- [ ] _.conforms +- [ ] _.nthArg +- [ ] _.over +- [ ] _.overEvery +- [ ] _.overSome +- [ ] _.rangeRight + +- [ ] _.next +*/ + declare var _: _.LoDashStatic; declare module _ { @@ -20,7 +253,7 @@ declare module _ { * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, - * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * keyBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip @@ -51,11 +284,6 @@ declare module _ { **/ VERSION: string; - /** - * An object used to flag environments features. - **/ - support: Support; - /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. @@ -128,89 +356,6 @@ declare module _ { set(key: string, value: any): _.Dictionary; } - /** - * An object used to flag environments features. - **/ - interface Support { - /** - * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). - **/ - argsClass: boolean; - - /** - * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). - **/ - argsObject: boolean; - - /** - * Detect if name or message properties of Error.prototype are enumerable by default. - * (IE < 9, Safari < 5.1) - **/ - enumErrorProps: boolean; - - /** - * Detect if prototype properties are enumerable by default. - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 (if the prototype or a property on the - * prototype has been set) incorrectly set the [[Enumerable]] value of a function’s prototype property to true. - **/ - enumPrototypes: boolean; - - /** - * Detect if Function#bind exists and is inferred to be fast (all but V8). - **/ - fastBind: boolean; - - /** - * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera - * mobile browsers & avoided in Windows 8 apps). - **/ - funcDecomp: boolean; - - /** - * Detect if Function#name is supported (all but IE). - **/ - funcNames: boolean; - - /** - * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, - * Safari < 5.1). - **/ - nonEnumArgs: boolean; - - /** - * Detect if properties shadowing those on Object.prototype are non-enumerable. - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made - * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). - **/ - nonEnumShadows: boolean; - - /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). - **/ - ownLast: boolean; - - /** - * Detect if Array#shift and Array#splice augment array-like objects correctly. - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() - * functions that fail to remove the last element, value[0], of array-like objects even - * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility - * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode - * in IE 9. - **/ - spliceObjects: boolean; - - /** - * Detect lack of support for accessing string characters by index. - * - * IE < 8 can't access characters by index and IE 8 can only access characters by index on - * string literals. - **/ - unindexedChars: boolean; - } - interface LoDashWrapperBase { } interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } @@ -334,6 +479,32 @@ declare module _ { compact(): LoDashExplicitArrayWrapper; } + //_.concat DUMMY + interface LoDashStatic { + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + concat(...values: (T[]|List)[]) : T[]; + } + //_.difference interface LoDashStatic { /** @@ -345,8 +516,8 @@ declare module _ { * @return Returns the new array of filtered values. */ difference( - array: T[]|List, - ...values: (T[]|List)[] + array: any[]|List, + ...values: any[] ): T[]; } @@ -378,6 +549,54 @@ declare module _ { difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; } + //_.differenceBy DUMMY + interface LoDashStatic { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([3, 2, 1], [4, 2]); + * // => [3, 1] + */ + differenceBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.differenceWith DUMMY + interface LoDashStatic { + /** + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([3, 2, 1], [4, 2]); + * // => [3, 1] + */ + differenceWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.drop interface LoDashStatic { /** @@ -1113,27 +1332,22 @@ declare module _ { //_.first interface LoDashStatic { - /** - * Gets the first element of array. - * - * @alias _.head - * - * @param array The array to query. - * @return Returns the first element of array. + /** + * @see _.head */ first(array: List): T; } interface LoDashImplicitArrayWrapper { /** - * @see _.first + * @see _.head */ first(): T; } interface LoDashImplicitObjectWrapper { /** - * @see _.first + * @see _.head */ first(): TResult; } @@ -1141,6 +1355,34 @@ declare module _ { interface RecursiveArray extends Array> {} interface ListOfRecursiveArraysOrValues extends List> {} + //_.flatMap DUMMY + interface LoDashStatic { + /** + * Creates an array of flattened values by running each element in `array` + * through `iteratee` and concating its result to the other mapped values. + * The iteratee is invoked with three arguments: (value, index|key, array). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + flatMap( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.flatten interface LoDashStatic { /** @@ -1259,10 +1501,36 @@ declare module _ { flattenDeep(): LoDashExplicitArrayWrapper; } + //_.fromPairs DUMMY + interface LoDashStatic { + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + */ + fromPairs( + array: any[]|List + ): any[]; + } + //_.head interface LoDashStatic { /** - * @see _.first + * Gets the first element of array. + * + * @alias _.first + * + * @param array The array to query. + * @return Returns the first element of array. */ head(array: List): T; } @@ -1284,14 +1552,27 @@ declare module _ { //_.indexOf interface LoDashStatic { /** - * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality - * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted - * providing true for fromIndex performs a faster binary search. + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. * - * @param array The array to search. - * @param value The value to search for. - * @param fromIndex The index to search from or true to perform a binary search on a sorted array. - * @return The index to search from or true to perform a binary search on a sorted array. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 */ indexOf( array: List, @@ -1340,6 +1621,227 @@ declare module _ { ): LoDashExplicitWrapper; } + //_.intersectionBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of shared values. + * @example + * + * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1] + * + * // using the `_.property` iteratee shorthand + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + intersectionBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.intersectionWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + intersectionWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.join DUMMY + interface LoDashStatic { + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + join( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.pullAll DUMMY + interface LoDashStatic { + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ + pullAll( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.pullAllBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to to generate the criterion + * by which uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + pullAllBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.reverse DUMMY + interface LoDashStatic { + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @memberOf _ + * @category Array + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + reverse( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.sortedIndexOf + interface LoDashStatic { + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([1, 1, 2, 2], 2); + * // => 2 + */ + sortedIndexOf( + array: List, + value: T + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: T + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: TValue + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: T + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndexOf + */ + sortedIndexOf( + value: TValue + ): LoDashExplicitWrapper; + } + //_.initial interface LoDashStatic { /** @@ -1515,125 +2017,6 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.object - interface LoDashStatic { - /** - * @see _.zipObject - */ - object( - props: List|List>, - values?: List - ): TResult; - - /** - * @see _.zipObject - */ - object( - props: List|List>, - values?: List - ): TResult; - - /** - * @see _.zipObject - */ - object( - props: List|List>, - values?: List - ): _.Dictionary; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashImplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper; - - /** - * @see _.zipObject - */ - object( - values?: List - ): _.LoDashExplicitObjectWrapper<_.Dictionary>; - } - //_.pull interface LoDashStatic { /** @@ -1879,7 +2262,7 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.rest + //_.tail interface LoDashStatic { /** * Gets all but the first element of array. @@ -1889,35 +2272,35 @@ declare module _ { * @param array The array to query. * @return Returns the slice of array. */ - rest(array: List): T[]; + tail(array: List): T[]; } interface LoDashImplicitArrayWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashImplicitArrayWrapper; + tail(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashImplicitArrayWrapper; + tail(): LoDashImplicitArrayWrapper; } interface LoDashExplicitArrayWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashExplicitArrayWrapper; + tail(): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.rest + * @see _.tail */ - rest(): LoDashExplicitArrayWrapper; + tail(): LoDashExplicitArrayWrapper; } //_.slice @@ -1960,24 +2343,26 @@ declare module _ { //_.sortedIndex interface LoDashStatic { /** - * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. * - * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * _.sortedIndex([30, 50], 40); + * // => 1 * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. - * - * @param array The sorted array to inspect. - * @param value The value to evaluate. - * @param iteratee The function invoked per iteration. - * @return The this binding of iteratee. + * _.sortedIndex([4, 5], 4); + * // => 0 */ sortedIndex( array: List, - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** @@ -1985,9 +2370,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee?: (x: T) => any, - thisArg?: any + value: T ): number; /** @@ -1995,8 +2378,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: string + value: T ): number; /** @@ -2004,8 +2386,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: W + value: T ): number; /** @@ -2013,8 +2394,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: Object + value: T ): number; } @@ -2023,9 +2403,7 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): number; } @@ -2034,25 +2412,14 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: string - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: W + value: T ): number; } @@ -2061,42 +2428,21 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: string + value: T ): number; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: Object + value: T ): number; } @@ -2105,9 +2451,7 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): LoDashExplicitWrapper; } @@ -2116,25 +2460,21 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: string + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee: W + value: T ): LoDashExplicitWrapper; } @@ -2143,40 +2483,245 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T, - iteratee: string + value: T ): LoDashExplicitWrapper; /** * @see _.sortedIndex */ sortedIndex( + value: T + ): LoDashExplicitWrapper; + + + } + + //_.sortedIndexBy + interface LoDashStatic { + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example + * + * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * + * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * // using the `_.property` iteratee shorthand + * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ + sortedIndexBy( + array: List, + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: string, + iteratee: (x: string) => TSort + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: string, + iteratee: (x: string) => TSort + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: (x: T) => any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndexBy + */ + sortedIndexBy( value: T, iteratee: W ): LoDashExplicitWrapper; /** - * @see _.sortedIndex + * @see _.sortedIndexBy */ - sortedIndex( + sortedIndexBy( value: T, iteratee: Object ): LoDashExplicitWrapper; @@ -2185,20 +2730,24 @@ declare module _ { //_.sortedLastIndex interface LoDashStatic { /** - * This method is like _.sortedIndex except that it returns the highest index at which value should be - * inserted into array in order to maintain its sort order. + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. * - * @param array The sorted array to inspect. - * @param value The value to evaluate. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the index at which value should be inserted into array. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example + * + * _.sortedLastIndex([4, 5], 4); + * // => 1 */ sortedLastIndex( array: List, - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** @@ -2206,9 +2755,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee?: (x: T) => any, - thisArg?: any + value: T ): number; /** @@ -2216,8 +2763,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: string + value: T ): number; /** @@ -2225,8 +2771,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: W + value: T ): number; /** @@ -2234,8 +2779,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: Object + value: T ): number; } @@ -2244,9 +2788,7 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): number; } @@ -2255,25 +2797,21 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: string + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: W + value: T ): number; } @@ -2282,42 +2820,21 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: string + value: T ): number; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: W - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: Object + value: T ): number; } @@ -2326,9 +2843,7 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): LoDashExplicitWrapper; } @@ -2337,25 +2852,14 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee: string - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: W + value: T ): LoDashExplicitWrapper; } @@ -2364,45 +2868,266 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => TSort, - thisArg?: any + value: T ): LoDashExplicitWrapper; /** * @see _.sortedLastIndex */ sortedLastIndex( - value: T, - iteratee?: (x: T) => any, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T, - iteratee: string + value: T ): LoDashExplicitWrapper; /** * @see _.sortedLastIndex */ sortedLastIndex( + value: T + ): LoDashExplicitWrapper; + } + + //_.sortedLastIndexBy + interface LoDashStatic { + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * @example + * + * // using the `_.property` iteratee shorthand + * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: string, + iteratee: (x: string) => TSort + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => any + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: string, + iteratee: (x: string) => TSort + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => TSort + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: (x: T) => any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndexBy + */ + sortedLastIndexBy( value: T, iteratee: W ): LoDashExplicitWrapper; /** - * @see _.sortedLastIndex + * @see _.sortedLastIndexBy */ - sortedLastIndex( + sortedLastIndexBy( value: T, iteratee: Object ): LoDashExplicitWrapper; } + //_.sortedLastIndexOf DUMMY + interface LoDashStatic { + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ + sortedLastIndexOf( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.tail interface LoDashStatic { /** @@ -2866,115 +3591,30 @@ declare module _ { //_.uniq interface LoDashStatic { /** - * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only - * the first occurrence of each element is kept. Providing true for isSorted performs a faster search - * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the - * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and - * invoked with three arguments: (value, index, array). + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. * - * If a property name is provided for iteratee the created _.property style callback returns the property - * value of the given element. + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @alias _.unique - * - * @param array The array to inspect. - * @param isSorted Specify the array is sorted. - * @param iteratee The function invoked per iteration. - * @param thisArg iteratee - * @return Returns the new duplicate-value-free array. + * _.uniq([2, 1, 2]); + * // => [2, 1] */ uniq( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + array: List ): T[]; /** * @see _.uniq */ uniq( - array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: ListIterator, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - isSorted?: boolean, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - isSorted?: boolean, - iteratee?: TWhere - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - uniq( - array: List, - iteratee?: TWhere + array: List ): T[]; } @@ -2982,694 +3622,618 @@ declare module _ { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; /** * @see _.uniq */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; + uniq(): LoDashImplicitArrayWrapper; } interface LoDashExplicitWrapper { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; } interface LoDashExplicitArrayWrapper { /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; /** * @see _.uniq */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; + /** + * @see _.uniq + */ + uniq(): LoDashExplicitArrayWrapper; /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: Object - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; + uniq(): LoDashExplicitArrayWrapper; } - //_.unique + //_.uniqBy interface LoDashStatic { /** - * @see _.uniq + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // using the `_.property` iteratee shorthand + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] */ - unique( + uniqBy( array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + iteratee: ListIterator ): T[]; /** - * @see _.uniq + * @see _.uniqBy */ - unique( + uniqBy( array: List, - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + iteratee: ListIterator ): T[]; /** - * @see _.uniq + * @see _.uniqBy */ - unique( + uniqBy( array: List, - iteratee?: ListIterator, - thisArg?: any + iteratee: string ): T[]; /** - * @see _.uniq + * @see _.uniqBy */ - unique( + uniqBy( array: List, - iteratee?: ListIterator, - thisArg?: any + iteratee: Object ): T[]; /** - * @see _.uniq + * @see _.uniqBy */ - unique( + uniqBy( array: List, - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: string, - thisArg?: any - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - isSorted?: boolean, - iteratee?: TWhere - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: Object - ): T[]; - - /** - * @see _.uniq - */ - unique( - array: List, - iteratee?: TWhere + iteratee: TWhere ): T[]; } interface LoDashImplicitWrapper { /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashImplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: string ): LoDashImplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere + uniqBy( + iteratee: TWhere ): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator ): LoDashImplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashImplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: string ): LoDashImplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: Object ): LoDashImplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: Object - ): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere + uniqBy( + iteratee: TWhere ): LoDashImplicitArrayWrapper; } interface LoDashExplicitWrapper { /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; } interface LoDashExplicitArrayWrapper { /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - unique( - iteratee?: TWhere + uniqBy( + iteratee: TWhere ): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: Object ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - unique( - isSorted?: boolean, - iteratee?: string, - thisArg?: any + uniqBy( + iteratee: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.sortedUniq + interface LoDashStatic { + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + sortedUniq( + array: List + ): T[]; + + /** + * @see _.sortedUniq + */ + sortedUniq( + array: List + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + sortedUniq(): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniq + */ + sortedUniq(): LoDashExplicitArrayWrapper; + } + + //_.sortedUniqBy + interface LoDashStatic { + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.2] + */ + sortedUniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: string + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: Object + ): T[]; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + array: List, + iteratee: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - unique( - iteratee?: string, - thisArg?: any + sortedUniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - unique( - isSorted?: boolean, - iteratee?: Object + sortedUniqBy( + iteratee: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - unique( - isSorted?: boolean, - iteratee?: TWhere + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - unique( - iteratee?: Object + sortedUniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - unique( - iteratee?: TWhere + sortedUniqBy( + iteratee: Object ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unionBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [2.1, 1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + unionBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.unionWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + unionWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.uniqWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + uniqWith( + array: any[]|List, + ...values: any[] + ): any[]; } //_.unzip @@ -3833,6 +4397,61 @@ declare module _ { xor(...arrays: List[]): LoDashExplicitArrayWrapper; } + //_.xorBy DUMMY + interface LoDashStatic { + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * // using the `_.property` iteratee shorthand + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + xorBy( + array: any[]|List, + ...values: any[] + ): any[]; + } + + //_.xorWith DUMMY + interface LoDashStatic { + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + xorWith( + array: any[]|List, + ...values: any[] + ): any[]; + } + //_.zip interface LoDashStatic { /** @@ -3880,8 +4499,6 @@ declare module _ { * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of * property names and one of corresponding values. * - * @alias _.object - * * @param props The property names. * @param values The property values. * @return Returns the new object. @@ -4346,14 +4963,6 @@ declare module _ { reverse(): LoDashExplicitArrayWrapper; } - //_.prototype.run - interface LoDashWrapperBase { - /** - * @see _.value - */ - run(): T; - } - //_.prototype.toJSON interface LoDashWrapperBase { /** @@ -4377,7 +4986,7 @@ declare module _ { /** * Executes the chained sequence to extract the unwrapped value. * - * @alias _.run, _.toJSON, _.valueOf + * @alias _.toJSON, _.valueOf * * @return Returns the resolved unwrapped value. */ @@ -4396,291 +5005,6 @@ declare module _ { * Collection * **************/ - //_.all - interface LoDashStatic { - /** - * @see _.every - */ - all( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - collection: List|Dictionary, - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - collection: List|Dictionary, - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.every - */ - all( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.every - */ - all( - predicate?: TObject - ): LoDashExplicitWrapper; - } - - //_.any - interface LoDashStatic { - /** - * @see _.some - */ - any( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: NumericDictionary, - predicate?: NumericDictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: List|Dictionary|NumericDictionary, - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - collection: List|Dictionary|NumericDictionary, - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|NumericDictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): boolean; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|NumericDictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.some - */ - any( - predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: string, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.some - */ - any( - predicate?: TObject - ): LoDashExplicitWrapper; - } - //_.at interface LoDashStatic { /** @@ -4725,220 +5049,6 @@ declare module _ { at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; } - //_.collect - interface LoDashStatic { - /** - * @see _.map - */ - collect( - collection: List, - iteratee?: ListIterator, - thisArg?: any - ): TResult[]; - - /** - * @see _.map - */ - collect( - collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any - ): TResult[]; - - /** - * @see _.map - */ - collect( - collection: List|Dictionary, - iteratee?: string - ): TResult[]; - - /** - * @see _.map - */ - collect( - collection: List|Dictionary, - iteratee?: TObject - ): boolean[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashImplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.map - */ - collect( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: string - ): LoDashExplicitArrayWrapper; - - /** - * @see _.map - */ - collect( - iteratee?: TObject - ): LoDashExplicitArrayWrapper; - } - - //_.contains - interface LoDashStatic { - /** - * @see _.includes - */ - contains( - collection: List|Dictionary, - target: T, - fromIndex?: number - ): boolean; - - /** - * @see _.includes - */ - contains( - collection: string, - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.includes - */ - contains( - target: T, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.includes - */ - contains( - target: TValue, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitWrapper { - /** - * @see _.includes - */ - contains( - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.includes - */ - contains( - target: T, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.includes - */ - contains( - target: TValue, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.includes - */ - contains( - target: string, - fromIndex?: number - ): LoDashExplicitWrapper; - } - //_.countBy interface LoDashStatic { /** @@ -5131,94 +5241,6 @@ declare module _ { ): LoDashExplicitObjectWrapper>; } - //_.detect - interface LoDashStatic { - /** - * @see _.find - */ - detect( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - collection: List|Dictionary, - predicate?: string, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - collection: List|Dictionary, - predicate?: TObject - ): T; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.find - */ - detect( - predicate?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - predicate?: string, - thisArg?: any - ): T; - - /** - * @see _.find - */ - detect( - predicate?: TObject - ): T; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.find - */ - detect( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any - ): TResult; - - /** - * @see _.find - */ - detect( - predicate?: string, - thisArg?: any - ): TResult; - - /** - * @see _.find - */ - detect( - predicate?: TObject - ): TResult; - } - //_.each interface LoDashStatic { /** @@ -5450,8 +5472,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.all - * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -5605,8 +5625,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.select - * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -5781,8 +5799,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.detect - * * @param collection The collection to search. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -5871,81 +5887,6 @@ declare module _ { ): TResult; } - //_.findWhere - interface LoDashStatic { - /** - * @see _.find - **/ - findWhere( - collection: Array, - callback: ListIterator, - thisArg?: any): T; - - /** - * @see _.find - **/ - findWhere( - collection: List, - callback: ListIterator, - thisArg?: any): T; - - /** - * @see _.find - **/ - findWhere( - collection: Dictionary, - callback: DictionaryIterator, - thisArg?: any): T; - - /** - * @see _.find - * @param _.matches style callback - **/ - findWhere( - collection: Array, - whereValue: W): T; - - /** - * @see _.find - * @param _.matches style callback - **/ - findWhere( - collection: List, - whereValue: W): T; - - /** - * @see _.find - * @param _.matches style callback - **/ - findWhere( - collection: Dictionary, - whereValue: W): T; - - /** - * @see _.find - * @param _.property style callback - **/ - findWhere( - collection: Array, - pluckValue: string): T; - - /** - * @see _.find - * @param _.property style callback - **/ - findWhere( - collection: List, - pluckValue: string): T; - - /** - * @see _.find - * @param _.property style callback - **/ - findWhere( - collection: Dictionary, - pluckValue: string): T; - } - //_.findLast interface LoDashStatic { /** @@ -6537,95 +6478,12 @@ declare module _ { ): LoDashExplicitObjectWrapper>; } - //_.include - interface LoDashStatic { - /** - * @see _.includes - */ - include( - collection: List|Dictionary, - target: T, - fromIndex?: number - ): boolean; - - /** - * @see _.includes - */ - include( - collection: string, - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.includes - */ - include( - target: T, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.includes - */ - include( - target: TValue, - fromIndex?: number - ): boolean; - } - - interface LoDashImplicitWrapper { - /** - * @see _.includes - */ - include( - target: string, - fromIndex?: number - ): boolean; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.includes - */ - include( - target: T, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.includes - */ - include( - target: TValue, - fromIndex?: number - ): LoDashExplicitWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.includes - */ - include( - target: string, - fromIndex?: number - ): LoDashExplicitWrapper; - } - //_.includes interface LoDashStatic { /** * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, * it’s used as the offset from the end of collection. * - * @alias _.contains, _.include - * * @param collection The collection to search. * @param target The value to search for. * @param fromIndex The index to search from. @@ -6707,7 +6565,7 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.indexBy + //_.keyBy interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through @@ -6729,51 +6587,51 @@ declare module _ { * @param thisArg The this binding of iteratee. * @return Returns the composed aggregate object. */ - indexBy( + keyBy( collection: List, iteratee?: ListIterator, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: NumericDictionary, iteratee?: NumericDictionaryIterator, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: Dictionary, iteratee?: DictionaryIterator, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: List|NumericDictionary|Dictionary, iteratee?: string, thisArg?: any ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: List|NumericDictionary|Dictionary, iteratee?: W ): Dictionary; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( collection: List|NumericDictionary|Dictionary, iteratee?: Object ): Dictionary; @@ -6781,9 +6639,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; @@ -6791,66 +6649,66 @@ declare module _ { interface LoDashImplicitArrayWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashImplicitObjectWrapper>; } interface LoDashImplicitObjectWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashImplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: Object ): LoDashImplicitObjectWrapper>; } interface LoDashExplicitWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashExplicitObjectWrapper>; @@ -6858,62 +6716,62 @@ declare module _ { interface LoDashExplicitArrayWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashExplicitObjectWrapper>; } interface LoDashExplicitObjectWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: string, thisArg?: any ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: W ): LoDashExplicitObjectWrapper>; /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: Object ): LoDashExplicitObjectWrapper>; } - //_.invoke + //_.invokeMap interface LoDashStatic { /** * Invokes the method named by methodName on each element in the collection returning @@ -6924,47 +6782,47 @@ declare module _ { * @param methodName The name of the method to invoke. * @param args Arguments to invoke the method with. **/ - invoke( + invokeMap( collection: Array, methodName: string, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: List, methodName: string, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: Dictionary, methodName: string, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: Array, method: Function, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: List, method: Function, ...args: any[]): any; /** - * @see _.invoke + * @see _.invokeMap **/ - invoke( + invokeMap( collection: Dictionary, method: Function, ...args: any[]): any; @@ -6993,8 +6851,6 @@ declare module _ { * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, * sample, some, sum, uniq, and words * - * @alias _.collect - * * @param collection The collection to iterate over. * @param iteratee The function invoked per iteration. * @param thisArg The this binding of iteratee. @@ -7276,57 +7132,6 @@ declare module _ { pluckValue: string): LoDashImplicitArrayWrapper; } - //_.pluck - interface LoDashStatic { - /** - * Gets the property value of path from all elements in collection. - * - * @param collection The collection to iterate over. - * @param path The path of the property to pluck. - * @return A new array of property values. - */ - pluck( - collection: List|Dictionary, - path: StringRepresentable|StringRepresentable[] - ): any[]; - - /** - * @see _.pluck - */ - pluck( - collection: List|Dictionary, - path: StringRepresentable|StringRepresentable[] - ): TResult[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.pluck - */ - pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; - } - //_.reduce interface LoDashStatic { /** @@ -7389,107 +7194,6 @@ declare module _ { callback: MemoIterator, thisArg?: any): TResult; - /** - * @see _.reduce - **/ - inject( - collection: Array, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: List, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: Dictionary, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: List, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Array, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: List, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Dictionary, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: List, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; } interface LoDashImplicitArrayWrapper { @@ -7507,36 +7211,6 @@ declare module _ { reduce( callback: MemoIterator, thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - thisArg?: any): TResult; } interface LoDashImplicitObjectWrapper { @@ -7554,36 +7228,6 @@ declare module _ { reduce( callback: MemoIterator, thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - inject( - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduce - **/ - foldl( - callback: MemoIterator, - thisArg?: any): TResult; } //_.reduceRight @@ -7644,57 +7288,6 @@ declare module _ { collection: Dictionary, callback: MemoIterator, thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Array, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: List, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Dictionary, - callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: List, - callback: MemoIterator, - thisArg?: any): TResult; - - /** - * @see _.reduceRight - **/ - foldr( - collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; } //_.reject @@ -7865,10 +7458,18 @@ declare module _ { //_.sample interface LoDashStatic { /** - * Retrieves a random element or n random elements from a collection. - * @param collection The collection to sample. - * @return Returns the random sample(s) of collection. - **/ + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ sample(collection: Array): T; /** @@ -7880,195 +7481,54 @@ declare module _ { * @see _.sample **/ sample(collection: Dictionary): T; - - /** - * @see _.sample - * @param n The number of elements to sample. - **/ - sample(collection: Array, n: number): T[]; - - /** - * @see _.sample - * @param n The number of elements to sample. - **/ - sample(collection: List, n: number): T[]; - - /** - * @see _.sample - * @param n The number of elements to sample. - **/ - sample(collection: Dictionary, n: number): T[]; } interface LoDashImplicitArrayWrapper { - /** - * @see _.sample - **/ - sample(n: number): LoDashImplicitArrayWrapper; - /** * @see _.sample **/ sample(): LoDashImplicitWrapper; } - //_.select + //_.sampleSize interface LoDashStatic { /** - * @see _.filter + * Gets `n` random elements from `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=0] The number of elements to sample. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3, 4], 2); + * // => [3, 1] */ - select( - collection: List, - predicate?: ListIterator, - thisArg?: any - ): T[]; + sampleSize(collection: Array, n: number): T[]; /** - * @see _.filter - */ - select( - collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any - ): T[]; + * @see _.sampleSize + **/ + sampleSize(collection: List, n: number): T[]; /** - * @see _.filter - */ - select( - collection: string, - predicate?: StringIterator, - thisArg?: any - ): string[]; - - /** - * @see _.filter - */ - select( - collection: List|Dictionary, - predicate: string, - thisArg?: any - ): T[]; - - /** - * @see _.filter - */ - select( - collection: List|Dictionary, - predicate: W - ): T[]; - } - - interface LoDashImplicitWrapper { - /** - * @see _.filter - */ - select( - predicate?: StringIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + * @see _.sampleSize + **/ + sampleSize(collection: Dictionary, n: number): T[]; } interface LoDashImplicitArrayWrapper { /** - * @see _.filter - */ - select( - predicate: ListIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; + * @see _.sampleSize + **/ + sampleSize(n: number): LoDashImplicitArrayWrapper; /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashImplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.filter - */ - select( - predicate?: StringIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.filter - */ - select( - predicate: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select( - predicate: string, - thisArg?: any - ): LoDashExplicitArrayWrapper; - - /** - * @see _.filter - */ - select(predicate: W): LoDashExplicitArrayWrapper; + * @see _.sampleSize + **/ + sampleSize(): LoDashImplicitWrapper; } //_.shuffle @@ -8204,8 +7664,6 @@ declare module _ { * If an object is provided for predicate the created _.matches style callback returns true for elements that * have the properties of the given object, else false. * - * @alias _.any - * * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param thisArg The this binding of predicate. @@ -8356,29 +7814,41 @@ declare module _ { //_.sortBy interface LoDashStatic { /** - * Creates an array of elements, sorted in ascending order by the results of running each element in a - * collection through iteratee. This method performs a stable sort, that is, it preserves the original sort - * order of equal elements. The iteratee is bound to thisArg and invoked with three arguments: - * (value, index|key, collection). + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). * - * If a property name is provided for iteratee the created _.property style callback returns the property - * valueof the given element. + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]] + * The iteratees to sort by, specified individually or in arrays. + * @returns {Array} Returns the new sorted array. + * @example * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. + * _.sortBy(users, function(o) { return o.user; }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the new sorted array. + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.sortBy(users, 'user', function(o) { + * return Math.floor(o.age / 10); + * }); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ sortBy( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): T[]; /** @@ -8386,8 +7856,7 @@ declare module _ { */ sortBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): T[]; /** @@ -8412,6 +7881,20 @@ declare module _ { sortBy( collection: List|Dictionary ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: (Array|List), + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: (Array|List), + ...iteratees: (ListIterator|Object|string)[]): T[]; } interface LoDashImplicitArrayWrapper { @@ -8419,8 +7902,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitArrayWrapper; /** @@ -8437,6 +7919,16 @@ declare module _ { * @see _.sortBy */ sortBy(): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(...iteratees: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + **/ + sortBy(iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { @@ -8444,8 +7936,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitArrayWrapper; /** @@ -8469,8 +7960,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitArrayWrapper; /** @@ -8494,8 +7984,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitArrayWrapper; /** @@ -8514,145 +8003,81 @@ declare module _ { sortBy(): LoDashExplicitArrayWrapper; } - //_.sortByAll + //_.orderBy interface LoDashStatic { /** - * This method is like "_.sortBy" except that it can sort by multiple iteratees or - * property names. - * - * If a property name is provided for an iteratee the created "_.property" style callback - * returns the property value of the given element. - * - * If a value is also provided for thisArg the created "_.matchesProperty" style callback - * returns true for elements that have a matching property value, else false. - * - * If an object is provided for an iteratee the created "_.matches" style callback returns - * true for elements that have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param callback The function called per iteration. - * @param thisArg The this binding of callback. - * @return A new array of sorted elements. - **/ - sortByAll( - collection: Array, - iteratees: (ListIterator|string|Object)[]): T[]; - - /** - * @see _.sortByAll - **/ - sortByAll( - collection: List, - iteratees: (ListIterator|string|Object)[]): T[]; - - /** - * @see _.sortByAll - **/ - sortByAll( - collection: Array, - ...iteratees: (ListIterator|string|Object)[]): T[]; - - /** - * @see _.sortByAll - **/ - sortByAll( - collection: List, - ...iteratees: (ListIterator|string|Object)[]): T[]; - - /** - * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts - * @param args The rules by which to sort - */ - sortByAll( - collection: (Array|List), - ...args: (ListIterator|Object|string)[] - ): T[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts - * @param args The rules by which to sort - */ - sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - **/ - sortByAll( - iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - **/ - sortByAll( - ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; - } - - //_.sortByOrder - interface LoDashStatic { - /** - * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort - * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in - * ascending order if its corresponding order is "asc", and descending if "desc". + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. * - * If a property name is provided for an iteratee the created _.property style callback returns the property - * value of the given element. + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example * - * If an object is provided for an iteratee the created _.matches style callback returns true for elements - * that have the properties of the given object, else false. + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; * - * @param collection The collection to iterate over. - * @param iteratees The iteratees to sort by. - * @param orders The sort orders of iteratees. - * @return Returns the new sorted array. + * // sort by `user` in ascending order and by `age` in descending order + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ - sortByOrder( + orderBy( collection: List, iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: List, iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: NumericDictionary, iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: NumericDictionary, iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: Dictionary, iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): T[]; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( collection: Dictionary, iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] @@ -8661,9 +8086,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|(ListIterator|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8671,9 +8096,9 @@ declare module _ { interface LoDashImplicitArrayWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8681,49 +8106,49 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8731,9 +8156,9 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|(ListIterator|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; @@ -8741,9 +8166,9 @@ declare module _ { interface LoDashExplicitArrayWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; @@ -8751,89 +8176,54 @@ declare module _ { interface LoDashExplicitObjectWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; } - //_.where - interface LoDashStatic { - /** - * Performs a deep comparison of each element in a collection to the given properties - * object, returning an array of all elements that have equivalent property values. - * @param collection The collection to iterate over. - * @param properties The object of property values to filter by. - * @return A new array of elements that have the given properties. - **/ - where( - list: Array, - properties: U): T[]; - - /** - * @see _.where - **/ - where( - list: List, - properties: U): T[]; - - /** - * @see _.where - **/ - where( - list: Dictionary, - properties: U): T[]; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.where - **/ - where(properties: U): LoDashImplicitArrayWrapper; - } - /******** * Date * ********/ @@ -8929,28 +8319,6 @@ declare module _ { ary(n?: number): LoDashExplicitObjectWrapper; } - //_.backflow - interface LoDashStatic { - /** - * @see _.flowRight - */ - backflow(...funcs: Function[]): TResult; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.flowRight - */ - backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.flowRight - */ - backflow(...funcs: Function[]): LoDashExplicitObjectWrapper; - } - //_.before interface LoDashStatic { /** @@ -9127,28 +8495,6 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.compose - interface LoDashStatic { - /** - * @see _.flowRight - */ - compose(...funcs: Function[]): TResult; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.flowRight - */ - compose(...funcs: Function[]): LoDashImplicitObjectWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.flowRight - */ - compose(...funcs: Function[]): LoDashExplicitObjectWrapper; - } - //_.createCallback interface LoDashStatic { /** @@ -9489,6 +8835,41 @@ declare module _ { ): LoDashExplicitWrapper; } + interface LoDashStatic { + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + flip(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flip + */ + flip(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flip + */ + flip(): LoDashExplicitObjectWrapper; + } + //_.flow interface LoDashStatic { /** @@ -9521,8 +8902,6 @@ declare module _ { * This method is like _.flow except that it creates a function that invokes the provided functions from right * to left. * - * @alias _.backflow, _.compose - * * @param funcs Functions to invoke. * @return Returns the new function. */ @@ -9571,7 +8950,7 @@ declare module _ { memoize(resolver?: Function): LoDashImplicitObjectWrapper; } - //_.modArgs + //_.overArgs (was _.modArgs) interface LoDashStatic { /** * Creates a function that runs each argument through a corresponding transform function. @@ -9581,15 +8960,15 @@ declare module _ { * of functions. * @return Returns the new function. */ - modArgs( + overArgs( func: T, ...transforms: Function[] ): TResult; /** - * @see _.modArgs + * @see _.overArgs */ - modArgs( + overArgs( func: T, transforms: Function[] ): TResult; @@ -9597,26 +8976,26 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; + overArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + overArgs(transforms: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; + overArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; /** - * @see _.modArgs + * @see _.overArgs */ - modArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + overArgs(transforms: Function[]): LoDashExplicitObjectWrapper; } //_.negate @@ -9841,7 +9220,7 @@ declare module _ { rearg(...indexes: number[]): LoDashImplicitObjectWrapper; } - //_.restParam + //_.rest interface LoDashStatic { /** * Creates a function that invokes func with the this binding of the created function and arguments from start @@ -9853,15 +9232,15 @@ declare module _ { * @param start The start position of the rest parameter. * @return Returns the new function. */ - restParam( + rest( func: Function, start?: number ): TResult; /** - * @see _.restParam + * @see _.rest */ - restParam( + rest( func: TFunc, start?: number ): TResult; @@ -9869,16 +9248,16 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** - * @see _.restParam + * @see _.rest */ - restParam(start?: number): LoDashImplicitObjectWrapper; + rest(start?: number): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.restParam + * @see _.rest */ - restParam(start?: number): LoDashExplicitObjectWrapper; + rest(start?: number): LoDashExplicitObjectWrapper; } //_.spread @@ -9971,6 +9350,39 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.unary + interface LoDashStatic { + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + unary(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unary + */ + unary(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unary + */ + unary(): LoDashExplicitObjectWrapper; + } + //_.wrap interface LoDashStatic { /** @@ -10083,86 +9495,150 @@ declare module _ { //_.clone interface LoDashStatic { /** - * Creates a clone of value. If isDeep is true nested objects are cloned, otherwise they are assigned by - * reference. If customizer is provided it’s invoked to produce the cloned values. If customizer returns - * undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with up - * to three argument; (value [, index|key, object]). - * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of arguments - * objects and objects created by constructors other than Object are cloned to plain Object objects. An empty - * object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. - * @param value The value to clone. - * @param isDeep Specify a deep clone. - * @param customizer The function to customize cloning values. - * @param thisArg The this binding of customizer. - * @return Returns the cloned value. + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true */ - clone( - value: T, - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T; - - /** - * @see _.clone - */ - clone( - value: T, - customizer?: (value: any) => any, - thisArg?: any): T; + clone(value: T): T; } interface LoDashImplicitWrapper { /** * @see _.clone */ - clone( - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T; - - /** - * @see _.clone - */ - clone( - customizer?: (value: any) => any, - thisArg?: any): T; + clone(): T; } interface LoDashImplicitArrayWrapper { - /** - * @see _.clone - */ - clone( - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T[]; /** * @see _.clone */ - clone( - customizer?: (value: any) => any, - thisArg?: any): T[]; + clone(): T[]; } interface LoDashImplicitObjectWrapper { /** * @see _.clone */ - clone( - isDeep?: boolean, - customizer?: (value: any) => any, - thisArg?: any): T; + clone(): T; + } + + //_.cloneDeep + interface LoDashStatic { + /** + * This method is like `_.clone` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to recursively clone. + * @returns {*} Returns the deep cloned value. + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var deep = _.cloneDeep(objects); + * console.log(deep[0] === objects[0]); + * // => false + */ + cloneDeep(value: T): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep(): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + //_.cloneWith + interface LoDashStatic { + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + clone( + value: T, + customizer: (value: any) => any): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clone + */ + clone(customizer: (value: any) => any): T; + } + + interface LoDashImplicitArrayWrapper { /** * @see _.clone */ - clone( - customizer?: (value: any) => any, - thisArg?: any): T; + clone(customizer: (value: any) => any): T[]; } - //_.cloneDeep + interface LoDashImplicitObjectWrapper { + /** + * @see _.clone + */ + clone(customizer: (value: any) => any): T; + } + + //_.cloneDeepWith interface LoDashStatic { /** * Creates a deep clone of value. If customizer is provided it’s invoked to produce the cloned values. If @@ -10178,47 +9654,65 @@ declare module _ { */ cloneDeep( value: T, - customizer?: (value: any) => any, - thisArg?: any): T; + customizer: (value: any) => any): T; } interface LoDashImplicitWrapper { /** * @see _.cloneDeep */ - cloneDeep( - customizer?: (value: any) => any, - thisArg?: any): T; + cloneDeep(customizer: (value: any) => any): T; } interface LoDashImplicitArrayWrapper { /** * @see _.cloneDeep */ - cloneDeep( - customizer?: (value: any) => any, - thisArg?: any): T[]; + cloneDeep(customizer: (value: any) => any): T[]; } interface LoDashImplicitObjectWrapper { /** * @see _.cloneDeep */ - cloneDeep( - customizer?: (value: any) => any, - thisArg?: any): T; + cloneDeep(customizer: (value: any) => any): T; } //_.eq interface LoDashStatic { /** - * @see _.isEqual + * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true */ eq( value: any, - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -10227,9 +9721,7 @@ declare module _ { * @see _.isEqual */ eq( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -10238,9 +9730,7 @@ declare module _ { * @see _.isEqual */ eq( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): LoDashExplicitWrapper; } @@ -10352,6 +9842,93 @@ declare module _ { isArray(): LoDashExplicitWrapper; } + //_.isArrayLike + interface LoDashStatic { + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @type Function + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + isArrayLike(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArrayLike + */ + isArrayLike(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArrayLike + */ + isArrayLike(): LoDashExplicitWrapper; + } + + //_.isArrayLikeObject + interface LoDashStatic { + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @type Function + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + isArrayLikeObject(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArrayLikeObject + */ + isArrayLikeObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArrayLikeObject + */ + isArrayLikeObject(): LoDashExplicitWrapper; + } + //_.isBoolean interface LoDashStatic { /** @@ -10446,34 +10023,37 @@ declare module _ { } //_.isEqual - interface IsEqualCustomizer { - (value: any, other: any, indexOrKey?: number|string): boolean; - } - interface LoDashStatic { /** - * Performs a deep comparison between two values to determine if they are equivalent. If customizer is - * provided it’s invoked to compare values. If customizer returns undefined comparisons are handled by the - * method instead. The customizer is bound to thisArg and invoked with up to three arguments: (value, other - * [, index|key]). + * Performs a deep comparison between two values to determine if they are + * equivalent. * - * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, - * and strings. Objects are compared by their own, not inherited, enumerable properties. Functions and DOM - * nodes are not supported. Provide a customizer function to extend support for comparing other values. + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are **not** supported. * - * @alias _.eq + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example * - * @param value The value to compare. - * @param other The other value to compare. - * @param customizer The function to customize value comparisons. - * @param thisArg The this binding of customizer. - * @return Returns true if the values are equivalent, else false. + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false */ isEqual( value: any, - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -10482,9 +10062,7 @@ declare module _ { * @see _.isEqual */ isEqual( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -10493,9 +10071,71 @@ declare module _ { * @see _.isEqual */ isEqual( + other: any + ): LoDashExplicitWrapper; + } + + // _.isEqualWith + interface IsEqualCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * This method is like `_.isEqual` except that it accepts `customizer` which is + * invoked to compare values. If `customizer` returns `undefined` comparisons are + * handled by the method instead. The `customizer` is invoked with up to seven arguments: + * (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + isEqualWith( + value: any, other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + customizer: IsEqualCustomizer + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqualWith + */ + isEqualWith( + other: any, + customizer: IsEqualCustomizer + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqualWith + */ + isEqualWith( + other: any, + customizer: IsEqualCustomizer ): LoDashExplicitWrapper; } @@ -10577,6 +10217,92 @@ declare module _ { isFunction(): LoDashExplicitWrapper; } + //_.isInteger + interface LoDashStatic { + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + isInteger(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isInteger + */ + isInteger(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isInteger + */ + isInteger(): LoDashExplicitWrapper; + } + + //_.isLength + interface LoDashStatic { + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + isLength(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isLength + */ + isLength(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isLength + */ + isLength(): LoDashExplicitWrapper; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; @@ -10584,24 +10310,82 @@ declare module _ { interface LoDashStatic { /** - * Performs a deep comparison between object and source to determine if object contains equivalent property - * values. If customizer is provided it’s invoked to compare values. If customizer returns undefined - * comparisons are handled by the method instead. The customizer is bound to thisArg and invoked with three - * arguments: (value, other, index|key). - * @param object The object to inspect. - * @param source The object of property values to match. - * @param customizer The function to customize value comparisons. - * @param thisArg The this binding of customizer. - * @return Returns true if object is a match, else false. + * Performs a deep comparison between `object` and `source` to determine if + * `object` contains equivalent property values. + * + * **Note:** This method supports comparing the same values as `_.isEqual`. + * + * @static + * @memberOf _ + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.isMatch(object, { 'age': 40 }); + * // => true + * + * _.isMatch(object, { 'age': 36 }); + * // => false */ - isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + isMatch(object: Object, source: Object): boolean; } interface LoDashImplicitObjectWrapper { /** * @see _.isMatch */ - isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + isMatch(source: Object): boolean; + } + + //_.isMatchWith + interface isMatchWithCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined` comparisons + * are handled by the method instead. The `customizer` is invoked with three + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + isMatchWith(object: Object, source: Object, customizer: isMatchWithCustomizer): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.isMatchWith + */ + isMatchWith(source: Object, customizer: isMatchWithCustomizer): boolean; } //_.isNaN @@ -10656,6 +10440,44 @@ declare module _ { isNative(): LoDashExplicitWrapper; } + //_.isNil + interface LoDashStatic { + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + isNil(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNil + */ + isNil(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNil + */ + isNil(): LoDashExplicitWrapper; + } + //_.isNull interface LoDashStatic { /** @@ -10734,6 +10556,48 @@ declare module _ { isObject(): LoDashExplicitWrapper; } + //_.isObjectLike + interface LoDashStatic { + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + isObjectLike(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isObjectLike + */ + isObjectLike(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isObjectLike + */ + isObjectLike(): LoDashExplicitWrapper; + } + //_.isPlainObject interface LoDashStatic { /** @@ -10787,6 +10651,50 @@ declare module _ { isRegExp(): LoDashExplicitWrapper; } + //_.isSafeInteger + interface LoDashStatic { + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + isSafeInteger(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isSafeInteger + */ + isSafeInteger(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isSafeInteger + */ + isSafeInteger(): LoDashExplicitWrapper; + } + //_.isString interface LoDashStatic { /** @@ -10812,6 +10720,41 @@ declare module _ { isString(): LoDashExplicitWrapper; } + //_.isSymbol + interface LoDashStatic { + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + isSymbol(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isSymbol + */ + isSymbol(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isSymbol + */ + isSymbol(): LoDashExplicitWrapper; + } + //_.isTypedArray interface LoDashStatic { /** @@ -11002,6 +10945,201 @@ declare module _ { toPlainObject(): LoDashImplicitObjectWrapper; } + //_.toInteger + interface LoDashStatic { + /** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3'); + * // => 3 + */ + toInteger(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toInteger + */ + toInteger(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toInteger + */ + toInteger(): LoDashExplicitWrapper; + } + + //_.toLength + interface LoDashStatic { + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @return {number} Returns the converted integer. + * @example + * + * _.toLength(3); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3'); + * // => 3 + */ + toLength(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toLength + */ + toLength(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toLength + */ + toLength(): LoDashExplicitWrapper; + } + + //_.toNumber + interface LoDashStatic { + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 + */ + toNumber(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toNumber + */ + toNumber(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toNumber + */ + toNumber(): LoDashExplicitWrapper; + } + + //_.toSafeInteger + interface LoDashStatic { + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3'); + * // => 3 + */ + toSafeInteger(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toSafeInteger + */ + toSafeInteger(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toSafeInteger + */ + toSafeInteger(): LoDashExplicitWrapper; + } + + //_.toString DUMMY + interface LoDashStatic { + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + toString(value: any): string; + } + /******** * Math * ********/ @@ -11095,55 +11233,18 @@ declare module _ { //_.max interface LoDashStatic { - /** - * Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee - * function is provided it’s invoked for each value in collection to generate the criterion by which the value - * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). - * - * If a property name is provided for iteratee the created _.property style callback returns the property value - * of the given element. - * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the maximum value. - */ + /** + * Computes the maximum value of `array`. If `array` is empty or falsey + * `undefined` is returned. + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ max( - collection: List, - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - collection: List|Dictionary, - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - collection: List|Dictionary, - whereValue?: TObject + collection: List ): T; } @@ -11151,103 +11252,164 @@ declare module _ { /** * @see _.max */ - max( - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.max - */ - max( - whereValue?: TObject - ): T; + max(): T; } interface LoDashImplicitObjectWrapper { /** * @see _.max */ - max( + max(): T; + } + + //_.maxBy + interface LoDashStatic { + /** + * This method is like `_.max` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {*} Returns the maximum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.maxBy(objects, function(o) { return o.a; }); + * // => { 'n': 2 } + * + * // using the `_.property` iteratee shorthand + * _.maxBy(objects, 'n'); + * // => { 'n': 2 } + */ + maxBy( + collection: List, + iteratee?: ListIterator + ): T; + + /** + * @see _.maxBy + */ + maxBy( + collection: Dictionary, + iteratee?: DictionaryIterator + ): T; + + /** + * @see _.maxBy + */ + maxBy( + collection: List|Dictionary, + iteratee?: string + ): T; + + /** + * @see _.maxBy + */ + maxBy( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.maxBy + */ + maxBy( + iteratee?: ListIterator + ): T; + + /** + * @see _.maxBy + */ + maxBy( + iteratee?: string + ): T; + + /** + * @see _.maxBy + */ + maxBy( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.maxBy + */ + maxBy( iteratee?: ListIterator|DictionaryIterator, thisArg?: any ): T; /** - * @see _.max + * @see _.maxBy */ - max( + maxBy( iteratee?: string, thisArg?: any ): T; /** - * @see _.max + * @see _.maxBy */ - max( + maxBy( whereValue?: TObject ): T; } + //_.mean + interface LoDashStatic { + /** + * Computes the mean of the values in `array`. + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {number} Returns the mean. + * @example + * + * _.mean([4, 2, 8, 6]); + * // => 5 + */ + mean( + collection: List + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.mean + */ + mean(): number; + + /** + * @see _.mean + */ + mean(): number; + } + //_.min interface LoDashStatic { /** - * Gets the minimum value of collection. If collection is empty or falsey Infinity is returned. If an iteratee - * function is provided it’s invoked for each value in collection to generate the criterion by which the value - * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * Computes the minimum value of `array`. If `array` is empty or falsey + * `undefined` is returned. * - * If a property name is provided for iteratee the created _.property style callback returns the property value - * of the given element. - * - * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for - * elements that have a matching property value, else false. - * - * If an object is provided for iteratee the created _.matches style callback returns true for elements that - * have the properties of the given object, else false. - * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the minimum value. + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. */ min( - collection: List, - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - collection: List|Dictionary, - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - collection: List|Dictionary, - whereValue?: TObject + collection: List ): T; } @@ -11255,48 +11417,114 @@ declare module _ { /** * @see _.min */ - min( - iteratee?: ListIterator, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - iteratee?: string, - thisArg?: any - ): T; - - /** - * @see _.min - */ - min( - whereValue?: TObject - ): T; + min(): T; } interface LoDashImplicitObjectWrapper { /** * @see _.min */ - min( + min(): T; + } + + //_.minBy + interface LoDashStatic { + /** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {*} Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.a; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ + minBy( + collection: List, + iteratee?: ListIterator + ): T; + + /** + * @see _.minBy + */ + minBy( + collection: Dictionary, + iteratee?: DictionaryIterator + ): T; + + /** + * @see _.minBy + */ + minBy( + collection: List|Dictionary, + iteratee?: string + ): T; + + /** + * @see _.minBy + */ + minBy( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.minBy + */ + minBy( + iteratee?: ListIterator + ): T; + + /** + * @see _.minBy + */ + minBy( + iteratee?: string + ): T; + + /** + * @see _.minBy + */ + minBy( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.minBy + */ + minBy( iteratee?: ListIterator|DictionaryIterator, thisArg?: any ): T; /** - * @see _.min + * @see _.minBy */ - min( + minBy( iteratee?: string, thisArg?: any ): T; /** - * @see _.min + * @see _.minBy */ - min( + minBy( whereValue?: TObject ): T; } @@ -11333,40 +11561,19 @@ declare module _ { //_.sum interface LoDashStatic { /** - * Gets the sum of the values in collection. + * Computes the sum of the values in `array`. * - * @param collection The collection to iterate over. - * @param iteratee The function invoked per iteration. - * @param thisArg The this binding of iteratee. - * @return Returns the sum. + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {number} Returns the sum. + * @example + * + * _.sum([4, 2, 8, 6]); + * // => 20 */ - sum( - collection: List, - iteratee: ListIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - **/ - sum( - collection: Dictionary, - iteratee: DictionaryIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum( - collection: List|Dictionary, - iteratee: string - ): number; - - /** - * @see _.sum - */ - sum(collection: List|Dictionary): number; + sum(collection: List): number; /** * @see _.sum @@ -11375,19 +11582,6 @@ declare module _ { } interface LoDashImplicitArrayWrapper { - /** - * @see _.sum - */ - sum( - iteratee: ListIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum(iteratee: string): number; - /** * @see _.sum */ @@ -11398,15 +11592,7 @@ declare module _ { /** * @see _.sum **/ - sum( - iteratee: ListIterator|DictionaryIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum(iteratee: string): number; + sum(): number; /** * @see _.sum @@ -11415,19 +11601,6 @@ declare module _ { } interface LoDashExplicitArrayWrapper { - /** - * @see _.sum - */ - sum( - iteratee: ListIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sum - */ - sum(iteratee: string): LoDashExplicitWrapper; - /** * @see _.sum */ @@ -11438,15 +11611,7 @@ declare module _ { /** * @see _.sum */ - sum( - iteratee: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sum - */ - sum(iteratee: string): LoDashExplicitWrapper; + sum(): LoDashExplicitWrapper; /** * @see _.sum @@ -11454,10 +11619,229 @@ declare module _ { sum(): LoDashExplicitWrapper; } + //_.sumBy + interface LoDashStatic { + /** + * This method is like `_.sum` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the value to be summed. + * The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the sum. + * @example + * + * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; + * + * _.sumBy(objects, function(o) { return o.n; }); + * // => 20 + * + * // using the `_.property` iteratee shorthand + * _.sumBy(objects, 'n'); + * // => 20 + */ + sumBy( + collection: List, + iteratee: ListIterator + ): number; + + /** + * @see _.sumBy + **/ + sumBy( + collection: Dictionary, + iteratee: DictionaryIterator + ): number; + + /** + * @see _.sumBy + */ + sumBy( + collection: List|Dictionary, + iteratee: string + ): number; + + /** + * @see _.sumBy + */ + sumBy(collection: List|Dictionary): number; + + /** + * @see _.sumBy + */ + sumBy(collection: List|Dictionary): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sumBy + */ + sumBy( + iteratee: ListIterator + ): number; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): number; + + /** + * @see _.sumBy + */ + sumBy(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sumBy + **/ + sumBy( + iteratee: ListIterator|DictionaryIterator + ): number; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): number; + + /** + * @see _.sumBy + */ + sumBy(): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sumBy + */ + sumBy( + iteratee: ListIterator + ): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sumBy + */ + sumBy( + iteratee: ListIterator|DictionaryIterator + ): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sumBy + */ + sumBy(): LoDashExplicitWrapper; + } + /********** * Number * **********/ + //_.subtract + interface LoDashStatic { + /** + * Subtract two numbers. + * + * @static + * @memberOf _ + * @category Math + * @param {number} minuend The first number in a subtraction. + * @param {number} subtrahend The second number in a subtraction. + * @returns {number} Returns the difference. + * @example + * + * _.subtract(6, 4); + * // => 2 + */ + subtract( + minuend: number, + subtrahend: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.subtract + */ + subtract( + subtrahend: number + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.subtract + */ + subtract( + subtrahend: number + ): LoDashExplicitWrapper; + } + + //_.clamp + interface LoDashStatic { + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + clamp( + number: number, + lower: number, + upper: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clamp + */ + clamp( + lower: number, + upper: number + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.clamp + */ + clamp( + lower: number, + upper: number + ): LoDashExplicitWrapper; + } + //_.inRange interface LoDashStatic { /** @@ -11582,32 +11966,40 @@ declare module _ { **********/ //_.assign - interface AssignCustomizer { - (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; - } - interface LoDashStatic { /** - * Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources - * overwrite property assignments of previous sources. If customizer is provided it’s invoked to produce the - * assigned values. The customizer is bound to thisArg and invoked with five arguments: - * (objectValue, sourceValue, key, object, source). + * Assigns own enumerable properties of source objects to the destination + * object. Source objects are applied from left to right. Subsequent sources + * overwrite property assignments of previous sources. * - * Note: This method mutates object and is based on Object.assign. + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). * - * @alias _.extend + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example * - * @param object The destination object. - * @param source The source objects. - * @param customizer The function to customize assigned values. - * @param thisArg The this binding of callback. - * @return The destination object. + * function Foo() { + * this.c = 3; + * } + * + * function Bar() { + * this.e = 5; + * } + * + * Foo.prototype.d = 4; + * Bar.prototype.f = 6; + * + * _.assign({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3, 'e': 5 } */ assign( object: TObject, - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): TResult; /** @@ -11616,9 +12008,7 @@ declare module _ { assign( object: TObject, source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): TResult; /** @@ -11628,9 +12018,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): TResult; /** @@ -11643,9 +12031,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): TResult; /** @@ -11666,9 +12052,7 @@ declare module _ { * @see _.assign */ assign( - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): LoDashImplicitObjectWrapper; /** @@ -11676,9 +12060,7 @@ declare module _ { */ assign( source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): LoDashImplicitObjectWrapper; /** @@ -11687,9 +12069,7 @@ declare module _ { assign( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): LoDashImplicitObjectWrapper; /** @@ -11699,9 +12079,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): LoDashImplicitObjectWrapper; /** @@ -11720,9 +12098,7 @@ declare module _ { * @see _.assign */ assign( - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): LoDashExplicitObjectWrapper; /** @@ -11730,9 +12106,7 @@ declare module _ { */ assign( source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): LoDashExplicitObjectWrapper; /** @@ -11741,9 +12115,7 @@ declare module _ { assign( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): LoDashExplicitObjectWrapper; /** @@ -11753,9 +12125,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): LoDashExplicitObjectWrapper; /** @@ -11769,6 +12139,552 @@ declare module _ { assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; } + //_.assignWith + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * This method is like `_.assign` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + assignWith( + object: TObject, + source: TSource, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignWith + */ + assignWith( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignWith + */ + assignWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignWith + */ + assignWith + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): TResult; + + /** + * @see _.assignWith + */ + assignWith(object: TObject): TObject; + + /** + * @see _.assignWith + */ + assignWith( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assignWith + */ + assignWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(): LoDashImplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assignWith + */ + assignWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignWith + */ + assignWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(): LoDashExplicitObjectWrapper; + + /** + * @see _.assignWith + */ + assignWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.assignIn + interface LoDashStatic { + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * function Bar() { + * this.d = 4; + * } + * + * Foo.prototype.c = 3; + * Bar.prototype.e = 5; + * + * _.assignIn({ 'a': 1 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 } + */ + assignIn( + object: TObject, + source: TSource + ): TResult; + + /** + * @see assignIn + */ + assignIn( + object: TObject, + source1: TSource1, + source2: TSource2 + ): TResult; + + /** + * @see assignIn + */ + assignIn( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): TResult; + + /** + * @see assignIn + */ + assignIn + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): TResult; + + /** + * @see _.assignIn + */ + assignIn(object: TObject): TObject; + + /** + * @see _.assignIn + */ + assignIn( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assignIn + */ + assignIn( + source: TSource + ): LoDashImplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2 + ): LoDashImplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashImplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(): LoDashImplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assignIn + */ + assignIn( + source: TSource + ): LoDashExplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2 + ): LoDashExplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashExplicitObjectWrapper; + + /** + * @see assignIn + */ + assignIn( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(): LoDashExplicitObjectWrapper; + + /** + * @see _.assignIn + */ + assignIn(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.assignInWith + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * This method is like `_.assignIn` except that it accepts `customizer` which + * is invoked to produce the assigned values. If `customizer` returns `undefined` + * assignment is handled by the method instead. The `customizer` is invoked + * with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + assignInWith( + object: TObject, + source: TSource, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignInWith + */ + assignInWith( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignInWith + */ + assignInWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): TResult; + + /** + * @see assignInWith + */ + assignInWith + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): TResult; + + /** + * @see _.assignInWith + */ + assignInWith(object: TObject): TObject; + + /** + * @see _.assignInWith + */ + assignInWith( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assignInWith + */ + assignInWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(): LoDashImplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assignInWith + */ + assignInWith( + source: TSource, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see assignInWith + */ + assignInWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: AssignCustomizer + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(): LoDashExplicitObjectWrapper; + + /** + * @see _.assignInWith + */ + assignInWith(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + //_.create interface LoDashStatic { /** @@ -12587,12 +13503,25 @@ declare module _ { //_.functions interface LoDashStatic { /** - * Creates an array of function property names from all enumerable properties, own and inherited, of object. + * Creates an array of function property names from own enumerable properties + * of `object`. * - * @alias _.methods + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the new array of property names. + * @example * - * @param object The object to inspect. - * @return Returns the new array of property names. + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] */ functions(object: any): string[]; } @@ -12611,6 +13540,46 @@ declare module _ { functions(): _.LoDashExplicitArrayWrapper; } + //_.functionsIn + interface LoDashStatic { + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the new array of property names. + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + functionsIn(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functionsIn + */ + functionsIn(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functionsIn + */ + functionsIn(): _.LoDashExplicitArrayWrapper; + } + //_.get interface LoDashStatic { /** @@ -12639,11 +13608,30 @@ declare module _ { //_.has interface LoDashStatic { /** - * Checks if path is a direct property. + * Checks if `path` is a direct property of `object`. * - * @param object The object to query. - * @param path The path to check. - * @return Returns true if path is a direct property, else false. + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false */ has( object: T, @@ -12665,6 +13653,53 @@ declare module _ { has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; } + //_.hasIn + interface LoDashStatic { + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b.c'); + * // => true + * + * _.hasIn(object, ['a', 'b', 'c']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + hasIn( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + //_.invert interface LoDashStatic { /** @@ -12959,29 +13994,39 @@ declare module _ { } //_.merge - interface MergeCustomizer { - (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; - } - interface LoDashStatic { /** - * Recursively merges own enumerable properties of the source object(s), that don’t resolve to undefined into - * the destination object. Subsequent sources overwrite property assignments of previous sources. If customizer - * is provided it’s invoked to produce the merged values of the destination and source properties. If - * customizer returns undefined merging is handled by the method instead. The customizer is bound to thisArg - * and invoked with five arguments: (objectValue, sourceValue, key, object, source). + * Recursively merges own and inherited enumerable properties of source + * objects into the destination object, skipping source properties that resolve + * to `undefined`. Array and plain object properties are merged recursively. + * Other objects and value types are overridden by assignment. Source objects + * are applied from left to right. Subsequent sources overwrite property + * assignments of previous sources. * - * @param object The destination object. - * @param source The source objects. - * @param customizer The function to customize assigned values. - * @param thisArg The this binding of customizer. - * @return Returns object. + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } */ merge( object: TObject, - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): TObject & TSource; /** @@ -12990,9 +14035,7 @@ declare module _ { merge( object: TObject, source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): TObject & TSource1 & TSource2; /** @@ -13002,9 +14045,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): TObject & TSource1 & TSource2 & TSource3; /** @@ -13015,10 +14056,8 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any - ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + source4: TSource4 + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** * @see _.merge @@ -13034,9 +14073,7 @@ declare module _ { * @see _.merge */ merge( - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): LoDashImplicitObjectWrapper; /** @@ -13044,9 +14081,7 @@ declare module _ { */ merge( source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): LoDashImplicitObjectWrapper; /** @@ -13055,9 +14090,7 @@ declare module _ { merge( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): LoDashImplicitObjectWrapper; /** @@ -13067,9 +14100,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any + source4: TSource4 ): LoDashImplicitObjectWrapper; /** @@ -13080,49 +14111,202 @@ declare module _ { ): LoDashImplicitObjectWrapper; } - //_.methods + interface LoDashExplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2 + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.mergeWith + interface MergeWithCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + interface LoDashStatic { /** - * @see _.functions + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined` merging is handled by the + * method instead. The `customizer` is invoked with seven arguments: + * (objValue, srcValue, key, object, source, stack). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, customizer); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } */ - methods(object: any): string[]; + mergeWith( + object: TObject, + source: TSource, + customizer: MergeWithCustomizer + ): TObject & TSource; + + /** + * @see _.mergeWith + */ + mergeWith( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer: MergeWithCustomizer + ): TObject & TSource1 & TSource2; + + /** + * @see _.mergeWith + */ + mergeWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: MergeWithCustomizer + ): TObject & TSource1 & TSource2 & TSource3; + + /** + * @see _.mergeWith + */ + mergeWith( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: MergeWithCustomizer + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + + /** + * @see _.mergeWith + */ + mergeWith( + object: any, + ...otherArgs: any[] + ): TResult; } interface LoDashImplicitObjectWrapper { /** - * @see _.functions + * @see _.mergeWith */ - methods(): _.LoDashImplicitArrayWrapper; - } + mergeWith( + source: TSource, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; - interface LoDashExplicitObjectWrapper { /** - * @see _.functions + * @see _.mergeWith */ - methods(): _.LoDashExplicitArrayWrapper; + mergeWith( + source1: TSource1, + source2: TSource2, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + mergeWith( + ...otherArgs: any[] + ): LoDashImplicitObjectWrapper; } //_.omit interface LoDashStatic { /** - * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable - * properties of object that are not omitted. + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that are not omitted. * - * @param object The source object. - * @param predicate The function invoked per iteration or property names to omit, specified as individual - * property names or arrays of property names. - * @param thisArg The this binding of predicate. - * @return Returns the new object. + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [props] The property names to omit, specified + * individually or in arrays.. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } */ - omit( - object: T, - predicate: ObjectIterator, - thisArg?: any - ): TResult; - /** - * @see _.omit - */ omit( object: T, ...predicate: (StringRepresentable|StringRepresentable[])[] @@ -13130,13 +14314,6 @@ declare module _ { } interface LoDashImplicitObjectWrapper { - /** - * @see _.omit - */ - omit( - predicate: ObjectIterator, - thisArg?: any - ): LoDashImplicitObjectWrapper; /** * @see _.omit @@ -13147,13 +14324,6 @@ declare module _ { } interface LoDashExplicitObjectWrapper { - /** - * @see _.omit - */ - omit( - predicate: ObjectIterator, - thisArg?: any - ): LoDashExplicitObjectWrapper; /** * @see _.omit @@ -13163,7 +14333,51 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.pairs + //_.omitBy + interface LoDashStatic { + /** + * The opposite of `_.pickBy`; this method creates an object composed of the + * own and inherited enumerable properties of `object` that `predicate` + * doesn't return truthy for. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + omitBy( + object: T, + predicate: ObjectIterator + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.omitBy + */ + omitBy( + predicate: ObjectIterator + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omitBy + */ + omitBy( + predicate: ObjectIterator + ): LoDashExplicitObjectWrapper; + } + + //_.toPairs interface LoDashStatic { /** * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. @@ -13171,47 +14385,43 @@ declare module _ { * @param object The object to query. * @return Returns the new array of key-value pairs. */ - pairs(object?: T): any[][]; + toPairs(object?: T): any[][]; - pairs(object?: T): TResult[][]; + toPairs(object?: T): TResult[][]; } interface LoDashImplicitObjectWrapper { /** - * @see _.pairs + * @see _.toPairs */ - pairs(): LoDashImplicitArrayWrapper; + toPairs(): LoDashImplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { /** - * @see _.pairs + * @see _.toPairs */ - pairs(): LoDashExplicitArrayWrapper; + toPairs(): LoDashExplicitArrayWrapper; } //_.pick interface LoDashStatic { /** - * Creates an object composed of the picked object properties. Property names may be specified as individual - * arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object - * picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with - * three arguments: (value, key, object). + * Creates an object composed of the picked `object` properties. * - * @param object The source object. - * @param predicate The function invoked per iteration or property names to pick, specified as individual - * property names or arrays of property names. - * @param thisArg The this binding of predicate. - * @return Returns the new object. - */ - pick( - object: T, - predicate: ObjectIterator, - thisArg?: any - ): TResult; - - /** - * @see _.pick + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [props] The property names to pick, specified + * individually or in arrays. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } */ pick( object: T, @@ -13220,14 +14430,6 @@ declare module _ { } interface LoDashImplicitObjectWrapper { - /** - * @see _.pick - */ - pick( - predicate: ObjectIterator, - thisArg?: any - ): LoDashImplicitObjectWrapper; - /** * @see _.pick */ @@ -13237,14 +14439,6 @@ declare module _ { } interface LoDashExplicitObjectWrapper { - /** - * @see _.pick - */ - pick( - predicate: ObjectIterator, - thisArg?: any - ): LoDashExplicitObjectWrapper; - /** * @see _.pick */ @@ -13253,6 +14447,49 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.pickBy + interface LoDashStatic { + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|Object|string} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + pickBy( + object: T, + predicate: ObjectIterator + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pickBy + */ + pickBy( + predicate: ObjectIterator + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pickBy + */ + pickBy( + predicate: ObjectIterator + ): LoDashExplicitObjectWrapper; + } + //_.result interface LoDashStatic { /** @@ -13667,6 +14904,79 @@ declare module _ { kebabCase(): LoDashExplicitWrapper; } + //_.lowerCase + interface LoDashStatic { + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + lowerCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.lowerCase + */ + lowerCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.lowerCase + */ + lowerCase(): LoDashExplicitWrapper; + } + + //_.lowerFirst + interface LoDashStatic { + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + lowerFirst(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.lowerFirst + */ + lowerFirst(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.lowerFirst + */ + lowerFirst(): LoDashExplicitWrapper; + } + //_.pad interface LoDashStatic { /** @@ -13705,7 +15015,7 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.padLeft + //_.padStart interface LoDashStatic { /** * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed @@ -13716,7 +15026,7 @@ declare module _ { * @param chars The string used as padding. * @return Returns the padded string. */ - padLeft( + padStart( string?: string, length?: number, chars?: string @@ -13725,9 +15035,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.padLeft + * @see _.padStart */ - padLeft( + padStart( length?: number, chars?: string ): string; @@ -13735,15 +15045,15 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.padLeft + * @see _.padStart */ - padLeft( + padStart( length?: number, chars?: string ): LoDashExplicitWrapper; } - //_.padRight + //_.padEnd interface LoDashStatic { /** * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed @@ -13754,7 +15064,7 @@ declare module _ { * @param chars The string used as padding. * @return Returns the padded string. */ - padRight( + padEnd( string?: string, length?: number, chars?: string @@ -13763,9 +15073,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.padRight + * @see _.padEnd */ - padRight( + padEnd( length?: number, chars?: string ): string; @@ -13773,9 +15083,9 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.padRight + * @see _.padEnd */ - padRight( + padEnd( length?: number, chars?: string ): LoDashExplicitWrapper; @@ -13989,6 +15299,82 @@ declare module _ { template(options?: TemplateOptions): LoDashExplicitObjectWrapper; } + //_.toLower + interface LoDashStatic { + /** + * Converts `string`, as a whole, to lower case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.toLower('--Foo-Bar'); + * // => '--foo-bar' + * + * _.toLower('fooBar'); + * // => 'foobar' + * + * _.toLower('__FOO_BAR__'); + * // => '__foo_bar__' + */ + toLower(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toLower + */ + toLower(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toLower + */ + toLower(): LoDashExplicitWrapper; + } + + //_.toUpper + interface LoDashStatic { + /** + * Converts `string`, as a whole, to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * _.toUpper('--foo-bar'); + * // => '--FOO-BAR' + * + * _.toUpper('fooBar'); + * // => 'FOOBAR' + * + * _.toUpper('__foo_bar__'); + * // => '__FOO_BAR__' + */ + toUpper(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toUpper + */ + toUpper(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toUpper + */ + toUpper(): LoDashExplicitWrapper; + } + //_.trim interface LoDashStatic { /** @@ -14018,7 +15404,7 @@ declare module _ { trim(chars?: string): LoDashExplicitWrapper; } - //_.trimLeft + //_.trimStart interface LoDashStatic { /** * Removes leading whitespace or specified characters from string. @@ -14027,7 +15413,7 @@ declare module _ { * @param chars The characters to trim. * @return Returns the trimmed string. */ - trimLeft( + trimStart( string?: string, chars?: string ): string; @@ -14035,19 +15421,19 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.trimLeft + * @see _.trimStart */ - trimLeft(chars?: string): string; + trimStart(chars?: string): string; } interface LoDashExplicitWrapper { /** - * @see _.trimLeft + * @see _.trimStart */ - trimLeft(chars?: string): LoDashExplicitWrapper; + trimStart(chars?: string): LoDashExplicitWrapper; } - //_.trimRight + //_.trimEnd interface LoDashStatic { /** * Removes trailing whitespace or specified characters from string. @@ -14056,7 +15442,7 @@ declare module _ { * @param chars The characters to trim. * @return Returns the trimmed string. */ - trimRight( + trimEnd( string?: string, chars?: string ): string; @@ -14064,20 +15450,20 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.trimRight + * @see _.trimEnd */ - trimRight(chars?: string): string; + trimEnd(chars?: string): string; } interface LoDashExplicitWrapper { /** - * @see _.trimRight + * @see _.trimEnd */ - trimRight(chars?: string): LoDashExplicitWrapper; + trimEnd(chars?: string): LoDashExplicitWrapper; } - //_.trunc - interface TruncOptions { + //_.truncate + interface TruncateOptions { /** The maximum string length. */ length?: number; /** The string to indicate text is omitted. */ @@ -14095,24 +15481,97 @@ declare module _ { * @param options The options object or maximum string length. * @return Returns the truncated string. */ - trunc( + truncate( string?: string, - options?: TruncOptions|number + options?: TruncateOptions|number ): string; } interface LoDashImplicitWrapper { /** - * @see _.trunc + * @see _.truncate */ - trunc(options?: TruncOptions|number): string; + truncate(options?: TruncateOptions|number): string; } interface LoDashExplicitWrapper { /** - * @see _.trunc + * @see _.truncate */ - trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + truncate(options?: TruncateOptions|number): LoDashExplicitWrapper; + } + + //_.upperCase + interface LoDashStatic { + /** + * Converts `string`, as space separated words, to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * _.upperCase('--foo-bar'); + * // => 'FOO BAR' + * + * _.upperCase('fooBar'); + * // => 'FOO BAR' + * + * _.upperCase('__foo_bar__'); + * // => 'FOO BAR' + */ + upperCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.upperCase + */ + upperCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.upperCase + */ + upperCase(): LoDashExplicitWrapper; + } + + //_.upperFirst + interface LoDashStatic { + /** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ + upperFirst(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.upperFirst + */ + upperFirst(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.upperFirst + */ + upperFirst(): LoDashExplicitWrapper; } //_.unescape @@ -14144,11 +15603,22 @@ declare module _ { //_.words interface LoDashStatic { /** - * Splits string into an array of its words. + * Splits `string` into an array of its words. * - * @param string The string to inspect. - * @param pattern The pattern to match words. - * @return Returns the words of string. + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] */ words( string?: string, @@ -14200,83 +15670,6 @@ declare module _ { attempt(): LoDashExplicitObjectWrapper; } - //_.callback - interface LoDashStatic { - /** - * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. - * If func is a property name the created callback returns the property value for a given element. If func is - * an object the created callback returns true for elements that contain the equivalent object properties, - * otherwise it returns false. - * - * @param func The value to convert to a callback. - * @param thisArg The this binding of func. - * @result Returns the callback. - */ - callback( - func: Function, - thisArg?: any - ): (...args: any[]) => TResult; - - /** - * @see _.callback - */ - callback( - func: string, - thisArg?: any - ): (object: any) => TResult; - - /** - * @see _.callback - */ - callback( - func: Object, - thisArg?: any - ): (object: any) => boolean; - - /** - * @see _.callback - */ - callback(): (value: TResult) => TResult; - } - - interface LoDashImplicitWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; - - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; - } - - interface LoDashExplicitWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; - - /** - * @see _.callback - */ - callback(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; - } - //_.constant interface LoDashStatic { /** @@ -14336,7 +15729,33 @@ declare module _ { //_.iteratee interface LoDashStatic { /** - * @see _.callback + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name the created callback returns the + * property value for a given element. If `func` is an object the created + * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * + * @static + * @memberOf _ + * @category Util + * @param {*} [func=_.identity] The value to convert to a callback. + * @returns {Function} Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // create custom iteratee shorthands + * _.iteratee = _.wrap(_.iteratee, function(callback, func) { + * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); + * return !p ? callback(func) : function(object) { + * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * }; + * }); + * + * _.filter(users, 'age > 36'); + * // => [{ 'user': 'fred', 'age': 40 }] */ iteratee( func: Function, @@ -14344,7 +15763,7 @@ declare module _ { ): (...args: any[]) => TResult; /** - * @see _.callback + * @see _.iteratee */ iteratee( func: string, @@ -14352,7 +15771,7 @@ declare module _ { ): (object: any) => TResult; /** - * @see _.callback + * @see _.iteratee */ iteratee( func: Object, @@ -14360,45 +15779,45 @@ declare module _ { ): (object: any) => boolean; /** - * @see _.callback + * @see _.iteratee */ iteratee(): (value: TResult) => TResult; } interface LoDashImplicitWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; } interface LoDashImplicitObjectWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; } interface LoDashExplicitWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; } interface LoDashExplicitObjectWrapper { /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; /** - * @see _.callback + * @see _.iteratee */ iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; } @@ -14831,6 +16250,77 @@ declare module _ { ): LoDashExplicitArrayWrapper; } + //_.rangeRight + interface LoDashStatic { + /** + * This method is like `_.range` except that it populates values in + * descending order. + * + * @static + * @memberOf _ + * @category Util + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @param {number} [step=1] The value to increment or decrement by. + * @returns {Array} Returns the new array of numbers. + * @example + * + * _.rangeRight(4); + * // => [3, 2, 1, 0] + * + * _.rangeRight(-4); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 5); + * // => [4, 3, 2, 1] + * + * _.rangeRight(0, 20, 5); + * // => [15, 10, 5, 0] + * + * _.rangeRight(0, -4, -1); + * // => [-3, -2, -1, 0] + * + * _.rangeRight(1, 4, 0); + * // => [1, 1, 1] + * + * _.rangeRight(0); + * // => [] + */ + rangeRight( + start: number, + end: number, + step?: number + ): number[]; + + /** + * @see _.rangeRight + */ + rangeRight( + end: number, + step?: number + ): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashExplicitArrayWrapper; + } + //_.runInContext interface LoDashStatic { /** @@ -14902,6 +16392,50 @@ declare module _ { times(): LoDashExplicitArrayWrapper; } + //_.toPath + interface LoDashStatic { + /** + * Converts `value` to a property path array. + * + * @static + * @memberOf _ + * @category Util + * @param {*} value The value to convert. + * @returns {Array} Returns the new property path array. + * @example + * + * _.toPath('a.b.c'); + * // => ['a', 'b', 'c'] + * + * _.toPath('a[0].b.c'); + * // => ['a', '0', 'b', 'c'] + * + * var path = ['a', 'b', 'c'], + * newPath = _.toPath(path); + * + * console.log(newPath); + * // => ['a', 'b', 'c'] + * + * console.log(path === newPath); + * // => false + */ + toPath(value: any): string[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPath + */ + toPath(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toPath + */ + toPath(): LoDashExplicitWrapper; + } + //_.uniqueId interface LoDashStatic { /** diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 4888b9f51..ab172a122 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -8,6 +8,19 @@ declare module "log4js" { import express = require('express'); + /** + * Replaces the console + * @param logger + * @returns void + */ + export function replaceConsole(logger?: Logger): void; + + /** + * Restores the console + * @returns void + */ + export function restoreConsole(): void; + /** * Get a logger instance. Instance is cached on categoryName level. * @@ -137,7 +150,7 @@ declare module "log4js" { } export interface ConsoleAppenderConfig extends AppenderConfigBase {} - + export interface FileAppenderConfig extends AppenderConfigBase { filename: string; } @@ -156,24 +169,24 @@ declare module "log4js" { pattern: string; alwaysIncludePattern: boolean; } - + export interface SmtpAppenderConfig extends AppenderConfigBase { /** Comma separated list of email recipients */ recipients: string; - + /** Sender of all emails (defaults to transport user) */ sender: string; - + /** Subject of all email messages (defaults to first event's message)*/ subject: string; - + /** * The time in seconds between sending attempts (defaults to 0). * All events are buffered and sent in one email during this time. * If 0 then every event sends an email */ sendInterval: number; - + SMTP: { host: string; secure: boolean; @@ -190,14 +203,14 @@ declare module "log4js" { backup: number; pollInterval: number; } - + export interface GelfAppenderConfig extends AppenderConfigBase { host: string; hostname: string; port: string; facility: string; } - + export interface MultiprocessAppenderConfig extends AppenderConfigBase { mode: string; loggerPort: number; @@ -205,25 +218,25 @@ declare module "log4js" { facility: string; appender?: AppenderConfig; } - + export interface LogglyAppenderConfig extends AppenderConfigBase { /** Loggly customer token - https://www.loggly.com/docs/api-sending-data/ */ token: string; - + /** Loggly customer subdomain (use 'abc' for abc.loggly.com) */ subdomain: string; - + /** an array of strings to help segment your data & narrow down search results in Loggly */ tags: string[]; - + /** Enable JSON logging by setting to 'true' */ json: boolean; } - + export interface ClusteredAppenderConfig extends AppenderConfigBase { appenders?: AppenderConfig[]; } - + type CoreAppenderConfig = ConsoleAppenderConfig | FileAppenderConfig | DateFileAppenderConfig @@ -233,11 +246,10 @@ declare module "log4js" { | MultiprocessAppenderConfig | LogglyAppenderConfig | ClusteredAppenderConfig - + interface CustomAppenderConfig extends AppenderConfigBase { [prop: string]: any; } type AppenderConfig = CoreAppenderConfig | CustomAppenderConfig; } - diff --git a/marionette/marionette-tests.ts b/marionette/marionette-tests.ts index 7483c7e2f..411ddc9b6 100644 --- a/marionette/marionette-tests.ts +++ b/marionette/marionette-tests.ts @@ -60,6 +60,12 @@ module Marionette.Tests { this.mainRegion = new Marionette.Region({ el: '#main' }); this.layoutView.addRegion('main', this.mainRegion); this.layoutView.render(); + this.layoutView.showChildView('main', new MyView(new MyModel)); + let view: Backbone.View = this.layoutView.getChildView('main'); + let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions(); + let prefix: string = this.layoutView.childViewEventPrefix; + let region: Marionette.Region = this.layoutView.removeRegion('main'); + let layout: Marionette.LayoutView = this.layoutView.destroy(); } } @@ -292,6 +298,10 @@ module Marionette.Tests { var cv = new MyCollectionView(); cv.collection.add(new MyModel()); app.mainRegion.attachView(cv); + cv.addEmptyView(new MyModel, MyView); + cv.proxyChildEvents(new MyView(new MyModel)); + let children: Backbone.ChildViewContainer> = cv.destroyChildren(); + let view: Marionette.CollectionView> = cv.destroy(); } class MyController extends Marionette.Controller { diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 314fcc432..4209677d2 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -348,6 +348,10 @@ declare module Marionette { */ empty(): any; + /** + * @returns view that this region has. + */ + currentView: Backbone.View; } interface RegionDefaults { @@ -792,6 +796,13 @@ declare module Marionette { * This event / callback is useful for DOM-dependent UI plugins such as jQueryUI or KendoUI. */ onDomRefresh(): void; + + /** + * Internal properties extended in Marionette.View. + */ + isDestroyed: boolean; + supportsRenderLifecycle: boolean; + supportsDestroyLifecycle: boolean; } /** @@ -846,6 +857,23 @@ declare module Marionette { * on initialize. */ sort?: boolean; + + /** + * This option is useful when you have performance issues when you + * resort your CollectionView. Without this option, your CollectionView + * will be completely re-rendered, which can be costly if you have a + * large number of elements or if your ChildViews are complex. If this + * option is activated, when you sort your Collection, there will be no + * re-rendering, only the DOM nodes will be reordered. This can be a + * problem if your ChildViews use their collection's index in their + * rendering. In this case, you cannot use this option as you need to + * re-render each ChildView. + * + * If you combine this option with a filter that changes the views that + * are to be displayed, reorderOnSort will be bypassed to render new + * children and remove those that are rejected by the filter. + */ + reorderOnSort?: boolean; } /** @@ -935,6 +963,7 @@ declare module Marionette { */ addChild(item: any, ChildView: TView, index: Number): void; + /** Render the child view */ renderChildView(view: TView, index: Number): void; /** @@ -949,7 +978,7 @@ declare module Marionette { * Remove the child view and destroy it. This function also updates the indices of * later views in the collection in order to keep the children in sync with the collection. */ - removeChildView(view: TView): void; + removeChildView(view: TView): TView; /** * Determines if the view is empty. If you want to control when the empty @@ -962,7 +991,11 @@ declare module Marionette { */ checkEmpty(): void; - destroyChildren(): void; + /** + * Destroy the child views that this collection view + * is holding on to, if any. This returns destroyed children. + */ + destroyChildren(): Backbone.ChildViewContainer; /** * By default the CollectionView will maintain the order of its collection @@ -1003,6 +1036,51 @@ declare module Marionette { */ getEmptyView(): any; + /** Serialize a collection by serializing each of its models. */ + serializeCollection(): any; + + /** + * Attaches the content of a given view. + * This method can be overridden to optimize rendering, + * or to render in a non standard way. + * + * For example, using `innerHTML` instead of `$el.html` + * + * @example + * attachElContent: function(html) { + * this.el.innerHTML = html; + * return this; + * } + */ + attachElContent(html: string): ItemView; + + /** + * Reorder DOM after sorting. When your element's rendering + * do not use their index, you can pass reorderOnSort: true + * to only reorder the DOM after a sort instead of rendering + * all the collectionView + */ + reorder(): void; + + /** + * Render and show the emptyView. Similar to addChild method + * but "add:child" events are not fired, and the event from + * emptyView are not forwarded + */ + addEmptyView(child: TModel, EmptyView: new (...args: any[]) => any): void; + + /** + * Handle cleanup and other destroying needs for the collection of views + */ + destroy(): CollectionView; + + /** + * Set up the child view event forwarding. Uses a "childview:" + * prefix in front of all forwarded events. + * @param view it might be ChildView or EmptyView. + */ + proxyChildEvents(view: any): void; + /** * Called just prior to rendering the collection view. */ @@ -1102,36 +1180,50 @@ declare module Marionette { * The LayoutView takes an additional parameter where you can pass the regions as option on creation. */ regions?:any; + + /** + * This option removes the layoutView from the DOM before destroying the + * children preventing repaints as each option is removed. However, it + * makes it difficult to do close animations for a child view (false by + * default) + */ + destroyImmediate?: boolean; } /** - * A LayoutView is a hybrid of an ItemView and a collection of Region objects. - * They are ideal for rendering application layouts with multiple sub-regions + * A LayoutView is a hybrid of an ItemView and a collection of Region objects. + * They are ideal for rendering application layouts with multiple sub-regions * managed by specified region managers. - * A layoutView can also act as a composite-view to aggregate multiple views - * and sub-application areas of the screen allowing applications to attach + * A layoutView can also act as a composite-view to aggregate multiple views + * and sub-application areas of the screen allowing applications to attach * multiple region managers to dynamically rendered HTML. * You can create complex views by nesting layoutView managers within Regions. */ class LayoutView extends ItemView { /** - * f you have the need to replace the Region with a region class of your - * own implementation, you can specify an alternate class to use with this + * If you have the need to replace the Region with a region class of your + * own implementation, you can specify an alternate class to use with this * property. */ regionClass: any; /** * Constructor. - * A hash that can contain a regions hash that allows you to specify regions per + * A hash that can contain a regions hash that allows you to specify regions per * LayoutView instance. */ constructor(options?: LayoutViewOptions); /** - * Regions hash or a method returning the regions hash that maps regions/selectors to methods on your View. + * Handle destroying regions, and then destroy the view itself. + */ + destroy(): LayoutView; + + /** + * Regions hash or a method returning the regions hash that maps + * regions/selectors to methods on your View. **/ - regions():any; + regions(): any; /** Adds a region to the layout view. */ addRegion(name: string, definition: any): Region; @@ -1140,26 +1232,52 @@ declare module Marionette { * Add multiple regions as a {name: definition, name2: def2} object literal. */ addRegions(regions: any): any; - - /** Returns a region from the layout view */ + + /** Returns a region from the layout view */ getRegion(name: string): Region; /** - * Renders the view. + * Renders the view. It will use the existing region objects the first + * time it is called. Subsequent calls will destroy the views that the + * regions are showing and then reset the `el` for the regions to the + * newly rendered DOM elements. */ render(): LayoutView; - /** + /** * Removes the region with the specified name. * @param name the name of the region to remove. */ - removeRegion(name: string): any; + removeRegion(name: string): Region; /** Enable easy overriding of the default `RegionManager` * for customized region interactions and business specific * view logic for better control over single regions. */ getRegionManager(): RegionManager; + + /** + * Show a view into the region specified by `regionName`. + */ + showChildView(regionName: string, view: any, options?: RegionShowOptions): void; + + /** + * Get the current view that is shown in the region specified by + * `regionName`. + */ + getChildView(regionName: string): Backbone.View; + + /** + * Returns all regions from the layout view. The results contains an + * Object hash that has `string`s as keys and `Region`s as values. + */ + getRegions(): {[key: string]: Region}; + + /** + * You can customize the event prefix for events that are forwarded through + * the layout view with this property. + */ + childViewEventPrefix: string; } interface AppRouterOptions extends Backbone.RouterOptions { diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index b5875f76d..ffd9b1814 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -23,6 +23,7 @@ import CardActions = require("material-ui/lib/card/card-actions"); import Dialog = require("material-ui/lib/dialog"); import DropDownMenu = require("material-ui/lib/drop-down-menu"); import DatePicker = require("material-ui/lib/date-picker/date-picker"); +import TimePicker = require("material-ui/lib/time-picker"); import RadioButtonGroup = require("material-ui/lib/radio-button-group"); import RadioButton = require("material-ui/lib/radio-button"); import Toggle = require("material-ui/lib/toggle"); @@ -193,6 +194,9 @@ class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implemen element = ; + // "http://material-ui.com/#/components/time-picker" + element = + // "http://material-ui.com/#/components/dialog" let standardActions = [ { text: 'Cancel' }, diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 8e135ce21..e727107cd 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1296,7 +1296,7 @@ declare namespace __MaterialUI { format?: string; pedantic?: boolean; style?: __React.CSSProperties; - textFieldStye?: __React.CSSProperties; + textFieldStyle?: __React.CSSProperties; autoOk?: boolean; openDialog?: () => void; onFocus?: React.FocusEventHandler; diff --git a/matter-js/matter-js-tests.ts b/matter-js/matter-js-tests.ts index 31649fc44..410a9ecea 100644 --- a/matter-js/matter-js-tests.ts +++ b/matter-js/matter-js-tests.ts @@ -7,25 +7,25 @@ var Engine = Matter.Engine, Composites = Matter.Composites, Constraint = Matter.Constraint, Events = Matter.Events, - Query = Matter.Query + Query = Matter.Query; -var engine = Engine.create(document.body) +var engine = Engine.create(); //Bodies -var box1 = Bodies.rectangle(400,200,80,80) +var box1 = Bodies.rectangle(400,200,80,80); var box2 = Bodies.rectangle(400,610,810,60, { angle: 10, angularSpeed: 11, angularVelocity: 1, density: 4, isStatic: true -}) +}); -var circle1 = Bodies.circle(100,100,50) +var circle1 = Bodies.circle(100,100,50); -World.addBody(engine.world, box1) -World.add(engine.world, [box2, circle1]) +World.addBody(engine.world, box1); +World.add(engine.world, [box2, circle1]); //Composites @@ -40,18 +40,18 @@ var constraint1 = Constraint.create({ bodyA: box1, bodyB: box2, stiffness: 0.02 -}) +}); //Query var collisions = Query.ray([box1, box2, circle1], {x:1, y:2}, {x:3, y:4}); -World.addConstraint(engine.world, constraint1) +World.addConstraint(engine.world, constraint1); //events -Events.on(engine, "beforeTick", (e:any)=>{ - -}) +Events.on(engine, "beforeTick", (e:Matter.IEventTimestamped)=>{ + +}); -Engine.run(engine) +Engine.run(engine); diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts index e4c72b13c..ed5412b52 100644 --- a/matter-js/matter-js.d.ts +++ b/matter-js/matter-js.d.ts @@ -1,1480 +1,3156 @@ -// Type definitions for Matter.js 0.8.0 +// Type definitions for Matter.js - EDGE // Project: https://github.com/liabru/matter-js -// Definitions by: Ivane Gegia +// Definitions by: Ivane Gegia , +// David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module 'matter-js' { + export = Matter; +} -declare module Matter -{ - export interface IEngineOptions - { - +declare module Matter { + /** + * The `Matter.Axes` module contains methods for creating and manipulating sets of axes. + * + * @class Axes + */ + export class Axes { + /** + * Creates a new set of axes from the given vertices. + * @method fromVertices + * @param {vertices} vertices + * @return {axes} A new axes from the given vertices + */ + static fromVertices(vertices: Array): Array; + /** + * Rotates a set of axes by the given angle. + * @method rotate + * @param {axes} axes + * @param {number} angle + */ + static rotate(axes: Array, angle: number): void; } - export interface IEngineTimingOptions - { + /** + * The `Matter.Bodies` module contains factory methods for creating rigid body models + * with commonly used body configurations (such as rectangles, circles and other polygons). + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Bodies + */ + export class Bodies { /** - *A Number that specifies the time correction factor to apply to the current timestep. It is automatically handled when using Engine.run, but is also only optional even if you use your own game loop. The value is defined as delta / lastDelta, i.e. the percentage change of delta between steps. This value is always 1 (no correction) when frame rate is constant or engine.timing.isFixed is true. If the framerate and hence delta are changing, then correction should be applied to the current update to account for the change. See the paper on Time Corrected Verlet for more information. + * Creates a new rigid body model with a circle hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method circle + * @param {number} x + * @param {number} y + * @param {number} radius + * @param {object} [options] + * @param {number} [maxSides] + * @return {body} A new circle body */ - correction:number; + static circle(x: number, y: number, radius: number, options?: IBodyDefinition, maxSides?: number): Body; /** - * A Number that specifies the time step between updates in milliseconds. If engine.timing.isFixed is set to true, then delta is fixed. If it is false, then delta can dynamically change to maintain the correct apparant simulation speed. + * Creates a new rigid body model with a regular polygon hull with the given number of sides. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method polygon + * @param {number} x + * @param {number} y + * @param {number} sides + * @param {number} radius + * @param {object} [options] + * @return {body} A new regular polygon body */ - delta:number; + static polygon(x: number, y: number, sides: number, radius: number, options?: IBodyDefinition): Body; /** - * A Number that specifies the global scaling factor of time for all bodies. A value of 0 freezes the simulation. A value of 0.1 gives a slow-motion effect. A value of 1.2 gives a speed-up effect. + * Creates a new rigid body model with a rectangle hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method rectangle + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {object} [options] + * @return {body} A new rectangle body */ - timeScale:number; + static rectangle(x: number, y: number, width: number, height: number, options?: IBodyDefinition): Body; /** - * A Number that specifies the current simulation-time in milliseconds starting from 0. It is incremented on every Engine.update by the timing.delta. + * Creates a new rigid body model with a trapezoid hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method trapezoid + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {number} slope + * @param {object} [options] + * @return {body} A new trapezoid body */ - timestamp:number; - + static trapezoid(x: number, y: number, width: number, height: number, slope: number, options?: IBodyDefinition): Body; /** - * An integer Number that specifies the number of velocity iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. - */ - velocityIterations:number; - + * Creates a body using the supplied vertices (or an array containing multiple sets of vertices). + * If the vertices are convex, they will pass through as supplied. + * Otherwise if the vertices are concave, they will be decomposed if [poly-decomp.js](https://github.com/schteppe/poly-decomp.js) is available. + * Note that this process is not guaranteed to support complex sets of vertices (e.g. those with holes may fail). + * By default the decomposition will discard collinear edges (to improve performance). + * It can also optionally discard any parts that have an area less than `minimumArea`. + * If the vertices can not be decomposed, the result will fall back to using the convex hull. + * The options parameter is an object that specifies any `Matter.Body` properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method fromVertices + * @param {number} x + * @param {number} y + * @param [[vector]] vertexSets + * @param {object} [options] + * @param {bool} [flagInternal=false] + * @param {number} [removeCollinear=0.01] + * @param {number} [minimumArea=10] + * @return {body} + */ + static fromVertices(x: number, y: number, vertexSets: Array>, options?: IBodyDefinition, flagInternal?: boolean, removeCollinear?: number, minimumArea?: number): Body; } - export class Engine - { + export interface IBodyDefinition { /** - * Clears the engine including the world, pairs and broadphase. - * @param engine - */ - static clear(engine:Engine):void; - - /** - * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. - * @param element - * @param options - */ - static create(element?: HTMLElement|IEngineOptions, options?:IEngineOptions):Engine; - - /** - * Merges two engines by keeping the configuration of engineA but replacing the world with the one from engineB. - * @param engineA - * @param engineB - */ - static merge(engineA:Engine, engineB:Engine):void; - - /** - * Renders the world by calling its defined renderer engine.render.controller. Triggers beforeRender and afterRender events. - * @param engineA - * @param engineB - */ - static render(engineA:Engine, engineB:Engine):void; - - /** - * An optional utility function that provides a game loop, that handles updating the engine for you. Calls Engine.update and Engine.render on the requestAnimationFrame event automatically. Handles time correction and non-fixed dynamic timing (if enabled). Triggers beforeTick, tick and afterTick events. - * @param engine - */ - static run(engine:Engine):void; - - /** - * Moves the simulation forward in time by delta ms. Triggers beforeUpdate and afterUpdate events. + * A `Number` specifying the angle of the body, in radians. * - * @param engine - * @param delta - * @param correction - */ - static update(engine:Engine, delta:number, correction?:number):void; - + * @property angle + * @type number + * @default 0 + */ + angle?: number; /** - * An integer Number that specifies the number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. The default value of 2 is usually very adequate. - */ - constraintIterations:number; - + * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). + * + * @readOnly + * @property angularSpeed + * @type number + * @default 0 + */ + angularSpeed?: number; /** - * A flag that specifies whether the engine is running or not. - */ - enabled:boolean; - + * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property angularVelocity + * @type number + * @default 0 + */ + angularVelocity?: number; /** - * A flag that specifies whether the engine should allow sleeping via the Matter.Sleeping module. Sleeping can improve stability and performance, but often at the expense of accuracy. - */ - enableSleeping:boolean; - + * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. + * + * @property area + * @type string + * @default + */ + area?: number; /** - * An integer Number that specifies the number of position iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. - */ - positionIterations:number; - + * An array of unique axis vectors (edge normals) used for collision detection. + * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. + * They are constantly updated by `Body.update` during the simulation. + * + * @property axes + * @type vector[] + */ + axes?: Array; /** - * An instance of a Render controller. The default value is a Matter.Render instance created by Engine.create. One may also develop a custom renderer module based on Matter.Render and pass an instance of it to Engine.create via options.render. - A minimal custom renderer object must define at least three functions: create, clear and world (see Matter.Render). It is also possible to instead pass the module reference via options.render.controller and Engine.create will instantiate one for you. - */ - render:Render; - + * A `Bounds` object that defines the AABB region for the body. + * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. + * + * @property bounds + * @type bounds + */ + bounds?: Bounds; /** - * An Object containing properties regarding the timing systems of the engine. - */ - timing:IEngineTimingOptions; - + * A `Number` that defines the density of the body, that is its mass per unit area. + * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. + * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + * + * @property density + * @type number + * @default 0.001 + */ + density?: number; /** - * A World composite object that will contain all simulated bodies and constraints. - */ - world:World; + * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. + * + * @property force + * @type vector + * @default { x: 0, y: 0 } + */ + force?: Vector; + /** + * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means that the body may slide indefinitely. + * A value of `1` means the body may come to a stop almost instantly after a force is applied. + * + * The effects of the value may be non-linear. + * High values may be unstable depending on the body. + * The engine uses a Coulomb friction model including static and kinetic friction. + * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: + * + * Math.min(bodyA.friction, bodyB.friction) + * + * @property friction + * @type number + * @default 0.1 + */ + friction?: number; + /** + * A `Number` that defines the air friction of the body (air resistance). + * A value of `0` means the body will never slow as it moves through space. + * The higher the value, the faster a body slows when moving through space. + * The effects of the value are non-linear. + * + * @property frictionAir + * @type number + * @default 0.01 + */ + frictionAir?: number; + /** + * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id?: number; + /** + * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. + * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. + * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). + * + * @property inertia + * @type number + */ + inertia?: number; + /** + * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). + * If you modify this value, you must also modify the `body.inertia` property. + * + * @property inverseInertia + * @type number + */ + inverseInertia?: number; + /** + * A `Number` that defines the inverse mass of the body (`1 / mass`). + * If you modify this value, you must also modify the `body.mass` property. + * + * @property inverseMass + * @type number + */ + inverseMass?: number; + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. + * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. + * + * @property isSleeping + * @type boolean + * @default false + */ + isSleeping?: boolean; + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. + * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. + * + * @property isStatic + * @type boolean + * @default false + */ + isStatic?: boolean; + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Body" + */ + + label?: string; + /** + * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. + * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). + * + * @property mass + * @type number + */ + mass?: number; + /** + * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. + * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. + * + * @readOnly + * @property motion + * @type number + * @default 0 + */ + motion?: number; + /** + * A `Vector` that specifies the current world-space position of the body. + * + * @property position + * @type vector + * @default { x: 0, y: */ + position?: Vector; + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render?: IBodyRenderOptions; + /** + * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. + * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. + * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: + * + * Math.max(bodyA.restitution, bodyB.restitution) + * + * @property restitution + * @type number + * @default 0 + */ + restitution?: number; + /** + * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). + * + * @property sleepThreshold + * @type number + * @default 60 + */ + sleepThreshold?: number; + /** + * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. + * Avoid changing this value unless you understand the purpose of `slop` in physics engines. + * The default should generally suffice, although very large bodies may require larger values for stable stacking. + * + * @property slop + * @type number + * @default 0.05 + */ + slop?: number; + /** + * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). + * + * @readOnly + * @property speed + * @type number + * @default 0 + */ + speed?: number; + /** + * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + * + * @property timeScale + * @type number + * @default 1 + */ + timeScale?: number; + /** + * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. + * + * @property torque + * @type number + * @default 0 + */ + torque?: number; + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "body" + */ + type?: string; + /** + * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property velocity + * @type vector + * @default { x: 0, y: 0 } + */ + velocity?: Vector; + /** + * An array of `Vector` objects that specify the convex hull of the rigid body. + * These should be provided about the origin `(0, 0)`. E.g. + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). + * The `Vector` objects are also augmented with additional properties required for efficient collision detection. + * + * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). + * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. + * + * @property vertices + * @type vector[] + */ + vertices?: Array; + /** + * An array of bodies that make up this body. + * The first body in the array must always be a self reference to the current body instance. + * All bodies in the `parts` array together form a single rigid compound body. + * Parts are allowed to overlap, have gaps or holes or even form concave bodies. + * Parts themselves should never be added to a `World`, only the parent body should be. + * Use `Body.setParts` when setting parts to ensure correct updates of all properties. + * + * @property parts + * @type body[] + */ + parts?: Array; + /** + * A self reference if the body is _not_ a part of another body. + * Otherwise this is a reference to the body that this is a part of. + * See `body.parts`. + * + * @property parent + * @type body + */ + parent?: Body; + /** + * A `Number` that defines the static friction of the body (in the Coulomb friction model). + * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. + * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. + * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. + * + * @property frictionStatic + * @type number + * @default 0.5 + */ + frictionStatic?: number; + /** + * An `Object` that specifies the collision filtering properties of this body. + * + * Collisions between two bodies will obey the following rules: + * - If the two bodies have the same non-zero value of `collisionFilter.group`, + * they will always collide if the value is positive, and they will never collide + * if the value is negative. + * - If the two bodies have different values of `collisionFilter.group` or if one + * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: + * + * Each body belongs to a collision category, given by `collisionFilter.category`. This + * value is used as a bit field and the category should have only one bit set, meaning that + * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 + * different collision categories available. + * + * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies + * the categories it collides with (the value is the bitwise AND value of all these categories). + * + * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's + * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` + * are both true. + * + * @property collisionFilter + * @type object + */ + collisionFilter?: ICollisionFilter; + } - interface IWorldOptions - { + export interface IBodyRenderOptions { + + /** + * A flag that indicates if the body should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ + visible: boolean; + + /** + * An `Object` that defines the sprite properties to use when rendering, if any. + * + * @property render.sprite + * @type object + */ + sprite: IBodyRenderOptionsSprite; + + /** + * A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + fillStyle: string; + + /** + * A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered. + Default: 1.5 + */ + lineWidth: number; + + + + /** + * A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + strokeStyle: string; + + + + } + + export interface IBodyRenderOptionsSprite { + /** + * An `String` that defines the path to the image to use as the sprite texture, if any. + * + * @property render.sprite.texture + * @type string + */ + texture: string; + + /** + * A `Number` that defines the scaling in the x-axis for the sprite, if any. + * + * @property render.sprite.xScale + * @type number + * @default 1 + */ + xScale: number; + + /** + * A `Number` that defines the scaling in the y-axis for the sprite, if any. + * + * @property render.sprite.yScale + * @type number + * @default 1 + */ + yScale: number; + } + + /** + * The `Matter.Body` module contains methods for creating and manipulating body models. + * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. + * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + + * @class Body + */ + export class Body { + /** + * Applies a force to a body from a given world-space position, including resulting torque. + * @method applyForce + * @param {body} body + * @param {vector} position + * @param {vector} force + */ + static applyForce(body: Body, position: Vector, force: Vector): void; + + /** + * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {body} body + */ + static create(options: IBodyDefinition): Body; + /** + * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. + * @method rotate + * @param {body} body + * @param {number} rotation + */ + static rotate(body: Body, rotation: number): void; + /** + * Returns the next unique group index for which bodies will collide. + * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide. + * See `body.collisionFilter` for more information. + * @method nextGroup + * @param {bool} [isNonColliding=false] + * @return {Number} Unique group index + */ + static nextGroup(isNonColliding: boolean): number; + /** + * Returns the next unique category bitfield (starting after the initial default category `0x0001`). + * There are 32 available. See `body.collisionFilter` for more information. + * @method nextCategory + * @return {Number} Unique category bitfield + */ + static nextCategory(): number; + /** + * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. + * Prefer to use the actual setter functions in performance critical situations. + * @method set + * @param {body} body + * @param {} settings A property name (or map of properties and values) to set on the body. + * @param {} value The value to set if `settings` is a single property name. + */ + static set(body: Body, settings: any, value?: any): void; + /** + * Sets the mass of the body. Inverse mass and density are automatically updated to reflect the change. + * @method setMass + * @param {body} body + * @param {number} mass + */ + static setMass(body: Body, mass: number): void; + /** + * Sets the density of the body. Mass is automatically updated to reflect the change. + * @method setDensity + * @param {body} body + * @param {number} density + */ + static setDensity(body: Body, density: number): void; + /** + * Sets the moment of inertia (i.e. second moment of area) of the body of the body. + * Inverse inertia is automatically updated to reflect the change. Mass is not changed. + * @method setInertia + * @param {body} body + * @param {number} inertia + */ + static setInterna(body: Body, interna: number): void; + /** + * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`). + * Vertices will be automatically transformed to be orientated around their centre of mass as the origin. + * They are then automatically translated to world space based on `body.position`. + * + * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array). + * Vertices must form a convex hull, concave hulls are not supported. + * + * @method setVertices + * @param {body} body + * @param {vector[]} vertices + */ + static setVertices(body: Body, vertices: Array): void; + /** + * Sets the parts of the `body` and updates mass, inertia and centroid. + * Each part will have its parent set to `body`. + * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` + * Note that this method will ensure that the first part in `body.parts` will always be the `body`. + * @method setParts + * @param {body} body + * @param [body] parts + * @param {bool} [autoHull=true] + */ + static setParts(body: Body, parts: Body, autoHull: boolean): void; + /** + * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged. + * @method setPosition + * @param {body} body + * @param {vector} position + */ + static setPosition(body: Body, position: Vector): void; + /** + * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged. + * @method setAngle + * @param {body} body + * @param {number} angle + */ + static setAngle(body: Body, angle: number): void; + /** + * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. + * @method setVelocity + * @param {body} body + * @param {vector} velocity + */ + static setVelocity(body: Body, velocity: Vector): void; + /** + * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. + * @method setAngularVelocity + * @param {body} body + * @param {number} velocity + */ + static setAngularVelocity(body: Body, velocity: number): void; + + + + /** + * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. + * @method setStatic + * @param {body} body + * @param {bool} isStatic + */ + static setStatic(body: Body, isStatic: boolean): void; + + /** + * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). + * @method scale + * @param {body} body + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} [point] + */ + static scale(body: Body, scaleX: number, scaleY: number, point?: Vector): void; + + /** + * Moves a body by a given vector relative to its current position, without imparting any velocity. + * @method translate + * @param {body} body + * @param {vector} translation + */ + static translate(body: Body, translation: Vector): void; + + /** + * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration. + * @method update + * @param {body} body + * @param {number} deltaTime + * @param {number} timeScale + * @param {number} correction + */ + static update(body: Body, deltaTime: number, timeScale: number, correction: number): void; + + /** + * A `Number` specifying the angle of the body, in radians. + * + * @property angle + * @type number + * @default 0 + */ + angle: number; + /** + * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). + * + * @readOnly + * @property angularSpeed + * @type number + * @default 0 + */ + angularSpeed: number; + /** + * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property angularVelocity + * @type number + * @default 0 + */ + angularVelocity: number; + /** + * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. + * + * @property area + * @type string + * @default + */ + area: number; + /** + * An array of unique axis vectors (edge normals) used for collision detection. + * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. + * They are constantly updated by `Body.update` during the simulation. + * + * @property axes + * @type vector[] + */ + axes: Array; + /** + * A `Bounds` object that defines the AABB region for the body. + * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. + * + * @property bounds + * @type bounds + */ + bounds: Bounds; + /** + * A `Number` that defines the density of the body, that is its mass per unit area. + * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. + * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + * + * @property density + * @type number + * @default 0.001 + */ + density: number; + /** + * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. + * + * @property force + * @type vector + * @default { x: 0, y: 0 } + */ + force: Vector; + /** + * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means that the body may slide indefinitely. + * A value of `1` means the body may come to a stop almost instantly after a force is applied. + * + * The effects of the value may be non-linear. + * High values may be unstable depending on the body. + * The engine uses a Coulomb friction model including static and kinetic friction. + * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: + * + * Math.min(bodyA.friction, bodyB.friction) + * + * @property friction + * @type number + * @default 0.1 + */ + friction: number; + /** + * A `Number` that defines the air friction of the body (air resistance). + * A value of `0` means the body will never slow as it moves through space. + * The higher the value, the faster a body slows when moving through space. + * The effects of the value are non-linear. + * + * @property frictionAir + * @type number + * @default 0.01 + */ + frictionAir: number; + /** + * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id: number; + /** + * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. + * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. + * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). + * + * @property inertia + * @type number + */ + inertia: number; + /** + * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). + * If you modify this value, you must also modify the `body.inertia` property. + * + * @property inverseInertia + * @type number + */ + inverseInertia: number; + /** + * A `Number` that defines the inverse mass of the body (`1 / mass`). + * If you modify this value, you must also modify the `body.mass` property. + * + * @property inverseMass + * @type number + */ + inverseMass: number; + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. + * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. + * + * @property isSleeping + * @type boolean + * @default false + */ + isSleeping: boolean; + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. + * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. + * + * @property isStatic + * @type boolean + * @default false + */ + isStatic: boolean; + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Body" + */ + + label: string; + /** + * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. + * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). + * + * @property mass + * @type number + */ + mass: number; + /** + * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. + * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. + * + * @readOnly + * @property motion + * @type number + * @default 0 + */ + motion: number; + /** + * A `Vector` that specifies the current world-space position of the body. + * + * @property position + * @type vector + * @default { x: 0, y: */ + position: Vector; + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render: IBodyRenderOptions; + /** + * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. + * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. + * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: + * + * Math.max(bodyA.restitution, bodyB.restitution) + * + * @property restitution + * @type number + * @default 0 + */ + restitution: number; + /** + * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). + * + * @property sleepThreshold + * @type number + * @default 60 + */ + sleepThreshold: number; + /** + * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. + * Avoid changing this value unless you understand the purpose of `slop` in physics engines. + * The default should generally suffice, although very large bodies may require larger values for stable stacking. + * + * @property slop + * @type number + * @default 0.05 + */ + slop: number; + /** + * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). + * + * @readOnly + * @property speed + * @type number + * @default 0 + */ + speed: number; + /** + * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + * + * @property timeScale + * @type number + * @default 1 + */ + timeScale: number; + /** + * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. + * + * @property torque + * @type number + * @default 0 + */ + torque: number; + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "body" + */ + type: string; + /** + * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property velocity + * @type vector + * @default { x: 0, y: 0 } + */ + velocity: Vector; + /** + * An array of `Vector` objects that specify the convex hull of the rigid body. + * These should be provided about the origin `(0, 0)`. E.g. + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). + * The `Vector` objects are also augmented with additional properties required for efficient collision detection. + * + * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). + * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. + * + * @property vertices + * @type vector[] + */ + vertices: Array; + /** + * An array of bodies that make up this body. + * The first body in the array must always be a self reference to the current body instance. + * All bodies in the `parts` array together form a single rigid compound body. + * Parts are allowed to overlap, have gaps or holes or even form concave bodies. + * Parts themselves should never be added to a `World`, only the parent body should be. + * Use `Body.setParts` when setting parts to ensure correct updates of all properties. + * + * @property parts + * @type body[] + */ + parts: Array; + /** + * A self reference if the body is _not_ a part of another body. + * Otherwise this is a reference to the body that this is a part of. + * See `body.parts`. + * + * @property parent + * @type body + */ + parent: Body; + /** + * A `Number` that defines the static friction of the body (in the Coulomb friction model). + * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. + * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. + * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. + * + * @property frictionStatic + * @type number + * @default 0.5 + */ + frictionStatic: number; + /** + * An `Object` that specifies the collision filtering properties of this body. + * + * Collisions between two bodies will obey the following rules: + * - If the two bodies have the same non-zero value of `collisionFilter.group`, + * they will always collide if the value is positive, and they will never collide + * if the value is negative. + * - If the two bodies have different values of `collisionFilter.group` or if one + * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: + * + * Each body belongs to a collision category, given by `collisionFilter.category`. This + * value is used as a bit field and the category should have only one bit set, meaning that + * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 + * different collision categories available. + * + * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies + * the categories it collides with (the value is the bitwise AND value of all these categories). + * + * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's + * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` + * are both true. + * + * @property collisionFilter + * @type object + */ + collisionFilter: ICollisionFilter; + + } + + export interface IBound { + min: { x: number, y: number } + max: { x: number, y: number } + } + + /** + * Internal Class, not generally used outside of the engine's internals. + * The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). + * + * @class Bounds + */ + export class Bounds { + + } + + export interface ICompositeDefinition { + /** + * An array of `Body` that are _direct_ children of this composite. + * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. + * + * @property bodies + * @type body[] + * @default [] + */ + bodies?: Array; + + /** + * An array of `Composite` that are _direct_ children of this composite. + * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. + * + * @property composites + * @type composite[] + * @default [] + */ + composites?: Array; + + /** + * An array of `Constraint` that are _direct_ children of this composite. + * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. + * + * @property constraints + * @type constraint[] + * @default [] + */ + constraints?: Array; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id?: number; + + /** + * A flag that specifies whether the composite has been modified during the current step. + * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. + * If you need to change it manually, you should use the `Composite.setModified` method. + * + * @property isModified + * @type boolean + * @default false + */ + isModified?: boolean; + + /** + * An arbitrary `String` name to help the user identify and manage composites. + * + * @property label + * @type string + * @default "Composite" + */ + label?: string; + + /** + * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. + * + * @property parent + * @type composite + * @default null + */ + parent?: Composite; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "composite" + */ + type?: String; + } + + /** + * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. + * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. + * It is important to use the functions in this module to modify composites, rather than directly modifying their properties. + * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Composite + */ + export class Composite { + /** + * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. + * Triggers `beforeAdd` and `afterAdd` events on the `composite`. + * @method add + * @param {composite} composite + * @param {} object + * @return {composite} The original composite with the objects added + */ + static add(composite: Composite, object: Body | Composite | Constraint): Composite; + + /** + * Returns all bodies in the given composite, including all bodies in its children, recursively. + * @method allBodies + * @param {composite} composite + * @return {body[]} All the bodies + */ + static allBodies(composite: Composite): Array; + + /** + * Returns all composites in the given composite, including all composites in its children, recursively. + * @method allComposites + * @param {composite} composite + * @return {composite[]} All the composites + */ + static allComposites(composite: Composite): Array; + + /** + * Returns all constraints in the given composite, including all constraints in its children, recursively. + * @method allConstraints + * @param {composite} composite + * @return {constraint[]} All the constraints + */ + static allConstraints(composite: Composite): Array; + + /** + * Removes all bodies, constraints and composites from the given composite. + * Optionally clearing its children recursively. + * @method clear + * @param {composite} composite + * @param {boolean} keepStatic + * @param {boolean} [deep=false] + */ + static clear(composite: Composite, keepStatic: boolean, deep?: boolean): void; + + /** + * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properites section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} [options] + * @return {composite} A new composite + */ + static create(options?: ICompositeDefinition): Composite; + + /** + * Searches the composite recursively for an object matching the type and id supplied, null if not found. + * @method get + * @param {composite} composite + * @param {number} id + * @param {string} type + * @return {object} The requested object, if found + */ + static get(composite: Composite, id: number, type: string): Body | Composite | Constraint; + + /** + * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add). + * @method move + * @param {compositeA} compositeA + * @param {object[]} objects + * @param {compositeB} compositeB + * @return {composite} Returns compositeA + */ + static move(compositeA: Composite, objects: Array, compositeB: Composite): Composite; + + /** + * Assigns new ids for all objects in the composite, recursively. + * @method rebase + * @param {composite} composite + * @return {composite} Returns composite + */ + static rebase(composite: Composite): Composite; + + /** + * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. + * Optionally searching its children recursively. + * Triggers `beforeRemove` and `afterRemove` events on the `composite`. + * @method remove + * @param {composite} composite + * @param {} object + * @param {boolean} [deep=false] + * @return {composite} The original composite with the objects removed + */ + static remove(composite: Composite, object: Body | Composite | Constraint, deep?: boolean): Composite; + + + + /** + * Sets the composite's `isModified` flag. + * If `updateParents` is true, all parents will be set (default: false). + * If `updateChildren` is true, all children will be set (default: false). + * @method setModified + * @param {composite} composite + * @param {boolean} isModified + * @param {boolean} [updateParents=false] + * @param {boolean} [updateChildren=false] + */ + static setModified(composite: Composite, isModified: boolean, updateParents?: boolean, updateChildren?: boolean): void; + /** + * Translates all children in the composite by a given vector relative to their current positions, + * without imparting any velocity. + * @method translate + * @param {composite} composite + * @param {vector} translation + * @param {bool} [recursive=true] + */ + static translate(composite: Composite, translation: Vector, recursive?: boolean): void; + /** + * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity. + * @method rotate + * @param {composite} composite + * @param {number} rotation + * @param {vector} point + * @param {bool} [recursive=true] + */ + static rotate(composite: Composite, rotation: number, point: Vector, recursive?: boolean): void; + /** + * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point. + * @method scale + * @param {composite} composite + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} point + * @param {bool} [recursive=true] + */ + static scale(composite: Composite, scaleX: number, scaleY: number, point: Vector, recursive?: boolean): void; + + + /** + * An array of `Body` that are _direct_ children of this composite. + * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. + * + * @property bodies + * @type body[] + * @default [] + */ + bodies: Array; + + /** + * An array of `Composite` that are _direct_ children of this composite. + * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. + * + * @property composites + * @type composite[] + * @default [] + */ + composites: Array; + + /** + * An array of `Constraint` that are _direct_ children of this composite. + * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. + * + * @property constraints + * @type constraint[] + * @default [] + */ + constraints: Array; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id: number; + + /** + * A flag that specifies whether the composite has been modified during the current step. + * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. + * If you need to change it manually, you should use the `Composite.setModified` method. + * + * @property isModified + * @type boolean + * @default false + */ + isModified: boolean; + + /** + * An arbitrary `String` name to help the user identify and manage composites. + * + * @property label + * @type string + * @default "Composite" + */ + label: string; + + /** + * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. + * + * @property parent + * @type composite + * @default null + */ + parent: Composite; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "composite" + */ + type: String; } /** - * The Matter.World module contains methods for creating and manipulating the world composite. A Matter.World is a Matter.Composite body, which is a collection of Matter.Body, Matter.Constraint and other Matter.Composite. A Matter.World has a few additional properties including gravity and bounds. It is important to use the functions in the Matter.Composite module to modify the world composite, rather than directly modifying its properties. There are also a few methods here that alias those in Matter.Composite for easier readability. - */ - export class World - { + * The `Matter.Composites` module contains factory methods for creating composite bodies + * with commonly used configurations (such as stacks and chains). + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Composites + */ + export class Composites { + /** + * Creates a composite with simple car setup of bodies and constraints. + * @method car + * @param {number} xx + * @param {number} yy + * @param {number} width + * @param {number} height + * @param {number} wheelSize + * @return {composite} A new composite car body + */ + static car(xx: number, yy: number, width: number, height: number, wheelSize: number): Composite; + + /** + * Chains all bodies in the given composite together using constraints. + * @method chain + * @param {composite} composite + * @param {number} xOffsetA + * @param {number} yOffsetA + * @param {number} xOffsetB + * @param {number} yOffsetB + * @param {object} options + * @return {composite} A new composite containing objects chained together with constraints + */ + static chain(composite: Composite, xOffsetA: number, yOffsetA: number, xOffsetB: number, yOffsetB: number, options: any): Composite; + + /** + * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. + * @method mesh + * @param {composite} composite + * @param {number} columns + * @param {number} rows + * @param {boolean} crossBrace + * @param {object} options + * @return {composite} The composite containing objects meshed together with constraints + */ + static mesh(composite: Composite, columns: number, rows: number, crossBrace: boolean, options: any): Composite; + + /** + * Creates a composite with a Newton's Cradle setup of bodies and constraints. + * @method newtonsCradle + * @param {number} xx + * @param {number} yy + * @param {number} number + * @param {number} size + * @param {number} length + * @return {composite} A new composite newtonsCradle body + */ + newtonsCradle(xx: number, yy: number, _number: number, size: number, length: number): Composite; + + /** + * Create a new composite containing bodies created in the callback in a pyramid arrangement. + * This function uses the body's bounds to prevent overlaps. + * @method pyramid + * @param {number} xx + * @param {number} yy + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {function} callback + * @return {composite} A new composite containing objects created in the callback + */ + static pyramid(xx: number, yy: number, columns: number, rows: number, columnGap: number, rowGap: number, callback: Function): Composite; + + /** + * Creates a simple soft body like object. + * @method softBody + * @param {number} xx + * @param {number} yy + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {boolean} crossBrace + * @param {number} particleRadius + * @param {} particleOptions + * @param {} constraintOptions + * @return {composite} A new composite softBody + */ + static softBody(xx: number, yy: number, columns: number, rows: number, columnGap: number, rowGap: number, crossBrace: boolean, particleRadius: number, particleOptions: any, constraintOptions: any): Composite; + + /** + * Create a new composite containing bodies created in the callback in a grid arrangement. + * This function uses the body's bounds to prevent overlaps. + * @method stack + * @param {number} xx + * @param {number} yy + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {function} callback + * @return {composite} A new composite containing objects created in the callback + */ + static stack(xx: number, yy: number, columns: number, rows: number, columnGap: number, rowGap: number, callback: Function): Composite; + } + + export interface IConstraintDefinition { + /** + * The first possible `Body` that this constraint is attached to. + * + * @property bodyA + * @type body + * @default null + */ + bodyA?: Body; + + /** + * The second possible `Body` that this constraint is attached to. + * + * @property bodyB + * @type body + * @default null + */ + bodyB?: Body; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id?: number; + + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Constraint" + */ + label?: string; + + /** + * A `Number` that specifies the target resting length of the constraint. + * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * + * @property length + * @type number + */ + length?: number; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointA + * @type vector + * @default { x: 0, y: 0 } + */ + pointA?: Vector; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointB + * @type vector + * @default { x: 0, y: 0 } + */ + pointB?: Vector; + + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render?: IConstraintRenderDefinition; + + /** + * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. + * A value of `1` means the constraint should be very stiff. + * A value of `0.2` means the constraint acts like a soft spring. + * + * @property stiffness + * @type number + * @default 1 + */ + stiffness?: number; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + type?: string; + } + + export interface IConstraintRenderDefinition { + /** + * A `Number` that defines the line width to use when rendering the constraint outline. + * A value of `0` means no outline will be rendered. + * + * @property render.lineWidth + * @type number + * @default 2 + */ + lineWidth: number; + + /** + * A `String` that defines the stroke style to use when rendering the constraint outline. + * It is the same as when using a canvas, so it accepts CSS style property values. + * + * @property render.strokeStyle + * @type string + * @default a random colour + */ + strokeStyle: string; + + /** + * A flag that indicates if the constraint should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ + visible: boolean; + } + + + /** + * The `Matter.Constraint` module contains methods for creating and manipulating constraints. + * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). + * The stiffness of constraints can be modified to create springs or elastic. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Constraint + */ + export class Constraint { + /** + * Creates a new constraint. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {constraint} constraint + */ + static create(options: IConstraintDefinition): Constraint; + + /** + * The first possible `Body` that this constraint is attached to. + * + * @property bodyA + * @type body + * @default null + */ + bodyA: Body; + + /** + * The second possible `Body` that this constraint is attached to. + * + * @property bodyB + * @type body + * @default null + */ + bodyB: Body; + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + id: number; + + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Constraint" + */ + label: string; + + /** + * A `Number` that specifies the target resting length of the constraint. + * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * + * @property length + * @type number + */ + length: number; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointA + * @type vector + * @default { x: 0, y: 0 } + */ + pointA: Vector; + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointB + * @type vector + * @default { x: 0, y: 0 } + */ + pointB: Vector; + + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + render: IConstraintRenderDefinition; + + /** + * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. + * A value of `1` means the constraint should be very stiff. + * A value of `0.2` means the constraint acts like a soft spring. + * + * @property stiffness + * @type number + * @default 1 + */ + stiffness: number; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + type: string; + } + + + + export interface IEngineDefinition { + /** + * An integer `Number` that specifies the number of position iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property positionIterations + * @type number + * @default 6 + */ + positionIterations?: number; + /** + * An integer `Number` that specifies the number of velocity iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property velocityIterations + * @type number + * @default 4 + */ + velocityIterations?: number; + /** + * An integer `Number` that specifies the number of constraint iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * The default value of `2` is usually very adequate. + * + * @property constraintIterations + * @type number + * @default 2 + */ + constraintIterations?: number; + + /** + * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. + * Sleeping can improve stability and performance, but often at the expense of accuracy. + * + * @property enableSleeping + * @type boolean + * @default false + */ + enableSleeping?: boolean; + /** + * An `Object` containing properties regarding the timing systems of the engine. + * + * @property timing + * @type object + */ + timing?: IEngineTimingOptions; + /** + * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. + * + * @property broadphase + * @type grid + * @default a Matter.Grid instance + */ + grid?: Grid; + /** + * A `World` composite object that will contain all simulated bodies and constraints. + * + * @property world + * @type world + * @default a Matter.World instance + */ + world?: World; + + } + + export interface IEngineTimingOptions { + /** + * A `Number` that specifies the global scaling factor of time for all bodies. + * A value of `0` freezes the simulation. + * A value of `0.1` gives a slow-motion effect. + * A value of `1.2` gives a speed-up effect. + * + * @property timing.timeScale + * @type number + * @default 1 + */ + timeScale: number; + + /** + * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. + * It is incremented on every `Engine.update` by the given `delta` argument. + * + * @property timing.timestamp + * @type number + * @default 0 + */ + timestamp: number; + } + + /** + * The `Matter.Engine` module contains methods for creating and manipulating engines. + * An engine is a controller that manages updating the simulation of the world. + * See `Matter.Runner` for an optional game loop utility. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Engine + */ + export class Engine { + /** + * Clears the engine including the world, pairs and broadphase. + * @method clear + * @param {engine} engine + */ + static clear(engine: Engine): void; + + /** + * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {HTMLElement} element + * @param {object} [options] + * @return {engine} engine + */ + static create(element?: HTMLElement | IEngineDefinition, options?: IEngineDefinition): Engine; + + /** + * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`. + * @method merge + * @param {engine} engineA + * @param {engine} engineB + */ + static merge(engineA: Engine, engineB: Engine): void; + + + /** + * Moves the simulation forward in time by `delta` ms. + * The `correction` argument is an optional `Number` that specifies the time correction factor to apply to the update. + * This can help improve the accuracy of the simulation in cases where `delta` is changing between updates. + * The value of `correction` is defined as `delta / lastDelta`, i.e. the percentage change of `delta` over the last step. + * Therefore the value is always `1` (no correction) when `delta` constant (or when no correction is desired, which is the default). + * See the paper on Time Corrected Verlet for more information. + * + * Triggers `beforeUpdate` and `afterUpdate` events. + * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. + * @method update + * @param {engine} engine + * @param {number} delta + * @param {number} [correction] + */ + static update(engine: Engine, delta: number, correction?: number): Engine; + + /** + * An alias for `Runner.run`, see `Matter.Runner` for more information. + * @method run + * @param {engine} engine + */ + static run(enige: Engine): void; + + /** + * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. + * + * @property broadphase + * @type grid + * @default a Matter.Grid instance + */ + broadphase: Grid; + /** + * An integer `Number` that specifies the number of constraint iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * The default value of `2` is usually very adequate. + * + * @property constraintIterations + * @type number + * @default 2 + */ + constraintIterations: number; + + /** + * A flag that specifies whether the engine is running or not. + */ + enabled: boolean; + + /** + * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. + * Sleeping can improve stability and performance, but often at the expense of accuracy. + * + * @property enableSleeping + * @type boolean + * @default false + */ + enableSleeping: boolean; + + /** + * An integer `Number` that specifies the number of position iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property positionIterations + * @type number + * @default 6 + */ + positionIterations: number; + + /** + * An instance of a `Render` controller. The default value is a `Matter.Render` instance created by `Engine.create`. + * One may also develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. + * + * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). + * It is also possible to instead pass the _module_ reference via `options.render.controller` and `Engine.create` will instantiate one for you. + * + * @property render + * @type render + * @default a Matter.Render instance + */ + render: Render; + + /** + * An `Object` containing properties regarding the timing systems of the engine. + * + * @property timing + * @type object + */ + timing: IEngineTimingOptions; + + /** + * An integer `Number` that specifies the number of velocity iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * + * @property velocityIterations + * @type number + * @default 4 + */ + velocityIterations: number; + + /** + * A `World` composite object that will contain all simulated bodies and constraints. + * + * @property world + * @type world + * @default a Matter.World instance + */ + world: World; + } + + + export interface IGridDefinition { + + } + + /** + * The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures. + * + * @class Grid + */ + export class Grid { + /** + * Creates a new grid. + * @method create + * @param {} options + * @return {grid} A new grid + */ + static create(options?: IGridDefinition): Grid; + + /** + * Updates the grid. + * @method update + * @param {grid} grid + * @param {body[]} bodies + * @param {engine} engine + * @param {boolean} forceUpdate + */ + static update(grid: Grid, bodies: Array, engine: Engine, forceUpdate: boolean): void; + + /** + * Clears the grid. + * @method clear + * @param {grid} grid + */ + static clear(grid: Grid): void; + + } + + export interface IMouseConstraintDefinition { + /** + * The `Constraint` object that is used to move the body during interaction. + * + * @property constraint + * @type constraint + */ + constraint?: Constraint; + + /** + * An `Object` that specifies the collision filter properties. + * The collision filter allows the user to define which types of body this mouse constraint can interact with. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter + * @type object + */ + collisionFilter?: ICollisionFilter; + + /** + * The `Body` that is currently being moved by the user, or `null` if no body. + * + * @property body + * @type body + * @default null + */ + body?: Body; + + /** + * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created. + * + * @property mouse + * @type mouse + * @default mouse + */ + mouse?: Mouse; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + + type?: string; + } + + /** + * The `Matter.MouseConstraint` module contains methods for creating mouse constraints. + * Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class MouseConstraint + */ + export class MouseConstraint { + /** + * Creates a new mouse constraint. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {engine} engine + * @param {} options + * @return {MouseConstraint} A new MouseConstraint + */ + create(engine: Engine, options: IMouseConstraintDefinition): MouseConstraint; + + /** + * The `Constraint` object that is used to move the body during interaction. + * + * @property constraint + * @type constraint + */ + constraint: Constraint; + + /** + * An `Object` that specifies the collision filter properties. + * The collision filter allows the user to define which types of body this mouse constraint can interact with. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter + * @type object + */ + collisionFilter: ICollisionFilter; + + /** + * The `Body` that is currently being moved by the user, or `null` if no body. + * + * @property body + * @type body + * @default null + */ + body: Body; + + /** + * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created. + * + * @property mouse + * @type mouse + * @default mouse + */ + mouse: Mouse; + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + */ + + type: string; + } + + export interface IPair { + id: number; + bodyA: Body; + bodyB: Body; + contacts: any; + activeContacts: any; + separation: number; + isActive: boolean; + timeCreated: number; + timeUpdated: number, + inverseMass: number; + friction: number; + frictionStatic: number; + restitution: number; + slop: number; + } + + /** + * The `Matter.Query` module contains methods for performing collision queries. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Query + */ + export class Query { + /** + * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. + * @method ray + * @param {body[]} bodies + * @param {vector} startPoint + * @param {vector} endPoint + * @param {number} [rayWidth] + * @return {object[]} Collisions + */ + static ray(bodies: Array, startPoint: Vector, endPoint: Vector, rayWidth?: number): Array; + + /** + * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. + * @method region + * @param {body[]} bodies + * @param {bounds} bounds + * @param {bool} [outside=false] + * @return {body[]} The bodies matching the query + */ + static region(bodies: Array, bounds: Bounds, outside?: boolean): Array; + + /** + * Returns all bodies whose vertices contain the given point, from the given set of bodies. + * @method point + * @param {body[]} bodies + * @param {vector} point + * @return {body[]} The bodies matching the query + */ + static point(bodies: Array, point: Vector): Array; + } + + export interface IRenderDefinition { + /** + * A back-reference to the `Matter.Render` module. + * + * @property controller + * @type render + */ + controller?: any; + /** + * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified) + * + * @property element + * @type HTMLElement + * @default null + */ + element?: HTMLElement; + /** + * The canvas element to render to. If not specified, one will be created if `render.element` has been specified. + * + * @property canvas + * @type HTMLCanvasElement + * @default null + */ + canvas?: HTMLCanvasElement; + + /** + * The configuration options of the renderer. + * + * @property options + * @type {} + */ + options?: IRendererOptions; + + /** + * A `Bounds` object that specifies the drawing view region. + * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`). + * This allows for creating views that can pan or zoom around the scene. + * You must also set `render.options.hasBounds` to `true` to enable bounded rendering. + * + * @property bounds + * @type bounds + */ + bounds?: Bounds; + + /** + * The 2d rendering context from the `render.canvas` element. + * + * @property context + * @type CanvasRenderingContext2D + */ + context?: CanvasRenderingContext2D; + + /** + * The sprite texture cache. + * + * @property textures + * @type {} + */ + textures?: any; + + + } + + export interface IRendererOptions { + /** + * The target width in pixels of the `render.canvas` to be created. + * + * @property options.width + * @type number + * @default 800 + */ + width?: number; + + /** + * The target height in pixels of the `render.canvas` to be created. + * + * @property options.height + * @type number + * @default 600 + */ + height?: number; + + /** + * A flag that specifies if `render.bounds` should be used when rendering. + * + * @property options.hasBounds + * @type boolean + * @default false + */ + hasBounds?: boolean; + + + + + } + + /** + * The `Matter.Render` module is the default `render.controller` used by a `Matter.Engine`. + * This renderer is HTML5 canvas based and supports a number of drawing options including sprites and viewports. + * + * It is possible develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. + * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). + * + * See also `Matter.RenderPixi` for an alternate WebGL, scene-graph based renderer. + * + * @class Render + */ + export class Render { + /** + * Creates a new renderer. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {object} [options] + * @return {render} A new renderer + */ + static create(options: IRenderDefinition): Render; + /** + * Sets the pixel ratio of the renderer and updates the canvas. + * To automatically detect the correct ratio, pass the string `'auto'` for `pixelRatio`. + * @method setPixelRatio + * @param {render} render + * @param {number} pixelRatio + */ + static setPixelRatio(render: Render, pixelRatio: number): void; + /** + * Renders the given `engine`'s `Matter.World` object. + * This is the entry point for all rendering and should be called every time the scene changes. + * @method world + * @param {engine} engine + */ + static world(engine: Engine): void; + + /** + * A back-reference to the `Matter.Render` module. + * + * @property controller + * @type render + */ + controller: any; + /** + * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified) + * + * @property element + * @type HTMLElement + * @default null + */ + element: HTMLElement; + /** + * The canvas element to render to. If not specified, one will be created if `render.element` has been specified. + * + * @property canvas + * @type HTMLCanvasElement + * @default null + */ + canvas: HTMLCanvasElement; + + /** + * The configuration options of the renderer. + * + * @property options + * @type {} + */ + options: IRendererOptions; + + /** + * A `Bounds` object that specifies the drawing view region. + * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`). + * This allows for creating views that can pan or zoom around the scene. + * You must also set `render.options.hasBounds` to `true` to enable bounded rendering. + * + * @property bounds + * @type bounds + */ + bounds: Bounds; + + /** + * The 2d rendering context from the `render.canvas` element. + * + * @property context + * @type CanvasRenderingContext2D + */ + context: CanvasRenderingContext2D; + + /** + * The sprite texture cache. + * + * @property textures + * @type {} + */ + textures: any; + } + + + + export interface IRunnerOptions { + /** + * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). + * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). + * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). + * + * @property isFixed + * @type boolean + * @default false + */ + isFixed?: boolean; + + /** + * A `Number` that specifies the time step between updates in milliseconds. + * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. + * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. + * + * @property delta + * @type number + * @default 1000 / 60 + */ + delta?: number; + } + + /** + * The `Matter.Runner` module is an optional utility which provides a game loop, + * that handles updating and rendering a `Matter.Engine` for you within a browser. + * It is intended for demo and testing purposes, but may be adequate for simple games. + * If you are using your own game loop instead, then you do not need the `Matter.Runner` module. + * Instead just call `Engine.update(engine, delta)` in your own loop. + * Note that the method `Engine.run` is an alias for `Runner.run`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Runner + */ + export class Runner { + /** + * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults. + * @method create + * @param {} options + */ + static create(options:IRunnerOptions): Runner; + /** + * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. + * @method run + * @param {engine} engine + */ + static run(runner: Runner, engine: Engine): Runner; + /** + * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. + * @method run + * @param {engine} engine + */ + static run(engine: Engine): Runner; + /** + * A game loop utility that updates the engine and renderer by one step (a 'tick'). + * Features delta smoothing, time correction and fixed or dynamic timing. + * Triggers `beforeTick`, `tick` and `afterTick` events on the engine. + * Consider just `Engine.update(engine, delta)` if you're using your own loop. + * @method tick + * @param {runner} runner + * @param {engine} engine + * @param {number} time + */ + static tick(runner: Runner, engine: Engine, time: number): void; + /** + * Ends execution of `Runner.run` on the given `runner`, by canceling the animation frame request event loop. + * If you wish to only temporarily pause the engine, see `engine.enabled` instead. + * @method stop + * @param {runner} runner + */ + static stop(runner: Runner): void; + /** + * Alias for `Runner.run`. + * @method start + * @param {runner} runner + * @param {engine} engine + */ + static start(runner: Runner, engine: Engine): void; + + /** + * A flag that specifies whether the runner is running or not. + * + * @property enabled + * @type boolean + * @default true + */ + enabled: boolean; + + /** + * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). + * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). + * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). + * + * @property isFixed + * @type boolean + * @default false + */ + isFixed: boolean; + + /** + * A `Number` that specifies the time step between updates in milliseconds. + * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. + * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. + * + * @property delta + * @type number + * @default 1000 / 60 + */ + delta: number; + } + + /** + * The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies. + * + * @class Sleeping + */ + export class Sleeping { + static set(body: Body, isSleeping: boolean): void; + } + + /** + * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Svg + */ + export class Svg { + /** + * Converts an SVG path into an array of vector points. + * If the input path forms a concave shape, you must decompose the result into convex parts before use. + * See `Bodies.fromVertices` which provides support for this. + * Note that this function is not guaranteed to support complex paths (such as those with holes). + * @method pathToVertices + * @param {SVGPathElement} path + * @param {Number} [sampleLength=15] + * @return {Vector[]} points + */ + static pathToVertices(path: SVGPathElement, sampleLength: number): Array; + } + + /** + * The `Matter.Vector` module contains methods for creating and manipulating vectors. + * Vectors are the basis of all the geometry related operations in the engine. + * A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Vector + */ + export class Vector { + + x: number; + y: number; + + /** + * Creates a new vector. + * @method create + * @param {number} x + * @param {number} y + * @return {vector} A new vector + */ + static create(x?: number, y?: number): Vector; + + /** + * Returns a new vector with `x` and `y` copied from the given `vector`. + * @method clone + * @param {vector} vector + * @return {vector} A new cloned vector + */ + static clone(vector: Vector): Vector; + + + /** + * Returns the cross-product of three vectors. + * @method cross3 + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} vectorC + * @return {number} The cross product of the three vectors + */ + static cross3(vectorA: Vector, vectorB: Vector, vectorC: Vector):number; + + /** + * Adds the two vectors. + * @method add + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} [output] + * @return {vector} A new vector of vectorA and vectorB added + */ + static add(vectorA: Vector, vectorB: Vector, output?: Vector): Vector; + + /** + * Returns the angle in radians between the two vectors relative to the x-axis. + * @method angle + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The angle in radians + */ + static angle(vectorA: Vector, vectorB: Vector): number; + + /** + * Returns the cross-product of two vectors. + * @method cross + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The cross product of the two vectors + */ + static cross(vectorA: Vector, vectorB: Vector): number; + + /** + * Divides a vector and a scalar. + * @method div + * @param {vector} vector + * @param {number} scalar + * @return {vector} A new vector divided by scalar + */ + static div(vector: Vector, scalar: number): Vector; + + /** + * Returns the dot-product of two vectors. + * @method dot + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The dot product of the two vectors + */ + static dot(vectorA: Vector, vectorB: Vector): Number; + + /** + * Returns the magnitude (length) of a vector. + * @method magnitude + * @param {vector} vector + * @return {number} The magnitude of the vector + */ + static magnitude(vector: Vector): number; + + /** + * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation). + * @method magnitudeSquared + * @param {vector} vector + * @return {number} The squared magnitude of the vector + */ + static magnitudeSquared(vector: Vector): number; + + /** + * Multiplies a vector and a scalar. + * @method mult + * @param {vector} vector + * @param {number} scalar + * @return {vector} A new vector multiplied by scalar + */ + static mult(vector: Vector, scalar: number): Vector; + + /** + * Negates both components of a vector such that it points in the opposite direction. + * @method neg + * @param {vector} vector + * @return {vector} The negated vector + */ + static neg(vector: Vector): Vector; + + /** + * Normalises a vector (such that its magnitude is `1`). + * @method normalise + * @param {vector} vector + * @return {vector} A new vector normalised + */ + static normalise(vector: Vector): Vector; + + /** + * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction. + * @method perp + * @param {vector} vector + * @param {bool} [negate=false] + * @return {vector} The perpendicular vector + */ + static perp(vector: Vector, negate?: boolean): Vector; + + /** + * Rotates the vector about (0, 0) by specified angle. + * @method rotate + * @param {vector} vector + * @param {number} angle + * @return {vector} A new vector rotated about (0, 0) + */ + static rotate(vector: Vector, angle: number): Vector; + + /** + * Rotates the vector about a specified point by specified angle. + * @method rotateAbout + * @param {vector} vector + * @param {number} angle + * @param {vector} point + * @param {vector} [output] + * @return {vector} A new vector rotated about the point + */ + static rotateAbout(vector: Vector, angle: number, point: Vector, output?: Vector): Vector; + + /** + * Subtracts the two vectors. + * @method sub + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} [output] + * @return {vector} A new vector of vectorA and vectorB subtracted + */ + static sub(vectorA: Vector, vectorB: Vector, optional?: Vector): Vector; + } + + /** + * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. + * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. + * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class Vertices + */ + export class Vertices { + /** + * Returns the average (mean) of the set of vertices. + * @method mean + * @param {vertices} vertices + * @return {vector} The average point + */ + static mean(vertices: Array): Array; + + /** + * Sorts the input vertices into clockwise order in place. + * @method clockwiseSort + * @param {vertices} vertices + * @return {vertices} vertices + */ + static clockwiseSort(vertices: Array): Array; + + /** + * Returns true if the vertices form a convex shape (vertices must be in clockwise order). + * @method isConvex + * @param {vertices} vertices + * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable). + */ + static isConvex(vertices: Array): boolean; + + /** + * Returns the convex hull of the input vertices as a new array of points. + * @method hull + * @param {vertices} vertices + * @return [vertex] vertices + */ + static hull(vertices: Array): Array; + + /** + * Returns the area of the set of vertices. + * @method area + * @param {vertices} vertices + * @param {bool} signed + * @return {number} The area + */ + static area(vertices: Array, signed: boolean): number; + + /** + * Returns the centre (centroid) of the set of vertices. + * @method centre + * @param {vertices} vertices + * @return {vector} The centre point + */ + static centre(vertices: Array): Vector; + + /** + * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. + * The radius parameter is a single number or an array to specify the radius for each vertex. + * @method chamfer + * @param {vertices} vertices + * @param {number[]} radius + * @param {number} quality + * @param {number} qualityMin + * @param {number} qualityMax + */ + static chamfer(vertices: Array, radius: Array, quality: number, qualityMin: number, qualityMax: number): void; + + + /** + * Returns `true` if the `point` is inside the set of `vertices`. + * @method contains + * @param {vertices} vertices + * @param {vector} point + * @return {boolean} True if the vertices contains point, otherwise false + */ + static contains(vertices: Array, point: Vector): boolean; + + /** + * Creates a new set of `Matter.Body` compatible vertices. + * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example: + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects, + * but with some additional references required for efficient collision detection routines. + * + * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided. + * + * @method create + * @param {vector[]} points + * @param {body} body + */ + static create(points: Array, body: Body): void; + + /** + * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), + * into a `Matter.Vertices` object for the given `Matter.Body`. + * For parsing SVG paths, see `Svg.pathToVertices`. + * @method fromPath + * @param {string} path + * @param {body} body + * @return {vertices} vertices + */ + static fromPath(path: string, body: Body): Array; + + /** + * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. + * @method inertia + * @param {vertices} vertices + * @param {number} mass + * @return {number} The polygon's moment of inertia + */ + static inertia(vertices: Array, mass: number): number; + + /** + * Rotates the set of vertices in-place. + * @method rotate + * @param {vertices} vertices + * @param {number} angle + * @param {vector} point + */ + static rotate(vertices: Array, angle: number, point: Vector): void; + + /** + * Scales the vertices from a point (default is centre) in-place. + * @method scale + * @param {vertices} vertices + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} point + */ + static scale(vertices: Array, scaleX: number, scaleY: number, point: Vector): void; + + /** + * Translates the set of vertices in-place. + * @method translate + * @param {vertices} vertices + * @param {vector} vector + * @param {number} scalar + */ + static translate(vertices: Array, vector: Vector, scalar: number): void; + } + + interface IWorldDefinition extends ICompositeDefinition { + gravity?: Vector; + bounds?: Bounds; + } + + /** + * The `Matter.World` module contains methods for creating and manipulating the world composite. + * A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. + * A `Matter.World` has a few additional properties including `gravity` and `bounds`. + * It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. + * There are also a few methods here that alias those in `Matter.Composite` for easier readability. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * + * @class World + * @extends Composite + */ + export class World { /** * Add objects or arrays of objects of types: Body, Constraint, Composite * @param world * @param body * @returns world */ - static add(world:World, body:Body|Array|Composite|Array|Constraint|Array):World; + static add(world: World, body: Body | Array | Composite | Array | Constraint | Array): World; /** * An alias for Composite.addBody since World is also a Composite - * @param world - * @param body - * @returns world + * @method addBody + * @param {world} world + * @param {body} body + * @return {world} The original world with the body added */ - static addBody(world:World, body:Body):World; + static addBody(world: World, body: Body): World; /** * An alias for Composite.add since World is also a Composite - * @param world - * @param composite + * @method addComposite + * @param {world} world + * @param {composite} composite + * @return {world} The original world with the objects from composite added */ - static addComposite(world:World, composite:Composite):World; + static addComposite(world: World, composite: Composite): World; /** - * An alias for Composite.addConstraint since World is also a Composite. - * @param world - * @param constraint + * An alias for Composite.addConstraint since World is also a Composite + * @method addConstraint + * @param {world} world + * @param {constraint} constraint + * @return {world} The original world with the constraint added */ - static addConstraint(world:World, constraint:Constraint):World; + static addConstraint(world: World, constraint: Constraint): World; /** - * An alias for Composite.clear since World is also a Composite. - * @param world - * @param keepStatic + * An alias for Composite.clear since World is also a Composite + * @method clear + * @param {world} world + * @param {boolean} keepStatic */ - static clear(world:World, keepStatic:boolean):void; + static clear(world: World, keepStatic: boolean): void; /** - * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. - * @param options + * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @constructor + * @param {} options + * @return {world} A new world */ - static create(options:IWorldOptions):World; + static create(options: IWorldDefinition): World; + + gravity: Vector; + bounds: Bounds; } - export interface IBodyDefinition - { - angle?:number; - angularSpeed?:number; - angularVelocity?:number; - area?:number; - axes?:Array; - bounds?:Bounds; - density?:number; - force?:Vector; - friction?:number; - frictionAir?:number; - groupId?:number; - id?:number; - inertia?:number; - inverseInertia?:number; - inverseMass?:number; - isSleeping?:boolean; - isStatic?:boolean; - label?:string; - mass?:number; - motion?:number; - position?:Vector; - render?:IBodyRenderOptions; - restitution?:number; - sleepThreshold?:number; - slop?:number; - speed?:number; - timeScale?:number; - torque?:number; - type?:string; - velocity?:Vector; - vertices?:Array; + export interface ICollisionFilter { + category: number; + mask: number; + group: number; } - /** - * The Matter.Body module contains methods for creating and manipulating body models. A Matter.Body is a rigid body that can be simulated by a Matter.Engine. Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module Matter.Bodies. - */ - export class Body - { - /** - * Applies a force to a body from a given world-space position, including resulting torque. - * @param body - * @param position - * @param force - */ - static applyForce(body:Body, position:Vector, force:Vector):void; - - /** - * Applys a mass dependant force to all given bodies. - * @param bodies - * @param gravity - */ - static applyGravityAll(bodies:Array, gravity:Vector):void; - - /** - * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. - * @param options - */ - static create(options:IBodyDefinition):Body; - - /** - * Returns the next unique groupID number. - */ - static nextGroupId():number; - - /** - * Zeroes the body.force and body.torque force buffers. - * @param bodies - */ - static resetForcesAll(bodies:Array):void; - - /** - * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. - * @param body - * @param angle - */ - static rotate(body:Body, angle:number):void; - - /** - * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. - * @param isStatic - */ - setStatic(isStatic:boolean):void; - - /** - * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). - * @param body - * @param scaleX - * @param scaleY - * @param poinst - */ - static scale(body:Body, scaleX:number, scaleY:number, poinst?:Vector):void; - - /** - * Moves a body by a given vector relative to its current position, without imparting any velocity. - * - * @param body - * @param translation - */ - static translate(body:Body, translation:Vector):void; - - /** - *Performs a simulation step for the given body, including updating position and angle using Verlet integration. - * - * @param body - * @param deltaTime - * @param timeScale - * @param correction - */ - static update(body:Body, deltaTime:number, timeScale:number, correction:number):void; - - /** - * Applys Body.update to all given bodies. - * - * @param bodies - * @param deltaTime - * @param timeScale - * @param correction - * @param worldBounds - */ - static updateAll ( bodies:Array, deltaTime:number, timeScale:number, correction:number, worldBounds:Bounds ):void; - - /** - * A Number specifying the angle of the body, in radians. - */ - angle:number; - - /** - * A Number that measures the current angular speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.angularVelocity). - */ - angularSpeed:number; - - /** - * A Number that measures the current angular velocity of the body after the last Body.update. It is read-only. If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's angle (as the engine uses position-Verlet integration). - */ - angularVelocity:number; - - /** - * A Number that measures the area of the body's convex hull, calculated at creation by Body.create. - */ - area:number; - - /** - * An array of unique axis vectors (edge normals) used for collision detection. These are automatically calculated from the given convex hull (vertices array) in Body.create. They are constantly updated by Body.update during the simulation. - */ - axes:Array; - - /** - * A Bounds object that defines the AABB region for the body. It is automatically calculated from the given convex hull (vertices array) in Body.create and constantly updated by Body.update during simulation. - */ - bounds:Bounds; - - /** - * A Number that defines the density of the body, that is its mass per unit area. If you pass the density via Body.create the mass property is automatically calculated for you based on the size (area) of the object. This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). - */ - density:number; - - /** - * A Vector that specifies the force to apply in the current step. It is zeroed after every Body.update. See also Body.applyForce. - */ - force:Vector; - - /** - * A Number that defines the friction of the body. The value is always positive and is in the range (0, 1). A value of 0 means that the body may slide indefinitely. A value of 1 means the body may come to a stop almost instantly after a force is applied. - The effects of the value may be non-linear. High values may be unstable depending on the body. The engine uses a Coulomb friction model including static and kinetic friction. Note that collision response is based on pairs of bodies, and that friction values are combined with the following formula: - Math.min(bodyA.friction, bodyB.friction) - */ - friction:number; - - /** - * A Number that defines the air friction of the body (air resistance). A value of 0 means the body will never slow as it moves through space. The higher the value, the faster a body slows when moving through space. The effects of the value are non-linear. - Default: 0.01 - */ - frictionAir:number; - - /** - * An integer Number that specifies the collision group the body belongs to. Bodies with the same groupId are considered as-one body and therefore do not interact. This allows for creation of segmented bodies that can self-intersect, such as a rope. The default value 0 means the body does not belong to a group, and can interact with all other bodies. - Default: 0 - */ - groupId:number; - - /** - * An integer Number uniquely identifying number generated in Body.create by Common.nextId. - */ - id:number; - - /** - * A Number that defines the moment of inertia (i.e. second moment of area) of the body. It is automatically calculated from the given convex hull (vertices array) and density in Body.create. If you modify this value, you must also modify the body.inverseInertia property (1 / inertia). - */ - inertia:number; - - /** - * A Number that defines the inverse moment of inertia of the body (1 / inertia). If you modify this value, you must also modify the body.inertia property. - */ - inverseInertia:number; - - /** - * A Number that defines the inverse mass of the body (1 / mass). If you modify this value, you must also modify the body.mass property. - */ - inverseMass:number; - - /** - * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. If you need to set a body as sleeping, you should use Sleeping.set as this requires more than just setting this flag. - Default: false - */ - isSleeping:boolean; - - /** - * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. If you need to set a body as static after its creation, you should use Body.setStatic as this requires more than just setting this flag. - Default: false - */ - isStatic:boolean; - - /** - * An arbitrary String name to help the user identify and manage bodies. - Default: "Body" - */ - label:string; - - /** - * A Number that defines the mass of the body, although it may be more appropriate to specify the density property instead. If you modify this value, you must also modify the body.inverseMass property (1 / mass). - */ - mass:number; - - /** - * A Number that measures the amount of movement a body currently has (a combination of speed and angularSpeed). It is read-only and always positive. It is used and updated by the Matter.Sleeping module during simulation to decide if a body has come to rest. - Default: 0 - */ - motion:number; - - /** - * A Vector that specifies the current world-space position of the body. - Default: { x: 0, y: 0 } - */ - position:Vector; - - /** - * An Object that defines the rendering properties to be consumed by the module Matter.Render. - */ - render:IBodyRenderOptions; - - /** - * A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: - Math.max(bodyA.restitution, bodyB.restitution) - Default: 0 - */ - restitution:number; - - /** - * A Number that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the Matter.Sleeping module (if sleeping is enabled by the engine). - Default: 60 - */ - sleepThreshold:number; - - /** - * A Number that specifies a tollerance on how far a body is allowed to 'sink' or rotate into other bodies. Avoid changing this value unless you understand the purpose of slop in physics engines. The default should generally suffice, although very large bodies may require larger values for stable stacking. - Default: 0.05 - */ - slop:number; - - /** - * A Number that measures the current speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.velocity). - Default: 0 - */ - speed:number; - - /** - * A Number that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. - Default: 1 - */ - timeScale:number; - - /** - * A Number that specifies the torque (turning force) to apply in the current step. It is zeroed after every Body.update. - Default: 0 - */ - torque:number; - - /** - *A String denoting the type of object. - Default: "body" - */ - type:string; - - /** - * A Vector that measures the current velocity of the body after the last Body.update. It is read-only. If you need to modify a body's velocity directly, you should either apply a force or simply change the body's position (as the engine uses position-Verlet integration). - Default: { x: 0, y: 0 } - */ - velocity:Vector; - - /** - * An array of Vector objects that specify the convex hull of the rigid body. These should be provided about the origin (0, 0). E.g. - [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - When passed via Body.create, the verticies are translated relative to body.position (i.e. world-space, and constantly updated by Body.update during simulation). The Vector objects are also augmented with additional properties required for efficient collision detection. - Other properties such as inertia and bounds are automatically calculated from the passed vertices (unless provided via options). Concave hulls are not currently supported. The module Matter.Vertices contains useful methods for working with vertices. - */ - vertices:Array; - + export interface IMousePoint { + x: number; + y: number; } - export class Bodies { - /** - * Creates a new rigid body model with a circle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param radius - * @param options - * @param maxSides - */ - static circle(x:number, y:number, radius:number, options?:IBodyDefinition, maxSides?:number):Body; - - /** - * Creates a new rigid body model with a regular polygon hull with the given number of sides. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param sides - * @param radius - * @param options - */ - static polygon(x:number, y:number, sides:number, radius:number, options?:IBodyDefinition):Body; - - /** - * Creates a new rigid body model with a rectangle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param width - * @param height - * @param options - */ - static rectangle(x:number, y:number, width:number, height:number, options?:IBodyDefinition):Body; - - /** - * Creates a new rigid body model with a trapezoid hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. - * - * @param x - * @param y - * @param width - * @param height - * @param slope - * @param options - */ - static trapezoid(x:number, y:number, width:number, height:number, slope:number, options?:IBodyDefinition):Body; - + export class Mouse { + static create(element: HTMLElement): Mouse; + static setElement(mouse: Mouse, element: HTMLElement): void; + static clearSourceEvents(mouse: Mouse): void; + static setOffset(mouse: Mouse, offset: Vector): void; + static setScale(mouse: Mouse, scale: Vector): void; + element: HTMLElement; + absolute: IMousePoint; + position: IMousePoint; + mousedownPosition: IMousePoint; + mouseupPosition: IMousePoint; + offset: IMousePoint; + scale: IMousePoint; + wheelDelta: number; + button: number; + pixelRatio: number; } - export interface IBodyRenderOptions - { + export interface IEvent { /** - * A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. - Default: a random colour + * The name of the event */ - fillStyle:string; - + name: string; /** - * A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered. - Default: 1.5 + * The source object of the event */ - lineWidth:number; - - /** - * An Object that defines the sprite properties to use when rendering, if any. - */ - sprite:IBodyRenderOptionsSprite; - - /** - * A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. - Default: a random colour - */ - strokeStyle:string; - - /** - * A flag that indicates if the body should be rendered. - Default: true - */ - visible:boolean; - + source: T; } - export interface IBodyRenderOptionsSprite - { + export interface IEventComposite extends IEvent { /** - * An String that defines the path to the image to use as the sprite texture, if any. + * EventObjects (may be a single body, constraint, composite or a mixed array of these) */ - texture:string; - - /** - * A Number that defines the scaling in the x-axis for the sprite, if any. - Default: 1 - */ - xScale:number; - - /** - * A Number that defines the scaling in the y-axis for the sprite, if any. - Default: 1 - */ - yScale:number; + object: any; } - export class Bounds - { - + export interface IEventTimestamped extends IEvent { + /** + * The engine.timing.timestamp of the event + */ + timestamp: number; } - export class Vector - { - - x:number; - y:number; - + export interface IEventCollision extends IEventTimestamped { /** - * Adds the two vectors. - * - * @param vectorA - * @param vectorB - * @returns A new vector of vectorA and vectorB added. + * The collision pair */ - static add ( vectorA:Vector, vectorB:Vector ):Vector; - - /** - * Returns the angle in radians between the two vectors relative to the x-axis. - * - * @param vectorA - * @param vectorB - * @returns The angle in radians. - */ - static angle ( vectorA:Vector, vectorB:Vector ):number; - - /** - * Returns the cross-product of two vectors. - * - * @param vectorA - * @param vectorB - * @returns The cross product of the two vectors. - */ - static cross ( vectorA:Vector, vectorB:Vector ):number; - - /** - * Divides a vector and a scalar. - * - * @param vector - * @param scalar - * @returns A new vector divided by scalar. - */ - static div ( vector:Vector, scalar:number ):Vector; - - /** - * Returns the dot-product of two vectors. - * - * @param vectorA - * @param vectorB - * @returns The dot product of the two vectors - */ - static dot ( vectorA:Vector, vectorB:Vector ):Number; - - /** - * Returns the magnitude (length) of a vector. - * - * @param vector - * @returns The magnitude of the vector - */ - static magnitude ( vector:Vector ):number; - - /** - * Returns the magnitude (length) of a vector (therefore saving a sqrt operation). - * - * @param vector - * @returns The squared magnitude of the vector. - */ - static magnitudeSquared ( vector:Vector ):number; - - /** - * Multiplies a vector and a scalar. - * - * @param vector - * @param scalar - * @returns A new vector multiplied by scalar - */ - static mult ( vector:Vector, scalar:number ):Vector; - - /** - * Negates both components of a vector such that it points in the opposite direction. - * @param vector - * @returns The negated vector. - */ - static neg ( vector:Vector ):Vector; - - /** - * Normalises a vector (such that its magnitude is 1). - * - * @param vector - * @returns A new vector normalised - */ - static normalise ( vector:Vector ):Vector; - - /** - * Returns the perpendicular vector. Set negate to true for the perpendicular in the opposite direction. - * - * @param vector - * @param negate - * @returns The perpendicular vector - */ - static perp ( vector:Vector, negate?:boolean ):Vector; - - /** - * Rotates the vector about (0, 0) by specified angle. - * - * @param vector - * @param angle - * @returns A new vector rotated about (0, 0) - */ - static rotate ( vector:Vector, angle:number ):Vector; - - /** - * Rotates the vector about a specified point by specified angle. - * - * @param vector - * @param angle - * @param point - * @returns A new vector rotated about the point - */ - static rotateAbout ( vector:Vector, angle:number, point:Vector ):Vector; - - /** - * Subtracts the two vectors. - * - * @param vectorA - * @param vectorB - * @returns A new vector of vectorA and vectorB subtracted - */ - static sub ( vectorA:Vector, vectorB:Vector ):Vector; + pairs: Array; } - export class Constraint - { + + export class Events { + /** - * Creates a new constraint. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * Fired when a body starts sleeping (where `this` is the body). + * + * @event sleepStart + * @this {body} The body that has started sleeping + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "sleepStart", callback: (e: IEvent) => void): void; + /** + * Fired when a body ends sleeping (where `this` is the body). * - * @param options - * @returns constraint - */ - static create(options:IConstraintDefinition):Constraint; - - /** - * The first possible Body that this constraint is attached to. - */ - bodyA:Body; - - /** - * The second possible Body that this constraint is attached to. - */ - bodyB:Body; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id:number; - - /** - * An arbitrary String name to help the user identify and manage bodies. - * Default: "Constraint" - */ - label:string; - - /** - * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. - */ - length:number; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointA:Vector; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointB:Vector; - - /** - * An Object that defines the rendering properties to be consumed by the module Matter.Render. - */ - render:IConstraintRenderRefinition; - - /** - * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. - Default: 1 - */ - stiffness:number; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type:string; - } - - export class MouseConstraint - { - create(engine:Engine, options:IMouseConstraintDefinition):MouseConstraint; - - /** - * The Constraint object that is used to move the body during interaction. - */ - constraint:Constraint; - - /** - * The Body that is currently being moved by the user, or null if no body. - Default: null - */ - dragBody:Body; - - /** - * The Vector offset at which the drag started relative to the dragBody, if any. - Default: null - */ - dragPoint:Vector; - - /** - * The Mouse instance in use. - Default: engine.input.mouse - */ - mouse:Mouse; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type:string; - } - - export interface IMouseConstraintDefinition - { - /** - * The Constraint object that is used to move the body during interaction. - */ - constraint?:Constraint; - - /** - * The Body that is currently being moved by the user, or null if no body. - Default: null - */ - dragBody?:Body; - - /** - * The Vector offset at which the drag started relative to the dragBody, if any. - Default: null - */ - dragPoint?:Vector; - - /** - * The Mouse instance in use. - Default: engine.input.mouse - */ - mouse?:Mouse; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type?:string; - } - - export class Query - { - /** - * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. - * - * @param bodies - * @param startPoint - * @param endPoint - * @param [rayWidth] - * - * @returns Object[] Collisions - */ - static ray( bodies:Array, startPoint:Vector, endPoint:Vector, rayWidth?:number ):Array; - - /** - * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. - * - * @param bodies - * @param bounds - * @returns Body[] The bodies matching the query - */ - static region( bodies:Array, bounds:Bounds, outside?:boolean ):Array; - } - - export class Mouse - { - - } - - export interface IConstraintRenderRefinition - { - /** - * A Number that defines the line width to use when rendering the constraint outline. A value of 0 means no outline will be rendered. - Default: 2 - */ - lineWidth:number; - - /** - * A String that defines the stroke style to use when rendering the constraint outline. It is the same as when using a canvas, so it accepts CSS style property values. - Default: a random colour - */ - strokeStyle:string; - - /** - * A flag that indicates if the constraint should be rendered. - Default: true - */ - visible:boolean; - } - - export interface IConstraintDefinition - { - /** - * The first possible Body that this constraint is attached to. - */ - bodyA?:Body; - - /** - * The second possible Body that this constraint is attached to. - */ - bodyB?:Body; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id?:number; - - /** - * An arbitrary String name to help the user identify and manage bodies. - * Default: "Constraint" - */ - label?:string; - - /** - * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. - */ - length?:number; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointA?:Vector; - - /** - * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. - Default: { x: 0, y: 0 } - */ - pointB?:Vector; - - /** - * An Object that defines the rendering properties to be consumed by the module Matter.Render. - */ - render?:IConstraintRenderRefinition; - - /** - * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. - Default: 1 - */ - stiffness?:number; - - /** - * A String denoting the type of object. - Default: "constraint" - */ - type?:string; - } - - export class Composite - { - /** - * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. - * - * @param composite - * @param object - * - * @returns The original composite with the objects added - */ - static add(composite:Composite, object:Body|Composite|Constraint ):Composite; - - /** - * Adds a body to the given composite - * - * @param composite - * @param body - * - * @returns Composite The original composite with the body added - */ - static addBody(composite:Composite, body:Body):Composite; - - /** - * Adds a composite to the given composite - * - * @param compositeA - * @param compositeB - * - * @returns The original compositeA with the objects from compositeB added - */ - static addComposite(compositeA:Composite, compositeB:Composite):Composite; - - /** - * - * @param composite - * @param constraint - * @returns The original composite with the constraint added - */ - static addConstraint(composite:Composite, constraint:Constraint):Composite; - - /** - * Returns all bodies in the given composite, including all bodies in its children, recursively. - * - * @param composite - * @returns Body[] All the bodies - */ - static allBodies(composite:Composite):Array; - - /** - * Returns all composites in the given composite, including all composites in its children, recursively. - * - * @param composite - * @returns Composite[] All the composites - */ - static allComposites(composite:Composite):Array; - - /** - * Returns all constraints in the given composite, including all constraints in its children, recursively. - * - * @param composite - * @returns Constraint[] All the constraints - */ - static allConstraints(composite:Composite):Array; - - /** - * Removes all bodies, constraints and composites from the given composite Optionally clearing its children recursively. - * - * @param world - * @param keepStatic - * @param deep - */ - static clear(world:World, keepStatic:boolean, deep?:boolean):void; - - /** - * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. - * - * @param options - * @returns A new composite - */ - static create(options:ICompositeDefinition):Composite; - - /** - * Searches the composite recursively for an object matching the type and id supplied, null if not found - * - * @param composite - * @param id - * @param type - * @returns The requested object, if found. - */ - static get(composite:Composite,id:number,type:string):Body|Composite|Constraint; - - /** - * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add) - * - * @param compositeA - * @param objects - * @param compositeB - * @returns Returns compositeA - */ - static move(compositeA:Composite, objects:Array, compositeB:Composite):Composite; - - /** - * Assigns new ids for all objects in the composite, recursively. - * - * @param composite - * @returns Returns composite - */ - static rebase(composite:Composite):Composite; - - /** - * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. Optionally searching its children recursively. - * - * @param composite - * @param object - * @param deep - * @returns The original composite with the objects removed. - */ - static remove(composite:Composite, object:Body|Composite|Constraint, deep?:boolean):Composite; - - /** - * Removes a body from the given composite, and optionally searching its children recursively. - * - * @param composite - * @param body - * @param deep - * @returns The original composite with the body removed. - */ - static removeBody(composite:Composite, body:Body, deep?:boolean):Composite; - - /** - * Removes a body from the given composite. - * - * @param composite - * @param position - * @returns The original composite with the body removed. - */ - static removeBodyAt(composite:Composite, position:number):Composite; - - /** - * Removes a composite from the given composite, and optionally searching its children recursively - * - * @param compositeA - * @param compositeB - * @returns The original compositeA with the composite removed. - */ - static removeComposite(compositeA:Composite, compositeB:Composite, deep?:boolean):Composite; - - /** - * Removes a composite from the given composite - * - * @param composite - * @param position - * @returns The original composite with the composite removed. - */ - static removeCompositeAt(composite:Composite, position:number):Composite; - - /** - * Removes a constraint from the given composite, and optionally searching its children recursively - * - * @param composite - * @param constraint - * @param deep - * - * @returns The original composite with the constraint removed - */ - static removeConstraint(composite:Composite, constraint:Constraint, deep?:boolean):Composite; - - /** - * Removes a body from the given composite - * @param composite - * @param position - * @returns The original composite with the constraint removed - */ - static removeConstraintAt(composite:Composite, position:number):Composite; - - /** - * Sets the composite's isModified flag. If updateParents is true, all parents will be set (default: false). If updateChildren is true, all children will be set (default: false). - * - * @param composite - * @param isModified - * @param updateParents - */ - static setModified(composite:Composite, isModified:boolean, updateParents?:boolean):void; - - /** - * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. - */ - bodies:Array; - - /** - * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. - */ - composites:Array; - - /** - * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. - */ - constraints:Array; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id:number; - - /** - * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. - */ - isModified:boolean; - - /** - * An arbitrary String name to help the user identify and manage composites. - * Default: "Composite" - */ - label:string; - - /** - * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. - */ - parent:Composite; - - /** - * A String denoting the type of object. - */ - type:String; - - } - - export class Composites - { - /** - * It will create car composite, wheels, car body and constraints. - * - * @param xx - * @param yy - * @param width - * @param height - * @param wheelSize - * - * @returns A new composite car body - */ - static car ( xx:number, yy:number, width:number, height:number, wheelSize:number ):Composite; - - /** - * Creates chain - * @param composite - * @param xOffsetA - * @param yOffsetA - * @param xOffsetB - * @param yOffsetB - * @param options - */ - static chain ( composite:Composite, xOffsetA:number, yOffsetA:number, xOffsetB:number, yOffsetB:number, options:any ):Composite; - - /** - *Connects bodies in the composite with constraints in a grid pattern, with optional cross braces - * - * @param composite - * @param columns - * @param rows - * @param crossBrace - * @param options - * @returns The composite containing objects meshed together with constraints - */ - static mesh(composite:Composite, columns:number, rows:number, crossBrace:boolean, options:any ):Composite; - - /** - * Creates newton cradle - * @param xx - * @param yy - * @param _number - * @param size - * @param length - * @returns A new composite newtonsCradle body - */ - newtonsCradle(xx:number, yy:number, _number:number, size:number, length:number):Composite; - - /** - * Creates pyramid - * - * @param xx - * @param yy - * @param columns - * @param rows - * @param columnGap - * @param rowGap - * @param callback - * @return A new composite containing objects created in the callback - */ - static pyramid(xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function):Composite; - - /** - * Creates a simple soft body like object - * - * @param xx - * @param yy - * @param columns - * @param rows - * @param columnGap - * @param rowGap - * @param crossBrace - * @param particleRadius - * @param particleOptions - * @param constraintOptions - * - * @returns A new composite softBody - */ - static softBody ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, crossBrace:boolean, particleRadius:number, particleOptions:any, constraintOptions:any ):Composite; - - /** - * Creates objects in and stacks them up. - * @param xx - * @param yy - * @param columns - * @param rows - * @param columnGap - * @param rowGap - * @param callback - * @returns A new composite containing objects created in the callback - */ - static stack ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function ):Composite; - } - - export interface ICompositeDefinition - { - /** - * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. - */ - bodies?:Array; - - /** - * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. - */ - composites?:Array; - - /** - * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. - */ - constraints?:Array; - - /** - * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. - */ - id?:number; - - /** - * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. - */ - isModified?:boolean; - - /** - * An arbitrary String name to help the user identify and manage composites. - * Default: "Composite" - */ - label?:string; - - /** - * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. - */ - parent?:Composite; - - /** - * A String denoting the type of object. - */ - type?:String; - } - - export class Vertices - { - /** - * Returns the area of the set of vertices. - * - * @param vertices - * @param signed - */ - static area ( vertices:Array, signed:boolean ):number; - - /** - * Returns the centre (centroid) of the set of vertices. - * @param vertices - * @returns The centre point - */ - static centre ( vertices:Array ):Vector; - - /** - * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. The radius parameter is a single number or an array to specify the radius for each vertex. - * @param vertices - */ - static chamfer ( vertices:Array, radius:Array, quality:number, qualityMin:number, qualityMax:number ):void; - - - /** - * Returns true if the point is inside the set of vertices. - * - * @param vertices - * @returns True if the vertices contains point, otherwise false. - */ - static contains ( vertices:Array, point:Vector ):boolean; - - /** - * Creates a new set of Matter.Body compatible vertices. The vertices argument accepts an array of Matter.Vector orientated around the origin (0, 0), for example: - [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - The Vertices.create method then inserts additional indexing properties required for efficient collision detection routines. - - * @param vertices - * @param body - */ - static create ( vertices:Array, body:Body):void; - - /** - * Parses a simple SVG-style path into a set of Matter.Vector points. - * - * @param path - * @returns vertices - */ - static fromPath ( path:string ):Array; - - /** - * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. - * - * @param vertices - * @returns The polygon's moment of inertia - */ - static inertia ( vertices:Array, mass:number ):number; - - /** - * Rotates the set of vertices in-place. - * - * @param vertices - * @param angle - * @param point - */ - static rotate ( vertices:Array, angle:number, point:Vector ):void; - - /** - * Scales the vertices from a point (default is centre) in-place. - * - * @param vertices - * @param scaleX - * @param scaleY - * @param point - */ - static scale( vertices:Array, scaleX:number, scaleY:number, point:Vector ):void; - - /** - * Translates the set of vertices in-place. - * - * @param vertices - */ - static translate ( vertices:Array, vector:Vector, scalar:number ):void; - } - - export class Render - { - - } - - export class Events - { - /** - * Fired after rendering - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"afterRender", callback:(e:any) => void ):void; - - /** - * Fired after engine update and after rendering - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"afterUpdate", callback:(e:any) => void ):void; - - /** - * Fired just before rendering - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"beforeRender", callback:(e:any) => void ):void; - - /** - * Fired at the start of a tick, before any updates to the engine or timing - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"beforeTick", callback:(e:any) => void ):void; - - /** - * Fired just before an update - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"beforeUpdate", callback:(e:any) => void ):void; - - /** - * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"collisionActive", callback:(e:any) => void ):void; - - - /** - * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"collisionEnd", callback:(e:any) => void ):void; - - /** - * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"collisionStart", callback:(e:any) => void ):void; + * @event sleepEnd + * @this {body} The body that has ended sleeping + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "sleepEnd", callback: (e: IEvent) => void): void; + + /** + * Fired when a call to `Composite.add` is made, before objects have been added. + * + * @event beforeAdd + * @param {} event An event object + * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeAdd", callback: (e: IEventComposite) => void): void; + + /** + * Fired when a call to `Composite.add` is made, after objects have been added. + * + * @event afterAdd + * @param {} event An event object + * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterAdd", callback: (e: IEventComposite) => void): void; + + /** + * Fired when a call to `Composite.remove` is made, before objects have been removed. + * + * @event beforeRemove + * @param {} event An event object + * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeRemove", callback: (e: IEventComposite) => void): void; + + /** + * Fired when a call to `Composite.remove` is made, after objects have been removed. + * + * @event afterRemove + * @param {} event An event object + * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterRemove", callback: (e: IEventComposite) => void): void; + + + /** + * Fired after engine update and all collision events + * + * @event afterUpdate + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterUpdate", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired before rendering + * + * @event beforeRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeRender", callback: (e: IEventTimestamped) => void): void; + /** + * Fired after rendering + * + * @event afterRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterRender", callback: (e: IEventTimestamped) => void): void; + + + /** + * Fired just before an update + * + * @event beforeUpdate + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeUpdate", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) + * + * @event collisionActive + * @param {} event An event object + * @param {} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "collisionActive", callback: (e: IEventCollision) => void): void; + + + /** + * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) + * + * @event collisionEnd + * @param {} event An event object + * @param {} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "collisionEnd", callback: (e: IEventCollision) => void): void; + + /** + * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) + * + * @event collisionStart + * @param {} event An event object + * @param {} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "collisionStart", callback: (e: IEventCollision) => void): void; + + /** + * Fired at the start of a tick, before any updates to the engine or timing + * + * @event beforeTick + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeTick", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired after engine timing updated, but just before update + * + * @event tick + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "tick", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired at the end of a tick, after engine update and after rendering + * + * @event afterTick + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterTick", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired before rendering + * + * @event beforeRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "beforeRender", callback: (e: IEventTimestamped) => void): void; + + /** + * Fired after rendering + * + * @event afterRender + * @param {} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + static on(obj: Engine, name: "afterRender", callback: (e: IEventTimestamped) => void): void; /** * Fired when the mouse is down (or a touch has started) during the last step @@ -1482,7 +3158,7 @@ declare module Matter * @param name * @param callback */ - static on(obj:Engine, name:"mousedown", callback:(e:any) => void ):void; + static on(obj: Engine, name: "mousedown", callback: (e: any) => void): void; /** * Fired when the mouse has moved (or a touch moves) during the last step @@ -1490,7 +3166,7 @@ declare module Matter * @param name * @param callback */ - static on(obj:Engine, name:"mousemove", callback:(e:any) => void ):void; + static on(obj: Engine, name: "mousemove", callback: (e: any) => void): void; /** * Fired when the mouse is up (or a touch has ended) during the last step @@ -1498,35 +3174,28 @@ declare module Matter * @param name * @param callback */ - static on(obj:Engine, name:"mouseup", callback:(e:any) => void ):void; + static on(obj: Engine, name: "mouseup", callback: (e: any) => void): void; - /** - * Fired after engine timing updated, but just before engine state updated - * @param obj - * @param name - * @param callback - */ - static on(obj:Engine, name:"tick", callback:(e:any) => void ):void; - static on(obj:Engine, name:string, callback:(e:any) => void ):void; + static on(obj: Engine, name: string, callback: (e: any) => void): void; /** * Removes the given event callback. If no callback, clears all callbacks in eventNames. If no eventNames, clears all events. * - * @param obj - * @param eventName - * @param callback - */ - static off(obj:any, eventName:string, callback: (e:any) => void ):void; + * @param obj + * @param eventName + * @param callback + */ + static off(obj: any, eventName: string, callback: (e: any) => void): void; /** * Fires all the callbacks subscribed to the given object's eventName, in the order they subscribed, if any. * - * @param object - * @param eventNames - * @param event - */ - static trigger( object:any, eventNames:string, event: (e:any) => void ):void; + * @param object + * @param eventNames + * @param event + */ + static trigger(object: any, eventNames: string, event: (e: any) => void): void; } } diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 3471a8fc3..16b167d8a 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -1,10 +1,12 @@ -// Type definitions for Moment.js 2.10.5 +// Type definitions for Moment.js 2.11.1 // Project: https://github.com/timrwood/moment -// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks , Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module moment { + type MomentComparable = Moment | string | number | Date | number[]; + interface MomentDateObject { years?: number; /* One digit */ @@ -97,6 +99,9 @@ declare module moment { days(): number; asDays(): number; + weeks(): number; + asWeeks(): number; + months(): number; asMonths(): number; @@ -115,6 +120,18 @@ declare module moment { toJSON(): string; } + interface MomentLocale { + ordinal(n: number): string; + } + + interface MomentCreationData { + input?: string, + format?: string, + locale: MomentLocale, + isUTC: boolean, + strict?: boolean + } + interface Moment { format(format: string): string; format(): string; @@ -259,8 +276,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment | string | number | Date | number[], suffix?: boolean): string; - to(f: Moment | string | number | Date | number[], suffix?: boolean): string; + from(f: MomentComparable, suffix?: boolean): string; + to(f: MomentComparable, suffix?: boolean): string; toNow(withoutPrefix?: boolean): string; diff(b: Moment): number; @@ -284,15 +301,22 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isBefore(b: MomentComparable, granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isAfter(b: MomentComparable, granularity?: string): boolean; - isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; - isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; + isSame(b: MomentComparable, granularity?: string): boolean; + isBetween(a: MomentComparable, b: MomentComparable, granularity?: string): boolean; - // Deprecated as of 2.8.0. + /** + * @since 2.10.7+ + */ + isSameOrBefore(b: MomentComparable, granularity?: string): boolean; + + /** + * @deprecated since version 2.8.0 + */ lang(language: string): Moment; lang(reset: boolean): Moment; lang(): MomentLanguage; @@ -305,11 +329,15 @@ declare module moment { localeData(reset: boolean): Moment; localeData(): MomentLanguage; - // Deprecated as of 2.7.0. + /** + * @deprecated since version 2.7.0 + */ max(date: Moment | string | number | Date | any[]): Moment; max(date: string, format: string): Moment; - // Deprecated as of 2.7.0. + /** + * @deprecated since version 2.7.0 + */ min(date: Moment | string | number | Date | any[]): Moment; min(date: string, format: string): Moment; @@ -317,9 +345,16 @@ declare module moment { set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; - /*This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.*/ - //Works with version 2.10.5+ + /** + * This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. + * @since 2.10.5+ + */ toObject(): MomentDateObject; + + /** + * @since 2.10.7+ + */ + creationData(): MomentCreationData; } type formatFunction = () => string; @@ -426,7 +461,9 @@ declare module moment { isDuration(): boolean; isDuration(d: any): boolean; - // Deprecated in 2.8.0. + /** + * @deprecated since version 2.8.0 + */ lang(language?: string): string; lang(language?: string, definition?: MomentLanguage): string; @@ -479,6 +516,11 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; + /** + * @since 2.10.7+ + */ + now(): number; + /** * Constant used to enable explicit ISO_8601 format parsing. */ diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 3cb9c3575..806272f45 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -41,6 +41,16 @@ var schema: mongoose.Schema = new Schema({ name: String }, { collection: 'actor' schema.set('collection', 'actor'); var Model = mongoose.model('Actor', schema, 'actor'); +interface IZip extends mongoose.Document { + _id: string; +} +interface IPerson extends mongoose.Document { + _id: mongoose.Types.ObjectId; +} +interface IThing extends mongoose.Document { + _id: number; +} + var names: string[] = mongoose.modelNames(); var names: string[] = db.modelNames(); mongoose.plugin((schema: mongoose.Schema) => { diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index b97162267..6871dc344 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -423,7 +423,7 @@ declare module "mongoose" { export interface Document { id?: string; - _id: Types.ObjectId; + _id: any; equals(doc: Document): boolean; get(path: string, type?: new(...args: any[]) => any): any; diff --git a/mysql/mysql-tests.ts b/mysql/mysql-tests.ts index 97df14dbf..080bece2d 100644 --- a/mysql/mysql-tests.ts +++ b/mysql/mysql-tests.ts @@ -222,6 +222,13 @@ var pool = poolCluster.of('SLAVE*', 'RANDOM'); pool.getConnection(function (err, connection) { }); pool.getConnection(function (err, connection) { }); +var poolClusterWithOptions = mysql.createPoolCluster({ + canRetry: true, + removeNodeErrorCount: 3, + restoreNodeTimeout: 1000, + defaultSelector: 'RR' +}); + // destroy poolCluster.end(); diff --git a/mysql/mysql.d.ts b/mysql/mysql.d.ts index 715c799a2..9239c1907 100644 --- a/mysql/mysql.d.ts +++ b/mysql/mysql.d.ts @@ -408,6 +408,12 @@ declare module "mysql" { */ removeNodeErrorCount?: number; + /** + * If connection fails, specifies the number of milliseconds before another connection attempt will be made. + * If set to 0, then node will be removed instead and never re-used. (Default: 0) + */ + restoreNodeTimeout?: number; + /** * The default selector. (Default: RR) * RR: Select one alternately. (Round-Robin) diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts index 27f50f89c..2fe90fe22 100644 --- a/ng-dialog/ng-dialog-tests.ts +++ b/ng-dialog/ng-dialog-tests.ts @@ -41,7 +41,7 @@ class DialogTestController { class LoginDialogController { - constructor($scope: angular.dialog.IDialogScope) { + constructor($scope:angular.dialog.IDialogScope) { $scope.closeThisDialog("bye"); } diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index 95f02af63..a89abd929 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -10,7 +10,7 @@ declare module angular.dialog { interface IDialogService { getDefaults(): IDialogOptions; open(options: IDialogOpenOptions): IDialogOpenResult; - openConfirm(options: IDialogOpenOptions): IPromise; + openConfirm(options: IDialogOpenConfirmOptions): IPromise; /** * Determine whether the specified dialog is open or not. @@ -25,7 +25,7 @@ declare module angular.dialog { interface IDialogOpenResult { id: string; - close: (value?: string) => void; + close: (value?: any) => void; closePromise: IPromise; } @@ -41,6 +41,21 @@ declare module angular.dialog { * @returns {} */ setDefaults(defaultOptions: IDialogOptions): void; + + /** + * Adds an additional listener on every $locationChangeSuccess event and gets update version of html into dialog. + * May be useful in some rare cases when you're dependant on DOM changes, defaults to false. + * @param {boolean} force + */ + setForceHtmlReload(force: boolean) : void; + + /** + * Adds additional listener on every $locationChangeSuccess event and gets updated version of body into dialog. + * Maybe useful in some rare cases when you're dependant on DOM changes, defaults to false. Use it in module's + * config as provider instance: + * @param {boolean} force + */ + setForceBodyReload(force: boolean) : void; } /** @@ -53,6 +68,27 @@ declare module angular.dialog { * For dialogs opened with the openConfirm() method the value is used as the reject reason. */ closeThisDialog(value?: any): void; + + /** + * Any serializable data that you want to be stored in the controller's dialog scope. + * From version 0.3.6 $scope.ngDialogData keeps references to the objects instead of copying them. + */ + ngDialogData : string | {} | any[]; + + /** + * The id of the dialog. If you you ngDialogData, it'll be also available under ngDialogData.ngDialogId + */ + ngDialogId : string; + } + + interface IDialogConfirmScope extends IDialogScope { + /** + * Use this method to close the dialog and resolve the promise that was returned when opening the modal. + * + * The function accepts a single optional parameter which is used as the value of the resolved promise. + * @param {any} [value] - The value with which the promise will resolve + */ + confirm(value?:any) : void; } interface IDialogOptions { @@ -63,7 +99,7 @@ declare module angular.dialog { className?: string; /** - * If true then animation for the dialog will be disabled, default false. + * If true then animation for the dialog will be disabled, default false. */ disableAnimation?: boolean; @@ -88,6 +124,12 @@ declare module angular.dialog { */ closeByDocument?: boolean; + /** + * Listens for $locationChangeSuccess event and closes open dialogs if true (also handles the ui.router $stateChangeSuccess event if ui.router is used) + * default : false + */ + closeByNavigation?: boolean; + /** * If true allows to use plain string as template, default false. */ @@ -98,7 +140,76 @@ declare module angular.dialog { */ name?: string | number; + /** + * Provide either the name of a function or a function to be called before the dialog is closed. + * If the callback function specified in the option returns false then the dialog will not be closed. + * Alternatively, if the callback function returns a promise that gets resolved the dialog will be closed. + * + * more: https://github.com/likeastore/ngDialog#preclosecallback-string--function + */ preCloseCallback?: string|Function; + + /** + * Pass false to disable template caching. Useful for developing purposes, default is true. + */ + cache?: boolean; + + /** + * Specify your element where to append dialog instance, accepts selector string (e.g. #yourId, .yourClass). + * If not specified appends dialog to body as default behavior. + */ + appendTo?: string; + + /** + * When true, ensures that the focused element remains within the dialog to conform to accessibility recommendations. + * Default value is true + */ + trapFocus?: boolean; + + /** + * When true, closing the dialog restores focus to the element that launched it. Designed to improve keyboard + * accessibility. Default value is true + */ + preserveFocus?: boolean; + + /** + * When true, automatically selects appropriate values for any unspecified accessibility attributes. Default value is true + */ + ariaAuto? : boolean; + + /** + * Specifies the value for the role attribute that should be applied to the dialog element. Default value is null (unspecified) + */ + ariaRole?: string; + + /** + * Specifies the value for the aria-labelledby attribute that should be applied to the dialog element. + * Default value is null (unspecified) + * + * If specified, the value is not validated against the DOM + */ + ariaLabelledById?: string; + + /** + * Specifies the CSS selector for the element to be referenced by the aria-labelledby attribute on the dialog element. Default value is null (unspecified) + * + * If specified, the first matching element is used. + */ + ariaLabelledBySelector?: string; + + /** + * Specifies the value for the aria-describedby attribute that should be applied to the dialog element. Default value is null (unspecified) + * + * If specified, the value is not validated against the DOM. + */ + ariaDescribedById?: string; + + /** + * Specifies the CSS selector for the element to be referenced by the aria-describedby attribute on the dialog element. Default value is null (unspecified) + * + * If specified, the first matching element is used. + */ + ariaDescribedBySelector?: string; } /** @@ -106,15 +217,29 @@ declare module angular.dialog { */ interface IDialogOpenOptions extends IDialogOptions { template: string; - controller?: string|any; + controller?: string| any[] | any; controllerAs?: string; + /** * Scope object that will be passed to dialog. If you use controller with separate $scope service this object will be passed to $scope.$parent param. */ - scope?: ng.IScope; + scope?: IDialogScope; + /** - * Any serializable data that you want to be stored in the controller's dialog scope. + * An optional map of dependencies which should be injected into the controller. If any of these dependencies + * are promises, ngDialog will wait for them all to be resolved or one to be rejected before the controller + * is instantiated. */ - data?: string|Object|any[]; + resolve?: {[key : string] : string | Function}; + + /** + * Any serializable data that you want to be stored in the controller's dialog scope. ($scope.ngDialogData). + * From version 0.3.6 $scope.ngDialogData keeps references to the objects instead of copying them. + */ + data?: string | {} | any[]; + } + + interface IDialogOpenConfirmOptions extends IDialogOpenOptions { + scope?: IDialogConfirmScope; } } diff --git a/ng-file-upload/ng-file-upload-tests.ts b/ng-file-upload/ng-file-upload-tests.ts index 6ff440402..f7fdcf101 100644 --- a/ng-file-upload/ng-file-upload-tests.ts +++ b/ng-file-upload/ng-file-upload-tests.ts @@ -1,53 +1,88 @@ /// -module controllers { +"use strict"; - "use strict"; +let controllerId = "upload"; - var controllerId = "upload"; +class UploadController { + static $inject = ["Upload"]; - class Upload { + constructor(private Upload: angular.angularFileUpload.IUploadService) { + this.Upload.setDefaults({ + ngfAccept: "image/*", + ngfAllowDir: true, + ngfEnableFirefoxPaste: true, + ngfHideOnDropNotAvailable: true, + ngfMaxDuration: 20, + ngfMaxFiles: 10, + ngfMaxSize: "10MB", + ngfMaxTotalSize: "10MB", + ngfMinDuration: "10s", + ngfMinRatio: "8:10,1.6", + ngfMinSize: "9MB", + ngfMultiple: true, + ngfRatio: "8:10,1.6", + ngfStopPropagation: true, + ngfValidateForce: true + }); + } + + onFileSelect(files: Array) { - static $inject = ["$upload"]; - constructor( - private $upload: angular.angularFileUpload.IUploadService - ) { - } + this.Upload + .upload({ + url: "/api/upload", + method: "POST", + data: { + media: files, + extraData: { + test: true + } + } + }).abort().xhr((evt: any) => { + console.log("xhr"); + }).progress((evt: angular.angularFileUpload.IFileProgressEvent) => { + let percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); + console.log("upload progress: " + percent + "% for " + evt.config.data.media[0]); + }).error((data: any, status: number, response: any, headers: any) => { + console.error(data, status, response, headers); + }).success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfigFile) => { + // file is uploaded successfully + console.log("Success!", data, status, headers, config); + }); - onFileSelect($files: File[]) { - // $files: an array of files selected, each file has name, size, and type. - for (var i = 0; i < $files.length; i++) { - var file = $files[i]; - this.$upload.upload({ - url: "/api/upload", - method: "POST", - data: { - extraData: { - fileName: file.name, - test: "anything" - } - }, - file: file - }) - .abort() - .xhr((evt: any) => { - console.log('xhr'); - }) - .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { - var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); - console.log("upload progress: " + percent + "% for " + evt.config.file.name); - }) - .error((data: any, status: number, response: any, headers: any) => { - console.error(data, status, response, headers); - }) - .success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfigFile) => { - // file is uploaded successfully - console.log("Success!", data, status, headers, config); - }); + this.Upload + .base64DataUrl(files[0]) + .then((file: string) => { + console.log(file); + }) - } - } - } + this.Upload + .dataUrl(files[0], true) + .then((result: string) => { + console.log(result); + }); - angular.module("app").controller(controllerId, Upload); + this.Upload + .imageDimensions(files[0]) + .then((imageDimensions) => { + console.log(imageDimensions.height + " " + imageDimensions.width); + }); + + this.Upload.isResizeSupported(); + this.Upload.isResumeSupported(); + this.Upload.isUploadInProgress(); + + let json = this.Upload.json({ test: true }), + jsonBlob = this.Upload.jsonBlob({ test: true }), + fileWithNewName = this.Upload.rename(files[0], "newName.jpg"); + + this.Upload + .resize(files[0], 1024, 1024, 0.7, 'image/jpeg', 0.9, true) + .then((resizedFile) => { + console.log(resizedFile); + }); + } } + +angular.module("app").controller("UploadController", UploadController); diff --git a/ng-file-upload/ng-file-upload.d.ts b/ng-file-upload/ng-file-upload.d.ts index 79b1a91f1..ae646b516 100644 --- a/ng-file-upload/ng-file-upload.d.ts +++ b/ng-file-upload/ng-file-upload.d.ts @@ -1,43 +1,280 @@ -// Type definitions for Angular File Upload 4.2.1 +// Type definitions for Angular File Upload 11.1.1 // Project: https://github.com/danialfarid/ng-file-upload // Definitions by: John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +declare module "ng-file-upload" { + let angularFileUploadDefaultExport: string; + export = angularFileUploadDefaultExport; +} + declare module angular.angularFileUpload { + interface ImageDimensions { + height: number; + width: number; + } + + interface FileUploadOptions { + /** + * Standard HTML accept attr, browser specific select popup window + * @type {string} + */ + ngfAccept?: string; + /** + * Default true, allow dropping files only for Chrome webkit browser + * @type {boolean} + */ + ngfAllowDir?: boolean; + /** + * Default false, enable firefox image paste by making element contenteditable + * @type {boolean} + */ + ngfEnableFirefoxPaste?: boolean; + /** + * Default false, hides element if file drag&drop is not + * @type {boolean} + */ + ngfHideOnDropNotAvailable?: boolean; + /** + * Validate error name: minDuration + * @type {(number|string)} + */ + ngfMinDuration: number | string; + ngfMinSize?: number | string; + /** + * Validate error name: minRatio + * @type {(number|string)} + */ + ngfMinRatio?: number | string; + /** + * Validate error name: maxDuration + * @type {(number|string)} + */ + ngfMaxDuration?: number | string; + /** + * Maximum number of files allowed to be selected or dropped, validate error name: maxFiles + * @type {number} + */ + ngfMaxFiles?: number; + /** + * Validate error name: maxSize + * @type {(number|string)} + */ + ngfMaxSize?: number | string; + /** + * Validate error name: maxTotalSize + * @type {(number|string)} + */ + ngfMaxTotalSize?: number | string; + /** + * Allows selecting multiple files + * @type {boolean} + */ + ngfMultiple?: boolean; + /** + * List of comma separated valid aspect ratio of images in float or 2:3 format + * @type {string} + */ + ngfRatio?: string; + /** + * Default false, whether to propagate drag/drop events. + * @type {boolean} + */ + ngfStopPropagation?: boolean; + /** + * Default false, if true file.$error will be set if the dimension or duration + * values for validations cannot be calculated for example image load error or unsupported video by the browser. + * By default it would assume the file is valid if the duration or dimension cannot be calculated by the browser. + * @type {boolean} + */ + ngfValidateForce?: boolean; + } interface IUploadService { - + /** + * Convert a single file or array of files to a single or array of + * base64 data url representation of the file(s). + * Could be used to send file in base64 format inside json to the databases + * + * @param {Array} + * @return {angular.IPromise} + */ + base64DataUrl(files: File | Array): angular.IPromise | string>; + /** + * Convert the file to blob url object or base64 data url based on boolean disallowObjectUrl value + * + * @param {File} file + * @param {boolean} [disallowObjectUrl] + * @return {angular.IPromise} + */ + dataUrl(file: File, disallowObjectUrl?: boolean): angular.IPromise; + /** + * Alternative way of uploading, send the file binary with the file's content-type. + * Could be used to upload files to CouchDB, imgur, etc... html5 FileReader is needed. + * This is equivalent to angular $http() but allow you to listen to the progress event for HTML5 browsers. + * + * @param {IRequestConfig} config + * @return {angular.IPromise} + */ http(config: IRequestConfig): IUploadPromise; - upload(config: IFileUploadConfigFiles|IFileUploadConfigFile): IUploadPromise; + /** + * Get image file dimensions + * + * @param {File} file + * @return {angular.IPromise} + */ + imageDimensions(file: File): angular.IPromise; + /** + * Returns boolean showing if image resize is supported by this browser + * + * @return {boolean} + */ + isResizeSupported(): boolean; + /** + * Returns boolean showing if resumable upload is supported by this browser + * + * @return {boolean} + */ + isResumeSupported(): boolean; + /** + * Returns true if there is an upload in progress. Can be used to prompt user before closing browser tab + * + * @return {boolean} + */ + isUploadInProgress(): boolean; + /** + * Converts the value to json to send data as json string. Same as angular.toJson(obj) + * + * @param {Object} obj + * @return {string} + */ + json(obj: Object): string; + /** + * Converts the object to a Blob object with application/json content type + * for jsob byte streaming support + * + * @param {Object} obj + * @return {Blob} + */ + jsonBlob(obj: Object): Blob; + /** + * Returns a file which will be uploaded with the newName instead of original file name + * + * @param {File} file + * @param {string} newName + * @return {File} + */ + rename(file: File, newName: string): File; + /** + * Resizes an image. Returns a promise + * + * @param {File} file + * @param {number} [width] + * @param {number} [height] + * @param {number} [quality] + * @param {string} [type] + * @param {number} [ratio] + * @param {boolean} [centerCrop] + * @return {angular.IPromise} + */ + resize(file: File, width?: number, height?: number, quality?: number, type?: string, + ratio?: number | string, centerCrop?: boolean): angular.IPromise; + /** + * Set the default values for ngf-select and ngf-drop directives + * + * @param {FileUploadOptions} defaultFileUploadOptions + */ + setDefaults(defaultFileUploadOptions: FileUploadOptions): void; + /** + * Upload a file. Returns a Promise, + * + * @param {IFileUploadConfigFile} config + * @return {IUploadPromise} + */ + upload(config: IFileUploadConfigFile): IUploadPromise; } interface IUploadPromise extends IHttpPromise { + /** + * Cancel/abort the upload in progress. + * + * @return {IUploadPromise} + */ abort(): IUploadPromise; progress(callback: IHttpPromiseCallback): IUploadPromise; + /** + * Access or attach event listeners to the underlying XMLHttpRequest + * + * @param {IHttpPromiseCallback} + * @return {IUploadPromise} + */ xhr(callback: IHttpPromiseCallback): IUploadPromise; } interface IFileUploadConfigFile extends IRequestConfig { - - file: File; - fileName?: string; - } - - interface IFileUploadConfigFiles extends IRequestConfig { - - file: File[]; - fileName?: string; - } - - interface IFilesProgressEvent extends ProgressEvent { - - config: IFileUploadConfigFiles; + /** + * Specify the file and optional data to be sent to the server. + * Each field including nested objects will be sent as a form data multipart. + * Samples: {pic: file, username: username} + * {files: files, otherInfo: {id: id, person: person,...}} multiple files (html5) + * {profiles: {[{pic: file1, username: username1}, {pic: file2, username: username2}]} nested array multiple files (html5) + * {file: file, info: Upload.json({id: id, name: name, ...})} send fields as json string + * {file: file, info: Upload.jsonBlob({id: id, name: name, ...})} send fields as json blob, 'application/json' content_type + * {picFile: Upload.rename(file, 'profile.jpg'), title: title} send file with picFile key and profile.jpg file name + * + * @type {Object} + */ + data: any; + /** + * upload.php script, node.js route, or servlet url + * @type {string} + */ + url: string; + /** + * This is to accommodate server implementations expecting nested data object keys in .key or [key] format. + * Example: data: {rec: {name: 'N', pic: file}} sent as: rec[name] -> N, rec[pic] -> file + * data: {rec: {name: 'N', pic: file}, objectKey: '.k'} sent as: rec.name -> N, rec.pic -> file + * @type {string} + */ + objectKey?: string; + /** + * This is to accommodate server implementations expecting array data object keys in '[i]' or '[]' or + * ''(multiple entries with same key) format. + * Example: data: {rec: [file[0], file[1], ...]} sent as: rec[0] -> file[0], rec[1] -> file[1],... + * data: {rec: {rec: [f[0], f[1], ...], arrayKey: '[]'} sent as: rec[] -> f[0], rec[] -> f[1],... + * @type {string} + */ + arrayKey?: string; + /** + * Uploaded file size so far on the server + * @type {string} + */ + resumeSizeUrl?: string; + /** + * Reads the uploaded file size from resumeSizeUrl GET response + * @type {Function} + */ + resumeSizeResponseReader?: Function; + /** + * Function that returns a prommise which will be resolved to the upload file size on the server. + * @type {[type]} + */ + resumeSize?: Function; + /** + * Upload in chunks of specified size + * @type {(number|string)} + */ + resumeChunkSize?: number | string; + /** + * Default false, experimental as hotfix for potential library conflicts with other plugins + * @type {boolean} + */ + disableProgress?: boolean; } interface IFileProgressEvent extends ProgressEvent { - config: IFileUploadConfigFile; } -} +} \ No newline at end of file diff --git a/ngprogress/ngprogress.d.ts b/ngprogress/ngprogress.d.ts index fdcdd28cb..20b06d9d6 100644 --- a/ngprogress/ngprogress.d.ts +++ b/ngprogress/ngprogress.d.ts @@ -15,6 +15,10 @@ declare module NgProgress { reset(): void; complete(): void; } + + export interface INgProgressFactory { + createInstance(): INgProgress; + } } diff --git a/node/node-tests.ts b/node/node-tests.ts index 9aebe5c53..8faf5fed6 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -134,6 +134,7 @@ function bufferTests() { var base64Buffer = new Buffer('','base64'); var octets: Uint8Array = null; var octetBuffer = new Buffer(octets); + var copiedBuffer = new Buffer(utf8Buffer); console.log(Buffer.isBuffer(octetBuffer)); console.log(Buffer.isEncoding('utf8')); console.log(Buffer.byteLength('xyz123')); @@ -159,6 +160,15 @@ function bufferTests() { // fill returns the input buffer. b.fill('a').fill('b'); + + { + let buffer = new Buffer('123'); + let index: number; + index = buffer.indexOf("23"); + index = buffer.indexOf("23", 1); + index = buffer.indexOf(23); + index = buffer.indexOf(buffer); + } } diff --git a/node/node.d.ts b/node/node.d.ts index a7f1a1617..928b823e5 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -113,6 +113,12 @@ declare var Buffer: { * @param array The octets to store. */ new (array: any[]): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + new (buffer: Buffer): Buffer; prototype: Buffer; /** * Returns true if {obj} is a Buffer @@ -395,6 +401,7 @@ interface NodeBuffer { writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; fill(value: any, offset?: number, end?: number): Buffer; + indexOf(value: string | number | Buffer, byteOffset?: number): number; } /************************************************ diff --git a/nvd3/nvd3-test-boxplot.ts b/nvd3/nvd3-test-boxplot.ts new file mode 100644 index 000000000..3b7809531 --- /dev/null +++ b/nvd3/nvd3-test-boxplot.ts @@ -0,0 +1,57 @@ +/// +/// +nv.addGraph(function() { + var chart = nv.models.boxPlotChart() + .x(function(d) { return d.label }) + .y(function(d) { return d.values.Q3 }) + .staggerLabels(true) + .maxBoxWidth(75) // prevent boxes from being incredibly wide + .yDomain([0, 500]) + ; + + d3.select('#chart1 svg') + .datum(exampleData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function exampleData() { + return [ + { + label: "Sample A", + values: { + Q1: 120, + Q2: 150, + Q3: 200, + whisker_low: 115, + whisker_high: 210, + outliers: [50, 100, 225] + }, + }, + { + label: "Sample B", + values: { + Q1: 300, + Q2: 350, + Q3: 400, + whisker_low: 225, + whisker_high: 425, + outliers: [175] + }, + }, + { + label: "Sample C", + values: { + Q1: 50, + Q2: 100, + Q3: 125, + whisker_low: 25, + whisker_high: 175, + outliers: [0] + }, + } + ]; + } \ No newline at end of file diff --git a/nvd3/nvd3-test-bullet.ts b/nvd3/nvd3-test-bullet.ts new file mode 100644 index 000000000..6471ef023 --- /dev/null +++ b/nvd3/nvd3-test-bullet.ts @@ -0,0 +1,47 @@ +/// +/// +module nvd3_test_bullet { + var width = 960, + height = 55, + margin = { top: 5, right: 40, bottom: 20, left: 120 }; + + var chart = nv.models.bullet() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var data = [ + { "title": "Revenue", "subtitle": "US$, in thousands", "ranges": [-150, -225, -300], "measures": [-220], "markers": [-250] } + ]; + + //TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element + var vis = d3.select("#chart").selectAll("svg") + .data(data) + .enter().append("svg") + .attr("class", "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis.transition().duration(1000).call(chart); + + var transition = function () { + vis.datum(randomize); + vis.transition().duration(1000).call(chart); + }; + + function randomize(d) { + if (!d.randomizer) d.randomizer = randomizer(d); + d.ranges = d.ranges.map(d.randomizer); + d.markers = d.markers.map(d.randomizer); + d.measures = d.measures.map(d.randomizer); + return d; + } + + function randomizer(d) { + var k = d3.max(d.ranges) * .2; + return function (d) { + return Math.max(0, d + k * (Math.random() - .5)); + }; + } + + d3.select('body').on('click', transition); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-bulletChart.ts b/nvd3/nvd3-test-bulletChart.ts new file mode 100644 index 000000000..1d126a4cf --- /dev/null +++ b/nvd3/nvd3-test-bulletChart.ts @@ -0,0 +1,73 @@ +/// +/// +module nvd3_test_bulletChart { + var width = 960, + height = 80, + margin = { top: 5, right: 40, bottom: 20, left: 120 }; + + var chart = nv.models.bulletChart() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var chart2 = nv.models.bulletChart() + .width(width - margin.right - margin.left) + .height(height - margin.top - margin.bottom); + + var data = [ + { "title": "Revenue", "subtitle": "US$, in thousands", "ranges": [150, 225, 300], "measures": [220], "markers": [250] }, + { "title": "Order Size", "subtitle": "US$, average", "ranges": [350, 500, 600], "measures": [100], "markers": [550] }, + { "title": "Satisfaction", "subtitle": "out of 5", "ranges": [3.5, 4.25, 5], "measures": [3.2, 4.7], "markers": [4.4] } + ]; + + var dataWithLabels = [{ + "title": "Revenue", + "subtitle": "US$, in thousands", + "ranges": [150, 225, 300], + "measures": [220], + "markers": [250, 100], + "markerLabels": ['Target Inventory', 'Low Inventory'], + "rangeLabels": ['Maximum Inventory', 'Average Inventory', 'Minimum Inventory'], + "measureLabels": ['Current Inventory'] + }]; + + //TODO: to be consistent with other models, should be appending a g to an already made svg, not creating the svg element + var vis = d3.select("#chart").selectAll("svg") + .data(data) + .enter().append("svg") + .attr("class", "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis.transition().duration(1000).call(chart); + + var vis2 = d3.select("#chart2").selectAll("svg") + .data(dataWithLabels) + .enter().append('svg') + .attr('class', "bullet nvd3") + .attr("width", width) + .attr("height", height); + + vis2.transition().duration(1000).call(chart2); + + var transition = function () { + vis.datum(randomize).transition().duration(1000).call(chart); + vis2.datum(randomize).transition().duration(1000).call(chart2); + }; + + function randomize(d) { + if (!d.randomizer) d.randomizer = randomizer(d); + d.ranges = d.ranges.map(d.randomizer); + d.markers = d.markers.map(d.randomizer); + d.measures = d.measures.map(d.randomizer); + return d; + } + + function randomizer(d) { + var k = d3.max(d.ranges) * .2; + return function (d) { + return Math.max(0, d + k * (Math.random() - .5)); + }; + } + + d3.select('body').on('click', transition); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-candlestick.ts b/nvd3/nvd3-test-candlestick.ts new file mode 100644 index 000000000..6794b553c --- /dev/null +++ b/nvd3/nvd3-test-candlestick.ts @@ -0,0 +1,90 @@ +/// +module nvd3_test_candlestick { + var data = [{ + values: [ + { "date": 15854, "open": 165.42, "high": 165.8, "low": 164.34, "close": 165.22, "volume": 160363400, "adjusted": 164.35 }, + { "date": 15855, "open": 165.35, "high": 166.59, "low": 165.22, "close": 165.83, "volume": 107793800, "adjusted": 164.96 }, + { "date": 15856, "open": 165.37, "high": 166.31, "low": 163.13, "close": 163.45, "volume": 176850100, "adjusted": 162.59 }, + { "date": 15859, "open": 163.83, "high": 164.46, "low": 162.66, "close": 164.35, "volume": 168390700, "adjusted": 163.48 }, + { "date": 15860, "open": 164.44, "high": 165.1, "low": 162.73, "close": 163.56, "volume": 157631500, "adjusted": 162.7 }, + { "date": 15861, "open": 163.09, "high": 163.42, "low": 161.13, "close": 161.27, "volume": 211737800, "adjusted": 160.42 }, + { "date": 15862, "open": 161.2, "high": 162.74, "low": 160.25, "close": 162.73, "volume": 200225500, "adjusted": 161.87 }, + { "date": 15863, "open": 163.85, "high": 164.95, "low": 163.14, "close": 164.8, "volume": 188337800, "adjusted": 163.93 }, + { "date": 15866, "open": 165.31, "high": 165.4, "low": 164.37, "close": 164.8, "volume": 105667100, "adjusted": 163.93 }, + { "date": 15867, "open": 163.3, "high": 164.54, "low": 162.74, "close": 163.1, "volume": 159505400, "adjusted": 162.24 }, + { "date": 15868, "open": 164.22, "high": 164.39, "low": 161.6, "close": 161.75, "volume": 177361500, "adjusted": 160.9 }, + { "date": 15869, "open": 161.66, "high": 164.5, "low": 161.3, "close": 164.21, "volume": 163587800, "adjusted": 163.35 }, + { "date": 15870, "open": 164.03, "high": 164.67, "low": 162.91, "close": 163.18, "volume": 141197500, "adjusted": 162.32 }, + { "date": 15873, "open": 164.29, "high": 165.22, "low": 163.22, "close": 164.44, "volume": 136295600, "adjusted": 163.57 }, + { "date": 15874, "open": 164.53, "high": 165.99, "low": 164.52, "close": 165.74, "volume": 114695600, "adjusted": 164.87 }, + { "date": 15875, "open": 165.6, "high": 165.89, "low": 163.38, "close": 163.45, "volume": 206149500, "adjusted": 162.59 }, + { "date": 15876, "open": 161.86, "high": 163.47, "low": 158.98, "close": 159.4, "volume": 321255900, "adjusted": 158.56 }, + { "date": 15877, "open": 159.64, "high": 159.76, "low": 157.47, "close": 159.07, "volume": 271956800, "adjusted": 159.07 }, + { "date": 15880, "open": 157.41, "high": 158.43, "low": 155.73, "close": 157.06, "volume": 222329000, "adjusted": 157.06 }, + { "date": 15881, "open": 158.48, "high": 160.1, "low": 157.42, "close": 158.57, "volume": 162262200, "adjusted": 158.57 }, + { "date": 15882, "open": 159.87, "high": 160.5, "low": 159.25, "close": 160.14, "volume": 134848000, "adjusted": 160.14 }, + { "date": 15883, "open": 161.1, "high": 161.82, "low": 160.95, "close": 161.08, "volume": 129483700, "adjusted": 161.08 }, + { "date": 15884, "open": 160.63, "high": 161.4, "low": 159.86, "close": 160.42, "volume": 160402900, "adjusted": 160.42 }, + { "date": 15887, "open": 161.26, "high": 162.48, "low": 161.08, "close": 161.36, "volume": 131954800, "adjusted": 161.36 }, + { "date": 15888, "open": 161.12, "high": 162.3, "low": 160.5, "close": 161.21, "volume": 154863700, "adjusted": 161.21 }, + { "date": 15889, "open": 160.48, "high": 161.77, "low": 160.22, "close": 161.28, "volume": 75216400, "adjusted": 161.28 }, + { "date": 15891, "open": 162.47, "high": 163.08, "low": 161.3, "close": 163.02, "volume": 122416900, "adjusted": 163.02 }, + { "date": 15894, "open": 163.86, "high": 164.39, "low": 163.08, "close": 163.95, "volume": 108092500, "adjusted": 163.95 }, + { "date": 15895, "open": 164.98, "high": 165.33, "low": 164.27, "close": 165.13, "volume": 119298000, "adjusted": 165.13 }, + { "date": 15896, "open": 164.97, "high": 165.75, "low": 164.63, "close": 165.19, "volume": 121410100, "adjusted": 165.19 }, + { "date": 15897, "open": 167.11, "high": 167.61, "low": 165.18, "close": 167.44, "volume": 135592200, "adjusted": 167.44 }, + { "date": 15898, "open": 167.39, "high": 167.93, "low": 167.13, "close": 167.51, "volume": 104212700, "adjusted": 167.51 }, + { "date": 15901, "open": 167.97, "high": 168.39, "low": 167.68, "close": 168.15, "volume": 69450600, "adjusted": 168.15 }, + { "date": 15902, "open": 168.26, "high": 168.36, "low": 167.07, "close": 167.52, "volume": 88702100, "adjusted": 167.52 }, + { "date": 15903, "open": 168.16, "high": 168.48, "low": 167.73, "close": 167.95, "volume": 92873900, "adjusted": 167.95 }, + { "date": 15904, "open": 168.31, "high": 169.27, "low": 168.2, "close": 168.87, "volume": 103620100, "adjusted": 168.87 }, + { "date": 15905, "open": 168.52, "high": 169.23, "low": 168.31, "close": 169.17, "volume": 103831700, "adjusted": 169.17 }, + { "date": 15908, "open": 169.41, "high": 169.74, "low": 169.01, "close": 169.5, "volume": 79428600, "adjusted": 169.5 }, + { "date": 15909, "open": 169.8, "high": 169.83, "low": 169.05, "close": 169.14, "volume": 80829700, "adjusted": 169.14 }, + { "date": 15910, "open": 169.79, "high": 169.86, "low": 168.18, "close": 168.52, "volume": 112914000, "adjusted": 168.52 }, + { "date": 15911, "open": 168.22, "high": 169.08, "low": 167.94, "close": 168.93, "volume": 111088600, "adjusted": 168.93 }, + { "date": 15912, "open": 168.22, "high": 169.16, "low": 167.52, "close": 169.11, "volume": 107814600, "adjusted": 169.11 }, + { "date": 15915, "open": 168.68, "high": 169.06, "low": 168.11, "close": 168.59, "volume": 79695000, "adjusted": 168.59 }, + { "date": 15916, "open": 169.1, "high": 169.28, "low": 168.19, "close": 168.59, "volume": 85209600, "adjusted": 168.59 }, + { "date": 15917, "open": 168.94, "high": 169.85, "low": 168.49, "close": 168.71, "volume": 142388700, "adjusted": 168.71 }, + { "date": 15918, "open": 169.99, "high": 170.81, "low": 169.9, "close": 170.66, "volume": 110438400, "adjusted": 170.66 }, + { "date": 15919, "open": 170.28, "high": 170.97, "low": 170.05, "close": 170.95, "volume": 91116700, "adjusted": 170.95 }, + { "date": 15922, "open": 170.57, "high": 170.96, "low": 170.35, "close": 170.7, "volume": 54072700, "adjusted": 170.7 }, + { "date": 15923, "open": 170.37, "high": 170.74, "low": 169.35, "close": 169.73, "volume": 87495000, "adjusted": 169.73 }, + { "date": 15924, "open": 169.19, "high": 169.43, "low": 168.55, "close": 169.18, "volume": 84854700, "adjusted": 169.18 }, + { "date": 15925, "open": 169.98, "high": 170.18, "low": 168.93, "close": 169.8, "volume": 102181300, "adjusted": 169.8 }, + { "date": 15926, "open": 169.58, "high": 170.1, "low": 168.72, "close": 169.31, "volume": 91757700, "adjusted": 169.31 }, + { "date": 15929, "open": 168.46, "high": 169.31, "low": 168.38, "close": 169.11, "volume": 68593300, "adjusted": 169.11 }, + { "date": 15930, "open": 169.41, "high": 169.9, "low": 168.41, "close": 169.61, "volume": 80806000, "adjusted": 169.61 }, + { "date": 15931, "open": 169.53, "high": 169.8, "low": 168.7, "close": 168.74, "volume": 79829200, "adjusted": 168.74 }, + { "date": 15932, "open": 167.41, "high": 167.43, "low": 166.09, "close": 166.38, "volume": 152931800, "adjusted": 166.38 }, + { "date": 15933, "open": 166.06, "high": 166.63, "low": 165.5, "close": 165.83, "volume": 130868200, "adjusted": 165.83 }, + { "date": 15936, "open": 165.64, "high": 166.21, "low": 164.76, "close": 164.77, "volume": 96437600, "adjusted": 164.77 }, + { "date": 15937, "open": 165.04, "high": 166.2, "low": 164.86, "close": 165.58, "volume": 89294400, "adjusted": 165.58 }, + { "date": 15938, "open": 165.12, "high": 166.03, "low": 164.19, "close": 164.56, "volume": 159530500, "adjusted": 164.56 }, + { "date": 15939, "open": 164.9, "high": 166.3, "low": 164.89, "close": 166.06, "volume": 101471400, "adjusted": 166.06 }, + { "date": 15940, "open": 166.55, "high": 166.83, "low": 165.77, "close": 166.62, "volume": 90888900, "adjusted": 166.62 }, + { "date": 15943, "open": 166.79, "high": 167.3, "low": 165.89, "close": 166, "volume": 89702100, "adjusted": 166 }, + { "date": 15944, "open": 164.36, "high": 166, "low": 163.21, "close": 163.33, "volume": 158619400, "adjusted": 163.33 }, + { "date": 15945, "open": 163.26, "high": 164.49, "low": 163.05, "close": 163.91, "volume": 108113000, "adjusted": 163.91 }, + { "date": 15946, "open": 163.55, "high": 165.04, "low": 163.4, "close": 164.17, "volume": 119200500, "adjusted": 164.17 }, + { "date": 15947, "open": 164.51, "high": 164.53, "low": 163.17, "close": 163.65, "volume": 134560800, "adjusted": 163.65 }, + { "date": 15951, "open": 165.23, "high": 165.58, "low": 163.7, "close": 164.39, "volume": 142322300, "adjusted": 164.39 }, + { "date": 15952, "open": 164.43, "high": 166.03, "low": 164.13, "close": 165.75, "volume": 97304000, "adjusted": 165.75 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.candlestickBar() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }); + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-candlestickChart.ts b/nvd3/nvd3-test-candlestickChart.ts new file mode 100644 index 000000000..ac753341e --- /dev/null +++ b/nvd3/nvd3-test-candlestickChart.ts @@ -0,0 +1,108 @@ +/// +module nvd3_test_candlestickChart { + var data = [{ + values: [ + { "date": 15854, "open": 165.42, "high": 165.8, "low": 164.34, "close": 165.22, "volume": 160363400, "adjusted": 164.35 }, + { "date": 15855, "open": 165.35, "high": 166.59, "low": 165.22, "close": 165.83, "volume": 107793800, "adjusted": 164.96 }, + { "date": 15856, "open": 165.37, "high": 166.31, "low": 163.13, "close": 163.45, "volume": 176850100, "adjusted": 162.59 }, + { "date": 15859, "open": 163.83, "high": 164.46, "low": 162.66, "close": 164.35, "volume": 168390700, "adjusted": 163.48 }, + { "date": 15860, "open": 164.44, "high": 165.1, "low": 162.73, "close": 163.56, "volume": 157631500, "adjusted": 162.7 }, + { "date": 15861, "open": 163.09, "high": 163.42, "low": 161.13, "close": 161.27, "volume": 211737800, "adjusted": 160.42 }, + { "date": 15862, "open": 161.2, "high": 162.74, "low": 160.25, "close": 162.73, "volume": 200225500, "adjusted": 161.87 }, + { "date": 15863, "open": 163.85, "high": 164.95, "low": 163.14, "close": 164.8, "volume": 188337800, "adjusted": 163.93 }, + { "date": 15866, "open": 165.31, "high": 165.4, "low": 164.37, "close": 164.8, "volume": 105667100, "adjusted": 163.93 }, + { "date": 15867, "open": 163.3, "high": 164.54, "low": 162.74, "close": 163.1, "volume": 159505400, "adjusted": 162.24 }, + { "date": 15868, "open": 164.22, "high": 164.39, "low": 161.6, "close": 161.75, "volume": 177361500, "adjusted": 160.9 }, + { "date": 15869, "open": 161.66, "high": 164.5, "low": 161.3, "close": 164.21, "volume": 163587800, "adjusted": 163.35 }, + { "date": 15870, "open": 164.03, "high": 164.67, "low": 162.91, "close": 163.18, "volume": 141197500, "adjusted": 162.32 }, + { "date": 15873, "open": 164.29, "high": 165.22, "low": 163.22, "close": 164.44, "volume": 136295600, "adjusted": 163.57 }, + { "date": 15874, "open": 164.53, "high": 165.99, "low": 164.52, "close": 165.74, "volume": 114695600, "adjusted": 164.87 }, + { "date": 15875, "open": 165.6, "high": 165.89, "low": 163.38, "close": 163.45, "volume": 206149500, "adjusted": 162.59 }, + { "date": 15876, "open": 161.86, "high": 163.47, "low": 158.98, "close": 159.4, "volume": 321255900, "adjusted": 158.56 }, + { "date": 15877, "open": 159.64, "high": 159.76, "low": 157.47, "close": 159.07, "volume": 271956800, "adjusted": 159.07 }, + { "date": 15880, "open": 157.41, "high": 158.43, "low": 155.73, "close": 157.06, "volume": 222329000, "adjusted": 157.06 }, + { "date": 15881, "open": 158.48, "high": 160.1, "low": 157.42, "close": 158.57, "volume": 162262200, "adjusted": 158.57 }, + { "date": 15882, "open": 159.87, "high": 160.5, "low": 159.25, "close": 160.14, "volume": 134848000, "adjusted": 160.14 }, + { "date": 15883, "open": 161.1, "high": 161.82, "low": 160.95, "close": 161.08, "volume": 129483700, "adjusted": 161.08 }, + { "date": 15884, "open": 160.63, "high": 161.4, "low": 159.86, "close": 160.42, "volume": 160402900, "adjusted": 160.42 }, + { "date": 15887, "open": 161.26, "high": 162.48, "low": 161.08, "close": 161.36, "volume": 131954800, "adjusted": 161.36 }, + { "date": 15888, "open": 161.12, "high": 162.3, "low": 160.5, "close": 161.21, "volume": 154863700, "adjusted": 161.21 }, + { "date": 15889, "open": 160.48, "high": 161.77, "low": 160.22, "close": 161.28, "volume": 75216400, "adjusted": 161.28 }, + { "date": 15891, "open": 162.47, "high": 163.08, "low": 161.3, "close": 163.02, "volume": 122416900, "adjusted": 163.02 }, + { "date": 15894, "open": 163.86, "high": 164.39, "low": 163.08, "close": 163.95, "volume": 108092500, "adjusted": 163.95 }, + { "date": 15895, "open": 164.98, "high": 165.33, "low": 164.27, "close": 165.13, "volume": 119298000, "adjusted": 165.13 }, + { "date": 15896, "open": 164.97, "high": 165.75, "low": 164.63, "close": 165.19, "volume": 121410100, "adjusted": 165.19 }, + { "date": 15897, "open": 167.11, "high": 167.61, "low": 165.18, "close": 167.44, "volume": 135592200, "adjusted": 167.44 }, + { "date": 15898, "open": 167.39, "high": 167.93, "low": 167.13, "close": 167.51, "volume": 104212700, "adjusted": 167.51 }, + { "date": 15901, "open": 167.97, "high": 168.39, "low": 167.68, "close": 168.15, "volume": 69450600, "adjusted": 168.15 }, + { "date": 15902, "open": 168.26, "high": 168.36, "low": 167.07, "close": 167.52, "volume": 88702100, "adjusted": 167.52 }, + { "date": 15903, "open": 168.16, "high": 168.48, "low": 167.73, "close": 167.95, "volume": 92873900, "adjusted": 167.95 }, + { "date": 15904, "open": 168.31, "high": 169.27, "low": 168.2, "close": 168.87, "volume": 103620100, "adjusted": 168.87 }, + { "date": 15905, "open": 168.52, "high": 169.23, "low": 168.31, "close": 169.17, "volume": 103831700, "adjusted": 169.17 }, + { "date": 15908, "open": 169.41, "high": 169.74, "low": 169.01, "close": 169.5, "volume": 79428600, "adjusted": 169.5 }, + { "date": 15909, "open": 169.8, "high": 169.83, "low": 169.05, "close": 169.14, "volume": 80829700, "adjusted": 169.14 }, + { "date": 15910, "open": 169.79, "high": 169.86, "low": 168.18, "close": 168.52, "volume": 112914000, "adjusted": 168.52 }, + { "date": 15911, "open": 168.22, "high": 169.08, "low": 167.94, "close": 168.93, "volume": 111088600, "adjusted": 168.93 }, + { "date": 15912, "open": 168.22, "high": 169.16, "low": 167.52, "close": 169.11, "volume": 107814600, "adjusted": 169.11 }, + { "date": 15915, "open": 168.68, "high": 169.06, "low": 168.11, "close": 168.59, "volume": 79695000, "adjusted": 168.59 }, + { "date": 15916, "open": 169.1, "high": 169.28, "low": 168.19, "close": 168.59, "volume": 85209600, "adjusted": 168.59 }, + { "date": 15917, "open": 168.94, "high": 169.85, "low": 168.49, "close": 168.71, "volume": 142388700, "adjusted": 168.71 }, + { "date": 15918, "open": 169.99, "high": 170.81, "low": 169.9, "close": 170.66, "volume": 110438400, "adjusted": 170.66 }, + { "date": 15919, "open": 170.28, "high": 170.97, "low": 170.05, "close": 170.95, "volume": 91116700, "adjusted": 170.95 }, + { "date": 15922, "open": 170.57, "high": 170.96, "low": 170.35, "close": 170.7, "volume": 54072700, "adjusted": 170.7 }, + { "date": 15923, "open": 170.37, "high": 170.74, "low": 169.35, "close": 169.73, "volume": 87495000, "adjusted": 169.73 }, + { "date": 15924, "open": 169.19, "high": 169.43, "low": 168.55, "close": 169.18, "volume": 84854700, "adjusted": 169.18 }, + { "date": 15925, "open": 169.98, "high": 170.18, "low": 168.93, "close": 169.8, "volume": 102181300, "adjusted": 169.8 }, + { "date": 15926, "open": 169.58, "high": 170.1, "low": 168.72, "close": 169.31, "volume": 91757700, "adjusted": 169.31 }, + { "date": 15929, "open": 168.46, "high": 169.31, "low": 168.38, "close": 169.11, "volume": 68593300, "adjusted": 169.11 }, + { "date": 15930, "open": 169.41, "high": 169.9, "low": 168.41, "close": 169.61, "volume": 80806000, "adjusted": 169.61 }, + { "date": 15931, "open": 169.53, "high": 169.8, "low": 168.7, "close": 168.74, "volume": 79829200, "adjusted": 168.74 }, + { "date": 15932, "open": 167.41, "high": 167.43, "low": 166.09, "close": 166.38, "volume": 152931800, "adjusted": 166.38 }, + { "date": 15933, "open": 166.06, "high": 166.63, "low": 165.5, "close": 165.83, "volume": 130868200, "adjusted": 165.83 }, + { "date": 15936, "open": 165.64, "high": 166.21, "low": 164.76, "close": 164.77, "volume": 96437600, "adjusted": 164.77 }, + { "date": 15937, "open": 165.04, "high": 166.2, "low": 164.86, "close": 165.58, "volume": 89294400, "adjusted": 165.58 }, + { "date": 15938, "open": 165.12, "high": 166.03, "low": 164.19, "close": 164.56, "volume": 159530500, "adjusted": 164.56 }, + { "date": 15939, "open": 164.9, "high": 166.3, "low": 164.89, "close": 166.06, "volume": 101471400, "adjusted": 166.06 }, + { "date": 15940, "open": 166.55, "high": 166.83, "low": 165.77, "close": 166.62, "volume": 90888900, "adjusted": 166.62 }, + { "date": 15943, "open": 166.79, "high": 167.3, "low": 165.89, "close": 166, "volume": 89702100, "adjusted": 166 }, + { "date": 15944, "open": 164.36, "high": 166, "low": 163.21, "close": 163.33, "volume": 158619400, "adjusted": 163.33 }, + { "date": 15945, "open": 163.26, "high": 164.49, "low": 163.05, "close": 163.91, "volume": 108113000, "adjusted": 163.91 }, + { "date": 15946, "open": 163.55, "high": 165.04, "low": 163.4, "close": 164.17, "volume": 119200500, "adjusted": 164.17 }, + { "date": 15947, "open": 164.51, "high": 164.53, "low": 163.17, "close": 163.65, "volume": 134560800, "adjusted": 163.65 }, + { "date": 15951, "open": 165.23, "high": 165.58, "low": 163.7, "close": 164.39, "volume": 142322300, "adjusted": 164.39 }, + { "date": 15952, "open": 164.43, "high": 166.03, "low": 164.13, "close": 165.75, "volume": 97304000, "adjusted": 165.75 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.candlestickBarChart() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }) + .duration(250) + .margin({ left: 75, bottom: 50 }); + + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Dates") + .tickFormat(function (d) { + // I didn't feel like changing all the above date values + // so I hack it to make each value fall on a different date + return d3.time.format('%x')(new Date(new Date().valueOf() - (20000 * 86400000) + (d * 86400000))); + }); + + chart.yAxis + .axisLabel('Stock Price') + .tickFormat(function (d, i) { return '$' + d3.format(',.1f')(d); }); + + + + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-cumulativeLineChart.ts b/nvd3/nvd3-test-cumulativeLineChart.ts new file mode 100644 index 000000000..fc7df21ed --- /dev/null +++ b/nvd3/nvd3-test-cumulativeLineChart.ts @@ -0,0 +1,75 @@ +/// +module nvd3_test_cumulativeLineChart { + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, + // and may do more in the future... it's NOT required + nv.addGraph(function () { + var chart = nv.models.cumulativeLineChart() + .useInteractiveGuideline(true) + .x(function (d) { return d[0] }) + .y(function (d) { return d[1] / 100 }) + .color(d3.scale.category10().range()) + .average(function (d) { return d.mean / 100; }) + .duration(300) + .clipVoronoi(false); + chart.dispatch.on('renderEnd', function () { + console.log('render complete: cumulative line with guide line'); + }); + + chart.xAxis.tickFormat(function (d) { + return d3.time.format('%m/%d/%y')(new Date(d)) + }); + + chart.yAxis.tickFormat(d3.format(',.1%')); + + d3.select('#chart1 svg') + .datum(cumulativeTestData()) + .call(chart); + + //TODO: Figure out a good way to do this automatically + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + chart.state.dispatch.on('change', function (state) { + nv.log('state', JSON.stringify(state)); + }); + + return chart; + }); + + function flatTestData() { + return [{ + key: "Snakes", + values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(function (d) { + var currentDate = new Date(); + currentDate.setDate(currentDate.getDate() + d); + return [currentDate, 0] + }) + }]; + } + + function cumulativeTestData() { + return [ + { + key: "Long", + values: [[1083297600000, -2.974623048543], [1085976000000, -1.7740300785979], [1088568000000, 4.4681318138177], [1091246400000, 7.0242541001353], [1093924800000, 7.5709603667586], [1096516800000, 20.612245065736], [1099195200000, 21.698065237316], [1101790800000, 40.501189458018], [1104469200000, 50.464679413194], [1107147600000, 48.917421973355], [1109566800000, 63.750936549160], [1112245200000, 59.072499126460], [1114833600000, 43.373158880492], [1117512000000, 54.490918947556], [1120104000000, 56.661178852079], [1122782400000, 73.450103545496], [1125460800000, 71.714526354907], [1128052800000, 85.221664349607], [1130734800000, 77.769261392481], [1133326800000, 95.966528716500], [1136005200000, 107.59132116397], [1138683600000, 127.25740096723], [1141102800000, 122.13917498830], [1143781200000, 126.53657279774], [1146369600000, 132.39300992970], [1149048000000, 120.11238242904], [1151640000000, 118.41408917750], [1154318400000, 107.92918924621], [1156996800000, 110.28057249569], [1159588800000, 117.20485334692], [1162270800000, 141.33556756948], [1164862800000, 159.59452727893], [1167541200000, 167.09801853304], [1170219600000, 185.46849659215], [1172638800000, 184.82474099990], [1175313600000, 195.63155213887], [1177905600000, 207.40597044171], [1180584000000, 230.55966698196], [1183176000000, 239.55649035292], [1185854400000, 241.35915085208], [1188532800000, 239.89428956243], [1191124800000, 260.47781917715], [1193803200000, 276.39457482225], [1196398800000, 258.66530682672], [1199077200000, 250.98846121893], [1201755600000, 226.89902618127], [1204261200000, 227.29009273807], [1206936000000, 218.66476654350], [1209528000000, 232.46605902918], [1212206400000, 253.25667081117], [1214798400000, 235.82505363925], [1217476800000, 229.70112774254], [1220155200000, 225.18472705952], [1222747200000, 189.13661746552], [1225425600000, 149.46533007301], [1228021200000, 131.00340772114], [1230699600000, 135.18341728866], [1233378000000, 109.15296887173], [1235797200000, 84.614772549760], [1238472000000, 100.60810015326], [1241064000000, 141.50134895610], [1243742400000, 142.50405083675], [1246334400000, 139.81192372672], [1249012800000, 177.78205544583], [1251691200000, 194.73691933074], [1254283200000, 209.00838460225], [1256961600000, 198.19855877420], [1259557200000, 222.37102417812], [1262235600000, 234.24581081250], [1264914000000, 228.26087689346], [1267333200000, 248.81895126250], [1270008000000, 270.57301075186], [1272600000000, 292.64604322550], [1275278400000, 265.94088520518], [1277870400000, 237.82887467569], [1280548800000, 265.55973314204], [1283227200000, 248.30877330928], [1285819200000, 278.14870066912], [1288497600000, 292.69260960288], [1291093200000, 300.84263809599], [1293771600000, 326.17253914628], [1296450000000, 337.69335966505], [1298869200000, 339.73260965121], [1301544000000, 346.87865120765], [1304136000000, 347.92991526628], [1306814400000, 342.04627502669], [1309406400000, 333.45386231233], [1312084800000, 323.15034181243], [1314763200000, 295.66126882331], [1317355200000, 251.48014579253], [1320033600000, 295.15424257905], [1322629200000, 294.54766764397], [1325307600000, 295.72906119051], [1327986000000, 325.73351347613], [1330491600000, 340.16106061186], [1333166400000, 345.15514071490], [1335758400000, 337.10259395679], [1338436800000, 318.68216333837], [1341028800000, 317.03683945246], [1343707200000, 318.53549659997], [1346385600000, 332.85381464104], [1348977600000, 337.36534373477], [1351656000000, 350.27872156161], [1354251600000, 349.45128876100]] + , + mean: 250 + }, + { + key: "Short", + values: [[1083297600000, -0.77078283705125], [1085976000000, -1.8356366650335], [1088568000000, -5.3121322073127], [1091246400000, -4.9320975829662], [1093924800000, -3.9835408823225], [1096516800000, -6.8694685316805], [1099195200000, -8.4854877428545], [1101790800000, -15.933627197384], [1104469200000, -15.920980069544], [1107147600000, -12.478685045651], [1109566800000, -17.297761889305], [1112245200000, -15.247129891020], [1114833600000, -11.336459046839], [1117512000000, -13.298990907415], [1120104000000, -16.360027000056], [1122782400000, -18.527929522030], [1125460800000, -22.176516738685], [1128052800000, -23.309665368330], [1130734800000, -21.629973409748], [1133326800000, -24.186429093486], [1136005200000, -29.116707312531], [1138683600000, -37.188037874864], [1141102800000, -34.689264821198], [1143781200000, -39.505932105359], [1146369600000, -45.339572492759], [1149048000000, -43.849353192764], [1151640000000, -45.418353922571], [1154318400000, -44.579281059919], [1156996800000, -44.027098363370], [1159588800000, -41.261306759439], [1162270800000, -47.446018534027], [1164862800000, -53.413782948909], [1167541200000, -50.700723647419], [1170219600000, -56.374090913296], [1172638800000, -61.754245220322], [1175313600000, -66.246241587629], [1177905600000, -75.351650899999], [1180584000000, -81.699058262032], [1183176000000, -82.487023368081], [1185854400000, -86.230055113277], [1188532800000, -84.746914818507], [1191124800000, -100.77134971977], [1193803200000, -109.95435565947], [1196398800000, -99.605672965057], [1199077200000, -99.607249394382], [1201755600000, -94.874614950188], [1204261200000, -105.35899063105], [1206936000000, -106.01931193802], [1209528000000, -110.28883571771], [1212206400000, -119.60256203030], [1214798400000, -115.62201315802], [1217476800000, -106.63824185202], [1220155200000, -99.848746318951], [1222747200000, -85.631219602987], [1225425600000, -63.547909262067], [1228021200000, -59.753275364457], [1230699600000, -63.874977883542], [1233378000000, -56.865697387488], [1235797200000, -54.285579501988], [1238472000000, -56.474659581885], [1241064000000, -63.847137745644], [1243742400000, -68.754247867325], [1246334400000, -69.474257009155], [1249012800000, -75.084828197067], [1251691200000, -77.101028237237], [1254283200000, -80.454866854387], [1256961600000, -78.984349952220], [1259557200000, -83.041230807854], [1262235600000, -84.529748348935], [1264914000000, -83.837470195508], [1267333200000, -87.174487671969], [1270008000000, -90.342293007487], [1272600000000, -93.550928464991], [1275278400000, -85.833102140765], [1277870400000, -79.326501831592], [1280548800000, -87.986196903537], [1283227200000, -85.397862121771], [1285819200000, -94.738167050020], [1288497600000, -98.661952897151], [1291093200000, -99.609665952708], [1293771600000, -103.57099836183], [1296450000000, -104.04353411322], [1298869200000, -108.21382792587], [1301544000000, -108.74006900920], [1304136000000, -112.07766650960], [1306814400000, -109.63328199118], [1309406400000, -106.53578966772], [1312084800000, -103.16480871469], [1314763200000, -95.945078001828], [1317355200000, -81.226687340874], [1320033600000, -90.782206596168], [1322629200000, -89.484445370113], [1325307600000, -88.514723135326], [1327986000000, -93.381292724320], [1330491600000, -97.529705609172], [1333166400000, -99.520481439189], [1335758400000, -99.430184898669], [1338436800000, -93.349934521973], [1341028800000, -95.858475286491], [1343707200000, -95.522755836605], [1346385600000, -98.503848862036], [1348977600000, -101.49415251896], [1351656000000, -101.50099325672], [1354251600000, -99.487094927489]] + , + mean: -60 + }, + { + key: "Gross", + mean: 125, + values: [[1083297600000, -3.7454058855943], [1085976000000, -3.6096667436314], [1088568000000, -0.8440003934950], [1091246400000, 2.0921565171691], [1093924800000, 3.5874194844361], [1096516800000, 13.742776534056], [1099195200000, 13.212577494462], [1101790800000, 24.567562260634], [1104469200000, 34.543699343650], [1107147600000, 36.438736927704], [1109566800000, 46.453174659855], [1112245200000, 43.825369235440], [1114833600000, 32.036699833653], [1117512000000, 41.191928040141], [1120104000000, 40.301151852023], [1122782400000, 54.922174023466], [1125460800000, 49.538009616222], [1128052800000, 61.911998981277], [1130734800000, 56.139287982733], [1133326800000, 71.780099623014], [1136005200000, 78.474613851439], [1138683600000, 90.069363092366], [1141102800000, 87.449910167102], [1143781200000, 87.030640692381], [1146369600000, 87.053437436941], [1149048000000, 76.263029236276], [1151640000000, 72.995735254929], [1154318400000, 63.349908186291], [1156996800000, 66.253474132320], [1159588800000, 75.943546587481], [1162270800000, 93.889549035453], [1164862800000, 106.18074433002], [1167541200000, 116.39729488562], [1170219600000, 129.09440567885], [1172638800000, 123.07049577958], [1175313600000, 129.38531055124], [1177905600000, 132.05431954171], [1180584000000, 148.86060871993], [1183176000000, 157.06946698484], [1185854400000, 155.12909573880], [1188532800000, 155.14737474392], [1191124800000, 159.70646945738], [1193803200000, 166.44021916278], [1196398800000, 159.05963386166], [1199077200000, 151.38121182455], [1201755600000, 132.02441123108], [1204261200000, 121.93110210702], [1206936000000, 112.64545460548], [1209528000000, 122.17722331147], [1212206400000, 133.65410878087], [1214798400000, 120.20304048123], [1217476800000, 123.06288589052], [1220155200000, 125.33598074057], [1222747200000, 103.50539786253], [1225425600000, 85.917420810943], [1228021200000, 71.250132356683], [1230699600000, 71.308439405118], [1233378000000, 52.287271484242], [1235797200000, 30.329193047772], [1238472000000, 44.133440571375], [1241064000000, 77.654211210456], [1243742400000, 73.749802969425], [1246334400000, 70.337666717565], [1249012800000, 102.69722724876], [1251691200000, 117.63589109350], [1254283200000, 128.55351774786], [1256961600000, 119.21420882198], [1259557200000, 139.32979337027], [1262235600000, 149.71606246357], [1264914000000, 144.42340669795], [1267333200000, 161.64446359053], [1270008000000, 180.23071774437], [1272600000000, 199.09511476051], [1275278400000, 180.10778306442], [1277870400000, 158.50237284410], [1280548800000, 177.57353623850], [1283227200000, 162.91091118751], [1285819200000, 183.41053361910], [1288497600000, 194.03065670573], [1291093200000, 201.23297214328], [1293771600000, 222.60154078445], [1296450000000, 233.35556801977], [1298869200000, 231.22452435045], [1301544000000, 237.84432503045], [1304136000000, 235.55799131184], [1306814400000, 232.11873570751], [1309406400000, 226.62381538123], [1312084800000, 219.34811113539], [1314763200000, 198.69242285581], [1317355200000, 168.90235629066], [1320033600000, 202.64725756733], [1322629200000, 203.05389378105], [1325307600000, 204.85986680865], [1327986000000, 229.77085616585], [1330491600000, 239.65202435959], [1333166400000, 242.33012622734], [1335758400000, 234.11773262149], [1338436800000, 221.47846307887], [1341028800000, 216.98308827912], [1343707200000, 218.37781386755], [1346385600000, 229.39368622736], [1348977600000, 230.54656412916], [1351656000000, 243.06087025523], [1354251600000, 244.24733578385]] + }, + { + key: "S&P 1500", + values: [[1083297600000, -1.7798428181819], [1085976000000, -0.36883324836999], [1088568000000, 1.7312581046040], [1091246400000, -1.8356125950460], [1093924800000, -1.5396564170877], [1096516800000, -0.16867791409247], [1099195200000, 1.3754263993413], [1101790800000, 5.8171640898041], [1104469200000, 9.4350145241608], [1107147600000, 6.7649081510160], [1109566800000, 9.1568499314776], [1112245200000, 7.2485090994419], [1114833600000, 4.8762222306595], [1117512000000, 8.5992339354652], [1120104000000, 9.0896517982086], [1122782400000, 13.394644048577], [1125460800000, 12.311842010760], [1128052800000, 13.221003650717], [1130734800000, 11.218481009206], [1133326800000, 15.565352598445], [1136005200000, 15.623703865926], [1138683600000, 19.275255326383], [1141102800000, 19.432433717836], [1143781200000, 21.232881244655], [1146369600000, 22.798299192958], [1149048000000, 19.006125095476], [1151640000000, 19.151889158536], [1154318400000, 19.340022855452], [1156996800000, 22.027934841859], [1159588800000, 24.903300681329], [1162270800000, 29.146492833877], [1164862800000, 31.781626082589], [1167541200000, 33.358770738428], [1170219600000, 35.622684613497], [1172638800000, 33.332821711366], [1175313600000, 34.878748635832], [1177905600000, 40.582332613844], [1180584000000, 45.719535502920], [1183176000000, 43.239344722386], [1185854400000, 38.550955100342], [1188532800000, 40.585368816283], [1191124800000, 45.601374057981], [1193803200000, 48.051404337892], [1196398800000, 41.582581696032], [1199077200000, 40.650580792748], [1201755600000, 32.252222066493], [1204261200000, 28.106390258553], [1206936000000, 27.532698196687], [1209528000000, 33.986390463852], [1212206400000, 36.302660526438], [1214798400000, 25.015574480172], [1217476800000, 23.989494069029], [1220155200000, 25.934351445531], [1222747200000, 14.627592011699], [1225425600000, -5.2249403809749], [1228021200000, -12.330933408050], [1230699600000, -11.000291508188], [1233378000000, -18.563864948088], [1235797200000, -27.213097001687], [1238472000000, -20.834133840523], [1241064000000, -12.717886701719], [1243742400000, -8.1644613083526], [1246334400000, -7.9108408918201], [1249012800000, -0.77002391591209], [1251691200000, 2.8243816569672], [1254283200000, 6.8761411421070], [1256961600000, 4.5060912230294], [1259557200000, 10.487179794349], [1262235600000, 13.251375597594], [1264914000000, 9.2207594803415], [1267333200000, 12.836276936538], [1270008000000, 19.816793904978], [1272600000000, 22.156787167211], [1275278400000, 12.518039090576], [1277870400000, 6.4253587440854], [1280548800000, 13.847372028409], [1283227200000, 8.5454736090364], [1285819200000, 18.542801953304], [1288497600000, 23.037064683183], [1291093200000, 23.517422401888], [1293771600000, 31.804723416068], [1296450000000, 34.778247386072], [1298869200000, 39.584883855230], [1301544000000, 40.080647664875], [1304136000000, 44.180050667889], [1306814400000, 42.533535927221], [1309406400000, 40.105374449011], [1312084800000, 37.014659267156], [1314763200000, 29.263745084262], [1317355200000, 19.637463417584], [1320033600000, 33.157645345770], [1322629200000, 32.895053150988], [1325307600000, 34.111544824647], [1327986000000, 40.453985817473], [1330491600000, 46.435700783313], [1333166400000, 51.062385488671], [1335758400000, 50.130448220658], [1338436800000, 41.035476682018], [1341028800000, 46.591932296457], [1343707200000, 48.349391180634], [1346385600000, 51.913011286919], [1348977600000, 55.747238313752], [1351656000000, 52.991824077209], [1354251600000, 49.556311883284]] + } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-discreteBarChart.ts b/nvd3/nvd3-test-discreteBarChart.ts new file mode 100644 index 000000000..cb7b444c6 --- /dev/null +++ b/nvd3/nvd3-test-discreteBarChart.ts @@ -0,0 +1,60 @@ +/// +module nvd3_test_discreteBarChart { + var historicalBarChart = [ + { + key: "Cumulative Return", + values: [ + { + "label": "A", + "value": 29.765957771107 + }, + { + "label": "B", + "value": 0 + }, + { + "label": "C", + "value": 32.807804682612 + }, + { + "label": "D", + "value": 196.45946739256 + }, + { + "label": "E", + "value": 0.19434030906893 + }, + { + "label": "F", + "value": 98.079782601442 + }, + { + "label": "G", + "value": 13.925743130903 + }, + { + "label": "H", + "value": 5.1387322875705 + } + ] + } + ]; + + nv.addGraph(function () { + var chart = nv.models.discreteBarChart() + .x(function (d) { return d.label }) + .y(function (d) { return d.value }) + .staggerLabels(true) + //.staggerLabels(historicalBarChart[0].values.length > 8) + .showValues(true) + .duration(250) + ; + + d3.select('#chart1 svg') + .datum(historicalBarChart) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-donutChart.ts b/nvd3/nvd3-test-donutChart.ts new file mode 100644 index 000000000..69f4d6c1f --- /dev/null +++ b/nvd3/nvd3-test-donutChart.ts @@ -0,0 +1,93 @@ +/// +module nvd3_test_donutChart { + var testdata = [ + { key: "One", y: 5 }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + + var height = 350; + var width = 350; + + var chart1; + nv.addGraph(function () { + var chart1 = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .width(width) + .height(height) + .padAngle(.08) + .cornerRadius(5) + .id('donut1'); // allow custom CSS for this one svg + + chart1.title("100%"); + chart1.pie.donutLabelsOutside(true).donut(true); + + d3.select("#test1") + .datum(testdata) + .transition().duration(1200) + .call(chart1); + + // LISTEN TO WINDOW RESIZE + // nv.utils.windowResize(chart1.update); + + // LISTEN TO CLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementClick', function() { + // code... + // }); + + // chart.pie.dispatch.on('chartClick', function() { + // code... + // }); + + // LISTEN TO DOUBLECLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementDblClick', function() { + // code... + // }); + + // LISTEN TO THE renderEnd EVENT OF THE PIE/DONUT + // chart.pie.dispatch.on('renderEnd', function() { + // code... + // }); + + // OTHER EVENTS DISPATCHED BY THE PIE INCLUDE: elementMouseover, elementMouseout, elementMousemove + // @see nv.models.pie + + return chart1; + + }); + + var chart2; + nv.addGraph(function () { + var chart2 = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + //.labelThreshold(.08) + //.showLabels(false) + .color(d3.scale.category20().range().slice(10)) + .width(width) + .height(height) + .donut(true) + .id('donut2') + .titleOffset(-30) + .title("woot"); + + // MAKES IT HALF CIRCLE + chart2.pie + .startAngle(function (d) { return d.startAngle / 2 - Math.PI / 2 }) + .endAngle(function (d) { return d.endAngle / 2 - Math.PI / 2 }); + + d3.select("#test2") + //.datum(historicalBarChart) + .datum(testdata) + .transition().duration(1200) + .call(chart2); + + return chart2; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-furiousLegend.ts b/nvd3/nvd3-test-furiousLegend.ts new file mode 100644 index 000000000..3477d064b --- /dev/null +++ b/nvd3/nvd3-test-furiousLegend.ts @@ -0,0 +1,72 @@ +/// +module nvd3_test_furiousLegend { + var width = 500, + height = 40; + + var legend = nv.models.legend().vers('furious'); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); + + var legend2 = nv.models.legend().vers('furious') + .align(false); + + d3.select('#test2') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()).call(legend2); + + var legend3 = nv.models.legend().vers('furious') + .width(900) + .padding(70); + + d3.select('#test3') + .attr('width', 900) + .attr('height', 200) + .datum(sinAndCos()).call(legend3); + + var update = function (i, l) { + d3.select('#test' + i).call(l); + } + + update(1, legend); + legend.dispatch.on('stateChange', function (d) { + console.log(d); + update(1, legend); + }); + + legend2.dispatch.on('stateChange', function (d) { + console.log(d); + update(2, legend2); + }); + + legend3.dispatch.on('stateChange', function (d) { + console.log(d); + update(3, legend3); + }); + + d3.select('#changeData').on('click', function () { + var exp = legend.expanded(); + + legend.expanded(!exp); + + d3.select('#test1') + .call(legend); + }); + + function sinAndCos() { + return [ + { key: "Sine Wave" }, + { key: "averylongserieslabelthatcontainsmorethantwentycharacters" }, + { key: "A Very Long Series Label" }, + { key: "A Very Long Series Label" }, + { key: "Cosine Wave" }, + { key: "Another test label" }, + { key: "Bonds", disengaged: true }, + { key: "Stocks", disengaged: true }, + { key: "Apple", disengaged: true } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-historicalBar.ts b/nvd3/nvd3-test-historicalBar.ts new file mode 100644 index 000000000..dc765cdcd --- /dev/null +++ b/nvd3/nvd3-test-historicalBar.ts @@ -0,0 +1,59 @@ +/// +/// +nv.addGraph({ + generate: function() { + var chart = nv.models.historicalBar(); + + d3.select("#test1") + .datum(sinData()) + .datum(sinData()) + .transition() + .call(chart); + + return chart; + }, + callback: function(graph) { + graph.dispatch.on('elementMouseover', function(e) { + var offsetElement = document.getElementById("chart"), + left = e.pos[0], + top = e.pos[1]; + var content = '

' + e.point.y + '

'; + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's'); + }); + + graph.dispatch.on('elementMouseout', function(e) { + nv.tooltip.cleanup(); + }); + } +}); + +//Simple test data generators +function sinAndCos() { + var sin = [], + cos = []; + + for (var i = 0; i < 100; i++) { + sin.push({x: i, y: Math.sin(i/10)}); + cos.push({x: i, y: .5 * Math.cos(i/10)}); + } + + return [ + {values: sin, key: "Sine Wave", color: "#ff7f0e"}, + {values: cos, key: "Cosine Wave", color: "#2ca02c"} + ]; +} + +function sinData() { + var sin = []; + + for (var i = 0; i < 100; i++) { + sin.push({x: i, y: Math.sin(i/10)}); + } + + return [{ + values: sin, + key: "Sine Wave", + color: "#ff7f0e" + }]; +} \ No newline at end of file diff --git a/nvd3/nvd3-test-historicalBarChart.ts b/nvd3/nvd3-test-historicalBarChart.ts new file mode 100644 index 000000000..dfd8a30ae --- /dev/null +++ b/nvd3/nvd3-test-historicalBarChart.ts @@ -0,0 +1,165 @@ +/// +/// +var data = [{ + values : [] + }]; + + var i, x; + var gap = false; + var prevVal = 3000; + var tickCount = 100; + var probEnterGap = 0.1; + var probExitGap = 0.2; + var barTimespan = 30 * 60; // thirty minutes in seconds + var startOfTime = 1425096000; + for (i = 0; i < tickCount; i++) { + x = startOfTime + i * barTimespan; + if (!gap) { + if (Math.random() > probEnterGap) { + prevVal += (Math.random() - 0.5) * 500; + if (prevVal <= 0) { + prevVal = Math.random() * 100; + } + data[0].values.push({x: x * 1000, y: prevVal}); + } + else { + gap = true; + } + } + else { + if (Math.random() < probExitGap) { + gap = false; + } + } + } + + var chart : nv.HistoricalBarChart; + + var halfBarXMin = data[0].values[0].x - barTimespan / 2 * 1000; + var halfBarXMax = data[0].values[data[0].values.length-1].x + barTimespan / 2 * 1000; + + function renderChart(location, meaning) { + nv.addGraph(function() { + chart = nv.models.historicalBarChart(); + chart + .xScale(d3.time.scale()) // use a time scale instead of plain numbers in order to get nice round default values in the axis + .color(['#68c']) + .forceX([halfBarXMin, halfBarXMax]) // fix half-bar problem on the first and last bars + .useInteractiveGuideline(true) // check out the css that turns the guideline into this nice thing + .margin({"left": 80, "right": 50, "top": 20, "bottom": 30}) + .duration(0) + ; + + var tickMultiFormat = d3.time.format.multi([ + ["%-I:%M%p", function(d) { return d.getMinutes(); }], // not the beginning of the hour + ["%-I%p", function(d) { return d.getHours(); }], // not midnight + ["%b %-d", function(d) { return d.getDate() != 1; }], // not the first of the month + ["%b %-d", function(d) { return d.getMonth(); }], // not Jan 1st + ["%Y", function() { return true; }] + ]); + chart.xAxis + .showMaxMin(false) + .tickPadding(10) + .tickFormat(function (d) { return tickMultiFormat(new Date(d)); }) + ; + + chart.yAxis + .showMaxMin(false) + .tickFormat(d3.format(",.0f")) + ; + + var svgElem = d3.select(location); + svgElem + .datum(data) + .transition() + .call(chart); + + // make our own x-axis tick marks because NVD3 doesn't provide any + var tickY2 = chart.yAxis.scale().range()[1]; + var lineElems = svgElem + .select('.nv-x.nv-axis.nvd3-svg') + .select('.nvd3.nv-wrap.nv-axis') + .select('g') + .selectAll('.tick') + .data(chart.xScale().ticks()) + .append('line') + .attr('class', 'x-axis-tick-mark') + .attr('x2', 0) + .attr('y1', tickY2 + 4) + .attr('y2', tickY2) + .attr('stroke-width', 1) + ; + + // set up the tooltip to display full dates + var tsFormat = d3.time.format('%b %-d, %Y %I:%M%p'); + var contentGenerator = chart.interactiveLayer.tooltip.contentGenerator(); + var tooltip = chart.interactiveLayer.tooltip; + tooltip.contentGenerator(function (d) { d.value = d.series[0].data.x; return contentGenerator(d); }); + tooltip.headerFormatter(function (d) { return tsFormat(new Date(d)); }); + + // common stuff for the sections below + var xScale = chart.xScale(); + var xPixelFirstBar = xScale(data[0].values[0].x); + var xPixelSecondBar = xScale(data[0].values[0].x + barTimespan * 1000); + var barWidth = xPixelSecondBar - xPixelFirstBar; // number of pixels representing time delta per bar + + // fix the bar widths so they don't overlap when there are gaps + function fixBarWidths(barSpacingFraction) { + svgElem + .selectAll('.nv-bars') + .selectAll('rect') + .attr('width', (1 - barSpacingFraction) * barWidth) + .attr('transform', function(d, i) { + var deltaX = xScale(data[0].values[i].x) - xPixelFirstBar; + deltaX += barSpacingFraction / 2 * barWidth; + return 'translate(' + deltaX + ', 0)'; + }) + ; + } + + /* + If you're representing sample measurements spaced a certain time apart, the tick marks should + be in the middle of the bars and some spacing between bars is recommended to aid with interpretation. + On the other hand, if you want to represent a quantity measured over a span of time (one bar), you're + better off placing the ticks on the edge of the bar and leaving no gap in between bars. + */ + function shiftXAxis() { + var xAxisElem = svgElem.select('.nv-axis.nv-x'); + var transform = xAxisElem.attr('transform'); + var xShift = -barWidth/2; + transform = transform.replace('0,', xShift + ','); + xAxisElem.attr('transform', transform); + } + + if (meaning === 'instant') { + fixBarWidths(0.2); + } + else if (meaning === 'timespan') { + fixBarWidths(0.0); + shiftXAxis(); + } + + return chart; + }); + } + + renderChart('#test1', 'instant'); + renderChart('#test2', 'timespan'); + + window.setTimeout(function() { + window.setTimeout(function() { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + }, 0); + }, 0); + + function switchChartStyle(style) { + if (style === 'instant') { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + } + else if (style === 'timespan') { + document.getElementById('sc-one').style.display = 'none'; + document.getElementById('sc-two').style.display = 'block'; + } + } diff --git a/nvd3/nvd3-test-legend.ts b/nvd3/nvd3-test-legend.ts new file mode 100644 index 000000000..99f4de2b7 --- /dev/null +++ b/nvd3/nvd3-test-legend.ts @@ -0,0 +1,69 @@ +/// +/// +module nvd3_test_legend { + var width = 500, + height = 20; + + var legend = nv.models.legend(); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); + + var legend2 = nv.models.legend() + .align(false); + + d3.select('#test2') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()).call(legend2); + + var legend3 = nv.models.legend() + .width(900) + .padding(70); + + d3.select('#test3') + .attr('width', 900) + .attr('height', 200) + .datum(sinAndCos()).call(legend3); + + var update = function () { + d3.select('#test1').call(legend); + } + + update(); + legend.dispatch.on('stateChange', function (d) { + console.log(d); + update(); + }); + + d3.select('#changeData').on('click', function () { + d3.select('#test1') + .datum(differentData()) + .call(legend); + }); + + function sinAndCos() { + return [ + { key: "Sine Wave" }, + { key: "A Very Long Label With Over Twenty Characters" }, + { key: "A Very Long Series Label With Over Twenty Characters" }, + { key: "A Very Long Series Label With Over Twenty Characters" }, + { key: "Cosine Wave" }, + { key: "Another test label" } + ]; + } + + function differentData() { + return [ + { key: "Fixed Income" }, + { key: "Derivatives" }, + { key: "Credit Default Swaps" }, + { key: "Equities" }, + { key: "Bonds" }, + { key: "Stocks" }, + { key: "Apple" } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-line.ts b/nvd3/nvd3-test-line.ts new file mode 100644 index 000000000..b96bbfcb9 --- /dev/null +++ b/nvd3/nvd3-test-line.ts @@ -0,0 +1,71 @@ +/// +module nvd3_test_line { + nv.addGraph({ + generate: function () { + var width = nv.utils.windowSize().width - 40, + height = nv.utils.windowSize().height - 40; + + var chart = nv.models.line() + .width(width) + .height(height) + .margin({ top: 20, right: 20, bottom: 20, left: 20 }); + + chart.dispatch.on('renderEnd', function () { + console.log('render complete'); + }); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()) + .call(chart); + + return chart; + }, + callback: function (graph) { + window.onresize = function () { + var width = nv.utils.windowSize().width - 40, + height = nv.utils.windowSize().height - 40, + margin = graph.margin(); + + if (width < margin.left + margin.right + 20) + width = margin.left + margin.right + 20; + + if (height < margin.top + margin.bottom + 20) + height = margin.top + margin.bottom + 20; + + graph.width(width).height(height); + + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .call(graph); + }; + } + }); + + function sinAndCos() { + var sin = [], + cos = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.sin(i / 10) }); + cos.push({ x: i, y: .5 * Math.cos(i / 10) }); + } + + return [ + { + values: sin, + key: "Sine Wave", + color: "#ff7f0e" + }, + { + values: cos, + key: "Cosine Wave", + color: "#2ca02c", + strokeWidth: 3 + } + ]; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineChart.ts b/nvd3/nvd3-test-lineChart.ts new file mode 100644 index 000000000..6591899ee --- /dev/null +++ b/nvd3/nvd3-test-lineChart.ts @@ -0,0 +1,103 @@ +/// +module nvd3_test_lineChart { + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required + var chart; + var data; + + var randomizeFillOpacity = function () { + var rand = Math.random(); + for (var i = 0; i < 100; i++) { // modify sine amplitude + data[4].values[i].y = Math.sin(i / (5 + rand)) * .4 * rand - .25; + } + data[4].fillOpacity = rand; + chart.update(); + }; + + nv.addGraph(function () { + chart = nv.models.lineChart() + .options({ + transitionDuration: 300, + useInteractiveGuideline: true + }) + ; + + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Time (s)") + .tickFormat(d3.format(',.1f')) + .staggerLabels(true) + ; + + chart.yAxis + .axisLabel('Voltage (v)') + .tickFormat(function (d) { + if (d == null) { + return 'N/A'; + } + return d3.format(',.2f')(d); + }) + ; + + data = sinAndCos(); + + d3.select('#chart1').append('svg') + .datum(data) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function sinAndCos() { + var sin = [], + sin2 = [], + cos = [], + rand = [], + rand2 = [] + ; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: i % 10 == 5 ? null : Math.sin(i / 10) }); //the nulls are to show how defined works + sin2.push({ x: i, y: Math.sin(i / 5) * 0.4 - 0.25 }); + cos.push({ x: i, y: .5 * Math.cos(i / 10) }); + rand.push({ x: i, y: Math.random() / 10 }); + rand2.push({ x: i, y: Math.cos(i / 10) + Math.random() / 10 }) + } + + return [ + { + area: true, + values: sin, + key: "Sine Wave", + color: "#ff7f0e", + strokeWidth: 4, + classed: 'dashed' + }, + { + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + }, + { + values: rand, + key: "Random Points", + color: "#2222ff" + }, + { + values: rand2, + key: "Random Cosine", + color: "#667711", + strokeWidth: 3.5 + }, + { + area: true, + values: sin2, + key: "Fill opacity", + color: "#EF9CFB", + fillOpacity: .1 + } + ]; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineChartLogScale.ts b/nvd3/nvd3-test-lineChartLogScale.ts new file mode 100644 index 000000000..bea43a5dc --- /dev/null +++ b/nvd3/nvd3-test-lineChartLogScale.ts @@ -0,0 +1,67 @@ +/// +module nvd3_test_lineChartLogScale { +var chart; + var data; + + + nv.addGraph(function () { + chart = nv.models.lineChart() + .x(function (d) { return d.x; }) + .options({ + showLegend: true, + showYAxis: true, + showXAxis: true, + useInteractiveGuideline: true + }); + + data = GenerateData(); + + chart.xAxis + .axisLabel("x axis") + .tickFormat(d3.format('0.2f')); + + chart.yScale(d3.scale.log()); + chart.yAxis + .axisLabel("Log axis") + .tickFormat(d3.format('.4e')); + + d3.select('#chart1').append('svg') + .datum(data) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + + }); + + function GenerateData() { + var sin = [], + sin2 = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.abs(i % 10 == 5 ? null : Math.sin(i / 10)) }); //the nulls are to show how defined works + sin2.push({ x: i, y: Math.abs(Math.sin(i / 5) * 0.4 - 0.25) }); + + } + + return [ + { + area: true, + values: sin, + key: "l1", + color: "#ff7f0e", + strokeWidth: 4, + classed: 'dashed' + }, + { + values: sin2, + key: "l2", + color: "#2ca02c" + } + ]; + + } + + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineChartSVGResize.ts b/nvd3/nvd3-test-lineChartSVGResize.ts new file mode 100644 index 000000000..3c6f7cd8d --- /dev/null +++ b/nvd3/nvd3-test-lineChartSVGResize.ts @@ -0,0 +1,108 @@ +/// +module nvd3_test_lineChartSVGResize { + nv.addGraph(function () { + var chart = nv.models.lineChart(); + var fitScreen = false; + var width = 600; + var height = 300; + var zoom = 1; + + chart.useInteractiveGuideline(true); + chart.xAxis + .tickFormat(d3.format(',r')); + + chart.lines.dispatch.on("elementClick", function (evt) { + console.log(evt); + }); + + chart.yAxis + .axisLabel('Voltage (v)') + .tickFormat(d3.format(',.2f')); + + d3.select('#chart1 svg') + .attr('perserveAspectRatio', 'xMinYMid') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); + + setChartViewBox(); + resizeChart(); + + nv.utils.windowResize(resizeChart); + + d3.select('#zoomIn').on('click', zoomIn); + d3.select('#zoomOut').on('click', zoomOut); + + + function setChartViewBox() { + var w = width * zoom, + h = height * zoom; + + chart + .width(w) + .height(h); + + d3.select('#chart1 svg') + .attr('viewBox', '0 0 ' + w + ' ' + h) + .transition().duration(500) + .call(chart); + } + + function zoomOut() { + zoom += .25; + setChartViewBox(); + } + + function zoomIn() { + if (zoom <= .5) return; + zoom -= .25; + setChartViewBox(); + } + + // This resize simply sets the SVG's dimensions, without a need to recall the chart code + // Resizing because of the viewbox and perserveAspectRatio settings + // This scales the interior of the chart unlike the above + function resizeChart() { + var container = d3.select('#chart1'); + var svg = container.select('svg'); + + if (fitScreen) { + // resize based on container's width AND HEIGHT + var windowSize = nv.utils.windowSize(); + svg.attr("width", windowSize.width); + svg.attr("height", windowSize.height); + } else { + // resize based on container's width + var aspect = chart.width() / chart.height(); + var targetWidth = parseInt(container.style('width')); + svg.attr("width", targetWidth); + svg.attr("height", Math.round(targetWidth / aspect)); + } + } + return chart; + }); + + function sinAndCos() { + var sin = [], + cos = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.sin(i / 10) }); + cos.push({ x: i, y: .5 * Math.cos(i / 10) }); + } + return [ + { + values: sin, + key: "Sine Wave", + color: "#ff7f0e" + }, + { + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + } + ]; + } + + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-linePlusBarChart.ts b/nvd3/nvd3-test-linePlusBarChart.ts new file mode 100644 index 000000000..1d7e71915 --- /dev/null +++ b/nvd3/nvd3-test-linePlusBarChart.ts @@ -0,0 +1,47 @@ +/// +module nvd3_test_linePlusBarChart { + var testdata = [ + { + "key": "Quantity", + "bar": true, + "values": [[1136005200000, 1271000.0], [1138683600000, 1271000.0], [1141102800000, 1271000.0], [1143781200000, 0], [1146369600000, 0], [1149048000000, 0], [1151640000000, 0], [1154318400000, 0], [1156996800000, 0], [1159588800000, 3899486.0], [1162270800000, 3899486.0], [1164862800000, 3899486.0], [1167541200000, 3564700.0], [1170219600000, 3564700.0], [1172638800000, 3564700.0], [1175313600000, 2648493.0], [1177905600000, 2648493.0], [1180584000000, 2648493.0], [1183176000000, 2522993.0], [1185854400000, 2522993.0], [1188532800000, 2522993.0], [1191124800000, 2906501.0], [1193803200000, 2906501.0], [1196398800000, 2906501.0], [1199077200000, 2206761.0], [1201755600000, 2206761.0], [1204261200000, 2206761.0], [1206936000000, 2287726.0], [1209528000000, 2287726.0], [1212206400000, 2287726.0], [1214798400000, 2732646.0], [1217476800000, 2732646.0], [1220155200000, 2732646.0], [1222747200000, 2599196.0], [1225425600000, 2599196.0], [1228021200000, 2599196.0], [1230699600000, 1924387.0], [1233378000000, 1924387.0], [1235797200000, 1924387.0], [1238472000000, 1756311.0], [1241064000000, 1756311.0], [1243742400000, 1756311.0], [1246334400000, 1743470.0], [1249012800000, 1743470.0], [1251691200000, 1743470.0], [1254283200000, 1519010.0], [1256961600000, 1519010.0], [1259557200000, 1519010.0], [1262235600000, 1591444.0], [1264914000000, 1591444.0], [1267333200000, 1591444.0], [1270008000000, 1543784.0], [1272600000000, 1543784.0], [1275278400000, 1543784.0], [1277870400000, 1309915.0], [1280548800000, 1309915.0], [1283227200000, 1309915.0], [1285819200000, 1331875.0], [1288497600000, 1331875.0], [1291093200000, 1331875.0], [1293771600000, 1331875.0], [1296450000000, 1154695.0], [1298869200000, 1154695.0], [1301544000000, 1194025.0], [1304136000000, 1194025.0], [1306814400000, 1194025.0], [1309406400000, 1194025.0], [1312084800000, 1194025.0], [1314763200000, 1244525.0], [1317355200000, 475000.0], [1320033600000, 475000.0], [1322629200000, 475000.0], [1325307600000, 690033.0], [1327986000000, 690033.0], [1330491600000, 690033.0], [1333166400000, 514733.0], [1335758400000, 514733.0]] + }, + { + "key": "Price", + "values": [[1136005200000, 71.89], [1138683600000, 75.51], [1141102800000, 68.49], [1143781200000, 62.72], [1146369600000, 70.39], [1149048000000, 59.77], [1151640000000, 57.27], [1154318400000, 67.96], [1156996800000, 67.85], [1159588800000, 76.98], [1162270800000, 81.08], [1164862800000, 91.66], [1167541200000, 84.84], [1170219600000, 85.73], [1172638800000, 84.61], [1175313600000, 92.91], [1177905600000, 99.8], [1180584000000, 121.191], [1183176000000, 122.04], [1185854400000, 131.76], [1188532800000, 138.48], [1191124800000, 153.47], [1193803200000, 189.95], [1196398800000, 182.22], [1199077200000, 198.08], [1201755600000, 135.36], [1204261200000, 125.02], [1206936000000, 143.5], [1209528000000, 173.95], [1212206400000, 188.75], [1214798400000, 167.44], [1217476800000, 158.95], [1220155200000, 169.53], [1222747200000, 113.66], [1225425600000, 107.59], [1228021200000, 92.67], [1230699600000, 85.35], [1233378000000, 90.13], [1235797200000, 89.31], [1238472000000, 105.12], [1241064000000, 125.83], [1243742400000, 135.81], [1246334400000, 142.43], [1249012800000, 163.39], [1251691200000, 168.21], [1254283200000, 185.35], [1256961600000, 188.5], [1259557200000, 199.91], [1262235600000, 210.732], [1264914000000, 192.063], [1267333200000, 204.62], [1270008000000, 235.0], [1272600000000, 261.09], [1275278400000, 256.88], [1277870400000, 251.53], [1280548800000, 257.25], [1283227200000, 243.1], [1285819200000, 283.75], [1288497600000, 300.98], [1291093200000, 311.15], [1293771600000, 322.56], [1296450000000, 339.32], [1298869200000, 353.21], [1301544000000, 348.5075], [1304136000000, 350.13], [1306814400000, 347.83], [1309406400000, 335.67], [1312084800000, 390.48], [1314763200000, 384.83], [1317355200000, 381.32], [1320033600000, 404.78], [1322629200000, 382.2], [1325307600000, 405.0], [1327986000000, 456.48], [1330491600000, 542.44], [1333166400000, 599.55], [1335758400000, 583.98]] + } + ].map(function (series) { + series.values = series.values.map(function (d) { return { x: d[0], y: d[1] } }); + return series; + }); + + var chart; + nv.addGraph(function () { + chart = nv.models.linePlusBarChart() + .margin({ top: 50, right: 80, bottom: 30, left: 80 }) + .legendRightAxisHint(' [Using Right Axis]') + .color(d3.scale.category10().range()); + + chart.xAxis.tickFormat(function (d) { + return d3.time.format('%x')(new Date(d)) + }) + .showMaxMin(false); + + chart.y1Axis.tickFormat(function (d) { return '$' + d3.format(',f')(d) }); + chart.bars.forceY([0]).padData(false); + + chart.x2Axis.tickFormat(function (d) { + return d3.time.format('%x')(new Date(d)) + }).showMaxMin(false); + + d3.select('#chart1 svg') + .datum(testdata) + .transition().duration(500).call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineWithFocusChart.ts b/nvd3/nvd3-test-lineWithFocusChart.ts new file mode 100644 index 000000000..5a0347647 --- /dev/null +++ b/nvd3/nvd3-test-lineWithFocusChart.ts @@ -0,0 +1,33 @@ +/// +module nvd3_test_lineWithFocusChart { + nv.addGraph(function () { + var chart = nv.models.lineWithFocusChart(); + + chart.brushExtent([50, 70]); + + chart.xAxis.tickFormat(d3.format(',f')).axisLabel("Stream - 3,128,.1"); + chart.x2Axis.tickFormat(d3.format(',f')); + chart.yAxis.tickFormat(d3.format(',.2f')); + chart.y2Axis.tickFormat(d3.format(',.2f')); + chart.useInteractiveGuideline(true); + + d3.select('#chart svg') + .datum(testData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function testData() { + return [3, 128, .1].map(function (data, i) { + //todo resolve this return stream_layers(3, 128, .1).map(function (data, i) { + return { + key: 'Stream' + i, + area: i === 1, + values: data + }; + }); + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts b/nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts new file mode 100644 index 000000000..16d79414c --- /dev/null +++ b/nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts @@ -0,0 +1,36 @@ +/// +module nvd3_test_lineWithFocusChartx2AxisLabel { + + nv.addGraph(function () { + var chart = nv.models.lineWithFocusChart(); + + chart.brushExtent([50, 70]); + + chart.xAxis.tickFormat(d3.format(',f')); + chart.focusHeight(50 + 20); + chart.focusMargin({ "bottom": 20 + 20 }); + chart.x2Axis.tickFormat(d3.format(',f')).axisLabel("Stream - 3,128,.1"); + chart.yAxis.tickFormat(d3.format(',.2f')); + chart.y2Axis.tickFormat(d3.format(',.2f')); + chart.useInteractiveGuideline(true); + + d3.select('#chart svg') + .datum(testData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function testData() { + return [3, 128, .1].map(function (data, i) { + // todo reolve stream_layers return stream_layers(3, 128, .1).map(function (data, i) { + return { + key: 'Stream' + i, + area: i === 1, + values: data + }; + }); + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-monitoringChart.ts b/nvd3/nvd3-test-monitoringChart.ts new file mode 100644 index 000000000..20e28da4f --- /dev/null +++ b/nvd3/nvd3-test-monitoringChart.ts @@ -0,0 +1,135 @@ +/// +module nvd3_test_monitoringChart { + + var testdata1 = [ + { key: "Updated", y: 0 }, + { key: "Pending", y: 100 } + ]; + + var arcRadius1 = [ + { inner: 0.6, outer: 1 }, + { inner: 0.65, outer: 0.95 } + ]; + + var colors = ["green", "gray"]; + + var testdata2 = [ + { key: "One", y: 1 }, + { key: "Two", y: 1 }, + { key: "Three", y: 1 }, + { key: "Four", y: 1 }, + { key: "Five", y: 1 }, + { key: "Six", y: 1 }, + { key: "Seven", y: 1 } + ]; + + var arcRadius2 = [ + { inner: 0.9, outer: 1 }, + { inner: 0.8, outer: 1 }, + { inner: 0.7, outer: 1 }, + { inner: 0.6, outer: 1 }, + { inner: 0.5, outer: 1 }, + { inner: 0.4, outer: 1 }, + { inner: 0.3, outer: 1 } + ]; + + var testdata3 = [ + { key: "Updated", y: 80 }, + { key: "Pending", y: 20 } + ]; + + var arcRadius3 = [ + { inner: 0, outer: 1 }, + { inner: 0, outer: 0.8 } + ]; + + var height = 350; + var width = 350; + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .showLabels(false) + .color(colors) + .width(width) + .height(height) + .growOnHover(false) + .arcsRadius(arcRadius1) + .id('donut1'); // allow custom CSS for this one svg + + chart.title("0%"); + + d3.select("#test1") + .datum(testdata1) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // update chart data values randomly + setInterval(function () { + if (testdata1[0].y < 100) { + testdata1[0].y = testdata1[0].y + 1; + testdata1[1].y = testdata1[1].y - 1; + } + else { + testdata1[0].y = 0; + testdata1[1].y = 100; + } + chart.title(testdata1[0].y + "%"); + chart.update(); + }, 4000); + + return chart; + + }); + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .width(width) + .height(height) + .arcsRadius(arcRadius2) + .donutLabelsOutside(true) + .labelSunbeamLayout(true) + .id('donut2'); // allow custom CSS for this one svg + + d3.select("#test2") + .datum(testdata2) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + return chart; + + }); + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .donut(true) + .showLabels(true) + .width(width) + .height(height) + .arcsRadius(arcRadius3) + .donutLabelsOutside(true) + .id('donut3'); // allow custom CSS for this one svg + + d3.select("#test3") + .datum(testdata3) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + return chart; + + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multiChart.ts b/nvd3/nvd3-test-multiChart.ts new file mode 100644 index 000000000..7e30ff4ce --- /dev/null +++ b/nvd3/nvd3-test-multiChart.ts @@ -0,0 +1,53 @@ +/// +module nvd3_test_multiChart { + //todo resolve stream_layersIssue var testdata = stream_layers(9, 10 + Math.random() * 100, .1).map(function (data, i) { + // return { + // key: 'Stream' + i, + // values: data.map(function (a) { a.y = a.y * (i <= 1 ? -1 : 1); return a }) + // }; + //}); + + var testdata = [1, 2, 3, 4, 5, 6, 7, 8, 9].map(function (data, i) { + return { + key: 'Stream' + i, + values: [1, 2], + type: '', + yAxis: 1 + }; + }); + + testdata[0].type = "area"; + testdata[0].yAxis = 1; + testdata[1].type = "area"; + testdata[1].yAxis = 1; + testdata[2].type = "line"; + testdata[2].yAxis = 1; + testdata[3].type = "line"; + testdata[3].yAxis = 2; + testdata[4].type = "scatter"; + testdata[4].yAxis = 1; + testdata[5].type = "scatter"; + testdata[5].yAxis = 2; + testdata[6].type = "bar"; + testdata[6].yAxis = 2; + testdata[7].type = "bar"; + testdata[7].yAxis = 2; + testdata[8].type = "bar"; + testdata[8].yAxis = 2; + + nv.addGraph(function () { + var chart = nv.models.multiChart() + .margin({ top: 30, right: 60, bottom: 50, left: 70 }) + .color(d3.scale.category10().range()); + + chart.xAxis.tickFormat(d3.format(',f')); + chart.yAxis1.tickFormat(d3.format(',.1f')); + chart.yAxis2.tickFormat(d3.format(',.1f')); + + d3.select('#chart1 svg') + .datum(testdata) + .transition().duration(500).call(chart); + + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multibarChart.ts b/nvd3/nvd3-test-multibarChart.ts new file mode 100644 index 000000000..c478d7e16 --- /dev/null +++ b/nvd3/nvd3-test-multibarChart.ts @@ -0,0 +1,69 @@ +/// +module nvd3_test_multibarChart { + //todo resolve stream_layers var test_data = stream_layers(3, 10 + Math.random() * 100, .1).map(function (data, i) { + var test_data = [3, 10 + Math.random() * 100, .1].map(function (data, i) { + return { + key: 'Stream' + i, + values: data + }; + }); + + console.log('td', test_data); + + var negative_test_data = d3.range(0, 3).map(function (d, i) { + return { + key: 'Stream' + i, + values: d3.range(0, 11).map(function (f, j) { + return { + y: 10 + Math.random() * 100 * (Math.floor(Math.random() * 100) % 2 ? 1 : -1), + x: j + } + }) + }; + }); + + var chart; + nv.addGraph(function () { + chart = nv.models.multiBarChart() + .barColor(d3.scale.category20().range()) + .duration(300) + .margin({ bottom: 100, left: 70 }) + .rotateLabels(45) + .groupSpacing(0.1) + ; + + chart.reduceXTicks(false).staggerLabels(true); + + chart.xAxis + .axisLabel("ID of Furry Cat Households") + .axisLabelDistance(35) + .showMaxMin(false) + .tickFormat(d3.format(',.6f')) + ; + + chart.yAxis + .axisLabel("Change in Furry Cat Population") + .axisLabelDistance(-5) + .tickFormat(d3.format(',.01f')) + ; + + chart.dispatch.on('renderEnd', function () { + nv.log('Render Complete'); + }); + + d3.select('#chart1 svg') + .datum(negative_test_data) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { + nv.log('New State:', JSON.stringify(e)); + }); + chart.state.dispatch.on('change', function (state) { + nv.log('state', JSON.stringify(state)); + }); + + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multibarChart2.ts b/nvd3/nvd3-test-multibarChart2.ts new file mode 100644 index 000000000..4623514e9 --- /dev/null +++ b/nvd3/nvd3-test-multibarChart2.ts @@ -0,0 +1,47 @@ +/// +module nvd3_test_multibarChart2 { + //todo resolve stream_layers var test_data = stream_layers(3, 128, .1).map(function (data, i) { + var test_data = [3, 128, .1].map(function (data, i) { + return { + key: (i == 1) ? 'Non-stackable Stream' + i : 'Stream' + i, + nonStackable: (i == 1), + values: data + }; + }); + nv.addGraph({ + generate: function () { + var width = nv.utils.windowSize().width, + height = nv.utils.windowSize().height; + + var chart = nv.models.multiBarChart() + .width(width) + .height(height) + .stacked(true) + ; + + chart.dispatch.on('renderEnd', function () { + console.log('Render Complete'); + }); + + var svg = d3.select('#test1 svg').datum(test_data); + console.log('calling chart'); + svg.transition().duration(0).call(chart); + + return chart; + }, + callback: function (graph) { + nv.utils.windowResize(function () { + var width = nv.utils.windowSize().width; + var height = nv.utils.windowSize().height; + graph.width(width).height(height); + + d3.select('#test1 svg') + .attr('width', width) + .attr('height', height) + .transition().duration(0) + .call(graph); + + }); + } + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-multibarHorizontalChart.ts b/nvd3/nvd3-test-multibarHorizontalChart.ts new file mode 100644 index 000000000..61e6ee86d --- /dev/null +++ b/nvd3/nvd3-test-multibarHorizontalChart.ts @@ -0,0 +1,159 @@ +/// +module nvd3_test_multibarHorizontalChart { + var long_short_data = [ + { + key: 'Series1', + values: [ + { + "label": "Group A", + "value": -1.8746444827653 + }, + { + "label": "Group B", + "value": -8.0961543492239 + }, + { + "label": "Group C", + "value": -0.57072943117674 + }, + { + "label": "Group D", + "value": -2.4174010336624 + }, + { + "label": "Group E", + "value": -0.72009071426284 + }, + { + "label": "Group F", + "value": -2.77154485523777 + }, + { + "label": "Group G", + "value": -9.90152097798131 + }, + { + "label": "Group H", + "value": 14.91445417330854 + }, + { + "label": "Group I", + "value": -3.055746319141851 + } + ] + }, + { + key: 'Series2', + values: [ + { + "label": "Group A", + "value": 25.307646510375 + }, + { + "label": "Group B", + "value": 16.756779544553 + }, + { + "label": "Group C", + "value": 18.451534877007 + }, + { + "label": "Group D", + "value": 8.6142352811805 + }, + { + "label": "Group E", + "value": 7.8082472075876 + }, + { + "label": "Group F", + "value": 5.259101026956 + }, + { + "label": "Group G", + "value": 7.0947953487127 + }, + { + "label": "Group H", + "value": 8 + }, + { + "label": "Group I", + "value": 21 + } + ] + }, + { + key: 'Series3', + values: [ + { + "label": "Group A", + "value": -14.307646510375 + }, + { + "label": "Group B", + "value": 16.756779544553 + }, + { + "label": "Group C", + "value": -18.451534877007 + }, + { + "label": "Group D", + "value": 8.6142352811805 + }, + { + "label": "Group E", + "value": -7.8082472075876 + }, + { + "label": "Group F", + "value": 15.259101026956 + }, + { + "label": "Group G", + "value": -0.30947953487127 + }, + { + "label": "Group H", + "value": 0 + }, + { + "label": "Group I", + "value": 0 + } + ] + } + ]; + + + var chart; + nv.addGraph(function () { + chart = nv.models.multiBarHorizontalChart() + .x(function (d) { return d.label }) + .y(function (d) { return d.value }) + .yErr(function (d) { return [-Math.abs(d.value * Math.random() * 0.3), Math.abs(d.value * Math.random() * 0.3)] }) + .barColor(d3.scale.category20().range()) + .duration(250) + .margin({ left: 100 }) + .stacked(true); + + chart.yAxis.tickFormat(d3.format(',.2f')); + + chart.yAxis.axisLabel('Y Axis'); + chart.xAxis.axisLabel('X Axis').axisLabelDistance(20); + + d3.select('#chart1 svg') + .datum(long_short_data) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + chart.state.dispatch.on('change', function (state) { + nv.log('state', JSON.stringify(state)); + }); + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-ohlc.ts b/nvd3/nvd3-test-ohlc.ts new file mode 100644 index 000000000..efd069301 --- /dev/null +++ b/nvd3/nvd3-test-ohlc.ts @@ -0,0 +1,192 @@ +/// +/// +module nvd3_test_ohlc { + var data = [{ + values: [ + { "date": 15707, "open": 145.11, "high": 146.15, "low": 144.73, "close": 146.06, "volume": 192059000, "adjusted": 144.65 }, + { "date": 15708, "open": 145.99, "high": 146.37, "low": 145.34, "close": 145.73, "volume": 144761800, "adjusted": 144.32 }, + { "date": 15709, "open": 145.97, "high": 146.61, "low": 145.67, "close": 146.37, "volume": 116817700, "adjusted": 144.95 }, + { "date": 15712, "open": 145.85, "high": 146.11, "low": 145.43, "close": 145.97, "volume": 110002500, "adjusted": 144.56 }, + { "date": 15713, "open": 145.71, "high": 145.91, "low": 144.98, "close": 145.55, "volume": 121265100, "adjusted": 144.14 }, + { "date": 15714, "open": 145.87, "high": 146.32, "low": 145.64, "close": 145.92, "volume": 90745600, "adjusted": 144.51 }, + { "date": 15715, "open": 146.73, "high": 147.09, "low": 145.97, "close": 147.08, "volume": 130735400, "adjusted": 145.66 }, + { "date": 15716, "open": 147.04, "high": 147.15, "low": 146.61, "close": 147.07, "volume": 113917300, "adjusted": 145.65 }, + { "date": 15719, "open": 146.89, "high": 147.07, "low": 146.43, "close": 146.97, "volume": 89567200, "adjusted": 145.55 }, + { "date": 15720, "open": 146.29, "high": 147.21, "low": 146.2, "close": 147.07, "volume": 93172600, "adjusted": 145.65 }, + { "date": 15721, "open": 146.77, "high": 147.28, "low": 146.61, "close": 147.05, "volume": 104849500, "adjusted": 145.63 }, + { "date": 15722, "open": 147.7, "high": 148.42, "low": 147.15, "close": 148, "volume": 133833500, "adjusted": 146.57 }, + { "date": 15723, "open": 147.97, "high": 148.49, "low": 147.43, "close": 148.33, "volume": 169906000, "adjusted": 146.9 }, + { "date": 15727, "open": 148.33, "high": 149.13, "low": 147.98, "close": 149.13, "volume": 111797300, "adjusted": 147.69 }, + { "date": 15728, "open": 149.13, "high": 149.5, "low": 148.86, "close": 149.37, "volume": 104596100, "adjusted": 147.93 }, + { "date": 15729, "open": 149.15, "high": 150.14, "low": 149.01, "close": 149.41, "volume": 146426400, "adjusted": 147.97 }, + { "date": 15730, "open": 149.88, "high": 150.25, "low": 149.37, "close": 150.25, "volume": 147211600, "adjusted": 148.8 }, + { "date": 15733, "open": 150.29, "high": 150.33, "low": 149.51, "close": 150.07, "volume": 113357700, "adjusted": 148.62 }, + { "date": 15734, "open": 149.77, "high": 150.85, "low": 149.67, "close": 150.66, "volume": 105694400, "adjusted": 149.2 }, + { "date": 15735, "open": 150.64, "high": 150.94, "low": 149.93, "close": 150.07, "volume": 137447700, "adjusted": 148.62 }, + { "date": 15736, "open": 149.89, "high": 150.38, "low": 149.6, "close": 149.7, "volume": 108975800, "adjusted": 148.25 }, + { "date": 15737, "open": 150.65, "high": 151.42, "low": 150.39, "close": 151.24, "volume": 131173000, "adjusted": 149.78 }, + { "date": 15740, "open": 150.32, "high": 151.27, "low": 149.43, "close": 149.54, "volume": 159073600, "adjusted": 148.09 }, + { "date": 15741, "open": 150.35, "high": 151.48, "low": 150.29, "close": 151.05, "volume": 113912400, "adjusted": 149.59 }, + { "date": 15742, "open": 150.52, "high": 151.26, "low": 150.41, "close": 151.16, "volume": 138762800, "adjusted": 149.7 }, + { "date": 15743, "open": 151.21, "high": 151.35, "low": 149.86, "close": 150.96, "volume": 162490000, "adjusted": 149.5 }, + { "date": 15744, "open": 151.22, "high": 151.89, "low": 151.22, "close": 151.8, "volume": 103133700, "adjusted": 150.33 }, + { "date": 15747, "open": 151.74, "high": 151.9, "low": 151.39, "close": 151.77, "volume": 73775000, "adjusted": 150.3 }, + { "date": 15748, "open": 151.78, "high": 152.3, "low": 151.61, "close": 152.02, "volume": 65392700, "adjusted": 150.55 }, + { "date": 15749, "open": 152.33, "high": 152.61, "low": 151.72, "close": 152.15, "volume": 82322600, "adjusted": 150.68 }, + { "date": 15750, "open": 151.69, "high": 152.47, "low": 151.52, "close": 152.29, "volume": 80834300, "adjusted": 150.82 }, + { "date": 15751, "open": 152.43, "high": 152.59, "low": 151.55, "close": 152.11, "volume": 215226500, "adjusted": 150.64 }, + { "date": 15755, "open": 152.37, "high": 153.28, "low": 152.16, "close": 153.25, "volume": 95105400, "adjusted": 151.77 }, + { "date": 15756, "open": 153.14, "high": 153.19, "low": 151.26, "close": 151.34, "volume": 160574800, "adjusted": 149.88 }, + { "date": 15757, "open": 150.96, "high": 151.42, "low": 149.94, "close": 150.42, "volume": 183257000, "adjusted": 148.97 }, + { "date": 15758, "open": 151.15, "high": 151.89, "low": 150.49, "close": 151.89, "volume": 106356600, "adjusted": 150.42 }, + { "date": 15761, "open": 152.63, "high": 152.86, "low": 149, "close": 149, "volume": 245824800, "adjusted": 147.56 }, + { "date": 15762, "open": 149.72, "high": 150.2, "low": 148.73, "close": 150.02, "volume": 186596200, "adjusted": 148.57 }, + { "date": 15763, "open": 149.89, "high": 152.33, "low": 149.76, "close": 151.91, "volume": 150781900, "adjusted": 150.44 }, + { "date": 15764, "open": 151.9, "high": 152.87, "low": 151.41, "close": 151.61, "volume": 126866000, "adjusted": 150.14 }, + { "date": 15765, "open": 151.09, "high": 152.34, "low": 150.41, "close": 152.11, "volume": 170634800, "adjusted": 150.64 }, + { "date": 15768, "open": 151.76, "high": 152.92, "low": 151.52, "close": 152.92, "volume": 99010200, "adjusted": 151.44 }, + { "date": 15769, "open": 153.66, "high": 154.7, "low": 153.64, "close": 154.29, "volume": 121431900, "adjusted": 152.8 }, + { "date": 15770, "open": 154.84, "high": 154.92, "low": 154.16, "close": 154.5, "volume": 94469900, "adjusted": 153.01 }, + { "date": 15771, "open": 154.7, "high": 154.98, "low": 154.52, "close": 154.78, "volume": 86101400, "adjusted": 153.28 }, + { "date": 15772, "open": 155.46, "high": 155.65, "low": 154.66, "close": 155.44, "volume": 123477800, "adjusted": 153.94 }, + { "date": 15775, "open": 155.32, "high": 156.04, "low": 155.13, "close": 156.03, "volume": 83746800, "adjusted": 154.52 }, + { "date": 15776, "open": 155.92, "high": 156.1, "low": 155.21, "close": 155.68, "volume": 105755800, "adjusted": 154.17 }, + { "date": 15777, "open": 155.76, "high": 156.12, "low": 155.23, "close": 155.9, "volume": 92550900, "adjusted": 154.39 }, + { "date": 15778, "open": 156.31, "high": 156.8, "low": 155.91, "close": 156.73, "volume": 126329900, "adjusted": 155.21 }, + { "date": 15779, "open": 155.85, "high": 156.04, "low": 155.31, "close": 155.83, "volume": 138601100, "adjusted": 155.01 }, + { "date": 15782, "open": 154.34, "high": 155.64, "low": 154.2, "close": 154.97, "volume": 126704300, "adjusted": 154.15 }, + { "date": 15783, "open": 155.3, "high": 155.51, "low": 153.59, "close": 154.61, "volume": 167567300, "adjusted": 153.8 }, + { "date": 15784, "open": 155.52, "high": 155.95, "low": 155.26, "close": 155.69, "volume": 113759300, "adjusted": 154.87 }, + { "date": 15785, "open": 154.76, "high": 155.64, "low": 154.1, "close": 154.36, "volume": 128605000, "adjusted": 153.55 }, + { "date": 15786, "open": 154.85, "high": 155.6, "low": 154.73, "close": 155.6, "volume": 111163600, "adjusted": 154.78 }, + { "date": 15789, "open": 156.01, "high": 156.27, "low": 154.35, "close": 154.95, "volume": 151322300, "adjusted": 154.13 }, + { "date": 15790, "open": 155.59, "high": 156.23, "low": 155.42, "close": 156.19, "volume": 86856600, "adjusted": 155.37 }, + { "date": 15791, "open": 155.26, "high": 156.24, "low": 155, "close": 156.19, "volume": 99950600, "adjusted": 155.37 }, + { "date": 15792, "open": 156.09, "high": 156.85, "low": 155.75, "close": 156.67, "volume": 102932800, "adjusted": 155.85 }, + { "date": 15796, "open": 156.59, "high": 156.91, "low": 155.67, "close": 156.05, "volume": 99194100, "adjusted": 155.23 }, + { "date": 15797, "open": 156.61, "high": 157.21, "low": 156.37, "close": 156.82, "volume": 101504300, "adjusted": 155.99 }, + { "date": 15798, "open": 156.91, "high": 157.03, "low": 154.82, "close": 155.23, "volume": 154167400, "adjusted": 154.41 }, + { "date": 15799, "open": 155.43, "high": 156.17, "low": 155.09, "close": 155.86, "volume": 131885000, "adjusted": 155.04 }, + { "date": 15800, "open": 153.95, "high": 155.35, "low": 153.77, "close": 155.16, "volume": 159666000, "adjusted": 154.34 }, + { "date": 15803, "open": 155.27, "high": 156.22, "low": 154.75, "close": 156.21, "volume": 86571200, "adjusted": 155.39 }, + { "date": 15804, "open": 156.5, "high": 157.32, "low": 155.98, "close": 156.75, "volume": 101922200, "adjusted": 155.92 }, + { "date": 15805, "open": 157.17, "high": 158.87, "low": 157.13, "close": 158.67, "volume": 135711100, "adjusted": 157.83 }, + { "date": 15806, "open": 158.7, "high": 159.71, "low": 158.54, "close": 159.19, "volume": 110142500, "adjusted": 158.35 }, + { "date": 15807, "open": 158.68, "high": 159.04, "low": 157.92, "close": 158.8, "volume": 116359900, "adjusted": 157.96 }, + { "date": 15810, "open": 158, "high": 158.13, "low": 155.1, "close": 155.12, "volume": 217259000, "adjusted": 154.3 }, + { "date": 15811, "open": 156.29, "high": 157.49, "low": 155.91, "close": 157.41, "volume": 147507800, "adjusted": 156.58 }, + { "date": 15812, "open": 156.29, "high": 156.32, "low": 154.28, "close": 155.11, "volume": 226834800, "adjusted": 154.29 }, + { "date": 15813, "open": 155.37, "high": 155.41, "low": 153.55, "close": 154.14, "volume": 167583200, "adjusted": 153.33 }, + { "date": 15814, "open": 154.5, "high": 155.55, "low": 154.12, "close": 155.48, "volume": 149687600, "adjusted": 154.66 }, + { "date": 15817, "open": 155.78, "high": 156.54, "low": 154.75, "close": 156.17, "volume": 106553500, "adjusted": 155.35 }, + { "date": 15818, "open": 156.95, "high": 157.93, "low": 156.17, "close": 157.78, "volume": 166141300, "adjusted": 156.95 }, + { "date": 15819, "open": 157.83, "high": 158.3, "low": 157.54, "close": 157.88, "volume": 96781200, "adjusted": 157.05 }, + { "date": 15820, "open": 158.34, "high": 159.27, "low": 158.1, "close": 158.52, "volume": 131060600, "adjusted": 157.69 }, + { "date": 15821, "open": 158.33, "high": 158.6, "low": 157.73, "close": 158.24, "volume": 95918800, "adjusted": 157.41 }, + { "date": 15824, "open": 158.67, "high": 159.65, "low": 158.42, "close": 159.3, "volume": 88572800, "adjusted": 158.46 }, + { "date": 15825, "open": 159.27, "high": 159.72, "low": 158.61, "close": 159.68, "volume": 116010700, "adjusted": 158.84 }, + { "date": 15826, "open": 159.33, "high": 159.41, "low": 158.1, "close": 158.28, "volume": 138874200, "adjusted": 157.45 }, + { "date": 15827, "open": 158.68, "high": 159.89, "low": 158.53, "close": 159.75, "volume": 96407600, "adjusted": 158.91 }, + { "date": 15828, "open": 161.14, "high": 161.88, "low": 159.78, "close": 161.37, "volume": 144202300, "adjusted": 160.52 }, + { "date": 15831, "open": 161.49, "high": 162.01, "low": 161.42, "close": 161.78, "volume": 66882100, "adjusted": 160.93 }, + { "date": 15832, "open": 162.13, "high": 162.65, "low": 161.67, "close": 162.6, "volume": 90359200, "adjusted": 161.74 }, + { "date": 15833, "open": 162.42, "high": 163.39, "low": 162.33, "close": 163.34, "volume": 97419200, "adjusted": 162.48 }, + { "date": 15834, "open": 163.27, "high": 163.7, "low": 162.47, "close": 162.88, "volume": 106738600, "adjusted": 162.02 }, + { "date": 15835, "open": 162.99, "high": 163.55, "low": 162.51, "close": 163.41, "volume": 103203000, "adjusted": 162.55 }, + { "date": 15838, "open": 163.2, "high": 163.81, "low": 162.82, "close": 163.54, "volume": 81843200, "adjusted": 162.68 }, + { "date": 15839, "open": 163.67, "high": 165.35, "low": 163.67, "close": 165.23, "volume": 119000900, "adjusted": 164.36 }, + { "date": 15840, "open": 164.96, "high": 166.45, "low": 164.91, "close": 166.12, "volume": 120718500, "adjusted": 165.25 }, + { "date": 15841, "open": 165.78, "high": 166.36, "low": 165.09, "close": 165.34, "volume": 109913600, "adjusted": 164.47 }, + { "date": 15842, "open": 165.95, "high": 167.04, "low": 165.73, "close": 166.94, "volume": 129801000, "adjusted": 166.06 }, + { "date": 15845, "open": 166.78, "high": 167.58, "low": 166.61, "close": 166.93, "volume": 85071200, "adjusted": 166.05 }, + { "date": 15846, "open": 167.08, "high": 167.8, "low": 166.5, "close": 167.17, "volume": 95804200, "adjusted": 166.29 }, + { "date": 15847, "open": 167.34, "high": 169.07, "low": 165.17, "close": 165.93, "volume": 244031800, "adjusted": 165.06 }, + { "date": 15848, "open": 164.16, "high": 165.91, "low": 163.94, "close": 165.45, "volume": 211064400, "adjusted": 164.58 }, + { "date": 15849, "open": 164.47, "high": 165.38, "low": 163.98, "close": 165.31, "volume": 151573900, "adjusted": 164.44 }, + { "date": 15853, "open": 167.04, "high": 167.78, "low": 165.81, "close": 166.3, "volume": 143679800, "adjusted": 165.42 }, + { "date": 15854, "open": 165.42, "high": 165.8, "low": 164.34, "close": 165.22, "volume": 160363400, "adjusted": 164.35 }, + { "date": 15855, "open": 165.35, "high": 166.59, "low": 165.22, "close": 165.83, "volume": 107793800, "adjusted": 164.96 }, + { "date": 15856, "open": 165.37, "high": 166.31, "low": 163.13, "close": 163.45, "volume": 176850100, "adjusted": 162.59 }, + { "date": 15859, "open": 163.83, "high": 164.46, "low": 162.66, "close": 164.35, "volume": 168390700, "adjusted": 163.48 }, + { "date": 15860, "open": 164.44, "high": 165.1, "low": 162.73, "close": 163.56, "volume": 157631500, "adjusted": 162.7 }, + { "date": 15861, "open": 163.09, "high": 163.42, "low": 161.13, "close": 161.27, "volume": 211737800, "adjusted": 160.42 }, + { "date": 15862, "open": 161.2, "high": 162.74, "low": 160.25, "close": 162.73, "volume": 200225500, "adjusted": 161.87 }, + { "date": 15863, "open": 163.85, "high": 164.95, "low": 163.14, "close": 164.8, "volume": 188337800, "adjusted": 163.93 }, + { "date": 15866, "open": 165.31, "high": 165.4, "low": 164.37, "close": 164.8, "volume": 105667100, "adjusted": 163.93 }, + { "date": 15867, "open": 163.3, "high": 164.54, "low": 162.74, "close": 163.1, "volume": 159505400, "adjusted": 162.24 }, + { "date": 15868, "open": 164.22, "high": 164.39, "low": 161.6, "close": 161.75, "volume": 177361500, "adjusted": 160.9 }, + { "date": 15869, "open": 161.66, "high": 164.5, "low": 161.3, "close": 164.21, "volume": 163587800, "adjusted": 163.35 }, + { "date": 15870, "open": 164.03, "high": 164.67, "low": 162.91, "close": 163.18, "volume": 141197500, "adjusted": 162.32 }, + { "date": 15873, "open": 164.29, "high": 165.22, "low": 163.22, "close": 164.44, "volume": 136295600, "adjusted": 163.57 }, + { "date": 15874, "open": 164.53, "high": 165.99, "low": 164.52, "close": 165.74, "volume": 114695600, "adjusted": 164.87 }, + { "date": 15875, "open": 165.6, "high": 165.89, "low": 163.38, "close": 163.45, "volume": 206149500, "adjusted": 162.59 }, + { "date": 15876, "open": 161.86, "high": 163.47, "low": 158.98, "close": 159.4, "volume": 321255900, "adjusted": 158.56 }, + { "date": 15877, "open": 159.64, "high": 159.76, "low": 157.47, "close": 159.07, "volume": 271956800, "adjusted": 159.07 }, + { "date": 15880, "open": 157.41, "high": 158.43, "low": 155.73, "close": 157.06, "volume": 222329000, "adjusted": 157.06 }, + { "date": 15881, "open": 158.48, "high": 160.1, "low": 157.42, "close": 158.57, "volume": 162262200, "adjusted": 158.57 }, + { "date": 15882, "open": 159.87, "high": 160.5, "low": 159.25, "close": 160.14, "volume": 134848000, "adjusted": 160.14 }, + { "date": 15883, "open": 161.1, "high": 161.82, "low": 160.95, "close": 161.08, "volume": 129483700, "adjusted": 161.08 }, + { "date": 15884, "open": 160.63, "high": 161.4, "low": 159.86, "close": 160.42, "volume": 160402900, "adjusted": 160.42 }, + { "date": 15887, "open": 161.26, "high": 162.48, "low": 161.08, "close": 161.36, "volume": 131954800, "adjusted": 161.36 }, + { "date": 15888, "open": 161.12, "high": 162.3, "low": 160.5, "close": 161.21, "volume": 154863700, "adjusted": 161.21 }, + { "date": 15889, "open": 160.48, "high": 161.77, "low": 160.22, "close": 161.28, "volume": 75216400, "adjusted": 161.28 }, + { "date": 15891, "open": 162.47, "high": 163.08, "low": 161.3, "close": 163.02, "volume": 122416900, "adjusted": 163.02 }, + { "date": 15894, "open": 163.86, "high": 164.39, "low": 163.08, "close": 163.95, "volume": 108092500, "adjusted": 163.95 }, + { "date": 15895, "open": 164.98, "high": 165.33, "low": 164.27, "close": 165.13, "volume": 119298000, "adjusted": 165.13 }, + { "date": 15896, "open": 164.97, "high": 165.75, "low": 164.63, "close": 165.19, "volume": 121410100, "adjusted": 165.19 }, + { "date": 15897, "open": 167.11, "high": 167.61, "low": 165.18, "close": 167.44, "volume": 135592200, "adjusted": 167.44 }, + { "date": 15898, "open": 167.39, "high": 167.93, "low": 167.13, "close": 167.51, "volume": 104212700, "adjusted": 167.51 }, + { "date": 15901, "open": 167.97, "high": 168.39, "low": 167.68, "close": 168.15, "volume": 69450600, "adjusted": 168.15 }, + { "date": 15902, "open": 168.26, "high": 168.36, "low": 167.07, "close": 167.52, "volume": 88702100, "adjusted": 167.52 }, + { "date": 15903, "open": 168.16, "high": 168.48, "low": 167.73, "close": 167.95, "volume": 92873900, "adjusted": 167.95 }, + { "date": 15904, "open": 168.31, "high": 169.27, "low": 168.2, "close": 168.87, "volume": 103620100, "adjusted": 168.87 }, + { "date": 15905, "open": 168.52, "high": 169.23, "low": 168.31, "close": 169.17, "volume": 103831700, "adjusted": 169.17 }, + { "date": 15908, "open": 169.41, "high": 169.74, "low": 169.01, "close": 169.5, "volume": 79428600, "adjusted": 169.5 }, + { "date": 15909, "open": 169.8, "high": 169.83, "low": 169.05, "close": 169.14, "volume": 80829700, "adjusted": 169.14 }, + { "date": 15910, "open": 169.79, "high": 169.86, "low": 168.18, "close": 168.52, "volume": 112914000, "adjusted": 168.52 }, + { "date": 15911, "open": 168.22, "high": 169.08, "low": 167.94, "close": 168.93, "volume": 111088600, "adjusted": 168.93 }, + { "date": 15912, "open": 168.22, "high": 169.16, "low": 167.52, "close": 169.11, "volume": 107814600, "adjusted": 169.11 }, + { "date": 15915, "open": 168.68, "high": 169.06, "low": 168.11, "close": 168.59, "volume": 79695000, "adjusted": 168.59 }, + { "date": 15916, "open": 169.1, "high": 169.28, "low": 168.19, "close": 168.59, "volume": 85209600, "adjusted": 168.59 }, + { "date": 15917, "open": 168.94, "high": 169.85, "low": 168.49, "close": 168.71, "volume": 142388700, "adjusted": 168.71 }, + { "date": 15918, "open": 169.99, "high": 170.81, "low": 169.9, "close": 170.66, "volume": 110438400, "adjusted": 170.66 }, + { "date": 15919, "open": 170.28, "high": 170.97, "low": 170.05, "close": 170.95, "volume": 91116700, "adjusted": 170.95 }, + { "date": 15922, "open": 170.57, "high": 170.96, "low": 170.35, "close": 170.7, "volume": 54072700, "adjusted": 170.7 }, + { "date": 15923, "open": 170.37, "high": 170.74, "low": 169.35, "close": 169.73, "volume": 87495000, "adjusted": 169.73 }, + { "date": 15924, "open": 169.19, "high": 169.43, "low": 168.55, "close": 169.18, "volume": 84854700, "adjusted": 169.18 }, + { "date": 15925, "open": 169.98, "high": 170.18, "low": 168.93, "close": 169.8, "volume": 102181300, "adjusted": 169.8 }, + { "date": 15926, "open": 169.58, "high": 170.1, "low": 168.72, "close": 169.31, "volume": 91757700, "adjusted": 169.31 }, + { "date": 15929, "open": 168.46, "high": 169.31, "low": 168.38, "close": 169.11, "volume": 68593300, "adjusted": 169.11 }, + { "date": 15930, "open": 169.41, "high": 169.9, "low": 168.41, "close": 169.61, "volume": 80806000, "adjusted": 169.61 }, + { "date": 15931, "open": 169.53, "high": 169.8, "low": 168.7, "close": 168.74, "volume": 79829200, "adjusted": 168.74 }, + { "date": 15932, "open": 167.41, "high": 167.43, "low": 166.09, "close": 166.38, "volume": 152931800, "adjusted": 166.38 }, + { "date": 15933, "open": 166.06, "high": 166.63, "low": 165.5, "close": 165.83, "volume": 130868200, "adjusted": 165.83 }, + { "date": 15936, "open": 165.64, "high": 166.21, "low": 164.76, "close": 164.77, "volume": 96437600, "adjusted": 164.77 }, + { "date": 15937, "open": 165.04, "high": 166.2, "low": 164.86, "close": 165.58, "volume": 89294400, "adjusted": 165.58 }, + { "date": 15938, "open": 165.12, "high": 166.03, "low": 164.19, "close": 164.56, "volume": 159530500, "adjusted": 164.56 }, + { "date": 15939, "open": 164.9, "high": 166.3, "low": 164.89, "close": 166.06, "volume": 101471400, "adjusted": 166.06 }, + { "date": 15940, "open": 166.55, "high": 166.83, "low": 165.77, "close": 166.62, "volume": 90888900, "adjusted": 166.62 }, + { "date": 15943, "open": 166.79, "high": 167.3, "low": 165.89, "close": 166, "volume": 89702100, "adjusted": 166 }, + { "date": 15944, "open": 164.36, "high": 166, "low": 163.21, "close": 163.33, "volume": 158619400, "adjusted": 163.33 }, + { "date": 15945, "open": 163.26, "high": 164.49, "low": 163.05, "close": 163.91, "volume": 108113000, "adjusted": 163.91 }, + { "date": 15946, "open": 163.55, "high": 165.04, "low": 163.4, "close": 164.17, "volume": 119200500, "adjusted": 164.17 }, + { "date": 15947, "open": 164.51, "high": 164.53, "low": 163.17, "close": 163.65, "volume": 134560800, "adjusted": 163.65 }, + { "date": 15951, "open": 165.23, "high": 165.58, "low": 163.7, "close": 164.39, "volume": 142322300, "adjusted": 164.39 }, + { "date": 15952, "open": 164.43, "high": 166.03, "low": 164.13, "close": 165.75, "volume": 97304000, "adjusted": 165.75 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.ohlcBar() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }); + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-ohlcChart.ts b/nvd3/nvd3-test-ohlcChart.ts new file mode 100644 index 000000000..b9d5d3560 --- /dev/null +++ b/nvd3/nvd3-test-ohlcChart.ts @@ -0,0 +1,40 @@ +/// +/// +module nvd3_test_ohlcChart { + var data = [{ + values: [ + { "date": 15707, "open": 145.11, "high": 146.15, "low": 144.73, "close": 146.06, "volume": 192059000, "adjusted": 144.65 }, + { "date": 15953, "open": 165.85, "high": 166.4, "low": 165.73, "close": 165.96, "volume": 62930500, "adjusted": 165.96 } + ] + }]; + + nv.addGraph(function () { + var chart = nv.models.ohlcBarChart() + .x(function (d) { return d['date'] }) + .y(function (d) { return d['close'] }) + .duration(250) + .margin({ left: 75, bottom: 50 }); + + // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately + chart.xAxis + .axisLabel("Dates") + .tickFormat(function (d) { + // I didn't feel like changing all the above date values + // so I hack it to make each value fall on a different date + return d3.time.format('%x')(new Date(new Date().valueOf() - (20000 * 86400000) + (d * 86400000))); + }); + + chart.yAxis + .axisLabel('Stock Price') + .tickFormat(function (d, i) { return '$' + d3.format(',.1f')(d); }); + + + + d3.select("#chart1 svg") + .datum(data) + .transition().duration(500) + .call(chart); + nv.utils.windowResize(chart.update); + return chart; + }); +} \ No newline at end of file diff --git a/nvd3/nvd3-test-parallelCoordinates.ts b/nvd3/nvd3-test-parallelCoordinates.ts new file mode 100644 index 000000000..37d74a94b --- /dev/null +++ b/nvd3/nvd3-test-parallelCoordinates.ts @@ -0,0 +1,47 @@ +/// +/// +module nvd3_test_parallelCoordinates { + var chart; + nv.addGraph(function () { + + chart = nv.models.parallelCoordinates() + .dimensionNames(["economy (mpg)", "cylinders", "displacement (cc)", "power (hp)", "weight (lb)", "0-60 mph (s)", "year"]) + .dimensionFormats(["0.5f", "e", "g", "d", "", "%", "p"]) + .lineTension(0.85); + + + d3.select('#chart1 svg') + .datum(data()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function data() { + return [ + { + "name": "AMC Ambassador Brougham", + "economy (mpg)": "13", + "cylinders": "8", + "displacement (cc)": "360", + "power (hp)": "175", + "weight (lb)": "3821", + "0-60 mph (s)": "11", + "year": "73" + }, +//skip to the end... + { + "name": "Volvo Diesel", + "economy (mpg)": "30.7", + "cylinders": "6", + "displacement (cc)": "145", + "power (hp)": "76", + "weight (lb)": "3160", + "0-60 mph (s)": "19.6", + "year": "81" + } + ] + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-parallelCoordinatesChart.ts b/nvd3/nvd3-test-parallelCoordinatesChart.ts new file mode 100644 index 000000000..842caca6a --- /dev/null +++ b/nvd3/nvd3-test-parallelCoordinatesChart.ts @@ -0,0 +1,186 @@ +/// +/// +module nvd3_test_parallelCoordinatesChart { + var chart; + function resetBrush() { + chart.filters([]); + chart.active([]); + chart.displayBrush(true); + d3.select("#resetBrushButton").style("visibility", "hidden"); + chart.update(); + } + + function resetSorting() { + var dim = chart.dimensionData(); + dim.map(function (d) { return d.currentPosition = d.originalPosition; }); + dim.sort(function (a, b) { return a.originalPosition - b.originalPosition; }); + chart.dimensionData(dim); + d3.select("#resetSortingButton").style("visibility", "hidden"); + chart.update(); + } + + nv.addGraph(function () { + + var dim = dimensions(); + chart = nv.models.parallelCoordinatesChart() + .dimensionData(dim) + .displayBrush(false) + .lineTension(0.85); + + var data = mydata(); + d3.select('#test') + .datum(data) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('brushEnd', function (e) { + d3.select("#resetBrushButton").style("visibility", "visible"); + }); + + chart.dispatch.on('dimensionsOrder', function (e, b) { + if (b) { + d3.select("#resetSortingButton").style("visibility", "visible"); + } + }); + + // update chart data values randomly + setInterval(function () { + data[0].values.P1 = Math.floor(Math.random() * 100).toString(); + chart.update(); + }, 4000); + + // update chart data dimension randomly + setInterval(function () { + var element = { + key: "P7", + format: "p", + tooltip: "year", + } + if (dim.length === 7) { + dim.splice(dim.indexOf(element), 1); + } else { + dim.push(element); + } + chart.dimensionData(dim); + chart.update(); + }, 10000); + + return chart; + }); + + function dimensions() { + return [ + { + key: "P1", + format: "0.5f", + tooltip: "economy (mpg)", + }, + { + key: "P2", + format: "e", + tooltip: "cylinders", + }, + { + key: "P3", + format: "g", + tooltip: "displacement (cc)", + }, + { + key: "P4", + format: "d", + tooltip: "power (hp)", + }, + { + key: "P5", + format: "", + tooltip: "weight (lb)", + }, + { + key: "P6", + format: "%", + tooltip: "0-60 mph (s)", + }, + { + key: "P7", + format: "p", + tooltip: "year", + } + ]; + } + + function mydata() { + return [ + { + name: "Current design point", + values: { + "P1": "13", + "P2": "8", + "P3": "360", + "P4": "175", + "P5": "3821", + "P6": "11", + "P7": "73" + }, + color: "red", + strokeWidth: 2 + }, + { + name: "DP1", + values: { + "P1": "15", + "P2": "8", + "P3": "390", + "P4": "190", + "P5": "3850", + "P6": "8.5", + "P7": "70" + }, + color: "blue", + strokeWidth: 1 + }, + { + name: "DP2", + values: { + "P1": "17", + "P2": "8", + "P3": "304", + "P4": "150", + "P5": "3672", + "P6": "11.5", + "P7": "72" + }, + color: "blue", + strokeWidth: 2 + }, + { + name: "DP3", + values: { + "P1": "20.2", + "P2": "6", + "P3": "232", + "P4": "", + "P5": "3265", + "P6": "18.2", + "P7": "79" + }, + color: "blue", + strokeWidth: 1 + }, + { + name: "DP4", + values: { + "P1": "18.1", + "P2": "6", + "P3": "258", + "P4": "120", + "P5": "3410", + "P6": "15.1", + "P7": "78" + }, + color: "blue", + strokeWidth: 1 + } + ]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-pie.ts b/nvd3/nvd3-test-pie.ts new file mode 100644 index 000000000..1a0270a20 --- /dev/null +++ b/nvd3/nvd3-test-pie.ts @@ -0,0 +1,71 @@ +/// +/// +module nvd3_test_pie { + + var testdata = [ + { key: "One", y: 5 }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + + var width = 300; + var height = 300; + + nv.addGraph(function () { + var chart = nv.models.pie() + .x(function (d) { return d.key; }) + .y(function (d) { return d.y; }) + .width(width) + .height(height) + .labelType(function (d, i, values) { + return values.key + ':' + values.value; + }) + ; + + d3.select("#test1") + .datum([testdata]) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // LISTEN TO CLICK EVENTS ON THE PIE CONTAINER + // chart.dispatch.on('chartClick', function() { + // code... + // }); + + // LISTEN TO CLICK EVENTS ON THE SLICES OF THE PIE + // chart.dispatch.on('elementClick', function() { + // code... + // }); + + // OTHER EVENTS DISPATCHED BY THE PIE INCLUDE: elementDblClick, elementMouseover, elementMouseout, elementMousemove, renderEnd + // @see nv.models.pie + return chart; + }); + + nv.addGraph(function () { + var chart = nv.models.pie() + .x(function (d) { return d.key; }) + .y(function (d) { return d.y; }) + .width(width) + .height(height) + .labelType('percent') + .valueFormat(d3.format('%')) + .donut(true); + + d3.select("#test2") + .datum([testdata]) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-pieChart.ts b/nvd3/nvd3-test-pieChart.ts new file mode 100644 index 000000000..688da56ff --- /dev/null +++ b/nvd3/nvd3-test-pieChart.ts @@ -0,0 +1,110 @@ +/// +/// +module nvd3_test_pieChart { + + var testdata = [ + { key: "One", y: 5, color: "#5F5" }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + var testdata2 = [ + { key: "One", y: 5 }, + { key: "Two", y: 2 }, + { key: "Three", y: 9 }, + { key: "Four", y: 7 }, + { key: "Five", y: 4 }, + { key: "Six", y: 3 }, + { key: "Seven", y: 0.5 } + ]; + + var height = 350; + var width = 350; + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + .width(width) + .height(height); + + d3.select("#test1") + .datum(testdata2) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // update chart data values randomly + setInterval(function () { + testdata2[0].y = Math.floor(Math.random() * 10); + testdata2[1].y = Math.floor(Math.random() * 10); + chart.update(); + }, 4000); + + return chart; + }); + + nv.addGraph(function () { + var chart = nv.models.pieChart() + .x(function (d) { return d.key }) + .y(function (d) { return d.y }) + //.labelThreshold(.08) + //.showLabels(false) + .color(d3.scale.category20().range().slice(8)) + .growOnHover(false) + .labelType('value') + .width(width) + .height(height); + + // make it a half circle + chart.pie + .startAngle(function (d) { return d.startAngle / 2 - Math.PI / 2 }) + .endAngle(function (d) { return d.endAngle / 2 - Math.PI / 2 }); + + // MAKES LABELS OUTSIDE OF PIE/DONUT + //chart.pie.donutLabelsOutside(true).donut(true); + + // LISTEN TO CLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementClick', function() { + // code... + // }); + + // chart.pie.dispatch.on('chartClick', function() { + // code... + // }); + + // LISTEN TO DOUBLECLICK EVENTS ON SLICES OF THE PIE/DONUT + // chart.pie.dispatch.on('elementDblClick', function() { + // code... + // }); + + // LISTEN TO THE renderEnd EVENT OF THE PIE/DONUT + // chart.pie.dispatch.on('renderEnd', function() { + // code... + // }); + + // OTHER EVENTS DISPATCHED BY THE PIE INCLUDE: elementMouseover, elementMouseout, elementMousemove + // @see nv.models.pie + + d3.select("#test2") + .datum(testdata) + .transition().duration(1200) + .attr('width', width) + .attr('height', height) + .call(chart); + + // disable and enable some of the sections + var is_disabled = false; + setInterval(function () { + chart.dispatch['changeState']({ disabled: { 2: !is_disabled, 4: !is_disabled } }); + is_disabled = !is_disabled; + }, 3000); + + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-scatter.ts b/nvd3/nvd3-test-scatter.ts new file mode 100644 index 000000000..d8ffe959d --- /dev/null +++ b/nvd3/nvd3-test-scatter.ts @@ -0,0 +1,35 @@ +/// +module nvd3_test_scatter { + nv.addGraph(function () { + + var chart = nv.models.scatter() + .margin({ top: 20, right: 20, bottom: 20, left: 20 }) + .pointSize(function (d) { return d.z }) + .useVoronoi(false); + + d3.select('#test1') + .datum(randomData()) + .transition().duration(500) + .call(chart); + + nv.utils.windowResize(chart.update); + return chart; + }); + + function randomData() { + var data = []; + + for (var i = 0; i < 2; i++) { + data.push({ + key: 'Group ' + i, + values: [] + }); + + for (var j = 0; j < 100; j++) { + data[i].values.push({ x: Math.random(), y: Math.random(), z: Math.random() }); + } + } + + return data; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-scatterChart.ts b/nvd3/nvd3-test-scatterChart.ts new file mode 100644 index 000000000..29ba71cf5 --- /dev/null +++ b/nvd3/nvd3-test-scatterChart.ts @@ -0,0 +1,66 @@ +/// +module nvd3_test_scatterChart { + // register our custom symbols to nvd3 + // make sure your path is valid given any size because size scales if the chart scales. + nv.utils.symbolMap.set('thin-x', function (size) { + size = Math.sqrt(size); + return 'M' + (-size / 2) + ',' + (-size / 2) + + 'l' + size + ',' + size + + 'm0,' + -(size) + + 'l' + (-size) + ',' + size; + }); + + // create the chart + var chart; + nv.addGraph(function () { + chart = nv.models.scatterChart() + .showDistX(true) + .showDistY(true) + .useVoronoi(true) + .color(d3.scale.category10().range()) + .duration(300) + ; + chart.dispatch.on('renderEnd', function () { + console.log('render complete'); + }); + + chart.xAxis.tickFormat(d3.format('.02f')); + chart.yAxis.tickFormat(d3.format('.02f')); + + d3.select('#test1 svg') + .datum(randomData(4, 40)) + .call(chart); + + nv.utils.windowResize(chart.update); + + chart.dispatch.on('stateChange', function (e) { ('New State:', JSON.stringify(e)); }); + return chart; + }); + + + function randomData(groups, points) { //# groups,# points per group + // smiley and thin-x are our custom symbols! + var data = [], + shapes = ['thin-x', 'circle', 'cross', 'triangle-up', 'triangle-down', 'diamond', 'square'], + random = d3.random.normal(); + + for (i = 0; i < groups; i++) { + data.push({ + key: 'Group ' + i, + values: [] + }); + + for (var j = 0; j < points; j++) { + data[i].values.push({ + x: random(), + y: random(), + size: Math.round(Math.random() * 100) / 100, + shape: shapes[j % shapes.length] + }); + } + } + + return data; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-scatterPlusLineChart.ts b/nvd3/nvd3-test-scatterPlusLineChart.ts new file mode 100644 index 000000000..8238c2404 --- /dev/null +++ b/nvd3/nvd3-test-scatterPlusLineChart.ts @@ -0,0 +1,53 @@ +/// +module nvd3_test_scatterPlusLineChart { + var chart; + nv.addGraph(function () { + chart = nv.models.scatterChart() + .showDistX(true) + .showDistY(true) + .duration(300) + .color(d3.scale.category10().range()); + + chart.dispatch.on('renderEnd', function () { + console.log('render complete'); + }); + + chart.xAxis.tickFormat(d3.format('.02f')); + chart.yAxis.tickFormat(d3.format('.02f')); + + d3.select('#test1 svg') + .datum(nv.log(randomData(4, 40))) + .call(chart); + + nv.utils.windowResize(chart.update); + chart.dispatch.on('stateChange', function (e) { nv.log('New State:', JSON.stringify(e)); }); + return chart; + }); + + + function randomData(groups, points) { //# groups,# points per group + var data = [], + shapes = ['circle'], + random = d3.random.normal(); + + for (i = 0; i < groups; i++) { + data.push({ + key: 'Group ' + i, + values: [], + slope: Math.random() - .01, + intercept: Math.random() - .5 + }); + + for (var j = 0; j < points; j++) { + data[i].values.push({ + x: random(), + y: random(), + size: Math.random(), + shape: shapes[j % shapes.length] + }); + } + } + return data; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-sparkLine.ts b/nvd3/nvd3-test-sparkLine.ts new file mode 100644 index 000000000..ef872bc2d --- /dev/null +++ b/nvd3/nvd3-test-sparkLine.ts @@ -0,0 +1,27 @@ +/// +module nvd3_test_sparkLine { + + nv.addGraph({ + generate: function () { + var chart = nv.models.sparkline() + .width(400) + .height(30) + + d3.select("#chart1") + .datum(sine()) + .call(chart); + + return chart; + } + }); + + function sine() { + var sin = []; + + for (var i = 0; i < 100; i++) { + sin.push({ x: i, y: Math.sin(i / 10) }); + } + + return sin; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-sparkLinePlus.ts b/nvd3/nvd3-test-sparkLinePlus.ts new file mode 100644 index 000000000..94003e21e --- /dev/null +++ b/nvd3/nvd3-test-sparkLinePlus.ts @@ -0,0 +1,54 @@ +/// +module nvd3_test_sparkLinePlus { + function defaultChartConfig(containerId, data) { + nv.addGraph(function () { + + var chart = nv.models.sparklinePlus(); + chart.margin({ left: 70 }) + .x(function (d, i) { return i }) + .showLastValue(true) + .xTickFormat(function (d) { + return d3.time.format('%x')(new Date(data[d].x)) + }); + + d3.select(containerId) + .datum(data) + .call(chart); + + return chart; + }); + } + + defaultChartConfig("#chart1", sine()); + defaultChartConfig("#chart2", volatileChart(130.0, 0.02)); + defaultChartConfig("#chart3", volatileChart(25.0, 0.09, 30)); + + function sine() { + var sin = []; + var now = +new Date(); + + for (var i = 0; i < 100; i++) { + sin.push({ x: now + i * 1000 * 60 * 60 * 24, y: Math.sin(i / 10) }); + } + + return sin; + } + + function volatileChart(startPrice, volatility, numPoints?) { + var rval = []; + var now = +new Date(); + numPoints = numPoints || 100; + for (var i = 1; i < numPoints; i++) { + + rval.push({ x: now + i * 1000 * 60 * 60 * 24, y: startPrice }); + var rnd = Math.random(); + var changePct = 2 * volatility * rnd; + if (changePct > volatility) { + changePct -= (2 * volatility); + } + startPrice = startPrice + startPrice * changePct; + } + return rval; + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-stackArea.ts b/nvd3/nvd3-test-stackArea.ts new file mode 100644 index 000000000..9153de1a4 --- /dev/null +++ b/nvd3/nvd3-test-stackArea.ts @@ -0,0 +1,96 @@ +/// +module nvd3_test_stackArea { + nv.addGraph({ + generate: function () { + var n = 10, // number of layers + m = 200; // number of samples per layer + + //var data = stream_layers(n, m).map(function (data, i) { + // return { + // key: 'Stream' + i, + // values: data + // }; + //}); + var data: any; + + + var width = nv.utils.windowSize().width; + var height = nv.utils.windowSize().height; + + var chart = nv.models.stackedArea() + .width(width) + .height(height); + + var svg = d3.select('#chart svg').datum(data); + svg.transition().duration(500).call(chart); + return chart; + }, + callback: function (graph) { + + graph.dispatch.on('tooltipShow', function (e) { + var offsetElement = document.getElementById("chart"), + left = e.pos[0] + offsetElement.offsetLeft, + top = e.pos[1] + offsetElement.offsetTop, + formatterY = d3.format(",.2%"), + formatterX = function (d) { + return d3.time.format('%x')(new Date(d)) + }; + + var content = '

' + e.series.key + '

' + + '

' + + formatterY(graph.y()(e.point)) + ' at ' + formatterX(graph.x()(e.point)) + + '

'; + + nv.tooltip.show([left, top], content); + }); + + graph.dispatch.on('tooltipHide', function (e) { + nv.tooltip.cleanup(); + }); + + nv.utils.windowResize(function () { + var width = nv.utils.windowSize().width; + var height = nv.utils.windowSize().height; + + graph.width(width).height(height); + d3.select('#chart svg').call(graph); + }); + } + }); + + /* Inspired by Lee Byron's test data generator. */ + function stream_layers(n, m, o) { + if (arguments.length < 3) o = 0; + function bump(a) { + var x = 1 / (.1 + Math.random()), + y = 2 * Math.random() - .5, + z = 10 / (.1 + Math.random()); + for (var i = 0; i < m; i++) { + var w = (i / m - y) * z; + a[i] += x * Math.exp(-w * w); + } + } + return d3.range(n).map(function () { + var a = [], i; + for (i = 0; i < m; i++) a[i] = o + o * Math.random(); + for (i = 0; i < 5; i++) bump(a); + return a.map(stream_index); + }); + } + + /* Another layer generator using gamma distributions. */ + function stream_waves(n, m) { + return d3.range(n).map(function (i) { + return d3.range(m).map(function (j) { + var x = 20 * j / m - i / 3; + return 2 * x * Math.exp(-.5 * x); + }).map(stream_index); + }); + } + + function stream_index(d, i) { + return { x: i, y: Math.max(0, d) }; + } + + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-stackAreaChart.ts b/nvd3/nvd3-test-stackAreaChart.ts new file mode 100644 index 000000000..f20938680 --- /dev/null +++ b/nvd3/nvd3-test-stackAreaChart.ts @@ -0,0 +1,79 @@ +/// +module nvd3_test_stackAreaChart { + var histcatexplong = [ + { + "key": "Consumer Discretionary", + "values": [[1138683600000, 27.38478809681], [1141102800000, 27.371377218208], [1143781200000, 26.309915460827], [1146369600000, 26.425199957521], [1149048000000, 26.823411519395], [1151640000000, 23.850443591584], [1154318400000, 23.158355444054], [1156996800000, 22.998689393694], [1159588800000, 27.977128511299], [1162270800000, 29.073672469721], [1164862800000, 28.587640408904], [1167541200000, 22.788453687638], [1170219600000, 22.429199073597], [1172638800000, 22.324103271051], [1175313600000, 17.558388444186], [1177905600000, 16.769518096208], [1180584000000, 16.214738201302], [1183176000000, 18.729632971228], [1185854400000, 18.814523318848], [1188532800000, 19.789986451358], [1191124800000, 17.070049054933], [1193803200000, 16.121349575715], [1196398800000, 15.141659430091], [1199077200000, 17.175388025298], [1201755600000, 17.286592443521], [1204261200000, 16.323141626569], [1206936000000, 19.231263773952], [1209528000000, 18.446256391094], [1212206400000, 17.822632399764], [1214798400000, 15.539366475979], [1217476800000, 15.255131790216], [1220155200000, 15.660963922593], [1222747200000, 13.254482273697], [1225425600000, 11.920796202299], [1228021200000, 12.122809090925], [1230699600000, 15.691026271393], [1233378000000, 14.720881635107], [1235797200000, 15.387939360044], [1238472000000, 13.765436672229], [1241064000000, 14.6314458648], [1243742400000, 14.292446536221], [1246334400000, 16.170071367016], [1249012800000, 15.948135554337], [1251691200000, 16.612872685134], [1254283200000, 18.778338719091], [1256961600000, 16.75602606542], [1259557200000, 19.385804443147], [1262235600000, 22.950590240168], [1264914000000, 23.61159018141], [1267333200000, 25.708586989581], [1270008000000, 26.883915999885], [1272600000000, 25.893486687065], [1275278400000, 24.678914263176], [1277870400000, 25.937275793023], [1280548800000, 29.46138169384], [1283227200000, 27.357322961862], [1285819200000, 29.057235285673], [1288497600000, 28.549434189386], [1291093200000, 28.506352379723], [1293771600000, 29.449241421597], [1296450000000, 25.796838168807], [1298869200000, 28.740145449189], [1301544000000, 22.091744141872], [1304136000000, 25.079662545409], [1306814400000, 23.674906973064], [1309406400000, 23.41800274293], [1312084800000, 23.243644138871], [1314763200000, 31.591854066817], [1317355200000, 31.497112374114], [1320033600000, 26.672380820431], [1322629200000, 27.297080015495], [1325307600000, 20.174315530051], [1327986000000, 19.631084213899], [1330491600000, 20.366462219462], [1333166400000, 17.429019937289], [1335758400000, 16.75543633539], [1338436800000, 16.182906906042]] + }, + { + "key": "Consumer Staples", + "values": [[1138683600000, 7.2800122043237], [1141102800000, 7.1187787503354], [1143781200000, 8.351887016482], [1146369600000, 8.4156698763993], [1149048000000, 8.1673298604231], [1151640000000, 5.5132447126042], [1154318400000, 6.1152537710599], [1156996800000, 6.076765091942], [1159588800000, 4.6304473798646], [1162270800000, 4.6301068469402], [1164862800000, 4.3466656309389], [1167541200000, 6.830104897003], [1170219600000, 7.241633040029], [1172638800000, 7.1432372054153], [1175313600000, 10.608942063374], [1177905600000, 10.914964549494], [1180584000000, 10.933223880565], [1183176000000, 8.3457524851265], [1185854400000, 8.1078413081882], [1188532800000, 8.2697185922474], [1191124800000, 8.4742436475968], [1193803200000, 8.4994601179319], [1196398800000, 8.7387319683243], [1199077200000, 6.8829183612895], [1201755600000, 6.984133637885], [1204261200000, 7.0860136043287], [1206936000000, 4.3961787956053], [1209528000000, 3.8699674365231], [1212206400000, 3.6928925238305], [1214798400000, 6.7571718894253], [1217476800000, 6.4367313362344], [1220155200000, 6.4048441521454], [1222747200000, 5.4643833239669], [1225425600000, 5.3150786833374], [1228021200000, 5.3011272612576], [1230699600000, 4.1203601430809], [1233378000000, 4.0881783200525], [1235797200000, 4.1928665957189], [1238472000000, 7.0249415663205], [1241064000000, 7.006530880769], [1243742400000, 6.994835633224], [1246334400000, 6.1220222336254], [1249012800000, 6.1177436137653], [1251691200000, 6.1413396231981], [1254283200000, 4.8046006145874], [1256961600000, 4.6647600660544], [1259557200000, 4.544865006255], [1262235600000, 6.0488249316539], [1264914000000, 6.3188669540206], [1267333200000, 6.5873958262306], [1270008000000, 6.2281189839578], [1272600000000, 5.8948915746059], [1275278400000, 5.5967320482214], [1277870400000, 0.99784432084837], [1280548800000, 1.0950794175359], [1283227200000, 0.94479734407491], [1285819200000, 1.222093988688], [1288497600000, 1.335093106856], [1291093200000, 1.3302565104985], [1293771600000, 1.340824670897], [1296450000000, 0], [1298869200000, 0], [1301544000000, 0], [1304136000000, 0], [1306814400000, 0], [1309406400000, 0], [1312084800000, 0], [1314763200000, 0], [1317355200000, 4.4583692315], [1320033600000, 3.6493043348059], [1322629200000, 3.8610064091761], [1325307600000, 5.5144800685202], [1327986000000, 5.1750695220792], [1330491600000, 5.6710066952691], [1333166400000, 8.5658461590953], [1335758400000, 8.6135447714243], [1338436800000, 8.0231460925212]] + }, + { + "key": "Energy", + "values": [[1138683600000, 1.544303464167], [1141102800000, 1.4387289432421], [1143781200000, 0], [1146369600000, 0], [1149048000000, 0], [1151640000000, 1.328626801128], [1154318400000, 1.2874050802627], [1156996800000, 1.0872743105593], [1159588800000, 0.96042562635813], [1162270800000, 0.93139372870616], [1164862800000, 0.94432167305385], [1167541200000, 1.277750166208], [1170219600000, 1.2204893886811], [1172638800000, 1.207489123122], [1175313600000, 1.2490651414113], [1177905600000, 1.2593129913052], [1180584000000, 1.373329808388], [1183176000000, 0], [1185854400000, 0], [1188532800000, 0], [1191124800000, 0], [1193803200000, 0], [1196398800000, 0], [1199077200000, 0], [1201755600000, 0], [1204261200000, 0], [1206936000000, 0], [1209528000000, 0], [1212206400000, 0], [1214798400000, 0], [1217476800000, 0], [1220155200000, 0], [1222747200000, 1.4516108933695], [1225425600000, 1.1856025268225], [1228021200000, 1.3430470355439], [1230699600000, 2.2752595354509], [1233378000000, 2.4031560010523], [1235797200000, 2.0822430731926], [1238472000000, 1.5640902826938], [1241064000000, 1.5812873972356], [1243742400000, 1.9462448548894], [1246334400000, 2.9464870223957], [1249012800000, 3.0744699383222], [1251691200000, 2.9422304628446], [1254283200000, 2.7503075599999], [1256961600000, 2.6506701800427], [1259557200000, 2.8005425319977], [1262235600000, 2.6816184971185], [1264914000000, 2.681206271327], [1267333200000, 2.8195488011259], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 1.0687057346382], [1280548800000, 1.2539400544134], [1283227200000, 1.1862969445955], [1285819200000, 0], [1288497600000, 0], [1291093200000, 0], [1293771600000, 0], [1296450000000, 1.941972859484], [1298869200000, 2.1142247697552], [1301544000000, 2.3788590206824], [1304136000000, 2.5337302877545], [1306814400000, 2.3163370395199], [1309406400000, 2.0645451843195], [1312084800000, 2.1004446672411], [1314763200000, 3.6301875804303], [1317355200000, 2.454204664652], [1320033600000, 2.196082370894], [1322629200000, 2.3358418255202], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0.39001201038526], [1335758400000, 0.30945472725559], [1338436800000, 0.31062439305591]] + }, + { + "key": "Financials", + "values": [[1138683600000, 13.356778764352], [1141102800000, 13.611196863271], [1143781200000, 6.895903006119], [1146369600000, 6.9939633271352], [1149048000000, 6.7241510257675], [1151640000000, 5.5611293669516], [1154318400000, 5.6086488714041], [1156996800000, 5.4962849907033], [1159588800000, 6.9193153169279], [1162270800000, 7.0016334389777], [1164862800000, 6.7865422443273], [1167541200000, 9.0006454225383], [1170219600000, 9.2233916171431], [1172638800000, 8.8929316009479], [1175313600000, 10.345937520404], [1177905600000, 10.075914677026], [1180584000000, 10.089006188111], [1183176000000, 10.598330295008], [1185854400000, 9.968954653301], [1188532800000, 9.7740580198146], [1191124800000, 10.558483060626], [1193803200000, 9.9314651823603], [1196398800000, 9.3997715873769], [1199077200000, 8.4086493387262], [1201755600000, 8.9698309085926], [1204261200000, 8.2778357995396], [1206936000000, 8.8585045600123], [1209528000000, 8.7013756413322], [1212206400000, 7.7933605469443], [1214798400000, 7.0236183483064], [1217476800000, 6.9873088186829], [1220155200000, 6.8031713070097], [1222747200000, 6.6869531315723], [1225425600000, 6.138256993963], [1228021200000, 5.6434994016354], [1230699600000, 5.495220262512], [1233378000000, 4.6885326869846], [1235797200000, 4.4524349883438], [1238472000000, 5.6766520778185], [1241064000000, 5.7675774480752], [1243742400000, 5.7882863168337], [1246334400000, 7.2666010034924], [1249012800000, 7.519182132226], [1251691200000, 7.849651451445], [1254283200000, 10.383992037985], [1256961600000, 9.0653691861818], [1259557200000, 9.6705248324159], [1262235600000, 10.856380561349], [1264914000000, 11.27452370892], [1267333200000, 11.754156529088], [1270008000000, 8.2870811422456], [1272600000000, 8.0210264360699], [1275278400000, 7.5375074474865], [1277870400000, 8.3419527338039], [1280548800000, 9.4197471818443], [1283227200000, 8.7321733185797], [1285819200000, 9.6627062648126], [1288497600000, 10.187962234549], [1291093200000, 9.8144201733476], [1293771600000, 10.275723361713], [1296450000000, 16.796066079353], [1298869200000, 17.543254984075], [1301544000000, 16.673660675084], [1304136000000, 17.963944353609], [1306814400000, 16.637740867211], [1309406400000, 15.84857094609], [1312084800000, 14.767303362182], [1314763200000, 24.778452182432], [1317355200000, 18.370353229999], [1320033600000, 15.2531374291], [1322629200000, 14.989600840649], [1325307600000, 16.052539160125], [1327986000000, 16.424390322793], [1330491600000, 17.884020741105], [1333166400000, 7.1424929577921], [1335758400000, 7.8076213051482], [1338436800000, 7.2462684949232]] + }, + { + "key": "Health Care", + "values": [[1138683600000, 14.212410956029], [1141102800000, 13.973193618249], [1143781200000, 15.218233920665], [1146369600000, 14.38210972745], [1149048000000, 13.894310878491], [1151640000000, 15.593086090032], [1154318400000, 16.244839695188], [1156996800000, 16.017088850646], [1159588800000, 14.183951830055], [1162270800000, 14.148523245697], [1164862800000, 13.424326059972], [1167541200000, 12.974450435753], [1170219600000, 13.23247041802], [1172638800000, 13.318762655574], [1175313600000, 15.961407746104], [1177905600000, 16.287714639805], [1180584000000, 16.246590583889], [1183176000000, 17.564505594809], [1185854400000, 17.872725373165], [1188532800000, 18.018998508757], [1191124800000, 15.584518016603], [1193803200000, 15.480850647181], [1196398800000, 15.699120036984], [1199077200000, 19.184281817226], [1201755600000, 19.691226605207], [1204261200000, 18.982314051295], [1206936000000, 18.707820309008], [1209528000000, 17.459630929761], [1212206400000, 16.500616076782], [1214798400000, 18.086324003979], [1217476800000, 18.929464156258], [1220155200000, 18.233728682084], [1222747200000, 16.315776297325], [1225425600000, 14.63289219025], [1228021200000, 14.667835024478], [1230699600000, 13.946993947308], [1233378000000, 14.394304684397], [1235797200000, 13.724462792967], [1238472000000, 10.930879035806], [1241064000000, 9.8339915513708], [1243742400000, 10.053858541872], [1246334400000, 11.786998438287], [1249012800000, 11.780994901769], [1251691200000, 11.305889670276], [1254283200000, 10.918452290083], [1256961600000, 9.6811395055706], [1259557200000, 10.971529744038], [1262235600000, 13.330210480209], [1264914000000, 14.592637568961], [1267333200000, 14.605329141157], [1270008000000, 13.936853794037], [1272600000000, 12.189480759072], [1275278400000, 11.676151385046], [1277870400000, 13.058852800017], [1280548800000, 13.62891543203], [1283227200000, 13.811107569918], [1285819200000, 13.786494560787], [1288497600000, 14.04516285753], [1291093200000, 13.697412447288], [1293771600000, 13.677681376221], [1296450000000, 19.961511864531], [1298869200000, 21.049198298158], [1301544000000, 22.687631094008], [1304136000000, 25.469010617433], [1306814400000, 24.883799437121], [1309406400000, 24.203843814248], [1312084800000, 22.138760964038], [1314763200000, 16.034636966228], [1317355200000, 15.394958944556], [1320033600000, 12.625642461969], [1322629200000, 12.973735699739], [1325307600000, 15.786018336149], [1327986000000, 15.227368020134], [1330491600000, 15.899752650734], [1333166400000, 18.994731295388], [1335758400000, 18.450055817702], [1338436800000, 17.863719889669]] + }, + { + "key": "Industrials", + "values": [[1138683600000, 7.1590087090398], [1141102800000, 7.1297210970108], [1143781200000, 5.5774588290586], [1146369600000, 5.4977254491156], [1149048000000, 5.5138153113634], [1151640000000, 4.3198084032122], [1154318400000, 3.9179295839125], [1156996800000, 3.8110093051479], [1159588800000, 5.5629020916939], [1162270800000, 5.7241673711336], [1164862800000, 5.4715049695004], [1167541200000, 4.9193763571618], [1170219600000, 5.136053947247], [1172638800000, 5.1327258759766], [1175313600000, 5.1888943925082], [1177905600000, 5.5191481293345], [1180584000000, 5.6093625614921], [1183176000000, 4.2706312987397], [1185854400000, 4.4453235132117], [1188532800000, 4.6228003109761], [1191124800000, 5.0645764756954], [1193803200000, 5.0723447230959], [1196398800000, 5.1457765818846], [1199077200000, 5.4067851597282], [1201755600000, 5.472241916816], [1204261200000, 5.3742740389688], [1206936000000, 6.251751933664], [1209528000000, 6.1406852153472], [1212206400000, 5.8164385627465], [1214798400000, 5.4255846656171], [1217476800000, 5.3738499417204], [1220155200000, 5.1815627753979], [1222747200000, 5.0305983235349], [1225425600000, 4.6823058607165], [1228021200000, 4.5941481589093], [1230699600000, 5.4669598474575], [1233378000000, 5.1249037357], [1235797200000, 4.3504421250742], [1238472000000, 4.6260881026002], [1241064000000, 5.0140402458946], [1243742400000, 4.7458462454774], [1246334400000, 6.0437019654564], [1249012800000, 6.4595216249754], [1251691200000, 6.6420468254155], [1254283200000, 5.8927271960913], [1256961600000, 5.4712108838003], [1259557200000, 6.1220254207747], [1262235600000, 5.5385935169255], [1264914000000, 5.7383377612639], [1267333200000, 6.1715976730415], [1270008000000, 4.0102262681174], [1272600000000, 3.769389679692], [1275278400000, 3.5301571031152], [1277870400000, 2.7660252652526], [1280548800000, 3.1409983385775], [1283227200000, 3.0528024863055], [1285819200000, 4.3126123157971], [1288497600000, 4.594654041683], [1291093200000, 4.5424126126793], [1293771600000, 4.7790043987302], [1296450000000, 7.4969154058289], [1298869200000, 7.9424751557821], [1301544000000, 7.1560736250547], [1304136000000, 7.9478117337855], [1306814400000, 7.4109214848895], [1309406400000, 7.5966457641101], [1312084800000, 7.165754444071], [1314763200000, 5.4816702524302], [1317355200000, 4.9893656089584], [1320033600000, 4.498385105327], [1322629200000, 4.6776090358151], [1325307600000, 8.1350814368063], [1327986000000, 8.0732769990652], [1330491600000, 8.5602340387277], [1333166400000, 5.1293714074325], [1335758400000, 5.2586794619016], [1338436800000, 5.1100853569977]] + }, + { + "key": "Information Technology", + "values": [[1138683600000, 13.242301508051], [1141102800000, 12.863536342042], [1143781200000, 21.034044171629], [1146369600000, 21.419084618803], [1149048000000, 21.142678863691], [1151640000000, 26.568489677529], [1154318400000, 24.839144939905], [1156996800000, 25.456187462167], [1159588800000, 26.350164502826], [1162270800000, 26.47833320519], [1164862800000, 26.425979547847], [1167541200000, 28.191461582256], [1170219600000, 28.930307448808], [1172638800000, 29.521413891117], [1175313600000, 28.188285966466], [1177905600000, 27.704619625832], [1180584000000, 27.490862424829], [1183176000000, 28.770679721286], [1185854400000, 29.060480671449], [1188532800000, 28.240998844973], [1191124800000, 33.004893194127], [1193803200000, 34.075180359928], [1196398800000, 32.548560664833], [1199077200000, 30.629727432728], [1201755600000, 28.642858788159], [1204261200000, 27.973575227842], [1206936000000, 27.393351882726], [1209528000000, 28.476095288523], [1212206400000, 29.29667866426], [1214798400000, 29.222333802896], [1217476800000, 28.092966093843], [1220155200000, 28.107159262922], [1222747200000, 25.482974832098], [1225425600000, 21.208115993834], [1228021200000, 20.295043095268], [1230699600000, 15.925754618401], [1233378000000, 17.162864628346], [1235797200000, 17.084345773174], [1238472000000, 22.246007102281], [1241064000000, 24.530543998509], [1243742400000, 25.084184918242], [1246334400000, 16.606166527358], [1249012800000, 17.239620011628], [1251691200000, 17.336739127379], [1254283200000, 25.478492475753], [1256961600000, 23.017152085245], [1259557200000, 25.617745423683], [1262235600000, 24.061133998642], [1264914000000, 23.223933318644], [1267333200000, 24.425887263937], [1270008000000, 35.501471156693], [1272600000000, 33.775013878676], [1275278400000, 30.417993630285], [1277870400000, 30.023598978467], [1280548800000, 33.327519522436], [1283227200000, 31.963388450371], [1285819200000, 30.498967232092], [1288497600000, 32.403696817912], [1291093200000, 31.47736071922], [1293771600000, 31.53259666241], [1296450000000, 41.760282761548], [1298869200000, 45.605771243237], [1301544000000, 39.986557966215], [1304136000000, 43.846330510051], [1306814400000, 39.857316881857], [1309406400000, 37.675127768208], [1312084800000, 35.775077970313], [1314763200000, 48.631009702577], [1317355200000, 42.830831754505], [1320033600000, 35.611502589362], [1322629200000, 35.320136981738], [1325307600000, 31.564136901516], [1327986000000, 32.074407502433], [1330491600000, 35.053013769976], [1333166400000, 26.434568573937], [1335758400000, 25.305617871002], [1338436800000, 24.520919418236]] + }, + { + "key": "Materials", + "values": [[1138683600000, 5.5806167415681], [1141102800000, 5.4539047069985], [1143781200000, 7.6728842432362], [1146369600000, 7.719946716654], [1149048000000, 8.0144619912942], [1151640000000, 7.942223133434], [1154318400000, 8.3998279827444], [1156996800000, 8.532324572605], [1159588800000, 4.7324285199763], [1162270800000, 4.7402397487697], [1164862800000, 4.9042069355168], [1167541200000, 5.9583963430882], [1170219600000, 6.3693899239171], [1172638800000, 6.261153903813], [1175313600000, 5.3443942184584], [1177905600000, 5.4932111235361], [1180584000000, 5.5747393101109], [1183176000000, 5.3833633060013], [1185854400000, 5.5125898831832], [1188532800000, 5.8116112661327], [1191124800000, 4.3962296939996], [1193803200000, 4.6967663605521], [1196398800000, 4.7963004350914], [1199077200000, 4.1817985183351], [1201755600000, 4.3797643870182], [1204261200000, 4.6966642197965], [1206936000000, 4.3609995132565], [1209528000000, 4.4736290996496], [1212206400000, 4.3749762738128], [1214798400000, 3.3274661194507], [1217476800000, 3.0316184691337], [1220155200000, 2.5718140204728], [1222747200000, 2.7034994044603], [1225425600000, 2.2033786591364], [1228021200000, 1.9850621240805], [1230699600000, 0], [1233378000000, 0], [1235797200000, 0], [1238472000000, 0], [1241064000000, 0], [1243742400000, 0], [1246334400000, 0], [1249012800000, 0], [1251691200000, 0], [1254283200000, 0.44495950017788], [1256961600000, 0.33945469262483], [1259557200000, 0.38348269455195], [1262235600000, 0], [1264914000000, 0], [1267333200000, 0], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 0], [1280548800000, 0], [1283227200000, 0], [1285819200000, 0], [1288497600000, 0], [1291093200000, 0], [1293771600000, 0], [1296450000000, 0.52216435716176], [1298869200000, 0.59275786698454], [1301544000000, 0], [1304136000000, 0], [1306814400000, 0], [1309406400000, 0], [1312084800000, 0], [1314763200000, 0], [1317355200000, 0], [1320033600000, 0], [1322629200000, 0], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0], [1335758400000, 0], [1338436800000, 0]] + }, + { + "key": "Telecommunication Services", + "values": [[1138683600000, 3.7056975170243], [1141102800000, 3.7561118692318], [1143781200000, 2.861913700854], [1146369600000, 2.9933744103381], [1149048000000, 2.7127537218463], [1151640000000, 3.1195497076283], [1154318400000, 3.4066964004508], [1156996800000, 3.3754571113569], [1159588800000, 2.2965579982924], [1162270800000, 2.4486818633018], [1164862800000, 2.4002308848517], [1167541200000, 1.9649579750349], [1170219600000, 1.9385263638056], [1172638800000, 1.9128975336387], [1175313600000, 2.3412869836298], [1177905600000, 2.4337870351445], [1180584000000, 2.62179703171], [1183176000000, 3.2642864957929], [1185854400000, 3.3200396223709], [1188532800000, 3.3934212707572], [1191124800000, 4.2822327088179], [1193803200000, 4.1474964228541], [1196398800000, 4.1477082879801], [1199077200000, 5.2947122916128], [1201755600000, 5.2919843508028], [1204261200000, 5.1989783050309], [1206936000000, 3.5603057673513], [1209528000000, 3.3009087690692], [1212206400000, 3.1784852603792], [1214798400000, 4.5889503538868], [1217476800000, 4.401779617494], [1220155200000, 4.2208301828278], [1222747200000, 3.89396671475], [1225425600000, 3.0423832241354], [1228021200000, 3.135520611578], [1230699600000, 1.9631418164089], [1233378000000, 1.8963543874958], [1235797200000, 1.8266636017025], [1238472000000, 0.93136635895188], [1241064000000, 0.92737801918888], [1243742400000, 0.97591889805002], [1246334400000, 2.6841193805515], [1249012800000, 2.5664341140531], [1251691200000, 2.3887523699873], [1254283200000, 1.1737801663681], [1256961600000, 1.0953582317281], [1259557200000, 1.2495674976653], [1262235600000, 0.36607452464754], [1264914000000, 0.3548719047291], [1267333200000, 0.36769242398939], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 0], [1280548800000, 0], [1283227200000, 0], [1285819200000, 0.85450741275337], [1288497600000, 0.91360317921637], [1291093200000, 0.89647678692269], [1293771600000, 0.87800687192639], [1296450000000, 0], [1298869200000, 0], [1301544000000, 0.43668720882994], [1304136000000, 0.4756523602692], [1306814400000, 0.46947368328469], [1309406400000, 0.45138896152316], [1312084800000, 0.43828726648117], [1314763200000, 2.0820861395316], [1317355200000, 0.9364411075395], [1320033600000, 0.60583907839773], [1322629200000, 0.61096950747437], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0], [1335758400000, 0], [1338436800000, 0]] + }, + { + "key": "Utilities", + "values": [[1138683600000, 0], [1141102800000, 0], [1143781200000, 0], [1146369600000, 0], [1149048000000, 0], [1151640000000, 0], [1154318400000, 0], [1156996800000, 0], [1159588800000, 0], [1162270800000, 0], [1164862800000, 0], [1167541200000, 0], [1170219600000, 0], [1172638800000, 0], [1175313600000, 0], [1177905600000, 0], [1180584000000, 0], [1183176000000, 0], [1185854400000, 0], [1188532800000, 0], [1191124800000, 0], [1193803200000, 0], [1196398800000, 0], [1199077200000, 0], [1201755600000, 0], [1204261200000, 0], [1206936000000, 0], [1209528000000, 0], [1212206400000, 0], [1214798400000, 0], [1217476800000, 0], [1220155200000, 0], [1222747200000, 0], [1225425600000, 0], [1228021200000, 0], [1230699600000, 0], [1233378000000, 0], [1235797200000, 0], [1238472000000, 0], [1241064000000, 0], [1243742400000, 0], [1246334400000, 0], [1249012800000, 0], [1251691200000, 0], [1254283200000, 0], [1256961600000, 0], [1259557200000, 0], [1262235600000, 0], [1264914000000, 0], [1267333200000, 0], [1270008000000, 0], [1272600000000, 0], [1275278400000, 0], [1277870400000, 0], [1280548800000, 0], [1283227200000, 0], [1285819200000, 0], [1288497600000, 0], [1291093200000, 0], [1293771600000, 0], [1296450000000, 0], [1298869200000, 0], [1301544000000, 0], [1304136000000, 0], [1306814400000, 0], [1309406400000, 0], [1312084800000, 0], [1314763200000, 0], [1317355200000, 0], [1320033600000, 0], [1322629200000, 0], [1325307600000, 0], [1327986000000, 0], [1330491600000, 0], [1333166400000, 0], [1335758400000, 0], [1338436800000, 0]] + } + ]; + + var colors = d3.scale.category20(); + + var chart; + nv.addGraph(function () { + chart = nv.models.stackedAreaChart() + .useInteractiveGuideline(true) + .x(function (d) { return d[0] }) + .y(function (d) { return d[1] }) + .controlLabels({ stacked: "Stacked" }) + .duration(300); + + chart.xAxis.tickFormat(function (d) { return d3.time.format('%x')(new Date(d)) }); + chart.yAxis.tickFormat(d3.format(',.4f')); + + chart.legend.vers('furious'); + + d3.select('#chart1') + .datum(histcatexplong) + .transition().duration(1000) + .call(chart) + .each('start', function () { + setTimeout(function () { + d3.selectAll('#chart1 *').each(function () { + if (this.__transition__) + this.__transition__.duration = 1; + }) + }, 0) + }); + + nv.utils.windowResize(chart.update); + return chart; + }); + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-sunburst.ts b/nvd3/nvd3-test-sunburst.ts new file mode 100644 index 000000000..cb299e084 --- /dev/null +++ b/nvd3/nvd3-test-sunburst.ts @@ -0,0 +1,402 @@ +/// +module nvd3_test_sunburst { + + var chart; + + nv.addGraph(function () { + chart = nv.models.sunburstChart(); + + chart.color(d3.scale.category20c()); + + d3.select("#test1") + .datum(getData()) + .call(chart); + + nv.utils.windowResize(chart.update); + + return chart; + }); + + function getData() { + return [{ + "name": "flare", + "children": [ + { + "name": "analytics", + "children": [ + { + "name": "cluster", + "children": [ + { "name": "AgglomerativeCluster", "size": 3938 }, + { "name": "CommunityStructure", "size": 3812 }, + { "name": "HierarchicalCluster", "size": 6714 }, + { "name": "MergeEdge", "size": 743 } + ] + }, + { + "name": "graph", + "children": [ + { "name": "BetweennessCentrality", "size": 3534 }, + { "name": "LinkDistance", "size": 5731 }, + { "name": "MaxFlowMinCut", "size": 7840 }, + { "name": "ShortestPaths", "size": 5914 }, + { "name": "SpanningTree", "size": 3416 } + ] + }, + { + "name": "optimization", + "children": [ + { "name": "AspectRatioBanker", "size": 7074 } + ] + } + ] + }, + { + "name": "animate", + "children": [ + { "name": "Easing", "size": 17010 }, + { "name": "FunctionSequence", "size": 5842 }, + { + "name": "interpolate", + "children": [ + { "name": "ArrayInterpolator", "size": 1983 }, + { "name": "ColorInterpolator", "size": 2047 }, + { "name": "DateInterpolator", "size": 1375 }, + { "name": "Interpolator", "size": 8746 }, + { "name": "MatrixInterpolator", "size": 2202 }, + { "name": "NumberInterpolator", "size": 1382 }, + { "name": "ObjectInterpolator", "size": 1629 }, + { "name": "PointInterpolator", "size": 1675 }, + { "name": "RectangleInterpolator", "size": 2042 } + ] + }, + { "name": "ISchedulable", "size": 1041 }, + { "name": "Parallel", "size": 5176 }, + { "name": "Pause", "size": 449 }, + { "name": "Scheduler", "size": 5593 }, + { "name": "Sequence", "size": 5534 }, + { "name": "Transition", "size": 9201 }, + { "name": "Transitioner", "size": 19975 }, + { "name": "TransitionEvent", "size": 1116 }, + { "name": "Tween", "size": 6006 } + ] + }, + { + "name": "data", + "children": [ + { + "name": "converters", + "children": [ + { "name": "Converters", "size": 721 }, + { "name": "DelimitedTextConverter", "size": 4294 }, + { "name": "GraphMLConverter", "size": 9800 }, + { "name": "IDataConverter", "size": 1314 }, + { "name": "JSONConverter", "size": 2220 } + ] + }, + { "name": "DataField", "size": 1759 }, + { "name": "DataSchema", "size": 2165 }, + { "name": "DataSet", "size": 586 }, + { "name": "DataSource", "size": 3331 }, + { "name": "DataTable", "size": 772 }, + { "name": "DataUtil", "size": 3322 } + ] + }, + { + "name": "display", + "children": [ + { "name": "DirtySprite", "size": 8833 }, + { "name": "LineSprite", "size": 1732 }, + { "name": "RectSprite", "size": 3623 }, + { "name": "TextSprite", "size": 10066 } + ] + }, + { + "name": "flex", + "children": [ + { "name": "FlareVis", "size": 4116 } + ] + }, + { + "name": "physics", + "children": [ + { "name": "DragForce", "size": 1082 }, + { "name": "GravityForce", "size": 1336 }, + { "name": "IForce", "size": 319 }, + { "name": "NBodyForce", "size": 10498 }, + { "name": "Particle", "size": 2822 }, + { "name": "Simulation", "size": 9983 }, + { "name": "Spring", "size": 2213 }, + { "name": "SpringForce", "size": 1681 } + ] + }, + { + "name": "query", + "children": [ + { "name": "AggregateExpression", "size": 1616 }, + { "name": "And", "size": 1027 }, + { "name": "Arithmetic", "size": 3891 }, + { "name": "Average", "size": 891 }, + { "name": "BinaryExpression", "size": 2893 }, + { "name": "Comparison", "size": 5103 }, + { "name": "CompositeExpression", "size": 3677 }, + { "name": "Count", "size": 781 }, + { "name": "DateUtil", "size": 4141 }, + { "name": "Distinct", "size": 933 }, + { "name": "Expression", "size": 5130 }, + { "name": "ExpressionIterator", "size": 3617 }, + { "name": "Fn", "size": 3240 }, + { "name": "If", "size": 2732 }, + { "name": "IsA", "size": 2039 }, + { "name": "Literal", "size": 1214 }, + { "name": "Match", "size": 3748 }, + { "name": "Maximum", "size": 843 }, + { + "name": "methods", + "children": [ + { "name": "add", "size": 593 }, + { "name": "and", "size": 330 }, + { "name": "average", "size": 287 }, + { "name": "count", "size": 277 }, + { "name": "distinct", "size": 292 }, + { "name": "div", "size": 595 }, + { "name": "eq", "size": 594 }, + { "name": "fn", "size": 460 }, + { "name": "gt", "size": 603 }, + { "name": "gte", "size": 625 }, + { "name": "iff", "size": 748 }, + { "name": "isa", "size": 461 }, + { "name": "lt", "size": 597 }, + { "name": "lte", "size": 619 }, + { "name": "max", "size": 283 }, + { "name": "min", "size": 283 }, + { "name": "mod", "size": 591 }, + { "name": "mul", "size": 603 }, + { "name": "neq", "size": 599 }, + { "name": "not", "size": 386 }, + { "name": "or", "size": 323 }, + { "name": "orderby", "size": 307 }, + { "name": "range", "size": 772 }, + { "name": "select", "size": 296 }, + { "name": "stddev", "size": 363 }, + { "name": "sub", "size": 600 }, + { "name": "sum", "size": 280 }, + { "name": "update", "size": 307 }, + { "name": "variance", "size": 335 }, + { "name": "where", "size": 299 }, + { "name": "xor", "size": 354 }, + { "name": "_", "size": 264 } + ] + }, + { "name": "Minimum", "size": 843 }, + { "name": "Not", "size": 1554 }, + { "name": "Or", "size": 970 }, + { "name": "Query", "size": 13896 }, + { "name": "Range", "size": 1594 }, + { "name": "StringUtil", "size": 4130 }, + { "name": "Sum", "size": 791 }, + { "name": "Variable", "size": 1124 }, + { "name": "Variance", "size": 1876 }, + { "name": "Xor", "size": 1101 } + ] + }, + { + "name": "scale", + "children": [ + { "name": "IScaleMap", "size": 2105 }, + { "name": "LinearScale", "size": 1316 }, + { "name": "LogScale", "size": 3151 }, + { "name": "OrdinalScale", "size": 3770 }, + { "name": "QuantileScale", "size": 2435 }, + { "name": "QuantitativeScale", "size": 4839 }, + { "name": "RootScale", "size": 1756 }, + { "name": "Scale", "size": 4268 }, + { "name": "ScaleType", "size": 1821 }, + { "name": "TimeScale", "size": 5833 } + ] + }, + { + "name": "util", + "children": [ + { "name": "Arrays", "size": 8258 }, + { "name": "Colors", "size": 10001 }, + { "name": "Dates", "size": 8217 }, + { "name": "Displays", "size": 12555 }, + { "name": "Filter", "size": 2324 }, + { "name": "Geometry", "size": 10993 }, + { + "name": "heap", + "children": [ + { "name": "FibonacciHeap", "size": 9354 }, + { "name": "HeapNode", "size": 1233 } + ] + }, + { "name": "IEvaluable", "size": 335 }, + { "name": "IPredicate", "size": 383 }, + { "name": "IValueProxy", "size": 874 }, + { + "name": "math", + "children": [ + { "name": "DenseMatrix", "size": 3165 }, + { "name": "IMatrix", "size": 2815 }, + { "name": "SparseMatrix", "size": 3366 } + ] + }, + { "name": "Maths", "size": 17705 }, + { "name": "Orientation", "size": 1486 }, + { + "name": "palette", + "children": [ + { "name": "ColorPalette", "size": 6367 }, + { "name": "Palette", "size": 1229 }, + { "name": "ShapePalette", "size": 2059 }, + { "name": "SizePalette", "size": 2291 } + ] + }, + { "name": "Property", "size": 5559 }, + { "name": "Shapes", "size": 19118 }, + { "name": "Sort", "size": 6887 }, + { "name": "Stats", "size": 6557 }, + { "name": "Strings", "size": 22026 } + ] + }, + { + "name": "vis", + "children": [ + { + "name": "axis", + "children": [ + { "name": "Axes", "size": 1302 }, + { "name": "Axis", "size": 24593 }, + { "name": "AxisGridLine", "size": 652 }, + { "name": "AxisLabel", "size": 636 }, + { "name": "CartesianAxes", "size": 6703 } + ] + }, + { + "name": "controls", + "children": [ + { "name": "AnchorControl", "size": 2138 }, + { "name": "ClickControl", "size": 3824 }, + { "name": "Control", "size": 1353 }, + { "name": "ControlList", "size": 4665 }, + { "name": "DragControl", "size": 2649 }, + { "name": "ExpandControl", "size": 2832 }, + { "name": "HoverControl", "size": 4896 }, + { "name": "IControl", "size": 763 }, + { "name": "PanZoomControl", "size": 5222 }, + { "name": "SelectionControl", "size": 7862 }, + { "name": "TooltipControl", "size": 8435 } + ] + }, + { + "name": "data", + "children": [ + { "name": "Data", "size": 20544 }, + { "name": "DataList", "size": 19788 }, + { "name": "DataSprite", "size": 10349 }, + { "name": "EdgeSprite", "size": 3301 }, + { "name": "NodeSprite", "size": 19382 }, + { + "name": "render", + "children": [ + { "name": "ArrowType", "size": 698 }, + { "name": "EdgeRenderer", "size": 5569 }, + { "name": "IRenderer", "size": 353 }, + { "name": "ShapeRenderer", "size": 2247 } + ] + }, + { "name": "ScaleBinding", "size": 11275 }, + { "name": "Tree", "size": 7147 }, + { "name": "TreeBuilder", "size": 9930 } + ] + }, + { + "name": "events", + "children": [ + { "name": "DataEvent", "size": 2313 }, + { "name": "SelectionEvent", "size": 1880 }, + { "name": "TooltipEvent", "size": 1701 }, + { "name": "VisualizationEvent", "size": 1117 } + ] + }, + { + "name": "legend", + "children": [ + { "name": "Legend", "size": 20859 }, + { "name": "LegendItem", "size": 4614 }, + { "name": "LegendRange", "size": 10530 } + ] + }, + { + "name": "operator", + "children": [ + { + "name": "distortion", + "children": [ + { "name": "BifocalDistortion", "size": 4461 }, + { "name": "Distortion", "size": 6314 }, + { "name": "FisheyeDistortion", "size": 3444 } + ] + }, + { + "name": "encoder", + "children": [ + { "name": "ColorEncoder", "size": 3179 }, + { "name": "Encoder", "size": 4060 }, + { "name": "PropertyEncoder", "size": 4138 }, + { "name": "ShapeEncoder", "size": 1690 }, + { "name": "SizeEncoder", "size": 1830 } + ] + }, + { + "name": "filter", + "children": [ + { "name": "FisheyeTreeFilter", "size": 5219 }, + { "name": "GraphDistanceFilter", "size": 3165 }, + { "name": "VisibilityFilter", "size": 3509 } + ] + }, + { "name": "IOperator", "size": 1286 }, + { + "name": "label", + "children": [ + { "name": "Labeler", "size": 9956 }, + { "name": "RadialLabeler", "size": 3899 }, + { "name": "StackedAreaLabeler", "size": 3202 } + ] + }, + { + "name": "layout", + "children": [ + { "name": "AxisLayout", "size": 6725 }, + { "name": "BundledEdgeRouter", "size": 3727 }, + { "name": "CircleLayout", "size": 9317 }, + { "name": "CirclePackingLayout", "size": 12003 }, + { "name": "DendrogramLayout", "size": 4853 }, + { "name": "ForceDirectedLayout", "size": 8411 }, + { "name": "IcicleTreeLayout", "size": 4864 }, + { "name": "IndentedTreeLayout", "size": 3174 }, + { "name": "Layout", "size": 7881 }, + { "name": "NodeLinkTreeLayout", "size": 12870 }, + { "name": "PieLayout", "size": 2728 }, + { "name": "RadialTreeLayout", "size": 12348 }, + { "name": "RandomLayout", "size": 870 }, + { "name": "StackedAreaLayout", "size": 9121 }, + { "name": "TreeMapLayout", "size": 9191 } + ] + }, + { "name": "Operator", "size": 2490 }, + { "name": "OperatorList", "size": 5248 }, + { "name": "OperatorSequence", "size": 4190 }, + { "name": "OperatorSwitch", "size": 2581 }, + { "name": "SortOperator", "size": 2023 } + ] + }, + { "name": "Visualization", "size": 16540 } + ] + } + ] + }]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3-test-timeSeries.ts b/nvd3/nvd3-test-timeSeries.ts new file mode 100644 index 000000000..2eec0dcbd --- /dev/null +++ b/nvd3/nvd3-test-timeSeries.ts @@ -0,0 +1,167 @@ +/// +module nvd3_test_timeSeries { + var data = [{ + values: [] + }]; + + var i, x; + var gap = false; + var prevVal = 3000; + var tickCount = 100; + var probEnterGap = 0.1; + var probExitGap = 0.2; + var barTimespan = 30 * 60; // thirty minutes in seconds + var startOfTime = 1425096000; + for (i = 0; i < tickCount; i++) { + x = startOfTime + i * barTimespan; + if (!gap) { + if (Math.random() > probEnterGap) { + prevVal += (Math.random() - 0.5) * 500; + if (prevVal <= 0) { + prevVal = Math.random() * 100; + } + data[0].values.push({ x: x * 1000, y: prevVal }); + } + else { + gap = true; + } + } + else { + if (Math.random() < probExitGap) { + gap = false; + } + } + } + + var chart; + + var halfBarXMin = data[0].values[0].x - barTimespan / 2 * 1000; + var halfBarXMax = data[0].values[data[0].values.length - 1].x + barTimespan / 2 * 1000; + + function renderChart(location, meaning) { + nv.addGraph(function () { + chart = nv.models.historicalBarChart(); + chart + .xScale(d3.time.scale()) // use a time scale instead of plain numbers in order to get nice round default values in the axis + .color(['#68c']) + .forceX([halfBarXMin, halfBarXMax]) // fix half-bar problem on the first and last bars + .useInteractiveGuideline(true) // check out the css that turns the guideline into this nice thing + .margin({ "left": 80, "right": 50, "top": 20, "bottom": 30 }) + .duration(0) + ; + + var tickMultiFormat = d3.time.format.multi([ + ["%-I:%M%p", function (d) { return d.getMinutes(); }], // not the beginning of the hour + ["%-I%p", function (d) { return d.getHours(); }], // not midnight + ["%b %-d", function (d) { return d.getDate() != 1; }], // not the first of the month + ["%b %-d", function (d) { return d.getMonth(); }], // not Jan 1st + ["%Y", function () { return true; }] + ]); + chart.xAxis + .showMaxMin(false) + .tickPadding(10) + .tickFormat(function (d) { return tickMultiFormat(new Date(d)); }) + ; + + chart.yAxis + .showMaxMin(false) + .tickFormat(d3.format(",.0f")) + ; + + var svgElem = d3.select(location); + svgElem + .datum(data) + .transition() + .call(chart); + + // make our own x-axis tick marks because NVD3 doesn't provide any + var tickY2 = chart.yAxis.scale().range()[1]; + var lineElems = svgElem + .select('.nv-x.nv-axis.nvd3-svg') + .select('.nvd3.nv-wrap.nv-axis') + .select('g') + .selectAll('.tick') + .data(chart.xScale().ticks()) + .append('line') + .attr('class', 'x-axis-tick-mark') + .attr('x2', 0) + .attr('y1', tickY2 + 4) + .attr('y2', tickY2) + .attr('stroke-width', 1) + ; + + // set up the tooltip to display full dates + var tsFormat = d3.time.format('%b %-d, %Y %I:%M%p'); + var contentGenerator = chart.interactiveLayer.tooltip.contentGenerator(); + var tooltip = chart.interactiveLayer.tooltip; + tooltip.contentGenerator(function (d) { d.value = d.series[0].data.x; return contentGenerator(d); }); + tooltip.headerFormatter(function (d) { return tsFormat(new Date(d)); }); + + // common stuff for the sections below + var xScale = chart.xScale(); + var xPixelFirstBar = xScale(data[0].values[0].x); + var xPixelSecondBar = xScale(data[0].values[0].x + barTimespan * 1000); + var barWidth = xPixelSecondBar - xPixelFirstBar; // number of pixels representing time delta per bar + + // fix the bar widths so they don't overlap when there are gaps + function fixBarWidths(barSpacingFraction) { + svgElem + .selectAll('.nv-bars') + .selectAll('rect') + .attr('width', (1 - barSpacingFraction) * barWidth) + .attr('transform', function (d, i) { + var deltaX = xScale(data[0].values[i].x) - xPixelFirstBar; + deltaX += barSpacingFraction / 2 * barWidth; + return 'translate(' + deltaX + ', 0)'; + }) + ; + } + + /* + If you're representing sample measurements spaced a certain time apart, the tick marks should + be in the middle of the bars and some spacing between bars is recommended to aid with interpretation. + On the other hand, if you want to represent a quantity measured over a span of time (one bar), you're + better off placing the ticks on the edge of the bar and leaving no gap in between bars. + */ + function shiftXAxis() { + var xAxisElem = svgElem.select('.nv-axis.nv-x'); + var transform = xAxisElem.attr('transform'); + var xShift = -barWidth / 2; + transform = transform.replace('0,', xShift + ','); + xAxisElem.attr('transform', transform); + } + + if (meaning === 'instant') { + fixBarWidths(0.2); + } + else if (meaning === 'timespan') { + fixBarWidths(0.0); + shiftXAxis(); + } + + return chart; + }); + } + + renderChart('#test1', 'instant'); + renderChart('#test2', 'timespan'); + + window.setTimeout(function () { + window.setTimeout(function () { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + }, 0); + }, 0); + + function switchChartStyle(style) { + if (style === 'instant') { + document.getElementById('sc-one').style.display = 'block'; + document.getElementById('sc-two').style.display = 'none'; + } + else if (style === 'timespan') { + document.getElementById('sc-one').style.display = 'none'; + document.getElementById('sc-two').style.display = 'block'; + } + } + +} \ No newline at end of file diff --git a/nvd3/nvd3-test-tooltip.ts b/nvd3/nvd3-test-tooltip.ts new file mode 100644 index 000000000..24a090922 --- /dev/null +++ b/nvd3/nvd3-test-tooltip.ts @@ -0,0 +1,59 @@ +/// +/// +module nvd3_test_tooltip { + var width = 500, + height = 20; + + var tooltip = nv.models.tooltip(); + tooltip.duration(0); + + d3.select('.tooltip_me') + .on('mouseover', function (d, i) { + console.log("mouseover", d, i); + var data = { + series: { + key: "title", + value: "the value", + color: "#229922" + } + }; + tooltip.data(data).hidden(false); + }) + .on('mouseout', function (d, i) { + console.log("mouseout", d, i); + tooltip.hidden(true); + }) + .on('mousemove', function (d, i) { + console.log("mousemove", d, i); + //tooltip.position({ top: d3.event.pageY, left: d3.event.pageX })(); todo pageY and X not found on d3 definition + }); + + + // we must also test the scatter/line way of getting position + // Wrapping in nv.addGraph allows for '0 timeout render', stores rendered charts in nv.graphs, and may do more in the future... it's NOT required + var chart; + nv.addGraph(function () { + chart = nv.models.lineChart() + .showXAxis(false) + .showLegend(false) + .clipVoronoi(false) + .showVoronoi(true) + .showYAxis(false); + d3.select('#test2') + .datum(sinAndCos()) + .call(chart); + return chart; + }); + + function sinAndCos() { + var cos = []; + for (var i = 0; i < 5; i++) { + cos.push({ x: i, y: Math.round(.5 * Math.cos(i / 10) * 100) / 100 }); + } + return [{ + values: cos, + key: "Cosine Wave", + color: "#2ca02c" + }]; + } +} \ No newline at end of file diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts new file mode 100644 index 000000000..e7cfe39ff --- /dev/null +++ b/nvd3/nvd3.d.ts @@ -0,0 +1,3351 @@ +// Type definitions for nvd3 1.8.1 +// Project: https://github.com/novus/nvd3 +// Definitions by: Peter Mitchell +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module nv { + +//#region Core Interfaces + interface Margin { + left?: number, + right?: number, + top?: number, + bottom?: number + } + + interface Size { + height: number; + width: number; + } + + interface ArcsRadius { + inner: number; + outer: number; + } + + interface Offset { + left?: number; + top?: number; + } + + interface State { + dispatch: d3.Dispatch; + } + + interface InteractiveLayer { + tooltip: Tooltip + } + + interface SymbolMap { + set(name:string,func: (size: any)=>void): void + } + + interface Utils { + /* Default color chooser uses a color scale of 20 colors from D3 https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors */ + defaultColor(): string[]; + + getColor(arg: any): string[]; + + /* Binds callback function to run when window is resized */ + windowResize(listener: (ev: Event) => any): void; + /* Gets the browser window size */ + windowSize(): Size; + state(): State; + symbolMap: SymbolMap; + } + + interface ChartFactory { + generate: () => TChart; + callback?: (chart: TChart) => void; + } + + interface Nvd3TooltipStatic { + show([left, top]: [number, number], content: string, gravity?: string): void; //todo sort out use on nv.tooltip. + cleanup(): void; //todo sort out use on nv.tooltip. + } + + interface Nvd3Element { + dispatch: d3.Dispatch; + options(options: any): this; + update(): void; + (transition: d3.Transition, ...args: any[]): any; + (selection: d3.Selection, ...args: any[]): any; + (transition: d3.Transition, ...args: any[]): any; + (selection: d3.Selection, ...args: any[]): any; + } + + interface Chart extends Nvd3Element { + state: State; + interactiveLayer: InteractiveLayer; + } + +//#endregion + +//#region Chart Component + + interface Legend extends Nvd3Element { + align(): boolean; + align(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + expanded(): boolean; + expanded(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + key(): any; + key(value: any): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*Specifies how much spacing there is between legend items.*/ + padding(): number; + /*Specifies how much spacing there is between legend items.*/ + padding(value: number): this; + radioButtonMode(): boolean; + //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at + radioButtonMode(value: boolean): this; + rightAlign(): boolean; + rightAlign(value: boolean): this; + //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + updateState(): boolean; + //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + updateState(value: boolean): this; + //Options are "classic" and "furious" + vers(): string; + //Options are "classic" and "furious" + vers(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface Nvd3Axis extends d3.svg.Axis { + axisLabel(): string; + axisLabel(value: string): this; + axisLabelDistance(): number; + axisLabelDistance(value: number): this; + domain(): number[]; + domain(domain: number[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + orient(): string; + orient(orientation: string): this; + range(): number[]; + range(range: number[]): this; + rangeBand(): number; + rangeBands(interval: [number, number], padding?: number, outerPadding?: number): this; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(): number; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(range: number): this; + rotateYLabels(): number; + rotateYLabels(range: number): this; + scale(): any; + scale(scale: any): this; + showMaxMin(value: boolean): this; + staggerLabels(): boolean; + staggerLabels(value: boolean): this; + tickFormat(): (d: any) => string; + tickFormat(format: (t: any) => string): this; + tickFormat(format: string): this; + tickFormat(format: (d: any, i: any) => string): this; + tickPadding(): number; + tickPadding(padding: number): this; + tickSize(): number; + tickSize(size: number): this; + tickSize(inner: number, outer: number): this; + tickValues(): any[]; + tickValues(values: any[]): this; + ticks(): any[]; + ticks(...args: any[]): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface BoxPlot extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + maxBoxWidth(): number; + maxBoxWidth(value: number): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface Bullet extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + markers(): (d: any) => any //todo; + markers(func: (d: any) => any): this //todo; + measures(): (d: any) => any //todo; + measures(func: (d: any) => any): this //todo; + orient(): string; + orient(orientation: string): this; + ranges(): (d: any) => any //todo; + ranges(func: (d: any) => any): this //todo; + tickFormat(): (d: any) => string; + tickFormat(format: (d: any) => string): this; + tickFormat(format: string): this; + tickFormat(format: (d: any, i: any) => string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface CandlestickBar extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d:any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface DiscreteBar extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + rectClass(): string; + rectClass(value: string): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface Distribution extends Nvd3Element { + axis(): string; + axis(value: 'x'): this; + axis(value: 'y'): this; + axis(value: string): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + domain(): number[]; + domain(value: number[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + getData(func: (d: any) => number): this; + scale(): any; + scale(value: any): this; + size(): number; + size(value: number): this; + width(): number; + width(value: number): this; + + + } + + interface HistoricalBar extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(): number[]; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(value: number[]): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*.*/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface Line extends Scatter { + scatter: Scatter; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + } + + interface MultiBar extends Nvd3Element { + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*.*/ + hideable(): boolean; + /**/ + hideable(value: boolean): this; + id(): any; +id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: (data: Array<[number, number]>) => number[]): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface MultiBarHorizontal extends Nvd3Element { + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: (data: Array<[number, number]>) => number[]): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*.*/ + valuePadding(): number; + /**/ + valuePadding(value: number): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /**/ + yErr(): (d: any, i: number) => number|number[]; + /**/ + yErr(func: (d: any, i: number) => number | number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface OhlcBar extends Nvd3Element { + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d: any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface ParallelCoordinates extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + dimensionData(): any + dimensionData(d: any): this + /*D3 format for each x axis*/ + dimensionFormats(): string[]; + /*D3 format for each x axis*/ + dimensionFormats(value: string[]): this; + /*Name of each dimension, used for each axis.*/ + dimensionNames(): string[]; + /*Name of each dimension, used for each axis.*/ + dimensionNames(value: string[]): this; + /*Deprecated. Use dimensionsNames instead. */ + dimensions(): any; + /*Deprecated. Use dimensionsNames instead. .*/ + dimensions(value: any): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(): number; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface Pie extends Nvd3Element { + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(): ArcsRadius[]; + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(value: ArcsRadius[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(): number; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(value: number): this; + /*Whether to make a pie graph a donut graph or not.*/ + donut(): boolean; + /*Whether to make a pie graph a donut graph or not.*/ + donut(value: boolean): this; + /**/ + donutLabelsOutside(): boolean; + /**/ + donutLabelsOutside(value: boolean): this; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(): number; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(value: number): this; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(): (d: any) => number; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(func: (d: any) => number): this; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(): boolean; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /**/ + labelFormat(): string; + /**/ + labelFormat(value: string): this; + /**/ + labelFormat(format: (d: any) => string): this; + /**/ + labelSunbeamLayout(): boolean; + /**/ + labelSunbeamLayout(value: boolean): this; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(): number; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(value: number): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(): string; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'key'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'value'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'percent'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: string): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(func: (d: any, i: number, values:any)=> string): this; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(): boolean; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(): number; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(value: number): this; + /**/ + pieLabelsOutside(): boolean; + /**/ + pieLabelsOutside(value: boolean): this; + /*Show pie/donut chart labels for each slice*/ + showLabels(): boolean; + /*Show pie/donut chart labels for each slice*/ + showLabels(value: boolean): this; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(): (d: any) => number; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(func: (d: any) => number): this; + /*Text to include within the middle of a donut chart*/ + title(): string; + /*Text to include within the middle of a donut chart*/ + title(value: string): this; + /*Vertical offset for the donut chart title*/ + titleOffset(): number; + /*Vertical offset for the donut chart title*/ + titleOffset(value: number): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(format: (d: any) => string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /*Proxy function to return the Y value so adjustments can be made if needed.For pie/ donut chart this returns the value for the slice.*/ + y(): (d: any) => number; + /*Proxy function to return the Y value so adjustments can be made if needed. For pie/donut chart this returns the value for the slice.*/ + y(func: (d: any) => number): this; + /**/ + } + + interface Scatter extends Nvd3Element { + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number | string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface SparkLine extends Nvd3Element { + animate(): boolean; + animate(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any, i?: number) => number; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any, i?: number) => number): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any, i?: number) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any, i?: number) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface SparkLinePlus extends SparkLine { + sparkline: SparkLine; + + alignValue(): boolean; + alignValue(value: boolean): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value: string): this; + rightAlignValue(): boolean; + rightAlignValue(value: boolean): this; + /*Shows the last value in the sparkline to the right of the line.*/ + showLastValue(): boolean; + /*Shows the last value in the sparkline to the right of the line.*/ + showLastValue(value: boolean): this; + xTickFormat(format: (d: any) => string): this; + xTickFormat(format: string): this; + xTickFormat(format: (d: any, i: any) => string) : this; + yTickFormat(format: (d: any) => string): this; + yTickFormat(format: string): this; + yTickFormat(format: (d: any, i: any) => string) :this; + } + + interface StackedArea extends Scatter { + scatter: Scatter; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + offset(offset: (data: Array<[number, number]>) => number[]): this; + order(): string; + order(value: string): this; + style(offset: 'stack'): this; + style(offset: 'stream'): this; + style(offset: 'stream-center'): this; + style(offset: 'expand'): this; + style(offset: 'stack_percent'): this; + style(offset: string): this; + } + + interface Sunburst extends Nvd3Element { + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(): string; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(value: 'size'): this; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(value: 'count'): this; + /*For sunburst only: specifies the mode of drawing the sunburst segments. Can be 'size' or 'count'. 'size' draws the segments according to the 'size' attribute of the leaf nodes, 'count' draws according to the amount of siblings a node has.*/ + mode(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface Tooltip { + + /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ + chartContainer(el: HTMLElement): this + /*For tooltip: Parent dom element of the SVG that holds the chart. This will make the tooltip dom be created inside this container instead of on the document body.*/ + chartContainer(): HTMLElement + /*Attaches additional CSS classes to the tooltip DIV that is created.*/ + classes(el: string): this + /*Attaches additional CSS classes to the tooltip DIV that is created.*/ + classes(): string + /*Function that generates the tooltip content html.*/ + contentGenerator(): (d: any) => string; + /*Function that generates the tooltip content html.*/ + contentGenerator(func: (d: any) => string): this; + data(): any; + data(value: any): this; + distance(): number; + distance(value: number): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*For tooltip: completely enables or disabled the tooltip*/ + enabled(): boolean; + /*For tooltip: completely enables or disabled the tooltip*/ + enabled(value: boolean): this; + /*For tooltip: If not null, this fixes the top position of the tooltip.*/ + fixedTop(): number; + /*For tooltip: If not null, this fixes the top position of the tooltip.*/ + fixedTop(value: number): this; + /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ + gravity(): string; + /*Can be 'n','s','e','w'. Determines how tooltip is positioned*/ + gravity(value: string): this; + /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ + headerEnabled(): boolean; + /*For tooltip: show the x axis value in the tooltip or not (not valid for pie charts for instance)*/ + headerEnabled(value: boolean): this; + /*For tooltip: formats the x axis value in the tooltip*/ + headerFormatter(func: (d: any) => string): this; + /*For tooltip: formats the x axis value in the tooltip*/ + headerFormatter(): (d: any) => string; + /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ + hidden(): boolean; + /*For tooltip: show or hide the tooltip by setting this to true or false. Tooltips used to be created and destroyed, but now we re-used the element and set opacity to 1 or 0.*/ + hidden(value: boolean): this; + /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ + hideDelay(): number; + /*Delay in ms before the tooltip hides itself after a mouseout event. A new mouseover event cancels the hide if within this timeout period.*/ + hideDelay(value: number): this; + /**/ + id(): any; + keyFormatter(): (d: any, i: number) => string; + keyFormatter(func: (d: any, i: number) => string): this; + offset(): Offset; + offset(value: Offset): this; + /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ + position(): Offset; + /*sets the top/left positioning for the tooltip. Should be given an object with 'left' and/or 'top' attributes. You can override just one, just like the 'margin' option on charts*/ + position(value: Offset): this; + /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ + snapDistance(): number; + /*Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect)*/ + snapDistance(value: number): this; + /*returns the dom element of the tooltip.*/ + tooltipElem(): HTMLElement; + /*formats the y axis value(s) in the tooltip*/ + valueFormatter(): (d: any) => string; + /*formats the y axis value(s) in the tooltip*/ + valueFormatter(func: (d: any) => string): this; + } + +//#endregion + +//#region Charts + interface BoxPlotChart extends Chart { + boxplot: BoxPlot; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + maxBoxWidth(): number; + maxBoxWidth(value: number): this; + noData(): string; + noData(value: string): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(): boolean; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface BulletChart extends Chart{ + bullet: Bullet; + tooltip: Tooltip; + + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + markers(): (d: any) => any //todo; + markers(func: (d: any) => any): this //todo; + measures(): (d: any) => any //todo; + measures(func: (d: any) => any): this //todo; + noData(): string; + noData(value: string): this; + orient(): string; + orient(orientation: string): this; + ranges(): (d: any) => any //todo; + ranges(func: (d: any) => any): this //todo; + tickFormat(): (d: any) => string; + tickFormat(format: (d: any) => string): this; + tickFormat(format: string): this; + tickFormat(format: (d: any, i: any) => string): this; + ticks(): any[]; + ticks(...args: any[]): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface CandlestickBarChart extends Chart { + bars: CandlestickBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d: any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): any; + id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not*/ + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface CumulativeLineChart extends LineChart { + controls: Legend; + average(func: (d: any) => number): this; + average(): (d: any) => number; + noErrorCheck(value: boolean): this; + noErrorCheck(): boolean; + } + + interface DiscreteBarChart extends Chart { + discretebar: DiscreteBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; + id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + rectClass(): string; + rectClass(value: string): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(): boolean; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface HistoricalBarChart extends Chart { + bars: HistoricalBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(): number[]; + /* List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceX(value: number[]): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface LineChart extends Chart { + lines: Line; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + legend: Legend; + tooltip: Tooltip; + + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface LinePlusBarChart extends Chart { + legend: Legend; + lines: Line; + lines2: Line; + bars: HistoricalBar; + bars2: HistoricalBar; + xAxis: Nvd3Axis; + x2Axis: Nvd3Axis; + y1Axis: Nvd3Axis; + y2Axis: Nvd3Axis; + y3Axis: Nvd3Axis; + y4Axis: Nvd3Axis; + tooltip: Tooltip; + + brushExtent(): [number, number] | [[number, number], [number, number]]; + brushExtent(value: [number, number] | [[number, number], [number, number]]) : this; + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + focusEnable(): boolean; + focusEnable(value: boolean): this; + focusHeight(): number; + focusHeight(value: number): this; + focusShowAxisX(): boolean; + focusShowAxisX(value: boolean): this; + focusShowAxisY(): boolean; + focusShowAxisY(value: boolean): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ + legendLeftAxisHint(): string; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any series on the left axis.*/ + legendLeftAxisHint(value: string): this + /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ + legendRightAxisHint(): string; + /*The extra text after the label in the legend that tells what axis the series belongs to, for any seris on the right axis.*/ + legendRightAxisHint(value: string): this + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface LineWithFocusChart extends Chart { + legend: Legend; + lines: Line; + lines2: Line; + xAxis: Nvd3Axis; + x2Axis: Nvd3Axis; + yAxis: Nvd3Axis; + y2Axis: Nvd3Axis; + tooltip: Tooltip; + + brushExtent(): [number, number] | [[number, number], [number, number]]; + brushExtent(value: [number, number] | [[number, number], [number, number]]): this; + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(): (d: any, i: number) => boolean; + /*A provided function that allows a line to be non-continuous when not defined.*/ + defined(func: (d: any, i: number) => boolean): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + focusHeight(): number; + focusHeight(value: number): this; + focusMargin(): Margin; + focusMargin(value: Margin): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + xTickFormat(): (d: any) => string; + xTickFormat(format: (t: any) => string): this; + xTickFormat(format: string): this; + xTickFormat(format: (d: any, i: any) => string): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + yTickFormat(): (d: any) => string; + yTickFormat(format: (t: any) => string): this; + yTickFormat(format: string): this; + yTickFormat(format: (d: any, i: any) => string): this; + } + + interface MultiBarChart extends Chart { + multibar: MultiBar; + legend: Legend; + controls: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(): any; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(value: any): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*.*/ + hideable(): boolean; + /**/ + hideable(value: boolean): this; + id(): any; +id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + reduceXTicks(): boolean; + reduceXTicks(value: boolean): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(): number; + /*Rotates the X axis labels by the specified degree.*/ + rotateLabels(value: number): this; + /*Whether to show extra controls or not. Extra controls include things like making mulitBar charts stacked or side by side.*/ + showControls(): boolean; + /*Whether to show extra controls or not. Extra controls include things like making mulitBar charts stacked or side by side.*/ + showControls(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'silhouette'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'wiggle'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'expand'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: 'zero'): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: string): this; + /* options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function*/ + stackOffset(offset: (data: Array<[number, number]>) => number[]): this; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(): boolean; + /*Makes the X labels stagger at different distances from the axis so they're less likely to overlap.*/ + staggerLabels(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface MultiBarHorizontalChart extends Chart { + multibar: MultiBar; + legend: Legend; + controls: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(value: string[]): this; + /*this option lets you specific a color for each bar group to have the same color but differentiated by shading.*/ + barColor(func: (d: any, i: number) => string): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(): any; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(value: any): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /**/ + disabled(): boolean[]; + /**/ + disabled(value: boolean[]): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(): number[]; + /* List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the Y domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option.*/ + forceY(value: number[]): this; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(): number; + /*The padding between bar groups, this is passed as the padding attribute of rangeBands*/ + groupSpacing(value: number): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + showControls(): boolean; + /*Whether to show extra controls or not. Extra controls include things like making mulitBar charts stacked or side by side.*/ + showControls(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(): boolean; + /*Prints the Y values on the top of the bars. Only recommended to use if there aren't many bars.*/ + showValues(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*.*/ + stacked(): boolean; + /**/ + stacked(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*.*/ + valuePadding(): number; + /**/ + valuePadding(value: number): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /**/ + yErr(): (d: any, i: number) => number | number[]; + /**/ + yErr(func: (d: any, i: number) => number | number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface MultiChart extends Chart { + lines1: Line; + lines2: Line; + bars1: MultiBar; + bars2: MultiBar; + scatters1: Scatter; + scatters2: Scatter; + stack1: StackedArea; + stack2: StackedArea; + xAxis: Nvd3Axis; + yAxis1: Nvd3Axis; + yAxis2: Nvd3Axis; + tooltip: Tooltip; + + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(): string; + /*controls the line interpolation between points, many options exist, see the D3 reference:*/ + interpolate(value: string): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(): (d: any) => boolean; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(value: boolean): this; + /*Function to define if a line is a normal line or if it fills in the area. Notice the default gets the value from the line's definition in data. If a non-function is given, it the value is used for all lines.*/ + isArea(func: (d: any) => boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* */ + yDomain1(): number[]; + /* */ + yDomain1(value: number[]): this; + /* */ + yDomain2(): number[]; + /* */ + yDomain2(value: number[]): this; + } + + interface OhlcBarChart extends Chart { + bars: OhlcBar; + legend: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + close(): (d: any) => number; + close(func: (d: any) => number): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the yDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + high(): (d: any) => number; + high(func: (d: any) => number): this; + id(): any; + id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + low(): (d: any) => number; + low(func: (d: any) => number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + open(): (d: any) => number; + open(func: (d: any) => number): this; + padData(): boolean; + padData(value: boolean): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /*Whether to display the legend or not*/ + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + } + + interface ParallelCoordinatesChart extends Chart { + parallelCoordinates: ParallelCoordinates; + legend: Legend; + tooltip: Tooltip; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + dimensionData(): any + dimensionData(d:any) : this + /*D3 format for each x axis*/ + dimensionFormats(): string[]; + /*D3 format for each x axis*/ + dimensionFormats(value: string[]): this; + /*Name of each dimension, used for each axis.*/ + dimensionNames(): string[]; + /*Name of each dimension, used for each axis.*/ + dimensionNames(value: string[]): this; + /*Deprecated. Use dimensionsNames instead. */ + dimensions(): any; + /*Deprecated. Use dimensionsNames instead. .*/ + dimensions(value: any): this; + /**/ + displayBrush(): boolean; + /**/ + displayBrush(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(): number; + /*Specifies each line tension. Values between 0 and 1.*/ + lineTension(value: number): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /**/ + noData(): string; + /**/ + noData(value: string): this; + /**/ + showLegend(): boolean; + /**/ + showLegend(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + } + + interface PieChart extends Chart { + legend: Legend; + pie: Pie; + tooltip: Tooltip; + + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(): ArcsRadius[]; + /*Specifies each slice size, by an inner and a outer radius. Values between 0 and 1*/ + arcsRadius(value: ArcsRadius[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(): number; + /*D3 3.4+, For donut charts only, the corner radius of the slices. Typically used with padAngle.*/ + cornerRadius(value: number): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Whether to make a pie graph a donut graph or not.*/ + donut(): boolean; + /*Whether to make a pie graph a donut graph or not.*/ + donut(value: boolean): this; + /**/ + donutLabelsOutside(): boolean; + /**/ + donutLabelsOutside(value: boolean): this; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(): number; + /*Percent of pie radius to cut out of the middle to make the donut. It is multiplied by the outer radius to calculate the inner radius, thus it should be between 0 and 1.*/ + donutRatio(value: number): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(): (d: any) => number; + /*Function used to manage the ending angle of the pie/donut chart*/ + endAngle(func: (d: any) => number): this; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(): boolean; + /*For pie/donut charts, whether to increase slice radius on hover or not*/ + growOnHover(value: boolean): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + id(): any; +id(value: number|string): this; + /**/ + labelFormat(): string; + /**/ + labelFormat(value: string): this; + /**/ + labelFormat(format: (d: any) => string): this; + /**/ + labelSunbeamLayout(): boolean; + /**/ + labelSunbeamLayout(value: boolean): this; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(): number; + /*Pie/donut charts: The slice threshold size to not display the label because it woudl be too small of a space*/ + labelThreshold(value: number): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(): string; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'key'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'value'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: 'percent'): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(value: string): this; + /*pie/donut charts only: what kind of data to display for the slice labels. Options are key, value, or percent. */ + labelType(func: (d: any, i: number, values: any) => string): this; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(): boolean; + /*Whether pie/donut chart labels should be outside the slices instead of inside them*/ + labelsOutside(value: boolean): this; + /*Position of the legend (top or right). */ + legendPosition(): string; + /*Position of the legend (top or right). */ + legendPosition(value: 'top'): this; + /*Position of the legend (top or right). */ + legendPosition(value: 'right'): this; + /*Position of the legend (top or right). */ + legendPosition(value: string): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value : string): this; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(): number; + /*D3 3.4+, For donut charts only, the percent of the chart that should be spacing between slices.*/ + padAngle(value: number): this; + /**/ + pieLabelsOutside(): boolean; + /**/ + pieLabelsOutside(value: boolean): this; + /*Show pie/donut chart labels for each slice*/ + showLabels(): boolean; + /*Show pie/donut chart labels for each slice*/ + showLabels(value: boolean): this; + /*Whether to display the legend or not*/ + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(): (d: any) => number; + /*Function used to manage the starting angle of the pie/donut chart*/ + startAngle(func: (d: any) => number): this; + /*Text to include within the middle of a donut chart*/ + title(): string; + /*Text to include within the middle of a donut chart*/ + title(value: string): this; + /*Vertical offset for the donut chart title*/ + titleOffset(): number; + /*Vertical offset for the donut chart title*/ + titleOffset(value: number): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(): string; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(value: string): this; + /*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/ + valueFormat(format: (d: any) => string): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /*Proxy function to return the Y value so adjustments can be made if needed.For pie/ donut chart this returns the value for the slice.*/ + y(): (d: any) => number; + /*Proxy function to return the Y value so adjustments can be made if needed. For pie/donut chart this returns the value for the slice.*/ + y(func: (d: any) => number): this; + } + + interface ScatterChart extends Chart { + scatter: Scatter; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + legend: Legend; + tooltip: Tooltip; + distX: Distribution; + distY: Distribution; + + clearHighlights(): this; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(): boolean; + /*If true, masks lines within the X and Y scales using a clip-path*/ + clipEdge(value: boolean): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(func: (d: any) => number): this; + /*When useVoronoi and clipVoronoi are true, you can control the clip radius with this option. Essentially this lets you set how far away from the actual point you can put the mouse for it to select the point.*/ + clipRadius(value: number): this; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(): boolean; + /*When useVoronoi is on, this masks each voronoi section with a circle to limit selection to smaller area.*/ + clipVoronoi(value: boolean): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(value: string[]): this; + /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ + color(func: (d: any, i: number) => string): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(): number[]; + /*List of numbers to Force into the point scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forcePoint(value: number[]): this; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(): number[]; + /*List of numbers to Force into the X scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceX(value: number[]): this; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(): number[]; + /*List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). This ensures the numbers are in the X domain but doesn't override the whole domain. This option only applies if you have not overridden the whole domain with the xDomain option*/ + forceY(value: number[]): this; + /*The height the graph or component created inside the SVG should be made*/ + height(): number; + /*The height the graph or component created inside the SVG should be made.*/ + height(value: number): this; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => boolean): this; + id(): any; +id(value: number|string): this; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(): boolean; + /*A master flag for turning chart interaction on and off. This overrides all tooltip, voronoi, and guideline options.*/ + interactive(value: boolean): this; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(): Margin; + /*Object containing the margins for the chart or component. You can specify only certain margins in the object to change just those parts.*/ + margin(value: Margin): this; + noData(): string; + noData(value: string): this; + /**/ + padData(): boolean; + /**/ + padData(value: boolean): this; + /**/ + padDataOuter(): number; + /**/ + padDataOuter(value: number): this; + /* Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(): (d: any) => boolean; + /*Function used to determine if scatter points are active or not, returns false to denote them as inactive and true for active.*/ + pointActive(func: (d: any) => boolean): this; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointxDomain(): number[]; + /* Defines the whole point scale's domain. Using this will disable calculating the domain based on the data.*/ + pointDomain(value: number[]): this; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(): number[]; + /* Override the point scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + pointRange(value: number[]): this; + /* Override the default scale type for the point axis*/ + pointScale(): any; + /* Override the default scale type for the point axis*/ + pointScale(value: any): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(): (d: any) => number; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(func: (d: any) => number): this; + /* Specifies the size of the points in a scatter. Scatter is also used to make the hover points on lines.*/ + pointSize(value: number): this; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + /**/ + showDistX(): boolean; + /**/ + showDistX(value: boolean): this; + /**/ + showDistY(): boolean; + /**/ + showDistY(value: boolean): this; + /*Whether to display the legend or not.*/ + showLegend(): boolean; + /*Whether to display the legend or not.*/ + showLegend(value: boolean): this; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(): boolean; + /*Displays the voronoi areas on the chart. This is mostly helpful when debugging issues.*/ + showVoronoi(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /**/ + tooltipXContent(): (d: any) => string; + /**/ + tooltipXContent(func: (d: any) => string): this; + /**/ + tooltipYContent(): (d: any) => string; + /**/ + tooltipYContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(): boolean; + /*Use voronoi diagram to select nearest point to display tooltip instead of requiring a hover over the specific point itself. Setting this to false will also set clipVoronoi to false.*/ + useVoronoi(value: boolean): this; + /* The width the graph or component created inside the SVG should be made*/ + width(): number; + /*The width the graph or component created inside the SVG should be made.*/ + width(value: number): this; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(): (d: any) => any; + /* Proxy function to return the X value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + x(func: (d: any) => any): this; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(): number[]; + /* Defines the whole X scale's domain. Using this will disable calculating the domain based on the data.*/ + xDomain(value: number[]): this; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(): number[]; + /* Override the X scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + xRange(value: number[]): this; + /* Override the default scale type for the X axis*/ + xScale(): any; + /* Override the default scale type for the X axis*/ + xScale(value: any): this; + y(): (d: any) => number; + /* Proxy function to return the y value so adjustments can be made if needed. For pie/donut chart this returns the key for the slice.*/ + y(func: (d: any) => number): this; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(): number[]; + /* Defines the whole y scale's domain. Using this will disable calculating the domain based on the data.*/ + yDomain(value: number[]): this; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(): number[]; + /* Override the y scale's range. Using this will disable calculating the range based on the data and chart width/height.*/ + yRange(value: number[]): this; + /* Override the default scale type for the y axis*/ + yScale(): any; + /* Override the default scale type for the y axis*/ + yScale(value: any): this; + + } + + interface StackedAreaChart extends StackedArea, Chart { + stacked: StackedArea; + legend: Legend; + controls: Legend; + xAxis: Nvd3Axis; + yAxis: Nvd3Axis; + tooltip: Tooltip; + + controlLabels(): any; + /*Object that defines the labels for control items in the graph. For instance, in the stackedAreaChart, there are controls for making it stacked, expanded, or stream. For stacked bar charts, there is stacked and grouped.*/ + controlLabels(value: any): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value: string): this; + rightAlignYAxis(): boolean; + /*When only one Y axis is used, this puts the Y axis on the right side instead of the left.*/ + rightAlignYAxis(value: boolean): this; + showLegend(): boolean; + /*Whether to display the legend or not*/ + showLegend(value: boolean): this; + /*Display or hide the X axis*/ + showXAxis(): boolean; + /*Display or hide the X axis*/ + showXAxis(value: boolean): this; + /*Display or hide the Y axis*/ + showYAxis(): boolean; + /*Display or hide the Y axis*/ + showYAxis(value: boolean): this; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(): (d: any) => string; + /*Deprecated. Use chart.tooltip.contentGenerator or chart.interactiveGuideline.tooltip.contentGenerator to control tooltip content.*/ + tooltipContent(func: (d: any) => string): this; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(): boolean; + /*Deprecated. Use chart.tooltip.enabled or chart.interactive to control if tooltips are enabled or not.*/ + tooltips(value: boolean): this; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(): boolean; + /*Sets the chart to use a guideline and floating tooltip instead of requiring the user to hover over specific hotspots. Turning this on will set the 'interactive' and 'useVoronoi' options to false to avoid conflicting.*/ + useInteractiveGuideline(value: boolean): this; + } + + interface SunburstChart extends Sunburst, Chart { + sunburst: Sunburst; + tooltip: Tooltip; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(): number; + /*Duration in ms to take when updating chart. For things like bar charts, each bar can animate by itself but the total time taken should be this value.*/ + duration(value: number): this; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(): any; + /*No longer used.Use chart.dispatch.changeState(...) instead*/ + defaultState(value: any): this; + /*Message to display if no data is provided*/ + noData(): string; + /*Message to display if no data is provided*/ + noData(value: string): this; + } + +//#endregion + + interface Models{ + boxPlotChart(): BoxPlotChart; + bullet(): Bullet; + bulletChart(): BulletChart; + candlestickBar(): CandlestickBar; + candlestickBarChart(): CandlestickBarChart; + cumulativeLineChart(): CumulativeLineChart; + discreteBar(): DiscreteBar; + discreteBarChart(): DiscreteBarChart; + distribution(): Distribution; + historicalBar(): HistoricalBar; + historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; + ohlcBar(): OhlcBar; + ohlcBarChart(): OhlcBarChart; + legend(): Legend; + line(): Line; + lineChart(): LineChart; + linePlusBarChart(): LinePlusBarChart; + lineWithFocusChart(): LineWithFocusChart; + multiBarChart(): MultiBarChart; + multiBarHorizontalChart(): MultiBarHorizontalChart; + multiChart(): MultiChart; + parallelCoordinates(): ParallelCoordinates; + parallelCoordinatesChart(): ParallelCoordinatesChart; + pie(): Pie; + pieChart(): PieChart; + scatter(): Scatter; + scatterChart(): ScatterChart; + sparkline(): SparkLine; + sparklinePlus(): SparkLinePlus; + stackedArea(): StackedArea; + stackedAreaChart(): StackedAreaChart; + sunburst(): Sunburst; + sunburstChart(): SunburstChart; + tooltip(): Tooltip; + } + + interface Nvd3Static{ + /*set to false in production*/ + dev: boolean + /*stores all the ready to use charts*/ + charts: any + models: Models; + tooltip: Nvd3TooltipStatic; + utils: Utils; + + /*stores some statistics and potential error messages*/ + logs: any; + + addGraph(factory: ChartFactory): void; + addGraph(generate: () => TChart, callBack?: (chart: TChart) => void): void; + + + log(topic: string, value?: string): string //returns last argument + log(arg: any[]): any //returns last argument + } +} +declare var nv : nv.Nvd3Static; \ No newline at end of file diff --git a/oidc-token-manager/oidc-token-manager-tests.ts b/oidc-token-manager/oidc-token-manager-tests.ts new file mode 100644 index 000000000..71261cce1 --- /dev/null +++ b/oidc-token-manager/oidc-token-manager-tests.ts @@ -0,0 +1,47 @@ +/// + +var config = { + client_id: "implicitclient", + redirect_uri: window.location.protocol + "//" + window.location.host + "/callback.html", + post_logout_redirect_uri: window.location.protocol + "//" + window.location.host + "/index.html", + response_type: "id_token token", + scope: "openid profile email read write", + authority: "https://localhost:44333/core", + silent_redirect_uri: window.location.protocol + "//" + window.location.host + "/frame.html", + popup_redirect_uri: window.location.protocol + "//" + window.location.host + "/popup.html", + silent_renew: true +}; +var mgr = new OidcTokenManager(config); +if (!mgr.expired) { + console.log("Token loaded, expires in: ", mgr.expires_in); + console.log("profile", mgr.profile); + console.log("access_token", !!mgr.access_token); +} +else { + console.log("No token loaded"); +} +mgr.addOnTokenObtained(function () { + console.log("token obtained, scopes: ", mgr.scopes); +}); +mgr.addOnTokenRemoved(function () { + console.log("token removed"); +}); +mgr.addOnTokenExpiring(function () { + console.log("token is about to expire"); + //mgr.renewTokenSilent(); +}); +mgr.addOnTokenExpired(function () { + console.log("token expired"); +}); + mgr.redirectForToken(); + mgr.openPopupForTokenAsync().then(function () { + console.log('popup success'); + }, function (err) { + console.log('popup error: ', err); + }); + mgr.removeToken(); + mgr.redirectForLogout(); +function toggleForget() { +} +mgr.addOnTokenObtained(toggleForget); +mgr.addOnTokenRemoved(toggleForget); \ No newline at end of file diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts new file mode 100644 index 000000000..f8309686b --- /dev/null +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -0,0 +1,120 @@ +// Type definitions for oidc-token-manager +// Project: https://github.com/IdentityModel/oidc-token-manager +// Definitions by: Sławomir Rosiek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module Oidc { + class DefaultHttpRequest { + getJSON(url: string, config: any): DefaultPromise; + } + + class DefaultPromise { + constructor(promise: any); + then(successCallback: (value?: any) => void, errorCallback: (reason?: any) => void): DefaultPromise; + catch(errorCallback: () => void): DefaultPromise; + } + + class DefaultPromiseFactory { + resolve(value: any): DefaultPromise; + reject(reason: any): DefaultPromise; + create(callback: any): DefaultPromise; + } + + interface OidcClientSettings { + request_state_key?: string; + request_state_store?: any; + load_user_profile?: boolean; + filter_protocol_claims?: boolean; + authority?: string; + response_type?: string; + } + + interface OidcClient_Static { + new (settings: OidcClientSettings): OidcTokenManager; + } + + interface OidcClient { + isOidc: boolean; + isOAuth: boolean; + + loadMetadataAsync(): DefaultPromise; + loadX509SigningKeyAsync(): DefaultPromise; + loadUserProfile(access_token: string): DefaultPromise; + loadAuthorizationEndpoint(): void; + createTokenRequestAsync(): DefaultPromise; + createLogoutRequestAsync(id_token_hint: string): DefaultPromise; + validateIdTokenAsync(id_token: string, nonce: string, access_token: string): DefaultPromise; + validateAccessTokenAsync(id_token_contents: string, access_token: string): DefaultPromise; + validateIdTokenAndAccessTokenAsync(id_token: string, nonce: string, access_token: string): DefaultPromise; + processResponseAsync(queryString: string): DefaultPromise; + } + + interface OidcTokenManagerSettings { + persist?: boolean; + store?: any; + persistKey?: string; + client_id?: string; + redirect_uri?: string; + post_logout_redirect_uri?: string; + response_type?: string; + scope?: string; + authority?: string; + popup_redirect_uri?: string; + silent_redirect_uri?: string; + silent_renew?: boolean; + } + + interface PopupSettings { + features?: string; + target?: string; + } + + interface OidcTokenManager_Static { + new (settings?: OidcTokenManagerSettings): OidcTokenManager; + setPromiseFactory(promiseFactory: DefaultPromiseFactory): void; + setHttpRequest(httpRequest: DefaultHttpRequest): void; + } + + interface OidcToken { + profile: string; + id_token: string; + access_token: string; + expires_at: number; + scope: string; + scopes: string[]; + session_state: any; + expired: boolean; + expires_in: number; + toJSON(): string; + } + + interface OidcTokenManager { + profile: any; + id_token: string; + access_token: string; + expired: boolean; + expires_in: number; + expires_at: number; + scope: string; + scopes: string[]; + session_state: any; + + saveToken(token: OidcToken): void; + addOnTokenRemoved(cb: () => void): void; + addOnTokenObtained(cb: () => void): void; + addOnTokenExpiring(cb: () => void): void; + addOnTokenExpired(cb: () => void): void; + addOnSilentTokenRenewFailed(cb: () => void): void; + removeToken(): void; + redirectForToken(): void; + redirectForLogout(): void; + processTokenCallbackAsync(queryString?: string): DefaultPromise; + renewTokenSilentAsync(): DefaultPromise; + processTokenCallbackSilent(hash?: string): void; + openPopupForTokenAsync(popupSettings?: PopupSettings): DefaultPromise; + processTokenPopup(hash?: string): void; + } +} + +declare var OidcTokenManager: Oidc.OidcTokenManager_Static; +declare var OidcClient: Oidc.OidcClient_Static; \ No newline at end of file diff --git a/oracledb/oracledb-tests.ts b/oracledb/oracledb-tests.ts new file mode 100644 index 000000000..39b77b5c4 --- /dev/null +++ b/oracledb/oracledb-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +import * as OracleDB from 'oracledb'; + +OracleDB.getConnection( + { + user: "hr", + password: "welcome", + connectString: "localhost/XE" + }, + function(err, connection) { + if (err) { + console.error(err.message); return; + } + connection.execute( + "SELECT department_id, department_name " + + "FROM departments " + + "WHERE manager_id < :id", + [110], // bind value for :id + function(err, result) { + if (err) { + console.error(err.message); return; + } + console.log(result.rows); + } + ); + } +); diff --git a/oracledb/oracledb.d.ts b/oracledb/oracledb.d.ts new file mode 100644 index 000000000..d990a36f9 --- /dev/null +++ b/oracledb/oracledb.d.ts @@ -0,0 +1,308 @@ +// Type definitions for oracledb v1.5.0 +// Project: https://github.com/oracle/node-oracledb +// Definitions by: Richard Natal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'oracledb' { + import * as stream from "stream"; + + export interface ILob { + chunkSize: number; + length: number; + pieceSize: number; + offset?: number; + type: string; + /** + * Release method on ILob class. + * @remarks The cleanup() called by Release() only frees OCI error handle and Lob + * locator. These calls acquire mutex on OCI environment handle very briefly. + */ + release?(): void; + /** + * Read method on ILob class. + * @param {(err : any, chunk: string | Buffer) => void} callback Callback to recive the data from lob. + * @remarks CLobs send strings while BLobs send Buffer object. + */ + read?(callback: (err: any, chunk: string | Buffer) => void): void; + /** + * Read method on ILob class. + * @param {Buffer} data Data write into Lob. + * @param {(err: any) => void} callback Callback executed when writ is finished or when some error occured. + * @remarks CLobs send strings while BLobs send Buffer object. + */ + write?(data: Buffer, callback: (err: any) => void): void; + } + + export interface Lob extends stream.Duplex { + iLob: ILob; + chunkSize: number; + length: number; + pieceSize: number; + type: string; + + /** + * Do not call this... used internally by node-oracledb + */ + constructor(iLob: ILob, opts: stream.DuplexOptions): Lob; + constructor(iLob: ILob): Lob; + + /** + * Closes the current LOB. + * @param {(err: any) => void} callback? When passed, is called after the release. + * @returns void + */ + close(callback: (err: any) => void): void; + close(): void; + } + + export interface IConnectionAttributes { + user?: string; + password?: string; + connectString: string; + stmtCacheSize?: number; + externalAuth?: boolean; + } + + export interface IPoolAttributes extends IConnectionAttributes { + poolMax?: number; + poolMin?: number; + poolIncrement?: number; + poolTimeout?: number; + } + + export interface IExecuteOptions { + /** Maximum number of rows that will be retrieved. Used when resultSet is false. */ + maxRows?: number; + /** Number of rows to be fetched in advance. */ + prefetchRows?: number; + /** Result format - ARRAY o OBJECT */ + outFormat?: number; + /** Should use ResultSet or not. */ + resultSet?: boolean; + /** Transaction should auto commit after each statement? */ + autoCommit?: boolean; + } + + export interface IExecuteReturn { + /** Number o rows affected by the statement (used for inserts / updates)*/ + rowsAffected?: number; + /** When the statement has out parameters, it comes here. */ + outBinds?: Array | Object; + /** Metadata information - just columns names for now. */ + metaData?: Array; + /** When not using ResultSet, query results comes here. */ + rows?: Array> | Array; + /** When using ResultSet, query results comes here. */ + resultSet?: IResultSet; + } + + export interface IMetaData { + /** Column name */ + columnName: string; + } + + export interface IResultSet { + /** Metadata information - just columns names for now. */ + metaData?: Array; + /** + * Closes the ResultSet. + * @param {(err:any)=>void} callback Callback called on finish or when some error occurs + * @returns void + * @remarks After using a resultSet, it must be closed to free the resources used by the driver. + */ + close(callback: (err: any) => void): void; + /** + * Fetch one row from ResultSet. + * @param {(err:any,row:Array|Object)=>void} callback Callback called when the row is available or when some error occurs. + * @returns void + */ + getRow(callback: (err: any, row: Array | Object) => void): void; + /** + * Fetch some rows from ResultSet. + * @param {number} rowCount Number of rows to be fetched. + * @param {(err:any,rows:Array>|Array)=>void} callback Callback called when the rows are available, or when some error occurs. + * @returns void + * @remarks When the number of rows passed to the callback is less than the rowCount, no more rows are available to be fetched. + */ + getRows(rowCount: number, callback: (err: any, rows: Array> | Array) => void): void; + } + + export interface IConnection { + /** Statement cache size in bytes (read-only)*/ + stmtCacheSize: number; + /** Client id (to be sent to database) (write-only)*/ + clientId: string; + /** Module (write-only) */ + module: string; + /** Action */ + action: string; + /** Oracle server version */ + oracleServerVersion: number; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {Object|Array} Binds Binds Object/Array + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + binds: Object | Array, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {Object|Array} Binds Binds Object/Array + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + binds: Object | Array, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Release method on Connection class. + * @param {(err: any) => void} callback Callback function to be called when the connection has been released. + */ + release(callback: (err: any) => void): void; + + /** + * Send a commit requisition to the database. + * @param {(err: any) => void} callback Callback on commit done. + */ + commit(callback: (err: any) => void): void; + + /** + * Send a rollback requisition to database. + * @param {(err: any) => void} callback Callback on rollback done. + */ + rollback(callback: (err: any) => void): void; + + /** + * Send a break to the database. + * @param {(err: any) => void} callback Callback on break done. + */ + break(callback: (err: any) => void): void; + } + + export interface IConnectionPool { + poolMax: number; + poolMin: number; + poolIncrement: number; + poolTimeout: number; + connectionsOpen: number; + connectionsInUse: number; + stmtCacheSize: number; + /** + * Finalizes the connection pool. + * @param {(err:any)=>void} callback Callback called when the pool is terminated or when some error occurs + * @returns void + */ + terminate(callback: (err: any) => void): void; + /** + * Retrieve a connection from the pool. + * @param {(err:any,connection:IConnection)=>void} callback Callback called when the connection is available or when some error occurs. + * @returns void + * @see {@link https://jsao.io/2015/03/making-a-wrapper-module-for-the-node-js-driver-for-oracle-database/} + * @see {@link https://github.com/OraOpenSource/orawrap} + */ + getConnection(callback: (err: any, connection: IConnection) => void): void; + } + + export const DEFAULT: number; + /** Data type */ + export const STRING: number; + /** Data type */ + export const NUMBER: number; + /** Data type */ + export const DATE: number; + /** Data type */ + export const CURSOR: number; + /** Data type */ + export const BUFFER: number; + /** Data type */ + export const CLOB: number; + /** Data type */ + export const BLOB: number; + /** Bind direction */ + export const BIND_IN: number; + /** Bind direction */ + export const BIND_INOUT: number; + /** Bind direction */ + export const BIND_OUT: number; + /** outFormat */ + export const ARRAY: number; + /** outFormat */ + export const OBJECT: number; + + /** + * Do not use this method - used internally by node-oracledb. + */ + export function newLob(iLob: ILob): Lob; + + /** + * Creates a connection with the database. + * @param {IConnectionAttributes} connectionAttributes Parameters to stablish the connection. + * @param {(err:any,connection:IConnection)=>void} callback Callback to run when the connection gets stablished or when some error occurs. + * @returns void + */ + export function getConnection(connectionAttributes: IConnectionAttributes, callback: (err: any, connection: IConnection) => void): void; + + /** + * Creates a database managed connection pool. + * @param {IPoolAttributes} poolAttributes Parameters to stablish the connection pool. + * @param {(err:any,connection:IConnectionPool)=>void} callback Callback to run when the connection pool gets created or when some error occurs. + * @returns void + */ + export function createPool(poolAttributes: IPoolAttributes, callback: (err: any, connection: IConnectionPool) => void): void; + + /** Default maximum connections in created pools */ + export var poolMax: number; + /** Default minimum connections in created pools */ + export var poolMin: number; + /** Default number of connections to increment when available connections reach 0 in created pools. poolMax will be respected.*/ + export var poolIncrement: number; + /** Default timeout for unused connections in pool to be released. poolMin will be respected.*/ + export var poolTimeout: number; + /** Default size of statements cache. Used to speed up creating queries.*/ + export var stmtCacheSize: number; + /** Default number of rows that the driver will fetch in each query.*/ + export var prefetchRows: number; + /** Default transaction behaviour of auto commit for each statement. */ + export var autoCommit: boolean; + /** Default maximum number of rows to be fetched in statements not using ResultSets */ + export var maxRows: number; + /** Default format for returning rows. When ARRAY, it will return Array>. When OBJECT, it will return Array. */ + export var outFormat: number; + /** node-oracledb driver version. */ + export var version: number; + export var connectionClass: string; + /** Default authentication/authorization method. When true, the SO trusted user will be used. */ + export var externalAuth: boolean; + export var fetchAsString: any; + /** Default size in bytes that the driver will fetch from LOBs in advance. */ + export var lobPrefetchSize: number; + /** Version of OCI that is used. */ + export var oracleClientVersion: number; +} diff --git a/osmtogeojson/osmtogeojson-tests.ts b/osmtogeojson/osmtogeojson-tests.ts index a4debe4c1..f7d52c075 100644 --- a/osmtogeojson/osmtogeojson-tests.ts +++ b/osmtogeojson/osmtogeojson-tests.ts @@ -33,7 +33,7 @@ osmtogeojson(xml, { uninterestingTags: {foo:true} }); -let json: OsmJSON.Root = { +let json: OsmJSON.OsmJSONObject = { elements: [ { type: "node", diff --git a/osmtogeojson/osmtogeojson.d.ts b/osmtogeojson/osmtogeojson.d.ts index 0edee3509..ad29c1b73 100644 --- a/osmtogeojson/osmtogeojson.d.ts +++ b/osmtogeojson/osmtogeojson.d.ts @@ -5,8 +5,8 @@ declare module "osmtogeojson" { export interface OsmToGeoJSON { - (data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; - toGeojson(data: Document|OsmJSON.Root, options?: Options): GeoJSON.GeoJSONObject; + (data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject; + toGeojson(data: Document|OsmJSON.OsmJSONObject, options?: Options): GeoJSON.GeoJSONObject; } export interface Options { @@ -54,11 +54,11 @@ declare module "osmtogeojson" { } export namespace OsmJSON { - export interface Root { + export interface OsmJSONObject { elements: (Node|Way|Relationship)[]; } - export interface OsmJSONObject { + export interface Element { type: string; id: number; tags?: { [name: string]: string; } @@ -69,16 +69,16 @@ declare module "osmtogeojson" { uid?: number; } - export interface Node extends OsmJSONObject { + export interface Node extends Element { lat: number; lon: number; } - export interface Way extends OsmJSONObject { + export interface Way extends Element { nodes: number[]; } - export interface Relationship extends OsmJSONObject { + export interface Relationship extends Element { members: Member[]; } diff --git a/pinterest-sdk/pinterest-sdk-tests.ts b/pinterest-sdk/pinterest-sdk-tests.ts new file mode 100644 index 000000000..ea1e2d438 --- /dev/null +++ b/pinterest-sdk/pinterest-sdk-tests.ts @@ -0,0 +1,17 @@ +/// + +// Examples from https://github.com/pinterest/pinterest-api-demo + +const PIN_FIELDS = "id,name,image[small]"; +const PIN_SCOPE = "read_public, write_public"; +const CALLBACK = (...args: any[]) => {}; +const DATA = { board: "test", note: "test", link: "tets", image_url: "test" }; + +// Auth +PDK.login({ scope : PIN_SCOPE }, CALLBACK); +PDK.logout(); +PDK.getSession(); + +// Requests +PDK.request("/pins/", "POST", DATA, CALLBACK); +PDK.me("boards", { fields: PIN_FIELDS }, CALLBACK); diff --git a/pinterest-sdk/pinterest-sdk.d.ts b/pinterest-sdk/pinterest-sdk.d.ts new file mode 100644 index 000000000..a72fe9d89 --- /dev/null +++ b/pinterest-sdk/pinterest-sdk.d.ts @@ -0,0 +1,146 @@ +// Type definitions for pinterest-sdk +// Project: https://assets.pinterest.com/sdk/sdk.js +// Definitions by: Adam Burmister +// Definitions: https://github.com/adamburmister/DefinitelyTyped +declare module PDK { + + enum OAuthScopes { 'read_public', 'write_public', 'read_relationships', 'write_relationships' } + + enum HttpMethod { 'get', 'put', 'post', 'delete' } + + type OauthSession = { + accessToken?: string; + scope?: string; + error?: string; + } + + interface LoginOptions { + scope: string|OAuthScopes; + method?: string; + appId?: string; + cookie?: boolean; + logging?: boolean; + session?: OauthSession; + } + + interface OAuthRequestParams { + accessToken?: string; + data?: any; + } + + interface InitOptions { + /** Your application ID from developer.pinterest.com */ + appId?: string; + cookie?: boolean; + logging?: boolean; + session?: OauthSession; + } + + /** + * Get information on the currently authenticated user + * @param cb the callback export function to handle the response + */ + export function me(callback: Function): void; + + /** + * Get information on the currently authenticated user + * @param path the url path + * @param cb the callback export function to handle the response + */ + export function me(path: string, callback: Function): void; + + /** + * Get information on the currently authenticated user + * @param path the url path + * @param params the parameters for the request + * @param cb the callback export function to handle the response + */ + export function me(path: string, params: Object, callback: Function): void; + + /** + * Make an API call to the server + * + * The path is the only required argument. + * + * @param path URL path + * @param httpMethod HTTP verb + */ + export function request(path: string, httpMethod?: string|HttpMethod, params?: OAuthRequestParams, callback?: Function): void; + + /** + * Show user login dialog, and save access token + */ + export function login(options: LoginOptions, callback: Function): void; + + /** + * Remove the session of the current user. + * + * Need to call login to re-connect, unless session is saved on server. + */ + export function logout(callback?: (session: OauthSession) => any): void; + + /** + * Get the active session for the current user + */ + export function getSession(): OauthSession; + + /** + * Save the user specified session + */ + export function setSession(session: OauthSession, callback?: (session: OauthSession) => any): void; + + /** + * Initialize the library. + * + * Typical initialization enabling all optional features: + * ``` + * + * + * ``` + * The best place to put this code is right before the closing + * `` tag. + * + * - Asynchronous Loading - + * + * The library makes non-blocking loading of the script easy to use by + * providing the `pAsyncInit` hook. If this global export function is defined, it + * will be executed when the library is loaded: + * ``` + *
+ * + * ``` + */ + export function init(options: InitOptions): void; + + /** + * Allow an unauthenticated user to pin using a popup + * + * @param imageUrl URL for image that you want to Pin. + * @param note The Pin's description. + * @param url The URL the Pin will link to when you click through. + */ + export function pin(imageUrl: string, note: string, url: string, callback: Function): void; +} + +declare module 'pinterest-sdk' { + export = PDK; +} diff --git a/promise/promise-tests.ts b/promise/promise-tests.ts new file mode 100644 index 000000000..140d170b1 --- /dev/null +++ b/promise/promise-tests.ts @@ -0,0 +1,21 @@ +/// + +var prom = new Promise((resolve, reject) => { + resolve(true); +}); + +var prom2 = new Promise((resolve, reject) => { + resolve(true); +}); + +prom.then((val) => { + console.log(val); +}).catch(() => { + +}); + +var prom3 = Promise.all([prom, prom2]); + +prom3.then((resolve: Array) => { + +}); diff --git a/promise/promise.d.ts b/promise/promise.d.ts new file mode 100644 index 000000000..9237b8908 --- /dev/null +++ b/promise/promise.d.ts @@ -0,0 +1,31 @@ +// Type definitions for promise v7.1.1 +// Project: https://www.promisejs.org/ +// Definitions by: Manuel Rueda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Support AMD require +declare module 'promise' { + export = Promise; +} + +declare var Promise: Promise.Ipromise; + +declare module Promise { + + export interface Ipromise { + new (resolver: (resolve: (value: T) => void, reject: (reason: any) => void) => void): IThenable; + + resolve: (value: T) => IThenable; + reject: (value: T) => IThenable; + all: (array: Array>) => IThenable>; + denodeify: (fn: Function) => IThenable; + nodeify: (fn: Function) => Function; + } + + export interface IThenable { + then(onFulfilled?: (value: T) => IThenable|R, onRejected?: (error: any) => IThenable|R): IThenable; + catch(onRejected?: (error: any) => IThenable|R): IThenable; + done(onFulfilled?: (value: T) => IThenable|R, onRejected?: (error: any) => IThenable|R): IThenable; + nodeify(callback: Function): IThenable; + } +} diff --git a/promises-a-plus/promises-a-plus-tests.ts b/promises-a-plus/promises-a-plus-tests.ts index bf6cc5ce0..0d7f5261a 100644 --- a/promises-a-plus/promises-a-plus-tests.ts +++ b/promises-a-plus/promises-a-plus-tests.ts @@ -4,9 +4,9 @@ /// /// -var thenNum: PromisesAPlus.Thenable; -var thenStr: PromisesAPlus.Thenable; -var thenBool: PromisesAPlus.Thenable; +var thenNum: PromisesAPlus.Thenable; +var thenStr: PromisesAPlus.Thenable; +var thenBool: PromisesAPlus.Thenable; var impl: PromisesAPlus.PromiseImpl; @@ -45,9 +45,9 @@ function testCompatibleWithRxJS() { } function testCompatibleWithES6Promises() { - // from spec to ES6 - var es6ThenNum: Thenable = thenNum; - var es6ThenStr: Thenable = thenStr; + // define ES6 thenables + var es6ThenNum: Thenable; + var es6ThenStr: Thenable; // from ES6 to spec thenNum = es6ThenNum; diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 8b0dd0fc0..2d578a13e 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -453,17 +453,25 @@ export class ReactBootstrapTest extends Component {
- + + + React-Bootstrap + + + + + +
diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index c63c55e9d..c6e30d081 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -120,6 +120,8 @@ declare module "react-bootstrap" { eventKey?: any; header?: boolean; href?: string; + onClick?: Function; + onKeyDown?: Function; onSelect?: Function; target?: string; title?: string; @@ -328,7 +330,7 @@ declare module "react-bootstrap" { placement?: string; positionLeft?: number; positionTop?: number; - title: any; // TODO: Add more specific type + title?: any; // TODO: Add more specific type } interface Popover extends React.ReactElement { } interface PopoverClass extends React.ComponentClass { } @@ -441,6 +443,33 @@ declare module "react-bootstrap" { interface NavItemClass extends React.ComponentClass { } var NavItem: NavItemClass; + // + // ---------------------------------------- + interface NavbarBrandProps extends React.Props { + } + interface NavbarBrand extends React.ReactElement { } + interface NavbarBrandClass extends React.ComponentClass { } + + // + // ---------------------------------------- + interface NavbarCollapseProps extends React.Props { + } + interface NavbarCollapse extends React.ReactElement { } + interface NavbarCollapseClass extends React.ComponentClass { } + + // + // ---------------------------------------- + interface NavbarHeaderProps extends React.Props { + } + interface NavbarHeader extends React.ReactElement { } + interface NavbarHeaderClass extends React.ComponentClass { } + + // + // ---------------------------------------- + interface NavbarToggleProps extends React.Props { + } + interface NavbarToggle extends React.ReactElement { } + interface NavbarToggleClass extends React.ComponentClass { } // // ---------------------------------------- @@ -463,7 +492,12 @@ declare module "react-bootstrap" { toggleNavKey?: string | number; } interface Navbar extends React.ReactElement { } - interface NavbarClass extends React.ComponentClass { } + interface NavbarClass extends React.ComponentClass { + Brand: NavbarBrandClass; + Collapse: NavbarCollapseClass; + Header: NavbarHeaderClass; + Toggle: NavbarToggleClass; + } var Navbar: NavbarClass; // @@ -813,6 +847,7 @@ declare module "react-bootstrap" { // // ---------------------------------------- interface InputProps extends React.Props { + defaultValue?:string; addonAfter?: any; // TODO: Add more specific type addonBefore?: any; // TODO: Add more specific type bsSize?: string; diff --git a/react-intl/react-intl.d.ts b/react-intl/react-intl.d.ts index b216a7dc8..8a11401af 100644 --- a/react-intl/react-intl.d.ts +++ b/react-intl/react-intl.d.ts @@ -24,7 +24,7 @@ declare module ReactIntl { [key: string]: FormattedMessage.MessageDescriptor } - function defineMessages(messages: Messages): T; + function defineMessages(messages: T): T; interface IntlShape extends React.Requireable { } @@ -236,4 +236,4 @@ declare module "react-intl" { declare module "react-intl/lib/locale-data/en" { var data: ReactIntl.LocaleData; export = data; -} \ No newline at end of file +} diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index f2e4cc22f..d4b89ab34 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -20,7 +20,7 @@ For a list of complete Typescript examples: check https://github.com/bgrieder/RN /// -import React from 'react-native' +import * as React from 'react-native' const { StyleSheet, Text, View } = React var styles = StyleSheet.create( diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index dc6cc5e3c..1ffa1d546 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -3459,7 +3459,7 @@ declare namespace __React { declare module "react-native" { import ReactNative = __React - export default ReactNative + export = ReactNative } declare var global: __React.GlobalStatic @@ -3469,7 +3469,7 @@ declare function require( name: string ): any //TODO: BGR: this is a left-over from the initial port. Not sure it makes any sense declare module "Dimensions" { - import React from 'react-native'; + import * as React from 'react-native'; interface Dimensions { get( what: string ): React.ScaledSize; diff --git a/react-notification-system/react-notification-system.d.ts b/react-notification-system/react-notification-system.d.ts index 52a5d7d98..04e6313a2 100644 --- a/react-notification-system/react-notification-system.d.ts +++ b/react-notification-system/react-notification-system.d.ts @@ -10,8 +10,8 @@ declare module NotificationSystem { import React = __React; export interface System extends React.Component { - addNotification(notification: Notification): Notification; - removeNotification(notification: Notification): void; + addNotification(notification: Notification): Notification; + removeNotification(notification: Notification): void; removeNotification(uid: string): void; } @@ -34,7 +34,7 @@ declare module NotificationSystem { export interface ActionObject { label: string; - callback?: Function; + callback?: () => void; } export interface ContainersStyle { @@ -75,7 +75,7 @@ declare module NotificationSystem { ref?: string; style?: Style | boolean; } - + export interface Component { (): React.ReactElement; diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 01411fcd5..aba062716 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -45,6 +45,7 @@ declare namespace ReactRouter { route?: PlainRoute routeParams?: R routes?: PlainRoute[] + children?: React.ReactElement } type RouteComponents = { [key: string]: RouteComponent } @@ -132,6 +133,8 @@ declare namespace ReactRouter { getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook + getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void + getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void } interface Route extends React.ComponentClass {} interface RouteElement extends React.ReactElement {} diff --git a/react-select/react-select-tests.ts b/react-select/react-select-tests.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx new file mode 100644 index 000000000..024761fe8 --- /dev/null +++ b/react-select/react-select-tests.tsx @@ -0,0 +1,29 @@ + +/// +/// +/// + +import * as React from "react" +import * as ReactDOM from "react-dom" + +import Select from "react-select" + +class SelectTest extends React.Component, {}> { + + render() { + return
+