From 6ed8a559b50507a8e974a5c7528310d5cdc9db63 Mon Sep 17 00:00:00 2001 From: Luuk Date: Sun, 13 Sep 2015 23:04:38 +0200 Subject: [PATCH 001/277] Added Safari extension TypeScript definitions --- safari/safari-content-tests.ts | 64 +++++ safari/safari-content.d.ts | 110 ++++++++ safari/safari-tests.ts | 159 ++++++++++++ safari/safari.d.ts | 457 +++++++++++++++++++++++++++++++++ 4 files changed, 790 insertions(+) create mode 100644 safari/safari-content-tests.ts create mode 100644 safari/safari-content.d.ts create mode 100644 safari/safari-tests.ts create mode 100644 safari/safari.d.ts diff --git a/safari/safari-content-tests.ts b/safari/safari-content-tests.ts new file mode 100644 index 000000000..b58735b9d --- /dev/null +++ b/safari/safari-content-tests.ts @@ -0,0 +1,64 @@ +/// + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingExtensionToolbars/AddingExtensionToolbars.html#//apple_ref/doc/uid/TP40009977-CH5-SW7 +var theBody = document.body; +// create a para and insert it at the top of the body +var element = document.createElement("p"); +element.id = "status"; +element.style.cssText = "float:right; color:red"; +element.textContent = "Waiting..."; +theBody.insertBefore(element, theBody.firstChild); + +function replyToMessage(aMessageEvent: SafariExtensionMessageEvent) { + if (aMessageEvent.name === "hey") { + document.getElementById("status").textContent="Message received."; + safari.self.tab.dispatchMessage("gotIt","Message acknowledged."); + } +} +// register for message events +safari.self.addEventListener("message", replyToMessage, false); + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingContextualMenuItems/AddingContextualMenuItems.html#//apple_ref/doc/uid/TP40009977-CH4-SW15 +document.addEventListener("contextmenu", handleContextMenu, false); + +function handleContextMenu(event: MouseEvent) { + safari.self.tab.setContextMenuEventUserInfo(event, (event.target).nodeName); +} + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingContextualMenuItems/AddingContextualMenuItems.html#//apple_ref/doc/uid/TP40009977-CH4-SW16 +document.addEventListener("contextmenu", handleContextMenu2, false); + +function handleContextMenu2(event: MouseEvent) { + if ((event.target).nodeName == "VIDEO") { + event.preventDefault(); + } +} + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW2 +var initialVal=1; +var calculatedVal=0 ; + +function doBigCalc(theData: number) { + safari.self.tab.dispatchMessage("calcThis",theData); +} + +function getAnswer(theMessageEvent: SafariExtensionMessageEvent) { + if (theMessageEvent.name === "theAnswer") { + calculatedVal=theMessageEvent.message; + console.log(calculatedVal); + } +} +safari.self.addEventListener("message", getAnswer, false); + +doBigCalc(initialVal); + +//https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW9 +function isItOkay(event: BeforeLoadEvent) { + var myMessageData = event.url; + var theAnswer = safari.self.tab.canLoad(event, myMessageData); + if (theAnswer == "block") { + event.preventDefault(); + } +} + +document.addEventListener("beforeload", isItOkay, true); diff --git a/safari/safari-content.d.ts b/safari/safari-content.d.ts new file mode 100644 index 000000000..3b0fead5c --- /dev/null +++ b/safari/safari-content.d.ts @@ -0,0 +1,110 @@ +// Type definitions for Safari extension development (content-scripts) +// Project: https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/InjectingScripts/InjectingScripts.html#//apple_ref/doc/uid/TP40009977-CH6-SW1 +// Definitions by: Luuk +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Window { + safari: typeof safari; +} + +declare module safari { + export var extension: SafariContentExtension; + export var self: SafariContentWebPage; +} + +interface SafariEvent { + /** + * The type of the event. + * The string used to identify a particular type of event is documented in the reference for that class. + */ + type: string; + + /** + * The target of the event. + * This attribute stays the same as the event moves through the event-dispatch hierarchy. Its value is the same as the object that the event is sent to during the targeting phase. + */ + target: SafariEventTarget; + + /** + * The object that the event is currently being sent to. + * This attribute varies as the event progresses through the phases, changing as the event moves through the event-dispatch hierarchy. + */ + currentTarget: SafariEventTarget; + + /** + * The time and date that the event was created. + */ + timestamp: number; + + /** + * The event-handling phase that the event is in. + * The values for this property are the same as the values used by Webkit to identify the event-handling phases. + */ + eventPhase: number; + + /** + * A Boolean value that indicates whether the event goes through the bubbling phase. + */ + bubbles: boolean; + + /** + * A Boolean value that indicates whether the event can be canceled. + */ + cancelable: boolean; + + /** + * A Boolean value that indicates whether the event’s default action has been prevented. + */ + defaultPrevented: boolean; + + /** + * Prevents the event from any further propagation. + * Propagation can be stopped only fon cancelable events. After propagation is stopped, the event is not sent to any other targets. + */ + stopPropagation() : void; + + /** + * Prevents the browser from performing the default action for an event. + * Use this method to indicate that your extension has already fully handled the event; you don’t want the browser to do anything. Note that preventing the default action does not stop an event from propagating. + */ + preventDefault(): void; +} + +interface SafariExtensionMessageEvent extends SafariEvent { + /** + * The name of the message. + */ + name: string; + + /** + * The message data. + */ + message: any; +} + +interface SafariEventListener extends Function { + (event: SafariEvent): any; +} + +interface SafariEventTarget { + addEventListener(type: string, listener: SafariEventListener, useCapture?: boolean): void; + removeEventListener(type: string, listener: SafariEventListener, useCapture?: boolean): void; +} + +interface SafariContentExtension { + baseURI: string; +} + +interface SafariContentWebPage extends SafariEventTarget { + tab: SafariContentBrowserTabProxy; +} + +interface SafariContentBrowserTabProxy { + canLoad(event: any, message: any): any; + dispatchMessage(name: string, message?: any): void; + setContextMenuEventUserInfo(event: MouseEvent, userInfo: any): void; +} + +interface BeforeLoadEvent extends Event { + url: string; +} \ No newline at end of file diff --git a/safari/safari-tests.ts b/safari/safari-tests.ts new file mode 100644 index 000000000..b4e5cfd60 --- /dev/null +++ b/safari/safari-tests.ts @@ -0,0 +1,159 @@ +/// + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AccessingResourcesWithinYourExtensionFolder/AccessingResourcesWithinYourExtensionFolder.html#//apple_ref/doc/uid/TP40009977-CH18-SW2 +var img = document.createElement("img"); +img.src = safari.extension.baseURI + 'Images/myImage.png' + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingExtensionToolbars/AddingExtensionToolbars.html#//apple_ref/doc/uid/TP40009977-CH5-SW2 +const bars = safari.extension.bars; +const activeBrowserWindow = safari.application.activeBrowserWindow; +for (var i = 0; i < bars.length; ++i) { + var bar = bars[i]; + if (bar.browserWindow === activeBrowserWindow && bar.identifier === "Audio Controls") { + /* Do something. */ + } +} + + +var server = "http://developer.apple.com/"; +var reflib = "safari/library/documentation/AppleApplications/Reference/" +function openInTab(source: string) { + var newTab = (safari.self).browserWindow.openTab(); + newTab.url = source; +} + +function sendMessage() { + document.getElementById("textField").innerHTML = "Sending message..."; + safari.application.activeBrowserWindow.activeTab.page.dispatchMessage("hey", "there"); +} + +function respondToMessage(messageEvent: SafariExtensionMessageEvent) { + if (messageEvent.name === "gotIt") + document.getElementById("textField").innerHTML = messageEvent.message; +} + +(safari.self).browserWindow.addEventListener("message", respondToMessage, false); + +const myBars = safari.extension.bars; +function updateAllBars() { + for (var i = 0; i < myBars.length; ++i) { + var barWindow = myBars[i].contentWindow; + barWindow.doSomething(); + var myWindow = safari.application.activeBrowserWindow; + if (myBars[i].browserWindow == myWindow) { + barWindow.doSomethingSpecial(); + } + } +} + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingaGlobalHTMLPage/AddingaGlobalHTMLPage.html#//apple_ref/doc/uid/TP40009977-CH16-SW2 +const myGlobal: any = safari.extension.globalPage.contentWindow; + +function doButton() { + myGlobal.calcThis(myGlobal.theAnswer); + var mButton = document.getElementById("myButton"); + mButton.value = ("Increment " + myGlobal.theAnswer); +} + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingButtonstotheMainSafariToolbar/AddingButtonstotheMainSafariToolbar.html#//apple_ref/doc/uid/TP40009977-CH3-SW12 +var itemArray = safari.extension.toolbarItems; +for (var i = 0; i < itemArray.length; ++i) { + var item = itemArray[i]; + if (item.identifier == "my lovely button") { + /* Do something. */ + } +} + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingButtonstotheMainSafariToolbar/AddingButtonstotheMainSafariToolbar.html#//apple_ref/doc/uid/TP40009977-CH3-SW8 +function performCommand(event: SafariCommandEvent) { + if (event.command === "reload-page") { + var currentURL = (event.target).browserWindow.activeTab.url; + if (currentURL) + (event.target).browserWindow.activeTab.url = currentURL; + } +} + +function validateCommand(event: SafariValidateEvent) { + if (event.command === "reload-page") { + // Disable the button if there is no URL loaded in the tab. + (event.target).disabled = !(event.target).browserWindow.activeTab.url; + } +} + +// if event handlers are in the global HTML page, +// register with application: +safari.application.addEventListener("command", performCommand, false); +safari.application.addEventListener("validate", validateCommand, false); +// if event handlers are in an extension bar, +// register with parent window: +(safari.self).browserWindow.addEventListener("command", performCommand, false); +(safari.self).browserWindow.addEventListener("validate", validateCommand, false); + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingExtensionMenus/AddingExtensionMenus.html#//apple_ref/doc/uid/TP40009977-CH20-SW8 +var myMenu = safari.extension.createMenu("menuId"); +safari.extension.removeMenu("menuId"); +myMenu.removeMenuItem(0); +myMenu.appendMenuItem("identifier", "title"); +myMenu.insertMenuItem(1, "identifier", "title"); +myMenu.appendSeparator("identifier"); +myMenu.insertSeparator(1, "identifier"); + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingPopovers/AddingPopovers.html#//apple_ref/doc/uid/TP40009977-CH21-SW7 +var validateHandler = (event: SafariValidateEvent) => { + if ((event.target).identifier !== "myToolbarItemID") return; +}; +var popoverHandler = (event: SafariEvent) => { + if ((event.target).identifier !== "myToolbarItemID") return; +}; +safari.application.addEventListener("validate", validateHandler, true); +safari.application.addEventListener("popover", popoverHandler, true); + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingPopovers/AddingPopovers.html#//apple_ref/doc/uid/TP40009977-CH21-SW8 +var width = 400; +var height = 400; +var myPop = safari.extension.createPopover("myPopoverID", safari.extension.baseURI + "myFile.html", width, height); + +var myToolbarItem = safari.extension.toolbarItems[0]; +myToolbarItem.popover = myPop; +myToolbarItem.popover = null; +safari.extension.removePopover("myPopoverID"); + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingContextualMenuItems/AddingContextualMenuItems.html#//apple_ref/doc/uid/TP40009977-CH4-SW17 +safari.application.addEventListener("contextmenu", handleContextMenu, false); + +function handleContextMenu(event: SafariExtensionContextMenuEvent) { + if (event.userInfo === "IMG") { + event.contextMenu.appendContextMenuItem("enlarge", "Enlarge Item"); + } +} + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW2 +function bigCalc(startVal: number, event: SafariExtensionMessageEvent) { + // imagine hundreds of lines of code here... + var endVal = startVal + 2; + // return to sender + (event.target).page.dispatchMessage("theAnswer", endVal); +} + +function respondToMessage2(theMessageEvent: SafariExtensionMessageEvent) { + if (theMessageEvent.name === "calcThis") { + var startVal = theMessageEvent.message; + bigCalc(startVal, theMessageEvent); + } +} + +safari.application.addEventListener("message", respondToMessage2, false); + +// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/ExtensionSettings/ExtensionSettings.html#//apple_ref/doc/uid/TP40009977-CH11-SW13 +var myVolume: number; +function volumeChanged(event: SafariExtensionSettingsChangeEvent) { + if (event.key == "volume") { + myVolume = event.newValue; + } +} + +safari.extension.settings.addEventListener("change", volumeChanged, false); +safari.extension.settings["volume"] = myVolume; +safari.extension.settings.setItem("volume", myVolume); +safari.extension.secureSettings["volume"] = myVolume; +safari.extension.secureSettings.setItem("volume", myVolume); \ No newline at end of file diff --git a/safari/safari.d.ts b/safari/safari.d.ts new file mode 100644 index 000000000..621bcc824 --- /dev/null +++ b/safari/safari.d.ts @@ -0,0 +1,457 @@ +// Type definitions for Safari extension development +// Project: https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009977-CH1-SW1 +// Definitions by: Luuk +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Window { + safari: typeof safari; +} + +declare module safari { + export var application: SafariApplication; + export var extension: SafariExtension; + export var self: SafariExtensionGlobalPage | SafariExtensionBar; +} + +interface SafariEvent { + /** + * The type of the event. + * The string used to identify a particular type of event is documented in the reference for that class. + */ + type: string; + + /** + * The target of the event. + * This attribute stays the same as the event moves through the event-dispatch hierarchy. Its value is the same as the object that the event is sent to during the targeting phase. + */ + target: SafariEventTarget; + + /** + * The object that the event is currently being sent to. + * This attribute varies as the event progresses through the phases, changing as the event moves through the event-dispatch hierarchy. + */ + currentTarget: SafariEventTarget; + + /** + * The time and date that the event was created. + */ + timestamp: number; + + /** + * The event-handling phase that the event is in. + * The values for this property are the same as the values used by Webkit to identify the event-handling phases. + */ + eventPhase: number; + + /** + * A Boolean value that indicates whether the event goes through the bubbling phase. + */ + bubbles: boolean; + + /** + * A Boolean value that indicates whether the event can be canceled. + */ + cancelable: boolean; + + /** + * A Boolean value that indicates whether the event’s default action has been prevented. + */ + defaultPrevented: boolean; + + /** + * Prevents the event from any further propagation. + * Propagation can be stopped only fon cancelable events. After propagation is stopped, the event is not sent to any other targets. + */ + stopPropagation() : void; + + /** + * Prevents the browser from performing the default action for an event. + * Use this method to indicate that your extension has already fully handled the event; you don’t want the browser to do anything. Note that preventing the default action does not stop an event from propagating. + */ + preventDefault(): void; +} + +interface SafariEventListener extends Function { + (event: SafariEvent): any; +} + +interface SafariEventTarget { + addEventListener(type: string, listener: SafariEventListener, useCapture?: boolean): void; + removeEventListener(type: string, listener: SafariEventListener, useCapture?: boolean): void; +} + +interface SafariBrowserWindow extends SafariEventTarget { + tabs: Array; + visible: boolean; + activeTab: SafariBrowserTab; + + activate(): void; + close(): void; + + /** + * Opens a new tab in the window. + * Available in Safari 5.0 and later. + * @param visibility Either foreground if the tab should be opened in the foreground, or background if it should be opened in the background. + * @param index The desired location of the new tab. + * @returns A new tab. + */ + openTab (visibility?: string, index?: number): SafariBrowserTab; + insertTab(tab: SafariBrowserTab, index: number): SafariBrowserTab; +} + +interface SafariBrowserTab extends SafariEventTarget { + browserWindow: SafariBrowserWindow; + reader: SafariReader; + + /** + * The tab’s current title. + * The tab’s title is the same as the title of the webpage in most cases. For example, the title of the webpage may be truncated for display, but the value of this property is not truncated. + * Available in Safari 5.0 and later. + */ + title: string; + page: SafariWebPageProxy; + + /** + * The URL loaded in this tab. + * Setting this attribute to a new value loads the page at the new URL in the tab. + * Available in Safari 5.0 and later. + */ + url: string; + + visibleContentsAsDataURL(): string; + activate(): void; + close(): void; +} + +interface SafariReader extends SafariEventTarget { + available: boolean; + tab: SafariBrowserTab; + visible: boolean; + + enter(): void; + exit(): void; + dispatchMessage (name: string, message?: any): void; +} + +interface SafariWebPageProxy { + dispatchMessage (name: string, message?: any): void; +} + +interface SafariExtensionGlobalPage { + contentWindow: Window; +} + +interface SafariExtensionPopover extends SafariEventTarget { + identifier: string; + visible: boolean; + + contentWindow: Window; + height: number; + width: number; + + hide(): void; +} + +interface SafariExtensionMenu { + identifier: string; + menuItems: Array; + visible: boolean; + + appendMenuItem (identifier: string, title: string, command?: string): SafariExtensionMenuItem; + appendSeparator (identifier: string): SafariExtensionMenuItem; + insertMenuItem (index: number, identifier: string, title: string, command?: string): SafariExtensionMenuItem; + insertSeparator (index: number, identifier: string): SafariExtensionMenuItem; + removeMenuItem (index: number): void; +} + +interface SafariExtensionMenuItem extends SafariEventTarget { + command: string; + identifier: string; + separator: boolean; + title: string; + image: string; + submenu: SafariExtensionMenu; + + visible: boolean; + disabled: boolean; + checkedState: number; +} + +interface SafariExtensionSettings extends SafariEventTarget { + [index: string]: any; + [index: number]: any; + getItem(key: string): any; + setItem(key: string, value: any): void; + removeItem(key: string): void; + clear(): void; +} + +interface SafariExtensionSecureSettings extends SafariEventTarget { + [index: string]: any; + getItem(key: string): any; + setItem(key: string, value: any): void; + removeItem(key: string): void; + clear(): void; +} + +interface SafariExtensionBar extends SafariEventTarget { + identifier: string; + label: string; + visible: boolean; + browserWindow: SafariBrowserWindow; + contentWindow: Window; + + hide(doNotRemember?: boolean): void; + show(doNotRemember?: boolean): void; +} + +interface SafariExtensionToolbarItem extends SafariEventTarget { + + /** + * The current badge number. + */ + badge: number; + + /** + * The URL of the current image. + */ + image: string; + + /** + * The label of the toolbar item, as shown in the toolbar’s overflow menu. + */ + label: string; + + /** + * The label of the toolbar item, as shown in the Customize palette. + * This attribute is optional; its value defaults to the value of label. + */ + paletteLabel: string; + + /** + * The tooltip (help tag) of the toolbar item. + * This attribute is optional; its value defaults to the value of label. + */ + toolTip: string; + menu: SafariExtensionMenu; + popover: SafariExtensionPopover; + browserWindow: SafariBrowserWindow; + command: string; + disabled: boolean; + identifier: string; + + showMenu(): void; + showPopover(): void; + validate(): void; +} + +interface SafariPrivateBrowsing { + enabled: boolean; +} + +interface SafariExtension { + bars: Array; + baseURI: string; + globalPage: SafariExtensionGlobalPage; + toolbarItems: Array; + + displayVersion: string; + bundleVersion: string; + + menus: Array; + createMenu (identifier: string): SafariExtensionMenu; + removeMenu (identifier: string): void; + + popovers: Array; + createPopover(identifier: string, url: string, width?: number, height?: number): SafariExtensionPopover; + removePopover(identifier: string): void; + + addContentScript (source: string, whitelist: Array, blacklist: Array, runAtEnd: boolean): string; + addContentScriptFromURL (url: string, whitelist: Array, blacklist: Array, runAtEnd: boolean): string; + addContentStyleSheet (source: string, whitelist: Array, blacklist: Array): string; + addContentStyleSheetFromURL (url: string, whitelist: Array, blacklist: Array): string; + removeContentScript(url: string): void; + removeContentScripts(): void; + removeContentStyleSheet(url: string): void; + removeContentStyleSheets(): void; + + settings: SafariExtensionSettings; + secureSettings: SafariExtensionSecureSettings; +} + +interface SafariApplication extends SafariEventTarget { + activeBrowserWindow: SafariBrowserWindow; + browserWindows: Array; + privateBrowsing: SafariPrivateBrowsing; + openBrowserWindow(): SafariBrowserWindow; +} + +interface SafariExtensionContextMenuEvent extends SafariEvent { + /** + * The target of the event. + * This attribute stays the same as the event moves through the event-dispatch hierarchy. Its value is the same as the object that the event is sent to during the targeting phase. + */ + target: SafariExtensionContextMenuItem; + + /** + * The object that the event is currently being sent to. + * This attribute varies as the event progresses through the phases, changing as the event moves through the event-dispatch hierarchy. + */ + currentTarget: SafariExtensionContextMenuItem; + + /** + * Information about the current context menu event. + */ + userInfo: any; + + /** + * The context menu being built up. + */ + contextMenu: SafariExtensionContextMenu; +} + +interface SafariExtensionContextMenu { + /** + * Returns a list of the context menu items from this extension. + * Only menu items from your extension are returned. + */ + contextMenuItems: any[]; + + /** + * Appends a menu item to the contextual menu. + * If another menu item with the same identifier already exists, it is removed before appending the menu item. If command is not supplied, identifier is used as the command identifier. + * @param identifier The unique identifier of the menu item. + * @param title The title of the menu item. + * @param command The command identifier that the context menu item sends when activated. + * @returns The context menu item that was appended. + */ + appendContextMenuItem (identifier: string, title: string, command?: string) : SafariExtensionContextMenuItem; + + /** + * Inserts a menu item at a specific index in the contextual menu. + * If another menu item with the same identifier already exists, it is removed before appending the menu item. If command is not supplied, identifier is used as the command identifier. + * @param index The index where the menu item is being inserted. + * @param identifier The unique identifier of the menu item. + * @param title The title of the menu item. + * @param command The command identifier that the context menu item sends when activated. + * @returns The context menu item that was inserted. + */ + insertContextMenuItem (index: number, identifier: string, title: string, command?: string): SafariExtensionContextMenuItem; +} + +interface SafariExtensionContextMenuItem extends SafariEventTarget { + /** + * The command identifier that the context menu item sends when activated. + * Setting an empty string, null, or undefined has no effect. + */ + command: string; + + /** + * A Boolean value that indicates whether a context menu item is disabled. + * Disabled menu items are not displayed in the context menu. + */ + disabled: boolean; + + /** + * The unique identifier of the context menu item. + */ + identifier: string; + + /** + * The title displayed in the context menu. + */ + title: string; +} + +interface SafariValidateEvent extends SafariEvent { + /** + * The command identifier of the target being validated. + */ + command: string; +} + +interface SafariExtensionContextMenuItemValidateEvent { + /** + * The target of the event. + * This attribute stays the same as the event moves through the event-dispatch hierarchy. Its value is the same as the object that the event is sent to during the targeting phase. + */ + target: SafariExtensionContextMenuItem; + + /** + * The object that the event is currently being sent to. + * This attribute varies as the event progresses through the phases, changing as the event moves through the event-dispatch hierarchy. + */ + currentTarget: SafariExtensionContextMenuItem; + + /** + * Information about the current context menu event. + */ + userInfo: any; +} + +interface SafariCommandEvent extends SafariEvent { + /** + * The command identifier of the target being dispatched. + */ + command: string; +} + +interface SafariExtensionContextMenuItemCommandEvent extends SafariCommandEvent { + /** + * The target of the event. + * This attribute stays the same as the event moves through the event-dispatch hierarchy. Its value is the same as the object that the event is sent to during the targeting phase. + */ + target: SafariExtensionContextMenuItem; + + /** + * The object that the event is currently being sent to. + * This attribute varies as the event progresses through the phases, changing as the event moves through the event-dispatch hierarchy. + */ + currentTarget: SafariExtensionContextMenuItem; + + /** + * The user info object for this context menu event. + */ + userInfo: any; +} + +interface SafariExtensionSettingsChangeEvent extends SafariEvent { + /** + * The target of the event. + * This attribute stays the same as the event moves through the event-dispatch hierarchy. Its value is the same as the object that the event is sent to during the targeting phase. + */ + target: SafariExtensionSettings|SafariExtensionSecureSettings; + + /** + * The object that the event is currently being sent to. + * This attribute varies as the event progresses through the phases, changing as the event moves through the event-dispatch hierarchy. + */ + currentTarget: SafariExtensionSettings|SafariExtensionSecureSettings; + + /** + * The key identifier of the setting that was changed. + */ + key: string; + + /** + * The value before the settings change. + */ + oldValue: any; + + /** + * The value after the settings change. + */ + newValue: any; +} + +interface SafariExtensionMessageEvent extends SafariEvent { + /** + * The name of the message. + */ + name: string; + + /** + * The message data. + */ + message: any; +} \ No newline at end of file From 6166ce3c5e4b23634c89435ad165bee3ebea24ce Mon Sep 17 00:00:00 2001 From: Luuk Date: Sat, 10 Oct 2015 16:40:33 +0200 Subject: [PATCH 002/277] Renamed files and folders for safari-extension definitions --- .../safari-extension-content-tests.ts | 0 .../safari-extension-content.d.ts | 0 .../safari-tests.ts => safari-extension/safari-extension-tests.ts | 0 safari/safari.d.ts => safari-extension/safari-extension.d.ts | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename safari/safari-content-tests.ts => safari-extension/safari-extension-content-tests.ts (100%) rename safari/safari-content.d.ts => safari-extension/safari-extension-content.d.ts (100%) rename safari/safari-tests.ts => safari-extension/safari-extension-tests.ts (100%) rename safari/safari.d.ts => safari-extension/safari-extension.d.ts (100%) diff --git a/safari/safari-content-tests.ts b/safari-extension/safari-extension-content-tests.ts similarity index 100% rename from safari/safari-content-tests.ts rename to safari-extension/safari-extension-content-tests.ts diff --git a/safari/safari-content.d.ts b/safari-extension/safari-extension-content.d.ts similarity index 100% rename from safari/safari-content.d.ts rename to safari-extension/safari-extension-content.d.ts diff --git a/safari/safari-tests.ts b/safari-extension/safari-extension-tests.ts similarity index 100% rename from safari/safari-tests.ts rename to safari-extension/safari-extension-tests.ts diff --git a/safari/safari.d.ts b/safari-extension/safari-extension.d.ts similarity index 100% rename from safari/safari.d.ts rename to safari-extension/safari-extension.d.ts From c88a935bc1fd65957d9355b4408f1cde0c1ba3c5 Mon Sep 17 00:00:00 2001 From: Luuk Date: Sat, 10 Oct 2015 16:43:55 +0200 Subject: [PATCH 003/277] Fixed references --- safari-extension/safari-extension-content-tests.ts | 2 +- safari-extension/safari-extension-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/safari-extension/safari-extension-content-tests.ts b/safari-extension/safari-extension-content-tests.ts index b58735b9d..067e90f05 100644 --- a/safari-extension/safari-extension-content-tests.ts +++ b/safari-extension/safari-extension-content-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingExtensionToolbars/AddingExtensionToolbars.html#//apple_ref/doc/uid/TP40009977-CH5-SW7 var theBody = document.body; diff --git a/safari-extension/safari-extension-tests.ts b/safari-extension/safari-extension-tests.ts index b4e5cfd60..0336c4411 100644 --- a/safari-extension/safari-extension-tests.ts +++ b/safari-extension/safari-extension-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AccessingResourcesWithinYourExtensionFolder/AccessingResourcesWithinYourExtensionFolder.html#//apple_ref/doc/uid/TP40009977-CH18-SW2 var img = document.createElement("img"); From dcaacde371c26112c7f0a9605531c38781dce2f9 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Mon, 30 Nov 2015 08:38:10 +0100 Subject: [PATCH 004/277] - extend the typings reading the official docs of ngDialog --- ng-dialog/ng-dialog-tests.ts | 2 +- ng-dialog/ng-dialog.d.ts | 309 +++++++++++++++++++++++++---------- 2 files changed, 223 insertions(+), 88 deletions(-) diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts index 6d68111a6..ae2586b1a 100644 --- a/ng-dialog/ng-dialog-tests.ts +++ b/ng-dialog/ng-dialog-tests.ts @@ -39,7 +39,7 @@ class DialogTestController { class LoginDialogController { - constructor($scope: angular.dialog.IDialogScope) { + constructor($scope:angular.dialog.IDialogOpenScope) { $scope.closeThisDialog("bye"); } diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index 3ad5c4d09..1eb1a1f8d 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -7,104 +7,239 @@ declare module angular.dialog { - interface IDialogService { - getDefaults(): IDialogOptions; - open(options: IDialogOpenOptions): IDialogOpenResult; - openConfirm(options: IDialogOpenOptions): IPromise; + /* + * Everytime ngDialog is opened or closed we're broadcasting three events + * (dispatching events downwards to all child scopes): + * + * for more info see: https://github.com/likeastore/ngDialog#events + */ + export const EVENT_OPENEND:string = 'ngDialog.opened'; + export const EVENT_CLOSING:string = 'ngDialog.closing'; + export const EVENT_CLOSED:string = 'ngDialog.closed'; - /** - * Determine whether the specified dialog is open or not. - * @param id Dialog id to check for. - * @returns {boolean} Indicating whether it exists or not. - */ - isOpen(id: string): boolean; - close(id: string, value?: any): void; - closeAll(value?: any): void; - getOpenDialogs(): string[]; - } - interface IDialogOpenResult { - id: string; - close: (value?: string) => void; - closePromise: IPromise; - } + interface IDialogService { + getDefaults(): IDialogOptions; + open(options:IDialogOpenOptions): IDialogOpenResult; + openConfirm(options:IDialogOpenConfirmOptions): IPromise; - interface IDialogClosePromise { - id: string; - value: any; - } + /** + * Determine whether the specified dialog is open or not. + * @param id Dialog id to check for. + * @returns {boolean} Indicating whether it exists or not. + */ + isOpen(id:string): boolean; + close(id:string, value?:any): void; + closeAll(value?:any): void; + getOpenDialogs(): string[]; + } - interface IDialogProvider extends angular.IServiceProvider { - /** - * Default options for the dialogs. - * @param defaultOptions - * @returns {} - */ - setDefaults(defaultOptions: IDialogOptions): void; - } + interface IDialogOpenResult { + id: string; + close: (value?:any) => void; + closePromise: IPromise; + } - /** - * Dialog Scope which extends the $scope. - */ - interface IDialogScope extends angular.IScope { - /** - * This allows you to close dialog straight from handler in a popup element. - * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog. - * For dialogs opened with the openConfirm() method the value is used as the reject reason. - */ - closeThisDialog(value?: any): void; - } + interface IDialogClosePromise { + id: string; + value: any; + } - interface IDialogOptions { - /** - * This option allows you to control the dialog's look, you can use built-in themes or create your own styled modals. - * It will be appended with the "ngdialog" class e.g. className is "default-theme flat-ui" it will be class="ngdialog default-theme flat-ui". - */ - className?: string; - /** - * If false it allows to hide overlay div behind the modals, default true. - */ - overlay?: boolean; + interface IDialogProvider extends angular.IServiceProvider { + /** + * Default options for the dialogs. + * @param defaultOptions + * @returns {} + */ + setDefaults(defaultOptions:IDialogOptions): void; - /** - * If false it allows to hide close button on modals, default true. - */ - showClose?: boolean; + /** + * 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; - /** - * It allows to close modals by clicking Esc button, default true. - * This will close all open modals if there several of them open at the same time. - */ - closeByEscape?: boolean; + /** + * 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; + } - /** - * It allows to close modals by clicking on overlay background, default true. If @see Hammer.js is loaded, it will listen for tap instead of click. - */ - closeByDocument?: boolean; + /** + * Dialog Scope which extends the $scope. + */ + interface IDialogOpenScope extends angular.IScope { + /** + * This allows you to close dialog straight from handler in a popup element. + * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog. + * For dialogs opened with the openConfirm() method the value is used as the reject reason. + */ + closeThisDialog(value?:any): void; + } - /** - * If true allows to use plain string as template, default false. - */ - plain?: boolean; + interface IDialogOpenConfirmScope extends IDialogOpenScope { + /** + * 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) + } - /** - * Give a name for a dialog instance. It is useful for identifying specific dialog if there are multiple dialog boxes opened. - */ - name?: string | number; + interface IDialogOptions { + /** + * This option allows you to control the dialog's look, you can use built-in themes or create your own styled modals. + * It will be appended with the "ngdialog" class e.g. className is "default-theme flat-ui" it will be class="ngdialog default-theme flat-ui". + */ + className?: string; - preCloseCallback?: string|Function; - } + /** + * If true then animation for the dialog will be disabled, default false. + */ + disableAnimation?: boolean; - /** - * Options which are provided to open a dialog. - */ - interface IDialogOpenOptions extends IDialogOptions { - template: string; - controller?: string|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; - } + /** + * If false it allows to hide overlay div behind the modals, default true. + */ + overlay?: boolean; + + /** + * If false it allows to hide close button on modals, default true. + */ + showClose?: boolean; + + /** + * It allows to close modals by clicking Esc button, default true. + * This will close all open modals if there several of them open at the same time. + */ + closeByEscape?: boolean; + + /** + * It allows to close modals by clicking on overlay background, default true. If @see Hammer.js is loaded, it will listen for tap instead of click. + */ + closeByDocument?: boolean; + + /** + * default : false + */ + closeByNavigation?: boolean; + + + /** + * If true allows to use plain string as template, default false. + */ + plain?: boolean; + + /** + * Give a name for a dialog instance. It is useful for identifying specific dialog if there are multiple dialog boxes opened. + */ + 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; + } + + /** + * Options which are provided to open a dialog. + */ + interface IDialogOpenOptions extends IDialogOptions { + template: string; + 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?: IDialogOpenScope; + + /** + * 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. + */ + 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? : IDialogOpenConfirmScope; + } } From 41df70b20c0083dbd21ac99b74a109c0b3fd30f2 Mon Sep 17 00:00:00 2001 From: Jamison Greeley Date: Tue, 8 Dec 2015 19:05:04 -0700 Subject: [PATCH 005/277] Adds gulp-jade --- gulp-jade/gulp-jade-tests.ts | 29 +++++++++++++ gulp-jade/gulp-jade.d.ts | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 gulp-jade/gulp-jade-tests.ts create mode 100644 gulp-jade/gulp-jade.d.ts diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts new file mode 100644 index 000000000..a2c7756d0 --- /dev/null +++ b/gulp-jade/gulp-jade-tests.ts @@ -0,0 +1,29 @@ +/// +/// + +import * as gulp from 'gulp'; +import 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..624b9a016 --- /dev/null +++ b/gulp-jade/gulp-jade.d.ts @@ -0,0 +1,83 @@ +// 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" { + export default function jade(params?: JadeParams): any; + + interface JadeParams { + + /******* + * 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?: any; + + /** + * 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; + } +} \ No newline at end of file From e9920407b96f37e0bcec3d6a8f8dfbb94073c497 Mon Sep 17 00:00:00 2001 From: Jamison Greeley Date: Tue, 8 Dec 2015 19:57:30 -0700 Subject: [PATCH 006/277] Fix for Typescript import syntax ES6 style syntax causes compiled code to function in unintended ways, leading to incorrect JavaScript code. --- gulp-jade/gulp-jade-tests.ts | 2 +- gulp-jade/gulp-jade.d.ts | 154 ++++++++++++++++++----------------- 2 files changed, 80 insertions(+), 76 deletions(-) diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts index a2c7756d0..d6077eae5 100644 --- a/gulp-jade/gulp-jade-tests.ts +++ b/gulp-jade/gulp-jade-tests.ts @@ -2,7 +2,7 @@ /// import * as gulp from 'gulp'; -import jade from 'gulp-jade'; +import * as jade from 'gulp-jade'; gulp.task('jade', () => { gulp.src('src/**/*.jade') diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts index 624b9a016..c5594a879 100644 --- a/gulp-jade/gulp-jade.d.ts +++ b/gulp-jade/gulp-jade.d.ts @@ -4,80 +4,84 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "gulp-jade" { - export default function jade(params?: JadeParams): any; - - interface JadeParams { - - /******* - * 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?: any; - - /** - * 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; + + 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?: any; + + /** + * 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 From ee16e460f7de92a4dd3086599f7ce1035a5d0721 Mon Sep 17 00:00:00 2001 From: Allen Li Date: Wed, 9 Dec 2015 22:38:00 -0800 Subject: [PATCH 007/277] [react-bootstrap] Update to include Navbar.*. Add: Navbar.Brand Navbar.Collapse Navbar.Header Navbar.Toggle --- react-bootstrap/react-bootstrap-tests.tsx | 30 ++++++++++++-------- react-bootstrap/react-bootstrap.d.ts | 34 ++++++++++++++++++++++- 2 files changed, 52 insertions(+), 12 deletions(-) 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..b1d8bd2d3 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -441,6 +441,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 +490,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; // From 41ef01998a31c0e5a2463c810fea5eb4216d1455 Mon Sep 17 00:00:00 2001 From: Jamison Greeley Date: Thu, 17 Dec 2015 15:29:24 -0700 Subject: [PATCH 008/277] gulp-jade -- better representation of `pretty` --- gulp-jade/gulp-jade.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts index c5594a879..221a14db0 100644 --- a/gulp-jade/gulp-jade.d.ts +++ b/gulp-jade/gulp-jade.d.ts @@ -27,7 +27,7 @@ declare module "gulp-jade" { * If a string is specified, that will be used as * indentation instead (e.g. '\t'). */ - pretty?: any; + pretty?: boolean|string; /** * Use a self namespace to hold the locals (false by default) From 3aff56f2323c7217fc8806ab51656e1126ddb3a6 Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Sun, 20 Dec 2015 20:51:20 +0000 Subject: [PATCH 009/277] Added Initial nvd3 definitions --- nvd3/nvd-test-bullet.ts | 46 +++++ nvd3/nvd-test-bulletChart.ts | 72 ++++++++ nvd3/nvd3-test-boxplot.ts | 57 ++++++ nvd3/nvd3-test-historicalBar.ts | 59 +++++++ nvd3/nvd3-test-historicalBarChart.ts | 165 ++++++++++++++++++ nvd3/nvd3-test-legend.ts | 67 +++++++ nvd3/nvd3-test-ohlcChart.ts | 36 ++++ nvd3/nvd3-test-tooltip.ts | 55 ++++++ nvd3/nvd3.d.ts | 252 +++++++++++++++++++++++++++ 9 files changed, 809 insertions(+) create mode 100644 nvd3/nvd-test-bullet.ts create mode 100644 nvd3/nvd-test-bulletChart.ts create mode 100644 nvd3/nvd3-test-boxplot.ts create mode 100644 nvd3/nvd3-test-historicalBar.ts create mode 100644 nvd3/nvd3-test-historicalBarChart.ts create mode 100644 nvd3/nvd3-test-legend.ts create mode 100644 nvd3/nvd3-test-ohlcChart.ts create mode 100644 nvd3/nvd3-test-tooltip.ts create mode 100644 nvd3/nvd3.d.ts diff --git a/nvd3/nvd-test-bullet.ts b/nvd3/nvd-test-bullet.ts new file mode 100644 index 000000000..7ec2363e0 --- /dev/null +++ b/nvd3/nvd-test-bullet.ts @@ -0,0 +1,46 @@ +/// +/// + +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/nvd-test-bulletChart.ts b/nvd3/nvd-test-bulletChart.ts new file mode 100644 index 000000000..eb727589e --- /dev/null +++ b/nvd3/nvd-test-bulletChart.ts @@ -0,0 +1,72 @@ +/// +/// + +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-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-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..81f39d2da --- /dev/null +++ b/nvd3/nvd3-test-legend.ts @@ -0,0 +1,67 @@ +/// +/// +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"} + ]; + } diff --git a/nvd3/nvd3-test-ohlcChart.ts b/nvd3/nvd3-test-ohlcChart.ts new file mode 100644 index 000000000..b62027f63 --- /dev/null +++ b/nvd3/nvd3-test-ohlcChart.ts @@ -0,0 +1,36 @@ +/// +/// +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-tooltip.ts b/nvd3/nvd3-test-tooltip.ts new file mode 100644 index 000000000..ee45f9ea7 --- /dev/null +++ b/nvd3/nvd3-test-tooltip.ts @@ -0,0 +1,55 @@ +/// +/// +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})(); + }); + + + // 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" + }]; + } diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts new file mode 100644 index 000000000..0fb9db4ed --- /dev/null +++ b/nvd3/nvd3.d.ts @@ -0,0 +1,252 @@ +// Type definitions for nvd3 1.8.1 +// Project: https://github.com/novus/nvd3 +// Definitions by: Maxime LUCE +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module nv { + +// interface Datum{ +// values: any[], +// key: string, +// color: string +// } + + interface Margin { + left?: number, + right?: number, + top?: number, + bottom?: number + } + + interface Legend extends Chart { + key(): any; + key(value: any): Legend; + align(): boolean; + align(value: boolean): Legend; + maxKeyLength(): number; + maxKeyLength(value: number): Legend; + rightAlign(): boolean; + rightAlign(value: boolean): Legend; + //define how much space between legend items. - recommend 32 for furious version + padding(): number; + //define how much space between legend items. - recommend 32 for furious version + padding(value: number): Legend; + //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): Legend; + //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at + 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): Legend; + expanded(): boolean; + expanded(value: boolean): Legend; + //Options are "classic" and "furious" + vers(): string; + //Options are "classic" and "furious" + vers(value: string): Legend; + } + + /** + *NVD3 extension of D3 Axis + */ + interface NvAxis extends d3.svg.Axis { + (selection: d3.Selection): void; + (selection: d3.Transition): void; + + scale(): any; + scale(scale: any): NvAxis; + + orient(): string; + orient(orientation: string): NvAxis; + + ticks(): any[]; + ticks(...args: any[]): NvAxis; + + tickValues(): any[]; + tickValues(values: any[]): NvAxis; + + tickSize(): number; + tickSize(size: number): NvAxis; + tickSize(inner: number, outer: number): NvAxis; + + innerTickSize(): number; + innerTickSize(size: number): NvAxis; + + outerTickSize(): number; + outerTickSize(size: number): NvAxis; + + tickPadding(): number; + tickPadding(padding: number): NvAxis; + + tickFormat(): (t: any) => string; + tickFormat(format: (t: any) => string): NvAxis; + tickFormat(format:string): NvAxis; + tickFormat(format: (t: any, i: any) => string): NvAxis; + + showMaxMin(value: boolean) : NvAxis; + axisLabel(value: string) : NvAxis; + + } + + interface InteractiveLayer { + tooltip : Tooltip + } + + interface ContentGenerator { + (arg: any) :string + } + + interface Tooltip { + + show([left , top]: [number,number], content: string, gravity: string) //todo sort out use on nv.tooltip. + cleanup():void; //todo sort out use on nv.tooltip. + contentGenerator(): ContentGenerator; + contentGenerator(func: (any) => string): void; + headerFormatter(func: (any)=> string): void; + } + + interface Utils { + windowResize(listener: (ev: Event) => any): void; + } + + interface ChartBase { + update(): void; + interactiveLayer :InteractiveLayer; + + (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 ChartBase { + margin() : Margin; + margin(value: Margin) : TChart; + width(): number; + width(value: number) : TChart; + height(): number; + height(value: number) : TChart; + color(value:string[]) : TChart; + color(value:string) : TChart; + dispatch : d3.Dispatch; + + } + + interface TwoDimensionalChart extends Chart + { + xAxis : NvAxis; + yAxis : NvAxis; + x(func: (any)=> any) : TChart; + y(func: (any)=> any) : TChart; + xScale(scale: d3.time.Scale) : TChart; + xScale() : d3.time.Scale; + yScale(scale: d3.time.Scale) : TChart; + yScale() : d3.time.Scale + forceX([xMin, xMax] : [number,number]) : TChart; + forceY([xMin, xMax] : [number,number]) : TChart; + + } + + interface HistoricalBarBase extends TwoDimensionalChart{ + + + } + + interface HistoricalBar extends HistoricalBarBase{ + + } + + interface HistoricalBarChart extends HistoricalBarBase{ + bars: HistoricalBar; + legend: Legend; + noData(): any //todo; + noData(value: any): HistoricalBarChart //todo; + defaultState(): any //todo; + defaultState(value: any): HistoricalBarChart //todo; + showXAxis(): boolean //todo; + showXAxis(value: boolean): HistoricalBarChart //todo; + showLegend(): boolean //todo; + showLegend(value: boolean): HistoricalBarChart //todo; + showYAxis(): boolean //todo; + showYAxis(value: boolean): HistoricalBarChart //todo; + rightAlignYAxis(): boolean //todo; + rightAlignYAxis(value: boolean): HistoricalBarChart //todo; + useInteractiveGuideline(value : boolean) : HistoricalBarChart; + duration(value: number) : HistoricalBarChart; + interactiveLayer :InteractiveLayer; + } + + + + + + interface BoxPlotChart extends TwoDimensionalChart{ + useInteractiveGuideline(value : boolean) : BoxPlotChart; + duration(value: number) : BoxPlotChart; + + staggerLabels(value : boolean) : BoxPlotChart; + maxBoxWidth(value: number) : BoxPlotChart; + yDomain([xMin, xMax] : [number,number]): BoxPlotChart; + xDomain([xMin, xMax] : [number,number]): BoxPlotChart; + showXAxis(): boolean //todo; + showXAxis(value: boolean): BoxPlotChart //todo; + showYAxis(): boolean //todo; + showYAxis(value: boolean): BoxPlotChart //todo; + rightAlignYAxis(): boolean //todo; + rightAlignYAxis(value: boolean): BoxPlotChart //todo; + } + + interface BulletBase extends Chart { + orient(): string; + orient(orientation: string): TBullet; + tickFormat(): (t: any) => string; + tickFormat(format: (t: any) => string): TBullet; + tickFormat(format:string): NvAxis; + tickFormat(format: (t: any, i: any) => string): TBullet; + forceX([xMin, xMax] : [number,number]) : TBullet; + ranges(): any //todo; + ranges(value: any): TBullet //todo; + markers(): any //todo; + markers(value: any): TBullet //todo; + measures(): any //todo; + measures(value: any): TBullet //todo; + } + + interface Bullet extends BulletBase{ + + } + interface BulletChart extends BulletBase{ + bullet: Bullet + ticks(): any //todo; + ticks(value: any): BulletChart //todo; + noData(): any //todo; + noData(value: any): BulletChart //todo; + } + interface Models{ + historicalBar(): HistoricalBar; + historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; + ohlcBarChart(): HistoricalBarChart; + bullet(): Bullet; + bulletChart(): BulletChart; + boxPlotChart(): BoxPlotChart; + legend(): Legend; + tooltip(): Tooltip; + } + + interface ChartFactory { + generate: ()=> Chart; + callback?: (chart:Chart)=> void; + } + + + interface nvStatic{ + models: Models; + tooltip: Tooltip; + utils: Utils; + addGraph(factory: ChartFactory); + addGraph(generate : ()=> Chart, callBack?: (chart:Chart)=> void) ; + } +} +declare var nv : nv.nvStatic; \ No newline at end of file From 121b2306986710c2d47f4a50e73484f22572be63 Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Tue, 22 Dec 2015 10:43:17 +0000 Subject: [PATCH 010/277] Used This keyword to declare fluent api --- nvd3/nvd3.d.ts | 139 +++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts index 0fb9db4ed..97e1ebf92 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -1,6 +1,6 @@ // Type definitions for nvd3 1.8.1 // Project: https://github.com/novus/nvd3 -// Definitions by: Maxime LUCE +// Definitions by: Peter Mitchell // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -19,29 +19,29 @@ declare module nv { bottom?: number } - interface Legend extends Chart { + interface Legend extends Chart { key(): any; - key(value: any): Legend; + key(value: any): this; align(): boolean; - align(value: boolean): Legend; + align(value: boolean): this; maxKeyLength(): number; - maxKeyLength(value: number): Legend; + maxKeyLength(value: number): this; rightAlign(): boolean; - rightAlign(value: boolean): Legend; + rightAlign(value: boolean): this; //define how much space between legend items. - recommend 32 for furious version padding(): number; //define how much space between legend items. - recommend 32 for furious version - padding(value: number): Legend; + padding(value: number): 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): Legend; + updateState(value: boolean): this; //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at 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): Legend; + radioButtonMode(value: boolean): this; expanded(): boolean; - expanded(value: boolean): Legend; + expanded(value: boolean): this; //Options are "classic" and "furious" vers(): string; //Options are "classic" and "furious" @@ -112,117 +112,118 @@ declare module nv { } interface ChartBase { - update(): void; - interactiveLayer :InteractiveLayer; - (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 ChartBase { + interface Chart { margin() : Margin; - margin(value: Margin) : TChart; + margin(value: Margin) : this; width(): number; - width(value: number) : TChart; + width(value: number) : this; height(): number; - height(value: number) : TChart; - color(value:string[]) : TChart; - color(value:string) : TChart; - dispatch : d3.Dispatch; + height(value: number) : this; + color(value:string[]) : this; + color(value:string) : this; + dispatch: d3.Dispatch; + + update(): void; + interactiveLayer: InteractiveLayer; + + (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 TwoDimensionalChart extends Chart + interface TwoDimensionalChart extends Chart { xAxis : NvAxis; yAxis : NvAxis; - x(func: (any)=> any) : TChart; - y(func: (any)=> any) : TChart; - xScale(scale: d3.time.Scale) : TChart; + x(func: (any)=> any) : this; + y(func: (any) => any): this; + xScale(scale: d3.time.Scale): this; xScale() : d3.time.Scale; - yScale(scale: d3.time.Scale) : TChart; + yScale(scale: d3.time.Scale): this; yScale() : d3.time.Scale - forceX([xMin, xMax] : [number,number]) : TChart; - forceY([xMin, xMax] : [number,number]) : TChart; + forceX([xMin, xMax]: [number, number]): this; + forceY([xMin, xMax]: [number, number]): this; } - interface HistoricalBarBase extends TwoDimensionalChart{ + interface HistoricalBarBase extends TwoDimensionalChart{ } - interface HistoricalBar extends HistoricalBarBase{ + interface HistoricalBar extends HistoricalBarBase{ } - interface HistoricalBarChart extends HistoricalBarBase{ + interface HistoricalBarChart extends HistoricalBarBase{ bars: HistoricalBar; legend: Legend; noData(): any //todo; - noData(value: any): HistoricalBarChart //todo; + noData(value: any): this //todo; defaultState(): any //todo; - defaultState(value: any): HistoricalBarChart //todo; + defaultState(value: any): this //todo; showXAxis(): boolean //todo; - showXAxis(value: boolean): HistoricalBarChart //todo; + showXAxis(value: boolean): this //todo; showLegend(): boolean //todo; - showLegend(value: boolean): HistoricalBarChart //todo; + showLegend(value: boolean): this //todo; showYAxis(): boolean //todo; - showYAxis(value: boolean): HistoricalBarChart //todo; + showYAxis(value: boolean): this //todo; rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): HistoricalBarChart //todo; - useInteractiveGuideline(value : boolean) : HistoricalBarChart; - duration(value: number) : HistoricalBarChart; - interactiveLayer :InteractiveLayer; + rightAlignYAxis(value: boolean): this //todo; + useInteractiveGuideline(value: boolean): this; + duration(value: number): this; } - interface BoxPlotChart extends TwoDimensionalChart{ - useInteractiveGuideline(value : boolean) : BoxPlotChart; - duration(value: number) : BoxPlotChart; + interface BoxPlotChart extends TwoDimensionalChart{ + useInteractiveGuideline(value : boolean) : this; + duration(value: number): this; - staggerLabels(value : boolean) : BoxPlotChart; - maxBoxWidth(value: number) : BoxPlotChart; - yDomain([xMin, xMax] : [number,number]): BoxPlotChart; - xDomain([xMin, xMax] : [number,number]): BoxPlotChart; + staggerLabels(value: boolean): this; + maxBoxWidth(value: number): this; + yDomain([xMin, xMax]: [number, number]): this; + xDomain([xMin, xMax]: [number, number]): this; showXAxis(): boolean //todo; - showXAxis(value: boolean): BoxPlotChart //todo; + showXAxis(value: boolean): this //todo; showYAxis(): boolean //todo; - showYAxis(value: boolean): BoxPlotChart //todo; + showYAxis(value: boolean): this //todo; rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): BoxPlotChart //todo; + rightAlignYAxis(value: boolean): this //todo; } - interface BulletBase extends Chart { + interface BulletBase extends Chart { orient(): string; - orient(orientation: string): TBullet; + orient(orientation: string): this; tickFormat(): (t: any) => string; - tickFormat(format: (t: any) => string): TBullet; + tickFormat(format: (t: any) => string): this; tickFormat(format:string): NvAxis; - tickFormat(format: (t: any, i: any) => string): TBullet; - forceX([xMin, xMax] : [number,number]) : TBullet; + tickFormat(format: (t: any, i: any) => string): this; + forceX([xMin, xMax]: [number, number]): this; ranges(): any //todo; - ranges(value: any): TBullet //todo; + ranges(value: any): this //todo; markers(): any //todo; - markers(value: any): TBullet //todo; + markers(value: any): this //todo; measures(): any //todo; - measures(value: any): TBullet //todo; + measures(value: any): this //todo; } - interface Bullet extends BulletBase{ + interface Bullet extends BulletBase{ } - interface BulletChart extends BulletBase{ + interface BulletChart extends BulletBase{ bullet: Bullet ticks(): any //todo; - ticks(value: any): BulletChart //todo; + ticks(value: any): this //todo; noData(): any //todo; - noData(value: any): BulletChart //todo; + noData(value: any): this //todo; } interface Models{ historicalBar(): HistoricalBar; @@ -235,9 +236,9 @@ declare module nv { tooltip(): Tooltip; } - interface ChartFactory { - generate: ()=> Chart; - callback?: (chart:Chart)=> void; + interface ChartFactory { + generate: () => TChart; + callback?: (chart: TChart)=> void; } @@ -245,8 +246,8 @@ declare module nv { models: Models; tooltip: Tooltip; utils: Utils; - addGraph(factory: ChartFactory); - addGraph(generate : ()=> Chart, callBack?: (chart:Chart)=> void) ; + addGraph(factory: ChartFactory); + addGraph(generate: () => TChart, callBack?: (chart: TChart)=> void) ; } } declare var nv : nv.nvStatic; \ No newline at end of file From 2c1ee425b67491d70b83b21c832472afec846203 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 29 Dec 2015 08:33:34 +0100 Subject: [PATCH 011/277] add properties ngDialogData and ngDialogId to the scope --- ng-dialog/ng-dialog.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index 1eb1a1f8d..c2444b984 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -79,6 +79,17 @@ 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 : {}; + + /** + * The id of the dialog. If you you ngDialogData, it'll be also available under ngDialogData.ngDialogId + */ + ngDialogId : string; } interface IDialogOpenConfirmScope extends IDialogOpenScope { From 5b9222c0d6e81679087d6e5538895d39324f5ea6 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 29 Dec 2015 13:31:42 +0100 Subject: [PATCH 012/277] change space to tab indent --- ng-dialog/ng-dialog.d.ts | 416 +++++++++++++++++++-------------------- 1 file changed, 208 insertions(+), 208 deletions(-) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index c2444b984..f7ebf7d7e 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -7,250 +7,250 @@ declare module angular.dialog { - /* - * Everytime ngDialog is opened or closed we're broadcasting three events - * (dispatching events downwards to all child scopes): - * - * for more info see: https://github.com/likeastore/ngDialog#events - */ - export const EVENT_OPENEND:string = 'ngDialog.opened'; - export const EVENT_CLOSING:string = 'ngDialog.closing'; - export const EVENT_CLOSED:string = 'ngDialog.closed'; + /* + * Everytime ngDialog is opened or closed we're broadcasting three events + * (dispatching events downwards to all child scopes): + * + * for more info see: https://github.com/likeastore/ngDialog#events + */ + export const EVENT_OPENEND:string = 'ngDialog.opened'; + export const EVENT_CLOSING:string = 'ngDialog.closing'; + export const EVENT_CLOSED:string = 'ngDialog.closed'; - interface IDialogService { - getDefaults(): IDialogOptions; - open(options:IDialogOpenOptions): IDialogOpenResult; - openConfirm(options:IDialogOpenConfirmOptions): IPromise; + interface IDialogService { + getDefaults(): IDialogOptions; + open(options:IDialogOpenOptions): IDialogOpenResult; + openConfirm(options:IDialogOpenConfirmOptions): IPromise; - /** - * Determine whether the specified dialog is open or not. - * @param id Dialog id to check for. - * @returns {boolean} Indicating whether it exists or not. - */ - isOpen(id:string): boolean; - close(id:string, value?:any): void; - closeAll(value?:any): void; - getOpenDialogs(): string[]; - } + /** + * Determine whether the specified dialog is open or not. + * @param id Dialog id to check for. + * @returns {boolean} Indicating whether it exists or not. + */ + isOpen(id:string): boolean; + close(id:string, value?:any): void; + closeAll(value?:any): void; + getOpenDialogs(): string[]; + } - interface IDialogOpenResult { - id: string; - close: (value?:any) => void; - closePromise: IPromise; - } + interface IDialogOpenResult { + id: string; + close: (value?:any) => void; + closePromise: IPromise; + } - interface IDialogClosePromise { - id: string; - value: any; - } + interface IDialogClosePromise { + id: string; + value: any; + } - interface IDialogProvider extends angular.IServiceProvider { - /** - * Default options for the dialogs. - * @param defaultOptions - * @returns {} - */ - setDefaults(defaultOptions:IDialogOptions): void; + interface IDialogProvider extends angular.IServiceProvider { + /** + * Default options for the dialogs. + * @param defaultOptions + * @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 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; - } + /** + * 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; + } - /** - * Dialog Scope which extends the $scope. - */ - interface IDialogOpenScope extends angular.IScope { - /** - * This allows you to close dialog straight from handler in a popup element. - * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog. - * For dialogs opened with the openConfirm() method the value is used as the reject reason. - */ - closeThisDialog(value?:any): void; + /** + * Dialog Scope which extends the $scope. + */ + interface IDialogOpenScope extends angular.IScope { + /** + * This allows you to close dialog straight from handler in a popup element. + * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this 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 : {}; + /** + * 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 : {}; - /** - * The id of the dialog. If you you ngDialogData, it'll be also available under ngDialogData.ngDialogId - */ - ngDialogId : string; - } + /** + * The id of the dialog. If you you ngDialogData, it'll be also available under ngDialogData.ngDialogId + */ + ngDialogId : string; + } - interface IDialogOpenConfirmScope extends IDialogOpenScope { - /** - * 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) - } + interface IDialogOpenConfirmScope extends IDialogOpenScope { + /** + * 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) + } - interface IDialogOptions { - /** - * This option allows you to control the dialog's look, you can use built-in themes or create your own styled modals. - * It will be appended with the "ngdialog" class e.g. className is "default-theme flat-ui" it will be class="ngdialog default-theme flat-ui". - */ - className?: string; + interface IDialogOptions { + /** + * This option allows you to control the dialog's look, you can use built-in themes or create your own styled modals. + * It will be appended with the "ngdialog" class e.g. className is "default-theme flat-ui" it will be class="ngdialog default-theme flat-ui". + */ + className?: string; - /** - * If true then animation for the dialog will be disabled, default false. - */ - disableAnimation?: boolean; + /** + * If true then animation for the dialog will be disabled, default false. + */ + disableAnimation?: boolean; - /** - * If false it allows to hide overlay div behind the modals, default true. - */ - overlay?: boolean; + /** + * If false it allows to hide overlay div behind the modals, default true. + */ + overlay?: boolean; - /** - * If false it allows to hide close button on modals, default true. - */ - showClose?: boolean; + /** + * If false it allows to hide close button on modals, default true. + */ + showClose?: boolean; - /** - * It allows to close modals by clicking Esc button, default true. - * This will close all open modals if there several of them open at the same time. - */ - closeByEscape?: boolean; + /** + * It allows to close modals by clicking Esc button, default true. + * This will close all open modals if there several of them open at the same time. + */ + closeByEscape?: boolean; - /** - * It allows to close modals by clicking on overlay background, default true. If @see Hammer.js is loaded, it will listen for tap instead of click. - */ - closeByDocument?: boolean; + /** + * It allows to close modals by clicking on overlay background, default true. If @see Hammer.js is loaded, it will listen for tap instead of click. + */ + closeByDocument?: boolean; - /** - * default : false - */ - closeByNavigation?: boolean; + /** + * default : false + */ + closeByNavigation?: boolean; - /** - * If true allows to use plain string as template, default false. - */ - plain?: boolean; + /** + * If true allows to use plain string as template, default false. + */ + plain?: boolean; - /** - * Give a name for a dialog instance. It is useful for identifying specific dialog if there are multiple dialog boxes opened. - */ - name?: string | number; + /** + * Give a name for a dialog instance. It is useful for identifying specific dialog if there are multiple dialog boxes opened. + */ + 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; + /** + * 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; + /** + * 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; + /** + * 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, 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, 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; + /** + * 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 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 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 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 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; - } + /** + * 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; + } - /** - * Options which are provided to open a dialog. - */ - interface IDialogOpenOptions extends IDialogOptions { - template: string; - controller?: string| any[] | any; - controllerAs?: string; + /** + * Options which are provided to open a dialog. + */ + interface IDialogOpenOptions extends IDialogOptions { + template: string; + 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?: IDialogOpenScope; + /** + * 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?: IDialogOpenScope; - /** - * 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. - */ - resolve? : {[key : string] : string | Function}; + /** + * 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. + */ + 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[]; - } + /** + * 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? : IDialogOpenConfirmScope; - } + interface IDialogOpenConfirmOptions extends IDialogOpenOptions { + scope? : IDialogOpenConfirmScope; + } } From 9ad3cd157a7e1b2862c14ec9b36467e78cc7f0db Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 29 Dec 2015 13:37:41 +0100 Subject: [PATCH 013/277] updated formatting to keep existing style --- ng-dialog/ng-dialog-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts index ae2586b1a..3e5732cfd 100644 --- a/ng-dialog/ng-dialog-tests.ts +++ b/ng-dialog/ng-dialog-tests.ts @@ -39,7 +39,7 @@ class DialogTestController { class LoginDialogController { - constructor($scope:angular.dialog.IDialogOpenScope) { + constructor($scope: angular.dialog.IDialogOpenScope) { $scope.closeThisDialog("bye"); } From cb003bb9a1bef7a0651d0d937f5d41d5dc06bff9 Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 29 Dec 2015 13:42:44 +0100 Subject: [PATCH 014/277] updated formatting to keep existing style --- ng-dialog/ng-dialog.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index f7ebf7d7e..f7934aa1f 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -28,15 +28,15 @@ declare module angular.dialog { * @param id Dialog id to check for. * @returns {boolean} Indicating whether it exists or not. */ - isOpen(id:string): boolean; - close(id:string, value?:any): void; - closeAll(value?:any): void; + isOpen(id: string): boolean; + close(id: string, value?: any): void; + closeAll(value?: any): void; getOpenDialogs(): string[]; } interface IDialogOpenResult { id: string; - close: (value?:any) => void; + close: (value?: any) => void; closePromise: IPromise; } @@ -51,14 +51,14 @@ declare module angular.dialog { * @param defaultOptions * @returns {} */ - setDefaults(defaultOptions:IDialogOptions): void; + 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; + setForceHtmlReload(force: boolean) : void; /** * Adds additional listener on every $locationChangeSuccess event and gets updated version of body into dialog. @@ -66,7 +66,7 @@ declare module angular.dialog { * config as provider instance: * @param {boolean} force */ - setForceBodyReload(force:boolean) : void; + setForceBodyReload(force: boolean) : void; } /** @@ -78,7 +78,7 @@ declare module angular.dialog { * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog. * For dialogs opened with the openConfirm() method the value is used as the reject reason. */ - closeThisDialog(value?:any): void; + closeThisDialog(value?: any): void; /** * Any serializable data that you want to be stored in the controller's dialog scope. @@ -99,7 +99,7 @@ declare module angular.dialog { * 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) + confirm(value?: any) } interface IDialogOptions { @@ -163,13 +163,13 @@ declare module angular.dialog { /** * Pass false to disable template caching. Useful for developing purposes, default is true. */ - cache? : boolean; + 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; + appendTo?: string; /** * When true, ensures that the focused element remains within the dialog to conform to accessibility recommendations. @@ -181,7 +181,7 @@ declare module angular.dialog { * When true, closing the dialog restores focus to the element that launched it. Designed to improve keyboard * accessibility. Default value is true */ - preserveFocus? : boolean; + preserveFocus?: boolean; /** * When true, automatically selects appropriate values for any unspecified accessibility attributes. Default value is true @@ -191,7 +191,7 @@ declare module angular.dialog { /** * Specifies the value for the role attribute that should be applied to the dialog element. Default value is null (unspecified) */ - ariaRole? : string; + ariaRole?: string; /** * Specifies the value for the aria-labelledby attribute that should be applied to the dialog element. @@ -241,16 +241,16 @@ declare module angular.dialog { * are promises, ngDialog will wait for them all to be resolved or one to be rejected before the controller * is instantiated. */ - resolve? : {[key : string] : string | Function}; + 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[]; + data?: string | {} | any[]; } interface IDialogOpenConfirmOptions extends IDialogOpenOptions { - scope? : IDialogOpenConfirmScope; + scope?: IDialogOpenConfirmScope; } } From 3f9ca14fce6e808e4053e441807909fce1d2184a Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Tue, 29 Dec 2015 13:43:48 +0100 Subject: [PATCH 015/277] updated formatting to keep existing style --- ng-dialog/ng-dialog.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index f7934aa1f..9c1b9b48b 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -20,8 +20,8 @@ declare module angular.dialog { interface IDialogService { getDefaults(): IDialogOptions; - open(options:IDialogOpenOptions): IDialogOpenResult; - openConfirm(options:IDialogOpenConfirmOptions): IPromise; + open(options: IDialogOpenOptions): IDialogOpenResult; + openConfirm(options: IDialogOpenConfirmOptions): IPromise; /** * Determine whether the specified dialog is open or not. From 0ed7440a06c209281431c48afa71c6888d3efd8b Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Wed, 30 Dec 2015 16:04:30 +0000 Subject: [PATCH 016/277] Redid definitions based on Docs. Definition WIP (parallelCoordinates) --- nvd3/nvd-test-bullet.ts | 46 - nvd3/nvd-test-bulletChart.ts | 72 - nvd3/nvd3-test-bullet.ts | 47 + nvd3/nvd3-test-bulletChart.ts | 73 + nvd3/nvd3-test-candlestick.ts | 90 + nvd3/nvd3-test-candlestickChart.ts | 108 + nvd3/nvd3-test-cumulativeLineChart.ts | 75 + nvd3/nvd3-test-discreteBarChart.ts | 60 + nvd3/nvd3-test-donutChart.ts | 93 + nvd3/nvd3-test-furiousLegend.ts | 72 + nvd3/nvd3-test-legend.ts | 110 +- nvd3/nvd3-test-line.ts | 71 + nvd3/nvd3-test-lineChart.ts | 103 + nvd3/nvd3-test-lineChartLogScale.ts | 67 + nvd3/nvd3-test-lineChartSVGResize.ts | 108 + nvd3/nvd3-test-linePlusBarChart.ts | 47 + nvd3/nvd3-test-lineWithFocusChart.ts | 33 + ...nvd3-test-lineWithFocusChartx2AxisLabel.ts | 36 + nvd3/nvd3-test-monitoringChart.ts | 135 + nvd3/nvd3-test-multiChart.ts | 53 + nvd3/nvd3-test-multibarChart.ts | 69 + nvd3/nvd3-test-multibarChart2.ts | 47 + nvd3/nvd3-test-multibarHorizontalChart.ts | 159 + nvd3/nvd3-test-ohlc.ts | 192 ++ nvd3/nvd3-test-ohlcChart.ts | 62 +- nvd3/nvd3-test-parallelCoordinates.ts | 47 + nvd3/nvd3-test-parallelCoordinatesChart.ts | 186 ++ nvd3/nvd3-test-scatter.ts | 35 + nvd3/nvd3-test-tooltip.ts | 100 +- nvd3/nvd3.d.ts | 2921 +++++++++++++++-- 30 files changed, 4860 insertions(+), 457 deletions(-) delete mode 100644 nvd3/nvd-test-bullet.ts delete mode 100644 nvd3/nvd-test-bulletChart.ts create mode 100644 nvd3/nvd3-test-bullet.ts create mode 100644 nvd3/nvd3-test-bulletChart.ts create mode 100644 nvd3/nvd3-test-candlestick.ts create mode 100644 nvd3/nvd3-test-candlestickChart.ts create mode 100644 nvd3/nvd3-test-cumulativeLineChart.ts create mode 100644 nvd3/nvd3-test-discreteBarChart.ts create mode 100644 nvd3/nvd3-test-donutChart.ts create mode 100644 nvd3/nvd3-test-furiousLegend.ts create mode 100644 nvd3/nvd3-test-line.ts create mode 100644 nvd3/nvd3-test-lineChart.ts create mode 100644 nvd3/nvd3-test-lineChartLogScale.ts create mode 100644 nvd3/nvd3-test-lineChartSVGResize.ts create mode 100644 nvd3/nvd3-test-linePlusBarChart.ts create mode 100644 nvd3/nvd3-test-lineWithFocusChart.ts create mode 100644 nvd3/nvd3-test-lineWithFocusChartx2AxisLabel.ts create mode 100644 nvd3/nvd3-test-monitoringChart.ts create mode 100644 nvd3/nvd3-test-multiChart.ts create mode 100644 nvd3/nvd3-test-multibarChart.ts create mode 100644 nvd3/nvd3-test-multibarChart2.ts create mode 100644 nvd3/nvd3-test-multibarHorizontalChart.ts create mode 100644 nvd3/nvd3-test-ohlc.ts create mode 100644 nvd3/nvd3-test-parallelCoordinates.ts create mode 100644 nvd3/nvd3-test-parallelCoordinatesChart.ts create mode 100644 nvd3/nvd3-test-scatter.ts diff --git a/nvd3/nvd-test-bullet.ts b/nvd3/nvd-test-bullet.ts deleted file mode 100644 index 7ec2363e0..000000000 --- a/nvd3/nvd-test-bullet.ts +++ /dev/null @@ -1,46 +0,0 @@ -/// -/// - -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/nvd-test-bulletChart.ts b/nvd3/nvd-test-bulletChart.ts deleted file mode 100644 index eb727589e..000000000 --- a/nvd3/nvd-test-bulletChart.ts +++ /dev/null @@ -1,72 +0,0 @@ -/// -/// - -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-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-legend.ts b/nvd3/nvd3-test-legend.ts index 81f39d2da..99f4de2b7 100644 --- a/nvd3/nvd3-test-legend.ts +++ b/nvd3/nvd3-test-legend.ts @@ -1,67 +1,69 @@ /// /// -var width = 500, - height = 20; +module nvd3_test_legend { + var width = 500, + height = 20; - var legend = nv.models.legend(); + var legend = nv.models.legend(); - d3.select('#test1') - .attr('width', width) - .attr('height', height) - .datum(sinAndCos()); + d3.select('#test1') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()); - var legend2 = nv.models.legend() - .align(false); + var legend2 = nv.models.legend() + .align(false); - d3.select('#test2') - .attr('width', width) - .attr('height', height) - .datum(sinAndCos()).call(legend2); + d3.select('#test2') + .attr('width', width) + .attr('height', height) + .datum(sinAndCos()).call(legend2); - var legend3 = nv.models.legend() - .width(900) - .padding(70); + var legend3 = nv.models.legend() + .width(900) + .padding(70); - d3.select('#test3') - .attr('width', 900) - .attr('height', 200) - .datum(sinAndCos()).call(legend3); + d3.select('#test3') + .attr('width', 900) + .attr('height', 200) + .datum(sinAndCos()).call(legend3); - var update = function() { - d3.select('#test1').call(legend); - } + var update = function () { + d3.select('#test1').call(legend); + } - update(); - legend.dispatch.on('stateChange', function(d) { - console.log(d); - update(); - }); + update(); + legend.dispatch.on('stateChange', function (d) { + console.log(d); + update(); + }); - d3.select('#changeData').on('click', function() { - d3.select('#test1') - .datum(differentData()) - .call(legend); - }); + 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 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"} - ]; - } + 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 index b62027f63..b9d5d3560 100644 --- a/nvd3/nvd3-test-ohlcChart.ts +++ b/nvd3/nvd3-test-ohlcChart.ts @@ -1,36 +1,40 @@ /// /// -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}); +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 } + ] + }]; - // 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))); - }); + 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.yAxis - .axisLabel('Stock Price') - .tickFormat(function(d,i){ return '$' + d3.format(',.1f')(d); }); + // 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 + 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-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-tooltip.ts b/nvd3/nvd3-test-tooltip.ts index ee45f9ea7..24a090922 100644 --- a/nvd3/nvd3-test-tooltip.ts +++ b/nvd3/nvd3-test-tooltip.ts @@ -1,55 +1,59 @@ /// /// -var width = 500, - height = 20; +module nvd3_test_tooltip { + var width = 500, + height = 20; - var tooltip = nv.models.tooltip(); - tooltip.duration(0); + 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})(); - }); + 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; - }); + // 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" - }]; - } + 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 index 97e1ebf92..7e462248c 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -5,249 +5,2754 @@ /// declare module nv { - -// interface Datum{ -// values: any[], -// key: string, -// color: string -// } - +//#region Chart Component interface Margin { left?: number, right?: number, top?: number, bottom?: number } - - interface Legend extends Chart { - key(): any; - key(value: any): this; - align(): boolean; - align(value: boolean): this; - maxKeyLength(): number; - maxKeyLength(value: number): this; - rightAlign(): boolean; - rightAlign(value: boolean): this; - //define how much space between legend items. - recommend 32 for furious version - padding(): number; - //define how much space between legend items. - recommend 32 for furious version - padding(value: number): 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; - //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at - 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; - expanded(): boolean; - expanded(value: boolean): this; - //Options are "classic" and "furious" - vers(): string; - //Options are "classic" and "furious" - vers(value: string): Legend; - } - - /** - *NVD3 extension of D3 Axis - */ - interface NvAxis extends d3.svg.Axis { - (selection: d3.Selection): void; - (selection: d3.Transition): void; - scale(): any; - scale(scale: any): NvAxis; + interface Size { + height: number; + width: number; + } - orient(): string; - orient(orientation: string): NvAxis; + interface Offset { + left?: number; + top?: number; + } - ticks(): any[]; - ticks(...args: any[]): NvAxis; - - tickValues(): any[]; - tickValues(values: any[]): NvAxis; - - tickSize(): number; - tickSize(size: number): NvAxis; - tickSize(inner: number, outer: number): NvAxis; - - innerTickSize(): number; - innerTickSize(size: number): NvAxis; - - outerTickSize(): number; - outerTickSize(size: number): NvAxis; - - tickPadding(): number; - tickPadding(padding: number): NvAxis; - - tickFormat(): (t: any) => string; - tickFormat(format: (t: any) => string): NvAxis; - tickFormat(format:string): NvAxis; - tickFormat(format: (t: any, i: any) => string): NvAxis; - - showMaxMin(value: boolean) : NvAxis; - axisLabel(value: string) : NvAxis; - - } - - interface InteractiveLayer { - tooltip : Tooltip - } - - interface ContentGenerator { - (arg: any) :string - } - - interface Tooltip { - - show([left , top]: [number,number], content: string, gravity: string) //todo sort out use on nv.tooltip. - cleanup():void; //todo sort out use on nv.tooltip. - contentGenerator(): ContentGenerator; - contentGenerator(func: (any) => string): void; - headerFormatter(func: (any)=> string): void; - } - - interface Utils { - windowResize(listener: (ev: Event) => any): void; - } - - interface ChartBase { - - } - - interface Chart { - margin() : Margin; - margin(value: Margin) : this; - width(): number; - width(value: number) : this; - height(): number; - height(value: number) : this; - color(value:string[]) : this; - color(value:string) : this; + interface State { dispatch: d3.Dispatch; + } + interface InteractiveLayer { + tooltip: Tooltip + } + + interface Nvd3Element { + dispatch: d3.Dispatch; + options(options: any) update(): void; - interactiveLayer: InteractiveLayer; - (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 TwoDimensionalChart extends Chart - { - xAxis : NvAxis; - yAxis : NvAxis; - x(func: (any)=> any) : this; - y(func: (any) => any): this; - xScale(scale: d3.time.Scale): this; - xScale() : d3.time.Scale; - yScale(scale: d3.time.Scale): this; - yScale() : d3.time.Scale - forceX([xMin, xMax]: [number, number]): this; - forceY([xMin, xMax]: [number, number]): this; - - } - - interface HistoricalBarBase extends TwoDimensionalChart{ - - - } - - interface HistoricalBar extends HistoricalBarBase{ - - } - - interface HistoricalBarChart extends HistoricalBarBase{ - bars: HistoricalBar; - legend: Legend; - noData(): any //todo; - noData(value: any): this //todo; - defaultState(): any //todo; - defaultState(value: any): this //todo; - showXAxis(): boolean //todo; - showXAxis(value: boolean): this //todo; - showLegend(): boolean //todo; - showLegend(value: boolean): this //todo; - showYAxis(): boolean //todo; - showYAxis(value: boolean): this //todo; - rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): this //todo; - useInteractiveGuideline(value: boolean): this; - duration(value: number): this; - } - - - + interface Chart extends Nvd3Element { + state: State; + interactiveLayer: InteractiveLayer; + + } + //#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 BoxPlotChart extends TwoDimensionalChart{ - useInteractiveGuideline(value : boolean) : this; + /** + *NVD3 extension of D3 Axis + */ + 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; - - staggerLabels(value: boolean): this; - maxBoxWidth(value: number): this; - yDomain([xMin, xMax]: [number, number]): this; - xDomain([xMin, xMax]: [number, number]): this; - showXAxis(): boolean //todo; - showXAxis(value: boolean): this //todo; - showYAxis(): boolean //todo; - showYAxis(value: boolean): this //todo; - rightAlignYAxis(): boolean //todo; - rightAlignYAxis(value: boolean): this //todo; - } - - interface BulletBase extends Chart { - orient(): string; - orient(orientation: string): this; - tickFormat(): (t: any) => string; + /*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): NvAxis; - tickFormat(format: (t: any, i: any) => string): this; - forceX([xMin, xMax]: [number, number]): this; - ranges(): any //todo; - ranges(value: any): this //todo; - markers(): any //todo; - markers(value: any): this //todo; - measures(): any //todo; - measures(value: any): this //todo; + 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 Bullet extends BulletBase{ - + 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(): number; + 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; + } + + 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(): number; + id(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; + 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) => 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) => 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) => 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(): number; + id(value: number): 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) => 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) => 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) => 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(): number; + id(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; + 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) => 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) => 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) => 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 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(): number; + id(value: number): 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) => 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) => 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) => 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 Scatter 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; + /*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(): number; + id(value: number): 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) => 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) => 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) => 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; + clearHighlights(): 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; + /**/ + highlightPoint(): (d: any) => boolean; + /**/ + highlightPoint(func: (d: any) => 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(): number; + id(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; + /*.*/ + 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) => 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) => 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) => 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(): number; + id(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; + /*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) => 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) => 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) => 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(): number; + id(value: number): 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) => 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) => 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) => 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; + } +//#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(): number; + id(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; + 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) => 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) => 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) => 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 BulletBase{ - bullet: Bullet - ticks(): any //todo; - ticks(value: any): this //todo; - noData(): any //todo; - noData(value: any): this //todo; + + 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 Models{ + + 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(): number; + id(value: number): 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) => 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) => 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) => 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(): number; + id(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; + 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) => 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) => 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) => 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(): number; + id(value: number): 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) => 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) => 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) => 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; + + 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(): number; + id(value: number): 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) => 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) => 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) => 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(): number; + id(value: number): 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) => 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) => 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) => 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(): number; + id(value: number): 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) => 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) => 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; + 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(): number; + id(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; + 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) => 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) => 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) => 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(): number; + id(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; + 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) => 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) => 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) => 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; + + } + //todo complete + interface MultiChart extends Chart { + lines1: Line; + lines2: Line; + bars1: HistoricalBar; + bars2: HistoricalBar; + stack1: HistoricalBar; + stack2: HistoricalBar; + xAxis: Nvd3Axis; + yAxis1: Nvd3Axis; + yAxis2: 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(): number; + id(value: number): 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) => 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) => 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) => 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 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(): number; + id(value: number): 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) => 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) => 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) => 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; + } + +//#endregion + + + interface Models{ + boxPlotChart(): BoxPlotChart; + bullet(): Bullet; + bulletChart(): BulletChart; + candlestickBar(): CandlestickBar; + candlestickBarChart(): CandlestickBarChart; + cumulativeLineChart(): CumulativeLineChart; + discreteBar(): DiscreteBar; + discreteBarChart(): DiscreteBarChart; historicalBar(): HistoricalBar; - historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; - ohlcBarChart(): HistoricalBarChart; - bullet(): Bullet; - bulletChart(): BulletChart; - boxPlotChart(): BoxPlotChart; - legend(): Legend; + historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; + ohlcBar(): OhlcBar; + ohlcBarChart(): OhlcBarChart; + legend(): Legend; + line(): Line; + lineChart(): LineChart; + linePlusBarChart(): LinePlusBarChart; + lineWithFocusChart(): LineWithFocusChart; + multiBarChart(): MultiBarChart; + multiBarHorizontalChart(): MultiBarHorizontalChart; + parallelCoordinates(): ParallelCoordinates; + parallelCoordinatesChart(): ParallelCoordinatesChart; + scatter(): Scatter; tooltip(): Tooltip; } - - interface ChartFactory { + + interface Utils { + windowResize(listener: (ev: Event) => any): void; + windowSize(): Size; + state(): State; + } + interface ChartFactory { generate: () => TChart; callback?: (chart: TChart)=> void; } - + + interface nvTooltipStatic { + show([left, top]: [number, number], content: string, gravity: string) //todo sort out use on nv.tooltip. + cleanup(): void; //todo sort out use on nv.tooltip. + } interface nvStatic{ models: Models; - tooltip: Tooltip; + tooltip: nvTooltipStatic; utils: Utils; - addGraph(factory: ChartFactory); - addGraph(generate: () => TChart, callBack?: (chart: TChart)=> void) ; + addGraph(factory: ChartFactory); + addGraph(generate: () => TChart, callBack?: (chart: TChart) => void); + log: (topic:string, value?:string)=> void } } declare var nv : nv.nvStatic; \ No newline at end of file From b289c6d249ec45a3cd1696a85c8e66614577be3d Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Wed, 30 Dec 2015 20:51:19 +0000 Subject: [PATCH 017/277] Finished Nvd3 definitions... for now --- nvd3/nvd3-test-pie.ts | 71 ++ nvd3/nvd3-test-pieChart.ts | 110 ++ nvd3/nvd3-test-scatterChart.ts | 66 ++ nvd3/nvd3-test-scatterPlusLineChart.ts | 53 + nvd3/nvd3-test-sparkLine.ts | 27 + nvd3/nvd3-test-sparkLinePlus.ts | 54 + nvd3/nvd3-test-stackArea.ts | 96 ++ nvd3/nvd3-test-stackAreaChart.ts | 79 ++ nvd3/nvd3-test-sunburst.ts | 402 +++++++ nvd3/nvd3-test-timeSeries.ts | 167 +++ nvd3/nvd3.d.ts | 1467 +++++++++++++++++------- 11 files changed, 2155 insertions(+), 437 deletions(-) create mode 100644 nvd3/nvd3-test-pie.ts create mode 100644 nvd3/nvd3-test-pieChart.ts create mode 100644 nvd3/nvd3-test-scatterChart.ts create mode 100644 nvd3/nvd3-test-scatterPlusLineChart.ts create mode 100644 nvd3/nvd3-test-sparkLine.ts create mode 100644 nvd3/nvd3-test-sparkLinePlus.ts create mode 100644 nvd3/nvd3-test-stackArea.ts create mode 100644 nvd3/nvd3-test-stackAreaChart.ts create mode 100644 nvd3/nvd3-test-sunburst.ts create mode 100644 nvd3/nvd3-test-timeSeries.ts 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-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.d.ts b/nvd3/nvd3.d.ts index 7e462248c..19c03d6dc 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -5,7 +5,8 @@ /// declare module nv { -//#region Chart Component + +//#region Core Interfaces interface Margin { left?: number, right?: number, @@ -18,6 +19,11 @@ declare module nv { width: number; } + interface ArcsRadius { + inner: number; + outer: number; + } + interface Offset { left?: number; top?: number; @@ -31,6 +37,34 @@ declare module nv { 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) //todo sort out use on nv.tooltip. + cleanup(): void; //todo sort out use on nv.tooltip. + } + interface Nvd3Element { dispatch: d3.Dispatch; options(options: any) @@ -42,12 +76,13 @@ declare module nv { } interface Chart extends Nvd3Element { - state: State; interactiveLayer: InteractiveLayer; - } - //#region Chart Component + +//#endregion + +//#region Chart Component interface Legend extends Nvd3Element { align(): boolean; @@ -91,9 +126,6 @@ declare module nv { width(value: number): this; } - /** - *NVD3 extension of D3 Axis - */ interface Nvd3Axis extends d3.svg.Axis { axisLabel(): string; axisLabel(value: string): this; @@ -148,78 +180,6 @@ declare module nv { /*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(): number; - 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; - } interface BoxPlot extends Nvd3Element { /*Colors to use for the different data. If an array is given, it is converted to a function automatically.*/ @@ -234,8 +194,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -247,9 +207,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -339,8 +299,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(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.*/ @@ -360,9 +320,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -409,8 +369,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -430,9 +390,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -462,6 +422,32 @@ declare module nv { 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; @@ -487,8 +473,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -506,9 +492,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -538,140 +524,12 @@ declare module nv { yScale(value: any): this; } - interface Scatter 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; - /*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(): number; - id(value: number): 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) => 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) => 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) => 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; - clearHighlights(): 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; - /**/ - highlightPoint(): (d: any) => boolean; - /**/ - highlightPoint(func: (d: any) => 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:*/ @@ -681,9 +539,7 @@ declare module nv { /*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; - - + isArea(func: (d: any) => boolean): this; } interface MultiBar extends Nvd3Element { @@ -723,8 +579,8 @@ declare module nv { hideable(): boolean; /**/ hideable(value: boolean): this; - id(): number; - id(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.*/ @@ -750,9 +606,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -811,8 +667,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -850,9 +706,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -911,8 +767,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(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.*/ @@ -932,9 +788,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1000,6 +856,457 @@ declare module nv { /*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); + yTickFormat(format: (d: any) => string): this; + yTickFormat(format: string): this; + yTickFormat(format: (d: any, i: any) => string); + } + + 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 @@ -1021,8 +1328,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -1060,9 +1367,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1182,8 +1489,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(value: number): this; + id(): any; + id(value: number|string): this; 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.*/ @@ -1233,9 +1540,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1295,8 +1602,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -1342,9 +1649,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1408,8 +1715,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -1456,9 +1763,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1493,6 +1800,7 @@ declare module nv { xAxis: Nvd3Axis; yAxis: Nvd3Axis; legend: Legend; + tooltip: Tooltip; clearHighlights(): this; /*If true, masks lines within the X and Y scales using a clip-path*/ @@ -1543,8 +1851,8 @@ declare module nv { highlightPoint(): (d: any) => boolean; /**/ highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(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.*/ @@ -1636,9 +1944,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1741,8 +2049,8 @@ declare module nv { highlightPoint(): (d: any) => boolean; /**/ highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(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.*/ @@ -1830,9 +2138,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -1927,8 +2235,8 @@ declare module nv { highlightPoint(): (d: any) => boolean; /**/ highlightPoint(func: (d: any) => boolean): this; - id(): number; - id(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.*/ @@ -2007,9 +2315,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -2099,8 +2407,8 @@ declare module nv { hideable(): boolean; /**/ hideable(value: boolean): this; - id(): number; - id(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.*/ @@ -2166,9 +2474,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -2243,8 +2551,8 @@ declare module nv { height(): number; /*The height the graph or component created inside the SVG should be made.*/ height(value: number): this; - id(): number; - id(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.*/ @@ -2295,9 +2603,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -2331,84 +2639,25 @@ declare module nv { yScale(value: any): this; } - //todo complete + interface MultiChart extends Chart { lines1: Line; lines2: Line; - bars1: HistoricalBar; - bars2: HistoricalBar; - stack1: HistoricalBar; - stack2: HistoricalBar; + bars1: MultiBar; + bars2: MultiBar; + scatters1: Scatter; + scatters2: Scatter; + stack1: StackedArea; + stack2: StackedArea; xAxis: Nvd3Axis; yAxis1: Nvd3Axis; yAxis2: 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(): number; - id(value: number): 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:*/ @@ -2419,58 +2668,16 @@ declare module nv { 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.*/ @@ -2479,10 +2686,6 @@ declare module nv { 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.*/ @@ -2492,36 +2695,21 @@ declare module nv { /*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) => number; + 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) => number): this; + 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; + /* */ + yDomain1(): number[]; + /* */ + yDomain1(value: number[]): this; + /* */ + yDomain2(): number[]; + /* */ + yDomain2(value: number[]): this; } interface OhlcBarChart extends Chart { @@ -2563,8 +2751,8 @@ declare module nv { height(value: number): this; high(): (d: any) => number; high(func: (d: any) => number): this; - id(): number; - id(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.*/ @@ -2614,9 +2802,9 @@ declare module nv { /*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) => number; + 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) => number): this; + 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.*/ @@ -2702,8 +2890,406 @@ declare module nv { width(value: number): this; } -//#endregion - + 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; @@ -2714,6 +3300,7 @@ declare module nv { cumulativeLineChart(): CumulativeLineChart; discreteBar(): DiscreteBar; discreteBarChart(): DiscreteBarChart; + distribution(): Distribution; historicalBar(): HistoricalBar; historicalBarChart(bar_model?: HistoricalBar): HistoricalBarChart; ohlcBar(): OhlcBar; @@ -2725,34 +3312,40 @@ declare module nv { 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 Utils { - windowResize(listener: (ev: Event) => any): void; - windowSize(): Size; - state(): State; - } - interface ChartFactory { - generate: () => TChart; - callback?: (chart: TChart)=> void; - } + 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; - interface nvTooltipStatic { - show([left, top]: [number, number], content: string, gravity: string) //todo sort out use on nv.tooltip. - cleanup(): void; //todo sort out use on nv.tooltip. - } - - interface nvStatic{ - models: Models; - tooltip: nvTooltipStatic; - utils: Utils; addGraph(factory: ChartFactory); addGraph(generate: () => TChart, callBack?: (chart: TChart) => void); - log: (topic:string, value?:string)=> void + + + log(topic: string, value?: string): string //returns last argument + log(arg: any[]): any //returns last argument } } -declare var nv : nv.nvStatic; \ No newline at end of file +declare var nv : nv.Nvd3Static; \ No newline at end of file From 5a8a7ab18146aeb82cc61b0f960bd4fd9794ef7b Mon Sep 17 00:00:00 2001 From: PjMitchell Date: Wed, 30 Dec 2015 21:42:46 +0000 Subject: [PATCH 018/277] Fixed implicit anys --- nvd3/nvd3.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nvd3/nvd3.d.ts b/nvd3/nvd3.d.ts index 19c03d6dc..e7cfe39ff 100644 --- a/nvd3/nvd3.d.ts +++ b/nvd3/nvd3.d.ts @@ -61,13 +61,13 @@ declare module nv { } interface Nvd3TooltipStatic { - show([left, top]: [number, number], content: string, gravity?: string) //todo sort out use on nv.tooltip. + 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) + options(options: any): this; update(): void; (transition: d3.Transition, ...args: any[]): any; (selection: d3.Selection, ...args: any[]): any; @@ -1168,10 +1168,10 @@ id(value: number|string): this; showLastValue(value: boolean): this; xTickFormat(format: (d: any) => string): this; xTickFormat(format: string): this; - xTickFormat(format: (d: any, i: any) => string); + 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); + yTickFormat(format: (d: any, i: any) => string) :this; } interface StackedArea extends Scatter { @@ -1490,7 +1490,7 @@ id(value: number|string): this; high(): (d: any) => number; high(func: (d: any) => number): this; id(): any; - id(value: number|string): this; this; + 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.*/ @@ -3340,8 +3340,8 @@ id(value: number|string): this; /*stores some statistics and potential error messages*/ logs: any; - addGraph(factory: ChartFactory); - addGraph(generate: () => TChart, callBack?: (chart: TChart) => void); + addGraph(factory: ChartFactory): void; + addGraph(generate: () => TChart, callBack?: (chart: TChart) => void): void; log(topic: string, value?: string): string //returns last argument From c7d3aaed8899816da654bdfcb40339700ee2b6e0 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Sun, 3 Jan 2016 16:40:10 +0100 Subject: [PATCH 019/277] keyboardjs updated to latest version --- keyboardjs/keyboardjs.d.ts | 173 +++++++++++++++++++++++++++---------- 1 file changed, 129 insertions(+), 44 deletions(-) diff --git a/keyboardjs/keyboardjs.d.ts b/keyboardjs/keyboardjs.d.ts index dfafd30a8..6a5c10f96 100644 --- a/keyboardjs/keyboardjs.d.ts +++ b/keyboardjs/keyboardjs.d.ts @@ -1,50 +1,135 @@ -// Type definitions for KeyboardJS +// Type definitions for KeyboardJS v2.2.0 // Project: https://github.com/RobertWHurst/KeyboardJS -// Definitions by: Vincent Bortone +// Definitions by: 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 execute when the keyCombostate is 'pressed', can be null. + * @param released Callback that gets execute 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 documant/element + */ + export function stop(); } -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 From 2961bf02f1ac6eb8b0341664a01f484f25a4fef1 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 16:22:15 +0100 Subject: [PATCH 020/277] Add Options interface to the namespace --- gulp-minify-html/gulp-minify-html-tests.ts | 2 +- gulp-minify-html/gulp-minify-html.d.ts | 36 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 2ec41e556..556ee203b 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -8,7 +8,7 @@ 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..321a56925 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -6,32 +6,32 @@ /// declare module 'gulp-minify-html' { - interface IOptions { - // Do not remove empty attributes - empty?: boolean; + namespace minifyHtml { + 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; } From d8851289004ecdc1137f2efc8e437c9c867cb705 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 6 Jan 2016 16:32:56 +0100 Subject: [PATCH 021/277] updates from adopting for vscode --- github-electron/github-electron.d.ts | 151 +++++++++++++++++---------- 1 file changed, 93 insertions(+), 58 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index b1df3bccc..df04e6271 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; /** * 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; +} \ No newline at end of file From 51b587292f2ba85d68939d9c59cf7fa745a6173e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 16:35:43 +0100 Subject: [PATCH 022/277] Add definitions for UglifyJS 2 (https://github.com/mishoo/UglifyJS2) --- uglify-js/uglify-js-tests.ts | 73 ++++++ uglify-js/uglify-js.d.ts | 430 +++++++++++++++++++++++++++++++++++ 2 files changed, 503 insertions(+) create mode 100644 uglify-js/uglify-js-tests.ts create mode 100644 uglify-js/uglify-js.d.ts diff --git a/uglify-js/uglify-js-tests.ts b/uglify-js/uglify-js-tests.ts new file mode 100644 index 000000000..23b935dec --- /dev/null +++ b/uglify-js/uglify-js-tests.ts @@ -0,0 +1,73 @@ +/// +/// + +import * as UglifyJS from 'uglify-js'; +import * as fs from 'fs'; + +var result = UglifyJS.minify("/path/to/file.js"); +console.log(result.code); // minified output +// if you need to pass code instead of file name +var result = UglifyJS.minify("var b = function () {};", {fromString: true}); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]); +console.log(result.code); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map" +}); +console.log(result.code); // minified output +console.log(result.map); + +var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map", + sourceRoot: "http://example.com/src" +}); + +var result = UglifyJS.minify("compiled.js", { + inSourceMap: "compiled.js.map", + outSourceMap: "minified.js.map" +}); +// same as before, it returns `code` and `map` + +const my_source_map_string = 'sourceMap'; +var result = UglifyJS.minify("compiled.js", { + inSourceMap: JSON.parse(my_source_map_string), + outSourceMap: "minified.js.map" +}); + +var toplevel_ast = UglifyJS.parse(code, {}); + +var toplevel: UglifyJS.AST_Toplevel = null; +const files = ['file1', 'file2']; +files.forEach(function(file){ + var code = fs.readFileSync(file, "utf8"); + toplevel = UglifyJS.parse(code, { + filename: file, + toplevel: toplevel + }); +}); + +toplevel.figure_out_scope() + +var compressor = UglifyJS.Compressor({}); +var compressed_ast = toplevel.transform(compressor); + +compressed_ast.figure_out_scope(); +compressed_ast.compute_char_frequency(); +compressed_ast.mangle_names(); + +var stream = UglifyJS.OutputStream({}); +compressed_ast.print(stream); +var code = stream.toString(); // this is your minified code + +var code = compressed_ast.print_to_string({}); + +var source_map = UglifyJS.SourceMap({}); +var stream = UglifyJS.OutputStream({ + //... + source_map: source_map +}); +compressed_ast.print(stream); + +var code = stream.toString(); +var map = source_map.toString(); // json output for your source map diff --git a/uglify-js/uglify-js.d.ts b/uglify-js/uglify-js.d.ts new file mode 100644 index 000000000..b9c22bc6e --- /dev/null +++ b/uglify-js/uglify-js.d.ts @@ -0,0 +1,430 @@ +// Type definitions for UglifyJS 2 v2.6.1 +// Project: https://github.com/mishoo/UglifyJS2 +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'uglify-js' { + import * as MOZ_SourceMap from 'source-map'; + + namespace UglifyJS { + interface Tokenizer { + /** + * The type of this token. + * Can be "num", "string", "regexp", "operator", "punc", "atom", "name", "keyword", "comment1" or "comment2". + * "comment1" and "comment2" are for single-line, respectively multi-line comments. + */ + type: string; + + /** + * The name of the file where this token originated from. Useful when compressing multiple files at once to generate the proper source map. + */ + file: string; + + /** + * The "value" of the token. + * That's additional information and depends on the token type: "num", "string" and "regexp" tokens you get their literal value. + * - For "operator" you get the operator. + * - For "punc" it's the punctuation sign (parens, comma, semicolon etc). + * - For "atom", "name" and "keyword" it's the name of the identifier + * - For comments it's the body of the comment (excluding the initial "//" and "/*". + */ + value: string; + + /** + * The line number of this token in the original code. + * 1-based index. + */ + line: number; + + /** + * The column number of this token in the original code. + * 0-based index. + */ + col: number; + + /** + * Short for "newline before", it's a boolean that tells us whether there was a newline before this node in the original source. It helps for automatic semicolon insertion. + * For multi-line comments in particular this will be set to true if there either was a newline before this comment, or * * if this comment contains a newline. + */ + nlb: boolean; + + /** + * This doesn't apply for comment tokens, but for all other token types it will be an array of comment tokens that were found before. + */ + comments_before: string[]; + } + + interface AST_Node { + // The first token of this node + start: AST_Node; + + // The last token of this node + end: AST_Node; + + transform(tt: TreeTransformer): AST_Toplevel; + } + + interface AST_Toplevel extends AST_Node { + // UglifyJS contains a scope analyzer which figures out variable/function definitions, references etc. + // You need to call it manually before compression or mangling. + // The figure_out_scope method is defined only on the AST_Toplevel node. + figure_out_scope(): void; + + // Get names that are optimized for GZip compression (names will be generated using the most frequent characters first) + compute_char_frequency(): void; + + mangle_names(): void; + + print(stream: OutputStream): void; + + print_to_string(options?: BeautifierOptions): string; + } + + interface MinifyOptions { + spidermonkey?: boolean; + outSourceMap?: string; + sourceRoot?: string; + inSourceMap?: string; + fromString?: boolean; + warnings?: boolean; + mangle?: Object; + output?: MinifyOutput, + compress?: Object; + } + + interface MinifyOutput { + code: string; + map: string; + } + + function minify(files: string | Array, options?: MinifyOptions): MinifyOutput; + + + interface ParseOptions { + // Default is false + strict?: boolean; + + // Input file name, default is null + filename?: string; + + // Default is null + toplevel?: AST_Toplevel; + } + + /** + * The parser creates a custom abstract syntax tree given a piece of JavaScript code. + * Perhaps you should read about the AST first. + */ + function parse(code: string, options?: ParseOptions): AST_Toplevel; + + + interface BeautifierOptions { + /** + * Start indentation on every line (only when `beautify`) + */ + indent_start?: number; + + /** + * 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 " boolean; + + /** + * UglifyJS provides a TreeWalker object and every node has a walk method that given a walker will apply your visitor to each node in the tree. + * Your visitor can return a non-falsy value in order to prevent descending the current node. + */ + function TreeWalker(visitor: visitor): TreeWalker; + + + // TODO + interface TreeTransformer extends TreeWalker { + } + + /** + * The tree transformer is a special case of a tree walker. + * In fact it even inherits from TreeWalker and you can use the same methods, but initialization and visitor protocol are a bit different. + */ + function TreeTransformer(before: visitor, after: visitor): TreeTransformer; + } + + export = UglifyJS; +} From ba956a3e6e8ebb82d33548209f793234efac44a2 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 16:36:37 +0100 Subject: [PATCH 023/277] gulp-uglify now uses uglify-js --- gulp-uglify/gulp-uglify-tests.ts | 8 +- gulp-uglify/gulp-uglify.d.ts | 183 +++++-------------------------- 2 files changed, 29 insertions(+), 162 deletions(-) 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 " Date: Wed, 6 Jan 2016 16:37:25 +0100 Subject: [PATCH 024/277] webpack now uses uglify-js --- webpack/webpack.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 5bf5050b8..be4c22328 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -3,7 +3,11 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "webpack" { + import * as UglifyJS from 'uglify-js'; + namespace webpack { interface Configuration { context?: string; @@ -426,7 +430,7 @@ declare module "webpack" { new(preferEntry: boolean): Plugin; } interface UglifyJsPluginStatic { - new(options?: any): Plugin; + new(options?: UglifyJS.MinifyOptions): Plugin; } interface CommonsChunkPluginStatic { new(chunkName: string, filenames?: string|string[]): Plugin; From 0009f34a8c5b6c545a0f9fce0c79c4bd18ddcbf7 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:13:52 +0100 Subject: [PATCH 025/277] Add definitions for clean-css (https://github.com/jakubpawlowicz/clean-css) --- clean-css/clean-css-tests.ts | 55 ++++++++++++++++++ clean-css/clean-css.d.ts | 109 +++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 clean-css/clean-css-tests.ts create mode 100644 clean-css/clean-css.d.ts 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; +} From 44f1cdb876f56b34b05cb3b1bdea828c0f3e3a4b Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:20:26 +0100 Subject: [PATCH 026/277] gulp-minify-css now uses clean-css --- gulp-minify-css/gulp-minify-css-tests.ts | 2 +- gulp-minify-css/gulp-minify-css.d.ts | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) 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 {} From 4e802a7747735ba5c5dc855ac366691ae329e9ab Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:21:20 +0100 Subject: [PATCH 027/277] Add definitions for relateurl (https://github.com/stevenvachon/relateurl) --- relateurl/relateurl-tests.ts | 20 ++++++ relateurl/relateurl.d.ts | 125 +++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 relateurl/relateurl-tests.ts create mode 100644 relateurl/relateurl.d.ts diff --git a/relateurl/relateurl-tests.ts b/relateurl/relateurl-tests.ts new file mode 100644 index 000000000..89a647d06 --- /dev/null +++ b/relateurl/relateurl-tests.ts @@ -0,0 +1,20 @@ +/// + +import * as RelateUrl from 'relateurl'; + +var from = "http://www.domain.com/asdf/"; +var to = "http://www.domain.com/asdf/asdf"; +var to1 = "http://www.domain.com/asdf/asdf1"; +var to2 = "http://www.domain.com/asdf/asdf1"; +var to3 = "http://www.domain.com/asdf/asdf1"; +var options = {site: "http://www.domain.com/asdf2/"}; +var customOptions = {output: RelateUrl.ABSOLUTE}; + +// Single Instance +var result = RelateUrl.relate(from, to, options); + +// Reusable Instances +var instance = new RelateUrl(from, options); +var result1 = instance.relate(to1); +var result2 = instance.relate(to2, customOptions); +var result3 = instance.relate(to3); diff --git a/relateurl/relateurl.d.ts b/relateurl/relateurl.d.ts new file mode 100644 index 000000000..9f24e59b9 --- /dev/null +++ b/relateurl/relateurl.d.ts @@ -0,0 +1,125 @@ +// Type definitions for relateurl v0.2.6 +// Project: https://github.com/stevenvachon/relateurl +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'relateurl' { + namespace RelateUrl { + interface Options { + /** + * Type: Object + * Default value: {ftp:21, http:80, https:443} + * + * Extend the list with any ports you need. Any URLs containing these default ports will have them removed. Example: http://example.com:80/ will become http://example.com/. + */ + defaultPorts?: Object; + + /** + * Type: Array + * Default value: ["index.html"] + * + * Extend the list with any resources you need. Works with options.removeDirectoryIndexes. + */ + directoryIndexes?: Array; + + /** + * Type: Boolean + * Default value: false + * + * This will, for example, consider any domains containing http://www.example.com/ to be related to any that contain http://example.com/. + */ + ignore_www?: boolean; + + /** + * Type: constant or String + * Choices: RelateUrl.ABSOLUTE,RelateUrl.PATH_RELATIVE,RelateUrl.ROOT_RELATIVE,RelateUrl.SHORTEST + * Choices: "absolute","pathRelative","rootRelative","shortest" + * Default value: RelateUrl.SHORTEST + * + * RelateUrl.ABSOLUTE will produce an absolute URL. Overrides options.schemeRelative with a value of false. + * RelateUrl.PATH_RELATIVE will produce something like ../child-of-parent/etc/. + * RelateUrl.ROOT_RELATIVE will produce something like /child-of-root/etc/. + * RelateUrl.SHORTEST will choose whichever is shortest between root- and path-relative. + */ + output?: string; + + /** + * Type: Array + * Default value: ["data","javascript","mailto"] + * + * Extend the list with any additional schemes. Example: javascript:something will not be modified. + */ + rejectedSchemes?: Array; + + /** + * Type: Boolean + * Default value: false + * + * Remove user authentication information from the output URL. + */ + removeAuth?: boolean; + + /** + * Type: Boolean + * Default value: true + * + * Remove any resources that match any found in options.directoryIndexes. + */ + removeDirectoryIndexes?: boolean; + + /** + * Type: Boolean + * Default value: false + * + * Remove empty query variables. Example: http://domain.com/?var1&var2=&var3=asdf will become http://domain.com/?var3=adsf. This does not apply to unrelated URLs (with other protocols, auths, hosts and/or ports). + */ + removeEmptyQueries?: boolean; + + /** + * Type: Boolean + * Default value: true + * + * Remove trailing slashes from root paths. Example: http://domain.com/?var will become http://domain.com?var while http://domain.com/dir/?var will not be modified. + */ + removeRootTrailingSlash?: boolean; + + /** + * Type: Boolean + * Default value: true + * + * Output URLs relative to the scheme. Example: http://example.com/ will become //example.com/. + */ + schemeRelative?: boolean; + + /** + * Type: String + * Default value: undefined + * + * An options-based version of the from argument. If both are specified, from takes priority. + */ + site?: string; + + /** + * Type: Boolean + * Default value: true + * + * Passed to Node's url.parse. + */ + slashesDenoteHost?: boolean; + } + } + + class RelateUrl { + static ABSOLUTE: string; + static PATH_RELATIVE: string; + static ROOT_RELATIVE: string; + static SHORTEST: string; + + static relate(from: string, to: string, options?: RelateUrl.Options): string; + + constructor(from: string, options?: RelateUrl.Options); + relate(to: string, options?: RelateUrl.Options): string; + } + + export = RelateUrl; +} From 3051b93e44c76235a5df0902371cdbf748e4f284 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:22:22 +0100 Subject: [PATCH 028/277] Add definitions for HTMLMinifier (https://github.com/kangax/html-minifier) --- html-minifier/html-minifier-tests.ts | 9 +++ html-minifier/html-minifier.d.ts | 115 +++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 html-minifier/html-minifier-tests.ts create mode 100644 html-minifier/html-minifier.d.ts 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; +} From b29d9f63400cf32f0977fff8811d23a1ee59871f Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:23:12 +0100 Subject: [PATCH 029/277] Add definitions for gulp-htmlmin (https://github.com/jonschlinkert/gulp-htmlmin) --- gulp-htmlmin/gulp-htmlmin-tests.ts | 11 +++++++++++ gulp-htmlmin/gulp-htmlmin.d.ts | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 gulp-htmlmin/gulp-htmlmin-tests.ts create mode 100644 gulp-htmlmin/gulp-htmlmin.d.ts 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; +} From 84fecab4c3294938ef35700e80e5684f94b1cda4 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 6 Jan 2016 17:25:55 +0100 Subject: [PATCH 030/277] "Deprecate" gulp-minify-html in favor of gulp-htmlmin --- gulp-minify-html/gulp-minify-html-tests.ts | 2 ++ gulp-minify-html/gulp-minify-html.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 556ee203b..1b3c7639d 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -4,6 +4,8 @@ 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}); diff --git a/gulp-minify-html/gulp-minify-html.d.ts b/gulp-minify-html/gulp-minify-html.d.ts index 321a56925..770789bbb 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -5,8 +5,11 @@ /// +// This package has been deprecated in favor of gulp-htmlmin, which should be faster and more comprehensive. + declare module 'gulp-minify-html' { namespace minifyHtml { + // Options from https://github.com/Swaagie/minimize#options interface Options { // Do not remove empty attributes empty?: boolean; From 7e3bc700b3e9f9ada0dc5f36c2b52bb51a23ec11 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Wed, 6 Jan 2016 17:29:37 +0100 Subject: [PATCH 031/277] Add definition for "i18next-express-middleware". --- .../i18next-express-middleware-tests.ts | 5 +++ .../i18next-express-middleware.d.ts | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 i18next-express-middleware/i18next-express-middleware-tests.ts create mode 100644 i18next-express-middleware/i18next-express-middleware.d.ts 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..54e47b03c --- /dev/null +++ b/i18next-express-middleware/i18next-express-middleware-tests.ts @@ -0,0 +1,5 @@ +/// + +//import express = require("express"); +//import i18next = require("i18next"); +import middleware = require("i18next-express-middleware"); 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..ad9f0a95d --- /dev/null +++ b/i18next-express-middleware/i18next-express-middleware.d.ts @@ -0,0 +1,33 @@ +// Type definitions for i18next-express-middleware +// Project: http://i18next.com/ +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "i18next-express-middleware" { + import express = require("express"); + export interface i18nextExpressMiddleware { + LanguageDetector(): express.Handler; + missingKeyHandler(): express.Handler; + } + + interface LanguageDetectorOptions { + caches: boolean; + cookieDomain: string; + cookieExpirationDate: Date; + lookupCookie: string; + lookupFromPathIndex: number; + lookupQuerystring: string; + lookupSession: string; + order: Array; + } + + export class LanguageDetector { + constructor(services?: any, options?: Object, allOptions?: Object); + addDetector(detector: any): void; + cacheUserLanguage(req: express.Request, res: express.Response, detectionOrder: any): void; + detect(req: express.Request, res: express.Response, detectionOrder: any): void; + init(services: any, options?: Object, allOptions?: Object): void; + } +} From 38fddea3d4d60235565aa750bcb0c8a8d2c20bb2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 7 Jan 2016 08:45:52 +0100 Subject: [PATCH 032/277] updates as discussed --- github-electron/github-electron-main-tests.ts | 25 ++++++++++--------- .../github-electron-renderer-tests.ts | 8 +++--- github-electron/github-electron.d.ts | 4 +-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 55588681f..00f9b3ae1 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 }); @@ -275,12 +276,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'; }); @@ -460,7 +461,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 df04e6271..29244bf93 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -914,7 +914,7 @@ declare module Electron { * Should be specified for submenu type menu item, when it's specified the * type: 'submenu' can be omitted for the menu item */ - submenu?: Menu; + 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. @@ -1879,4 +1879,4 @@ declare module 'electron' { interface NodeRequireFunction { (moduleName: 'electron'): Electron.ElectronMainAndRenderer; -} \ No newline at end of file +} From 5f2a5d25bbf64562561aeb3055b4ea6fbd27716f Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Thu, 7 Jan 2016 16:23:33 +0100 Subject: [PATCH 033/277] Update definitions for "i18next-express-middleware", "i18next" and "connect-timeout". Remove "tscparams" file for "acc-wizard". --- acc-wizard/acc-wizard.ts.tscparams | 1 - connect-timeout/connect-timeout-tests.ts | 8 +- connect-timeout/connect-timeout.d.ts | 7 +- .../i18next-express-middleware-tests.ts | 47 ++++++++++- .../i18next-express-middleware.d.ts | 83 ++++++++++++++++--- i18next/i18next.d.ts | 7 +- 6 files changed, 132 insertions(+), 21 deletions(-) delete mode 100644 acc-wizard/acc-wizard.ts.tscparams 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/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/i18next-express-middleware/i18next-express-middleware-tests.ts b/i18next-express-middleware/i18next-express-middleware-tests.ts index 54e47b03c..a696f4f8a 100644 --- a/i18next-express-middleware/i18next-express-middleware-tests.ts +++ b/i18next-express-middleware/i18next-express-middleware-tests.ts @@ -1,5 +1,48 @@ +/// /// -//import express = require("express"); -//import i18next = require("i18next"); +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 index ad9f0a95d..fe51928bf 100644 --- a/i18next-express-middleware/i18next-express-middleware.d.ts +++ b/i18next-express-middleware/i18next-express-middleware.d.ts @@ -4,30 +4,93 @@ // 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; } - interface LanguageDetectorOptions { - caches: boolean; - cookieDomain: string; - cookieExpirationDate: Date; - lookupCookie: string; - lookupFromPathIndex: number; - lookupQuerystring: string; - lookupSession: string; - order: Array; + /** + * @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); - addDetector(detector: any): void; + + /** + * @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/i18next.d.ts b/i18next/i18next.d.ts index 38d91b603..9256e7a45 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -1,11 +1,13 @@ -// 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; @@ -99,7 +101,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 +126,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 From 68fb3b7b5ae0475229d63d71e2884fe74b7e6e26 Mon Sep 17 00:00:00 2001 From: Ville Lahdenvuo Date: Fri, 8 Jan 2016 16:50:03 +0200 Subject: [PATCH 034/277] Add static plugin method to definitions. --- bookshelf/bookshelf.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index e0278df26..95aa38408 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -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; } From 3a35d23702820bb9c6d322a5698cd6fbcb8f57eb Mon Sep 17 00:00:00 2001 From: Radu Woinaroski Date: Sun, 10 Jan 2016 21:32:56 +0100 Subject: [PATCH 035/277] fixed CodeMirror.TextMarker.find() return type Added CodeMirror.Range type Changed CodeMirror.TextMarker.find() to return CodeMirror.Range instead of CodeMirror.Position (which was wrong). --- codemirror/codemirror.d.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 2ca58c702..1df15739b 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -601,7 +601,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; @@ -645,7 +645,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; @@ -795,9 +800,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; } From 7329ae6688394e18feca20a9afbdc99979475be8 Mon Sep 17 00:00:00 2001 From: Manuel Rueda Date: Sun, 10 Jan 2016 19:43:37 -0300 Subject: [PATCH 036/277] add typing for promise --- promise/promise-test.ts | 21 +++++++++++++++++++++ promise/promise.d.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 promise/promise-test.ts create mode 100644 promise/promise.d.ts diff --git a/promise/promise-test.ts b/promise/promise-test.ts new file mode 100644 index 000000000..140d170b1 --- /dev/null +++ b/promise/promise-test.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..387a01397 --- /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(callbacl: Function): IThenable; + } +} From 52b68b9e9c434c51c78ee27066a5c473b112ba3f Mon Sep 17 00:00:00 2001 From: Manuel Rueda Date: Sun, 10 Jan 2016 19:46:46 -0300 Subject: [PATCH 037/277] fix typo --- promise/promise.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/promise/promise.d.ts b/promise/promise.d.ts index 387a01397..9237b8908 100644 --- a/promise/promise.d.ts +++ b/promise/promise.d.ts @@ -26,6 +26,6 @@ declare module Promise { 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(callbacl: Function): IThenable; + nodeify(callback: Function): IThenable; } } From 535891011950677f24deaafb625874a19e201e7a Mon Sep 17 00:00:00 2001 From: Radu Woinaroski Date: Mon, 11 Jan 2016 11:35:19 +0100 Subject: [PATCH 038/277] pulled hljs out of 'highlight.js' so it can be also used without an AMD loader pulled the declaration of module hljs out of the declaration for module "highlight.js" so that the file can be used in both AMD and static load scenarios. --- highlightjs/highlightjs.d.ts | 276 +++++++++++++++++------------------ 1 file changed, 138 insertions(+), 138 deletions(-) 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; } From 948f0629b2cfc28db174feb4ba5da1d28a4de863 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Mon, 11 Jan 2016 15:06:54 +0100 Subject: [PATCH 039/277] added old author; grammatical corrections, stop() now returns void instead of any --- keyboardjs/keyboardjs.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/keyboardjs/keyboardjs.d.ts b/keyboardjs/keyboardjs.d.ts index 6a5c10f96..0d6783ee8 100644 --- a/keyboardjs/keyboardjs.d.ts +++ b/keyboardjs/keyboardjs.d.ts @@ -1,6 +1,7 @@ // Type definitions for KeyboardJS v2.2.0 // Project: https://github.com/RobertWHurst/KeyboardJS -// Definitions by: David Asmuth +// Definitions by: Vincent Bortone , +// David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped // KeyboardJS is a library for use in the browser (node.js compatible). @@ -36,14 +37,14 @@ declare module keyboardjs { /** * Binds a keyCombo to specific callback functions. * @param keyCombo String of keys to be pressed to execute callbacks. - * @param pressed Callback that gets execute when the keyCombostate is 'pressed', can be null. - * @param released Callback that gets execute when the keyCombostate is 'released' + * @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' + * @param pressed Callback that gets executed when the keyComboState is 'pressed' */ export function bind(keyCombo: string, pressed: Callback): void; @@ -125,9 +126,9 @@ declare module keyboardjs { export function watch(): void; /** - * Detaches KeyboardJS from the window and documant/element + * Detaches KeyboardJS from the window and document/element */ - export function stop(); + export function stop(): void; } declare module 'keyboardjs' { From 890d4d8bfea9ba2fd03fb76c82cd95e236a48433 Mon Sep 17 00:00:00 2001 From: DavidCai <376462191@qq.com> Date: Mon, 11 Jan 2016 22:23:56 +0800 Subject: [PATCH 040/277] add koa2.d.ts --- koa2/koa2-tests.ts | 20 +++++++ koa2/koa2.d.ts | 135 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 koa2/koa2-tests.ts create mode 100644 koa2/koa2.d.ts diff --git a/koa2/koa2-tests.ts b/koa2/koa2-tests.ts new file mode 100644 index 000000000..7c460d475 --- /dev/null +++ b/koa2/koa2-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/koa2/koa2.d.ts b/koa2/koa2.d.ts new file mode 100644 index 000000000..0433e2b09 --- /dev/null +++ b/koa2/koa2.d.ts @@ -0,0 +1,135 @@ +// 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; + } + + let K: typeof Koa; + export = K +} From 19850bf86c876e0c2544842114878ece4664941a Mon Sep 17 00:00:00 2001 From: Niko Kovacic Date: Mon, 11 Jan 2016 15:43:58 +0100 Subject: [PATCH 041/277] Added forceAsyncReload method to $translateProvider. --- angular-translate/angular-translate-tests.ts | 1 + angular-translate/angular-translate.d.ts | 1 + 2 files changed, 2 insertions(+) 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; From 96c7488d5f84129c7a108d2124fc4d9d90bb6331 Mon Sep 17 00:00:00 2001 From: DavidCai <376462191@qq.com> Date: Mon, 11 Jan 2016 23:23:15 +0800 Subject: [PATCH 042/277] rename koa2 to koa --- koa2/koa2-tests.ts => koa/koa-tests.ts | 2 +- koa2/koa2.d.ts => koa/koa.d.ts | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename koa2/koa2-tests.ts => koa/koa-tests.ts (90%) rename koa2/koa2.d.ts => koa/koa.d.ts (100%) diff --git a/koa2/koa2-tests.ts b/koa/koa-tests.ts similarity index 90% rename from koa2/koa2-tests.ts rename to koa/koa-tests.ts index 7c460d475..e98436497 100644 --- a/koa2/koa2-tests.ts +++ b/koa/koa-tests.ts @@ -1,4 +1,4 @@ -/// +/// import * as Koa from "koa"; const app = new Koa(); diff --git a/koa2/koa2.d.ts b/koa/koa.d.ts similarity index 100% rename from koa2/koa2.d.ts rename to koa/koa.d.ts From 6c53e8f8572775932e15ccdf4c889f4f79c83dde Mon Sep 17 00:00:00 2001 From: Manuel Rueda Date: Mon, 11 Jan 2016 12:24:32 -0300 Subject: [PATCH 043/277] Fix tests file name --- promise/{promise-test.ts => promise-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename promise/{promise-test.ts => promise-tests.ts} (100%) diff --git a/promise/promise-test.ts b/promise/promise-tests.ts similarity index 100% rename from promise/promise-test.ts rename to promise/promise-tests.ts From 4146ca6918fe8dafa3ca1fc43444493d04dc14eb Mon Sep 17 00:00:00 2001 From: Urs Wegmann Date: Mon, 11 Jan 2016 17:09:44 +0100 Subject: [PATCH 044/277] Add relativeUrls to IOptions --- gulp-less/gulp-less.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/gulp-less/gulp-less.d.ts b/gulp-less/gulp-less.d.ts index 9ca5e35b7..ed1ab5f0f 100644 --- a/gulp-less/gulp-less.d.ts +++ b/gulp-less/gulp-less.d.ts @@ -10,6 +10,7 @@ declare module "gulp-less" { interface IOptions { paths: string[]; plugins?: any[]; + relativeUrls?: boolean; } function less(options?: IOptions): NodeJS.ReadWriteStream; From c0bc8907bd25a1179d171f27fd7609011ac1ab8d Mon Sep 17 00:00:00 2001 From: Kirill Chaban Date: Mon, 11 Jan 2016 22:09:57 +0300 Subject: [PATCH 045/277] material-ui: fix misprint in time-picker Renamed textFieldStye to textFieldStyle --- material-ui/material-ui-tests.tsx | 4 ++++ material-ui/material-ui.d.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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; From 2e36df31fefbe865f9c457ce525f66c932935d99 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 12 Jan 2016 00:03:57 +0500 Subject: [PATCH 046/277] lodash: signatures of _.merge have been changed --- lodash/lodash-tests.ts | 35 ++++++++++++++++++++++++++++ lodash/lodash.d.ts | 53 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4dfaa33f1..900d6c626 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8478,6 +8478,41 @@ module TestMerge { { a: [1] }, { a: true }).value(); + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(initialValue).chain().merge(mergingValue); + result = _(initialValue).chain().merge(mergingValue, customizer); + result = _(initialValue).chain().merge(mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, mergingValue); + result = _(initialValue).chain().merge({}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, {}, mergingValue); + result = _(initialValue).chain().merge({}, {}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, {}, mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, {}, {}, mergingValue); + result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer, any); + + result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); + result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer); + result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer, any); + } + + { + 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 diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5f0c07777..3a37fc9dd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13018,7 +13018,7 @@ declare module _ { source4: TSource4, customizer?: MergeCustomizer, thisArg?: any - ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** * @see _.merge @@ -13080,6 +13080,57 @@ declare module _ { ): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashExplicitObjectWrapper; + } + //_.methods interface LoDashStatic { /** From 1e4a86c5fdad1113793811a9ade0864ea1cdab44 Mon Sep 17 00:00:00 2001 From: Adam Burmister Date: Mon, 11 Jan 2016 15:25:33 -0800 Subject: [PATCH 047/277] Pinterest JS SDK definitions --- pinterest-sdk/pinterest-sdk.d.ts | 130 +++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 pinterest-sdk/pinterest-sdk.d.ts diff --git a/pinterest-sdk/pinterest-sdk.d.ts b/pinterest-sdk/pinterest-sdk.d.ts new file mode 100644 index 000000000..2c7b32b0d --- /dev/null +++ b/pinterest-sdk/pinterest-sdk.d.ts @@ -0,0 +1,130 @@ +// Type definitions for pinterest-sdk +// Project: +// Definitions by: Adam Burmister +// Definitions: https://github.com/adamburmister/DefinitelyTyped +declare module PDK { + + type OauthSession = { + accessToken?: string; + scope?: string; + error?: string; + } + + interface LoginOptions { + 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; + } + + enum HttpMethod { 'get', 'put', 'post', 'delete' } + + /** + * 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 being pinned + * @param note description for pin + * @param url url where pin is from + */ + export function pin(imageUrl: string, note: string, url: string, callback: Function): void; +} + +declare module 'pinterest-sdk' { + export = PDK; +} From b7b7da9f379ed4134a6aaa35e1c48ebcc9ab767a Mon Sep 17 00:00:00 2001 From: Adam Burmister Date: Mon, 11 Jan 2016 15:40:22 -0800 Subject: [PATCH 048/277] Test suite for Pinterest SDK --- pinterest-sdk/pinterest-sdk-tests.ts | 17 +++++++++++++++++ pinterest-sdk/pinterest-sdk.d.ts | 17 ++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 pinterest-sdk/pinterest-sdk-tests.ts diff --git a/pinterest-sdk/pinterest-sdk-tests.ts b/pinterest-sdk/pinterest-sdk-tests.ts new file mode 100644 index 000000000..0c0f9a934 --- /dev/null +++ b/pinterest-sdk/pinterest-sdk-tests.ts @@ -0,0 +1,17 @@ +/// + +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" }; + +// Examples from https://github.com/pinterest/pinterest-api-demo + +// 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 index 2c7b32b0d..6c9d48493 100644 --- a/pinterest-sdk/pinterest-sdk.d.ts +++ b/pinterest-sdk/pinterest-sdk.d.ts @@ -1,9 +1,13 @@ // Type definitions for pinterest-sdk -// Project: +// 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; @@ -11,6 +15,7 @@ declare module PDK { } interface LoginOptions { + scope: string|OAuthScopes; method?: string; appId?: string; cookie?: boolean; @@ -31,8 +36,6 @@ declare module PDK { session?: OauthSession; } - enum HttpMethod { 'get', 'put', 'post', 'delete' } - /** * Get information on the currently authenticated user * @param path the url path @@ -61,7 +64,7 @@ declare module PDK { * * Need to call login to re-connect, unless session is saved on server. */ - export function logout(callback: (session: OauthSession) => any): void; + export function logout(callback?: (session: OauthSession) => any): void; /** * Get the active session for the current user @@ -118,9 +121,9 @@ declare module PDK { /** * Allow an unauthenticated user to pin using a popup * - * @param imageUrl URL for image being pinned - * @param note description for pin - * @param url url where pin is from + * @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; } From 7c674066763d9ef1f38dd4cfbe4bf909d5275308 Mon Sep 17 00:00:00 2001 From: Adam Burmister Date: Mon, 11 Jan 2016 15:44:12 -0800 Subject: [PATCH 049/277] Tidy --- pinterest-sdk/pinterest-sdk-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pinterest-sdk/pinterest-sdk-tests.ts b/pinterest-sdk/pinterest-sdk-tests.ts index 0c0f9a934..ea1e2d438 100644 --- a/pinterest-sdk/pinterest-sdk-tests.ts +++ b/pinterest-sdk/pinterest-sdk-tests.ts @@ -1,12 +1,12 @@ /// +// 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" }; -// Examples from https://github.com/pinterest/pinterest-api-demo - // Auth PDK.login({ scope : PIN_SCOPE }, CALLBACK); PDK.logout(); From 29844903a52da1b82ef1ea4ef70c1b6a330f495f Mon Sep 17 00:00:00 2001 From: Adam Burmister Date: Mon, 11 Jan 2016 16:02:27 -0800 Subject: [PATCH 050/277] Add overloads for PDK.me --- pinterest-sdk/pinterest-sdk.d.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pinterest-sdk/pinterest-sdk.d.ts b/pinterest-sdk/pinterest-sdk.d.ts index 6c9d48493..a72fe9d89 100644 --- a/pinterest-sdk/pinterest-sdk.d.ts +++ b/pinterest-sdk/pinterest-sdk.d.ts @@ -36,13 +36,26 @@ declare module PDK { 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; + export function me(path: string, params: Object, callback: Function): void; /** * Make an API call to the server From f505d870ffb00e8c4e5f88ada8b86ab70bf9d506 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Mon, 11 Jan 2016 23:16:59 -0500 Subject: [PATCH 051/277] Remove dependence on jquery.d.ts jQuery declares a global var `$` which makes it potentially conflict with other declarations, for example angular-protractor autobahn.d.ts doesn't need to depend on jquery.d.ts since the only thing it used, JqueryPromise, can be replaced with when.Promise --- autobahn/autobahn.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; From 57112090daefe2e0fb29726d9bd170b19c43d336 Mon Sep 17 00:00:00 2001 From: Matthias Thomann Date: Tue, 12 Jan 2016 08:45:04 +0100 Subject: [PATCH 052/277] Added missing options to SliderOptions and DialogOptions --- jqueryui/jqueryui-tests.ts | 4 +++- jqueryui/jqueryui.d.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index bc84cb475..75ad6f3cd 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 }); @@ -1489,7 +1490,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 ade8eb735..08735884b 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; @@ -634,6 +635,7 @@ declare module JQueryUI { step?: number; value?: number; values?: number[]; + highlight?: boolean; } interface SliderUIParams { From ac0fcd9ac803963b666aeb46b545be098bfe6ee6 Mon Sep 17 00:00:00 2001 From: Philipp Stucki Date: Tue, 12 Jan 2016 11:04:46 +0100 Subject: [PATCH 053/277] adds definitions for https://github.com/mattijs/node-rsync --- rsync/rsync-tests.ts | 157 +++++++++++++++++++++++++++++++++++++++++++ rsync/rsync.d.ts | 97 ++++++++++++++++++++++++++ 2 files changed, 254 insertions(+) create mode 100644 rsync/rsync-tests.ts create mode 100644 rsync/rsync.d.ts diff --git a/rsync/rsync-tests.ts b/rsync/rsync-tests.ts new file mode 100644 index 000000000..6e12213bd --- /dev/null +++ b/rsync/rsync-tests.ts @@ -0,0 +1,157 @@ +/// + +import * as Rsync from 'rsync'; + +// -------------------------- +// simple usage +// Build the command +const rs = new Rsync() + .shell('ssh') + .flags('az') + .source('/path/to/source') + .destination('server:/path/to/destination'); + +// Execute the command +rs.execute(function(error, code, cmd) { + // we're done +}); + +// -------------------------- +// api +const rsync = new Rsync(); + + +// set(flags, set) +rsync.set('a') + .set('progress') + .set('list-only') + .set('exclude-from', '/path/to/exclude-file'); + +// unset +rsync.unset('progress') + .unset('quiet'); + +// flags// As String +rsync.flags('avz'); // set +rsync.flags('avz', false); // unset + +// As String arguments +rsync.flags('a', 'v', 'z'); // set +rsync.flags('a', 'v', 'z', false); // unset + +// As Array +rsync.flags(['a', 'v', 'z']); // set +rsync.flags(['a', 'z'], false); // unset + +// As Object +rsync.flags({ + 'a': true, // set + 'z': true, // set + 'v': false // unset +}); + + +// isSet(option) +rsync.set('quiet'); +rsync.isSet('quiet'); // is TRUE +rsync.isSet('q'); // is FALSE + + +// option(option) +rsync.option('rsh'); // returns String value +rsync.option('progress'); // returns NULL + + +// command() +const command = rsync.command(); + + +// output(stdoutHandler, stderrHandler) +rsync.output( + function(data) { + // do things like parse progress + }, function(data) { + // do things like parse error output + } +); + + +// execute(callback, stdoutHandler, stderrHandler) +// signal handler function +const quitting = function() { + if (rsyncPid) { + rsyncPid.kill(); + } + process.exit(); +} +process.on("SIGINT", quitting); // run signal handler on CTRL-C +process.on("SIGTERM", quitting); // run signal handler on SIGTERM +process.on("exit", quitting); // run signal handler when main process exits + +// simple execute +var rsyncPid = rsync.execute(function(error, code, cmd) { + // we're done +}); + +// execute with stream callbacks +var rsyncPid = rsync.execute( + function(error, code, cmd) { + // we're done + }, function(data) { + // do things like parse progress + }, function(data) { + // do things like parse error output + } +); + + +// option shorthands +rsync.shell('ssh') + .delete() + .progress() + .archive() + .compress() + .recursive() + .update() + .quiet() + .dirs() + .links() + .dry(); + + +// accessor methods +rsync.executable('executable'); +const e = rsync.executable(); + +rsync.executableShell('executableShell'); +const s = rsync.executableShell(); + +rsync.destination('destination'); +const d = rsync.destination(); + +rsync.source('/a/path') + .source('/b/path'); +rsync.source(['/a/path', '/b/path']); +const src = rsync.source() + + +// patterns +// on an existing Rsync object +rsync.patterns([ '-.git', { action: '+', pattern: '/some_dir' }]); + +// exclude(pattern) +// chained +rsync.exclude('.git') + .exclude('.DS_Store'); + +// as Array +rsync.exclude(['.git', '.DS_Store']); + + +// include(pattern) +// chained +rsync.include('/a/file') + .include('/b/file'); + +// as Array +rsync.include(['/a/file', '/b/file']); \ No newline at end of file diff --git a/rsync/rsync.d.ts b/rsync/rsync.d.ts new file mode 100644 index 000000000..137e9c1d1 --- /dev/null +++ b/rsync/rsync.d.ts @@ -0,0 +1,97 @@ +// Type definitions for node-rsync v0.4.0 +// Project: https://github.com/mattijs/node-rsync +// Definitions by: Philipp Stucki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'rsync' { + import * as child_process from 'child_process'; + interface StreamDataHandler { + (data: any): void; + } + + interface Pattern { + action: string; + pattern: string; + } + + interface Flag { + [name: string]: boolean; + } + + interface Rsync { + // instance methods + set(option: string, value: string): Rsync; + set(option: string): Rsync; + + unset(option: string): Rsync; + + flags(flags: string, set?: boolean): Rsync; + flags(flags: Flag): Rsync; + flags(flags: string[], set?: boolean): Rsync; + flags(...flags: any[]): Rsync + + isSet(option: string): boolean; + + option(option: string): any; + + args(): string[]; + + command(): string; + + output(stdout: StreamDataHandler, stderr: StreamDataHandler):Rsync; + + execute(callback: (err: Error, code: number, cmd: string) => void): child_process.ChildProcess; + execute( + callback: (err: Error, code: number, cmd: string) => void, + stdout: StreamDataHandler, + stderr: StreamDataHandler + ): child_process.ChildProcess; + + + // option shorthands + shell(shell: string): Rsync; + delete(): Rsync; + progress(): Rsync; + archive(): Rsync; + compress(): Rsync; + recursive(): Rsync; + update(): Rsync; + quiet(): Rsync; + dirs(): Rsync; + links(): Rsync; + dry(): Rsync; + // source(): Rsync; + + // accessor methods + executable(): string; + executable(e: string): Rsync; + + executableShell(): string; + executableShell(e: string): Rsync; + + destination(): string; + destination(d: string): Rsync; + + source(): string[]; + source(s: string): Rsync; + source(s: string[]): Rsync; + + // pattern accessors + patterns(patterns: (string|Pattern)[]): Rsync; + + exclude(p: string): Rsync; + exclude(p: string[]): Rsync; + + include(p: string): Rsync; + include(p: string[]): Rsync; + } + + interface RsyncStatic { + new(): Rsync; + } + + const e: RsyncStatic; + export = e; +} From c491f170acf84de20b47f018c5cbfad82537c557 Mon Sep 17 00:00:00 2001 From: Philipp Stucki Date: Tue, 12 Jan 2016 11:13:53 +0100 Subject: [PATCH 054/277] removes obsolete source() definition --- rsync/rsync.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/rsync/rsync.d.ts b/rsync/rsync.d.ts index 137e9c1d1..bcbf0d0b4 100644 --- a/rsync/rsync.d.ts +++ b/rsync/rsync.d.ts @@ -62,7 +62,6 @@ declare module 'rsync' { dirs(): Rsync; links(): Rsync; dry(): Rsync; - // source(): Rsync; // accessor methods executable(): string; From 941b8aabd2f74493a1f3c5de2cef9b39338b0249 Mon Sep 17 00:00:00 2001 From: brierel Date: Tue, 12 Jan 2016 11:39:29 +0100 Subject: [PATCH 055/277] Fixed deprecated express 3.x functions - Fixed deprecated express 3.x functions as reporte in issue https://github.com/DefinitelyTyped/DefinitelyTyped/issues/7507 - Also updated use() fonction when having only one handler parameter --- express/express.d.ts | 53 +++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/express/express.d.ts b/express/express.d.ts index db1981d5d..3db27bc37 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -103,9 +103,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 +200,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 +255,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`. * From 9a2c50ea846ee6ae36feaea0accc77ae7b08a748 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Tue, 12 Jan 2016 12:33:57 +0100 Subject: [PATCH 056/277] Updated urlencoded method The urlencoded extended option is no longer optional The default value has been deprecated. https://github.com/expressjs/body-parser#bodyparserurlencodedoptions --- body-parser/body-parser.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 +} From 60ec68376b3c66dca9b47073d8703fa4f2ebca38 Mon Sep 17 00:00:00 2001 From: Philipp Stucki Date: Tue, 12 Jan 2016 14:10:24 +0100 Subject: [PATCH 057/277] small linting fixes --- rsync/rsync.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rsync/rsync.d.ts b/rsync/rsync.d.ts index bcbf0d0b4..9c828e6fb 100644 --- a/rsync/rsync.d.ts +++ b/rsync/rsync.d.ts @@ -30,7 +30,7 @@ declare module 'rsync' { flags(flags: string, set?: boolean): Rsync; flags(flags: Flag): Rsync; flags(flags: string[], set?: boolean): Rsync; - flags(...flags: any[]): Rsync + flags(...flags: any[]): Rsync; isSet(option: string): boolean; @@ -40,7 +40,7 @@ declare module 'rsync' { command(): string; - output(stdout: StreamDataHandler, stderr: StreamDataHandler):Rsync; + output(stdout: StreamDataHandler, stderr: StreamDataHandler): Rsync; execute(callback: (err: Error, code: number, cmd: string) => void): child_process.ChildProcess; execute( From 4cdea2aaeb4a26873828d463c97dc36fad8d85d6 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 15:37:58 +0200 Subject: [PATCH 058/277] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 3471a8fc3..99c32854a 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -1,6 +1,6 @@ -// 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 { @@ -115,6 +115,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; @@ -292,6 +304,9 @@ declare module moment { 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; + // Since version 2.10.7+ + isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string); + // Deprecated as of 2.8.0. lang(language: string): Moment; lang(reset: boolean): Moment; @@ -317,9 +332,12 @@ 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. */ + // Works with version 2.10.5+ toObject(): MomentDateObject; + + // Since version 2.10.7+ + creationData(): MomentCreationData; } type formatFunction = () => string; @@ -479,6 +497,9 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; + // Since version 2.10.7+ + now(): number; + /** * Constant used to enable explicit ISO_8601 format parsing. */ From 3e6e0b6de69752234d3de812b77b4f0c8d9497d3 Mon Sep 17 00:00:00 2001 From: delphinus Date: Tue, 12 Jan 2016 22:45:21 +0900 Subject: [PATCH 059/277] Add methods & fix comments for CollectionView --- marionette/marionette.d.ts | 79 +++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 314fcc432..c75b62123 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -846,6 +846,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 +952,7 @@ declare module Marionette { */ addChild(item: any, ChildView: TView, index: Number): void; + /** Render the child view */ renderChildView(view: TView, index: Number): void; /** @@ -949,7 +967,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 +980,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 +1025,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,6 +1169,14 @@ 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; } /** From a4931e69071bce862ddeefebd9999f29df7a699c Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 12 Jan 2016 23:10:54 +0900 Subject: [PATCH 060/277] Update del.d.ts 1.2.0 -> 2.2.0 --- del/del-tests.ts | 2 ++ del/del.d.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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; } } From ba4191f9dded38121c981d7989928da435a29aa6 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 16:17:07 +0200 Subject: [PATCH 061/277] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 99c32854a..89178262f 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -305,7 +305,7 @@ declare module moment { isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; // Since version 2.10.7+ - isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string); + isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; From 4f99c3c7e56b93e8b859fdaa008319224f887b6e Mon Sep 17 00:00:00 2001 From: guischdi Date: Tue, 12 Jan 2016 15:18:58 +0100 Subject: [PATCH 062/277] update shel.task() signature add done function to method signature of shell.task() --- gulp-shell/gulp-shell.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From 13dc65314e7f3387086cacc36d53543fa75aa7d9 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 12 Jan 2016 23:39:40 +0900 Subject: [PATCH 063/277] Fix #448 --- easeljs/easeljs.d.ts | 2043 +++++++++++++++++++++--------------------- 1 file changed, 1022 insertions(+), 1021 deletions(-) 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; + } +} From e52bf136cd6447937bedc248a28cbf22d23d70a9 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 12 Jan 2016 22:58:20 +0900 Subject: [PATCH 064/277] Update react-notification-system.d.ts --- react-notification-system/react-notification-system.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; From a29b4dbbd98e2ff2c31588cfe573d1417bc2b33d Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Wed, 13 Jan 2016 00:17:02 +0900 Subject: [PATCH 065/277] Fix #7131 --- fs-extra/fs-extra.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 69efd3471ad3b7a5ff4cc9280686b9db1bb2cf1d Mon Sep 17 00:00:00 2001 From: delphinus Date: Tue, 12 Jan 2016 22:47:38 +0900 Subject: [PATCH 066/277] Add methods & fix comments for LayoutView --- marionette/marionette.d.ts | 62 +++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index c75b62123..869339b6f 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -1176,37 +1176,43 @@ declare module Marionette { * makes it difficult to do close animations for a child view (false by * default) */ - destroyImmediate: boolean; + 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; @@ -1215,26 +1221,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 { From 73b8fac8325e35152fddfaf8825efca13b5a54e1 Mon Sep 17 00:00:00 2001 From: delphinus Date: Tue, 12 Jan 2016 23:06:47 +0900 Subject: [PATCH 067/277] Add tests for LayoutView & CollectionView --- marionette/marionette-tests.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 { From fc129dfe1ac8805399121feb406de91c9572b3f8 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 17:51:02 +0200 Subject: [PATCH 068/277] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 51 ++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 89178262f..6102d1e13 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -5,6 +5,8 @@ declare module moment { + type MomentComparable = Moment | string | number | Date | number[]; + interface MomentDateObject { years?: number; /* One digit */ @@ -271,8 +273,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; @@ -296,18 +298,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; - // Since version 2.10.7+ - isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; + /** + * @since 2.10.7+ + */ + isSameOrBefore(b: MomentComparable, granularity?: string): boolean; - // Deprecated as of 2.8.0. + /** + * @deprecated since version 2.8.0 + */ lang(language: string): Moment; lang(reset: boolean): Moment; lang(): MomentLanguage; @@ -320,11 +326,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; @@ -332,11 +342,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 version 2.10.7+ + /** + * @since 2.10.7+ + */ + creationData(): MomentCreationData; } @@ -444,7 +459,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; @@ -497,7 +514,9 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; - // Since version 2.10.7+ + /** + * @since 2.10.7+ + */ now(): number; /** From 8aacd9222c7e36171adb3dfbd6178a90965d91d8 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 18:02:48 +0200 Subject: [PATCH 069/277] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 6102d1e13..a11fad1dc 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -351,7 +351,6 @@ declare module moment { /** * @since 2.10.7+ */ - creationData(): MomentCreationData; } From 655f8c1bf3c71b0e1ba415b36309604f79326ac8 Mon Sep 17 00:00:00 2001 From: Nils Engelbach Date: Tue, 12 Jan 2016 17:11:18 +0100 Subject: [PATCH 070/277] Added Missing includes function overload The includes function call with an options object was not defined. See: http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state --- angular-ui-router/angular-ui-router.d.ts | 1 + 1 file changed, 1 insertion(+) 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; From 97ec10cb6c917dce7668f3833679506162c0f5c4 Mon Sep 17 00:00:00 2001 From: John Hasselkus Date: Tue, 12 Jan 2016 10:14:33 -0600 Subject: [PATCH 071/277] mongoose.d.ts Document interface should define _id as any In the Document interface definition of mongoose.d.ts, the _id field definition of _id: Types.ObjectId was wrong, as it can be any type. This commit changes the definition to _id: any to allow interfaces that extend Document to refine the definition of _id as appropriate to match the schema of the model/collection. --- mongoose/mongoose-tests.ts | 10 ++++++++++ mongoose/mongoose.d.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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; From 022f77341ec34dd5d5144edecf729573614431d1 Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Tue, 12 Jan 2016 16:27:04 +0000 Subject: [PATCH 072/277] Update helmet CSP typings --- helmet/helmet-tests.ts | 36 +++++++++++++++++++++++++++++++++++- helmet/helmet.d.ts | 32 +++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) 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; From 4d9c488acbb6069db668abf4d73aa4246c9f7c28 Mon Sep 17 00:00:00 2001 From: Tsvetomir Tsonev Date: Tue, 12 Jan 2016 22:25:16 +0200 Subject: [PATCH 073/277] Update Kendo UI TypeScript definitions for 2016 Q1 Signed-off-by: Tsvetomir Tsonev --- kendo-ui/kendo-ui.d.ts | 3581 ++++++++++++++++++++++------------------ 1 file changed, 1971 insertions(+), 1610 deletions(-) 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 { From 901e24cc8540866b1fbc1fb3f537d17e868d667c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 13 Jan 2016 02:22:46 +0500 Subject: [PATCH 074/277] lodash: signatures of _.sortByAll have been changed --- lodash/lodash-tests.ts | 68 ++++++++++++- lodash/lodash.d.ts | 218 +++++++++++++++++++++++++++++++---------- 2 files changed, 228 insertions(+), 58 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4dfaa33f1..f97b1cbc8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5230,11 +5230,71 @@ module TestSortBy { } } -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); }); +// _.sortByAll +module TestSortByAll { + type SampleObject = {a: number; b: string; c: boolean}; -result = _(foodsOrganic).sortByAll('organic', (food) => food.name, { organic: true }).value(); + let array: SampleObject[]; + let list: _.List; + let numericDictionary: _.NumericDictionary; + let dictionary: _.Dictionary;; + + { + let iteratees: (value: string) => any|((value: string) => any)[]; + let result: string[]; + + result = _.sortByAll('acbd', iteratees); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: SampleObject[]; + + result = _.sortByAll<{a: number}, SampleObject>(array, iteratees); + result = _.sortByAll(array, iteratees); + + result = _.sortByAll<{a: number}, SampleObject>(list, iteratees); + result = _.sortByAll(list, iteratees); + + result = _.sortByAll<{a: number}, SampleObject>(numericDictionary, iteratees); + result = _.sortByAll(numericDictionary, iteratees); + + result = _.sortByAll<{a: number}, SampleObject>(dictionary, iteratees); + result = _.sortByAll(dictionary, iteratees); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).sortByAll<{a: number}>(iteratees); + + result = _(list).sortByAll<{a: number}, SampleObject>(iteratees); + result = _(list).sortByAll(iteratees); + + result = _(numericDictionary).sortByAll<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).sortByAll(iteratees); + + result = _(dictionary).sortByAll<{a: number}, SampleObject>(iteratees); + result = _(dictionary).sortByAll(iteratees); + } + + { + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().sortByAll<{a: number}>(iteratees); + + result = _(list).chain().sortByAll<{a: number}, SampleObject>(iteratees); + result = _(list).chain().sortByAll(iteratees); + + result = _(numericDictionary).chain().sortByAll<{a: number}, SampleObject>(iteratees); + result = _(numericDictionary).chain().sortByAll(iteratees); + + result = _(dictionary).chain().sortByAll<{a: number}, SampleObject>(iteratees); + result = _(dictionary).chain().sortByAll(iteratees); + } +} // _.sortByOrder module TestSortByOrder { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5f0c07777..662f1366a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8517,76 +8517,186 @@ declare module _ { //_.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( + * 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 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, specified as individual values or arrays of values. + * @return Returns the new sorted array. + */ + sortByAll( collection: List, - iteratees: (ListIterator|string|Object)[]): T[]; + iteratees: ListIterator|string|W|(ListIterator|string|W)[] + ): 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 + * @see _.sortByAll */ sortByAll( - collection: (Array|List), - ...args: (ListIterator|Object|string)[] + collection: List, + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] ): T[]; + + /** + * @see _.sortByAll + */ + sortByAll( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] + ): T[]; + + /** + * @see _.sortByAll + */ + sortByAll( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] + ): T[]; + + /** + * @see _.sortByAll + */ + sortByAll( + collection: Dictionary, + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] + ): T[]; + + /** + * @see _.sortByAll + */ + sortByAll( + collection: Dictionary, + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: ListIterator|string|(ListIterator|string)[] + ): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** - * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts - * @param args The rules by which to sort + * @see _.sortByAll */ - sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + sortByAll( + iteratees: ListIterator|string|W|(ListIterator|string|W)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: ListIterator|string|W|(ListIterator|string|W)[] + ): LoDashImplicitArrayWrapper; /** - * @see _.sortByAll - **/ - sortByAll( - iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + * @see _.sortByAll + */ + sortByAll( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] + ): LoDashImplicitArrayWrapper; /** - * @see _.sortByAll - **/ + * @see _.sortByAll + */ + sortByAll( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortByAll + */ sortByAll( - ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + iteratees: ListIterator|string|(ListIterator|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: ListIterator|string|W|(ListIterator|string|W)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: ListIterator|string|W|(ListIterator|string|W)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByAll + */ + sortByAll( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] + ): LoDashExplicitArrayWrapper; } //_.sortByOrder From a94a38a68f9d670b46ba23f9c5af67018fedd7d8 Mon Sep 17 00:00:00 2001 From: igochkov Date: Tue, 12 Jan 2016 23:38:11 +0100 Subject: [PATCH 075/277] Typeahead constructor and events signitures changed to reflect latest 0.11.1 typeahead documentation --- typeahead/typeahead.d.ts | 842 ++++++++++++++++++++++++++++++++------- 1 file changed, 700 insertions(+), 142 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 8164d430e..aa1db2b44 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -6,148 +6,706 @@ /// interface JQuery { - - /** - * Destroys previously initialized typeaheads. This entails reverting - * DOM modifications and removing event handlers. - * - * @constructor - * @param methodName Method 'destroy' - */ - typeahead(methodName: 'destroy'): JQuery; - - /** - * Opens the dropdown menu of typeahead. Note that being open does not mean that the menu is visible. - * The menu is only visible when it is open and has content. - * - * @constructor - * @param methodName Method 'open' - */ - typeahead(methodName: 'open'): JQuery; - - /** - * Closes the dropdown menu of typeahead. - * - * @constructor - * @param methodName Method 'close' - */ - typeahead(methodName: 'close'): JQuery; - - /** - * Returns the current value of the typeahead. - * The value is the text the user has entered into the input element. - * - * @constructor - * @param methodName Method 'val' - */ - typeahead(methodName: 'val'): string; - - /** - * Sets the value of the typeahead. This should be used in place of jQuery#val. - * - * @constructor - * @param methodName Method 'val' - * @param query The value to be set - */ - typeahead(methodName: 'val', val: string): JQuery; - - /** - * Accommodates the val overload. - * - * @constructor - * @param methodName Method name ('val') - */ - typeahead(methodName: string): string; - - - /** - * Accommodates multiple overloads. - * - * @constructor - * @param methodName Method name - * @param query The query to be set in case method 'val' is used. - */ - typeahead(methodName: string, query: string): JQuery; - - /** - * Accomodates specifying options such as hint and highlight. - * This is in correspondence to the examples mentioned in http://twitter.github.io/typeahead.js/examples/ - * - * @constructor - * @param options ('hint' or 'highlight' or 'minLength' all of which are optional) - * @param datasets Array of datasets - */ - typeahead(options: Twitter.Typeahead.Options, datasets: Twitter.Typeahead.Dataset[]): JQuery; - - /** - * Accomodates specifying options such as hint and highlight. - * This is in correspondence to the examples mentioned in http://twitter.github.io/typeahead.js/examples/ - * - * @constructor - * @param options ('hint' or 'highlight' or 'minLength' all of which are optional) - * @param datasets One or more datasets passed in as arguments. - */ - typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; - - on(events: "typeahead:active", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:active", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:active", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:active", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:idle", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:idle", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:idle", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:idle", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:open", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:open", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:open", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:open", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:close", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:close", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:close", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:close", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:change", selector: string, data: any, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:change", selector: string, handler: (ev: JQueryEventObject) => any): JQuery; - on(events: "typeahead:change", handler: (ev: JQueryEventObject) => any): JQuery; - off(events: "typeahead:change", handler: (ev: JQueryEventObject) => any): JQuery; - - on(events: "typeahead:render", selector: string, data: any, handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - on(events: "typeahead:render", selector: string, handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - on(events: "typeahead:render", handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - off(events: "typeahead:render", handler: (ev: JQueryEventObject, suggestions: Array, async: boolean, datasetName: string) => any): JQuery; - - on(events: "typeahead:select", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:select", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - off(events: "typeahead:select", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - - on(events: "typeahead:autocomplete", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:autocomplete", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:autocomplete", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - off(events: "typeahead:autocomplete", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - - on(events: "typeahead:cursorchange", selector: string, data: any, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:cursorchange", selector: string, handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - on(events: "typeahead:cursorchange", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - off(events: "typeahead:cursorchange", handler: (ev: JQueryEventObject, suggestion: any) => any): JQuery; - - on(events: "typeahead:asyncrequest", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncrequest", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncrequest", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - off(events: "typeahead:asyncrequest", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - - on(events: "typeahead:asynccancel", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asynccancel", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asynccancel", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - off(events: "typeahead:asynccancel", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - - on(events: "typeahead:asyncreceive", selector: string, data: any, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncreceive", selector: string, handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - on(events: "typeahead:asyncreceive", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; - off(events: "typeahead:asyncreceive", handler: (ev: JQueryEventObject, query: string, datasetName: string) => any): JQuery; + /** + * For a given input[type="text"], enables typeahead functionality. + * + * @constructor + * @param options Options hash that's used for configuration + * @param datasets Array of datasets + */ + typeahead(options: Twitter.Typeahead.Options, datasets: Twitter.Typeahead.Dataset[]): JQuery; + + /** + * For a given input[type="text"], enables typeahead functionality. + * + * @constructor + * @param options Options hash that's used for configuration + * @param datasets One or more datasets passed as rest parameters. + */ + typeahead(options: Twitter.Typeahead.Options, ...datasets: Twitter.Typeahead.Dataset[]): JQuery; + + /** + * Returns the current value of the typeahead. + * The value is the text the user has entered into the input element. + * + * @constructor + * @param methodName Method 'val' + */ + typeahead(methodName: 'val'): string; + + /** + * Accommodates the val overload. + * + * @constructor + * @param methodName Method 'val' + */ + typeahead(methodName: string): string; + + /** + * Sets the value of the typeahead. This should be used in place of jQuery#val. + * + * @constructor + * @param methodName Method 'val' + * @param val The value to be set + */ + typeahead(methodName: 'val', val: string): JQuery; + + /** + * Accommodates the set val overload. + * + * @constructor + * @param methodName Method 'val' + * @param val The value to be set + */ + typeahead(methodName: string, val: string): JQuery; + + /** + * Opens the suggestion menu. + * + * @constructor + * @param methodName Method 'open' + */ + typeahead(methodName: 'open'): JQuery; + + /** + * Closes the suggestion menu. + * + * @constructor + * @param methodName Method 'close' + */ + typeahead(methodName: 'close'): JQuery; + + /** + * Removes typeahead functionality and reverts the input element back to its original state. + * + * @constructor + * @param methodName Method 'destroy' + */ + typeahead(methodName: 'destroy'): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:active", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:active", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:active", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:active event to the selected elements. + * + * @param events typeahead:active event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:active", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:idle", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:idle", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:idle", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:idle event to the selected elements. + * + * @param events typeahead:idle event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:idle", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:open", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:open", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:open", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:open event to the selected elements. + * + * @param events typeahead:open event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:open", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:close", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:close", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:close", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:close event to the selected elements. + * + * @param events typeahead:close event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:close", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:change", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:change", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:change", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:change event to the selected elements. + * + * @param events typeahead:change event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:change", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:render", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:render", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:render", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:render event to the selected elements. + * + * @param events typeahead:render event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:render", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:select", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:select", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:select", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:select event to the selected elements. + * + * @param events typeahead:select event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:select", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:autocomplete", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:autocomplete", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:autocomplete", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:autocomplete event to the selected elements. + * + * @param events typeahead:autocomplete event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:autocomplete", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:cursorchange", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:cursorchange", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:cursorchange", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:cursorchange event to the selected elements. + * + * @param events typeahead:cursorchange event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:cursorchange", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:asyncrequest", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncrequest", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncrequest", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncrequest event to the selected elements. + * + * @param events typeahead:asyncrequest event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncrequest", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:asynccancel", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asynccancel", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asynccancel", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asynccancel event to the selected elements. + * + * @param events typeahead:asynccancel event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asynccancel", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: "typeahead:asyncreceive", handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncreceive", data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncreceive", selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach an event handler function for typeahead:asyncreceive event to the selected elements. + * + * @param events typeahead:asyncreceive event fired when the typeahead moves to active state. + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: "typeahead:asyncreceive", selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:active event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:active", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:active event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:active", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:idle event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:idle", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:idle event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:idle", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:open event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:open", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:open event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:open", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:close event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:close", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:close event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:close", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:change event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:change", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:change event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:change", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:render event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:render", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:render event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:render", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:select event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:select", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:select event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:select", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:autocomplete event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:autocomplete", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:autocomplete event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:autocomplete", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:cursorchange event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:cursorchange", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:cursorchange event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:cursorchange", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncrequest event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncrequest", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncrequest event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncrequest", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asynccancel event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asynccancel", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asynccancel event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asynccancel", handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncreceive event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncreceive", selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events typeahead:asyncreceive event. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: "typeahead:asyncreceive", handler: (eventObject: JQueryEventObject) => any): JQuery; } declare module Twitter.Typeahead { From f7bbba882dd6220f130e0befa674bc343d29ff69 Mon Sep 17 00:00:00 2001 From: vangorra Date: Tue, 12 Jan 2016 18:19:50 -0800 Subject: [PATCH 076/277] Adding subscribe method to meteor angular IScope. --- angular-meteor/angular-meteor.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } /** From 1735153b55c4616192219e7edaecdef3971bd5b3 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 13 Jan 2016 04:20:47 +0100 Subject: [PATCH 077/277] Add definitions for gulp-filter (https://github.com/sindresorhus/gulp-filter) --- gulp-filter/gulp-filter-tests.ts | 71 ++++++++++++++++++++++++++++++++ gulp-filter/gulp-filter.d.ts | 33 +++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 gulp-filter/gulp-filter-tests.ts create mode 100644 gulp-filter/gulp-filter.d.ts 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; +} From bed1b13d7935dc027c94839379e654be96e8b0b2 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Sun, 10 Jan 2016 03:09:20 +0100 Subject: [PATCH 078/277] Removed the default keyword as it confuses some IDEs See discussion in https://github.com/mozilla/localForage/issues/494 --- localForage/localForage.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 15b9154db282c7d10236a18a978d3d21f5a6d575 Mon Sep 17 00:00:00 2001 From: Norgerman Date: Wed, 13 Jan 2016 13:59:22 +0800 Subject: [PATCH 079/277] change ResultSet.rows from Object[] to any[] --- any-db/any-db.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ From cf21ce49f0c2aad22adf98ec961f1fb46918b65a Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Wed, 13 Jan 2016 08:42:58 +0100 Subject: [PATCH 080/277] add camelcase --- camelcase/camelcase-tests.ts | 12 ++++++++++++ camelcase/camelcase.d.ts | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 camelcase/camelcase-tests.ts create mode 100644 camelcase/camelcase.d.ts 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; +} From 8b515b23637d52a56741bca9a6e67d42ff0422df Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Wed, 13 Jan 2016 08:48:52 +0100 Subject: [PATCH 081/277] add dot-prop --- dot-prop/dot-prop-tests.ts | 12 ++++++++++++ dot-prop/dot-prop.d.ts | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 dot-prop/dot-prop-tests.ts create mode 100644 dot-prop/dot-prop.d.ts 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; +} From 88296dd9b2c19f9dfd370b20087ec4e363852803 Mon Sep 17 00:00:00 2001 From: Oscar Lorentzon Date: Wed, 13 Jan 2016 11:05:44 +0100 Subject: [PATCH 082/277] Correct parameter type for Vector4.setAxisAngleFromRotationMatrix. The parameter to Vector4.setAxisAngleFromRotationMatrix is a Matrix4 from which the upper 3x3 matrix is used, not a Matrix3. See https://github.com/mrdoob/three.js/blob/master/src/math/Vector4.js#L271 for a reference. --- threejs/tests/math/test_unit_math.ts | 12 ++++++++++++ threejs/three.d.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/threejs/tests/math/test_unit_math.ts b/threejs/tests/math/test_unit_math.ts index 312a16b24..0c92e970a 100644 --- a/threejs/tests/math/test_unit_math.ts +++ b/threejs/tests/math/test_unit_math.ts @@ -3524,4 +3524,16 @@ ok( a.equals( b ), "Passed!" ); ok( b.equals( a ), "Passed!" ); }); + + test( "setAxisAngleFromRotationMatrix", function() { + var TOL = 1e-9; + + var r = new THREE.Matrix4().makeRotationZ(Math.PI / 2); + var v = new THREE.Vector4().setAxisAngleFromRotationMatrix(r); + + ok( v.x == 0, "Passed!" ); + ok( v.y == 0, "Passed!" ); + ok( v.z == 1, "Passed!" ); + ok( Math.abs(v.w - Math.PI / 2) < TOL, "Passed!" ); + }); }; diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 0717427b3..37804860e 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4166,7 +4166,7 @@ declare module THREE { * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm * @param m assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) */ - setAxisAngleFromRotationMatrix(m: Matrix3): Vector4; + setAxisAngleFromRotationMatrix(m: Matrix4): Vector4; min(v: Vector4): Vector4; max(v: Vector4): Vector4; From 321e862d5a3618f2ce96de0b4cc4075f4e93fad9 Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Wed, 13 Jan 2016 14:48:03 +0000 Subject: [PATCH 083/277] Update convict definitions to add custom formats --- convict/convict-tests.ts | 43 +++++++++++++++++++++++++++++- convict/convict.d.ts | 57 ++++++++++++++++++++++++---------------- 2 files changed, 76 insertions(+), 24 deletions(-) diff --git a/convict/convict-tests.ts b/convict/convict-tests.ts index 6cde3b38c..54a570141 100644 --- a/convict/convict-tests.ts +++ b/convict/convict-tests.ts @@ -6,6 +6,39 @@ 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 +79,15 @@ var conf = convict({ env: 'PORT', arg: 'port', } - } + }, + primeNumber: { + format: 'prime', + default: 17 + }, + percentNumber: { + format: 'float-percent', + default: 0.5 + }, }); diff --git a/convict/convict.d.ts b/convict/convict.d.ts index 74ed10038..332441b20 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -4,30 +4,41 @@ // 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; + format?: any; + 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; + } + } + interface convict { + addFormat(format: convict.Format): void; + addFormats(formats: { [name: string]: convict.Format }): void; + (config: convict.Schema): convict.Config; + } + var convict : convict; + export = convict; } + From c0ff329a4edad9e4df3a89d1d75c246c103cc325 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 13 Jan 2016 17:14:22 +0100 Subject: [PATCH 084/277] Add overload to allow both forms of global property setting in calq --- calq/calq.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/calq/calq.d.ts b/calq/calq.d.ts index c574df58f..390124c1e 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 From 60b04cfffea80d3687792e45d1450a1778e6b312 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 13 Jan 2016 17:17:37 +0100 Subject: [PATCH 085/277] Make property params non-options (whoops) --- calq/calq.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calq/calq.d.ts b/calq/calq.d.ts index 390124c1e..331b89720 100644 --- a/calq/calq.d.ts +++ b/calq/calq.d.ts @@ -21,7 +21,7 @@ declare module Calq trackPageView(action?:string):void; setGlobalProperty(name:string, value:any):void; - setGlobalProperty(params?: {[index:string]: any}):void; + setGlobalProperty(params: {[index:string]: any}):void; } interface User From 0074be4cf5ed6409842d115ca9dbe63e44d699a5 Mon Sep 17 00:00:00 2001 From: Jim McCarthy Date: Wed, 13 Jan 2016 11:26:37 -0500 Subject: [PATCH 086/277] Updated type file to include support for Async dropdowns. Added tests. --- react-select/react-select-tests.ts | 0 react-select/react-select-tests.tsx | 29 ++++++++++++++++++++++ react-select/react-select.d.ts | 37 +++++++++++++++++++---------- 3 files changed, 54 insertions(+), 12 deletions(-) delete mode 100644 react-select/react-select-tests.ts create mode 100644 react-select/react-select-tests.tsx 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
+ element to use. + */ + target?: (elem: Element) => Element; + } + + interface ITextOptions extends IOptions { + /** + * Returns the explicit text to copy. + * @param {Element} elem Current element + * @returns {String} Text to be copied. + */ + text?: (elem: Element) => string; + } +} + +declare module 'clipboardjs' { + export = clipboardjs; +} \ No newline at end of file From c4193a4d81b914dd8f233583131dc57fbb136d91 Mon Sep 17 00:00:00 2001 From: Andrey Kurosh Date: Fri, 15 Jan 2016 17:24:43 +0300 Subject: [PATCH 143/277] Tests & compilation fixes. --- clipboard.js/clipboard.js-tests.ts | 6 ++++-- clipboard.js/clipboard.js.d.ts | 17 +++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/clipboard.js/clipboard.js-tests.ts b/clipboard.js/clipboard.js-tests.ts index 5adbeda27..962bf34e0 100644 --- a/clipboard.js/clipboard.js-tests.ts +++ b/clipboard.js/clipboard.js-tests.ts @@ -1,14 +1,16 @@ -/// +/// var cb1 = new clipboardjs.Clipboard('.btn'); var cb2 = new clipboardjs.Clipboard('.btn', { action: elem => 'copy' }); var cb3 = new clipboardjs.Clipboard('.btn', { - action: elem => 'copy', text: elem => null }); var cb4 = new clipboardjs.Clipboard('.btn', { + target: elem => null +}); +var cb5 = new clipboardjs.Clipboard('.btn', { action: elem => 'copy', target: elem => null }); diff --git a/clipboard.js/clipboard.js.d.ts b/clipboard.js/clipboard.js.d.ts index 26b1a9201..6a8af8519 100644 --- a/clipboard.js/clipboard.js.d.ts +++ b/clipboard.js/clipboard.js.d.ts @@ -6,22 +6,21 @@ declare module clipboardjs { export class Clipboard { - constructor (selector: string, options?: ITargetOptions); - constructor (selector: string, options?: ITextOptions); + 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); - on(type: "error", handler: (e: Event) => void); - on(type: string, handler: (e: Event) => void); + 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(); + destroy(): void; } interface IOptions { @@ -31,20 +30,14 @@ declare module clipboardjs { * @returns {String} Only 'cut' or 'copy'. */ action?: (elem: Element) => string; - } - // Two different interfaces, because 'target' and 'text' attributes cannot be used together. - - interface ITargetOptions extends IOptions { /** * Overwrites default target input element. * @param {Element} elem Current element * @returns {Element} element to use. */ target?: (elem: Element) => Element; - } - interface ITextOptions extends IOptions { /** * Returns the explicit text to copy. * @param {Element} elem Current element From 04371efd2aec9f2f8a5b11a23a0ca991a503b19f Mon Sep 17 00:00:00 2001 From: Jimmy Anderson Date: Fri, 15 Jan 2016 09:36:33 -0500 Subject: [PATCH 144/277] Add ignoreReadonly option --- bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts | 1 + 1 file changed, 1 insertion(+) 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 { From d8996a18ee1c859a69cdd3450c5ff93cd56bb378 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 15 Jan 2016 17:37:54 +0100 Subject: [PATCH 145/277] extended-listbox.d.ts version 1.1.x --- extended-listbox/extended-listbox-tests.ts | 146 +++++++++++++++++---- extended-listbox/extended-listbox.d.ts | 110 +++++++++++++++- 2 files changed, 228 insertions(+), 28 deletions(-) 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; } From ce6e288c4d14d66c216b153dd25558e01c6628ed Mon Sep 17 00:00:00 2001 From: Nimish Telang Date: Fri, 15 Jan 2016 16:46:36 +0000 Subject: [PATCH 146/277] Update express router type, to work around typescript issue #1805 --- express/express-tests.ts | 20 +++++++++++++++++++- express/express.d.ts | 6 ++---- 2 files changed, 21 insertions(+), 5 deletions(-) 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..1a3784049 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 { @@ -881,8 +880,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; }; /** From 37afc2c83af2b87a3d2812d2fd2615a6dde825ae Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 09:44:10 -0800 Subject: [PATCH 147/277] improve typings for 12.x --- hapi/hapi.d.ts | 1949 +++++++++++++++++++++++++----------------------- 1 file changed, 1009 insertions(+), 940 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index aa814fcc3..a832922b8 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -1,129 +1,129 @@ -// Type definitions for hapi 8.8.0 +// Type definitions for hapi 12.0.1 // Project: http://github.com/spumko/hapi // Definitions by: Jason Swearingen // 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,273 +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; + 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 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?: { + 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. @@ -514,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). @@ -572,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: @@ -583,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. @@ -592,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. @@ -601,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. @@ -613,36 +622,36 @@ 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 { + 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. @@ -652,14 +661,14 @@ declare module "hapi" { * 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; + 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; - } + 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(), @@ -671,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: { @@ -709,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. @@ -765,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: @@ -899,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: @@ -907,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. @@ -981,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: @@ -1031,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. @@ -1086,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. @@ -1211,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. @@ -1229,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. @@ -1257,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. @@ -1275,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]) @@ -1316,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: @@ -1351,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. @@ -1366,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'. @@ -1378,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. @@ -1419,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). @@ -1467,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(); @@ -1477,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' }); @@ -1485,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(); @@ -1495,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'); @@ -1540,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. @@ -1552,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. @@ -1572,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) { @@ -1583,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: @@ -1600,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'); @@ -1614,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: @@ -1640,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. @@ -1660,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(); @@ -1685,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: @@ -1707,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: @@ -1733,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. @@ -1750,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) @@ -1773,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 @@ -1787,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: @@ -1809,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: @@ -1826,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) @@ -1837,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: @@ -1846,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: @@ -1873,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: @@ -1913,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 @@ -1929,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: @@ -1945,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. @@ -1962,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'). @@ -1981,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; @@ -2025,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) @@ -2050,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 '.'. @@ -2064,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: @@ -2089,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: @@ -2122,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. @@ -2134,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. @@ -2149,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: @@ -2160,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. @@ -2192,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: @@ -2205,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. @@ -2236,7 +2305,7 @@ declare module "hapi" { // } //] */ - table(host?: any): IConnectionTable; + table(host?: any): IConnectionTable; /**server.views(options) Initializes the server views manager @@ -2250,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; - } + } } From 8d852210cf8378ac5fe11380b5d1d17f2e5b0968 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 09:48:12 -0800 Subject: [PATCH 148/277] fix bluebird.d.ts promise.delay() typing: ms is first arg. see http://bluebirdjs.com/docs/api/promise.delay.html --- bluebird/bluebird.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; /** From 3c1f12954a5417a4a0d0dbb859486c148e59ba0d Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 09:56:32 -0800 Subject: [PATCH 149/277] react-router.d.ts: add RouteComponentProps.children --- react-router/react-router.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 01411fcd5..6f8410bad 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 } From 82a2b628a36a0d66d1c8623a51cca07899f1a187 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 15 Jan 2016 10:13:52 -0800 Subject: [PATCH 150/277] fix bluebird test file for proper Promise.delay() parameter order. --- bluebird/bluebird-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 5bff5f871a0ea58be885fb52146cb67b86bcc1ae Mon Sep 17 00:00:00 2001 From: Will Johnston Date: Fri, 15 Jan 2016 12:19:16 -0600 Subject: [PATCH 151/277] adding catch onto Thenable, updating tests --- es6-promise/es6-promise-tests.ts | 57 +++++++++++++++++--------------- es6-promise/es6-promise.d.ts | 1 + 2 files changed, 31 insertions(+), 27 deletions(-) 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 { From 0224e96881ac7a7ee8017defbe397ff5d8c77c15 Mon Sep 17 00:00:00 2001 From: Will Johnston Date: Fri, 15 Jan 2016 12:25:22 -0600 Subject: [PATCH 152/277] fixing promises a plus test for compatibility with es6 promises --- promises-a-plus/promises-a-plus-tests.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; From 7554cff7c4dd34decc2f3dc0d711a6c288174eee Mon Sep 17 00:00:00 2001 From: Kevin Smets Date: Fri, 15 Jan 2016 20:26:20 +0100 Subject: [PATCH 153/277] Fixed restoreConsole --- log4js/log4js.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 4a1160ec1..ab172a122 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -17,10 +17,9 @@ declare module "log4js" { /** * Restores the console - * @param logger * @returns void */ - export function restoreConsole(logger?: Logger): void; + export function restoreConsole(): void; /** * Get a logger instance. Instance is cached on categoryName level. From 33e0e801f1f2d1f13430883794cdf104099dce6c Mon Sep 17 00:00:00 2001 From: haizz Date: Fri, 15 Jan 2016 22:32:20 +0200 Subject: [PATCH 154/277] Update react-bootstrap.d.ts --- react-bootstrap/react-bootstrap.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index c63c55e9d..597b80cbd 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; From a71a912ada937fc8dc8e499f7ba3b01a59a2c960 Mon Sep 17 00:00:00 2001 From: David Reher Date: Fri, 15 Jan 2016 22:38:55 +0100 Subject: [PATCH 155/277] added missing properties to Instruction interface in angular-component-router --- angularjs/angular-component-router.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts index da93596ca..3b6e2b726 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; From 046e0e85d04f75a692bca781281578c9fd8cd418 Mon Sep 17 00:00:00 2001 From: David Reher Date: Fri, 15 Jan 2016 22:52:08 +0100 Subject: [PATCH 156/277] accidently copied the default value :/ --- angularjs/angular-component-router.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts index 3b6e2b726..228db1e01 100644 --- a/angularjs/angular-component-router.d.ts +++ b/angularjs/angular-component-router.d.ts @@ -38,7 +38,7 @@ declare module angular { interface Instruction { component: ComponentInstruction; child: Instruction; - auxInstruction: {[key: string]: Instruction} = {}; + auxInstruction: {[key: string]: Instruction}; urlPath(): string; From 6036819810bb7af82fb1047e3c6ed9f3e59513e2 Mon Sep 17 00:00:00 2001 From: pdeva Date: Sat, 16 Jan 2016 00:34:55 -0800 Subject: [PATCH 157/277] updated properties for some components to match reality --- react-bootstrap/react-bootstrap.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index c63c55e9d..928b1a042 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -328,7 +328,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 { } @@ -813,6 +813,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; From c2bbed113e3ba69297dba951f725978444e9478a Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Sat, 16 Jan 2016 11:10:06 +0100 Subject: [PATCH 158/277] - remove constants from definition file (not supported) - rename the scopes so old implementations still work - add return type to IDialogConfirmScope.confirm --- ng-dialog/ng-dialog.d.ts | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index ba632fbc1..a89abd929 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -7,17 +7,6 @@ declare module angular.dialog { - /* - * Everytime ngDialog is opened or closed we're broadcasting three events - * (dispatching events downwards to all child scopes): - * - * for more info see: https://github.com/likeastore/ngDialog#events - */ - export const EVENT_OPENEND:string = 'ngDialog.opened'; - export const EVENT_CLOSING:string = 'ngDialog.closing'; - export const EVENT_CLOSED:string = 'ngDialog.closed'; - - interface IDialogService { getDefaults(): IDialogOptions; open(options: IDialogOpenOptions): IDialogOpenResult; @@ -72,7 +61,7 @@ declare module angular.dialog { /** * Dialog Scope which extends the $scope. */ - interface IDialogOpenScope extends angular.IScope { + interface IDialogScope extends angular.IScope { /** * This allows you to close dialog straight from handler in a popup element. * @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog. @@ -92,14 +81,14 @@ declare module angular.dialog { ngDialogId : string; } - interface IDialogOpenConfirmScope extends IDialogOpenScope { + 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) + confirm(value?:any) : void; } interface IDialogOptions { @@ -234,7 +223,7 @@ declare module angular.dialog { /** * 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?: IDialogOpenScope; + scope?: IDialogScope; /** * An optional map of dependencies which should be injected into the controller. If any of these dependencies @@ -251,6 +240,6 @@ declare module angular.dialog { } interface IDialogOpenConfirmOptions extends IDialogOpenOptions { - scope?: IDialogOpenConfirmScope; + scope?: IDialogConfirmScope; } } From 4fde70e3c11cf39d0d4523065fcb3525c815ae6f Mon Sep 17 00:00:00 2001 From: Michael Wittwer Date: Sat, 16 Jan 2016 11:14:14 +0100 Subject: [PATCH 159/277] - update test --- ng-dialog/ng-dialog-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts index f7b867d01..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.IDialogOpenScope) { + constructor($scope:angular.dialog.IDialogScope) { $scope.closeThisDialog("bye"); } From 684cd0268c021d426175802f14d8c38153463cab Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sat, 16 Jan 2016 16:07:04 -0300 Subject: [PATCH 160/277] add wiredep definition --- wiredep/wiredep-tests.ts | 17 ++ wiredep/wiredep.d.ts | 372 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 389 insertions(+) create mode 100644 wiredep/wiredep-tests.ts create mode 100644 wiredep/wiredep.d.ts diff --git a/wiredep/wiredep-tests.ts b/wiredep/wiredep-tests.ts new file mode 100644 index 000000000..4a8313bd6 --- /dev/null +++ b/wiredep/wiredep-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import gulp = require('gulp'); +import wiredep = require('wiredep'); + +gulp.task('bower', function () { + gulp.src('./src/footer.html') + .pipe(wiredep.stream({ + cwd:'.', + overrides:{ + optional: 'configuration', + goes: 'here' + } + })) + .pipe(gulp.dest('./dest')); +}); \ No newline at end of file diff --git a/wiredep/wiredep.d.ts b/wiredep/wiredep.d.ts new file mode 100644 index 000000000..add84b164 --- /dev/null +++ b/wiredep/wiredep.d.ts @@ -0,0 +1,372 @@ +// Type definitions for Wiredep v3.0.x +// Project: https://github.com/taptapship/wiredep +// Definitions by: Abraão Alves +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'wiredep' { + + interface PathFiles{ + [type: string]: string[]; + } + + /** + * @return {PathFiles} paths to your files by extension + * @example: + * { + * js: [ + * 'paths/to/your/js/files.js', + * 'in/their/order/of/dependency.js' + * ], + * css: [ + * 'paths/to/your/css/files.css' + * ], + * // etc. + * } + */ + function Wiredep(config: WiredepParams): PathFiles; + + module Wiredep { + export function stream(config: WiredepParams): NodeJS.ReadWriteStream; + } + + + interface WiredepParams { + src?: string | string[]; + /** + * the directory of your Bower packages. + * Default: '.bowerrc'.directory || bower_components + */ + directory?: string; + /** + * your bower.json file contents. + * Default: require('./bower.json') + */ + bowerJson?: string; + + + // ----- Advanced Configuration ----- + // All of the below settings are for advanced configuration, to + // give your project support for additional file types and more + // control. + // + // Out of the box, wiredep will handle HTML files just fine for + // JavaScript and CSS injection. + + /** + * path to where we are pretending to be + */ + cwd?: string; + /** + * Default: true + */ + dependencies?: boolean; + /** + * Default: false + */ + devDependencies?: boolean; + /** + * Default: false + */ + includeSelf?: boolean; + /** + * @example: + * [ /jquery/, 'bower_components/modernizr/modernizr.js' ] + */ + exclude?: Array; + + /** + * string or regexp to ignore from the injected filepath + * @example: + * [ /jquery/, 'bower_components/modernizr/modernizr.js' ] + */ + ignorePath?: string | RegExp; + + /** + * This inline object offers another way to define your overrides if + * modifying your project's `bower.json` isn't an option. + */ + overrides?: Object; + + /** + * If not overridden, an error will throw + * + * err.code can be: + * - "PKG_NOT_INSTALLED" (a Bower package was not found) + * - "BOWER_COMPONENTS_MISSING" (cannot find the `bower_components` directory) + */ + onError?: (err: Error) => void; + + /** + * @param {string} filePath name of file that was updated + */ + onFileUpdated?: (filePath: string) => void; + + /** + * @param {FileObject} fileObject + */ + onPathInjected?: (fileObject: FileObject) => void; + + /** + * @param {string} pkg name of bower package without main + */ + onMainNotFound?: (pkg: string) => void; + + fileTypes? : FileTypes; + } + + interface FileObject { + /** + * type of wiredep block ('js', 'css', etc) + */ + block: string; + /** + * name of file that was updated + */ + file: string; + /** + * path to file that was injected + */ + path: string + } + + interface FileTypes { + fileExtension: { + /** + * match the beginning-to-end of a bower block in this type of file + */ + block: RegExp; + detect: { + /** + * match the way this type of file is included + */ + typeOfBowerFile: RegExp; + }; + replace: { + /** + * + */ + typeOfBowerFile: string; + /** + * @exemple: + * return '' + */ + anotherTypeOfBowerFile: (filePath) => string; + } + }; + + // defaults: + html: { + /** + * @example: + * /(([ \t]*))(\n|\r|.)*?()/gi + */ + block: RegExp; + + detect: { + /** + * @example: + * /' + */ + js: string; + /** + * @example: + * '' + */ + css: string; + }; + }; + + jade: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + detect: { + /** + * @example: + * /script\(.*src=['"]([^'"]+)/gi + */ + js: RegExp; + /** + * @example: + * /link\(.*href=['"]([^'"]+)/gi + */ + css: RegExp; + }; + + replace: { + /** + * @example: + * 'script(src=\'{{filePath}}\')' + */ + js: string; + /** + * @example: + * 'link(rel=\'stylesheet\', href=\'{{filePath}}\')' + */ + css: string; + } + }; + + less: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + detect: { + /** + * @example: + * /@import\s['"](.+css)['"]/gi + */ + css: RegExp; + /** + * @example: + * /@import\s['"](.+less)['"]/gi + */ + less: RegExp + }; + + replace: { + /** + * @example: + * '@import "{{filePath}}";' + */ + css: string; + /** + * @example: + * '@import "{{filePath}}";' + */ + less: string; + }; + }; + + scss: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + detect: { + /** + * @example: + * /@import\s['"](.+css)['"]/gi + */ + css: RegExp; + /** + * @example: + * /@import\s['"](.+sass)['"]/gi + */ + sass: RegExp; + /** + * @example: + * /@import\s['"](.+scss)['"]/gi + */ + scss: RegExp; + }, + replace: { + /** + * @example: + * '@import "{{filePath}}";' + */ + css: string; + /** + * @example: + * '@import "{{filePath}}";' + */ + sass: string; + /** + * @example: + * '@import "{{filePath}}";' + */ + scss: string; + } + }; + + styl: { + /** + * @example: + * /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi + */ + block: RegExp; + + detect: { + /** + * @example: + * /@import\s['"](.+css)['"]/gi + */ + css: RegExp; + /** + * @example: + * /@import\s['"](.+styl)['"]/gi + */ + styl: RegExp; + }; + replace: { + /** + * @example: + * '@import "{{filePath}}"' + */ + css: string; + /** + * @example: + * '@import "{{filePath}}"' + */ + styl: string; + }; + }; + + yaml: { + /** + * @example: + * /(([ \t]*)#\s*bower:*(\S*))(\n|\r|.)*?(#\s*endbower)/gi + */ + block: RegExp; + + detect: { + /** + * @example: + * /-\s(.+js)/gi + */ + js: RegExp; + /** + * @example: + * /-\s(.+css)/gi + */ + css: RegExp; + }; + + replace: { + /** + * @example: + * '- {{filePath}}' + */ + js: string; + /** + * @example: + * '- {{filePath}}' + */ + css: string; + }; + }; + } + + +export = Wiredep; +} \ No newline at end of file From 263c39f5766f8eb9b8738b1cba6591efb131f21f Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 16 Jan 2016 22:57:14 +0500 Subject: [PATCH 161/277] base-x and bs58: definitions and tests added --- base-x/base-x-tests.ts | 14 ++++++++++++++ base-x/base-x.d.ts | 28 ++++++++++++++++++++++++++++ bs58/bs58-tests.ts | 12 ++++++++++++ bs58/bs58.d.ts | 14 ++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 base-x/base-x-tests.ts create mode 100644 base-x/base-x.d.ts create mode 100644 bs58/bs58-tests.ts create mode 100644 bs58/bs58.d.ts 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/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; +} From 73f1ee61d99dbdcfd5456a1f07a297bd69906ee2 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 16 Jan 2016 11:20:17 -0800 Subject: [PATCH 162/277] remove dependency on es6-promise.d.ts (it prevented using with other promise library definitions) --- axios/axios.d.ts | 264 ++++++++++++++++++++++++----------------------- 1 file changed, 137 insertions(+), 127 deletions(-) diff --git a/axios/axios.d.ts b/axios/axios.d.ts index 48f57a73a..fd19caf94 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -3,160 +3,170 @@ // 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 + * - request body data type */ - transformRequest?: ((data:T) => U)|[(data:T) => U]; + interface AxiosXHRConfigBase { + + /** + * 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 + */ + headers?: Object; + + /** + * URL parameters to be sent with the request + */ + params?: Object; + + /** + * indicates whether or not cross-site Access-Control requests + * should be made using credentials + */ + withCredentials?: boolean; + + /** + * 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 response data to be made before it is passed to then/catch + * - request body data type */ - transformResponse?: (data:T) => U; + 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; + } /** - * custom headers to be sent + * - expected response type, + * - request body data type */ - headers?: 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; + } /** - * URL parameters to be sent with the request + * - expected response type, + * - request body data type */ - params?: Object; + interface AxiosStatic { - /** - * indicates whether or not cross-site Access-Control requests - * should be made using credentials - */ - withCredentials?: boolean; + (config: AxiosXHRConfig): IPromise>; - /** - * indicates the type of data that the server will respond with - * options are 'arraybuffer', 'blob', 'document', 'json', 'text' - */ - responseType?: string; + new (config: AxiosXHRConfig): IPromise>; - /** - * 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 = GET + */ + get(url: string, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = DELETE - */ - delete(url: string, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = DELETE + */ + delete(url: string, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = HEAD - */ - head(url: string, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = HEAD + */ + head(url: string, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = POST - */ - post(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = POST + */ + post(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = PUT - */ - put(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; + /** + * convenience alias, method = PUT + */ + put(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; - /** - * convenience alias, method = PATCH - */ - patch(url: string, data?: any, config?: AxiosXHRConfigBase): Promise>; - } + /** + * convenience alias, method = PATCH + */ + patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; + } } declare var axios: Axios.AxiosStatic; declare module "axios" { - export = axios; + export = axios; } From 5421783adfaf9b99e9274f4488cfc0ee73f17a56 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Sat, 16 Jan 2016 00:30:37 +0100 Subject: [PATCH 163/277] added copy-paste --- copy-paste/copy-paste-tests.ts | 16 ++++++++++++ copy-paste/copy-paste.d.ts | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 copy-paste/copy-paste-tests.ts create mode 100644 copy-paste/copy-paste.d.ts 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 From c1dc967273846cde4088f7f1c3b7438ed4a5f88d Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Sun, 17 Jan 2016 14:44:57 +0100 Subject: [PATCH 164/277] matter-js updated to version 0.9.0 --- matter-js/matter-js-tests.ts | 26 +- matter-js/matter-js.d.ts | 4478 +++++++++++++++++++++++----------- 2 files changed, 3100 insertions(+), 1404 deletions(-) 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..aa9f5c0b3 100644 --- a/matter-js/matter-js.d.ts +++ b/matter-js/matter-js.d.ts @@ -1,1480 +1,3183 @@ -// 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 -{ - 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 - { - /** - * 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; - /** - * 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; + + + + export interface IEvent { + /** + * The name of the event + */ + name: string; + /** + * The source object of the event + */ + 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; + * @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; - /** - * 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; /** * Fired when the mouse is down (or a touch has started) during the last step @@ -1482,7 +3185,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 +3193,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 +3201,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; } } From 6670de8685a6623e6907316abc84d4847b47927e Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sun, 17 Jan 2016 12:06:17 -0300 Subject: [PATCH 165/277] fix error "implicity any" --- wiredep/wiredep.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiredep/wiredep.d.ts b/wiredep/wiredep.d.ts index add84b164..ec256b47b 100644 --- a/wiredep/wiredep.d.ts +++ b/wiredep/wiredep.d.ts @@ -152,7 +152,7 @@ declare module 'wiredep' { * @exemple: * return '' */ - anotherTypeOfBowerFile: (filePath) => string; + anotherTypeOfBowerFile: (filePath: string) => string; } }; From 6a287502dab374e7d4cbf18ea1ac5dff7f74726a Mon Sep 17 00:00:00 2001 From: Olivier CHEVET Date: Sun, 17 Jan 2016 17:38:52 +0100 Subject: [PATCH 166/277] Added missing functions from version 3.31 - reset - epilog/epilogue - locale - detectLocale - choices - exitProcess Added an extra prototype for version, accepting a function argument --- yargs/yargs-tests.ts | 64 ++++++++++++++++++++++++++++++++++++++++++++ yargs/yargs.d.ts | 17 ++++++++++++ 2 files changed, 81 insertions(+) diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index f20254990..d504cd181 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -134,6 +134,16 @@ function Argv$options() { ; } +function Argv$choices() { + // example from documentation + var argv = yargs + .alias('i', 'ingredient') + .describe('i', 'choose your sandwich ingredients') + .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) + .help('help') + .argv +} + function command() { var argv = yargs .usage('npm ') @@ -208,4 +218,58 @@ function Argv$version() { var argv3 = yargs .version('1.0.0', '--version', 'description'); + + var argv4 = yargs + .version( function() { return '1.0.0'; }, '--version', 'description'); +} + +function Argv$locale() { + var argv = yargs + .usage('./$0 - follow ye instructions true') + .option('option', { + alias: 'o', + describe: "'tis a mighty fine option", + demand: true + }) + .command('run', "Arrr, ya best be knowin' what yer doin'") + .example('$0 run foo', "shiver me timbers, here's an example for ye") + .help('help') + .wrap(70) + .locale('pirate') + .argv +} + +function Argv$epilogue() { + var argv = yargs + .epilogue('for more information, find our manual at http://example.com'); +} + +function Argv$reset() { + var ya = yargs + .usage('$0 command') + .command('hello', 'hello command') + .command('world', 'world command') + .demand(1, 'must provide a valid command'), + argv = yargs.argv, + command = argv._[0]; + + if (command === 'hello') { + ya.reset() + .usage('$0 hello') + .help('h') + .example('$0 hello', 'print the hello message!') + .argv + + console.log('hello!'); + } else if (command === 'world'){ + ya.reset() + .usage('$0 world') + .help('h') + .example('$0 world', 'print the world message!') + .argv + + console.log('world!'); + } else { + ya.showHelp(); + } } diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index 03b7c05dc..637137fbf 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -11,6 +11,13 @@ declare module "yargs" { (...args: any[]): any; parse(...args: any[]): any; + reset(): Argv; + + locale(): string; + locale(loc:string): Argv; + + detectLocale(detect:boolean): Argv; + alias(shortName: string, longName: string): Argv; alias(aliases: { [shortName: string]: string }): Argv; alias(aliases: { [shortName: string]: string[] }): Argv; @@ -71,6 +78,9 @@ declare module "yargs" { string(key: string): Argv; string(keys: string[]): Argv; + choices(choices: Object): Argv; + choices(key: string, values:any[]): Argv; + config(key: string): Argv; config(keys: string[]): Argv; @@ -81,12 +91,18 @@ declare module "yargs" { help(): string; help(option: string, description?: string): Argv; + epilog(msg: string): Argv; + epilogue(msg: string): Argv; + version(version: string, option?: string, description?: string): Argv; + version(version: () => string, option?: string, description?: string): Argv; showHelpOnFail(enable: boolean, message?: string): Argv; showHelp(func?: (message: string) => any): Argv; + exitProcess(enabled:boolean): Argv; + /* Undocumented */ normalize(key: string): Argv; @@ -115,6 +131,7 @@ declare module "yargs" { description?: any; desc?: any; requiresArg?: any; + choices?:string[]; } type SyncCompletionFunction = (current: string, argv: any) => string[]; From b64f4c98948d5378e32ee7bab158793257f07ec2 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Sun, 17 Jan 2016 21:08:52 +0100 Subject: [PATCH 167/277] module name added, removed empty lines --- matter-js/matter-js.d.ts | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts index aa9f5c0b3..ed5412b52 100644 --- a/matter-js/matter-js.d.ts +++ b/matter-js/matter-js.d.ts @@ -4,6 +4,9 @@ // David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module 'matter-js' { + export = Matter; +} declare module Matter { /** @@ -2882,32 +2885,12 @@ declare module Matter { } - - export interface ICollisionFilter { category: number; mask: number; group: number; } - - - - - - - - - - - - - - - - - - export interface IMousePoint { x: number; y: number; @@ -2932,14 +2915,6 @@ declare module Matter { pixelRatio: number; } - - - - - - - - export interface IEvent { /** * The name of the event @@ -3177,8 +3152,6 @@ declare module Matter { */ 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 * @param obj From 4128f7af06c355e3526b7cf7cbb85e2e43bff167 Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Sun, 17 Jan 2016 21:46:29 +0100 Subject: [PATCH 168/277] Update definitions for socket.io to v1.4.4. --- socket.io/socket.io.d.ts | 58 +++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 355606858..67fb7dd9a 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -1,6 +1,6 @@ -// Type definitions for socket.io 1.3.5 +// Type definitions for socket.io 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly +// Definitions by: PROGRE , Damian Connolly , Florent Poujol // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -248,6 +248,18 @@ declare module SocketIO { * @see send( ...args ) */ write( ...args: any[] ): Namespace; + + /** + * Gets a list of clients + * @return The default '/' Namespace + */ + clients( ...args: any[] ): Namespace; + + /** + * Sets the compress flag + * @return The default '/' Namespace + */ + compress( ...args: any[] ): Namespace; } /** @@ -360,9 +372,10 @@ declare module SocketIO { server: Server; /** - * A list of all the Sockets connected to this Namespace + * A dictionary of all the Sockets connected to this Namespace, where + * the Socket ID is the key */ - sockets: Socket[]; + sockets: { [id: string]: Socket }; /** * A dictionary of all the Sockets connected to this Namespace, where @@ -437,6 +450,19 @@ declare module SocketIO { * @ This Namespace */ on( event: string, listener: Function ): Namespace; + + /** + * Gets a list of clients. + * @return This Namespace + */ + clients( fn: Function ): Namespace; + + /** + * Sets the compress flag. + * @param compress If `true`, compresses the sending data + * @return This Namespace + */ + compress( compress: boolean ): Namespace; } /** @@ -506,9 +532,10 @@ declare module SocketIO { }; /** - * The list of rooms that this Socket is currently in + * The list of rooms that this Socket is currently in, where + * the ID the the room ID */ - rooms: string[]; + rooms: { [id: string]: string }; /** * Is the Socket currently connected? @@ -702,6 +729,13 @@ declare module SocketIO { * @return An array of callback Functions, or an empty array if we don't have any */ listeners( event: string ):Function[]; + + /** + * Sets the compress flag + * @param compress If `true`, compresses the sending data + * @return This Socket + */ + compress( compress: boolean ): Socket; } /** @@ -715,10 +749,10 @@ declare module SocketIO { nsp: Namespace; /** - * A dictionary of all the rooms that we have in this namespace, each room - * a dictionary of all the sockets currently in that room + * A dictionary of all the rooms that we have in this namespace + * The rooms are made of a `sockets` key which is the dictionary of sockets per ID */ - rooms: {[room: string]: {[id: string]: boolean }}; + rooms: {[room: string]: {sockets: {[id: string]: boolean }}}; /** * A dictionary of all the socket ids that we're dealing with, and all @@ -809,10 +843,10 @@ declare module SocketIO { request: any; /** - * The list of sockets currently connect via this client (i.e. to different - * namespaces) + * The dictionary of sockets currently connect via this client (i.e. to different + * namespaces) where the Socket ID is the key */ - sockets: Socket[]; + sockets: {[id: string]: Socket}; /** * A dictionary of all the namespaces for this client, with the Socket that From 495f2734927a644e913f9ed8f4d7d903f276f41d Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Fri, 15 Jan 2016 21:43:29 +0100 Subject: [PATCH 169/277] Update definitions for socket.io-client to v1.4.4. --- socket.io-client/socket.io-client.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts index 32f51aea4..56d0a0f5b 100644 --- a/socket.io-client/socket.io-client.d.ts +++ b/socket.io-client/socket.io-client.d.ts @@ -1,6 +1,6 @@ -// Type definitions for socket.io-client 1.3.5 +// Type definitions for socket.io-client 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly +// Definitions by: PROGRE , Damian Connolly , Florent Poujol // Definitions: https://github.com/borisyankov/DefinitelyTyped declare var io: SocketIOClientStatic; @@ -219,6 +219,7 @@ declare module SocketIOClient { * connect * connect_error * connect_timeout + * connecting * disconnect * error * reconnect @@ -226,6 +227,8 @@ declare module SocketIOClient { * reconnect_failed * reconnect_error * reconnecting + * ping + * pong * then the event is emitted normally. Otherwise, if we're connected, the * event is sent. Otherwise, it's buffered. * @@ -248,6 +251,13 @@ declare module SocketIOClient { * @see close() */ disconnect():Socket; + + /** + * Sets the compress flag. + * @param compress If `true`, compresses the sending data + * @return this Socket + */ + compress(compress: boolean):Socket; } /** @@ -308,7 +318,7 @@ declare module SocketIOClient { /** * The currently connected sockets */ - connected: Socket[]; + connecting: Socket[]; /** * If we should auto connect (also used when creating Sockets). Set via the From 37929dedfb6033988dda368e6f27f4af41b28326 Mon Sep 17 00:00:00 2001 From: "Michael J. Bennett" Date: Sun, 17 Jan 2016 18:10:50 -0500 Subject: [PATCH 170/277] Adds support for invariant 2.2.0 --- invariant/invariant-tests.ts | 22 ++++++++++++++++++++++ invariant/invariant.d.ts | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 invariant/invariant-tests.ts create mode 100644 invariant/invariant.d.ts 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; + } +} + From fe559849bffe3845ee62e585b4765c2cf3c685be Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 13:49:09 +1100 Subject: [PATCH 171/277] ga('UA-65432-1', 'auto') actually returns `undefined` --- google.analytics/ga-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga-tests.ts b/google.analytics/ga-tests.ts index dd03e0d25..acff9eb55 100644 --- a/google.analytics/ga-tests.ts +++ b/google.analytics/ga-tests.ts @@ -40,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'); From 91fbf92911f47c8a3ef0c0efd856fa6e966d2fa2 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 13:49:20 +1100 Subject: [PATCH 172/277] updated API --- google.analytics/ga.d.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 1cbbba44e..794f4cd19 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -46,7 +46,7 @@ declare module UniversalAnalytics { interface ga { l: number; q: any[]; - + (command: 'send', hitType: 'event', eventCategory: string, eventAction: string, eventLabel?: string, eventValue?: number, fieldsObject?: {}): void; (command: 'send', hitType: 'event', fieldsObject: { @@ -71,18 +71,22 @@ declare module UniversalAnalytics { timingCategory: string, timingVar: string, timingValue: number): void; (command: 'send', hitType: 'timing', fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; - (command: 'send', hitType: HitType, ...fields: any[]): void; + (command: 'send', hitType: HitType, ...fields: any[], fieldsObject?: {}): void; (command: 'send', fieldsObject: {}): void; - (command: string, hitType: string, ...fields: any[]): void; - (command: string, hitDetails: {}): void; - (command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker; - (command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - - create(trackingId: string, opt_configObject?: {}): UniversalAnalytics.Tracker; - create(trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; + (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; + (command: 'remove'): void; + + (command: string, ...fields?: any[], fieldsObject?: {}): void; + (command: string, ...fields: any[], fieldsObject?: {}): void; + + (readyCallback: (tracker?: UniversalAnalytics.Tracker):void): void; + + create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; getAll(): UniversalAnalytics.Tracker[]; getByName(name: string): UniversalAnalytics.Tracker; + remove(name:string): void; } interface Tracker { From e61862aca77c16045b31c3194f0732d405cdb4ca Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 13:53:46 +1100 Subject: [PATCH 173/277] use correct callback syntax --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 794f4cd19..bab55b9e5 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -80,7 +80,7 @@ declare module UniversalAnalytics { (command: string, ...fields?: any[], fieldsObject?: {}): void; (command: string, ...fields: any[], fieldsObject?: {}): void; - (readyCallback: (tracker?: UniversalAnalytics.Tracker):void): void; + (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; From ae08e2515a5c8621ee3503c0056b9ddc0fea7039 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:04:30 +1100 Subject: [PATCH 174/277] `(command: string, ...fields?: any[]}): void;` should handle any other commands --- google.analytics/ga.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index bab55b9e5..b8518fc90 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -73,12 +73,12 @@ declare module UniversalAnalytics { fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; (command: 'send', hitType: HitType, ...fields: any[], fieldsObject?: {}): 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[], fieldsObject?: {}): void; - (command: string, ...fields: any[], fieldsObject?: {}): void; + (command: string, ...fields?: any[]}): void; (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; From a608ac5b6701a515269be163dbb825dc5a0a81af Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:06:49 +1100 Subject: [PATCH 175/277] fixed typo --- google.analytics/ga.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index b8518fc90..ca142c2fb 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -78,7 +78,7 @@ declare module UniversalAnalytics { (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; (command: 'remove'): void; - (command: string, ...fields?: any[]}): void; + (command: string, ...fields?: any[]): void; (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; From 86c94ff30be1cce6afbbae6edde2777857517c82 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:09:15 +1100 Subject: [PATCH 176/277] removed redundant declaration --- google.analytics/ga.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index ca142c2fb..4472cf780 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -71,7 +71,6 @@ declare module UniversalAnalytics { timingCategory: string, timingVar: string, timingValue: number): void; (command: 'send', hitType: 'timing', fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void; - (command: 'send', hitType: HitType, ...fields: any[], fieldsObject?: {}): void; (command: 'send', fieldsObject: {}): void; (command: string, hitType: HitType, ...fields: any[]): void; From 3b751150b2818dd5a7447d95db657297e74d3695 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:16:08 +1100 Subject: [PATCH 177/277] non-optional rest parameter --- google.analytics/ga.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 4472cf780..d6c817cd5 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -77,12 +77,13 @@ declare module UniversalAnalytics { (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void; (command: 'remove'): void; - (command: string, ...fields?: any[]): void; + (command: string, ...fields: any[]): void; (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; - create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + getAll(): UniversalAnalytics.Tracker[]; getByName(name: string): UniversalAnalytics.Tracker; remove(name:string): void; From 5c0a2a138ac67c1b1c13dafc5837bfcbff6a00e2 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Mon, 18 Jan 2016 14:19:57 +1100 Subject: [PATCH 178/277] fixed `create` API --- google.analytics/ga.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index d6c817cd5..68d0293a4 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -81,7 +81,8 @@ declare module UniversalAnalytics { (readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void; - create(trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): UniversalAnalytics.Tracker; + 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[]; From f03447b87052b3faac3d217b86728debf0403820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Mon, 18 Jan 2016 09:48:30 +0100 Subject: [PATCH 179/277] Update electron-packager.d.ts --- electron-packager/electron-packager.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 */ From 8ac2edf817ab77a00f0d2a1a53bb46eb2a466067 Mon Sep 17 00:00:00 2001 From: Martin Helmich Date: Mon, 18 Jan 2016 11:59:30 +0100 Subject: [PATCH 180/277] mysql: IPoolClusterConfig.restoreNodeTimeout is missing --- mysql/mysql-tests.ts | 7 +++++++ mysql/mysql.d.ts | 6 ++++++ 2 files changed, 13 insertions(+) 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) From 34ae6b21bca77b453f278697e7a7e1ce784c64ab Mon Sep 17 00:00:00 2001 From: ali taheri Date: Mon, 18 Jan 2016 15:56:06 +0330 Subject: [PATCH 181/277] [iban] Support require/import style --- iban/iban.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; +} From 3bebbe1baee04846cc46ed7249e8117e4cd7c7ff Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 18 Jan 2016 16:32:28 -0300 Subject: [PATCH 182/277] Inline annotated function support added to service method on IProvideService\ --- angularjs/angular.d.ts | 1 + 1 file changed, 1 insertion(+) 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; } From 91757f194174d1dc3a175c90ea91cf9c2fd4fc92 Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Mon, 18 Jan 2016 19:03:34 -0500 Subject: [PATCH 183/277] add definitions, tests, and jsdocs for cordova-plugin-qrscanner --- .../cordova-plugin-qrscanner-tests.ts | 43 ++++ .../cordova-plugin-qrscanner.d.ts | 191 ++++++++++++++++++ 2 files changed, 234 insertions(+) create mode 100644 cordova-plugin-qrscanner/cordova-plugin-qrscanner-tests.ts create mode 100644 cordova-plugin-qrscanner/cordova-plugin-qrscanner.d.ts 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; From 8eca847a131aea253d4f00fc0eacd481c1ef628a Mon Sep 17 00:00:00 2001 From: Robert Imig Date: Mon, 18 Jan 2016 19:28:36 -0500 Subject: [PATCH 184/277] Add typings for leaflet-markercluster --- .../leaflet-markercluster-tests.ts | 19 +++ .../leaflet-markercluster.d.ts | 125 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 leaflet-markercluster/leaflet-markercluster-tests.ts create mode 100644 leaflet-markercluster/leaflet-markercluster.d.ts 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[]; + } +} From 7cecac8c670bc54b34e23677428e7b8cc1c43968 Mon Sep 17 00:00:00 2001 From: Thomas Johansson Date: Mon, 18 Jan 2016 17:03:02 -0800 Subject: [PATCH 185/277] Change the input type of defineMessages to T This allows for full intellisense on the return value, so `messages.foo` will work. --- react-intl/react-intl.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +} From 8d948f4a02ca04895b7f408f380bf2dbb4dab68e Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 15 Jan 2016 16:51:34 +0900 Subject: [PATCH 186/277] fix code format --- sequelize/sequelize-tests-2.0.0.ts | 17 +- sequelize/sequelize-tests.ts | 4 +- sequelize/sequelize.d.ts | 310 ++++++++++++++--------------- 3 files changed, 165 insertions(+), 166 deletions(-) diff --git a/sequelize/sequelize-tests-2.0.0.ts b/sequelize/sequelize-tests-2.0.0.ts index d35074e08..0ef636c85 100644 --- a/sequelize/sequelize-tests-2.0.0.ts +++ b/sequelize/sequelize-tests-2.0.0.ts @@ -18,7 +18,7 @@ var transOpts: Sequelize.TransactionOptions; var syncOpts: Sequelize.SyncOptions; var assocOpts: Sequelize.AssociationOptions; var schemaOpts: Sequelize.SchemaOptions; -var findOpts: Sequelize.FindOptions +var findOpts: Sequelize.FindOptions; var findCrOpts: Sequelize.FindOrCreateOptions; var queryOpts: Sequelize.QueryOptions; var buildOpts: Sequelize.BuildOptions; @@ -45,7 +45,6 @@ interface modelPojo { } interface modelInst extends Sequelize.Instance, modelPojo { - }; var myModelInst: modelInst; @@ -117,12 +116,12 @@ model.find().then(function () { }, function () { }); model.find().then(function () { }); model.find().then(null, function () { }); model.find().then(function (result: modelInst) { }); -model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }); -model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }, function (): Sequelize.PromiseT { return model.find(1) }); +model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }); +model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }, function (): Sequelize.PromiseT { return model.find(1); }); model.find().catch(function () { }); model.find().catch(function (result: modelInst) { }); -model.find().catch(function (result: modelInst): Sequelize.Promise { return model.find(1) }); +model.find().catch(function (result: modelInst): Sequelize.Promise { return model.find(1); }); model.find().spread(function () { }, function () { }); model.find().spread(function () { }); @@ -130,10 +129,10 @@ model.find().spread(null, function () { }); model.find().spread(function (result: modelInst) { }); model.find().spread(function (result1: modelInst, result2: any) { }); model.find().spread(null, function (result1: any, result2: boolean) { }); -model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1) }); -model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }); -model.find().spread(function (result: modelInst) { }, function (): Sequelize.PromiseT { return model.find(1) }); -model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }, function (): Sequelize.PromiseT { return model.find(1) }); +model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1); }); +model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }); +model.find().spread(function (result: modelInst) { }, function (): Sequelize.PromiseT { return model.find(1); }); +model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }, function (): Sequelize.PromiseT { return model.find(1); }); promiseMe = model.findAll(findOpts, queryOpts); promiseMe = model.findAll(findOpts); diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index cda4aff11..74c7e06e8 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -906,7 +906,7 @@ User.find( { where : { intVal : { lte : 5 } } } ); User.count(); User.count( { transaction : t } ); -User.count().then( function( c ) { c.toFixed() } ); +User.count().then( function( c ) { c.toFixed(); } ); User.count( { where : ["username LIKE '%us%'"] } ); User.count( { include : [{ model : User, required : false }] } ); User.count( { distinct : true, include : [{ model : User, required : false }] } ); @@ -1122,7 +1122,7 @@ s.query( '', { raw : true, nest : false } ); s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } ); s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } ); s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } ); -s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ) } ); +s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } ); s.define( 'foo', { bar : Sequelize.STRING }, { collate : 'utf8_bin' } ); s.define( 'Foto', { name : Sequelize.STRING }, { tableName : 'photos' } ); s.databaseVersion().then( function( version ) { } ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 3f1e2c86f..e33b4b8d7 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -55,7 +55,7 @@ declare module "sequelize" { * Get the associated instance. * @param options The options to use when getting the association. */ - (options?: BelongsToGetAssociationMixinOptions): Promise + (options?: BelongsToGetAssociationMixinOptions): Promise; } /** @@ -96,7 +96,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: BelongsToSetAssociationMixinOptions | InstanceSaveOptions - ): Promise + ): Promise; } /** @@ -132,7 +132,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions - ): Promise + ): Promise; } /** @@ -169,7 +169,7 @@ declare module "sequelize" { * Get the associated instance. * @param options The options to use when getting the association. */ - (options?: HasOneGetAssociationMixinOptions): Promise + (options?: HasOneGetAssociationMixinOptions): Promise; } /** @@ -210,7 +210,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: HasOneSetAssociationMixinOptions | HasOneGetAssociationMixinOptions | InstanceSaveOptions - ): Promise + ): Promise; } /** @@ -246,7 +246,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions - ): Promise + ): Promise; } /** @@ -296,7 +296,7 @@ declare module "sequelize" { * Get everything currently associated with this, using an optional where clause. * @param options The options to use when getting the associations. */ - (options?: HasManyGetAssociationsMixinOptions): Promise + (options?: HasManyGetAssociationsMixinOptions): Promise; } /** @@ -346,7 +346,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: HasManySetAssociationsMixinOptions | FindOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -395,7 +395,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: HasManyAddAssociationsMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -444,7 +444,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: HasManyAddAssociationMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -487,7 +487,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: HasManyCreateAssociationMixinOptions | CreateOptions - ): Promise + ): Promise; } /** @@ -530,7 +530,7 @@ declare module "sequelize" { ( oldAssociated?: TInstance | TInstancePrimaryKey, options?: HasManyRemoveAssociationMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -573,7 +573,7 @@ declare module "sequelize" { ( oldAssociateds?: Array, options?: HasManyRemoveAssociationsMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -616,7 +616,7 @@ declare module "sequelize" { ( target: TInstance | TInstancePrimaryKey, options?: HasManyHasAssociationMixinOptions | HasManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -659,7 +659,7 @@ declare module "sequelize" { ( targets: Array, options?: HasManyHasAssociationsMixinOptions | HasManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -709,7 +709,7 @@ declare module "sequelize" { * Count everything currently associated with this, using an optional where clause. * @param options The options to use when counting the associations. */ - (options?: HasManyCountAssociationsMixinOptions): Promise + (options?: HasManyCountAssociationsMixinOptions): Promise; } /** @@ -759,7 +759,7 @@ declare module "sequelize" { * Get everything currently associated with this, using an optional where clause. * @param options The options to use when getting the associations. */ - (options?: BelongsToManyGetAssociationsMixinOptions): Promise + (options?: BelongsToManyGetAssociationsMixinOptions): Promise; } /** @@ -809,7 +809,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: BelongsToManySetAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -858,7 +858,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: BelongsToManyAddAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -907,7 +907,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: BelongsToManyAddAssociationMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -950,7 +950,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -993,7 +993,7 @@ declare module "sequelize" { ( oldAssociated?: TInstance | TInstancePrimaryKey, options?: BelongsToManyRemoveAssociationMixinOptions | InstanceDestroyOptions - ): Promise + ): Promise; } /** @@ -1036,7 +1036,7 @@ declare module "sequelize" { ( oldAssociateds?: Array, options?: BelongsToManyRemoveAssociationsMixinOptions | InstanceDestroyOptions - ): Promise + ): Promise; } /** @@ -1079,7 +1079,7 @@ declare module "sequelize" { ( target: TInstance | TInstancePrimaryKey, options?: BelongsToManyHasAssociationMixinOptions | BelongsToManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -1122,7 +1122,7 @@ declare module "sequelize" { ( targets: Array, options?: BelongsToManyHasAssociationsMixinOptions | BelongsToManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -1172,7 +1172,7 @@ declare module "sequelize" { * Count everything currently associated with this, using an optional where clause. * @param options The options to use when counting the associations. */ - (options?: BelongsToManyCountAssociationsMixinOptions): Promise + (options?: BelongsToManyCountAssociationsMixinOptions): Promise; } /** @@ -1879,9 +1879,9 @@ declare module "sequelize" { ENUM: DataTypeEnum; RANGE: DataTypeRange; REAL: DataTypeReal; - DOUBLE: DataTypeDouble, - 'DOUBLE PRECISION': DataTypeDouble, - GEOMETRY: DataTypeGeometry + DOUBLE: DataTypeDouble; + "DOUBLE PRECISION": DataTypeDouble; + GEOMETRY: DataTypeGeometry; } // @@ -1942,7 +1942,7 @@ declare module "sequelize" { * * @param constraints An array of constraint names. Will defer all constraints by default. */ - ( constraints : Array ) : DeferrableSetDeferred; + ( constraints : string[] ) : DeferrableSetDeferred; } @@ -1954,7 +1954,7 @@ declare module "sequelize" { * * @param constraints An array of constraint names. Will defer all constraints by default. */ - ( constraints : Array ) : DeferrableSetImmediate; + ( constraints : string[] ) : DeferrableSetImmediate; } @@ -2018,18 +2018,18 @@ declare module "sequelize" { * @param message Error message * @param errors Array of ValidationErrorItem objects describing the validation errors */ - new ( message : string, errors? : Array ) : ValidationError; + new ( message : string, errors? : ValidationErrorItem[] ) : ValidationError; /** * Gets all validation error items for the path / field specified. * * @param path The path to be checked for error items */ - get( path : string ) : Array; - + get( path : string ) : ValidationErrorItem[]; + /** Array of ValidationErrorItem objects describing the validation errors */ - errors : Array; - + errors : ValidationErrorItem[]; + } interface ValidationErrorItem extends BaseError { @@ -2044,19 +2044,19 @@ declare module "sequelize" { * @param value The value that generated the error */ new ( message : string, type : string, path : string, value : string ) : ValidationErrorItem; - + /** An error message */ message : string; - + /** The type of the validation error */ type : string; - + /** The field that triggered the validation error */ path : string; - + /** The value that generated the error */ value : string; - + } interface DatabaseError extends BaseError { @@ -2091,7 +2091,7 @@ declare module "sequelize" { /** * Thrown when a foreign key constraint is violated in the database */ - new ( options : { parent? : Error, message? : string, index? : string, fields? : Array, table? : string } ) : ForeignKeyConstraintError; + new ( options : { parent? : Error, message? : string, index? : string, fields? : string[], table? : string } ) : ForeignKeyConstraintError; } @@ -2100,7 +2100,7 @@ declare module "sequelize" { /** * Thrown when an exclusion constraint is violated in the database */ - new ( options : { parent? : Error, message? : string, constraint? : string, fields? : Array, table? : string } ) : ExclusionConstraintError; + new ( options : { parent? : Error, message? : string, constraint? : string, fields? : string[], table? : string } ) : ExclusionConstraintError; } @@ -2217,8 +2217,8 @@ declare module "sequelize" { afterDelete? : ( instance : TInstance, options : Object, fn? : Function ) => any; beforeUpdate? : ( instance : TInstance, options : Object, fn? : Function ) => any; afterUpdate? : ( instance : TInstance, options : Object, fn? : Function ) => any; - beforeBulkCreate? : ( instances : Array, options : Object, fn? : Function ) => any; - afterBulkCreate? : ( instances : Array, options : Object, fn? : Function ) => any; + beforeBulkCreate? : ( instances : TInstance[], options : Object, fn? : Function ) => any; + afterBulkCreate? : ( instances : TInstance[], options : Object, fn? : Function ) => any; beforeBulkDestroy? : ( options : Object, fn? : Function ) => any; beforeBulkDelete? : ( options : Object, fn? : Function ) => any; afterBulkDestroy? : ( options : Object, fn? : Function ) => any; @@ -2228,7 +2228,7 @@ declare module "sequelize" { beforeFind? : ( options : Object, fn? : Function ) => any; beforeFindAfterExpandIncludeAll? : ( options : Object, fn? : Function ) => any; beforeFindAfterOptions? : ( options : Object, fn? : Function ) => any; - afterFind? : ( instancesOrInstance : Array | TInstance, options : Object, + afterFind? : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => any; } @@ -2392,8 +2392,8 @@ declare module "sequelize" { * @param fn A callback function that is called with instances, options */ beforeBulkCreate( name : string, - fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; - beforeBulkCreate( fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; + fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; + beforeBulkCreate( fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; /** * A hook that is run after creating instances in bulk @@ -2403,8 +2403,8 @@ declare module "sequelize" { * @name afterBulkCreate */ afterBulkCreate( name : string, - fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; - afterBulkCreate( fn : ( instances : Array, options : Object, fn? : Function ) => void ): void; + fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; + afterBulkCreate( fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void; /** * A hook that is run before destroying instances in bulk @@ -2485,9 +2485,9 @@ declare module "sequelize" { * @param fn A callback function that is called with instance(s), options */ afterFind( name : string, - fn : ( instancesOrInstance : Array | TInstance, options : Object, + fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => void ): void; - afterFind( fn : ( instancesOrInstance : Array | TInstance, options : Object, + afterFind( fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => void ): void; /** @@ -2641,7 +2641,7 @@ declare module "sequelize" { * An optional array of strings, representing database columns. If fields is provided, only those columns * will be validated and saved. */ - fields? : Array; + fields? : string[]; /** * If true, the updatedAt timestamp will not be updated. @@ -2773,7 +2773,7 @@ declare module "sequelize" { * If changed is called without an argument and no keys have changed, it will return `false`. */ changed( key : string ) : boolean; - changed() : boolean | Array; + changed() : boolean | string[]; /** * Returns the previous value for key from `_previousDataValues`. @@ -2805,7 +2805,7 @@ declare module "sequelize" { * * @param options.skip An array of strings. All properties that are in this array will not be validated */ - validate( options? : { skip?: Array } ) : Promise; + validate( options? : { skip?: string[] } ) : Promise; /** * This is the same as calling `set` and then calling `save`. @@ -2846,7 +2846,7 @@ declare module "sequelize" { * If an array is provided, the same is true for each column. * If and object is provided, each column is incremented by the value given. */ - increment( fields : string | Array | Object, + increment( fields : string | string[] | Object, options? : InstanceIncrementDecrementOptions ) : Promise; /** @@ -2869,7 +2869,7 @@ declare module "sequelize" { * If an array is provided, the same is true for each column. * If and object is provided, each column is decremented by the value given */ - decrement( fields : string | Array | Object, + decrement( fields : string | string[] | Object, options? : InstanceIncrementDecrementOptions ) : Promise; /** @@ -2880,7 +2880,7 @@ declare module "sequelize" { /** * Check if this is eqaul to one of `others` by calling equals */ - equalsOneOf( others : Array> ) : boolean; + equalsOneOf( others : Instance[] ) : boolean; /** * Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all @@ -2922,12 +2922,12 @@ declare module "sequelize" { /** * The character(s) that separates the schema name from the table name */ - schemaDelimeter? : string, + schemaDelimeter? : string; /** * A function that gets executed while running the query to log the sql. */ - logging? : Function | boolean + logging? : Function | boolean; } @@ -2943,7 +2943,7 @@ declare module "sequelize" { * any arguments, or an array, where the first element is the name of the method, and consecutive elements * are arguments to that method. Pass null to remove all scopes, including the default. */ - method : string | Array; + method : string | any[]; } @@ -2968,7 +2968,7 @@ declare module "sequelize" { */ interface WhereGeometryOptions { type: string; - coordinates: Array | number>; + coordinates: Array; } /** @@ -3023,7 +3023,7 @@ declare module "sequelize" { /** * A list of attributes to select from the join model for belongsToMany relations */ - attributes? : Array; + attributes? : string[]; } @@ -3050,7 +3050,7 @@ declare module "sequelize" { * The alias of the relation, in case the model you want to eagerly load is aliassed. For `hasOne` / * `belongsTo`, this should be the singular name, and for `hasMany`, it should be the plural */ - as? : string; + as? : string; /** * The association you want to eagerly load. (This can be used instead of providing a model/as pair) @@ -3066,7 +3066,7 @@ declare module "sequelize" { /** * A list of attributes to select from the child model */ - attributes? : Array; + attributes? : string[]; /** * If true, converts to an inner join, which means that the parent model will only be loaded if it has any @@ -3175,7 +3175,7 @@ declare module "sequelize" { /** * A hash of search attributes. */ - where? : WhereOptions | Array; + where? : WhereOptions | string[]; /** * Include options. See `find` for details @@ -3239,7 +3239,7 @@ declare module "sequelize" { /** * If set, only columns matching those in fields will be saved */ - fields? : Array; + fields? : string[]; /** * On Duplicate @@ -3301,7 +3301,7 @@ declare module "sequelize" { /** * The fields to insert / update. Defaults to all fields */ - fields? : Array; + fields? : string[]; /** * A function that gets executed while running the query to log the sql. @@ -3318,7 +3318,7 @@ declare module "sequelize" { /** * Fields to insert (defaults to all fields) */ - fields? : Array; + fields? : string[]; /** * Should each row be subject to validation before it is inserted. The whole insert will fail if one row @@ -3348,7 +3348,7 @@ declare module "sequelize" { * Fields to update if row key already exists (on duplicate key update)? (only supported by mysql & * mariadb). By default, all fields are updated. */ - updateOnDuplicate? : Array; + updateOnDuplicate? : string[]; /** * Transaction to run query under @@ -3477,7 +3477,7 @@ declare module "sequelize" { /** * Fields to update (defaults to all fields) */ - fields? : Array; + fields? : string[]; /** * Should each row be subject to validation before it is inserted. The whole insert will fail if one row @@ -3564,7 +3564,7 @@ declare module "sequelize" { /** * The Instance class */ - Instance() : Instance; + Instance() : TInstance; /** * Remove attribute from model definition @@ -3656,7 +3656,7 @@ declare module "sequelize" { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope( options? : string | Array | ScopeOptions | WhereOptions ) : Model; + scope( options? : string | string[] | ScopeOptions | WhereOptions ) : Model; /** * Search for multiple instances. @@ -3720,8 +3720,8 @@ declare module "sequelize" { * * @see {Sequelize#query} */ - findAll( options? : FindOptions ) : Promise>; - all( optionz? : FindOptions ) : Promise>; + findAll( options? : FindOptions ) : Promise; + all( optionz? : FindOptions ) : Promise; /** * Search for a single instance by its primary key. This applies LIMIT 1, so the listener will @@ -3790,8 +3790,8 @@ declare module "sequelize" { * without * profiles will be counted */ - findAndCount( options? : FindOptions ) : Promise<{ rows : Array, count : number }>; - findAndCountAll( options? : FindOptions ) : Promise<{ rows : Array, count : number }>; + findAndCount( options? : FindOptions ) : Promise<{ rows : TInstance[], count : number }>; + findAndCountAll( options? : FindOptions ) : Promise<{ rows : TInstance[], count : number }>; /** * Find the maximum value of field @@ -3816,7 +3816,7 @@ declare module "sequelize" { /** * Undocumented bulkBuild */ - bulkBuild( records : Array, options? : BuildOptions ) : Array; + bulkBuild( records : TAttributes[], options? : BuildOptions ) : TInstance[]; /** * Builds a new model instance and calls save on it. @@ -3876,7 +3876,7 @@ declare module "sequelize" { * * @param records List of objects (key/value pairs) to create instances from */ - bulkCreate( records : Array, options? : BulkCreateOptions ) : Promise>; + bulkCreate( records : TAttributes[], options? : BulkCreateOptions ) : Promise; /** * Truncate all instances of the model. This is a convenient method for Model.destroy({ truncate: true }). @@ -3900,7 +3900,7 @@ declare module "sequelize" { * elements. The first element is always the number of affected rows, while the second element is the actual * affected rows (only supported in postgres with `options.returning` true.) */ - update( values : TAttributes, options : UpdateOptions ) : Promise<[number, Array]>; + update( values : TAttributes, options : UpdateOptions ) : Promise<[number, TInstance[]]>; /** * Run a describe query on the table. The result will be return to the listener as a hash of attributes and @@ -3949,7 +3949,7 @@ declare module "sequelize" { * We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately. */ QueryGenerator: any; - + /** * Returns the current sequelize instance. */ @@ -4026,7 +4026,7 @@ declare module "sequelize" { /** * Returns all tables */ - showAllTables( options? : QueryOptions ) : Promise>; + showAllTables( options? : QueryOptions ) : Promise; /** * Describe a table @@ -4062,7 +4062,7 @@ declare module "sequelize" { /** * Adds a new index to a table */ - addIndex( tableName : string | Object, attributes : Array, options? : QueryOptions, + addIndex( tableName : string | Object, attributes : string[], options? : QueryOptions, rawTablename? : string ) : Promise; /** @@ -4073,7 +4073,7 @@ declare module "sequelize" { /** * Put a name to an index */ - nameIndexes( indexes : Array, rawTablename : string ) : Promise; + nameIndexes( indexes : string[], rawTablename : string ) : Promise; /** * Returns all foreign key constraints of a table @@ -4083,7 +4083,7 @@ declare module "sequelize" { /** * Removes an index of a table */ - removeIndex( tableName : string, indexNameOrAttributes : Array | string, + removeIndex( tableName : string, indexNameOrAttributes : string[] | string, options? : QueryInterfaceOptions ) : Promise; /** @@ -4101,8 +4101,8 @@ declare module "sequelize" { /** * Inserts multiple records at once */ - bulkInsert( tableName : string, records : Array, options? : QueryOptions, - attributes? : Array | string ) : Promise; + bulkInsert( tableName : string, records : Object[], options? : QueryOptions, + attributes? : string[] | string ) : Promise; /** * Updates a row @@ -4114,7 +4114,7 @@ declare module "sequelize" { * Updates multiple rows at once */ bulkUpdate( tableName : string, values : Object, identifier : Object, options? : QueryOptions, - attributes? : Array | string ) : Promise; + attributes? : string[] | string ) : Promise; /** * Deletes a row @@ -4131,7 +4131,7 @@ declare module "sequelize" { /** * Returns selected rows */ - select( model : Model, tableName : string, options? : QueryOptions ) : Promise>; + select( model : Model, tableName : string, options? : QueryOptions ) : Promise; /** * Increments a row value @@ -4142,15 +4142,15 @@ declare module "sequelize" { /** * Selects raw without parsing the string into an object */ - rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | Array, - model? : Model ) : Promise>; + rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | string[], + model? : Model ) : Promise; /** * Postgres only. Creates a trigger on specified table to call the specified function with supplied * parameters. */ - createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : Array, - functionName : string, functionParams : Array, optionsArray : Array, + createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : any[], + functionName : string, functionParams : any[], optionsArray : string[], options? : QueryInterfaceOptions ): Promise; /** @@ -4167,19 +4167,19 @@ declare module "sequelize" { /** * Postgres only. Create a function */ - createFunction( functionName : string, params : Array, returnType : string, language : string, + createFunction( functionName : string, params : any[], returnType : string, language : string, body : string, options? : QueryOptions ) : Promise; /** * Postgres only. Drops a function */ - dropFunction( functionName : string, params : Array, + dropFunction( functionName : string, params : any[], options? : QueryInterfaceOptions ) : Promise; /** * Postgres only. Rename a function */ - renameFunction( oldFunctionName : string, params : Array, newFunctionName : string, + renameFunction( oldFunctionName : string, params : any[], newFunctionName : string, options? : QueryInterfaceOptions ) : Promise; /** @@ -4244,19 +4244,19 @@ declare module "sequelize" { // interface QueryTypes { - SELECT: string // 'SELECT' - INSERT: string // 'INSERT' - UPDATE: string // 'UPDATE' - BULKUPDATE: string // 'BULKUPDATE' - BULKDELETE: string // 'BULKDELETE' - DELETE: string // 'DELETE' - UPSERT: string // 'UPSERT' - VERSION: string // 'VERSION' - SHOWTABLES: string // 'SHOWTABLES' - SHOWINDEXES: string // 'SHOWINDEXES' - DESCRIBE: string // 'DESCRIBE' - RAW: string // 'RAW' - FOREIGNKEYS: string // 'FOREIGNKEYS' + SELECT: string; // 'SELECT' + INSERT: string; // 'INSERT' + UPDATE: string; // 'UPDATE' + BULKUPDATE: string; // 'BULKUPDATE' + BULKDELETE: string; // 'BULKDELETE' + DELETE: string; // 'DELETE' + UPSERT: string; // 'UPSERT' + VERSION: string; // 'VERSION' + SHOWTABLES: string; // 'SHOWTABLES' + SHOWINDEXES: string; // 'SHOWINDEXES' + DESCRIBE: string; // 'DESCRIBE' + RAW: string; // 'RAW' + FOREIGNKEYS: string; // 'FOREIGNKEYS' } // @@ -4404,7 +4404,7 @@ declare module "sequelize" { * }) * ``` */ - values? : Array; + values? : string[]; } @@ -4465,7 +4465,7 @@ declare module "sequelize" { * Either an object of named parameter replacements in the format `:param` or an array of unnamed * replacements to replace `?` in your SQL. */ - replacements? : Object | Array; + replacements? : Object | string[]; /** * Force the query to use the write pool, regardless of the query type. @@ -4477,7 +4477,7 @@ declare module "sequelize" { /** * A function that gets executed while running the query to log the sql. */ - logging? : Function + logging? : Function; /** * A sequelize instance used to build the return instance @@ -4608,17 +4608,17 @@ declare module "sequelize" { /** * check the value is not one of these */ - notIn? : Array> | { msg: string, args: Array> }; + notIn? : string[][] | { msg: string, args: string[][] }; /** * check the value is one of these */ - isIn? : Array> | { msg: string, args: Array> }; + isIn? : string[][] | { msg: string, args: string[][] }; /** * don't allow specific substrings */ - notContains? : Array | string | { msg: string, args: Array | string }; + notContains? : string[] | string | { msg: string, args: string[] | string }; /** * only allow values with length between 2 and 10 @@ -4694,32 +4694,32 @@ declare module "sequelize" { /** * The name of the index. Defaults to model name + _ + fields concatenated */ - name? : string, + name? : string; /** * Index type. Only used by mysql. One of `UNIQUE`, `FULLTEXT` and `SPATIAL` */ - index? : string, + index? : string; /** * The method to create the index by (`USING` statement in SQL). BTREE and HASH are supported by mysql and * postgres, and postgres additionally supports GIST and GIN. */ - method? : string, + method? : string; /** * Should the index by unique? Can also be triggered by setting type to `UNIQUE` * * Defaults to false */ - unique? : boolean, + unique? : boolean; /** * PostgreSQL will build the index without taking any write locks. Postgres only * * Defaults to false */ - concurrently? : boolean, + concurrently? : boolean; /** * An array of the fields to index. Each field can either be a string containing the name of the field, @@ -4727,7 +4727,7 @@ declare module "sequelize" { * (field name), `length` (create a prefix index of length chars), `order` (the direction the column * should be sorted in), `collate` (the collation (sort order) for the column) */ - fields? : Array + fields? : Array; } @@ -4741,12 +4741,12 @@ declare module "sequelize" { /** * Singular model name */ - singular? : string, + singular? : string; /** * Plural model name */ - plural? : string, + plural? : string; } @@ -4842,7 +4842,7 @@ declare module "sequelize" { /** * Indexes for the provided database table */ - indexes? : Array; + indexes? : DefineIndexesOptions[]; /** * Override the name of the createdAt column if a string is provided, or disable it if false. Timestamps @@ -5009,20 +5009,20 @@ declare module "sequelize" { interface ReplicationOptions { read?: { - host?: string, - port?: string | number, - username?: string, - password?: string, - database?: string - } + host?: string; + port?: string | number; + username?: string; + password?: string; + database?: string; + }; write?: { - host?: string, - port?: string | number, - username?: string, - password?: string, - database?: string - } + host?: string; + port?: string | number; + username?: string; + password?: string; + database?: string; + }; } @@ -5265,7 +5265,7 @@ declare module "sequelize" { * * @param args Each argument will be joined by OR */ - or( ...args : Array ) : or; + or( ...args : Array ) : or; /** * Creates an object representing nested where conditions for postgres's json data-type. @@ -5462,7 +5462,7 @@ declare module "sequelize" { * * @param path The path to the file that holds the model you want to import. If the part is relative, it * will be resolved relatively to the calling file - * + * * @param defineFunction An optional function that provides model definitions. Useful if you do not * want to use the module root as the define function */ @@ -5490,7 +5490,7 @@ declare module "sequelize" { * @param sql * @param options Query options */ - query( sql : string | { query: string, values: Array }, options? : QueryOptions ) : Promise; + query( sql : string | { query: string, values: any[] }, options? : QueryOptions ) : Promise; /** * Execute a query which would set an environment or user variable. The variables are set per connection, @@ -5671,17 +5671,17 @@ declare module "sequelize" { notEmpty( str : string ) : boolean; len( str : string, min : number, max : number ) : boolean; isUrl( str : string ) : boolean; - isIPv6( str : string ) : boolean - isIPv4( str : string ) : boolean - notIn( str : string, values : Array ) : boolean; + isIPv6( str : string ) : boolean; + isIPv4( str : string ) : boolean; + notIn( str : string, values : string[] ) : boolean; regex( str : string, pattern : string, modifiers : string ) : boolean; notRegex( str : string, pattern : string, modifiers : string ) : boolean; isDecimal( str : string ) : boolean; min( str : string, val : number ) : boolean; max( str : string, val : number ) : boolean; not( str : string, pattern : string, modifiers : string ) : boolean; - contains( str : string, element : Array ) : boolean; - notContains( str : string, element : Array ) : boolean; + contains( str : string, element : string[] ) : boolean; + notContains( str : string, element : string[] ) : boolean; is( str : string, pattern : string, modifiers : string ) : boolean; } @@ -5859,7 +5859,7 @@ declare module "sequelize" { * @param fn The function you want to call * @param args All further arguments will be passed as arguments to the function */ - new ( fn : string, ...args : Array ) : fn; + new ( fn : string, ...args : any[] ) : fn; } interface col { @@ -5906,7 +5906,7 @@ declare module "sequelize" { } interface and { - args: Array; + args: any[]; } interface andStatic { @@ -5919,7 +5919,7 @@ declare module "sequelize" { } interface or { - args: Array; + args: any[]; } interface orStatic { @@ -5929,7 +5929,7 @@ declare module "sequelize" { * * @param args Each argument will be joined by OR */ - new ( ...args : Array ) : or; + new ( ...args : Array ) : or; } interface json { @@ -5991,8 +5991,8 @@ declare module "sequelize" { * * @param arr Array to compact. */ - compactLite( arr : Array ): Array; - matchesDots( dots : string | Array, value : Object ) : ( item : Object ) => boolean; + compactLite( arr : T[] ): T[]; + matchesDots( dots : string | string[], value : Object ) : ( item : Object ) => boolean; } @@ -6009,13 +6009,13 @@ declare module "sequelize" { uppercaseFirst( str : string ): string; spliceStr( str : string, index : number, count : number, add : string ): string; camelize( str : string ): string; - format( arr : Array, dialect? : string ): string; + format( arr : any[], dialect? : string ): string; formatNamedParameters( sql : string, parameters : any, dialect? : string ): string; cloneDeep( obj : T, fn? : ( value : T ) => any ) : T; mapOptionFieldNames( options : T, Model : Model ) : T; - mapValueFieldNames( dataValues : Object, fields : Array, Model : Model ) : Object; - argsArePrimaryKeys( args : Array, primaryKeys : Object ) : boolean; - canTreatArrayAsAnd( arr : Array ) : boolean; + mapValueFieldNames( dataValues : Object, fields : string[], Model : Model ) : Object; + argsArePrimaryKeys( args : any[], primaryKeys : Object ) : boolean; + canTreatArrayAsAnd( arr : any[] ) : boolean; combineTableNames( tableName1 : string, tableName2 : string ): string; singularize( s : string ): string; pluralize( s : string ): string; @@ -6032,7 +6032,7 @@ declare module "sequelize" { removeNullValuesFromHash( hash : Object, omitNull? : boolean, options? : Object ): any; inherit( subClass : Object, superClass : Object ): Object; stack(): string; - sliceArgs( args : Array, begin? : number ) : Array; + sliceArgs( args : any[], begin? : number ) : any[]; now( dialect : string ): Date; tick( f : Function ): void; addTicks( s : string, tickChar? : string ): string; From 22726c075179d7ecaf22960d4c283752b11160e8 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 15 Jan 2016 16:51:34 +0900 Subject: [PATCH 187/277] change to use `this` type --- sequelize/sequelize-tests.ts | 26 +++++++++--------- sequelize/sequelize.d.ts | 52 ++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 74c7e06e8..522f51dab 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -8,7 +8,7 @@ import Sequelize = require("sequelize"); // interface AnyAttributes { }; -interface AnyInstance extends Sequelize.Instance { }; +interface AnyInstance extends Sequelize.Instance { }; var s = new Sequelize( '' ); var sequelize = s; @@ -32,7 +32,7 @@ interface GUserAttributes { username? : string; } -interface GUserInstance extends Sequelize.Instance {} +interface GUserInstance extends Sequelize.Instance {} var GUser = s.define( 'user', { id: Sequelize.INTEGER, username : Sequelize.STRING }); GUser.create({ id : 1, username : 'one' }).then( ( guser ) => guser.save() ); @@ -47,7 +47,7 @@ interface GTaskAttributes { revision? : number; name? : string; } -interface GTaskInstance extends Sequelize.Instance { +interface GTaskInstance extends Sequelize.Instance { upRevision(): void; } var GTask = s.define( 'task', { revision : Sequelize.INTEGER, name : Sequelize.STRING }); @@ -347,7 +347,7 @@ interface ProductAttributes { price?: number; }; -interface ProductInstance extends Sequelize.Instance, ProductAttributes { +interface ProductInstance extends Sequelize.Instance, ProductAttributes { // hasOne association mixins: getBarcode: Sequelize.HasOneGetAssociationMixin; setBarcode: Sequelize.HasOneSetAssociationMixin; @@ -365,7 +365,7 @@ interface BarcodeAttributes { dateIssued?: Date; }; -interface BarcodeInstance extends Sequelize.Instance, BarcodeAttributes { +interface BarcodeInstance extends Sequelize.Instance, BarcodeAttributes { // belongsTo association mixins: getProduct: Sequelize.BelongsToGetAssociationMixin; setProduct: Sequelize.BelongsToSetAssociationMixin; @@ -378,7 +378,7 @@ interface WarehouseAttributes { capacity?: number; }; -interface WarehouseInstance extends Sequelize.Instance, WarehouseAttributes { +interface WarehouseInstance extends Sequelize.Instance, WarehouseAttributes { // hasMany association mixins: getProducts: Sequelize.HasManyGetAssociationsMixin; setProducts: Sequelize.HasManySetAssociationsMixin; @@ -410,7 +410,7 @@ interface BranchAttributes { rank?: number; }; -interface BranchInstance extends Sequelize.Instance, BranchAttributes { +interface BranchInstance extends Sequelize.Instance, BranchAttributes { // belongsToMany association mixins: getWarehouses: Sequelize.BelongsToManyGetAssociationsMixin; setWarehouses: Sequelize.BelongsToManySetAssociationsMixin; @@ -440,7 +440,7 @@ interface WarehouseBranchAttributes { distance?: number; }; -interface WarehouseBranchInstance extends Sequelize.Instance, WarehouseBranchAttributes { }; +interface WarehouseBranchInstance extends Sequelize.Instance, WarehouseBranchAttributes { }; interface CustomerAttributes { id?: number; @@ -448,7 +448,7 @@ interface CustomerAttributes { credit?: number; }; -interface CustomerInstance extends Sequelize.Instance, CustomerAttributes { +interface CustomerInstance extends Sequelize.Instance, CustomerAttributes { // belongsToMany association mixins: getBranches: Sequelize.BelongsToManyGetAssociationsMixin; setBranches: Sequelize.BelongsToManySetAssociationsMixin; @@ -633,11 +633,11 @@ new s.ConnectionTimedOutError( new Error( 'original connection error message' ) // https://github.com/sequelize/sequelize/blob/v3.4.1/test/integration/hooks.test.js // -User.addHook( 'afterCreate', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); -User.addHook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); +User.addHook( 'afterCreate', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); +User.addHook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); s.addHook( 'beforeInit', function( config : Object, options : Object ) { } ); -User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); -User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); +User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function) { next(); } ); +User.hook( 'afterCreate', 'myHook', function( instance : Sequelize.Instance, options : Object, next : Function ) { next(); } ); User.removeHook( 'afterCreate', 'myHook' ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index e33b4b8d7..0dcd61e86 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -2690,7 +2690,7 @@ declare module "sequelize" { * * @see Sequelize.define for more information about getters and setters */ - interface Instance { + interface Instance { /** * Returns true if this instance has not yet been persisted to the database @@ -2702,7 +2702,7 @@ declare module "sequelize" { * * @see Model */ - Model : Model; + Model : Model; /** * A reference to the sequelize instance @@ -2759,10 +2759,10 @@ declare module "sequelize" { * @param options.raw If set to true, field and virtual setters will be ignored * @param options.reset Clear all previously set data values */ - set( key : string, value : any, options? : InstanceSetOptions ) : TInstance; - set( keys : Object, options? : InstanceSetOptions ) : TInstance; - setAttributes( key : string, value : any, options? : InstanceSetOptions ) : TInstance; - setAttributes( keys : Object, options? : InstanceSetOptions ) : TInstance; + set( key : string, value : any, options? : InstanceSetOptions ) : this; + set( keys : Object, options? : InstanceSetOptions ) : this; + setAttributes( key : string, value : any, options? : InstanceSetOptions ) : this; + setAttributes( keys : Object, options? : InstanceSetOptions ) : this; /** * If changed is called with a string it will return a boolean indicating whether the value of that key in @@ -2787,7 +2787,7 @@ declare module "sequelize" { * called with an instance of `Sequelize.ValidationError`. This error will have a property for each of the * fields for which validation failed, with the error message for that field. */ - save( options? : InstanceSaveOptions ) : Promise; + save( options? : InstanceSaveOptions ) : Promise; /** * Refresh the current instance in-place, i.e. update the object with current data from the DB and return @@ -2795,7 +2795,7 @@ declare module "sequelize" { * return a new instance. With this method, all references to the Instance are updated with the new data * and no new objects are created. */ - reload( options? : FindOptions ) : Promise; + reload( options? : FindOptions ) : Promise; /** * Validate the attribute of this instance according to validation rules set in the model definition. @@ -2810,10 +2810,10 @@ declare module "sequelize" { /** * This is the same as calling `set` and then calling `save`. */ - update( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; - update( keys : Object, options? : InstanceUpdateOptions ) : Promise; - updateAttributes( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; - updateAttributes( keys : Object, options? : InstanceUpdateOptions ) : Promise; + update( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; + update( keys : Object, options? : InstanceUpdateOptions ) : Promise; + updateAttributes( key : string, value : any, options? : InstanceUpdateOptions ) : Promise; + updateAttributes( keys : Object, options? : InstanceUpdateOptions ) : Promise; /** * Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will @@ -2847,7 +2847,7 @@ declare module "sequelize" { * If and object is provided, each column is incremented by the value given. */ increment( fields : string | string[] | Object, - options? : InstanceIncrementDecrementOptions ) : Promise; + options? : InstanceIncrementDecrementOptions ) : Promise; /** * Decrement the value of one or more columns. This is done in the database, which means it does not use @@ -2870,17 +2870,17 @@ declare module "sequelize" { * If and object is provided, each column is decremented by the value given */ decrement( fields : string | string[] | Object, - options? : InstanceIncrementDecrementOptions ) : Promise; + options? : InstanceIncrementDecrementOptions ) : Promise; /** * Check whether all values of this and `other` Instance are the same */ - equals( other : Instance ) : boolean; + equals( other : Instance ) : boolean; /** * Check if this is eqaul to one of `others` by calling equals */ - equalsOneOf( others : Instance[] ) : boolean; + equalsOneOf( others : Instance[] ) : boolean; /** * Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all @@ -3577,7 +3577,7 @@ declare module "sequelize" { * Sync this Model to the DB, that is create the table. Upon success, the callback will be called with the * model instance (this) */ - sync( options? : SyncOptions ) : Promise>; + sync( options? : SyncOptions ) : Promise; /** * Drop the table represented by this Model @@ -3595,7 +3595,7 @@ declare module "sequelize" { * @param schema The name of the schema * @param options */ - schema( schema : string, options? : SchemaOptions ) : Model; + schema( schema : string, options? : SchemaOptions ) : this; /** * Get the tablename of the model, taking schema into account. The method will return The name as a string @@ -3656,7 +3656,7 @@ declare module "sequelize" { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope( options? : string | string[] | ScopeOptions | WhereOptions ) : Model; + scope( options? : string | string[] | ScopeOptions | WhereOptions ) : this; /** * Search for multiple instances. @@ -3911,7 +3911,7 @@ declare module "sequelize" { /** * Unscope the model */ - unscoped() : Model; + unscoped() : this; } @@ -4089,7 +4089,7 @@ declare module "sequelize" { /** * Inserts a new record */ - insert( instance : Instance, tableName : string, values : Object, + insert( instance : Instance, tableName : string, values : Object, options? : QueryOptions ) : Promise; /** @@ -4107,7 +4107,7 @@ declare module "sequelize" { /** * Updates a row */ - update( instance : Instance, tableName : string, values : Object, identifier : Object, + update( instance : Instance, tableName : string, values : Object, identifier : Object, options? : QueryOptions ) : Promise; /** @@ -4119,7 +4119,7 @@ declare module "sequelize" { /** * Deletes a row */ - "delete"( instance : Instance, tableName : string, identifier : Object, + "delete"( instance : Instance, tableName : string, identifier : Object, options? : QueryOptions ) : Promise; /** @@ -4136,7 +4136,7 @@ declare module "sequelize" { /** * Increments a row value */ - increment( instance : Instance, tableName : string, values : Object, identifier : Object, + increment( instance : Instance, tableName : string, values : Object, identifier : Object, options? : QueryOptions ) : Promise; /** @@ -4482,7 +4482,7 @@ declare module "sequelize" { /** * A sequelize instance used to build the return instance */ - instance? : Instance; + instance? : Instance; /** * A sequelize model used to build the returned model instances (used to be called callee) @@ -5210,7 +5210,7 @@ declare module "sequelize" { /** * A reference to the sequelize instance class. */ - Instance : Instance; + Instance : Instance; /** * Creates a object representing a database function. This can be used in search queries, both in where and From bf904b5a587471c3db03e83ed6fec42b6634aa16 Mon Sep 17 00:00:00 2001 From: Tomas Carnecky Date: Tue, 19 Jan 2016 09:14:17 +0100 Subject: [PATCH 188/277] react-router: a React component supports get{Index,Child}Routes props --- react-router/react-router.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 01411fcd5..a6b5c8a01 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -132,6 +132,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 {} From ae84fb741f3ab88ee0ff2781f5d9a17b89369114 Mon Sep 17 00:00:00 2001 From: fverswijver Date: Tue, 19 Jan 2016 14:37:27 +0100 Subject: [PATCH 189/277] Update stacktrace-js.d.ts to include report function Added function to the definition file that was not present. --- stacktrace-js/stacktrace-js.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stacktrace-js/stacktrace-js.d.ts b/stacktrace-js/stacktrace-js.d.ts index 9f7ce5ea2..d20645ae9 100644 --- a/stacktrace-js/stacktrace-js.d.ts +++ b/stacktrace-js/stacktrace-js.d.ts @@ -63,4 +63,13 @@ declare module StackTrace { * @param fn {Function} */ export function deinstrument(fn:() => void): void; + + /** + * Given an Array of StackFrames, serialize and POST to given URL. + * + * @param stackframes - Array[StackFrame] + * @param url - URL as String + * @return Promise + */ + export function report(stackframes: StackFrame[], url: string): Promise; } From a4b718b3d818418d505562ef659b30e162769125 Mon Sep 17 00:00:00 2001 From: Zorgatone Date: Tue, 19 Jan 2016 16:37:36 +0100 Subject: [PATCH 190/277] Using angular instead of obsolete module ng --- ionic/ionic.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 { From eb31772a9439e29d9dfb2042ea4b24764e221ab1 Mon Sep 17 00:00:00 2001 From: Richard Natal Date: Tue, 19 Jan 2016 17:24:42 -0200 Subject: [PATCH 191/277] Added oracledb --- oracledb/oracledb-tests.ts | 29 ++++ oracledb/oracledb.d.ts | 308 +++++++++++++++++++++++++++++++++++++ 2 files changed, 337 insertions(+) create mode 100644 oracledb/oracledb-tests.ts create mode 100644 oracledb/oracledb.d.ts 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; +} From e6231f5948a29d6ffc7bc96e7808dd7a09aa0228 Mon Sep 17 00:00:00 2001 From: Erik O'Leary Date: Tue, 19 Jan 2016 14:37:59 -0600 Subject: [PATCH 192/277] Added missing optional parameter --- chartjs/chart.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From a984b54b41dd3af424879e40cfacdc8f26f8bf0a Mon Sep 17 00:00:00 2001 From: Jean-Philipe Pellerin Date: Tue, 19 Jan 2016 15:51:21 -0500 Subject: [PATCH 193/277] Definition files for hapi/confidence --- confidence/confidence-tests.ts | 79 ++++++++++++++++++++++++++++++++++ confidence/confidence.d.ts | 48 +++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 confidence/confidence-tests.ts create mode 100644 confidence/confidence.d.ts 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; + } +} From 67315b6fb078b8b27c89339c09094a303548d19f Mon Sep 17 00:00:00 2001 From: Oleksandr Podoprygora Date: Tue, 19 Jan 2016 21:31:21 +0200 Subject: [PATCH 194/277] exporting module to be able to declare variable of Umzug type like Umzug.Umzug --- umzug/umzug-tests.ts | 7 +- umzug/umzug.d.ts | 181 ++++++++++++++++++++++--------------------- 2 files changed, 95 insertions(+), 93 deletions(-) diff --git a/umzug/umzug-tests.ts b/umzug/umzug-tests.ts index 95d7521fd..fc3f5aea3 100644 --- a/umzug/umzug-tests.ts +++ b/umzug/umzug-tests.ts @@ -2,11 +2,12 @@ /// /// -import Umzug = require("umzug"); -import Sequelize = require("sequelize"); - +import * as Umzug from "umzug"; +import * as Sequelize from "sequelize"; +var someVar:Umzug.Umzug; var umzug = new Umzug({}); +someVar = umzug; umzug.up().then(function (result) { // do something with the result diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index 2e2b20a7c..82b66c6be 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -7,10 +7,11 @@ /// declare module "umzug" { + import Sequelize = require("sequelize"); - import Sequelize = require("sequelize"); + module umzug { - interface MigrationOptions { + interface MigrationOptions { /* * The params that gets passed to the migrations. @@ -30,9 +31,9 @@ declare module "umzug" { */ wrap?: ( fn : T ) => T; - } + } - interface JSONStorageOptions { + interface JSONStorageOptions { /** * The path to the json storage. @@ -40,55 +41,55 @@ declare module "umzug" { */ path?: string; - } + } - interface SequelizeStorageOptions { + interface SequelizeStorageOptions { - /** - * The configured instance of Sequelize. - * Optional if `model` is passed. - */ - sequelize?: Sequelize.Sequelize; + /** + * The configured instance of Sequelize. + * Optional if `model` is passed. + */ + sequelize?: Sequelize.Sequelize; - /** - * The to be used Sequelize model. - * Must have column name matching `columnName` option - * Optional of `sequelize` is passed. - */ - model?: Sequelize.Model; + /** + * The to be used Sequelize model. + * Must have column name matching `columnName` option + * Optional of `sequelize` is passed. + */ + model?: Sequelize.Model; - /** - * The name of the to be used model. - * Defaults to 'SequelizeMeta' - */ - modelName?: string; + /** + * The name of the to be used model. + * Defaults to 'SequelizeMeta' + */ + modelName?: string; - /** - * The name of table to create if `model` option is not supplied - * Defaults to `modelName` - */ - tableName?: string; + /** + * The name of table to create if `model` option is not supplied + * Defaults to `modelName` + */ + tableName?: string; - /** - * The name of table column holding migration name. - * Defaults to 'name'. - */ - columnName: string; + /** + * The name of table column holding migration name. + * Defaults to 'name'. + */ + columnName: string; - /** - * The type of the column holding migration name. - * Defaults to `Sequelize.STRING` - */ - columnType: Sequelize.DataTypeAbstract; + /** + * The type of the column holding migration name. + * Defaults to `Sequelize.STRING` + */ + columnType: Sequelize.DataTypeAbstract; - } + } - interface ExecuteOptions { + interface ExecuteOptions { migrations?: Array; method?: string; - } + } - interface UmzugOptions { + interface UmzugOptions { /** * The storage. @@ -122,67 +123,67 @@ declare module "umzug" { */ migrations? : MigrationOptions; - } + } - interface UpDownToOptions { + interface UpDownToOptions { - /** - * It is also possible to pass the name of a migration in order to - * just run the migrations from the current state to the passed - * migration name. - */ - to: string; + /** + * It is also possible to pass the name of a migration in order to + * just run the migrations from the current state to the passed + * migration name. + */ + to: string; - } + } - interface UpDownMigrationsOptions { + interface UpDownMigrationsOptions { - /** - * Running specific migrations while ignoring the right order, can be - * done like this: - */ - migrations: Array; + /** + * Running specific migrations while ignoring the right order, can be + * done like this: + */ + migrations: Array; - } + } - class Umzug { + interface Umzug { + /** + * The execute method is a general purpose function that runs for + * every specified migrations the respective function. + */ + execute(options? : ExecuteOptions) : Promise>; - constructor(options?: UmzugOptions); + /** + * You can get a list of pending/not yet executed migrations like this: + */ + pending() : Promise>; - /** - * The execute method is a general purpose function that runs for - * every specified migrations the respective function. - */ - execute(options? : ExecuteOptions) : Promise>; + /** + * You can get a list of already executed migrations like this: + */ + executed() : Promise>; - /** - * You can get a list of pending/not yet executed migrations like this: - */ - pending() : Promise>; + /** + * The up method can be used to execute all pending migrations. + */ + up(migration?: string) : Promise; + up(migrations?: Array) : Promise>; + up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; - /** - * You can get a list of already executed migrations like this: - */ - executed() : Promise>; + /** + * The down method can be used to revert the last executed migration. + */ + down(migration?: string) : Promise; + down(migrations?: Array) : Promise>; + down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; - /** - * The up method can be used to execute all pending migrations. - */ - up(migration?: string) : Promise; - up(migrations?: Array) : Promise>; - up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + } - /** - * The down method can be used to revert the last executed migration. - */ - down(migration?: string) : Promise; - down(migrations?: Array) : Promise>; - down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; - - } - - var umzug : typeof Umzug; - - export = umzug; + interface UmzugStatic { + new (options?: UmzugOptions) : Umzug; + } + } + var umzug : umzug.UmzugStatic; + export = umzug; } From f20ff280475b6a12d4d279860074de925ab4a738 Mon Sep 17 00:00:00 2001 From: Azhaguthasan Date: Tue, 19 Jan 2016 17:17:59 -0800 Subject: [PATCH 195/277] Included NgProgressFactory Definition --- ngprogress/ngprogress.d.ts | 4 ++++ 1 file changed, 4 insertions(+) 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; + } } From 5bf306a3f23cc4c74e5178ad7a085fb447afd4b3 Mon Sep 17 00:00:00 2001 From: DavidCai <376462191@qq.com> Date: Wed, 20 Jan 2016 12:45:33 +0800 Subject: [PATCH 196/277] fix 'can not find name' issue --- koa/koa.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/koa/koa.d.ts b/koa/koa.d.ts index 0433e2b09..450134278 100644 --- a/koa/koa.d.ts +++ b/koa/koa.d.ts @@ -130,6 +130,7 @@ declare module "koa" { onerror(err: any): void; } - let K: typeof Koa; - export = K + namespace Koa {} + + export = Koa; } From bcebb6e7e6e65aa0265343915aa89ee07630ef91 Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 21:42:44 -0800 Subject: [PATCH 197/277] Update angular-idle typings for 1.1.1 --- angular-idle/angular-idle.d.ts | 58 ++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index 4e1e98fb5..95489f53a 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,7 @@ declare module angular.idle { /** - * Used to configure the $keepalive service. + * Used to configure the Keepalive service. */ interface IKeepAliveProvider extends IServiceProvider { @@ -18,9 +18,9 @@ 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 @@ -32,10 +32,10 @@ declare module angular.idle { } /** - * $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 { @@ -56,17 +56,16 @@ declare module angular.idle { } /** - * 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 +74,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,7 +82,7 @@ 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 @@ -95,7 +94,7 @@ declare module angular.idle { autoResume(enabled: boolean): 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 +102,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(): void; + + /** + * Updates the timeout value (see IdleProvider.timeout()) and + * restarts the watch if its running. + */ + setTimeout(): 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 +155,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; } } From ae814b634b23763ebb75a16c0bb3fbe970e31625 Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 21:54:58 -0800 Subject: [PATCH 198/277] Update tests --- angular-idle/angular-idle-tests.ts | 48 +++++++++++++++++++----------- angular-idle/angular-idle.d.ts | 4 +-- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index fc39bf72a..c442d4370 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -1,23 +1,37 @@ /// 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', + (keepaliveProvider: ng.idle.IKeepAliveProvider, idleProvider: ng.idle.IIdleProvider) => { + 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); }]) - .run(['$keepalive', '$idle', ($keepalive: ng.idle.IKeepAliveService, $idle: ng.idle.IIdleService) => { - $idle.watch(); - - if ($idle.running() || $idle.idling()) { - $idle.unwatch(); + .run(['Keepalive', 'Idle', (Keepalive: ng.idle.IKeepAliveService, Idle: ng.idle.IIdleService) => { + 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(); }]); \ No newline at end of file diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index 95489f53a..abdc1e993 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -123,13 +123,13 @@ declare module angular.idle { * Updates the idle value (see IdleProvider.idle()) and * restarts the watch if its running. */ - setIdle(): void; + setIdle(idle: number): void; /** * Updates the timeout value (see IdleProvider.timeout()) and * restarts the watch if its running. */ - setTimeout(): void; + setTimeout(timeout: number): void; /** * Whether user has timed out (meaning idleDuration + timeout has passed without any activity) From cdb35b399643f70a9215f4a2f7f14176ef4c979c Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 22:08:28 -0800 Subject: [PATCH 199/277] Add Title service to angular-idle --- angular-idle/angular-idle.d.ts | 92 ++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index abdc1e993..fc7729f27 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -7,6 +7,98 @@ declare module angular.idle { + /** + * 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(); + } + /** * Used to configure the Keepalive service. */ From 23a59921f3433d741bcb6d947a74403e8447267b Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 22:14:00 -0800 Subject: [PATCH 200/277] Add tests for angular idle Title Service --- angular-idle/angular-idle-tests.ts | 19 ++++++++++++++++--- angular-idle/angular-idle.d.ts | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index c442d4370..74af16c02 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -1,8 +1,9 @@ /// angular.module('app', ['ngIdle']) - .config(['KeepaliveProvider', 'IdleProvider', - (keepaliveProvider: ng.idle.IKeepAliveProvider, idleProvider: ng.idle.IIdleProvider) => { + .config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider', + (keepaliveProvider: ng.idle.IKeepAliveProvider, idleProvider: ng.idle.IIdleProvider, + titleProvider: ng.idle.ITitleProvider) => { idleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown'); idleProvider.idle(5); idleProvider.timeout(5); @@ -17,8 +18,10 @@ angular.module('app', ['ngIdle']) 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) => { + .run(['Keepalive', 'Idle', 'Title', (Keepalive: ng.idle.IKeepAliveService, Idle: ng.idle.IIdleService, Title: ng.idle.ITitleService) => { Idle.setTimeout(Idle.getTimeout()); Idle.setIdle(Idle.getIdle()); @@ -34,4 +37,14 @@ angular.module('app', ['ngIdle']) Keepalive.start(); Keepalive.ping(); Keepalive.stop(); + + Title.setEnabled(Title.isEnabled()); + Title.original(Title.original()); + Title.value(Title.value()); + Title.store(false); + 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 fc7729f27..b2087e60d 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -96,7 +96,7 @@ declare module angular.idle { /** * Stores the original title if it hasn't been already, and displays the timedOutMessage. */ - setAsTimedOut(); + setAsTimedOut(): void; } /** From 9f026569c8cf537857548e873fa13e80c16149ca Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 23:18:20 -0800 Subject: [PATCH 201/277] Use angular.idle instead of ng.idle --- angular-idle/angular-idle-tests.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index 74af16c02..f3401b10f 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -2,8 +2,8 @@ angular.module('app', ['ngIdle']) .config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider', - (keepaliveProvider: ng.idle.IKeepAliveProvider, idleProvider: ng.idle.IIdleProvider, - titleProvider: ng.idle.ITitleProvider) => { + (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); @@ -21,7 +21,8 @@ angular.module('app', ['ngIdle']) titleProvider.enabled(true); }]) - .run(['Keepalive', 'Idle', 'Title', (Keepalive: ng.idle.IKeepAliveService, Idle: ng.idle.IIdleService, Title: ng.idle.ITitleService) => { + .run(['Keepalive', 'Idle', 'Title', (Keepalive: angular.idle.IKeepAliveService, Idle: angular.idle.IIdleService, + Title: angular.idle.ITitleService) => { Idle.setTimeout(Idle.getTimeout()); Idle.setIdle(Idle.getIdle()); From f7287b046a4d217115562df4a1c3fabc444f3752 Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 23:25:47 -0800 Subject: [PATCH 202/277] Update setInterval --- angular-idle/angular-idle-tests.ts | 1 + angular-idle/angular-idle.d.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index f3401b10f..bcb2f2e55 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -38,6 +38,7 @@ angular.module('app', ['ngIdle']) Keepalive.start(); Keepalive.ping(); Keepalive.stop(); + Keepalive.setInterval(10); Title.setEnabled(Title.isEnabled()); Title.original(Title.original()); diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index b2087e60d..a53c3a930 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -145,6 +145,12 @@ 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; } /** From 0c29979c89090444e7760a01542c2d5a1ecea205 Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 23:26:19 -0800 Subject: [PATCH 203/277] Updated per new api documentation --- angular-idle/angular-idle.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index a53c3a930..098c81b15 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -118,7 +118,7 @@ declare module angular.idle { * 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; } @@ -183,13 +183,14 @@ declare module angular.idle { 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. From d4ffe15f647112a42e01ef80f650e523c9b31f7d Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Tue, 19 Jan 2016 23:31:41 -0800 Subject: [PATCH 204/277] Switch my spaces to tabs in the test file --- angular-idle/angular-idle-tests.ts | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index bcb2f2e55..f7297a94f 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -3,33 +3,33 @@ angular.module('app', ['ngIdle']) .config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider', (keepaliveProvider: angular.idle.IKeepAliveProvider, idleProvider: angular.idle.IIdleProvider, - titleProvider: angular.idle.ITitleProvider) => { + 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" - }; + const config: ng.IRequestConfig = { + url: "http://google.com", + method: "GET" + }; - keepaliveProvider.http(config.url); // should accept string and ng.IRequestConfig - keepaliveProvider.http(config); + keepaliveProvider.http(config.url); // should accept string and ng.IRequestConfig + keepaliveProvider.http(config); keepaliveProvider.interval(10); - titleProvider.enabled(true); + titleProvider.enabled(true); }]) .run(['Keepalive', 'Idle', 'Title', (Keepalive: angular.idle.IKeepAliveService, Idle: angular.idle.IIdleService, - Title: angular.idle.ITitleService) => { - Idle.setTimeout(Idle.getTimeout()); - Idle.setIdle(Idle.getIdle()); + Title: angular.idle.ITitleService) => { + Idle.setTimeout(Idle.getTimeout()); + Idle.setIdle(Idle.getIdle()); Idle.watch(); - Idle.interrupt(); + Idle.interrupt(); - const expired: boolean = Idle.isExpired(); + const expired: boolean = Idle.isExpired(); if (Idle.running() || Idle.idling()) { Idle.unwatch(); @@ -38,15 +38,15 @@ angular.module('app', ['ngIdle']) Keepalive.start(); Keepalive.ping(); Keepalive.stop(); - Keepalive.setInterval(10); + Keepalive.setInterval(10); - Title.setEnabled(Title.isEnabled()); - Title.original(Title.original()); - Title.value(Title.value()); - Title.store(false); - Title.restore(); - Title.idleMessage(Title.idleMessage()); - Title.timedOutMessage(Title.timedOutMessage()); - Title.setAsIdle(120); - Title.setAsTimedOut(); + Title.setEnabled(Title.isEnabled()); + Title.original(Title.original()); + Title.value(Title.value()); + Title.store(false); + Title.restore(); + Title.idleMessage(Title.idleMessage()); + Title.timedOutMessage(Title.timedOutMessage()); + Title.setAsIdle(120); + Title.setAsTimedOut(); }]); \ No newline at end of file From 9d3c0e31928a196677b1371a350a363cf1357317 Mon Sep 17 00:00:00 2001 From: Andrey Kurosh Date: Wed, 20 Jan 2016 10:54:00 +0300 Subject: [PATCH 205/277] Renamed to match npm module's name. --- clipboard.js/clipboard.js-tests.ts | 22 ------------------- clipboard/clipboard-tests.ts | 22 +++++++++++++++++++ .../clipboard.d.ts | 6 ++--- 3 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 clipboard.js/clipboard.js-tests.ts create mode 100644 clipboard/clipboard-tests.ts rename clipboard.js/clipboard.js.d.ts => clipboard/clipboard.d.ts (94%) diff --git a/clipboard.js/clipboard.js-tests.ts b/clipboard.js/clipboard.js-tests.ts deleted file mode 100644 index 962bf34e0..000000000 --- a/clipboard.js/clipboard.js-tests.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -var cb1 = new clipboardjs.Clipboard('.btn'); -var cb2 = new clipboardjs.Clipboard('.btn', { - action: elem => 'copy' -}); -var cb3 = new clipboardjs.Clipboard('.btn', { - text: elem => null -}); -var cb4 = new clipboardjs.Clipboard('.btn', { - target: elem => null -}); -var cb5 = new clipboardjs.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-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.js/clipboard.js.d.ts b/clipboard/clipboard.d.ts similarity index 94% rename from clipboard.js/clipboard.js.d.ts rename to clipboard/clipboard.d.ts index 6a8af8519..ddba32b06 100644 --- a/clipboard.js/clipboard.js.d.ts +++ b/clipboard/clipboard.d.ts @@ -3,7 +3,7 @@ // Definitions by: Andrei Kurosh // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module clipboardjs { +declare module clipboard { export class Clipboard { constructor(selector: string, options?: IOptions); @@ -47,6 +47,6 @@ declare module clipboardjs { } } -declare module 'clipboardjs' { - export = clipboardjs; +declare module 'clipboard' { + export = clipboard; } \ No newline at end of file From 690e9db4f61d5fbcf3cb9619cdda423092fe7145 Mon Sep 17 00:00:00 2001 From: delphinus Date: Wed, 20 Jan 2016 21:28:03 +0900 Subject: [PATCH 206/277] Add internal properties extended for Marionette.View --- marionette/marionette.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index b120961cf..4209677d2 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -796,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; } /** From a6e024eb4a0df9f81b9406e3e81bbbdb0c27f835 Mon Sep 17 00:00:00 2001 From: York Yao Date: Wed, 20 Jan 2016 20:46:35 +0800 Subject: [PATCH 207/277] Update react-native.d.ts https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Writing%20Definition%20Files.md --- react-native/react-native.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 3a49a791829b130853c1ad600aa259766c4e2d93 Mon Sep 17 00:00:00 2001 From: York Yao Date: Wed, 20 Jan 2016 20:47:54 +0800 Subject: [PATCH 208/277] Update react-native-tests.tsx --- react-native/react-native-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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( From fc78e5691045ff3cb9eed72e32bb86719f5ac61b Mon Sep 17 00:00:00 2001 From: "Rosiek.Slawomir YSI" Date: Wed, 20 Jan 2016 15:21:43 +0100 Subject: [PATCH 209/277] Initial version of oidc-token-manager definition --- .../oidc-token-manager-tests.ts | 47 ++++++++ oidc-token-manager/oidc-token-manager.d.ts | 107 ++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 oidc-token-manager/oidc-token-manager-tests.ts create mode 100644 oidc-token-manager/oidc-token-manager.d.ts 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..ce01f457b --- /dev/null +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -0,0 +1,107 @@ +// 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, config); + } + + class DefaultPromise { + constructor(promise); + then(successCallback, errorCallback): DefaultPromise; + catch(errorCallback): DefaultPromise; + } + + class DefaultPromiseFactory { + resolve(value): DefaultPromise; + reject(reason): DefaultPromise; + create(callback): DefaultPromise; + } + + interface OidcClientSettings { + request_state_key?: string; + request_state_store?; + 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); + 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?; + 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): void; + } + + interface OidcTokenManager { + profile; + id_token: string; + access_token: string; + expired: boolean; + expires_in: number; + expires_at: number; + scope; + scopes: any[]; + session_state; + + saveToken(token): 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 From 5fc15065bd14b0d2d2d600c1821c2691c155be87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= Date: Wed, 20 Jan 2016 15:33:44 +0100 Subject: [PATCH 210/277] Add weeks(), asWeeks() methods to Duration interface --- moment/moment-node.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index a11fad1dc..16b167d8a 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -99,6 +99,9 @@ declare module moment { days(): number; asDays(): number; + weeks(): number; + asWeeks(): number; + months(): number; asMonths(): number; From fbe0e1e9b1e09e82c575fd2e4f9f61d223e3b70e Mon Sep 17 00:00:00 2001 From: "Rosiek.Slawomir YSI" Date: Wed, 20 Jan 2016 15:41:34 +0100 Subject: [PATCH 211/277] Fixed issues with travis build --- oidc-token-manager/oidc-token-manager.d.ts | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts index ce01f457b..b1e3f2cea 100644 --- a/oidc-token-manager/oidc-token-manager.d.ts +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -5,24 +5,24 @@ declare module Oidc { class DefaultHttpRequest { - getJSON(url, config); + getJSON(url: string, config: any): DefaultPromise; } class DefaultPromise { constructor(promise); - then(successCallback, errorCallback): DefaultPromise; - catch(errorCallback): DefaultPromise; + then(successCallback: () => void, errorCallback: () => void): DefaultPromise; + catch(errorCallback: () => void): DefaultPromise; } class DefaultPromiseFactory { - resolve(value): DefaultPromise; - reject(reason): DefaultPromise; - create(callback): DefaultPromise; + resolve(value: any): DefaultPromise; + reject(reason: any): DefaultPromise; + create(callback: any): DefaultPromise; } interface OidcClientSettings { request_state_key?: string; - request_state_store?; + request_state_store?: any; load_user_profile?: boolean; filter_protocol_claims?: boolean; authority?: string; @@ -51,7 +51,7 @@ declare module Oidc { interface OidcTokenManagerSettings { persist?: boolean; - store?; + store?: any; persistKey?: string; client_id?: string; redirect_uri?: string; @@ -72,19 +72,19 @@ declare module Oidc { interface OidcTokenManager_Static { new (settings?: OidcTokenManagerSettings): OidcTokenManager; setPromiseFactory(promiseFactory: DefaultPromiseFactory): void; - setHttpRequest(httpRequest): void; + setHttpRequest(httpRequest: DefaultHttpRequest): void; } interface OidcTokenManager { - profile; + profile: any; id_token: string; access_token: string; expired: boolean; expires_in: number; expires_at: number; - scope; + scope: any; scopes: any[]; - session_state; + session_state: any; saveToken(token): void; addOnTokenRemoved(cb: () => void): void; From 84a5a8bb62b78a7269a7bad1032868249caa9ce7 Mon Sep 17 00:00:00 2001 From: "Rosiek.Slawomir YSI" Date: Wed, 20 Jan 2016 15:56:02 +0100 Subject: [PATCH 212/277] Another set of fixes for definition --- oidc-token-manager/oidc-token-manager.d.ts | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts index b1e3f2cea..b744f7885 100644 --- a/oidc-token-manager/oidc-token-manager.d.ts +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -9,8 +9,8 @@ declare module Oidc { } class DefaultPromise { - constructor(promise); - then(successCallback: () => void, errorCallback: () => void): DefaultPromise; + constructor(promise: any); + then(successCallback: (value?: any) => void, errorCallback: (reason?) => void): DefaultPromise; catch(errorCallback: () => void): DefaultPromise; } @@ -39,7 +39,7 @@ declare module Oidc { loadMetadataAsync(): DefaultPromise; loadX509SigningKeyAsync(): DefaultPromise; - loadUserProfile(access_token: string); + loadUserProfile(access_token: string): DefaultPromise; loadAuthorizationEndpoint(): void; createTokenRequestAsync(): DefaultPromise; createLogoutRequestAsync(id_token_hint: string): DefaultPromise; @@ -74,6 +74,19 @@ declare module Oidc { 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; @@ -82,11 +95,11 @@ declare module Oidc { expired: boolean; expires_in: number; expires_at: number; - scope: any; - scopes: any[]; + scope: string; + scopes: string[]; session_state: any; - saveToken(token): void; + saveToken(token: OidcToken): void; addOnTokenRemoved(cb: () => void): void; addOnTokenObtained(cb: () => void): void; addOnTokenExpiring(cb: () => void): void; From 888fd83599a9668d79e32cf484f1a9847ebde7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Rosiek?= Date: Wed, 20 Jan 2016 17:31:56 +0100 Subject: [PATCH 213/277] Another set of fixes for definition --- oidc-token-manager/oidc-token-manager.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oidc-token-manager/oidc-token-manager.d.ts b/oidc-token-manager/oidc-token-manager.d.ts index b744f7885..f8309686b 100644 --- a/oidc-token-manager/oidc-token-manager.d.ts +++ b/oidc-token-manager/oidc-token-manager.d.ts @@ -10,7 +10,7 @@ declare module Oidc { class DefaultPromise { constructor(promise: any); - then(successCallback: (value?: any) => void, errorCallback: (reason?) => void): DefaultPromise; + then(successCallback: (value?: any) => void, errorCallback: (reason?: any) => void): DefaultPromise; catch(errorCallback: () => void): DefaultPromise; } From 5d51369b02b48a87e5195af1a2a1dcce356fcb3a Mon Sep 17 00:00:00 2001 From: theodorz Date: Wed, 20 Jan 2016 17:37:04 +0100 Subject: [PATCH 214/277] Update to fix S3 with latest AWS SDK I removed the nested S3 Client interface, because it doesn't seem to be present in the latest AWS JS SDK (2.2.31). --- aws-sdk/aws-sdk.d.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index f89059463..3fef2702e 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -147,7 +147,8 @@ 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 DynamoDB { @@ -1042,14 +1043,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; From ec7740ba881b4f09781809c26766d4ffbaa520a4 Mon Sep 17 00:00:00 2001 From: marcelbuesing Date: Wed, 20 Jan 2016 20:26:39 +0100 Subject: [PATCH 215/277] Update axios definitions to v0.8.1 --- axios/axios-tests.ts | 49 +++++++++++++++- axios/axios.d.ts | 134 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 165 insertions(+), 18 deletions(-) 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 fd19caf94..7348ec651 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -1,9 +1,8 @@ -// 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 { interface IThenable { @@ -18,21 +17,24 @@ declare module Axios { } /** + * HTTP Basic auth details + */ + interface AxiosHttpBasicAuth { + username: string; + password: string; + } + + /** + * Common axios XHR config interface * - request body data type */ interface AxiosXHRConfigBase { - /** - * 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 + * 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. */ - 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; + baseURL?: string; /** * custom headers to be sent @@ -44,12 +46,32 @@ declare module Axios { */ 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' @@ -66,6 +88,17 @@ declare module Axios { */ 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; } /** @@ -92,7 +125,7 @@ declare module Axios { } /** - * - expected response type, + * - expected response type, * - request body data type */ interface AxiosXHR { @@ -122,16 +155,77 @@ declare module Axios { 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; + } + /** - * - expected response type, + * - expected response type, * - request body data type */ - interface AxiosStatic { + 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 */ @@ -163,6 +257,16 @@ declare module Axios { */ patch(url: string, data?: any, config?: AxiosXHRConfigBase): IPromise>; } + + /** + * - expected response type, + */ + interface AxiosStatic extends AxiosInstance { + /** + * create a new instance of axios with a custom config + */ + create(config: AxiosXHRConfigBase): AxiosInstance; + } } declare var axios: Axios.AxiosStatic; From a4c90beffc567638eb87752c376c25ab2152e653 Mon Sep 17 00:00:00 2001 From: Oleksandr Podoprygora Date: Wed, 20 Jan 2016 22:54:21 +0200 Subject: [PATCH 216/277] methods of Umzug class return Promise instead of Promise or Promise at least for Umzug 1.8.0 --- umzug/umzug.d.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index 82b66c6be..47cfe595f 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -146,36 +146,41 @@ declare module "umzug" { } + interface Migration { + path: string; + file: string; + } + interface Umzug { /** * The execute method is a general purpose function that runs for * every specified migrations the respective function. */ - execute(options? : ExecuteOptions) : Promise>; + execute(options? : ExecuteOptions) : Promise; /** * You can get a list of pending/not yet executed migrations like this: */ - pending() : Promise>; + pending() : Promise; /** * You can get a list of already executed migrations like this: */ - executed() : Promise>; + executed() : Promise; /** * The up method can be used to execute all pending migrations. */ - up(migration?: string) : Promise; - up(migrations?: Array) : Promise>; - up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + up(migration?: string) : Promise; + up(migrations?: string[]) : Promise; + up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise; /** * The down method can be used to revert the last executed migration. */ - down(migration?: string) : Promise; - down(migrations?: Array) : Promise>; - down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise>; + down(migration?: string) : Promise; + down(migrations?: string[]) : Promise; + down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise; } From b878ea974797c05350cc2be2e7b7a38200fa2d37 Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Wed, 20 Jan 2016 14:13:25 -0800 Subject: [PATCH 217/277] store arguments are optional --- angular-idle/angular-idle-tests.ts | 1 + angular-idle/angular-idle.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts index f7297a94f..e6eb1a9f2 100644 --- a/angular-idle/angular-idle-tests.ts +++ b/angular-idle/angular-idle-tests.ts @@ -44,6 +44,7 @@ angular.module('app', ['ngIdle']) Title.original(Title.original()); Title.value(Title.value()); Title.store(false); + Title.store(); Title.restore(); Title.idleMessage(Title.idleMessage()); Title.timedOutMessage(Title.timedOutMessage()); diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts index 098c81b15..725beac67 100644 --- a/angular-idle/angular-idle.d.ts +++ b/angular-idle/angular-idle.d.ts @@ -60,7 +60,7 @@ declare module angular.idle { * 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; + store(overwrite?: boolean): void; /** * Sets the title to the original value (if it was stored or set previously). From 44e9def8ee61ff7ac1c7ed70f75fbd19f682a53e Mon Sep 17 00:00:00 2001 From: Justin Reidy Date: Wed, 20 Jan 2016 16:18:57 -0800 Subject: [PATCH 218/277] Add support for mjackson/expect --- expect/expect-tests.ts | 695 +++++++++++++++++++++++++++++++ expect/expect-tests.ts.tscparams | 1 + expect/expect.d.ts | 88 ++++ 3 files changed, 784 insertions(+) create mode 100644 expect/expect-tests.ts create mode 100644 expect/expect-tests.ts.tscparams create mode 100644 expect/expect.d.ts 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..8d3cdc0d8 --- /dev/null +++ b/expect/expect.d.ts @@ -0,0 +1,88 @@ +// 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 expectFn(actual:any):Expectation; + + export module expect { + 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; + } + + import createSpy = expect.createSpy; + import spyOn = expect.spyOn; + import isSpy = expect.isSpy; + import restoreSpies = expect.restoreSpies; + import assert = expect.assert; + import extend = expect.extend; + + export default expectFn; + export { + createSpy, + spyOn, + isSpy, + restoreSpies, + assert, + extend + } +} From 39b27dc36d3abc2230388bc68ef71682f0755f11 Mon Sep 17 00:00:00 2001 From: Justin Reidy Date: Wed, 20 Jan 2016 16:31:29 -0800 Subject: [PATCH 219/277] update export syntax --- expect/expect.d.ts | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/expect/expect.d.ts b/expect/expect.d.ts index 8d3cdc0d8..2566c79fa 100644 --- a/expect/expect.d.ts +++ b/expect/expect.d.ts @@ -58,31 +58,14 @@ declare module "expect" { destroy():void; } - function expectFn(actual:any):Expectation; + function expect(actual:any):Expectation; - export module expect { - 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 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; - import createSpy = expect.createSpy; - import spyOn = expect.spyOn; - import isSpy = expect.isSpy; - import restoreSpies = expect.restoreSpies; - import assert = expect.assert; - import extend = expect.extend; - - export default expectFn; - export { - createSpy, - spyOn, - isSpy, - restoreSpies, - assert, - extend - } + export default expect; } From 5fe89fb639d8d7f772aaac09882b7c1269fe3820 Mon Sep 17 00:00:00 2001 From: Oleksandr Podoprygora Date: Thu, 21 Jan 2016 04:45:02 +0200 Subject: [PATCH 220/277] updating version: Umzug v1.8.0 --- umzug/umzug.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index 47cfe595f..b09aae88c 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Umzug v1.7.0 +// Type definitions for Umzug v1.8.0 // Project: https://github.com/sequelize/umzug // Definitions by: Ivan Drinchev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 010286e12798f2a32a1071611bb2c4a1c2e4f9a6 Mon Sep 17 00:00:00 2001 From: achiever-ph Date: Thu, 21 Jan 2016 12:34:07 +0000 Subject: [PATCH 221/277] Added AMD Module for well-known name "amplify" --- amplifyjs/amplifyjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From 2cad4a3cff770c37b40496188c246b1a60e87e2d Mon Sep 17 00:00:00 2001 From: Jason Jarrett Date: Thu, 21 Jan 2016 09:27:28 -0800 Subject: [PATCH 222/277] small change to force an update (testing NugetAutomation) --- react/react.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react/react.d.ts b/react/react.d.ts index 15146eb9b..8b4f32587 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare namespace __React { + // // React Elements // ---------------------------------------------------------------------- From 6f3a573f2090549c1e6616c16b0d77e6eaa1467a Mon Sep 17 00:00:00 2001 From: Bernie Sumption Date: Thu, 21 Jan 2016 21:37:48 +0000 Subject: [PATCH 223/277] Added type annotation to Utils.Factorial Without the type annotation, this fails to compile with --noImplicitAny --- tween.js/tween.js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tween.js/tween.js.d.ts b/tween.js/tween.js.d.ts index 0caaed147..ecf82d61e 100644 --- a/tween.js/tween.js.d.ts +++ b/tween.js/tween.js.d.ts @@ -95,6 +95,6 @@ interface TweenInterpolation { Utils: { Linear(p0:number, p1:number, t:number): number; Bernstein(n:number, i:number): number; - Factorial(n): number; + Factorial(n:number): number; }; } From 6c891d4cdd21b9255df21edfb7566945e4b44f05 Mon Sep 17 00:00:00 2001 From: bmajz Date: Thu, 21 Jan 2016 17:37:58 -0800 Subject: [PATCH 224/277] Add ECS definitions to AWS type definitions --- aws-sdk/aws-sdk.d.ts | 109 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 3fef2702e..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; @@ -151,6 +152,16 @@ declare module "aws-sdk" { 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 { constructor(options?: any); } @@ -1085,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; + } + } } From df409d2ef6da6ce2bb43457a0198437df2ba978c Mon Sep 17 00:00:00 2001 From: Josh McCullough Date: Sun, 17 Jan 2016 21:20:00 -0500 Subject: [PATCH 225/277] Added definition for Node.JS package http-status-codes. --- http-status-codes/http-status-codes-tests.ts | 109 +++++++++++++++++++ http-status-codes/http-status-codes.d.ts | 61 +++++++++++ 2 files changed, 170 insertions(+) create mode 100644 http-status-codes/http-status-codes-tests.ts create mode 100644 http-status-codes/http-status-codes.d.ts 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 From 3be6ea80f1d7880dbeabe5ae1cfb7b22fa22839c Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 22 Jan 2016 16:36:54 +0900 Subject: [PATCH 226/277] add `bson` definition files --- bson/bson-tests.ts | 23 ++++++++ bson/bson.d.ts | 133 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 bson/bson-tests.ts create mode 100644 bson/bson.d.ts 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; +} + From 808a31e15f9ff68696d66cb7e7ff78ed01b99486 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 16:42:21 +0100 Subject: [PATCH 227/277] (feature) Fist step to upgrade lodash to 4.0.0 --- backbone/backbone-with-lodash-tests.ts | 2 +- bookshelf/bookshelf.d.ts | 2 +- knex/knex-tests.ts | 2 +- lodash-decorators/lodash-decorators-tests.ts | 2 +- lodash-decorators/lodash-decorators.d.ts | 2 +- lodash/lodash-3.10.d.ts | 14991 +++++++++++++++++ lodash/lodash-tests-3.10.ts | 10016 +++++++++++ lodash/lodash-tests.ts | 138 +- lodash/lodash.d.ts | 354 +- sequelize/sequelize-2.0.0.d.ts | 2 +- sequelize/sequelize.d.ts | 2 +- 11 files changed, 25265 insertions(+), 248 deletions(-) create mode 100644 lodash/lodash-3.10.d.ts create mode 100644 lodash/lodash-tests-3.10.ts 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/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index 95aa38408..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' { 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/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 0293b17e6..f2c59d841 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3941,12 +3941,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; }); @@ -4657,68 +4651,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; @@ -5386,12 +5381,6 @@ module TestSortByOrder { } } -result = _.where(stoogesCombined, { 'age': 40 }); -result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); - -result = _(stoogesCombined).where({ 'age': 40 }).value(); -result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); - /******** * Date * ********/ @@ -9992,7 +9981,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 9d42b9d5d..8fd70fc49 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3,6 +3,194 @@ // Definitions by: Brian Zengel , Ilya Mochalov // Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** +# 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) + +TODO: +- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence +- [ ] Removed _.pluck in favor of _.map with iteratee shorthand +- [ ] Removed thisArg params from most methods +- [ ] Split _.max & _.min into _.maxBy & _.minBy + +- [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 _.first to _.head +- [ ] Renamed _.indexBy to _.keyBy +- [ ] Renamed _.invoke to _.invokeMap +- [ ] Renamed _.modArgs to _.overArgs +- [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd +- [ ] Renamed _.pairs to _.toPairs +- [ ] Renamed _.rest to _.tail +- [ ] Renamed _.restParam to _.rest +- [ ] Renamed _.sortByOrder to _.orderBy +- [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd +- [ ] Renamed _.trunc to _.truncate + +- [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf +- [ ] Split _.max & _.min into _.maxBy & _.minBy +- [ ] Split _.omit & _.pick into _.omitBy & _.pickBy +- [ ] Split _.sample into _.sampleSize +- [ ] Split _.sortedIndex into _.sortedIndexBy +- [ ] Split _.sortedLastIndex into _.sortedLastIndexBy +- [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy + +- [ ] Absorbed _.sortByAll into _.sortBy +- [ ] Changed the category of _.at to “Object” +- [ ] Changed the category of _.bindAll to “Utility” +- [ ] Made “By” methods provide a single param to iteratees +- [ ] Made _.capitalize uppercase the first character & lowercase the rest +- [ ] Made _.functions return only own method names +- [ ] 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 + +added 23 array methods: +- [ ] _.concat, +- [ ] _.differenceBy, +- [ ] _.differenceWith, +- [ ] _.flatMap, +- [ ] _.fromPairs, +- [ ] _.intersectionBy, +- [ ] _.intersectionWith, +- [ ] _.join, +- [ ] _.pullAll, +- [ ] _.pullAllBy, +- [ ] _.reverse, +- [ ] _.sortedIndexBy, +- [ ] _.sortedIndexOf, +- [ ] _.sortedLastIndexBy, +- [ ] _.sortedLastIndexOf, +- [ ] _.sortedUniq, +- [ ] _.sortedUniqBy, +- [ ] _.unionBy, +- [ ] _.unionWith, +- [ ] _.uniqBy, +- [ ] _.uniqWith, +- [ ] _.xorBy, & +- [ ] _.xorWith + +added 18 lang methods: +- [ ] _.cloneDeepWith, +- [ ] _.cloneWith, +- [ ] _.eq, +- [ ] _.isArrayLike, +- [ ] _.isArrayLikeObject, +- [ ] _.isEqualWith, +- [ ] _.isInteger, +- [ ] _.isLength, +- [ ] _.isMatchWith, +- [ ] _.isNil, +- [ ] _.isObjectLike, +- [ ] _.isSafeInteger, +- [ ] _.isSymbol, +- [ ] _.toInteger, +- [ ] _.toLength, +- [ ] _.toNumber, +- [ ] _.toSafeInteger, & +- [ ] _.toString + +added 13 object methods: +- [ ] _.assignIn, +- [ ] _.assignInWith, +- [ ] _.assignWith, +- [ ] _.functionsIn, +- [ ] _.hasIn, +- [ ] _.invoke, +- [ ] _.mergeWith, +- [ ] _.omitBy, +- [ ] _.pickBy, +- [ ] _.setWith, +- [ ] _.toPairs, +- [ ] _.toPairsIn, & +- [ ] _.unset + +added 8 string methods: +- [ ] _.lowerCase, +- [ ] _.lowerFirst, +- [ ] _.replace, +- [ ] _.split, +- [ ] _.upperCase, +- [ ] _.upperFirst, +- [ ] _.toLower, & +- [ ] _.toUpper + +added 8 utility methods: +- [ ] _.cond, +- [ ] _.conforms, +- [ ] _.nthArg, +- [ ] _.over, +- [ ] _.overEvery, +- [ ] _.overSome, +- [ ] _.rangeRight, & +- [ ] _.toPath + +added 4 math methods: +- [ ] _.maxBy, +- [ ] _.mean, +- [ ] _.minBy, & +- [ ] _.sumBy + +added 2 function methods: +- [ ] _.flip & +- [ ] _.unary + +added 2 number methods: +- [ ] _.clamp & +- [ ] _.subtract + +added chain method: +- [ ] _#next + +added collection method: +- [ ] _.sampleSize + +Added 3 aliases +- [ ] _.extend as an alias of _.assignIn +- [ ] _.extendWith as an alias of _.assignInWith +- [ ] _.first as an alias of _.head + +Removed 17 aliases +- [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique + +Other changes +- [ ] Added clear method to _.memoize.Cache +- [ ] Added flush method to debounced & throttled functions +- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray +- [ ] Added support for array buffers to _.isEqual +- [ ] Added support for converting iterators to _.toArray +- [ ] Added support for deep paths to _.zipObject +- [ ] Changed UMD to export to window or self when available regardless of other exports +- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [ ] Ensured “Collection” methods treat functions as objects +- [ ] Ensured debounce cancel clears args & thisArg references +- [ ] Ensured _.add, _.subtract, & _.sum don’t skip NaN values +- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects +- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator +- [ ] Ensured _.clone treats generators like functions +- [ ] Ensured _.clone produces clones with the source’s [[Prototype]] +- [ ] Ensured _.defaults assigns properties that shadow Object.prototype +- [ ] Ensured _.defaultsDeep doesn’t merge a string into an array +- [ ] Ensured _.defaultsDeep & _.merge don’t modify sources +- [ ] Ensured _.defaultsDeep works with circular references +- [ ] Ensured _.isFunction returns true for generator functions +- [ ] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 +- [ ] Ensured _.merge assigns typed arrays directly +- [ ] Ensured _.merge doesn’t convert strings to arrays +- [ ] Ensured _.merge merges plain-objects onto non plain-objects +- [ ] Ensured _#plant resets iterator data of cloned sequences +- [ ] Ensured _.random swaps min & max if min is greater than max +- [ ] Ensured _.range preserves the sign of start of -0 +- [ ] Ensured _.reduce & _.reduceRight use getIteratee in their array branch +- [ ] Fixed rounding issue with the precision param of _.floor +- [ ] Made _(...) an iterator & iterable +- [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0 +*/ + declare var _: _.LoDashStatic; declare module _ { @@ -51,11 +239,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. @@ -5871,81 +6054,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 { /** @@ -7276,57 +7384,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 { /** @@ -8909,41 +8966,6 @@ declare module _ { ): 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 * ********/ diff --git a/sequelize/sequelize-2.0.0.d.ts b/sequelize/sequelize-2.0.0.d.ts index 1bb6be593..04af612a5 100644 --- a/sequelize/sequelize-2.0.0.d.ts +++ b/sequelize/sequelize-2.0.0.d.ts @@ -6,7 +6,7 @@ // Based on original work by: samuelneff /// -/// +/// declare module "sequelize" { diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 0dcd61e86..fda6503a5 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -5,7 +5,7 @@ // Based on original work by: samuelneff -/// +/// /// /// From 5abdddd2ab2371bb83178264771ef60989798e7c Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:03:47 +0100 Subject: [PATCH 228/277] (feature) Rename fist to head --- lodash/lodash.d.ts | 107 +++++---------------------------------------- 1 file changed, 12 insertions(+), 95 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8fd70fc49..9952113da 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -18,7 +18,7 @@ TODO: - [x] Removed _.where in favor of _.filter with iteratee shorthand - [x] Removed _.pluck in favor of _.map with iteratee shorthand -- [ ] Renamed _.first to _.head +- [x] Renamed _.first to _.head - [ ] Renamed _.indexBy to _.keyBy - [ ] Renamed _.invoke to _.invokeMap - [ ] Renamed _.modArgs to _.overArgs @@ -152,7 +152,7 @@ added collection method: Added 3 aliases - [ ] _.extend as an alias of _.assignIn - [ ] _.extendWith as an alias of _.assignInWith -- [ ] _.first as an alias of _.head +- [x] _.first as an alias of _.head Removed 17 aliases - [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique @@ -311,89 +311,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 { } @@ -1296,27 +1213,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; } @@ -1445,7 +1357,12 @@ declare module _ { //_.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; } From b7f28d2d86f94c79d67dc5b796f099520ffad663 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:07:22 +0100 Subject: [PATCH 229/277] (feature) Rename _.indexBy to _.keyBy --- lodash/lodash-tests.ts | 186 ++++++++++++++++++++--------------------- lodash/lodash.d.ts | 92 ++++++++++---------- 2 files changed, 139 insertions(+), 139 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f2c59d841..765ab33ee 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4384,8 +4384,8 @@ module TestIncludes { } } -// _.indexBy -module TestIndexBy { +// _.keyBy +module TestKeyBy { type SampleObject = {a: number; b: string; c: boolean;}; let array: SampleObject[]; @@ -4401,131 +4401,131 @@ 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}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9952113da..93d974cfd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -19,7 +19,7 @@ TODO: - [x] Removed _.pluck in favor of _.map with iteratee shorthand - [x] Renamed _.first to _.head -- [ ] Renamed _.indexBy to _.keyBy +- [x] Renamed _.indexBy to _.keyBy - [ ] Renamed _.invoke to _.invokeMap - [ ] Renamed _.modArgs to _.overArgs - [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd @@ -208,7 +208,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 @@ -6732,7 +6732,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 @@ -6754,51 +6754,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; @@ -6806,9 +6806,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.indexBy + * @see _.keyBy */ - indexBy( + keyBy( iteratee?: ListIterator, thisArg?: any ): LoDashImplicitObjectWrapper>; @@ -6816,66 +6816,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>; @@ -6883,57 +6883,57 @@ 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>; } From 9841ecc216bd491d615c84829c3d08ee1668dcd1 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:09:38 +0100 Subject: [PATCH 230/277] (feature) Renamed _.invoke to _.invokeMap --- lodash/lodash-tests.ts | 4 ++-- lodash/lodash.d.ts | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 765ab33ee..f8b8671a9 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4529,8 +4529,8 @@ module TestKeyBy { } } -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 { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 93d974cfd..a713c97d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -20,7 +20,7 @@ TODO: - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy -- [ ] Renamed _.invoke to _.invokeMap +- [x] Renamed _.invoke to _.invokeMap - [ ] Renamed _.modArgs to _.overArgs - [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [ ] Renamed _.pairs to _.toPairs @@ -6938,7 +6938,7 @@ declare module _ { ): LoDashExplicitObjectWrapper>; } - //_.invoke + //_.invokeMap interface LoDashStatic { /** * Invokes the method named by methodName on each element in the collection returning @@ -6949,47 +6949,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; From 95514890d62b943ba07354228860bffa247afda5 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 17:11:48 +0100 Subject: [PATCH 231/277] (feature) Renamed _.overArgs to _.overArgs --- lodash/lodash-tests.ts | 28 ++++++++++++++-------------- lodash/lodash.d.ts | 26 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f8b8671a9..39d3d5f6f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5993,8 +5993,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; @@ -6007,43 +6007,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]); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a713c97d7..5212735dc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -21,7 +21,7 @@ TODO: - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap -- [ ] Renamed _.modArgs to _.overArgs +- [x] Renamed _.overArgs to _.overArgs - [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [ ] Renamed _.pairs to _.toPairs - [ ] Renamed _.rest to _.tail @@ -9620,7 +9620,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. @@ -9630,15 +9630,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; @@ -9646,26 +9646,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 From 6c45e1efa3dc97c6a60a988fe9aa283bf5c1f21d Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 18:59:53 +0100 Subject: [PATCH 232/277] (feature) Renamed _.padLeft & _.padRight to _.padStart & _.padEnd --- lodash/lodash-tests.ts | 44 +++++++++++++++++++++--------------------- lodash/lodash.d.ts | 28 +++++++++++++-------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 39d3d5f6f..15509fd77 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9010,49 +9010,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, '_-'); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5212735dc..0e7ea8fd7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9,9 +9,7 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence -- [ ] Removed _.pluck in favor of _.map with iteratee shorthand - [ ] Removed thisArg params from most methods -- [ ] Split _.max & _.min into _.maxBy & _.minBy - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand @@ -22,7 +20,7 @@ TODO: - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap - [x] Renamed _.overArgs to _.overArgs -- [ ] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd +- [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [ ] Renamed _.pairs to _.toPairs - [ ] Renamed _.rest to _.tail - [ ] Renamed _.restParam to _.rest @@ -13805,7 +13803,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 @@ -13816,7 +13814,7 @@ declare module _ { * @param chars The string used as padding. * @return Returns the padded string. */ - padLeft( + padStart( string?: string, length?: number, chars?: string @@ -13825,9 +13823,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.padLeft + * @see _.padStart */ - padLeft( + padStart( length?: number, chars?: string ): string; @@ -13835,15 +13833,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 @@ -13854,7 +13852,7 @@ declare module _ { * @param chars The string used as padding. * @return Returns the padded string. */ - padRight( + padEnd( string?: string, length?: number, chars?: string @@ -13863,9 +13861,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.padRight + * @see _.padEnd */ - padRight( + padEnd( length?: number, chars?: string ): string; @@ -13873,9 +13871,9 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.padRight + * @see _.padEnd */ - padRight( + padEnd( length?: number, chars?: string ): LoDashExplicitWrapper; From 654d36379b2e071c41add511bd3c585d07d669f0 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:01:39 +0100 Subject: [PATCH 233/277] (feature) Renamed _.pairs to _.toPairs --- lodash/lodash-tests.ts | 16 ++++++++-------- lodash/lodash.d.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 15509fd77..7ff608f52 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8627,44 +8627,44 @@ module TestOmit { } } -// _.pairs -module TestPairs { +// _.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(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 0e7ea8fd7..49fba82c3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -21,7 +21,7 @@ TODO: - [x] Renamed _.invoke to _.invokeMap - [x] Renamed _.overArgs to _.overArgs - [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd -- [ ] Renamed _.pairs to _.toPairs +- [x] Renamed _.pairs to _.toPairs - [ ] Renamed _.rest to _.tail - [ ] Renamed _.restParam to _.rest - [ ] Renamed _.sortByOrder to _.orderBy @@ -13261,7 +13261,7 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.pairs + //_.toPairs interface LoDashStatic { /** * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. @@ -13269,23 +13269,23 @@ 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 From a7699d15e70c986ec4c5fbef9856d3304e66cebd Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:02:46 +0100 Subject: [PATCH 234/277] (feature) Renamed _.rest to _.tail --- lodash/lodash-tests.ts | 16 ++++++++-------- lodash/lodash.d.ts | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7ff608f52..e342cb7c8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1283,31 +1283,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(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 49fba82c3..fabea5b90 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -22,7 +22,7 @@ TODO: - [x] Renamed _.overArgs to _.overArgs - [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [x] Renamed _.pairs to _.toPairs -- [ ] Renamed _.rest to _.tail +- [x] Renamed _.rest to _.tail - [ ] Renamed _.restParam to _.rest - [ ] Renamed _.sortByOrder to _.orderBy - [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd @@ -1977,7 +1977,7 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.rest + //_.tail interface LoDashStatic { /** * Gets all but the first element of array. @@ -1987,35 +1987,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 From 324afef7721890dd5e8bc0ca9c2778705c90190c Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:04:20 +0100 Subject: [PATCH 235/277] (feature) Renamed _.restParam to _.rest --- lodash/lodash-tests.ts | 20 ++++++++++---------- lodash/lodash.d.ts | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index e342cb7c8..5c2b3d573 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6132,8 +6132,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; @@ -6142,25 +6142,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); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index fabea5b90..05f51816e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -23,7 +23,7 @@ TODO: - [x] Renamed _.padLeft & _.padRight to _.padStart & _.padEnd - [x] Renamed _.pairs to _.toPairs - [x] Renamed _.rest to _.tail -- [ ] Renamed _.restParam to _.rest +- [x] Renamed _.restParam to _.rest - [ ] Renamed _.sortByOrder to _.orderBy - [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [ ] Renamed _.trunc to _.truncate @@ -9888,7 +9888,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 @@ -9900,15 +9900,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; @@ -9916,16 +9916,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 From 515bcddd071a914f8bd627fd90de9df58983e454 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:05:43 +0100 Subject: [PATCH 236/277] (feature) Renamed _.sortByOrder to _.orderBy --- lodash/lodash-tests.ts | 96 +++++++++++++++++++++--------------------- lodash/lodash.d.ts | 90 +++++++++++++++++++-------------------- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5c2b3d573..d0d3c94aa 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5291,8 +5291,8 @@ module TestSortByAll { } } -// _.sortByOrder -module TestSortByOrder { +// _.orderBy +module TestorderBy { type SampleObject = {a: number; b: string; c: boolean}; let array: SampleObject[]; @@ -5305,79 +5305,79 @@ 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); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 05f51816e..75bf6baac 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -24,7 +24,7 @@ TODO: - [x] Renamed _.pairs to _.toPairs - [x] Renamed _.rest to _.tail - [x] Renamed _.restParam to _.rest -- [ ] Renamed _.sortByOrder to _.orderBy +- [x] Renamed _.sortByOrder to _.orderBy - [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [ ] Renamed _.trunc to _.truncate @@ -8671,7 +8671,7 @@ declare module _ { ): LoDashExplicitArrayWrapper; } - //_.sortByOrder + //_.orderBy interface LoDashStatic { /** * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort @@ -8689,52 +8689,52 @@ declare module _ { * @param orders The sort orders of iteratees. * @return Returns the new sorted array. */ - 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)[] @@ -8743,9 +8743,9 @@ declare module _ { interface LoDashImplicitWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|(ListIterator|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8753,9 +8753,9 @@ declare module _ { interface LoDashImplicitArrayWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashImplicitArrayWrapper; @@ -8763,49 +8763,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; @@ -8813,9 +8813,9 @@ declare module _ { interface LoDashExplicitWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|(ListIterator|string)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; @@ -8823,9 +8823,9 @@ declare module _ { interface LoDashExplicitArrayWrapper { /** - * @see _.sortByOrder + * @see _.orderBy */ - sortByOrder( + orderBy( iteratees: ListIterator|string|W|(ListIterator|string|W)[], orders?: boolean|string|(boolean|string)[] ): LoDashExplicitArrayWrapper; @@ -8833,49 +8833,49 @@ 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; From 63157c261eca23f05555ae57ee53a49203aacf41 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:07:06 +0100 Subject: [PATCH 237/277] (feature) Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd --- lodash/lodash-tests.ts | 37 ++++++++++++++++++------------------- lodash/lodash.d.ts | 26 +++++++++++++------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d0d3c94aa..d2ef64326 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9203,46 +9203,45 @@ 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('_-'); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 75bf6baac..e88e628d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -25,7 +25,7 @@ TODO: - [x] Renamed _.rest to _.tail - [x] Renamed _.restParam to _.rest - [x] Renamed _.sortByOrder to _.orderBy -- [ ] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd +- [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [ ] Renamed _.trunc to _.truncate - [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf @@ -14116,7 +14116,7 @@ declare module _ { trim(chars?: string): LoDashExplicitWrapper; } - //_.trimLeft + //_.trimStart interface LoDashStatic { /** * Removes leading whitespace or specified characters from string. @@ -14125,7 +14125,7 @@ declare module _ { * @param chars The characters to trim. * @return Returns the trimmed string. */ - trimLeft( + trimStart( string?: string, chars?: string ): string; @@ -14133,19 +14133,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. @@ -14154,7 +14154,7 @@ declare module _ { * @param chars The characters to trim. * @return Returns the trimmed string. */ - trimRight( + trimEnd( string?: string, chars?: string ): string; @@ -14162,16 +14162,16 @@ 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 From 27cb7c84ccd308f1d65e97643edd9a9fd40e71bd Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:09:18 +0100 Subject: [PATCH 238/277] (feature) Renamed _.trunc to _.truncate --- lodash/lodash-tests.ts | 34 +++++++++++++++++----------------- lodash/lodash.d.ts | 16 ++++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d2ef64326..f8318107e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9245,32 +9245,32 @@ module TestTrimEnd { } } -// _.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': ' […]' }); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e88e628d7..f12d06ada 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -14174,8 +14174,8 @@ declare module _ { trimEnd(chars?: string): LoDashExplicitWrapper; } - //_.trunc - interface TruncOptions { + //_.truncate + interface TruncateOptions { /** The maximum string length. */ length?: number; /** The string to indicate text is omitted. */ @@ -14193,24 +14193,24 @@ 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; } //_.unescape From aebe3d44cababeb3d324e77d42bdd0edde0da4e3 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 19:20:39 +0100 Subject: [PATCH 239/277] (feature) Split _.max & _.min into _.maxBy & _.minBy --- lodash/lodash-tests.ts | 147 +++++++++-------- lodash/lodash.d.ts | 349 ++++++++++++++++++++++++----------------- 2 files changed, 286 insertions(+), 210 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f8318107e..41b80f49c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7185,52 +7185,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; @@ -7240,41 +7206,92 @@ 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}); +} + +// _.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 diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f12d06ada..793aaca1f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -26,7 +26,7 @@ TODO: - [x] Renamed _.restParam to _.rest - [x] Renamed _.sortByOrder to _.orderBy - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd -- [ ] Renamed _.trunc to _.truncate +- [x] Renamed _.trunc to _.truncate - [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [ ] Split _.max & _.min into _.maxBy & _.minBy @@ -37,10 +37,10 @@ TODO: - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy - [ ] Absorbed _.sortByAll into _.sortBy -- [ ] Changed the category of _.at to “Object” -- [ ] Changed the category of _.bindAll to “Utility” +- [x] Changed the category of _.at to “Object” +- [x] Changed the category of _.bindAll to “Utility” - [ ] Made “By” methods provide a single param to iteratees -- [ ] Made _.capitalize uppercase the first character & lowercase the rest +- [x] Made _.capitalize uppercase the first character & lowercase the rest - [ ] Made _.functions return only own method names - [ ] Made _.words chainable by default - [ ] Removed isDeep params from _.clone & _.flatten @@ -10137,6 +10137,7 @@ declare module _ { * 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. @@ -11142,55 +11143,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; } @@ -11198,48 +11162,114 @@ 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; } @@ -11247,54 +11277,17 @@ declare module _ { //_.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; } @@ -11302,48 +11295,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; } From 474d691952462d02e82580182cee9f439df867de Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:29:32 +0100 Subject: [PATCH 240/277] (feature) Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf --- lodash/lodash-tests.ts | 23 +++++++++++ lodash/lodash.d.ts | 90 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 104 insertions(+), 9 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 41b80f49c..983d73f21 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[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 793aaca1f..f4f34bfc7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -28,8 +28,8 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate -- [ ] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf -- [ ] Split _.max & _.min into _.maxBy & _.minBy +- [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf +- [x] Split _.max & _.min into _.maxBy & _.minBy - [ ] Split _.omit & _.pick into _.omitBy & _.pickBy - [ ] Split _.sample into _.sampleSize - [ ] Split _.sortedIndex into _.sortedIndexBy @@ -1382,14 +1382,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, @@ -1438,6 +1451,65 @@ declare module _ { ): LoDashExplicitWrapper; } + //_.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 { /** From e9db15c7d208963e37e33ca9720592078d6d7cb2 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:39:38 +0100 Subject: [PATCH 241/277] (feature) Split _.omit & _.pick into _.omitBy & _.pickBy --- lodash/lodash-tests.ts | 58 ++++++++++--- lodash/lodash.d.ts | 181 ++++++++++++++++++++++++++--------------- 2 files changed, 163 insertions(+), 76 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 983d73f21..4b06f98b0 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8640,8 +8640,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); } { @@ -8651,8 +8649,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); } { @@ -8662,8 +8658,29 @@ 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); + } +} + +// _.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); } } @@ -8719,8 +8736,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); } { @@ -8730,8 +8745,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); } { @@ -8741,8 +8754,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); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f4f34bfc7..818c28076 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -30,7 +30,7 @@ TODO: - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy -- [ ] Split _.omit & _.pick into _.omitBy & _.pickBy +- [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [ ] Split _.sample into _.sampleSize - [ ] Split _.sortedIndex into _.sortedIndexBy - [ ] Split _.sortedLastIndex into _.sortedLastIndexBy @@ -13334,24 +13334,24 @@ declare module _ { //_.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[])[] @@ -13359,13 +13359,6 @@ declare module _ { } interface LoDashImplicitObjectWrapper { - /** - * @see _.omit - */ - omit( - predicate: ObjectIterator, - thisArg?: any - ): LoDashImplicitObjectWrapper; /** * @see _.omit @@ -13376,13 +13369,6 @@ declare module _ { } interface LoDashExplicitObjectWrapper { - /** - * @see _.omit - */ - omit( - predicate: ObjectIterator, - thisArg?: any - ): LoDashExplicitObjectWrapper; /** * @see _.omit @@ -13392,6 +13378,50 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.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 { /** @@ -13422,25 +13452,21 @@ declare module _ { //_.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, @@ -13449,14 +13475,6 @@ declare module _ { } interface LoDashImplicitObjectWrapper { - /** - * @see _.pick - */ - pick( - predicate: ObjectIterator, - thisArg?: any - ): LoDashImplicitObjectWrapper; - /** * @see _.pick */ @@ -13466,14 +13484,6 @@ declare module _ { } interface LoDashExplicitObjectWrapper { - /** - * @see _.pick - */ - pick( - predicate: ObjectIterator, - thisArg?: any - ): LoDashExplicitObjectWrapper; - /** * @see _.pick */ @@ -13482,6 +13492,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 { /** From 6fab2980b1795b5cea5b07952f95987bae7c0b26 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:44:37 +0100 Subject: [PATCH 242/277] (feature) Split _.sample into _.sampleSize --- lodash/lodash-tests.ts | 9 +++-- lodash/lodash.d.ts | 78 ++++++++++++++++++++++++++++-------------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4b06f98b0..f0abe1d44 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4894,12 +4894,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(); + +// _.sampleSize +result = _.sampleSize([1, 2, 3, 4], 2); +result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sampleSize(2); +result = _([1, 2, 3, 4]).sampleSize(2).value(); // _.select module TestSelect { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 818c28076..ff005a991 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -31,7 +31,7 @@ TODO: - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy -- [ ] Split _.sample into _.sampleSize +- [x] Split _.sample into _.sampleSize - [ ] Split _.sortedIndex into _.sortedIndexBy - [ ] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy @@ -7909,10 +7909,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; /** @@ -7924,36 +7932,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; + sample(): LoDashImplicitWrapper; + } + + //_.sampleSize + interface LoDashStatic { + /** + * 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] + */ + sampleSize(collection: Array, n: number): T[]; /** - * @see _.sample + * @see _.sampleSize + **/ + sampleSize(collection: List, n: number): T[]; + + /** + * @see _.sampleSize + **/ + sampleSize(collection: Dictionary, n: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sampleSize **/ - sample(): LoDashImplicitWrapper; + sampleSize(n: number): LoDashImplicitArrayWrapper; + + /** + * @see _.sampleSize + **/ + sampleSize(): LoDashImplicitWrapper; } //_.select From c00b6c330cbe71aa1652cb957a1b6554c0ccd808 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 22:57:04 +0100 Subject: [PATCH 243/277] (feature) Split _.sortedIndex into _.sortedIndexBy --- lodash/lodash-tests.ts | 107 +++++++------ lodash/lodash.d.ts | 338 ++++++++++++++++++++++++++++++----------- 2 files changed, 313 insertions(+), 132 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f0abe1d44..506aac21f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1380,70 +1380,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}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ff005a991..03eb0b2d1 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -32,7 +32,7 @@ TODO: - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [x] Split _.sample into _.sampleSize -- [ ] Split _.sortedIndex into _.sortedIndexBy +- [x] Split _.sortedIndex into _.sortedIndexBy - [ ] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy @@ -2130,24 +2130,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; /** @@ -2155,9 +2157,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee?: (x: T) => any, - thisArg?: any + value: T ): number; /** @@ -2165,8 +2165,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: string + value: T ): number; /** @@ -2174,8 +2173,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: W + value: T ): number; /** @@ -2183,8 +2181,7 @@ declare module _ { */ sortedIndex( array: List, - value: T, - iteratee: Object + value: T ): number; } @@ -2193,9 +2190,7 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): number; } @@ -2204,25 +2199,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; } @@ -2231,42 +2215,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; } @@ -2275,9 +2238,7 @@ declare module _ { * @see _.sortedIndex */ sortedIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): LoDashExplicitWrapper; } @@ -2286,25 +2247,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; } @@ -2313,40 +2270,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; From 420423e900fcce6bdc101e024c8abcdb623fb688 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:06:10 +0100 Subject: [PATCH 244/277] (feature) Split _.sortedLastIndex into _.sortedLastIndexBy --- lodash/lodash-tests.ts | 105 +++++++------ lodash/lodash.d.ts | 329 ++++++++++++++++++++++++++++++----------- 2 files changed, 304 insertions(+), 130 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 506aac21f..f1c04cb4f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1483,70 +1483,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}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 03eb0b2d1..43542ec89 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -33,7 +33,7 @@ TODO: - [x] Split _.omit & _.pick into _.omitBy & _.pickBy - [x] Split _.sample into _.sampleSize - [x] Split _.sortedIndex into _.sortedIndexBy -- [ ] Split _.sortedLastIndex into _.sortedLastIndexBy +- [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy - [ ] Absorbed _.sortByAll into _.sortBy @@ -2517,20 +2517,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; /** @@ -2538,9 +2542,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee?: (x: T) => any, - thisArg?: any + value: T ): number; /** @@ -2548,8 +2550,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: string + value: T ): number; /** @@ -2557,8 +2558,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: W + value: T ): number; /** @@ -2566,8 +2566,7 @@ declare module _ { */ sortedLastIndex( array: List, - value: T, - iteratee: Object + value: T ): number; } @@ -2576,9 +2575,7 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): number; } @@ -2587,25 +2584,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; } @@ -2614,42 +2607,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; } @@ -2658,9 +2630,7 @@ declare module _ { * @see _.sortedLastIndex */ sortedLastIndex( - value: string, - iteratee?: (x: string) => TSort, - thisArg?: any + value: string ): LoDashExplicitWrapper; } @@ -2669,25 +2639,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; } @@ -2696,40 +2655,238 @@ 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; From 618f01a953e24c808d820539fe0020bbbd029fce Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:18:31 +0100 Subject: [PATCH 245/277] (feature) Removed aliase _.unique --- lodash/lodash-tests.ts | 162 ------------ lodash/lodash.d.ts | 552 +++++++---------------------------------- 2 files changed, 89 insertions(+), 625 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f1c04cb4f..ed873436a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2003,168 +2003,6 @@ module TestUniq { } } -// _.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]]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 43542ec89..103897a2b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11,11 +11,13 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods +- [ ] Check for aliases in this group - [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 +- [ ] Check for aliases in this group - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap @@ -28,6 +30,7 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate +- [ ] Check for aliases in this group - [x] Split _.indexOf & _.lastIndexOf into _.sortedIndexOf & _.sortedLastIndexOf - [x] Split _.max & _.min into _.maxBy & _.minBy - [x] Split _.omit & _.pick into _.omitBy & _.pickBy @@ -36,6 +39,7 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +- [ ] Check for aliases in this group - [ ] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” @@ -48,89 +52,89 @@ TODO: - [ ] Removed func-first param signature from _.before & _.after added 23 array methods: -- [ ] _.concat, -- [ ] _.differenceBy, -- [ ] _.differenceWith, -- [ ] _.flatMap, -- [ ] _.fromPairs, -- [ ] _.intersectionBy, -- [ ] _.intersectionWith, -- [ ] _.join, -- [ ] _.pullAll, -- [ ] _.pullAllBy, -- [ ] _.reverse, -- [ ] _.sortedIndexBy, -- [ ] _.sortedIndexOf, -- [ ] _.sortedLastIndexBy, -- [ ] _.sortedLastIndexOf, -- [ ] _.sortedUniq, -- [ ] _.sortedUniqBy, -- [ ] _.unionBy, -- [ ] _.unionWith, -- [ ] _.uniqBy, -- [ ] _.uniqWith, -- [ ] _.xorBy, & +- [ ] _.concat +- [ ] _.differenceBy +- [ ] _.differenceWith +- [ ] _.flatMap +- [ ] _.fromPairs +- [ ] _.intersectionBy +- [ ] _.intersectionWith +- [ ] _.join +- [ ] _.pullAll +- [ ] _.pullAllBy +- [ ] _.reverse +- [ ] _.sortedIndexBy +- [ ] _.sortedIndexOf +- [ ] _.sortedLastIndexBy +- [ ] _.sortedLastIndexOf +- [ ] _.sortedUniq +- [ ] _.sortedUniqBy +- [ ] _.unionBy +- [ ] _.unionWith +- [ ] _.uniqBy +- [ ] _.uniqWith +- [ ] _.xorBy - [ ] _.xorWith added 18 lang methods: -- [ ] _.cloneDeepWith, -- [ ] _.cloneWith, -- [ ] _.eq, -- [ ] _.isArrayLike, -- [ ] _.isArrayLikeObject, -- [ ] _.isEqualWith, -- [ ] _.isInteger, -- [ ] _.isLength, -- [ ] _.isMatchWith, -- [ ] _.isNil, -- [ ] _.isObjectLike, -- [ ] _.isSafeInteger, -- [ ] _.isSymbol, -- [ ] _.toInteger, -- [ ] _.toLength, -- [ ] _.toNumber, -- [ ] _.toSafeInteger, & +- [ ] _.cloneDeepWith +- [ ] _.cloneWith +- [ ] _.eq +- [ ] _.isArrayLike +- [ ] _.isArrayLikeObject +- [ ] _.isEqualWith +- [ ] _.isInteger +- [ ] _.isLength +- [ ] _.isMatchWith +- [ ] _.isNil +- [ ] _.isObjectLike +- [ ] _.isSafeInteger +- [ ] _.isSymbol +- [ ] _.toInteger +- [ ] _.toLength +- [ ] _.toNumber +- [ ] _.toSafeInteger - [ ] _.toString added 13 object methods: -- [ ] _.assignIn, -- [ ] _.assignInWith, -- [ ] _.assignWith, -- [ ] _.functionsIn, -- [ ] _.hasIn, -- [ ] _.invoke, -- [ ] _.mergeWith, -- [ ] _.omitBy, -- [ ] _.pickBy, -- [ ] _.setWith, -- [ ] _.toPairs, -- [ ] _.toPairsIn, & +- [ ] _.assignIn +- [ ] _.assignInWith +- [ ] _.assignWith +- [ ] _.functionsIn +- [ ] _.hasIn +- [ ] _.invoke +- [ ] _.mergeWith +- [ ] _.omitBy +- [ ] _.pickBy +- [ ] _.setWith +- [ ] _.toPairs +- [ ] _.toPairsIn - [ ] _.unset added 8 string methods: -- [ ] _.lowerCase, -- [ ] _.lowerFirst, -- [ ] _.replace, -- [ ] _.split, -- [ ] _.upperCase, -- [ ] _.upperFirst, -- [ ] _.toLower, & +- [ ] _.lowerCase +- [ ] _.lowerFirst +- [ ] _.replace +- [ ] _.split +- [ ] _.upperCase +- [ ] _.upperFirst +- [ ] _.toLower - [ ] _.toUpper added 8 utility methods: -- [ ] _.cond, -- [ ] _.conforms, -- [ ] _.nthArg, -- [ ] _.over, -- [ ] _.overEvery, -- [ ] _.overSome, -- [ ] _.rangeRight, & +- [ ] _.cond +- [ ] _.conforms +- [ ] _.nthArg +- [ ] _.over +- [ ] _.overEvery +- [ ] _.overSome +- [ ] _.rangeRight - [ ] _.toPath added 4 math methods: -- [ ] _.maxBy, -- [ ] _.mean, -- [ ] _.minBy, & +- [ ] _.maxBy +- [ ] _.mean +- [ ] _.minBy - [ ] _.sumBy added 2 function methods: @@ -153,7 +157,23 @@ Added 3 aliases - [x] _.first as an alias of _.head Removed 17 aliases -- [ ] _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object, _.#run, _.select, & _.unique +- [ ] Removed aliase _.all +- [ ] Removed aliase _.any +- [ ] Removed aliase _.backflow +- [ ] Removed aliase _.callback +- [ ] Removed aliase _.collect +- [ ] Removed aliase _.compose +- [ ] Removed aliase _.contains +- [ ] Removed aliase _.detect +- [ ] Removed aliase _.foldl +- [ ] Removed aliase _.foldr +- [ ] Removed aliase _.include +- [ ] Removed aliase _.inject +- [ ] Removed aliase _.methods +- [ ] Removed aliase _.object +- [ ] Removed aliase _.#run +- [ ] Removed aliase _.select +- [x] Removed aliase _.unique Other changes - [ ] Added clear method to _.memoize.Cache @@ -3767,400 +3787,6 @@ declare module _ { ): 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 { /** From 5dd9ae353ce862612130c1e856d933e5da0b3133 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:21:24 +0100 Subject: [PATCH 246/277] (feature) Removed aliase _.select --- lodash/lodash-tests.ts | 98 ------------------------- lodash/lodash.d.ts | 163 +---------------------------------------- 2 files changed, 2 insertions(+), 259 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ed873436a..d94e7a368 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4778,104 +4778,6 @@ result = _.sampleSize([1, 2, 3, 4], 2); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sampleSize(2); result = _([1, 2, 3, 4]).sampleSize(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[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 103897a2b..e59f5a89e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -171,8 +171,8 @@ Removed 17 aliases - [ ] Removed aliase _.inject - [ ] Removed aliase _.methods - [ ] Removed aliase _.object -- [ ] Removed aliase _.#run -- [ ] Removed aliase _.select +- [ ] Removed aliase _.run +- [x] Removed aliase _.select - [x] Removed aliase _.unique Other changes @@ -7927,165 +7927,6 @@ declare module _ { sampleSize(): 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 { /** From 4a5102e41bf5a13b5dc584c6a6dbac0d8a060e06 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:23:15 +0100 Subject: [PATCH 247/277] (feature) Removed aliase _.run --- lodash/lodash-tests.ts | 38 -------------------------------------- lodash/lodash.d.ts | 12 ++---------- 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d94e7a368..1a4bf57d6 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2744,44 +2744,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e59f5a89e..11845033b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -171,7 +171,7 @@ Removed 17 aliases - [ ] Removed aliase _.inject - [ ] Removed aliase _.methods - [ ] Removed aliase _.object -- [ ] Removed aliase _.run +- [x] Removed aliase _.run - [x] Removed aliase _.select - [x] Removed aliase _.unique @@ -4461,14 +4461,6 @@ declare module _ { reverse(): LoDashExplicitArrayWrapper; } - //_.prototype.run - interface LoDashWrapperBase { - /** - * @see _.value - */ - run(): T; - } - //_.prototype.toJSON interface LoDashWrapperBase { /** @@ -4492,7 +4484,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. */ From 3ee78754090916e910e64f30738b63ec06b94705 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 13 Jan 2016 23:42:39 +0100 Subject: [PATCH 248/277] (feature) Removed aliases _.all, _.any, _.backflow, _.callback, _.collect, _.compose, _.contains, _.detect, _.foldl, _.foldr, _.include, _.inject, _.methods, _.object --- lodash/lodash-tests.ts | 707 ----------------------- lodash/lodash.d.ts | 1236 ++-------------------------------------- 2 files changed, 50 insertions(+), 1893 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1a4bf57d6..1d0f2fa96 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1008,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[]; @@ -2879,170 +2751,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[]; @@ -3074,143 +2782,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[]; @@ -3344,54 +2915,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[]; @@ -4151,52 +3674,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;}; @@ -4589,22 +4066,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; }); @@ -4613,24 +4074,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 { @@ -5229,36 +4673,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 { @@ -5488,36 +4902,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); @@ -8345,31 +7729,6 @@ module TestMerge { } } -// _.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; @@ -9147,72 +8506,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 11845033b..8500d9ecf 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -157,20 +157,20 @@ Added 3 aliases - [x] _.first as an alias of _.head Removed 17 aliases -- [ ] Removed aliase _.all -- [ ] Removed aliase _.any -- [ ] Removed aliase _.backflow -- [ ] Removed aliase _.callback -- [ ] Removed aliase _.collect -- [ ] Removed aliase _.compose -- [ ] Removed aliase _.contains -- [ ] Removed aliase _.detect -- [ ] Removed aliase _.foldl -- [ ] Removed aliase _.foldr -- [ ] Removed aliase _.include -- [ ] Removed aliase _.inject -- [ ] Removed aliase _.methods -- [ ] Removed aliase _.object +- [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 @@ -1705,125 +1705,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 { /** @@ -3390,8 +3271,6 @@ declare module _ { * 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. @@ -3995,8 +3874,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. @@ -4503,291 +4380,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 { /** @@ -4832,220 +4424,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 { /** @@ -5238,94 +4616,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 { /** @@ -5557,8 +4847,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. @@ -5712,8 +5000,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. @@ -5888,8 +5174,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. @@ -6569,95 +5853,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. @@ -7025,8 +6226,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. @@ -7370,107 +6569,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 { @@ -7488,36 +6586,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 { @@ -7535,36 +6603,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 @@ -7625,57 +6663,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 @@ -8052,8 +7039,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. @@ -8852,28 +7837,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 { /** @@ -9050,28 +8013,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 { /** @@ -9444,8 +8385,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. */ @@ -12571,8 +11510,6 @@ declare module _ { /** * 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. */ @@ -13113,28 +12050,6 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.methods - interface LoDashStatic { - /** - * @see _.functions - */ - methods(object: any): string[]; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.functions - */ - methods(): _.LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.functions - */ - methods(): _.LoDashExplicitArrayWrapper; - } - //_.omit interface LoDashStatic { /** @@ -14286,83 +13201,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 { /** @@ -14422,7 +13260,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, @@ -14430,7 +13294,7 @@ declare module _ { ): (...args: any[]) => TResult; /** - * @see _.callback + * @see _.iteratee */ iteratee( func: string, @@ -14438,7 +13302,7 @@ declare module _ { ): (object: any) => TResult; /** - * @see _.callback + * @see _.iteratee */ iteratee( func: Object, @@ -14446,45 +13310,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>; } From 3e8f32f82b1bc1ed15232efdcbc3d1729bd392f1 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 00:17:54 +0100 Subject: [PATCH 249/277] (feature) Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy --- lodash/lodash-tests.ts | 308 +++++++++++------ lodash/lodash.d.ts | 766 +++++++++++++++++++++++++---------------- 2 files changed, 654 insertions(+), 420 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1d0f2fa96..a6b7b2cc1 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1725,153 +1725,233 @@ 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}); + + } +} + + +// _.uniqBy +module TestUniqBy { + 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 = _.uniqBy('abc', stringIterator); + result = _.uniqBy('abc', stringIterator); + } + + { + let result: SampleObject[]; + + 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 = _.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').uniqBy(stringIterator); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).uniqBy(listIterator); + result = _(array).uniqBy('a'); + result = _(array).uniqBy<{a: number}>({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().uniqBy(stringIterator); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().uniqBy(listIterator); + result = _(array).chain().uniqBy('a'); + result = _(array).chain().uniqBy<{a: number}>({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}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8500d9ecf..1ba718812 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -146,7 +146,7 @@ added 2 number methods: - [ ] _.subtract added chain method: -- [ ] _#next +- [ ] _.next added collection method: - [ ] _.sampleSize @@ -3256,113 +3256,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. - * - * @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[]; } @@ -3370,299 +3287,536 @@ 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; + uniq(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.uniq + */ + uniq(): LoDashExplicitArrayWrapper; /** * @see _.uniq */ - uniq( - isSorted?: boolean, - iteratee?: string, - thisArg?: any + uniq(): LoDashExplicitArrayWrapper; + } + + //_.uniqBy + interface LoDashStatic { + /** + * 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 }] + */ + uniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: ListIterator + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: string + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: Object + ): T[]; + + /** + * @see _.uniqBy + */ + uniqBy( + array: List, + iteratee: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - iteratee?: string, - thisArg?: any + uniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - isSorted?: boolean, - iteratee?: TWhere - ): LoDashExplicitArrayWrapper; - - /** - * @see _.uniq - */ - uniq( - iteratee?: TWhere + uniqBy( + iteratee: TWhere ): LoDashExplicitArrayWrapper; } interface LoDashExplicitObjectWrapper { - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + /** + * @see _.uniqBy + */ + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - isSorted?: boolean, - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - iteratee?: ListIterator, - thisArg?: any + uniqBy( + iteratee: Object ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.uniqBy */ - uniq( - 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 */ - uniq( - iteratee?: string, - thisArg?: any + sortedUniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - isSorted?: boolean, - iteratee?: Object + sortedUniqBy( + iteratee: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - isSorted?: boolean, - iteratee?: TWhere + sortedUniqBy( + iteratee: ListIterator ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - iteratee?: Object + sortedUniqBy( + iteratee: string ): LoDashExplicitArrayWrapper; /** - * @see _.uniq + * @see _.sortedUniqBy */ - uniq( - iteratee?: TWhere + sortedUniqBy( + iteratee: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortedUniqBy + */ + sortedUniqBy( + iteratee: TWhere ): LoDashExplicitArrayWrapper; } From 0ebf1030569dcf57078da515fc93f3c5384c91e7 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:08:08 +0100 Subject: [PATCH 250/277] (feature) _.cloneDeepWith and _.cloneWith --- lodash/lodash-tests.ts | 78 ++++++++--------- lodash/lodash.d.ts | 190 ++++++++++++++++++++++++++--------------- 2 files changed, 158 insertions(+), 110 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a6b7b2cc1..63fd99870 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5552,87 +5552,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 diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1ba718812..6f9f2f223 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -77,8 +77,8 @@ added 23 array methods: - [ ] _.xorWith added 18 lang methods: -- [ ] _.cloneDeepWith -- [ ] _.cloneWith +- [x] _.cloneDeepWith +- [x] _.cloneWith - [ ] _.eq - [ ] _.isArrayLike - [ ] _.isArrayLikeObject @@ -9099,87 +9099,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. + * Creates a shallow clone of `value`. * - * @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. + * **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 @@ -9195,35 +9258,28 @@ 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 From bee4d73867e1f363a34731d74bf035a46521d95a Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:09:54 +0100 Subject: [PATCH 251/277] (feature) Absorbed _.sortByAll into _.sortBy --- lodash/lodash-tests.ts | 76 +--------- lodash/lodash.d.ts | 324 ++++++++++++----------------------------- 2 files changed, 100 insertions(+), 300 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 63fd99870..c19e3af69 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4451,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}); } @@ -4473,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}); } @@ -4495,89 +4489,27 @@ 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}); } } -// _.sortByAll -module TestSortByAll { - type SampleObject = {a: number; b: string; c: boolean}; +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); }); - let array: SampleObject[]; - let list: _.List; - let numericDictionary: _.NumericDictionary; - let dictionary: _.Dictionary;; +result = _(foodsOrganic).sortBy('organic', (food) => food.name, { organic: true }).value(); - { - let iteratees: (value: string) => any|((value: string) => any)[]; - let result: string[]; - - result = _.sortByAll('acbd', iteratees); - } - - { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; - let result: SampleObject[]; - - result = _.sortByAll<{a: number}, SampleObject>(array, iteratees); - result = _.sortByAll(array, iteratees); - - result = _.sortByAll<{a: number}, SampleObject>(list, iteratees); - result = _.sortByAll(list, iteratees); - - result = _.sortByAll<{a: number}, SampleObject>(numericDictionary, iteratees); - result = _.sortByAll(numericDictionary, iteratees); - - result = _.sortByAll<{a: number}, SampleObject>(dictionary, iteratees); - result = _.sortByAll(dictionary, iteratees); - } - - { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; - let result: _.LoDashImplicitArrayWrapper; - - result = _(array).sortByAll<{a: number}>(iteratees); - - result = _(list).sortByAll<{a: number}, SampleObject>(iteratees); - result = _(list).sortByAll(iteratees); - - result = _(numericDictionary).sortByAll<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).sortByAll(iteratees); - - result = _(dictionary).sortByAll<{a: number}, SampleObject>(iteratees); - result = _(dictionary).sortByAll(iteratees); - } - - { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; - let result: _.LoDashExplicitArrayWrapper; - - result = _(array).chain().sortByAll<{a: number}>(iteratees); - - result = _(list).chain().sortByAll<{a: number}, SampleObject>(iteratees); - result = _(list).chain().sortByAll(iteratees); - - result = _(numericDictionary).chain().sortByAll<{a: number}, SampleObject>(iteratees); - result = _(numericDictionary).chain().sortByAll(iteratees); - - result = _(dictionary).chain().sortByAll<{a: number}, SampleObject>(iteratees); - result = _(dictionary).chain().sortByAll(iteratees); - } -} // _.orderBy module TestorderBy { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6f9f2f223..dc4594691 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -39,8 +39,8 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy -- [ ] Check for aliases in this group -- [ ] Absorbed _.sortByAll into _.sortBy +- [ ] TODO remove _.sortBy duplicates +- [x] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” - [ ] Made “By” methods provide a single param to iteratees @@ -7343,29 +7343,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[]; /** @@ -7373,8 +7385,7 @@ declare module _ { */ sortBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): T[]; /** @@ -7399,6 +7410,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 { @@ -7406,8 +7431,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitArrayWrapper; /** @@ -7424,6 +7448,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 { @@ -7431,8 +7465,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitArrayWrapper; /** @@ -7456,8 +7489,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitArrayWrapper; /** @@ -7481,8 +7513,7 @@ declare module _ { * @see _.sortBy */ sortBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitArrayWrapper; /** @@ -7501,208 +7532,34 @@ declare module _ { 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 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, specified as individual values or arrays of values. - * @return Returns the new sorted array. - */ - sortByAll( - collection: List, - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: List, - iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: NumericDictionary, - iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: NumericDictionary, - iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: Dictionary, - iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] - ): T[]; - - /** - * @see _.sortByAll - */ - sortByAll( - collection: Dictionary, - iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] - ): T[]; - } - - interface LoDashImplicitWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|(ListIterator|string)[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitArrayWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] - ): LoDashImplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] - ): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|(ListIterator|string)[] - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitArrayWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|W|(ListIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: ListIterator|string|Object|(ListIterator|string|Object)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[] - ): LoDashExplicitArrayWrapper; - - /** - * @see _.sortByAll - */ - sortByAll( - iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[] - ): LoDashExplicitArrayWrapper; - } - //_.orderBy 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]] */ orderBy( collection: List, @@ -13355,11 +13212,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, From ebb1b5add4dfbf7290490aeb5f982590031c52b9 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:10:29 +0100 Subject: [PATCH 252/277] (clean) Status update --- lodash/lodash.d.ts | 65 ++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index dc4594691..1f4f78ede 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11,13 +11,11 @@ TODO: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods -- [ ] Check for aliases in this group - [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 -- [ ] Check for aliases in this group - [x] Renamed _.first to _.head - [x] Renamed _.indexBy to _.keyBy - [x] Renamed _.invoke to _.invokeMap @@ -30,14 +28,13 @@ TODO: - [x] Renamed _.trimLeft & _.trimRight to _.trimStart & _.trimEnd - [x] Renamed _.trunc to _.truncate -- [ ] Check for aliases in this group - [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 -- [ ] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +- [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy - [ ] TODO remove _.sortBy duplicates - [x] Absorbed _.sortByAll into _.sortBy @@ -45,7 +42,7 @@ TODO: - [x] Changed the category of _.bindAll to “Utility” - [ ] Made “By” methods provide a single param to iteratees - [x] Made _.capitalize uppercase the first character & lowercase the rest -- [ ] Made _.functions return only own method names +- [x] Made _.functions return only own method names - [ ] Made _.words chainable by default - [ ] Removed isDeep params from _.clone & _.flatten - [ ] Removed _.bindAll support for binding all methods when no names are provided @@ -63,15 +60,15 @@ added 23 array methods: - [ ] _.pullAll - [ ] _.pullAllBy - [ ] _.reverse -- [ ] _.sortedIndexBy -- [ ] _.sortedIndexOf -- [ ] _.sortedLastIndexBy +- [x] _.sortedIndexBy +- [x] _.sortedIndexOf +- [x] _.sortedLastIndexBy - [ ] _.sortedLastIndexOf -- [ ] _.sortedUniq -- [ ] _.sortedUniqBy +- [x] _.sortedUniq +- [x] _.sortedUniqBy - [ ] _.unionBy - [ ] _.unionWith -- [ ] _.uniqBy +- [x] _.uniqBy - [ ] _.uniqWith - [ ] _.xorBy - [ ] _.xorWith @@ -132,9 +129,9 @@ added 8 utility methods: - [ ] _.toPath added 4 math methods: -- [ ] _.maxBy +- [x] _.maxBy - [ ] _.mean -- [ ] _.minBy +- [x] _.minBy - [ ] _.sumBy added 2 function methods: @@ -149,7 +146,7 @@ added chain method: - [ ] _.next added collection method: -- [ ] _.sampleSize +- [x] _.sampleSize Added 3 aliases - [ ] _.extend as an alias of _.assignIn @@ -179,32 +176,32 @@ Other changes - [ ] Added clear method to _.memoize.Cache - [ ] Added flush method to debounced & throttled functions - [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray -- [ ] Added support for array buffers to _.isEqual -- [ ] Added support for converting iterators to _.toArray -- [ ] Added support for deep paths to _.zipObject -- [ ] Changed UMD to export to window or self when available regardless of other exports +- [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 - [ ] Enabled _.flow & _.flowRight to accept an array of functions - [ ] Ensured “Collection” methods treat functions as objects -- [ ] Ensured debounce cancel clears args & thisArg references -- [ ] Ensured _.add, _.subtract, & _.sum don’t skip NaN values +- [x] Ensured debounce cancel clears args & thisArg references +- [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values - [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects - [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator -- [ ] Ensured _.clone treats generators like functions -- [ ] Ensured _.clone produces clones with the source’s [[Prototype]] -- [ ] Ensured _.defaults assigns properties that shadow Object.prototype -- [ ] Ensured _.defaultsDeep doesn’t merge a string into an array -- [ ] Ensured _.defaultsDeep & _.merge don’t modify sources -- [ ] Ensured _.defaultsDeep works with circular references +- [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 - [ ] Ensured _.isFunction returns true for generator functions -- [ ] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 +- [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 - [ ] Ensured _.merge assigns typed arrays directly -- [ ] Ensured _.merge doesn’t convert strings to arrays -- [ ] Ensured _.merge merges plain-objects onto non plain-objects -- [ ] Ensured _#plant resets iterator data of cloned sequences -- [ ] Ensured _.random swaps min & max if min is greater than max -- [ ] Ensured _.range preserves the sign of start of -0 -- [ ] Ensured _.reduce & _.reduceRight use getIteratee in their array branch -- [ ] Fixed rounding issue with the precision param of _.floor +- [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 - [ ] Made _(...) an iterator & iterable - [ ] Made _.drop, _.take, & right forms coerce n of undefined to 0 */ From ede6c030a176e7e8e8392982e29a42b946268c4d Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 01:47:52 +0100 Subject: [PATCH 253/277] (feature) Add _.clamp and _.subtract --- lodash/lodash-tests.ts | 34 +++++++++++++++ lodash/lodash.d.ts | 96 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c19e3af69..69ad40482 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6539,6 +6539,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1f4f78ede..f36c2c1d7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5,17 +5,20 @@ /** -# 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) +### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) -TODO: +#### TODO: +misc: - [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence - [ ] Removed thisArg params from most methods +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 @@ -28,6 +31,7 @@ TODO: - [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 @@ -36,6 +40,7 @@ TODO: - [x] Split _.sortedLastIndex into _.sortedLastIndexBy - [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy +changes: - [ ] TODO remove _.sortBy duplicates - [x] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” @@ -10443,6 +10448,93 @@ declare module _ { * 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 { /** From 5919b1b39d79c4e406b8c420dc6b8f7b1c5fb80e Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 02:08:49 +0100 Subject: [PATCH 254/277] (feature) Add _.flip and _.unary --- lodash/lodash-tests.ts | 57 +++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 76 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 127 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 69ad40482..af31de6ce 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4627,8 +4627,7 @@ module TestNow { /************* * Functions * *************/ - -// _after +// _.after module TestAfter { interface Func { (a: string, b: number): boolean; @@ -5080,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; @@ -5395,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} diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f36c2c1d7..1f5d7d743 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -140,12 +140,12 @@ added 4 math methods: - [ ] _.sumBy added 2 function methods: -- [ ] _.flip & -- [ ] _.unary +- [x] _.flip +- [x] _.unary added 2 number methods: -- [ ] _.clamp & -- [ ] _.subtract +- [x] _.clamp +- [x] _.subtract added chain method: - [ ] _.next @@ -8366,6 +8366,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 { /** @@ -8846,6 +8881,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 { /** From ccc411a625c10c4654ab364574cf0c1cdc10b080 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 02:25:33 +0100 Subject: [PATCH 255/277] (feature) Add _.mean and _.sumBy --- lodash/lodash-tests.ts | 94 +++++++++------ lodash/lodash.d.ts | 257 ++++++++++++++++++++++++++++------------- 2 files changed, 240 insertions(+), 111 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index af31de6ce..c3748114d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6442,6 +6442,18 @@ module TestMaxBy { 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[]; @@ -6533,58 +6545,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(''); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1f5d7d743..0bdf99972 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -135,9 +135,9 @@ added 8 utility methods: added 4 math methods: - [x] _.maxBy -- [ ] _.mean +- [x] _.mean - [x] _.minBy -- [ ] _.sumBy +- [x] _.sumBy added 2 function methods: - [x] _.flip @@ -10226,6 +10226,38 @@ declare module _ { ): 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 { /** @@ -10391,40 +10423,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 @@ -10433,19 +10444,6 @@ declare module _ { } interface LoDashImplicitArrayWrapper { - /** - * @see _.sum - */ - sum( - iteratee: ListIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum(iteratee: string): number; - /** * @see _.sum */ @@ -10456,15 +10454,7 @@ declare module _ { /** * @see _.sum **/ - sum( - iteratee: ListIterator|DictionaryIterator, - thisArg?: any - ): number; - - /** - * @see _.sum - */ - sum(iteratee: string): number; + sum(): number; /** * @see _.sum @@ -10473,19 +10463,6 @@ declare module _ { } interface LoDashExplicitArrayWrapper { - /** - * @see _.sum - */ - sum( - iteratee: ListIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sum - */ - sum(iteratee: string): LoDashExplicitWrapper; - /** * @see _.sum */ @@ -10496,15 +10473,7 @@ declare module _ { /** * @see _.sum */ - sum( - iteratee: ListIterator|DictionaryIterator, - thisArg?: any - ): LoDashExplicitWrapper; - - /** - * @see _.sum - */ - sum(iteratee: string): LoDashExplicitWrapper; + sum(): LoDashExplicitWrapper; /** * @see _.sum @@ -10512,6 +10481,138 @@ 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 * **********/ From c64f7a35b79dbc536f5af4953e7897c94a5d4063 Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 17:39:12 +0100 Subject: [PATCH 256/277] (feature) Add _.isEqual and _.eq --- lodash/lodash-tests.ts | 33 +++++---- lodash/lodash.d.ts | 155 +++++++++++++++++++++++++++++++---------- 2 files changed, 141 insertions(+), 47 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c3748114d..bea9ee14a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5620,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); } } @@ -5843,20 +5837,35 @@ 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); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 0bdf99972..5cadfc55f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9212,13 +9212,38 @@ declare module _ { //_.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; } @@ -9227,9 +9252,7 @@ declare module _ { * @see _.isEqual */ eq( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -9238,9 +9261,7 @@ declare module _ { * @see _.isEqual */ eq( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): LoDashExplicitWrapper; } @@ -9446,34 +9467,38 @@ declare module _ { } //_.isEqual - interface IsEqualCustomizer { - (value: any, other: any, indexOrKey?: number|string): boolean; - } - + // TODO tests 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; } @@ -9482,9 +9507,7 @@ declare module _ { * @see _.isEqual */ isEqual( - other: any, - customizer?: IsEqualCustomizer, - thisArg?: any + other: any ): boolean; } @@ -9493,9 +9516,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; } From dcf0aac8b272dda73024d832988fc85a1a91f91d Mon Sep 17 00:00:00 2001 From: DomiR Date: Thu, 14 Jan 2016 18:06:29 +0100 Subject: [PATCH 257/277] (feature) Add _.lowerCase and _.lowerFirst --- lodash/lodash-tests.ts | 32 ++++++++++++++++++ lodash/lodash.d.ts | 73 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bea9ee14a..a20319e2d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8289,6 +8289,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5cadfc55f..ee569ab6e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13078,6 +13078,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 { /** From 3276cdc914e84978fb672817757b98419471e78d Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:38:15 +0100 Subject: [PATCH 258/277] (feature) Add _.upperFirst and _.upperCase --- lodash/lodash-tests.ts | 32 +++++++++++++++++ lodash/lodash.d.ts | 81 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 109 insertions(+), 4 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a20319e2d..574739560 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8608,6 +8608,38 @@ module Testtruncate { } } +// _.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(); + } +} + // _.unescape module TestUnescape { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ee569ab6e..e3dfd5235 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -114,12 +114,12 @@ added 13 object methods: - [ ] _.unset added 8 string methods: -- [ ] _.lowerCase -- [ ] _.lowerFirst +- [x] _.lowerCase +- [x] _.lowerFirst - [ ] _.replace - [ ] _.split -- [ ] _.upperCase -- [ ] _.upperFirst +- [x] _.upperCase +- [x] _.upperFirst - [ ] _.toLower - [ ] _.toUpper @@ -13599,6 +13599,79 @@ declare module _ { 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 interface LoDashStatic { /** From 90053552388a8ab95078633479e4cc0e0ff9a1e2 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:42:13 +0100 Subject: [PATCH 259/277] (feature) Add _.toLower and _.toUpper --- lodash/lodash-tests.ts | 32 ++++++++++++++++++ lodash/lodash.d.ts | 76 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 574739560..ab51b9e44 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8516,6 +8516,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e3dfd5235..2f98201dc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13473,6 +13473,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 { /** From c5b2e44a2fac562913c3cd7f45d641525be4a58d Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:45:25 +0100 Subject: [PATCH 260/277] (feature) Add _.isArrayLike and _.isArrayLikeObject --- lodash/lodash-tests.ts | 72 +++++++++++++++++++++++++++++++++ lodash/lodash.d.ts | 91 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 161 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ab51b9e44..29fdbcbd3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5738,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 2f98201dc..2c2a50b82 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -120,8 +120,8 @@ added 8 string methods: - [ ] _.split - [x] _.upperCase - [x] _.upperFirst -- [ ] _.toLower -- [ ] _.toUpper +- [x] _.toLower +- [x] _.toUpper added 8 utility methods: - [ ] _.cond @@ -9373,6 +9373,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 { /** From 30e24ce7974cb44e47f4cefe3ea211a1968d8a98 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:50:14 +0100 Subject: [PATCH 261/277] (feature) Add _.isInteger --- lodash/lodash-tests.ts | 23 +++++++++++++++++-- lodash/lodash.d.ts | 50 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 29fdbcbd3..0ccd4dae8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5916,8 +5916,6 @@ module TestIsEqual { { let result: _.LoDashExplicitWrapper; - - result = _(any).chain().isEqual(any); } } @@ -6036,6 +6034,27 @@ 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(); + } +} + // _.isMatch var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; result = _.isMatch({}, {}); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 2c2a50b82..a8ea000a6 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -82,9 +82,9 @@ added 18 lang methods: - [x] _.cloneDeepWith - [x] _.cloneWith - [ ] _.eq -- [ ] _.isArrayLike -- [ ] _.isArrayLikeObject -- [ ] _.isEqualWith +- [x] _.isArrayLike +- [x] _.isArrayLikeObject +- [x] _.isEqualWith - [ ] _.isInteger - [ ] _.isLength - [ ] _.isMatchWith @@ -9554,7 +9554,6 @@ declare module _ { } //_.isEqual - // TODO tests interface LoDashStatic { /** * Performs a deep comparison between two values to determine if they are @@ -9749,6 +9748,49 @@ 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; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; From 2fff06cb701e5528e7c59989779b81e48eb6b364 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:52:15 +0100 Subject: [PATCH 262/277] (feature) Add _.isLength --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0ccd4dae8..ed3239134 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6055,6 +6055,27 @@ module TestIsInteger { } } +// _.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({}, {}); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a8ea000a6..a5c8ff5db 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9791,6 +9791,49 @@ declare module _ { 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; From f10d6aafaa4c978b307d53b55ce00bcdb7ec44ac Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:56:45 +0100 Subject: [PATCH 263/277] (feature) Add _.isMatchWith --- lodash/lodash-tests.ts | 27 ++++++++++---- lodash/lodash.d.ts | 80 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 89 insertions(+), 18 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ed3239134..4a0884984 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6077,13 +6077,26 @@ module TestIsLength { } // _.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 { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a5c8ff5db..76d716126 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9841,24 +9841,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 From d28a7929bdfee3c0a2db594492747676c3453f78 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:58:39 +0100 Subject: [PATCH 264/277] (feature) Add _.isNil --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4a0884984..d97800833 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6151,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 76d716126..4c6a30c23 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9971,6 +9971,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 { /** From 9ab4d2254ed373bf174c13c1a4abd5690f31027a Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:59:49 +0100 Subject: [PATCH 265/277] (feature) Add _.isObjectLike --- lodash/lodash-tests.ts | 20 ++++++++++++++++++++ lodash/lodash.d.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d97800833..7b2a10356 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6245,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 4c6a30c23..aa21e03cd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10087,6 +10087,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 { /** From 58f769dda4976ec1b7f1d6ebfb4babb18b1c74a4 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:01:36 +0100 Subject: [PATCH 266/277] (feature) Add _.isSafeInteger --- lodash/lodash-tests.ts | 21 ++++++++++++++++++++ lodash/lodash.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7b2a10356..8a14db2d3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6316,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index aa21e03cd..24bb866a0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10182,6 +10182,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 { /** From 34a25f6aef4f9b6e921412d89906c4e9fd15f8c1 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:04:36 +0100 Subject: [PATCH 267/277] (feature) Add _.isSymbol --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 8a14db2d3..3a748e852 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6368,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 24bb866a0..56b21f99c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10251,6 +10251,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 { /** From 08671c96f7b075d1ef379257778d9d0494a08545 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:14:47 +0100 Subject: [PATCH 268/277] (feature) Add _.toInteger --- lodash/lodash-tests.ts | 55 ++++++++++++++++++++++++++++++++---------- lodash/lodash.d.ts | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 13 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3a748e852..ed64e9179 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6523,21 +6523,50 @@ 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(); + } } /******** diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 56b21f99c..063ae8522 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10476,6 +10476,49 @@ 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; + } + /******** * Math * ********/ From a8fe84edcfe0451b26805fc0bc992a9b1a47c386 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:33:35 +0100 Subject: [PATCH 269/277] (feature) Add _.toInteger, _.toLength, _.toNumber, _.toSafeInteger --- lodash/lodash-tests.ts | 69 ++++++++++++++++++++++ lodash/lodash.d.ts | 127 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ed64e9179..bc33ed1ea 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6569,6 +6569,75 @@ module TestToInteger { } } +// _.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(); + } +} + /******** * Math * ********/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 063ae8522..ec40ddac3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10519,6 +10519,133 @@ declare module _ { 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; + } + /******** * Math * ********/ From 8807088ee7f3adfce36eb9da9d9d8ec61423c85b Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:49:45 +0100 Subject: [PATCH 270/277] (feature) Add _.assign and _.assignWith --- lodash/lodash-tests.ts | 142 +++++++++++++++---- lodash/lodash.d.ts | 304 ++++++++++++++++++++++++++++++++--------- 2 files changed, 351 insertions(+), 95 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bc33ed1ea..deb05249e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7051,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); } { @@ -7097,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); } { @@ -7143,40 +7123,142 @@ 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); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ec40ddac3..7c6a46754 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -81,21 +81,21 @@ added 23 array methods: added 18 lang methods: - [x] _.cloneDeepWith - [x] _.cloneWith -- [ ] _.eq +- [x] _.eq - [x] _.isArrayLike - [x] _.isArrayLikeObject - [x] _.isEqualWith -- [ ] _.isInteger -- [ ] _.isLength -- [ ] _.isMatchWith -- [ ] _.isNil -- [ ] _.isObjectLike -- [ ] _.isSafeInteger -- [ ] _.isSymbol -- [ ] _.toInteger -- [ ] _.toLength -- [ ] _.toNumber -- [ ] _.toSafeInteger +- [x] _.isInteger +- [x] _.isLength +- [x] _.isMatchWith +- [x] _.isNil +- [x] _.isObjectLike +- [x] _.isSafeInteger +- [x] _.isSymbol +- [x] _.toInteger +- [x] _.toLength +- [x] _.toNumber +- [x] _.toSafeInteger - [ ] _.toString added 13 object methods: @@ -106,8 +106,8 @@ added 13 object methods: - [ ] _.hasIn - [ ] _.invoke - [ ] _.mergeWith -- [ ] _.omitBy -- [ ] _.pickBy +- [x] _.omitBy +- [x] _.pickBy - [ ] _.setWith - [ ] _.toPairs - [ ] _.toPairsIn @@ -11472,32 +11472,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; /** @@ -11506,9 +11514,7 @@ declare module _ { assign( object: TObject, source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): TResult; /** @@ -11518,9 +11524,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): TResult; /** @@ -11533,9 +11537,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): TResult; /** @@ -11556,9 +11558,7 @@ declare module _ { * @see _.assign */ assign( - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): LoDashImplicitObjectWrapper; /** @@ -11566,9 +11566,7 @@ declare module _ { */ assign( source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): LoDashImplicitObjectWrapper; /** @@ -11577,9 +11575,7 @@ declare module _ { assign( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): LoDashImplicitObjectWrapper; /** @@ -11589,9 +11585,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): LoDashImplicitObjectWrapper; /** @@ -11610,9 +11604,7 @@ declare module _ { * @see _.assign */ assign( - source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + source: TSource ): LoDashExplicitObjectWrapper; /** @@ -11620,9 +11612,7 @@ declare module _ { */ assign( source1: TSource1, - source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + source2: TSource2 ): LoDashExplicitObjectWrapper; /** @@ -11631,9 +11621,7 @@ declare module _ { assign( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + source3: TSource3 ): LoDashExplicitObjectWrapper; /** @@ -11643,9 +11631,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + source4: TSource4 ): LoDashExplicitObjectWrapper; /** @@ -11659,6 +11645,194 @@ 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; + } + + + //_.create interface LoDashStatic { /** From 75401b033629cf7894efd7322d59fd5cb9c401de Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:51:51 +0100 Subject: [PATCH 271/277] (feature) Add _.assignIn and _.assignInWith --- lodash/lodash-tests.ts | 239 +++++++++++++++++++++++++++ lodash/lodash.d.ts | 358 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 597 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index deb05249e..01aedc432 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7262,6 +7262,245 @@ module TestAssignWith { } } +// _.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); + } +} + // _.create module TestCreate { type SampleProto = {a: number}; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7c6a46754..3f596a202 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11831,7 +11831,365 @@ declare module _ { 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 { From b89bde3df995f59b9d67c09187f4074f1cd99cc2 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:53:24 +0100 Subject: [PATCH 272/277] (feature) Add _.functionsIn --- lodash/lodash-tests.ts | 25 ++++++++++++++++ lodash/lodash.d.ts | 67 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 86 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 01aedc432..7db984bcc 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8152,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'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 3f596a202..e27022b9c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -99,9 +99,9 @@ added 18 lang methods: - [ ] _.toString added 13 object methods: -- [ ] _.assignIn -- [ ] _.assignInWith -- [ ] _.assignWith +- [x] _.assignIn +- [x] _.assignInWith +- [x] _.assignWith - [ ] _.functionsIn - [ ] _.hasIn - [ ] _.invoke @@ -13009,10 +13009,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`. * - * @param object The object to inspect. - * @return Returns the new array of property names. + * @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'); + * + * _.functions(new Foo); + * // => ['a', 'b'] */ functions(object: any): string[]; } @@ -13031,6 +13046,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 { /** From 242f39f73508ec72ade4e7144b142c2d66dbabe8 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 02:55:49 +0100 Subject: [PATCH 273/277] (feature) Add _.hasIn --- lodash/lodash-tests.ts | 30 ++++++++++++++++ lodash/lodash.d.ts | 78 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 102 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7db984bcc..2e95b756d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8222,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e27022b9c..14b0f7246 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -102,8 +102,8 @@ added 13 object methods: - [x] _.assignIn - [x] _.assignInWith - [x] _.assignWith -- [ ] _.functionsIn -- [ ] _.hasIn +- [x] _.functionsIn +- [x] _.hasIn - [ ] _.invoke - [ ] _.mergeWith - [x] _.omitBy @@ -13114,11 +13114,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, @@ -13140,6 +13159,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 { /** From 0d6bd794759a7517a5ea63d77c8d5123d13fbe59 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 11:52:01 +0100 Subject: [PATCH 274/277] (feature) Add _.mergeWith --- lodash/lodash-tests.ts | 84 +++++++-------- lodash/lodash.d.ts | 228 +++++++++++++++++++++++++++++++---------- 2 files changed, 213 insertions(+), 99 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2e95b756d..b43e4eb3c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8421,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 }; @@ -8468,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 @@ -8504,41 +8481,58 @@ module TestMerge { { let result: _.LoDashExplicitObjectWrapper; - - result = _(initialValue).chain().merge(mergingValue); - result = _(initialValue).chain().merge(mergingValue, customizer); - result = _(initialValue).chain().merge(mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, mergingValue); - result = _(initialValue).chain().merge({}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, {}, mergingValue); - result = _(initialValue).chain().merge({}, {}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, {}, mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, {}, {}, mergingValue); - result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, {}, {}, mergingValue, customizer, any); - - result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue); - result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer); - result = _(initialValue).chain().merge({}, {}, {}, {}, mergingValue, customizer, any); + // 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 }); + //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 }); + //result = _({ a: 1 }).chain().merge({ a: "string" }, { a: {} }, { a: [1] }, { a: true }); } } +// _.mergeWith +module TestMergeWith { + 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 = _.mergeWith(initialValue, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, {}, mergingValue, customizer); + result = _.mergeWith(initialValue, {}, {}, {}, mergingValue, customizer); + + // Once we get to the varargs version, you have to specify the result explicitl + result = _.mergeWith(initialValue, {}, {}, {}, {}, mergingValue, customizer); + + // 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(); + + // Once we get to the varargs version, you have to specify the result explicitl + result = _(initialValue).mergeWith({}, {}, {}, {}, mergingValue, customizer).value(); +} + // _.omit module TestOmit { let predicate: (element: any, key: string, collection: any) => boolean; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 14b0f7246..6126d16e7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -105,7 +105,7 @@ added 13 object methods: - [x] _.functionsIn - [x] _.hasIn - [ ] _.invoke -- [ ] _.mergeWith +- [x] _.mergeWith - [x] _.omitBy - [x] _.pickBy - [ ] _.setWith @@ -13500,29 +13500,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; /** @@ -13531,9 +13541,7 @@ declare module _ { merge( object: TObject, source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): TObject & TSource1 & TSource2; /** @@ -13543,9 +13551,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): TObject & TSource1 & TSource2 & TSource3; /** @@ -13556,9 +13562,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any + source4: TSource4 ): TObject & TSource1 & TSource2 & TSource3 & TSource4; /** @@ -13575,9 +13579,7 @@ declare module _ { * @see _.merge */ merge( - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): LoDashImplicitObjectWrapper; /** @@ -13585,9 +13587,7 @@ declare module _ { */ merge( source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): LoDashImplicitObjectWrapper; /** @@ -13596,9 +13596,7 @@ declare module _ { merge( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): LoDashImplicitObjectWrapper; /** @@ -13608,9 +13606,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any + source4: TSource4 ): LoDashImplicitObjectWrapper; /** @@ -13626,9 +13622,7 @@ declare module _ { * @see _.merge */ merge( - source: TSource, - customizer?: MergeCustomizer, - thisArg?: any + source: TSource ): LoDashExplicitObjectWrapper; /** @@ -13636,9 +13630,7 @@ declare module _ { */ merge( source1: TSource1, - source2: TSource2, - customizer?: MergeCustomizer, - thisArg?: any + source2: TSource2 ): LoDashExplicitObjectWrapper; /** @@ -13647,21 +13639,13 @@ declare module _ { merge( source1: TSource1, source2: TSource2, - source3: TSource3, - customizer?: MergeCustomizer, - thisArg?: any + source3: TSource3 ): LoDashExplicitObjectWrapper; /** * @see _.merge */ merge( - source1: TSource1, - source2: TSource2, - source3: TSource3, - source4: TSource4, - customizer?: MergeCustomizer, - thisArg?: any ): LoDashExplicitObjectWrapper; /** @@ -13672,6 +13656,142 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.mergeWith + interface MergeWithCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + + interface LoDashStatic { + /** + * 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'] } + */ + 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 _.mergeWith + */ + mergeWith( + source: TSource, + customizer: MergeWithCustomizer + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mergeWith + */ + 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 { /** From fcb3ef91382454096cbc3bedcc6edfffd41e1ff7 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 15:51:22 +0100 Subject: [PATCH 275/277] (feature) Add _.toPath --- lodash/lodash-tests.ts | 23 ++++++++++++++++++++++ lodash/lodash.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b43e4eb3c..0a356d90e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9969,6 +9969,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 { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6126d16e7..097290c78 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -15827,6 +15827,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 { /** From 4f38ac3bc6649ce32dbd17d2c46bff46ffa2dbb4 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 15:54:38 +0100 Subject: [PATCH 276/277] (feature) Add _.rangeRight --- lodash/lodash-tests.ts | 27 ++++++++++++++++ lodash/lodash.d.ts | 73 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0a356d90e..af33b66ac 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9917,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 _; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 097290c78..d9e957f9a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -131,7 +131,7 @@ added 8 utility methods: - [ ] _.overEvery - [ ] _.overSome - [ ] _.rangeRight -- [ ] _.toPath +- [x] _.toPath added 4 math methods: - [x] _.maxBy @@ -15756,6 +15756,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 { /** From 2a6a4132bf524eb4d101a5897f31135429af0976 Mon Sep 17 00:00:00 2001 From: DomiR Date: Wed, 20 Jan 2016 15:20:13 +0100 Subject: [PATCH 277/277] (feature) Added some dummies for array functions --- lodash/lodash.d.ts | 610 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 552 insertions(+), 58 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d9e957f9a..f9249d16b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8,10 +8,6 @@ ### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) #### TODO: -misc: -- [ ] Made _.forEach, _.forIn, _.forOwn, & _.times implicitly end a chain sequence -- [ ] Removed thisArg params from most methods - removed: - [x] Removed _.support - [x] Removed _.findWhere in favor of _.find with iteratee shorthand @@ -41,42 +37,37 @@ split: - [x] Split _.uniq into _.sortedUniq, _.sortedUniqBy, & _.uniqBy changes: -- [ ] TODO remove _.sortBy duplicates - [x] Absorbed _.sortByAll into _.sortBy - [x] Changed the category of _.at to “Object” - [x] Changed the category of _.bindAll to “Utility” -- [ ] Made “By” methods provide a single param to iteratees - [x] Made _.capitalize uppercase the first character & lowercase the rest - [x] Made _.functions return only own method names -- [ ] 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 + added 23 array methods: -- [ ] _.concat -- [ ] _.differenceBy -- [ ] _.differenceWith -- [ ] _.flatMap -- [ ] _.fromPairs -- [ ] _.intersectionBy -- [ ] _.intersectionWith -- [ ] _.join -- [ ] _.pullAll -- [ ] _.pullAllBy -- [ ] _.reverse +- [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 -- [ ] _.sortedLastIndexOf +- [x] _.sortedLastIndexOf - [x] _.sortedUniq - [x] _.sortedUniqBy -- [ ] _.unionBy -- [ ] _.unionWith +- [x] _.unionBy +- [x] _.unionWith - [x] _.uniqBy -- [ ] _.uniqWith -- [ ] _.xorBy -- [ ] _.xorWith +- [x] _.uniqWith +- [x] _.xorBy +- [x] _.xorWith added 18 lang methods: - [x] _.cloneDeepWith @@ -96,7 +87,7 @@ added 18 lang methods: - [x] _.toLength - [x] _.toNumber - [x] _.toSafeInteger -- [ ] _.toString +- [x] _.toString added 13 object methods: - [x] _.assignIn @@ -104,33 +95,20 @@ added 13 object methods: - [x] _.assignWith - [x] _.functionsIn - [x] _.hasIn -- [ ] _.invoke - [x] _.mergeWith - [x] _.omitBy - [x] _.pickBy -- [ ] _.setWith -- [ ] _.toPairs -- [ ] _.toPairsIn -- [ ] _.unset + added 8 string methods: - [x] _.lowerCase - [x] _.lowerFirst -- [ ] _.replace -- [ ] _.split - [x] _.upperCase - [x] _.upperFirst - [x] _.toLower - [x] _.toUpper added 8 utility methods: -- [ ] _.cond -- [ ] _.conforms -- [ ] _.nthArg -- [ ] _.over -- [ ] _.overEvery -- [ ] _.overSome -- [ ] _.rangeRight - [x] _.toPath added 4 math methods: @@ -147,15 +125,11 @@ added 2 number methods: - [x] _.clamp - [x] _.subtract -added chain method: -- [ ] _.next - added collection method: - [x] _.sampleSize Added 3 aliases -- [ ] _.extend as an alias of _.assignIn -- [ ] _.extendWith as an alias of _.assignInWith + - [x] _.first as an alias of _.head Removed 17 aliases @@ -178,28 +152,19 @@ Removed 17 aliases - [x] Removed aliase _.unique Other changes -- [ ] Added clear method to _.memoize.Cache -- [ ] Added flush method to debounced & throttled functions -- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray - [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 -- [ ] Enabled _.flow & _.flowRight to accept an array of functions -- [ ] Ensured “Collection” methods treat functions as objects - [x] Ensured debounce cancel clears args & thisArg references - [x] Ensured _.add, _.subtract, & _.sum don’t skip NaN values -- [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects -- [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator - [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 -- [ ] Ensured _.isFunction returns true for generator functions - [x] Ensured _.keys skips “length” on strict mode arguments objects in Safari 9 -- [ ] Ensured _.merge assigns typed arrays directly - [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 @@ -207,8 +172,68 @@ Other changes - [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; @@ -454,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 { /** @@ -465,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[]; } @@ -498,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 { /** @@ -1256,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 { /** @@ -1374,6 +1501,27 @@ 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 { /** @@ -1473,6 +1621,168 @@ 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 { /** @@ -2795,6 +3105,29 @@ declare module _ { ): 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 { /** @@ -3822,6 +4155,87 @@ declare module _ { ): 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 interface LoDashStatic { /** @@ -3983,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 { /** @@ -10646,6 +11115,31 @@ declare module _ { 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 * ********/