diff --git a/.gitignore b/.gitignore index 2a52c95e0..35dd5a667 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,37 @@ -*.dll -*.exe -*.cmd -*.pdb -*.suo -*.js -*.user -*.cache -*.cs -*.sln -*.csproj -*.txt -*.map -*.swp -.DS_Store -npm-debug.log - -_Resharper.DefinitelyTyped -bin -obj -Properties - -# VIM backup files -*~ - -# test folder -_infrastructure/tests/build - -.idea -*.iml -*.js.map -!*.js/ - -node_modules - -.sublimets -.settings/launch.json +*.dll +*.exe +*.cmd +*.pdb +*.suo +*.js +*.user +*.cache +*.cs +*.sln +*.csproj +*.txt +*.map +*.swp +.DS_Store +npm-debug.log + +_Resharper.DefinitelyTyped +bin +obj +Properties + +# VIM backup files +*~ + +# test folder +_infrastructure/tests/build + +.idea +*.iml +*.js.map +!*.js/ + +node_modules + +.sublimets +.settings/launch.json diff --git a/Finch/Finch-tests.ts b/Finch/Finch-tests.ts index 28aeb6b66..ec15bcb88 100644 --- a/Finch/Finch-tests.ts +++ b/Finch/Finch-tests.ts @@ -1,368 +1,368 @@ -/// - -function test_Finch() { - - - Finch.route("Hello/Route", function() { - return console.log("Well hello there! How you doin'?!"); - }); - - Finch.route("Hello/Route/:someId", function(bindings) { - return console.log("Hey! Here's Some Id: " + bindings.someId); - }); - - Finch.route("Hello/Route/:someId", function(bindings, childCallback) { - console.log("Hey! Here's Some Id: " + bindings.someId); - return childCallback(); - }); - - Finch.route("some/route", { - setup: function(bindings) { - return console.log("Some Route has been setup! :)"); - }, - load: function(bindings) { - return console.log("Some Route has been loaed! :D"); - }, - unload: function(bindings) { - return console.log("Some Route has been loaed! :("); - }, - teardown: function(bindings) { - return console.log("Some Route has been torndown! :'("); - } - }); - - Finch.route("some/route", { - setup: function(bindings, childCallback) { - console.log("Some Route has been setup! :)"); - return childCallback(); - }, - load: function(bindings, childCallback) { - console.log("Some Route has been loaed! :D"); - return childCallback(); - }, - unload: function(bindings, childCallback) { - console.log("Some Route has been loaed! :("); - return childCallback(); - }, - teardown: function(bindings, childCallback) { - console.log("Some Route has been torndown! :'("); - return childCallback(); - } - }); - - Finch.call("Some/Route"); - - Finch.route("Some/Route", function() { - return Finch.observe("hello", "foo", function(hello: any, foo: string) { - return console.log("" + hello + " and " + foo); - }); - }); - - Finch.route("Some/Route", function() { - return Finch.observe(["hello", "foo"], function(hello: any, foo: any) { - return console.log("" + hello + " and " + foo); - }); - }); - - Finch.route("Some/Route", function(bindings) { - return Finch.observe(function(params) { - }); - }); - - Finch.navigate("Some/Route"); - - Finch.navigate("Some/Route", { - hello: 'world', - foo: 'bar' - }); - - Finch.navigate("Some/Route", { - foo: 'bar' - }, true); - - Finch.navigate("Some/Route", true); - - Finch.navigate({ - hello: 'world2', - wow: 'wee' - }); - - Finch.navigate({ - foo: 'bar', - wow: 'wee!!!' - }); - - Finch.navigate({ - hello: 'world2' - }, true); - - Finch.listen(); - Finch.ignore(); - Finch.abort(); - - - //test from Finch - Finch.call("/foo/bar"); - Finch.call("/foo/bar/123"); - Finch.call("/foo/bar/123"); - Finch.call("/foo/bar/123?x=Hello&y=World"); - Finch.call("/foo/baz/456"); - Finch.call("/quux/789?band=Sunn O)))&genre=Post-Progressive Fridgecore"); - Finch.call("/foo/bar/baz"); - Finch.call("/foo/bar/quux"); - Finch.call("/foo"); - Finch.call("/foo/bar"); - Finch.call("/foo"); - Finch.call("/foo"); - Finch.call("/"); - Finch.call("/"); - Finch.call("/foo"); - Finch.call("/foo/bar"); - Finch.call("/foo/bar?baz=quux"); - Finch.call("/foo/bar?baz=xyzzy"); - - var cb: any; - Finch.route("foo", { - setup: cb.setup_foo = this.stub(), - load: cb.load_foo = this.stub(), - unload: cb.unload_foo = this.stub(), - teardown: cb.teardown_foo = this.stub() - }); - Finch.route("[foo]/bar", { - setup: cb.setup_foo_bar = this.stub(), - load: cb.load_foo_bar = this.stub(), - unload: cb.unload_foo_bar = this.stub(), - teardown: cb.teardown_foo_bar = this.stub() - }); - Finch.route("[foo/bar]/:id", { - setup: cb.setup_foo_bar_id = this.stub(), - load: cb.load_foo_bar_id = this.stub(), - unload: cb.unload_foo_bar_id = this.stub(), - teardown: cb.teardown_foo_bar_id = this.stub() - }); - Finch.route("[foo]/baz", { - setup: cb.setup_foo_baz = this.stub(), - load: cb.load_foo_baz = this.stub(), - unload: cb.unload_foo_baz = this.stub(), - teardown: cb.teardown_foo_baz = this.stub() - }); - Finch.route("[foo/baz]/:id", { - setup: cb.setup_foo_baz_id = this.stub(), - load: cb.load_foo_baz_id = this.stub(), - unload: cb.unload_foo_baz_id = this.stub(), - teardown: cb.teardown_foo_baz_id = this.stub() - }); - Finch.call("/foo"); - Finch.call("/foo/bar"); - Finch.call("/foo"); - Finch.call("/foo/bar/123?x=abc"); - Finch.call("/foo/bar/456?x=aaa&y=zzz"); - Finch.call("/foo/bar/456?x=bbb&y=zzz"); - Finch.call("/foo/bar/456?y=zzz&x=bbb"); - Finch.call("/foo/baz/789"); - Finch.call("/foo/baz/abc?term=Hello"); - Finch.call("/foo/baz/abc?term=World"); - Finch.route("bar", this.stub()); - Finch.call("/foo"); - Finch.call("/bar"); - Finch.route("/", function() { - }); - Finch.route("[/]home", function() { - }); - Finch.route("[/home]/news", { - setup: function() { - }, - load: function() { - }, - unload: function() { - return true; - }, - teardown: function() { - return false; - } - }); - Finch.route("/foo", { - setup: function() { - return true; - }, - load: function() { - return true; - }, - unload: function() { - }, - teardown: function() { - } - }); - Finch.route("[/]bar", { - setup: function() { - }, - load: function() { - }, - unload: function() { - }, - teardown: function() { - } - }); - Finch.call("/bar"); - Finch.call("/home/news"); - Finch.call("/foo"); - Finch.call("/home/news"); - Finch.call("/bar"); - Finch.route("baz", this.stub()); - Finch.call("/foo"); - Finch.call("/foo/bar"); - Finch.call("/baz"); - Finch.route("/home", { - setup: function(bindings, next) { - return next(); - }, - load: function(bindings, next) { - return next(); - }, - unload: function(bindings, next) { - return next(); - }, - teardown: function(bindings, next) { - return next(); - } - }); - Finch.route("[/home]/news", { - setup: function(bindings, next) { - return next(); - }, - load: function(bindings, next) { - return next(); - }, - unload: function(bindings, next) { - return next(); - }, - teardown: function(bindings, next) { - return next(); - } - }); - Finch.call("/home"); - Finch.call("/home/news"); - Finch.call("/foo"); - - Finch.route("/", function(bindings) { - return Finch.observe(["x"], function(x) { - }); - }); - Finch.call("/?x=123"); - Finch.call("/?x=123.456"); - Finch.call("/?x=true"); - Finch.call("/?x=false"); - Finch.call("/?x=stuff"); - Finch.options({ - CoerceParameterTypes: true - }); - Finch.call("/?x=123"); - Finch.call("/?x=123.456"); - Finch.call("/?x=true"); - Finch.call("/?x=false"); - Finch.call("/?x=stuff"); - Finch.route("/:x", function(_arg) { - }); - Finch.call("/123"); - Finch.call("/123.456"); - Finch.call("/true"); - Finch.call("/false"); - Finch.call("/stuff"); - Finch.options({ - CoerceParameterTypes: true - }); - Finch.call("/123"); - Finch.call("/123.456"); - Finch.call("/true"); - Finch.call("/false"); - Finch.call("/stuff"); - - Finch.navigate("/home"); - Finch.navigate("/home/news"); - Finch.navigate("/home"); - Finch.navigate("/home", { - foo: "bar" - }); - Finch.navigate("/home", { - hello: "world" - }); - Finch.navigate({ - foos: "bars" - }); - Finch.navigate({ - foos: "baz" - }); - Finch.navigate({ - hello: "world" - }, true); - Finch.navigate({ - foos: null - }, true); - Finch.navigate("/home/news", true); - Finch.navigate("/hello world", {}); - Finch.navigate("/hello world", { - foo: "bar bar" - }); - Finch.navigate({ - foo: "baz baz" - }); - Finch.navigate({ - hello: 'world world' - }, true); - Finch.navigate("/home?foo=bar", { - hello: "world" - }); - Finch.navigate("/home?foo=bar", { - hello: "world", - foo: "baz" - }); - Finch.navigate("/home?foo=bar", { - hello: "world", - free: "bird" - }); - Finch.navigate("#/home", true); - Finch.navigate("#/home"); - Finch.navigate("#/home/news", { - free: "birds", - hello: "worlds" - }); - Finch.navigate("#/home/news", { - foo: "bar" - }, true); - Finch.navigate("/home/news"); - Finch.navigate("../"); - Finch.navigate("./"); - Finch.navigate("./news"); - Finch.navigate("/home/news/article"); - Finch.navigate("../../account"); - - Finch.listen(); - Finch.ignore(); - Finch.route("/home", function(bindings, continuation) { - }); - Finch.route("/foo", function(bindings, continuation) { - }); - Finch.call("home"); - Finch.call("foo"); - Finch.abort(); - Finch.call("foo"); - Finch.route("/", { - 'setup': cb.slash_setup = this.stub(), - 'load': cb.slash_load = this.stub(), - 'unload': cb.slash_unload = this.stub(), - 'teardown': cb.slash_teardown = this.stub() - }); - Finch.route("[/]users/profile", { - 'setup': cb.profile_setup = this.stub(), - 'load': cb.profile_load = this.stub(), - 'unload': cb.profile_unload = this.stub(), - 'teardown': cb.profile_teardown = this.stub() - }); - Finch.route("[/]:page", { - 'setup': cb.page_setup = this.stub(), - 'load': cb.page_load = this.stub(), - 'unload': cb.page_unload = this.stub(), - 'teardown': cb.page_teardown = this.stub() - }); - Finch.call("/users"); -} +/// + +function test_Finch() { + + + Finch.route("Hello/Route", function() { + return console.log("Well hello there! How you doin'?!"); + }); + + Finch.route("Hello/Route/:someId", function(bindings) { + return console.log("Hey! Here's Some Id: " + bindings.someId); + }); + + Finch.route("Hello/Route/:someId", function(bindings, childCallback) { + console.log("Hey! Here's Some Id: " + bindings.someId); + return childCallback(); + }); + + Finch.route("some/route", { + setup: function(bindings) { + return console.log("Some Route has been setup! :)"); + }, + load: function(bindings) { + return console.log("Some Route has been loaed! :D"); + }, + unload: function(bindings) { + return console.log("Some Route has been loaed! :("); + }, + teardown: function(bindings) { + return console.log("Some Route has been torndown! :'("); + } + }); + + Finch.route("some/route", { + setup: function(bindings, childCallback) { + console.log("Some Route has been setup! :)"); + return childCallback(); + }, + load: function(bindings, childCallback) { + console.log("Some Route has been loaed! :D"); + return childCallback(); + }, + unload: function(bindings, childCallback) { + console.log("Some Route has been loaed! :("); + return childCallback(); + }, + teardown: function(bindings, childCallback) { + console.log("Some Route has been torndown! :'("); + return childCallback(); + } + }); + + Finch.call("Some/Route"); + + Finch.route("Some/Route", function() { + return Finch.observe("hello", "foo", function(hello: any, foo: string) { + return console.log("" + hello + " and " + foo); + }); + }); + + Finch.route("Some/Route", function() { + return Finch.observe(["hello", "foo"], function(hello: any, foo: any) { + return console.log("" + hello + " and " + foo); + }); + }); + + Finch.route("Some/Route", function(bindings) { + return Finch.observe(function(params) { + }); + }); + + Finch.navigate("Some/Route"); + + Finch.navigate("Some/Route", { + hello: 'world', + foo: 'bar' + }); + + Finch.navigate("Some/Route", { + foo: 'bar' + }, true); + + Finch.navigate("Some/Route", true); + + Finch.navigate({ + hello: 'world2', + wow: 'wee' + }); + + Finch.navigate({ + foo: 'bar', + wow: 'wee!!!' + }); + + Finch.navigate({ + hello: 'world2' + }, true); + + Finch.listen(); + Finch.ignore(); + Finch.abort(); + + + //test from Finch + Finch.call("/foo/bar"); + Finch.call("/foo/bar/123"); + Finch.call("/foo/bar/123"); + Finch.call("/foo/bar/123?x=Hello&y=World"); + Finch.call("/foo/baz/456"); + Finch.call("/quux/789?band=Sunn O)))&genre=Post-Progressive Fridgecore"); + Finch.call("/foo/bar/baz"); + Finch.call("/foo/bar/quux"); + Finch.call("/foo"); + Finch.call("/foo/bar"); + Finch.call("/foo"); + Finch.call("/foo"); + Finch.call("/"); + Finch.call("/"); + Finch.call("/foo"); + Finch.call("/foo/bar"); + Finch.call("/foo/bar?baz=quux"); + Finch.call("/foo/bar?baz=xyzzy"); + + var cb: any; + Finch.route("foo", { + setup: cb.setup_foo = this.stub(), + load: cb.load_foo = this.stub(), + unload: cb.unload_foo = this.stub(), + teardown: cb.teardown_foo = this.stub() + }); + Finch.route("[foo]/bar", { + setup: cb.setup_foo_bar = this.stub(), + load: cb.load_foo_bar = this.stub(), + unload: cb.unload_foo_bar = this.stub(), + teardown: cb.teardown_foo_bar = this.stub() + }); + Finch.route("[foo/bar]/:id", { + setup: cb.setup_foo_bar_id = this.stub(), + load: cb.load_foo_bar_id = this.stub(), + unload: cb.unload_foo_bar_id = this.stub(), + teardown: cb.teardown_foo_bar_id = this.stub() + }); + Finch.route("[foo]/baz", { + setup: cb.setup_foo_baz = this.stub(), + load: cb.load_foo_baz = this.stub(), + unload: cb.unload_foo_baz = this.stub(), + teardown: cb.teardown_foo_baz = this.stub() + }); + Finch.route("[foo/baz]/:id", { + setup: cb.setup_foo_baz_id = this.stub(), + load: cb.load_foo_baz_id = this.stub(), + unload: cb.unload_foo_baz_id = this.stub(), + teardown: cb.teardown_foo_baz_id = this.stub() + }); + Finch.call("/foo"); + Finch.call("/foo/bar"); + Finch.call("/foo"); + Finch.call("/foo/bar/123?x=abc"); + Finch.call("/foo/bar/456?x=aaa&y=zzz"); + Finch.call("/foo/bar/456?x=bbb&y=zzz"); + Finch.call("/foo/bar/456?y=zzz&x=bbb"); + Finch.call("/foo/baz/789"); + Finch.call("/foo/baz/abc?term=Hello"); + Finch.call("/foo/baz/abc?term=World"); + Finch.route("bar", this.stub()); + Finch.call("/foo"); + Finch.call("/bar"); + Finch.route("/", function() { + }); + Finch.route("[/]home", function() { + }); + Finch.route("[/home]/news", { + setup: function() { + }, + load: function() { + }, + unload: function() { + return true; + }, + teardown: function() { + return false; + } + }); + Finch.route("/foo", { + setup: function() { + return true; + }, + load: function() { + return true; + }, + unload: function() { + }, + teardown: function() { + } + }); + Finch.route("[/]bar", { + setup: function() { + }, + load: function() { + }, + unload: function() { + }, + teardown: function() { + } + }); + Finch.call("/bar"); + Finch.call("/home/news"); + Finch.call("/foo"); + Finch.call("/home/news"); + Finch.call("/bar"); + Finch.route("baz", this.stub()); + Finch.call("/foo"); + Finch.call("/foo/bar"); + Finch.call("/baz"); + Finch.route("/home", { + setup: function(bindings, next) { + return next(); + }, + load: function(bindings, next) { + return next(); + }, + unload: function(bindings, next) { + return next(); + }, + teardown: function(bindings, next) { + return next(); + } + }); + Finch.route("[/home]/news", { + setup: function(bindings, next) { + return next(); + }, + load: function(bindings, next) { + return next(); + }, + unload: function(bindings, next) { + return next(); + }, + teardown: function(bindings, next) { + return next(); + } + }); + Finch.call("/home"); + Finch.call("/home/news"); + Finch.call("/foo"); + + Finch.route("/", function(bindings) { + return Finch.observe(["x"], function(x) { + }); + }); + Finch.call("/?x=123"); + Finch.call("/?x=123.456"); + Finch.call("/?x=true"); + Finch.call("/?x=false"); + Finch.call("/?x=stuff"); + Finch.options({ + CoerceParameterTypes: true + }); + Finch.call("/?x=123"); + Finch.call("/?x=123.456"); + Finch.call("/?x=true"); + Finch.call("/?x=false"); + Finch.call("/?x=stuff"); + Finch.route("/:x", function(_arg) { + }); + Finch.call("/123"); + Finch.call("/123.456"); + Finch.call("/true"); + Finch.call("/false"); + Finch.call("/stuff"); + Finch.options({ + CoerceParameterTypes: true + }); + Finch.call("/123"); + Finch.call("/123.456"); + Finch.call("/true"); + Finch.call("/false"); + Finch.call("/stuff"); + + Finch.navigate("/home"); + Finch.navigate("/home/news"); + Finch.navigate("/home"); + Finch.navigate("/home", { + foo: "bar" + }); + Finch.navigate("/home", { + hello: "world" + }); + Finch.navigate({ + foos: "bars" + }); + Finch.navigate({ + foos: "baz" + }); + Finch.navigate({ + hello: "world" + }, true); + Finch.navigate({ + foos: null + }, true); + Finch.navigate("/home/news", true); + Finch.navigate("/hello world", {}); + Finch.navigate("/hello world", { + foo: "bar bar" + }); + Finch.navigate({ + foo: "baz baz" + }); + Finch.navigate({ + hello: 'world world' + }, true); + Finch.navigate("/home?foo=bar", { + hello: "world" + }); + Finch.navigate("/home?foo=bar", { + hello: "world", + foo: "baz" + }); + Finch.navigate("/home?foo=bar", { + hello: "world", + free: "bird" + }); + Finch.navigate("#/home", true); + Finch.navigate("#/home"); + Finch.navigate("#/home/news", { + free: "birds", + hello: "worlds" + }); + Finch.navigate("#/home/news", { + foo: "bar" + }, true); + Finch.navigate("/home/news"); + Finch.navigate("../"); + Finch.navigate("./"); + Finch.navigate("./news"); + Finch.navigate("/home/news/article"); + Finch.navigate("../../account"); + + Finch.listen(); + Finch.ignore(); + Finch.route("/home", function(bindings, continuation) { + }); + Finch.route("/foo", function(bindings, continuation) { + }); + Finch.call("home"); + Finch.call("foo"); + Finch.abort(); + Finch.call("foo"); + Finch.route("/", { + 'setup': cb.slash_setup = this.stub(), + 'load': cb.slash_load = this.stub(), + 'unload': cb.slash_unload = this.stub(), + 'teardown': cb.slash_teardown = this.stub() + }); + Finch.route("[/]users/profile", { + 'setup': cb.profile_setup = this.stub(), + 'load': cb.profile_load = this.stub(), + 'unload': cb.profile_unload = this.stub(), + 'teardown': cb.profile_teardown = this.stub() + }); + Finch.route("[/]:page", { + 'setup': cb.page_setup = this.stub(), + 'load': cb.page_load = this.stub(), + 'unload': cb.page_unload = this.stub(), + 'teardown': cb.page_teardown = this.stub() + }); + Finch.call("/users"); +} diff --git a/Finch/Finch.d.ts b/Finch/Finch.d.ts index e3dd86c70..ca896570f 100644 --- a/Finch/Finch.d.ts +++ b/Finch/Finch.d.ts @@ -1,47 +1,47 @@ -// Type definitions for Finch 0.5.13 -// Project: https://github.com/stoodder/finchjs -// Definitions by: David Sichau -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -interface FinchCallback { - (bindings?: any, childCallback? : () => void): any; -} - -interface ExpandedCallback { - setup?: FinchCallback; - load?: FinchCallback; - unload?: FinchCallback; - teardown?: FinchCallback; -} - -interface ObserveCallback { - (...args: any[]): string; -} -interface FinchOptions { - CoerceParameterTypes?: boolean; -} - - -interface FinchStatic { - route(route: string, callback: FinchCallback): void; - route(route: string, callbacks: ExpandedCallback): void; - call( uri: string ): void; - - observe(argN: string[], callback: (params: ObserveCallback ) => void): void; - observe(callback: (params: ObserveCallback) => void): void; - observe(...args: any[]): void; - navigate(uri:string, queryParams?:any, doUpdate?:boolean ): void; - navigate(uri:string, doUpdate:boolean ): void; - navigate(queryParams:any, doUpdate?:boolean ): void; - listen(): boolean; - ignore(): boolean; - abort(): void; - options(options: FinchOptions): void; -} - - -declare var Finch: FinchStatic; -declare module "finch" { - export = Finch; -} +// Type definitions for Finch 0.5.13 +// Project: https://github.com/stoodder/finchjs +// Definitions by: David Sichau +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface FinchCallback { + (bindings?: any, childCallback? : () => void): any; +} + +interface ExpandedCallback { + setup?: FinchCallback; + load?: FinchCallback; + unload?: FinchCallback; + teardown?: FinchCallback; +} + +interface ObserveCallback { + (...args: any[]): string; +} +interface FinchOptions { + CoerceParameterTypes?: boolean; +} + + +interface FinchStatic { + route(route: string, callback: FinchCallback): void; + route(route: string, callbacks: ExpandedCallback): void; + call( uri: string ): void; + + observe(argN: string[], callback: (params: ObserveCallback ) => void): void; + observe(callback: (params: ObserveCallback) => void): void; + observe(...args: any[]): void; + navigate(uri:string, queryParams?:any, doUpdate?:boolean ): void; + navigate(uri:string, doUpdate:boolean ): void; + navigate(queryParams:any, doUpdate?:boolean ): void; + listen(): boolean; + ignore(): boolean; + abort(): void; + options(options: FinchOptions): void; +} + + +declare var Finch: FinchStatic; +declare module "finch" { + export = Finch; +} diff --git a/accounting/accounting-tests.ts b/accounting/accounting-tests.ts index a00f2fefc..bc9b74eaa 100644 --- a/accounting/accounting-tests.ts +++ b/accounting/accounting-tests.ts @@ -1,107 +1,107 @@ -/// - -// formatMoney - -// Default usage: -accounting.formatMoney(12345678); // $12,345,678.00 - -// European formatting (custom symbol and separators), could also use options object as second param: -accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99 - -// Negative values are formatted nicely, too: -accounting.formatMoney(-500000, "£ ", 0); // £ -500,000 - -// Simple `format` string allows control of symbol position [%v = value, %s = symbol]: -accounting.formatMoney(5318008, { symbol: "GBP", format: "%v %s" }); // 5,318,008.00 GBP - -// Example usage with options object: -accounting.formatMoney(5318008, { - symbol: "GBP", - precision: 0, - thousand: "·", - format: { - pos: "%s %v", - neg: "%s (%v)", - zero: "%s --" - } -}); - -// Will recursively format an array of values: -accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]] - - - -// formatColumn - -// Format list of numbers for display: -accounting.formatColumn([123.5, 3456.49, 777888.99, 12345678, -5432], "$ "); - -// Example usage (NB. use a space after the symbol to add arbitrary padding to all values): -accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"] - -// List of numbers can be a multi-dimensional array (formatColumn is applied recursively): -accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]] - - - -// formatNumber - -// Example usage: -accounting.formatNumber(5318008); // 5,318,008 -accounting.formatNumber(9876543.21, 3, " "); // 9 876 543.210 -accounting.formatNumber(4999.99, 2, ".", ","); // 4.999,99 - -// Example usage with options object: -accounting.formatNumber(5318008, { - precision: 3, - thousand: " " -}); - -// Will recursively format an array of values: -accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]] - - - -// toFixed - -(0.615).toFixed(2); // "0.61" -accounting.toFixed(0.615, 2); // "0.62" - - - - -// unformat - -// Example usage: -accounting.unformat("£ 12,345,678.90 GBP"); // 12345678.9 -accounting.unformat("GBP £ 12,345,678.90"); // 12345678.9 - -// If a non-standard decimal separator was used (eg. a comma) unformat() will need it in order to work out -// which part of the number is a decimal/float: -accounting.unformat("€ 1.000.000,00", ","); // 1000000 - -// Settings object that controls default parameters for library methods: -accounting.settings = { - currency: { - symbol: "$", // default currency symbol is '$' - format: "%s%v", // controls output: %s = symbol, %v = value/number (can be object: see below) - decimal: ".", // decimal point separator - thousand: ",", // thousands separator - precision: 2 // decimal places - }, - number: { - precision: 0, // default precision on numbers is 0 - thousand: ",", - decimal: "." - } -}; - -// These can be changed externally to edit the library's defaults: -accounting.settings.currency.format = "%s %v"; - -// Format can be an object, with `pos`, `neg` and `zero`: -accounting.settings.currency.format = { - pos: "%s %v", // for positive values, eg. "$ 1.00" (required) - neg: "%s (%v)", // for negative values, eg. "$ (1.00)" [optional] - zero: "%s -- " // for zero values, eg. "$ --" [optional] -}; \ No newline at end of file +/// + +// formatMoney + +// Default usage: +accounting.formatMoney(12345678); // $12,345,678.00 + +// European formatting (custom symbol and separators), could also use options object as second param: +accounting.formatMoney(4999.99, "€", 2, ".", ","); // €4.999,99 + +// Negative values are formatted nicely, too: +accounting.formatMoney(-500000, "£ ", 0); // £ -500,000 + +// Simple `format` string allows control of symbol position [%v = value, %s = symbol]: +accounting.formatMoney(5318008, { symbol: "GBP", format: "%v %s" }); // 5,318,008.00 GBP + +// Example usage with options object: +accounting.formatMoney(5318008, { + symbol: "GBP", + precision: 0, + thousand: "·", + format: { + pos: "%s %v", + neg: "%s (%v)", + zero: "%s --" + } +}); + +// Will recursively format an array of values: +accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]] + + + +// formatColumn + +// Format list of numbers for display: +accounting.formatColumn([123.5, 3456.49, 777888.99, 12345678, -5432], "$ "); + +// Example usage (NB. use a space after the symbol to add arbitrary padding to all values): +accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"] + +// List of numbers can be a multi-dimensional array (formatColumn is applied recursively): +accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]] + + + +// formatNumber + +// Example usage: +accounting.formatNumber(5318008); // 5,318,008 +accounting.formatNumber(9876543.21, 3, " "); // 9 876 543.210 +accounting.formatNumber(4999.99, 2, ".", ","); // 4.999,99 + +// Example usage with options object: +accounting.formatNumber(5318008, { + precision: 3, + thousand: " " +}); + +// Will recursively format an array of values: +accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]] + + + +// toFixed + +(0.615).toFixed(2); // "0.61" +accounting.toFixed(0.615, 2); // "0.62" + + + + +// unformat + +// Example usage: +accounting.unformat("£ 12,345,678.90 GBP"); // 12345678.9 +accounting.unformat("GBP £ 12,345,678.90"); // 12345678.9 + +// If a non-standard decimal separator was used (eg. a comma) unformat() will need it in order to work out +// which part of the number is a decimal/float: +accounting.unformat("€ 1.000.000,00", ","); // 1000000 + +// Settings object that controls default parameters for library methods: +accounting.settings = { + currency: { + symbol: "$", // default currency symbol is '$' + format: "%s%v", // controls output: %s = symbol, %v = value/number (can be object: see below) + decimal: ".", // decimal point separator + thousand: ",", // thousands separator + precision: 2 // decimal places + }, + number: { + precision: 0, // default precision on numbers is 0 + thousand: ",", + decimal: "." + } +}; + +// These can be changed externally to edit the library's defaults: +accounting.settings.currency.format = "%s %v"; + +// Format can be an object, with `pos`, `neg` and `zero`: +accounting.settings.currency.format = { + pos: "%s %v", // for positive values, eg. "$ 1.00" (required) + neg: "%s (%v)", // for negative values, eg. "$ (1.00)" [optional] + zero: "%s -- " // for zero values, eg. "$ --" [optional] +}; diff --git a/accounting/accounting.d.ts b/accounting/accounting.d.ts index ea861612b..675104047 100644 --- a/accounting/accounting.d.ts +++ b/accounting/accounting.d.ts @@ -3,28 +3,28 @@ // Definitions by: Sergey Gerasimov // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface IAccountingCurrencyFormat { - pos: string; // for positive values, eg. "$ 1.00" - neg?: string; // for negative values, eg. "$ (1.00)" +interface IAccountingCurrencyFormat { + pos: string; // for positive values, eg. "$ 1.00" + neg?: string; // for negative values, eg. "$ (1.00)" zero?: string; // for zero values, eg. "$ --" } -interface IAccountingCurrencySettings { - symbol?: string; // default currency symbol is '$' - format?: TFormat; // controls output: %s = symbol, %v = value/number - decimal?: string; // decimal point separator - thousand?: string; // thousands separator +interface IAccountingCurrencySettings { + symbol?: string; // default currency symbol is '$' + format?: TFormat; // controls output: %s = symbol, %v = value/number + decimal?: string; // decimal point separator + thousand?: string; // thousands separator precision?: number // decimal places } -interface IAccountingNumberSettings { - precision?: number; // default precision on numbers is 0 - thousand?: string; - decimal?: string; +interface IAccountingNumberSettings { + precision?: number; // default precision on numbers is 0 + thousand?: string; + decimal?: string; } -interface IAccountingSettings { - currency: IAccountingCurrencySettings; // IAccountingCurrencySettings or IAccountingCurrencySettings +interface IAccountingSettings { + currency: IAccountingCurrencySettings; // IAccountingCurrencySettings or IAccountingCurrencySettings number: IAccountingNumberSettings; } @@ -76,4 +76,4 @@ declare var accounting: IAccountingStatic; declare module "accounting" { export = accounting; -} \ No newline at end of file +} diff --git a/ace/all-tests.ts.tscparams b/ace/all-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/all-tests.ts.tscparams +++ b/ace/all-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-anchor-tests.ts.tscparams b/ace/tests/ace-anchor-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-anchor-tests.ts.tscparams +++ b/ace/tests/ace-anchor-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-background_tokenizer-tests.ts.tscparams b/ace/tests/ace-background_tokenizer-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-background_tokenizer-tests.ts.tscparams +++ b/ace/tests/ace-background_tokenizer-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-default-tests.ts.tscparams b/ace/tests/ace-default-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-default-tests.ts.tscparams +++ b/ace/tests/ace-default-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-document-tests.ts.tscparams b/ace/tests/ace-document-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-document-tests.ts.tscparams +++ b/ace/tests/ace-document-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-edit_session-tests.ts.tscparams b/ace/tests/ace-edit_session-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-edit_session-tests.ts.tscparams +++ b/ace/tests/ace-edit_session-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-editor1-tests.ts.tscparams b/ace/tests/ace-editor1-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-editor1-tests.ts.tscparams +++ b/ace/tests/ace-editor1-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams b/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams +++ b/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-editor_navigation-tests.ts.tscparams b/ace/tests/ace-editor_navigation-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-editor_navigation-tests.ts.tscparams +++ b/ace/tests/ace-editor_navigation-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-multi_select-tests.ts.tscparams b/ace/tests/ace-multi_select-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-multi_select-tests.ts.tscparams +++ b/ace/tests/ace-multi_select-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-placeholder-tests.ts.tscparams b/ace/tests/ace-placeholder-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-placeholder-tests.ts.tscparams +++ b/ace/tests/ace-placeholder-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-range_list-tests.ts.tscparams b/ace/tests/ace-range_list-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-range_list-tests.ts.tscparams +++ b/ace/tests/ace-range_list-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-selection-tests.ts.tscparams b/ace/tests/ace-selection-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-selection-tests.ts.tscparams +++ b/ace/tests/ace-selection-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-token_iterator-tests.ts.tscparams b/ace/tests/ace-token_iterator-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-token_iterator-tests.ts.tscparams +++ b/ace/tests/ace-token_iterator-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/ace/tests/ace-virtual_renderer-tests.ts.tscparams b/ace/tests/ace-virtual_renderer-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/ace/tests/ace-virtual_renderer-tests.ts.tscparams +++ b/ace/tests/ace-virtual_renderer-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/amcharts/AmCharts.d.ts.tscparams b/amcharts/AmCharts.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/amcharts/AmCharts.d.ts.tscparams +++ b/amcharts/AmCharts.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/amplifyjs/amplifyjs-tests.ts.tscparams b/amplifyjs/amplifyjs-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/amplifyjs/amplifyjs-tests.ts.tscparams +++ b/amplifyjs/amplifyjs-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/angular-google-analytics/angular-google-analytics-service.d.ts b/angular-google-analytics/angular-google-analytics-service.d.ts index 5f478621c..e69b63d90 100644 --- a/angular-google-analytics/angular-google-analytics-service.d.ts +++ b/angular-google-analytics/angular-google-analytics-service.d.ts @@ -1,62 +1,62 @@ -// Type definitions for angular-google-analytics v1.1.0 -// Project: https://github.com/revolunet/angular-google-analytics -// Definitions by: Matt Wheatley -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module angular.google.analytics { - interface AnalyticsService { - /** - * @summary If logging is enabled then all outbound calls are accessible via an in-memory array. - * This is useful for troubleshooting and seeing the order of outbound calls with parameters. - */ - log: Array; - - /** - * @summary If in offline mode then all calls are queued to an in-memory array for future processing. - * All calls queued to the offlineQueue are not outbound calls yet and hence do not show up in the log. - */ - offlineQueue: Array; - - /** - * @summary Returns the current URL that would be sent if a `trackPage` call was made. - * @return {string} The URL - */ - getUrl: () => string; - - /** - * @summary Manually create classic analytics (ga.js) script tag - */ - createScriptTag: () => void; - - /** - * @summary Manually create universal analytics (analytics.js) script tag - */ - createAnalyticsScriptTag: () => void; - - /** - * @summary Allows for advanced configuration and definitions in univeral analytics only. This is a no-op when using classic analytics. - */ - set: (key: string, value: any, accountName?: string) => void; - - /** - * @summary Creates a new page view event - * @param {string} pageURL URL of page view - * @param {string} title Page Title - * @param {Object} dimensions Additional dimensions and metrics - */ - trackPage: (pageURL: string, title?: string, dimensions?: { [expr: string]: any }) => void; - - /** - * @summary Create a new event - */ - trackEvent: (category: string, action: string, label: string, value?: any, nonInteractionFlag?: boolean, dimensions?: { [expr: string]: any }) => void; - - trackException: (descrption: string, isFatal: boolean) => void; - - /** - * @summary While in offline mode, no calls to the ga function or pushes to the gaq array are made. - * This will queue all calls for later sending once offline mode is reset to false. - */ - offline: (offlineMode: boolean) => void; - } -} +// Type definitions for angular-google-analytics v1.1.0 +// Project: https://github.com/revolunet/angular-google-analytics +// Definitions by: Matt Wheatley +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module angular.google.analytics { + interface AnalyticsService { + /** + * @summary If logging is enabled then all outbound calls are accessible via an in-memory array. + * This is useful for troubleshooting and seeing the order of outbound calls with parameters. + */ + log: Array; + + /** + * @summary If in offline mode then all calls are queued to an in-memory array for future processing. + * All calls queued to the offlineQueue are not outbound calls yet and hence do not show up in the log. + */ + offlineQueue: Array; + + /** + * @summary Returns the current URL that would be sent if a `trackPage` call was made. + * @return {string} The URL + */ + getUrl: () => string; + + /** + * @summary Manually create classic analytics (ga.js) script tag + */ + createScriptTag: () => void; + + /** + * @summary Manually create universal analytics (analytics.js) script tag + */ + createAnalyticsScriptTag: () => void; + + /** + * @summary Allows for advanced configuration and definitions in univeral analytics only. This is a no-op when using classic analytics. + */ + set: (key: string, value: any, accountName?: string) => void; + + /** + * @summary Creates a new page view event + * @param {string} pageURL URL of page view + * @param {string} title Page Title + * @param {Object} dimensions Additional dimensions and metrics + */ + trackPage: (pageURL: string, title?: string, dimensions?: { [expr: string]: any }) => void; + + /** + * @summary Create a new event + */ + trackEvent: (category: string, action: string, label: string, value?: any, nonInteractionFlag?: boolean, dimensions?: { [expr: string]: any }) => void; + + trackException: (descrption: string, isFatal: boolean) => void; + + /** + * @summary While in offline mode, no calls to the ga function or pushes to the gaq array are made. + * This will queue all calls for later sending once offline mode is reset to false. + */ + offline: (offlineMode: boolean) => void; + } +} diff --git a/angular-growl-v2/angular-growl-v2-tests.ts b/angular-growl-v2/angular-growl-v2-tests.ts index c03e0725a..13c7cad2e 100644 --- a/angular-growl-v2/angular-growl-v2-tests.ts +++ b/angular-growl-v2/angular-growl-v2-tests.ts @@ -1,65 +1,65 @@ -/// - -var app = angular.module("ag", ["pascalprecht.translate", "$httpProvider"]); - -app.config((growlProvider:angular.growl.IGrowlProvider, $httpProvider:angular.IHttpProvider) => { - var ttl:angular.growl.IGrowlTTLConfig = { - success: 5000, - error: 4000 - }; - - growlProvider.globalTimeToLive(ttl) - .globalTimeToLive(5000) - .globalDisableCloseButton(true) - .globalDisableIcons(true) - .globalReversedOrder(false) - .globalDisableCountDown(true) - .messageVariableKey("someKey") - .globalInlineMessages(false) - .globalPosition("top-center") - .messagesKey("someKey") - .messageTextKey("someKey") - .messageTitleKey("someKey") - .messageSeverityKey("someKey") - .onlyUniqueMessages(false); - - $httpProvider.interceptors.push(growlProvider.serverMessagesInterceptor); -}); - -app.controller("Ctrl", ($scope:angular.IScope, - growl:angular.growl.IGrowlService, - growlMessages:angular.growl.IGrowlMessagesService) => { - var config:angular.growl.IGrowlMessageConfig = { - ttl: 5000, - disableCountDown: true, - disableCloseButton: true - }; - - var message = "Some message"; - - growl.warning(message); - growl.warning(message, config); - growl.error(message); - growl.error(message, config); - growl.info(message); - growl.info(message, config); - growl.success(message); - growl.success(message, config); - growl.general(message); - growl.general(message, config); - growl.general(message, config, "error"); - growl.onlyUnique(); - growl.reverseOrder(); - growl.inlineMessages(); - growl.position(); - - growlMessages.initDirective(1, 10); - var messages:angular.growl.IGrowlMessage[] = growlMessages.getAllMessages(2); - growlMessages.destroyAllMessages(0); - growlMessages.addMessage(messages[0]); - growlMessages.deleteMessage(messages[1]); - - var testMessage = growl.warning(message); - testMessage.setText("Some other message"); - testMessage.destroy(); -}); +/// + +var app = angular.module("ag", ["pascalprecht.translate", "$httpProvider"]); + +app.config((growlProvider:angular.growl.IGrowlProvider, $httpProvider:angular.IHttpProvider) => { + var ttl:angular.growl.IGrowlTTLConfig = { + success: 5000, + error: 4000 + }; + + growlProvider.globalTimeToLive(ttl) + .globalTimeToLive(5000) + .globalDisableCloseButton(true) + .globalDisableIcons(true) + .globalReversedOrder(false) + .globalDisableCountDown(true) + .messageVariableKey("someKey") + .globalInlineMessages(false) + .globalPosition("top-center") + .messagesKey("someKey") + .messageTextKey("someKey") + .messageTitleKey("someKey") + .messageSeverityKey("someKey") + .onlyUniqueMessages(false); + + $httpProvider.interceptors.push(growlProvider.serverMessagesInterceptor); +}); + +app.controller("Ctrl", ($scope:angular.IScope, + growl:angular.growl.IGrowlService, + growlMessages:angular.growl.IGrowlMessagesService) => { + var config:angular.growl.IGrowlMessageConfig = { + ttl: 5000, + disableCountDown: true, + disableCloseButton: true + }; + + var message = "Some message"; + + growl.warning(message); + growl.warning(message, config); + growl.error(message); + growl.error(message, config); + growl.info(message); + growl.info(message, config); + growl.success(message); + growl.success(message, config); + growl.general(message); + growl.general(message, config); + growl.general(message, config, "error"); + growl.onlyUnique(); + growl.reverseOrder(); + growl.inlineMessages(); + growl.position(); + + growlMessages.initDirective(1, 10); + var messages:angular.growl.IGrowlMessage[] = growlMessages.getAllMessages(2); + growlMessages.destroyAllMessages(0); + growlMessages.addMessage(messages[0]); + growlMessages.deleteMessage(messages[1]); + + var testMessage = growl.warning(message); + testMessage.setText("Some other message"); + testMessage.destroy(); +}); diff --git a/angular-growl-v2/angular-growl-v2.d.ts b/angular-growl-v2/angular-growl-v2.d.ts index 07c0dbe37..594e45c42 100644 --- a/angular-growl-v2/angular-growl-v2.d.ts +++ b/angular-growl-v2/angular-growl-v2.d.ts @@ -1,259 +1,259 @@ -// Type definitions for Angular Growl 2 v.0.7.5 -// Project: http://janstevens.github.io/angular-growl-2 -// Definitions by: Tadeusz Hucal -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module angular.growl { - - /** - * Global Time-To-Leave configuration. - */ - interface IGrowlTTLConfig { - success?: number; - error?: number; - warning?: number; - info?: number; - } - - /** - * Custom configuration used in single message call. - */ - interface IGrowlMessageConfig { - title?: string; - ttl?: number; - disableCountDown?: boolean; - disableIcons?: boolean; - disableCloseButton?: boolean; - onclose?: Function; - onopen?: Function; - position?: string; - referenceId?: number; - translateMessage?: boolean; - variables?: { [variable: string]: any; }; - } - - /** - * Growl message with configuration. - */ - interface IGrowlMessage extends IGrowlMessageConfig { - text: string; - - /** - * Destroy the message. - */ - destroy(): void; - /** - * Update the message body. - * @param newText new message body - */ - setText(newText: string): void; - } - - /** - * Growl service provider. - */ - interface IGrowlProvider extends angular.IServiceProvider { - /** - * Pre-defined server error interceptor. - */ - serverMessagesInterceptor: (string|IHttpInterceptorFactory)[]; - - /** - * Set default TTL settings. - * @param ttl configuration of TTL for different type of message - */ - globalTimeToLive(ttl: IGrowlTTLConfig): IGrowlProvider; - /** - * Set default TTL settings. - * @param ttl ttl in milliseconds - */ - globalTimeToLive(ttl: number): IGrowlProvider; - /** - * Set default setting for disabling close button. - * @param disableCloseButton - */ - globalDisableCloseButton(disableCloseButton: boolean): IGrowlProvider; - /** - * Set default setting for disabling icons. - * @param disableIcons - */ - globalDisableIcons(disableIcons: boolean): IGrowlProvider; - /** - * Set reversing order of displaying new messages. - * @param reverseOrder - */ - globalReversedOrder(reverseOrder: boolean): IGrowlProvider; - /** - * Set default setting for displaying message disappear countdown. - * @param disableCountDown - */ - globalDisableCountDown(disableCountDown: boolean): IGrowlProvider; - /** - * Set default allowance for inline messages. - * @param inline - */ - globalInlineMessages(inline: boolean): IGrowlProvider; - /** - * Set default message position. - * @param position - */ - globalPosition(position: string): IGrowlProvider; - /** - * Enable/disable displaying only unique messages. - * @param onlyUniqueMessages - */ - onlyUniqueMessages(onlyUniqueMessages: boolean): IGrowlProvider; - - /** - * Set key where messages are stored (for http interceptor). - * @param messageVariableKey - */ - messagesKey(messageKey: string): IGrowlProvider; - /** - * Set key where message text is stored (for http interceptor). - * @param messageVariableKey - */ - messageTextKey(messageTextKey: string): IGrowlProvider; - /** - * Set key where title of message is stored (for http interceptor). - * @param messageVariableKey - */ - messageTitleKey(messageTitleKey: string): IGrowlProvider; - /** - * Set key where severity of message is stored (for http interceptor). - * @param messageVariableKey - */ - messageSeverityKey(messageSeverityKey: string): IGrowlProvider; - /** - * Set key where variables for message are stored (for http interceptor). - * @param messageVariableKey - */ - messageVariableKey(messageVariableKey: string): IGrowlProvider; - } - - /** - * Growl service. - */ - interface IGrowlService { - /** - * Show warning message. - * @param message text to display (or code for angular-translate) - */ - warning(message: string): IGrowlMessage; - /** - * Show warning message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - warning(message: string, config: IGrowlMessageConfig): IGrowlMessage; - - /** - * Show error message. - * @param message text to display (or code for angular-translate) - */ - error(message: string): IGrowlMessage; - /** - * Show error message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - error(message: string, config: IGrowlMessageConfig): IGrowlMessage; - - /** - * Show information message. - * @param message text to display (or code for angular-translate) - */ - info(message: string): IGrowlMessage; - /** - * Show information message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - info(message: string, config: IGrowlMessageConfig): IGrowlMessage; - - /** - * Show success message. - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - success(message: string): IGrowlMessage; - /** - * Show success message. - * @param message text to display (or code for angular-translate) - */ - success(message: string, config: IGrowlMessageConfig): IGrowlMessage; - - /** - * Show message (generic). - * @param message text to display (or code for angular-translate) - */ - general(message: string): IGrowlMessage; - /** - * Show message (generic). - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - */ - general(message: string, config: IGrowlMessageConfig): IGrowlMessage; - /** - * Show message (generic). - * @param message text to display (or code for angular-translate) - * @param config additional message configuration - * @param severity message severity (error, warning, success, info). - */ - general(message: string, config: IGrowlMessageConfig, severity: string): IGrowlMessage; - - /** - * Get current setting for displaying only unique messages. - */ - onlyUnique(): boolean; - /** - * Get current setting for reversing messages order. - */ - reverseOrder(): boolean; - /** - * Get current allowance for inline messages. - */ - inlineMessages(): boolean; - /** - * Get current messages position. - */ - position(): string; - } - - /** - * GrowlMessages service. - */ - interface IGrowlMessagesService { - /** - * Initialize a directive - * We look at the preloaded directive and use this else we - * create a new blank object - * @param referenceId - * @param limitMessages - */ - initDirective(referenceId: number, limitMessages: number): angular.IDirective; - - /** - * Get current messages - */ - getAllMessages(referenceId?: number): IGrowlMessage[]; - - /** - * Destroy all messages - */ - destroyAllMessages(referenceId?: number): void; - - /** - * Add a message - */ - addMessage(message: IGrowlMessage): IGrowlMessage; - - /** - * Delete a message - */ - deleteMessage(message: IGrowlMessage): void; - - } -} +// Type definitions for Angular Growl 2 v.0.7.5 +// Project: http://janstevens.github.io/angular-growl-2 +// Definitions by: Tadeusz Hucal +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.growl { + + /** + * Global Time-To-Leave configuration. + */ + interface IGrowlTTLConfig { + success?: number; + error?: number; + warning?: number; + info?: number; + } + + /** + * Custom configuration used in single message call. + */ + interface IGrowlMessageConfig { + title?: string; + ttl?: number; + disableCountDown?: boolean; + disableIcons?: boolean; + disableCloseButton?: boolean; + onclose?: Function; + onopen?: Function; + position?: string; + referenceId?: number; + translateMessage?: boolean; + variables?: { [variable: string]: any; }; + } + + /** + * Growl message with configuration. + */ + interface IGrowlMessage extends IGrowlMessageConfig { + text: string; + + /** + * Destroy the message. + */ + destroy(): void; + /** + * Update the message body. + * @param newText new message body + */ + setText(newText: string): void; + } + + /** + * Growl service provider. + */ + interface IGrowlProvider extends angular.IServiceProvider { + /** + * Pre-defined server error interceptor. + */ + serverMessagesInterceptor: (string|IHttpInterceptorFactory)[]; + + /** + * Set default TTL settings. + * @param ttl configuration of TTL for different type of message + */ + globalTimeToLive(ttl: IGrowlTTLConfig): IGrowlProvider; + /** + * Set default TTL settings. + * @param ttl ttl in milliseconds + */ + globalTimeToLive(ttl: number): IGrowlProvider; + /** + * Set default setting for disabling close button. + * @param disableCloseButton + */ + globalDisableCloseButton(disableCloseButton: boolean): IGrowlProvider; + /** + * Set default setting for disabling icons. + * @param disableIcons + */ + globalDisableIcons(disableIcons: boolean): IGrowlProvider; + /** + * Set reversing order of displaying new messages. + * @param reverseOrder + */ + globalReversedOrder(reverseOrder: boolean): IGrowlProvider; + /** + * Set default setting for displaying message disappear countdown. + * @param disableCountDown + */ + globalDisableCountDown(disableCountDown: boolean): IGrowlProvider; + /** + * Set default allowance for inline messages. + * @param inline + */ + globalInlineMessages(inline: boolean): IGrowlProvider; + /** + * Set default message position. + * @param position + */ + globalPosition(position: string): IGrowlProvider; + /** + * Enable/disable displaying only unique messages. + * @param onlyUniqueMessages + */ + onlyUniqueMessages(onlyUniqueMessages: boolean): IGrowlProvider; + + /** + * Set key where messages are stored (for http interceptor). + * @param messageVariableKey + */ + messagesKey(messageKey: string): IGrowlProvider; + /** + * Set key where message text is stored (for http interceptor). + * @param messageVariableKey + */ + messageTextKey(messageTextKey: string): IGrowlProvider; + /** + * Set key where title of message is stored (for http interceptor). + * @param messageVariableKey + */ + messageTitleKey(messageTitleKey: string): IGrowlProvider; + /** + * Set key where severity of message is stored (for http interceptor). + * @param messageVariableKey + */ + messageSeverityKey(messageSeverityKey: string): IGrowlProvider; + /** + * Set key where variables for message are stored (for http interceptor). + * @param messageVariableKey + */ + messageVariableKey(messageVariableKey: string): IGrowlProvider; + } + + /** + * Growl service. + */ + interface IGrowlService { + /** + * Show warning message. + * @param message text to display (or code for angular-translate) + */ + warning(message: string): IGrowlMessage; + /** + * Show warning message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + warning(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show error message. + * @param message text to display (or code for angular-translate) + */ + error(message: string): IGrowlMessage; + /** + * Show error message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + error(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show information message. + * @param message text to display (or code for angular-translate) + */ + info(message: string): IGrowlMessage; + /** + * Show information message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + info(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show success message. + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + success(message: string): IGrowlMessage; + /** + * Show success message. + * @param message text to display (or code for angular-translate) + */ + success(message: string, config: IGrowlMessageConfig): IGrowlMessage; + + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + */ + general(message: string): IGrowlMessage; + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + */ + general(message: string, config: IGrowlMessageConfig): IGrowlMessage; + /** + * Show message (generic). + * @param message text to display (or code for angular-translate) + * @param config additional message configuration + * @param severity message severity (error, warning, success, info). + */ + general(message: string, config: IGrowlMessageConfig, severity: string): IGrowlMessage; + + /** + * Get current setting for displaying only unique messages. + */ + onlyUnique(): boolean; + /** + * Get current setting for reversing messages order. + */ + reverseOrder(): boolean; + /** + * Get current allowance for inline messages. + */ + inlineMessages(): boolean; + /** + * Get current messages position. + */ + position(): string; + } + + /** + * GrowlMessages service. + */ + interface IGrowlMessagesService { + /** + * Initialize a directive + * We look at the preloaded directive and use this else we + * create a new blank object + * @param referenceId + * @param limitMessages + */ + initDirective(referenceId: number, limitMessages: number): angular.IDirective; + + /** + * Get current messages + */ + getAllMessages(referenceId?: number): IGrowlMessage[]; + + /** + * Destroy all messages + */ + destroyAllMessages(referenceId?: number): void; + + /** + * Add a message + */ + addMessage(message: IGrowlMessage): IGrowlMessage; + + /** + * Delete a message + */ + deleteMessage(message: IGrowlMessage): void; + + } +} diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts index 9ce0a33e9..cc2a62c8d 100644 --- a/angular-meteor/angular-meteor-tests.ts +++ b/angular-meteor/angular-meteor-tests.ts @@ -1,255 +1,255 @@ -/// - -interface ITodo { - _id?: string; - name: string; - public?: boolean; - sticky?: boolean; -} - -interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject {} - -interface CustomScope extends angular.meteor.IScope { - sticky: boolean; - - todos: angular.meteor.AngularMeteorCollection; - stickyTodos: angular.meteor.AngularMeteorCollection; - notAutoTodos: angular.meteor.AngularMeteorCollection; - - todo: ITodo; - todoNotAuto: TodoAngularMeteorObject; - todoSubscribed: TodoAngularMeteorObject; - - save: (todo: ITodo) => void; - saveAll: () =>void; - autoSave: (todo: ITodo) => void; - remove: (todoId: string) => void; - removeAll: () => void; - removeAuto: (todo: ITodo) => void; - toSticky: (todo: ITodo) => void; -} - -var Todos = new Mongo.Collection('todos'); - -var app = angular.module('angularMeteorTestApp'); - -app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => { - // Bind all the todos to $scope.todos - $scope.todos = $meteor.collection(Todos); - - $scope.sticky = true; - // Bind all sticky todos to $scope.stickyTodos - // Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it - // to $scope.stickyTodos - $scope.stickyTodos = $meteor.collection(function(){ - return Todos.find({sticky: $scope.getReactively('sticky')}); - }); - - // Bind without auto-save all todos to $scope.notAutoTodos - $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); - - $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); - $scope.todoSubscribed = $meteor.object(Todos, 'TodoID').subscribe('todos'); - $scope.todo = $scope.todoNotAuto.getRawObject(); - $scope.todoNotAuto.reset(); - $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; - - // todo might be an object like this {text: "Learn Angular", sticky: false} - // or an array like this: - // [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}] - - $scope.save = function(todo) { - $scope.notAutoTodos.save(todo); - }; - - $scope.saveAll = function() { - $scope.notAutoTodos.save(); - }; - - $scope.autoSave = function(todo) { - $scope.todos.push(todo); - }; - - // todoId might be an string like this "WhrnEez5yBRgo4yEm" - // or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"] - $scope.remove = function(todoId) { - $scope.notAutoTodos.remove(todoId); - }; - - $scope.removeAll = function() { - $scope.notAutoTodos.remove(); - }; - - $scope.removeAuto = function(todo) { - $scope.todos.splice( $scope.todos.indexOf(todo), 1 ); - } - - $scope.toSticky = function(todo) { - if (angular.isArray(todo)){ - angular.forEach(todo, function(object) { - object.sticky = true; - }); - } else { - todo.sticky = true; - } - - $scope.stickyTodos.save(todo); - }; - - var todoObject = {name:'first todo'}; - var todosArray = [{name:'second todo'}, {name:'third todo'}]; - var todoSecondObject = {name:'forth todo'}; - - $scope.todos.save(todoObject); // todos equals [{name:'first todo'}] - - $scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] - - $scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] - // but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] - - $scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] - - $scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] - - var todoIdsArray = ['secondTodoId', 'thirdTodoId']; - $scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection - - $scope.todos.pop(); // removes only in scope - - $scope.todos.remove(); // syncs also in Meteor collection - - // Subscribe -> - - $meteor.subscribe('todos').then((subscriptionHandle) => { - // Bind all the todos to $scope.todos - $scope.todos = $meteor.collection(Todos); - - console.log($scope.todos + ' is ready'); - - // You can use the subscription handle to stop the subscription if you want - subscriptionHandle.stop(); - }); - - $scope.subscribe('todos').then((subscriptionHandle) => { - // Bind all the todos to $scope.books - $scope.todos = $meteor.collection(Todos); - - console.log($scope.todos + ' is ready'); - - // No need to stop the subscription, it will automatically close on scope destroy - }); - - $meteor.call('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => { - // Handle success - console.log('success subscribing', data.name); - }, (err) => { - // Handle error - console.log('failed', err); - }); - - if (!$scope.loggingIn) { - $meteor.waitForUser(); - - $meteor.requireUser(); - - $meteor.requireValidUser(user => { - return user.username == 'admin'; - }); - - $meteor.loginWithPassword('user', 'password').then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - - $meteor.createUser({ - username:'moma', - email:'example@gmail.com', - password: 'Bksd@asdf', - profile: {expertize: 'Developer'} - }).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - - $meteor.changePassword('old', 'new232f3').then(() => { - console.log('Change password success'); - }, err => { - console.log('Error changing password - ', err); - }); - - $meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => { - console.log('Success sending forgot password email'); - }, err => { - console.log('Error sending forgot password email - ', err); - }); - - $meteor.resetPassword('tokenID', 'new232f3').then(() => { - console.log('Reset password success'); - }, err => { - console.log('Error resetting password - ', err); - }); - - $meteor.verifyEmail('tokenID').then(() => { - console.log('Success verifying password '); - }, err => { - console.log('Error verifying password - ', err); - }); - - $meteor.logout().then(() => { - console.log('Logout success'); - }, err => { - console.log('logout error - ', err); - }); - - $meteor.logoutOtherClients().then(() => { - console.log('Logout success'); - }, err => { - console.log('logout error - ', err); - }); - - var loginWithOptions = {requestPermissions: ['email']}; - - $meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - $meteor.loginWithGithub({requestPermissions: ['email']}).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - $meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - $meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - $meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - $meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => { - console.log('Login success'); - }, err => { - console.log('Login error - ', err); - }); - } - - $meteor.autorun($scope, () => { console.log("Aurorun triggered."); }); - $meteor.getCollectionByName('collectionName'); - - // requires meteor add mdg:camera - $meteor.getPicture().then(function(data){ - $scope['picture'] = data; - }); - - $meteor.session('counter').bind($scope, 'counter'); -}]); +/// + +interface ITodo { + _id?: string; + name: string; + public?: boolean; + sticky?: boolean; +} + +interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject {} + +interface CustomScope extends angular.meteor.IScope { + sticky: boolean; + + todos: angular.meteor.AngularMeteorCollection; + stickyTodos: angular.meteor.AngularMeteorCollection; + notAutoTodos: angular.meteor.AngularMeteorCollection; + + todo: ITodo; + todoNotAuto: TodoAngularMeteorObject; + todoSubscribed: TodoAngularMeteorObject; + + save: (todo: ITodo) => void; + saveAll: () =>void; + autoSave: (todo: ITodo) => void; + remove: (todoId: string) => void; + removeAll: () => void; + removeAuto: (todo: ITodo) => void; + toSticky: (todo: ITodo) => void; +} + +var Todos = new Mongo.Collection('todos'); + +var app = angular.module('angularMeteorTestApp'); + +app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + $scope.sticky = true; + // Bind all sticky todos to $scope.stickyTodos + // Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it + // to $scope.stickyTodos + $scope.stickyTodos = $meteor.collection(function(){ + return Todos.find({sticky: $scope.getReactively('sticky')}); + }); + + // Bind without auto-save all todos to $scope.notAutoTodos + $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); + + $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); + $scope.todoSubscribed = $meteor.object(Todos, 'TodoID').subscribe('todos'); + $scope.todo = $scope.todoNotAuto.getRawObject(); + $scope.todoNotAuto.reset(); + $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; + + // todo might be an object like this {text: "Learn Angular", sticky: false} + // or an array like this: + // [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}] + + $scope.save = function(todo) { + $scope.notAutoTodos.save(todo); + }; + + $scope.saveAll = function() { + $scope.notAutoTodos.save(); + }; + + $scope.autoSave = function(todo) { + $scope.todos.push(todo); + }; + + // todoId might be an string like this "WhrnEez5yBRgo4yEm" + // or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"] + $scope.remove = function(todoId) { + $scope.notAutoTodos.remove(todoId); + }; + + $scope.removeAll = function() { + $scope.notAutoTodos.remove(); + }; + + $scope.removeAuto = function(todo) { + $scope.todos.splice( $scope.todos.indexOf(todo), 1 ); + } + + $scope.toSticky = function(todo) { + if (angular.isArray(todo)){ + angular.forEach(todo, function(object) { + object.sticky = true; + }); + } else { + todo.sticky = true; + } + + $scope.stickyTodos.save(todo); + }; + + var todoObject = {name:'first todo'}; + var todosArray = [{name:'second todo'}, {name:'third todo'}]; + var todoSecondObject = {name:'forth todo'}; + + $scope.todos.save(todoObject); // todos equals [{name:'first todo'}] + + $scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + // but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + $scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + var todoIdsArray = ['secondTodoId', 'thirdTodoId']; + $scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection + + $scope.todos.pop(); // removes only in scope + + $scope.todos.remove(); // syncs also in Meteor collection + + // Subscribe -> + + $meteor.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // You can use the subscription handle to stop the subscription if you want + subscriptionHandle.stop(); + }); + + $scope.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.books + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // No need to stop the subscription, it will automatically close on scope destroy + }); + + $meteor.call('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => { + // Handle success + console.log('success subscribing', data.name); + }, (err) => { + // Handle error + console.log('failed', err); + }); + + if (!$scope.loggingIn) { + $meteor.waitForUser(); + + $meteor.requireUser(); + + $meteor.requireValidUser(user => { + return user.username == 'admin'; + }); + + $meteor.loginWithPassword('user', 'password').then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.createUser({ + username:'moma', + email:'example@gmail.com', + password: 'Bksd@asdf', + profile: {expertize: 'Developer'} + }).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.changePassword('old', 'new232f3').then(() => { + console.log('Change password success'); + }, err => { + console.log('Error changing password - ', err); + }); + + $meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => { + console.log('Success sending forgot password email'); + }, err => { + console.log('Error sending forgot password email - ', err); + }); + + $meteor.resetPassword('tokenID', 'new232f3').then(() => { + console.log('Reset password success'); + }, err => { + console.log('Error resetting password - ', err); + }); + + $meteor.verifyEmail('tokenID').then(() => { + console.log('Success verifying password '); + }, err => { + console.log('Error verifying password - ', err); + }); + + $meteor.logout().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + $meteor.logoutOtherClients().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + var loginWithOptions = {requestPermissions: ['email']}; + + $meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGithub({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + } + + $meteor.autorun($scope, () => { console.log("Aurorun triggered."); }); + $meteor.getCollectionByName('collectionName'); + + // requires meteor add mdg:camera + $meteor.getPicture().then(function(data){ + $scope['picture'] = data; + }); + + $meteor.session('counter').bind($scope, 'counter'); +}]); diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index e536e3203..e3e66bf34 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -1,352 +1,352 @@ -// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module) -// Project: https://github.com/Urigo/angular-meteor -// Definitions by: Peter Grman -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -/// - -declare module angular.meteor { - interface IRootScopeService extends angular.IRootScopeService { - /** - * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. - */ - currentUser: Meteor.User; - - /** - * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. - * A reactive data source. Can be use to display animation while user is logging in. - */ - loggingIn: boolean; - } - - interface IScope extends angular.IScope, IRootScopeService { - /** - * A method to get a $scope variable and watch it reactivly - * - * @param scopeVariableName - The name of the scope's variable to bind to - * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower - */ - getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; - - /** - * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. - * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. - * - * @param name - Name of the subscription. Matches the name of the server's publish() call. - * @param publisherArguments - Optional arguments passed to publisher function on server. - * - * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. - */ - subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; - - /** - * The helpers method is part of the ReactiveContext, and available on every context and $scope. - * These method are defined as Object, where each key is the name of the variable that will be available on the context we run, and each value is a function with a return value. - * Under the hood, each helper starts a new Tracker.autorun. When its reactive dependencies change, the helper is rerun. - * To trigger a rerun every time an specific Angular variable change, use getReactively](/api/1.3.1/get-reactively) to make your Angular variable reactive inside the helper its used in. - * Each helper function should return a MongoDB Cursor and the helpers will expose it as a normal array to the context. - * - * @param definitions - Object containing `name` => `function` definition, where each name is a string and each function is the helper function. Should return a [MongoDB Cursor](http://docs.meteor.com/#/full/mongo_cursor) - * @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; - } - - /** - * $meteor in angularjs - */ - interface IMeteorService { - /** - * A service that wraps the Meteor collections to enable reactivity within AngularJS. - * - * @param collection - A Meteor Collection or a reactive function to bind to. - * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. - * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. - * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. - */ - collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; - - /** - * A service that wraps the Meteor collections to enable reactivity within AngularJS. - * - * @param collection - A Meteor Collection or a reactive function to bind to. - * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. - * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. - * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. - * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). - */ - collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; - - /** - * A service that wraps a Meteor object to enable reactivity within AngularJS. - * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne - * - * @param collection - A Meteor Collection to bind to. - * @param selector - A query describing the documents to find or just the ID of the document. - * - $meteor.object will find the first document that matches the selector, - * - as ordered by sort and skip options, exactly like Meteor's collection.findOne - * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. - * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. - */ - object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; - - /** - * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. - * - * @param name - Name of the subscription. Matches the name of the server's publish() call. - * @param publisherArguments - Optional arguments passed to publisher function on server. - * - * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. - */ - subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; - - /** - * A service service which wraps up Meteor.methods with AngularJS promises. - * - * @param name - Name of method to invoke - * @param methodArguments - Optional method arguments - * - * @return The promise solves successfully with the return value of the method or return reject with the error from the method. - */ - call(name: string, ...methodArguments: any[]): angular.IPromise; - - // User Authentication BEGIN -> - - /** - * Returns a promise fulfilled with the currentUser when the user subscription is ready. - * This is useful when you want to grab the current user before the route is rendered. - * If there is no logged in user, it will return null. - * See the “Authentication with Routers” section of our tutorial for more information and a full example. - */ - waitForUser(): angular.IPromise; - - /** - * Resolves the promise successfully if a user is authenticated and rejects otherwise. - * This is useful in cases where you want to require a route to have an authenticated user. - * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. - * See the “Authentication with Routers” section of our tutorial for more information and a full example. - */ - requireUser(): angular.IPromise; - - /** - * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. - * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. - * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. - * See the “Authentication with Routers” section of our tutorial for more information and a full example. - * - * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. - * If it returns a string, the promise will be rejected using said string as the reason. - * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. - */ - requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; - - /** - * Log the user in with a password. - * - * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. - * @param password - The user's password. - */ - loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; - - /** - * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser - * - * @param options.username - A unique name for this user. Either this, or email is required. - * @param options.email - The user's email address. Either this, or username is required. - * @param options.password - The user's password. This is not sent in plain text over the wire. - * @param options.profile - The user's profile, typically including the name field. - */ - createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; - - /** - * Change the current user's password. Must be logged in. - * - * @param oldPassword - The user's current password. This is not sent in plain text over the wire. - * @param newPassword - A new password for the user. This is not sent in plain text over the wire. - */ - changePassword(oldPassword: string, newPassword: string): angular.IPromise; - - /** - * Request a forgot password email. - * - * @param options.email - The email address to send a password reset link. - */ - forgotPassword(options: {email: string}): angular.IPromise; - - /** - * Reset the password for a user using a token received in email. Logs the user in afterwards. - * - * @param token - The token retrieved from the reset password URL. - * @param newPassword - A new password for the user. This is not sent in plain text over the wire. - */ - resetPassword(token: string, newPassword: string): angular.IPromise; - - /** - * Marks the user's email address as verified. Logs the user in afterwards. - * - * @param token - The token retrieved from the reset password URL. - */ - verifyEmail(token: string): angular.IPromise; - - loginWithFacebook: ILoginWithExternalService; - loginWithTwitter: ILoginWithExternalService; - loginWithGoogle: ILoginWithExternalService; - loginWithGithub: ILoginWithExternalService; - loginWithMeetup: ILoginWithExternalService; - loginWithWeibo: ILoginWithExternalService; - - /** - * Log the user out. - * - * @return Resolves with no arguments on success, or reject with a Error argument on failure. - */ - logout(): angular.IPromise; - - /** - * Log out other clients logged in as the current user, but does not log out the client that calls this function. - * For example, when called in a user's browser, connections in that browser remain logged in, - * but any other browsers or DDP clients logged in as that user will be logged out. - * - * @return Resolves with no arguments on success, or reject with a Error argument on failure. - */ - logoutOtherClients(): angular.IPromise; - - // <- User Authentication END - // $meteorUtils BEGIN -> - - /** - * @param scope - The AngularJS scope you use the autorun on. - * @param fn - The function that will re-run every time a reactive variable changes inside it. - */ - autorun(scope: angular.IScope, fn: Function): void; - - /** - * @param collectionName - The name of the collection you want to get back - */ - getCollectionByName(collectionName: string): Mongo.Collection; - - // <- $meteorUtils END - // $meteorCamera BEGIN -> - - /** - * A helper service for taking pictures across platforms. - * Must add mdg:camera package to use! (meteor add mdg:camera) - * - * @param [options] - options is an optional argument that is an Object with the following possible keys: - * @param options.width - An integer that specifies the minimum width of the returned photo. - * @param options.height - An integer that specifies the minimum height of the returned photo. - * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. - * - * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. - */ - getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; - - // <- $meteorCamera END - - /** - * A service that binds a scope variable to a Meteor Session variable. - * - * @param sessionKey - The name of the session variable - * @return An object with a single function bind - to bind to that variable. - */ - session(sessionKey: string): { - /** - * @param scope - The scope the document will be bound to. - * @param model - The name of the scope's model variable that the document will be bound to. - */ - bind: (scope: IScope, model: string) => void; - }; - } - - /** - * An object that connects a Meteor Object to an AngularJS scope variable. - * - * The object contains also all the properties from the generic type T, - * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). - * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: - * - * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } - * var todo = $meteor.object(TodoCollection, 'TodoID'); - */ - interface AngularMeteorObject { - /** - * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. - * - Unchanged properties will be overridden with their existing values, which may trigger hooks. - * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. - * - * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. - */ - save(doc?: T): angular.IPromise; - - /** - * Reset the current value of the object to the one in the server. - */ - reset(): void; - - /** - * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. - * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. - */ - getRawObject(): T; - - /** - * A shorten (Syntactic sugar) function for the $meteor.subscribe function. - * Takes only one parameter and not returns a promise like $meteor.subscribe does. - * - * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. - */ - subscribe(subscriptionName:string): AngularMeteorObject; - } - - /** - * An object that connects a Meteor Collection to an AngularJS scope variable - */ - interface AngularMeteorCollection extends AngularMeteorCollection2 { } - - /** - * An object that connects a Meteor Collection to an AngularJS scope variable, - * but can use a differen type for updates. - */ - interface AngularMeteorCollection2 extends Array { - /** - * @param [docs] - The docs to save to the Meteor Collection. - * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. - * - If an object is passed, the method pushes that object into the AngularMeteorCollection. - * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. - */ - save(docs?: U|U[]): void; - - /** - * @param [keys] - The keys of the object to remove from the Meteor Collection. - * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. - * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. - * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. - */ - remove(keys?: U|string|number|string[]|number[]): void; - - /** - * A shorten (Syntactic sugar) function for the $meteor.subscribe function. - * Takes only one parameter and not returns a promise like $meteor.subscribe does. - * - * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. - */ - subscribe(subscriptionName:string): AngularMeteorCollection2; - } - - interface ILoginWithExternalService { - (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; - } - - interface ReactiveResult { } -} +// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module) +// Project: https://github.com/Urigo/angular-meteor +// Definitions by: Peter Grman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.meteor { + interface IRootScopeService extends angular.IRootScopeService { + /** + * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. + */ + currentUser: Meteor.User; + + /** + * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. + * A reactive data source. Can be use to display animation while user is logging in. + */ + loggingIn: boolean; + } + + interface IScope extends angular.IScope, IRootScopeService { + /** + * A method to get a $scope variable and watch it reactivly + * + * @param scopeVariableName - The name of the scope's variable to bind to + * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower + */ + getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * The helpers method is part of the ReactiveContext, and available on every context and $scope. + * These method are defined as Object, where each key is the name of the variable that will be available on the context we run, and each value is a function with a return value. + * Under the hood, each helper starts a new Tracker.autorun. When its reactive dependencies change, the helper is rerun. + * To trigger a rerun every time an specific Angular variable change, use getReactively](/api/1.3.1/get-reactively) to make your Angular variable reactive inside the helper its used in. + * Each helper function should return a MongoDB Cursor and the helpers will expose it as a normal array to the context. + * + * @param definitions - Object containing `name` => `function` definition, where each name is a string and each function is the helper function. Should return a [MongoDB Cursor](http://docs.meteor.com/#/full/mongo_cursor) + * @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; + } + + /** + * $meteor in angularjs + */ + interface IMeteorService { + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + */ + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; + + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). + */ + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + + /** + * A service that wraps a Meteor object to enable reactivity within AngularJS. + * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne + * + * @param collection - A Meteor Collection to bind to. + * @param selector - A query describing the documents to find or just the ID of the document. + * - $meteor.object will find the first document that matches the selector, + * - as ordered by sort and skip options, exactly like Meteor's collection.findOne + * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. + */ + object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * A service service which wraps up Meteor.methods with AngularJS promises. + * + * @param name - Name of method to invoke + * @param methodArguments - Optional method arguments + * + * @return The promise solves successfully with the return value of the method or return reject with the error from the method. + */ + call(name: string, ...methodArguments: any[]): angular.IPromise; + + // User Authentication BEGIN -> + + /** + * Returns a promise fulfilled with the currentUser when the user subscription is ready. + * This is useful when you want to grab the current user before the route is rendered. + * If there is no logged in user, it will return null. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + waitForUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + requireUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + * + * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. + * If it returns a string, the promise will be rejected using said string as the reason. + * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. + */ + requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; + + /** + * Log the user in with a password. + * + * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. + * @param password - The user's password. + */ + loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; + + /** + * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser + * + * @param options.username - A unique name for this user. Either this, or email is required. + * @param options.email - The user's email address. Either this, or username is required. + * @param options.password - The user's password. This is not sent in plain text over the wire. + * @param options.profile - The user's profile, typically including the name field. + */ + createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; + + /** + * Change the current user's password. Must be logged in. + * + * @param oldPassword - The user's current password. This is not sent in plain text over the wire. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + changePassword(oldPassword: string, newPassword: string): angular.IPromise; + + /** + * Request a forgot password email. + * + * @param options.email - The email address to send a password reset link. + */ + forgotPassword(options: {email: string}): angular.IPromise; + + /** + * Reset the password for a user using a token received in email. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + resetPassword(token: string, newPassword: string): angular.IPromise; + + /** + * Marks the user's email address as verified. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + */ + verifyEmail(token: string): angular.IPromise; + + loginWithFacebook: ILoginWithExternalService; + loginWithTwitter: ILoginWithExternalService; + loginWithGoogle: ILoginWithExternalService; + loginWithGithub: ILoginWithExternalService; + loginWithMeetup: ILoginWithExternalService; + loginWithWeibo: ILoginWithExternalService; + + /** + * Log the user out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logout(): angular.IPromise; + + /** + * Log out other clients logged in as the current user, but does not log out the client that calls this function. + * For example, when called in a user's browser, connections in that browser remain logged in, + * but any other browsers or DDP clients logged in as that user will be logged out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logoutOtherClients(): angular.IPromise; + + // <- User Authentication END + // $meteorUtils BEGIN -> + + /** + * @param scope - The AngularJS scope you use the autorun on. + * @param fn - The function that will re-run every time a reactive variable changes inside it. + */ + autorun(scope: angular.IScope, fn: Function): void; + + /** + * @param collectionName - The name of the collection you want to get back + */ + getCollectionByName(collectionName: string): Mongo.Collection; + + // <- $meteorUtils END + // $meteorCamera BEGIN -> + + /** + * A helper service for taking pictures across platforms. + * Must add mdg:camera package to use! (meteor add mdg:camera) + * + * @param [options] - options is an optional argument that is an Object with the following possible keys: + * @param options.width - An integer that specifies the minimum width of the returned photo. + * @param options.height - An integer that specifies the minimum height of the returned photo. + * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. + * + * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. + */ + getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; + + // <- $meteorCamera END + + /** + * A service that binds a scope variable to a Meteor Session variable. + * + * @param sessionKey - The name of the session variable + * @return An object with a single function bind - to bind to that variable. + */ + session(sessionKey: string): { + /** + * @param scope - The scope the document will be bound to. + * @param model - The name of the scope's model variable that the document will be bound to. + */ + bind: (scope: IScope, model: string) => void; + }; + } + + /** + * An object that connects a Meteor Object to an AngularJS scope variable. + * + * The object contains also all the properties from the generic type T, + * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). + * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: + * + * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } + * var todo = $meteor.object(TodoCollection, 'TodoID'); + */ + interface AngularMeteorObject { + /** + * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. + * - Unchanged properties will be overridden with their existing values, which may trigger hooks. + * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. + * + * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. + */ + save(doc?: T): angular.IPromise; + + /** + * Reset the current value of the object to the one in the server. + */ + reset(): void; + + /** + * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. + * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. + */ + getRawObject(): T; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorObject; + } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable + */ + interface AngularMeteorCollection extends AngularMeteorCollection2 { } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable, + * but can use a differen type for updates. + */ + interface AngularMeteorCollection2 extends Array { + /** + * @param [docs] - The docs to save to the Meteor Collection. + * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. + * - If an object is passed, the method pushes that object into the AngularMeteorCollection. + * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. + */ + save(docs?: U|U[]): void; + + /** + * @param [keys] - The keys of the object to remove from the Meteor Collection. + * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. + * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. + * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. + */ + remove(keys?: U|string|number|string[]|number[]): void; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorCollection2; + } + + interface ILoginWithExternalService { + (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; + } + + interface ReactiveResult { } +} diff --git a/angularjs/README.md b/angularjs/README.md index e1256e905..cdd952454 100644 --- a/angularjs/README.md +++ b/angularjs/README.md @@ -1,230 +1,230 @@ -# AngularJS Definitions Usage Notes - -## Referencing AngularJS definition files in your code - -To do that, simply add `/// ` at the top of your code. - -That will make available to your code all interfaces AngularJS' main module **ng** implements, as well as the **AUTO** module. - -If you are including other AngularJS' modules in your code, like **ngResource**, just like you needed to include the additional module implementation file in your code, _angular-resource.js_, you will also need to reference the definitions file related to that module. Your code would then have the following definitions files reference: - - /// - /// - -Having these modules in separated files is actually good because they sometimes either augment or modify some of **ng**'s interfaces, and thus those differences should only be available to you when you really need them. Also, it forces you to explicit what you're going to be using. - -The following extra definition files are available for referencing: - -* angular-resource.d.ts (for the **ngResource** module) -* angular-route.d.ts (for the **ngRoute** module) -* angular-cookies.d.ts (for the **ngCookies** module) -* angular-sanitize.d.ts (for the **ngSanitize** module) -* angular-mocks.d.ts (for the **ngMock** and **ngMockE2E** modules) - -(postfix with version number for specific verion, eg. angular-resource-1.0.d.ts) - -## The Angular Static - -The definitions declare the AngularJS static variable `angular` as ambient. That means that, after referencing the AngularJS definition, you will be able to get type checks and code assistance for the global `angular` member. - - -## Definitions modularized - -To avoid cluttering the list of suggestions as you type in your IDE, all interfaces reside in their respective module namespace: - -* `ng` for AngularJS' **ng** module -* `ng.auto` for **AUTO** -* `ng.cookies` for **ngCookies** -* `ng.mock` for **ngMock** -* `ng.resource` for **ngResource** -* `ng.route` for **ngRoute** -* `ng.sanitize` for **ngSanitize** - -**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces. - -Below is an example of how to use the interfaces: -```ts -function MainController($scope: ng.IScope, $http: ng.IHttpService) { - // code assistance will now be available for $scope and $http -} -``` - -## Services and other injectables - -AngularJS makes vast use of what it calls "injectable" functions. To put it simple, in AngularJS you are constantly annotating your functions and constructors with their dependencies, services that are going to be provided as arguments automagically during invocation. - -All known services interfaces have been defined, and were named using the following convention: - -**I + 'ServiceName' + 'Service'** - -So, for instance, the **$parse** service has it's interface defined as **ng.IParseService**. - -Service providers, by the same logic, follow this convention: - -**I + 'ServiceName' + 'Provider'** - -The **$httpProvider**, thus, is defined by **ng.IHttpProvider**. - - -## A word on $scope and assigning new members - -TypeScript allows for static checking. Among other obvious things, that means you're gonna have to extend interfaces when you need to augment an object whose interface has been defined, because otherwise the compiler will see it as an error to try to assign a value to a unspecified member. - -Consider the following ordinary code: -```ts -function Controller($scope) { - $scope.$broadcast('myEvent'); - $scope.title = 'Yabadabadu'; -} -``` -That will not produce any compilation error because the compiler does not know the first thing about $scope to do any checking. For that same reason, you will not get any assistance either. - -Now consider this: -```ts -function Controller($scope: ng.IScope) { - $scope.$broadcast('myEvent'); - $scope.title = 'Yabadabadu'; -} -``` - -Now we annotated `$scope` with the interface `ng.IScope`. The compiler now knows that, among other members, `$scope` has a method called `$broadcast`. That interface, however, does not define a `title` property. The compiler will complain about it. - -Since you are augmenting the $scope object, you should let the compiler know what to expect then: -```ts -interface ICustomScope extends ng.IScope { - title: string; -} - -function Controller($scope: ICustomScope) { - $scope.$broadcast('myEvent'); - $scope.title = 'Yabadabadu'; -} -``` - -## Examples - -### Working with $resource -```ts -/// -/// - -// We have the option to define arguments for a custom resource -interface IArticleParameters { - id: number; -} - -interface IArticleResource extends ng.resource.IResource { - title: string; - text: string; - date: Date; - author: number; - - // Although all actions defined on IArticleResourceClass are avaiable with - // the '$' prefix, we have the choice to expose only what we will use - $publish(): IArticleResource; - $unpublish(): IArticleResource; -} - -// Let's define a custom resource -interface IArticleResourceClass extends ng.resource.IResourceClass { - // Overload get to accept our custom parameters - get(): ng.resource.IResource; - get(params: IArticleParameters, onSuccess: Function): IArticleResource; - - // Add our custom resource actions - publish(): IArticleResource; - publish(params: IArticleParameters): IArticleResource; - unpublish(params: IArticleParameters): IArticleResource; -} - -function MainController($resource: ng.resource.IResourceService) { - - // IntelliSense will provide IActionDescriptor interface and will validate - // your assignment against it - var publishDescriptor: ng.resource.IActionDescriptor; - publishDescriptor = { - method: 'GET', - isArray: false - }; - - // I could still create a descriptor without the interface... - var unpublishDescriptor = { - method: 'POST' - } - - // A call to the $resource service returns a IResourceClass. Since - // our own IArticleResourceClass defines 2 more actions, we cast the return - // value to make the compiler aware of that - var articleResource = $resource('/articles/:id', null, { - publish : publishDescriptor, - unpublish : unpublishDescriptor - }); - - // Now we can do this - articleResource.unpublish({ id: 1 }); - - // IResourceClass.get() will be automatically available here - var article: IArticleResource = articleResource.get({id: 1}, function success() { - // Again, default + custom action here... - article.title = 'New Title'; - article.$save(); - article.$publish(); - }); -} -``` - -### Working with $resource in angular-1.0 definitions -```ts -/// -/// - -// Let's define a custom resource -interface IArticleResourceClass extends ng.resource.IResourceClass { - publish: ng.resource.IActionCall; - unpublish: ng.resource.IActionCall; -} -interface IArticleResource extends ng.resource.IResource { - title: string; - text: string; - date: Date; - author: number; - $publish: ng.resource.IActionCall; - $unpublish: ng.resource.IActionCall; -} - -function MainController($resource: ng.resource.IResourceService) { - - // IntelliSense will provide IActionDescriptor interface and will validate - // your assignment against it - var publishDescriptor: ng.resource.IActionDescriptor; - publishDescriptor = { - method: 'GET', - isArray: false - }; - - // I could still create a descriptor without the interface... - var unpublishDescriptor = { - method: 'POST' - } - - // A call to the $resource service returns a IResourceClass. Since - // our own IArticleResourceClass defines 2 more actions, we cast the return - // value to make the compiler aware of that - var articles = $resource('/articles/:id', null, { - publish : publishDescriptor, - unpublish : unpublishDescriptor - }); - - // Now we can do this - articles.unpublish({ id: 1 }); - - // IResourceClass.get() will be automatically available here - var article = articles.get({id: 1}); - - // Again, default + custom action here... - article.title = 'New Title'; - article.$save(); - article.$publish(); - -} -``` +# AngularJS Definitions Usage Notes + +## Referencing AngularJS definition files in your code + +To do that, simply add `/// ` at the top of your code. + +That will make available to your code all interfaces AngularJS' main module **ng** implements, as well as the **AUTO** module. + +If you are including other AngularJS' modules in your code, like **ngResource**, just like you needed to include the additional module implementation file in your code, _angular-resource.js_, you will also need to reference the definitions file related to that module. Your code would then have the following definitions files reference: + + /// + /// + +Having these modules in separated files is actually good because they sometimes either augment or modify some of **ng**'s interfaces, and thus those differences should only be available to you when you really need them. Also, it forces you to explicit what you're going to be using. + +The following extra definition files are available for referencing: + +* angular-resource.d.ts (for the **ngResource** module) +* angular-route.d.ts (for the **ngRoute** module) +* angular-cookies.d.ts (for the **ngCookies** module) +* angular-sanitize.d.ts (for the **ngSanitize** module) +* angular-mocks.d.ts (for the **ngMock** and **ngMockE2E** modules) + +(postfix with version number for specific verion, eg. angular-resource-1.0.d.ts) + +## The Angular Static + +The definitions declare the AngularJS static variable `angular` as ambient. That means that, after referencing the AngularJS definition, you will be able to get type checks and code assistance for the global `angular` member. + + +## Definitions modularized + +To avoid cluttering the list of suggestions as you type in your IDE, all interfaces reside in their respective module namespace: + +* `ng` for AngularJS' **ng** module +* `ng.auto` for **AUTO** +* `ng.cookies` for **ngCookies** +* `ng.mock` for **ngMock** +* `ng.resource` for **ngResource** +* `ng.route` for **ngRoute** +* `ng.sanitize` for **ngSanitize** + +**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces. + +Below is an example of how to use the interfaces: +```ts +function MainController($scope: ng.IScope, $http: ng.IHttpService) { + // code assistance will now be available for $scope and $http +} +``` + +## Services and other injectables + +AngularJS makes vast use of what it calls "injectable" functions. To put it simple, in AngularJS you are constantly annotating your functions and constructors with their dependencies, services that are going to be provided as arguments automagically during invocation. + +All known services interfaces have been defined, and were named using the following convention: + +**I + 'ServiceName' + 'Service'** + +So, for instance, the **$parse** service has it's interface defined as **ng.IParseService**. + +Service providers, by the same logic, follow this convention: + +**I + 'ServiceName' + 'Provider'** + +The **$httpProvider**, thus, is defined by **ng.IHttpProvider**. + + +## A word on $scope and assigning new members + +TypeScript allows for static checking. Among other obvious things, that means you're gonna have to extend interfaces when you need to augment an object whose interface has been defined, because otherwise the compiler will see it as an error to try to assign a value to a unspecified member. + +Consider the following ordinary code: +```ts +function Controller($scope) { + $scope.$broadcast('myEvent'); + $scope.title = 'Yabadabadu'; +} +``` +That will not produce any compilation error because the compiler does not know the first thing about $scope to do any checking. For that same reason, you will not get any assistance either. + +Now consider this: +```ts +function Controller($scope: ng.IScope) { + $scope.$broadcast('myEvent'); + $scope.title = 'Yabadabadu'; +} +``` + +Now we annotated `$scope` with the interface `ng.IScope`. The compiler now knows that, among other members, `$scope` has a method called `$broadcast`. That interface, however, does not define a `title` property. The compiler will complain about it. + +Since you are augmenting the $scope object, you should let the compiler know what to expect then: +```ts +interface ICustomScope extends ng.IScope { + title: string; +} + +function Controller($scope: ICustomScope) { + $scope.$broadcast('myEvent'); + $scope.title = 'Yabadabadu'; +} +``` + +## Examples + +### Working with $resource +```ts +/// +/// + +// We have the option to define arguments for a custom resource +interface IArticleParameters { + id: number; +} + +interface IArticleResource extends ng.resource.IResource { + title: string; + text: string; + date: Date; + author: number; + + // Although all actions defined on IArticleResourceClass are avaiable with + // the '$' prefix, we have the choice to expose only what we will use + $publish(): IArticleResource; + $unpublish(): IArticleResource; +} + +// Let's define a custom resource +interface IArticleResourceClass extends ng.resource.IResourceClass { + // Overload get to accept our custom parameters + get(): ng.resource.IResource; + get(params: IArticleParameters, onSuccess: Function): IArticleResource; + + // Add our custom resource actions + publish(): IArticleResource; + publish(params: IArticleParameters): IArticleResource; + unpublish(params: IArticleParameters): IArticleResource; +} + +function MainController($resource: ng.resource.IResourceService) { + + // IntelliSense will provide IActionDescriptor interface and will validate + // your assignment against it + var publishDescriptor: ng.resource.IActionDescriptor; + publishDescriptor = { + method: 'GET', + isArray: false + }; + + // I could still create a descriptor without the interface... + var unpublishDescriptor = { + method: 'POST' + } + + // A call to the $resource service returns a IResourceClass. Since + // our own IArticleResourceClass defines 2 more actions, we cast the return + // value to make the compiler aware of that + var articleResource = $resource('/articles/:id', null, { + publish : publishDescriptor, + unpublish : unpublishDescriptor + }); + + // Now we can do this + articleResource.unpublish({ id: 1 }); + + // IResourceClass.get() will be automatically available here + var article: IArticleResource = articleResource.get({id: 1}, function success() { + // Again, default + custom action here... + article.title = 'New Title'; + article.$save(); + article.$publish(); + }); +} +``` + +### Working with $resource in angular-1.0 definitions +```ts +/// +/// + +// Let's define a custom resource +interface IArticleResourceClass extends ng.resource.IResourceClass { + publish: ng.resource.IActionCall; + unpublish: ng.resource.IActionCall; +} +interface IArticleResource extends ng.resource.IResource { + title: string; + text: string; + date: Date; + author: number; + $publish: ng.resource.IActionCall; + $unpublish: ng.resource.IActionCall; +} + +function MainController($resource: ng.resource.IResourceService) { + + // IntelliSense will provide IActionDescriptor interface and will validate + // your assignment against it + var publishDescriptor: ng.resource.IActionDescriptor; + publishDescriptor = { + method: 'GET', + isArray: false + }; + + // I could still create a descriptor without the interface... + var unpublishDescriptor = { + method: 'POST' + } + + // A call to the $resource service returns a IResourceClass. Since + // our own IArticleResourceClass defines 2 more actions, we cast the return + // value to make the compiler aware of that + var articles = $resource('/articles/:id', null, { + publish : publishDescriptor, + unpublish : unpublishDescriptor + }); + + // Now we can do this + articles.unpublish({ id: 1 }); + + // IResourceClass.get() will be automatically available here + var article = articles.get({id: 1}); + + // Again, default + custom action here... + article.title = 'New Title'; + article.$save(); + article.$publish(); + +} +``` diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 25efc42de..3a5f53504 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -1,91 +1,91 @@ -// Type definitions for Angular JS 1.4 (ngCookies module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar , Anthony Ciccarello -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -declare module "angular-cookies" { - var _: string; - export = _; -} - -/** - * ngCookies module (angular-cookies.js) - */ -declare module angular.cookies { - - /** - * Cookies options - * see https://docs.angularjs.org/api/ngCookies/provider/$cookiesProvider#defaults - */ - interface ICookiesOptions { - /** - * The cookie will be available only for this path and its sub-paths. - * By default, this would be the URL that appears in your base tag. - */ - path?: string; - /** - * The cookie will be available only for this domain and its sub-domains. - * For obvious security reasons the user agent will not accept the cookie if the - * current domain is not a sub domain or equals to the requested domain. - */ - domain?: string; - /** - * String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object - * indicating the exact date/time this cookie will expire. - */ - expires?: string|Date; - /** - * The cookie will be available only in secured connection. - */ - secure?: boolean; - } - - /** - * CookieService - * see http://docs.angularjs.org/api/ngCookies.$cookies - */ - interface ICookiesService { - [index: string]: any; - } - - /** - * CookieStoreService - * see http://docs.angularjs.org/api/ngCookies.$cookieStore - */ - interface ICookiesService { - get(key: string): string; - getObject(key: string): any; - getObject(key: string): T; - getAll(): any; - put(key: string, value: string, options?: ICookiesOptions): void; - putObject(key: string, value: any, options?: ICookiesOptions): void; - remove(key: string, options?: ICookiesOptions): void; - } - - /** - * CookieStoreService DEPRECATED - * see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookieStore - */ - interface ICookieStoreService { - /** - * Returns the value of given cookie key - * @param key Id to use for lookup - */ - get(key: string): any; - /** - * Sets a value for given cookie key - * @param key Id for the value - * @param value Value to be stored - */ - put(key: string, value: any): void; - /** - * Remove given cookie - * @param key Id of the key-value pair to delete - */ - remove(key: string): void; - } - -} +// Type definitions for Angular JS 1.4 (ngCookies module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar , Anthony Ciccarello +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module "angular-cookies" { + var _: string; + export = _; +} + +/** + * ngCookies module (angular-cookies.js) + */ +declare module angular.cookies { + + /** + * Cookies options + * see https://docs.angularjs.org/api/ngCookies/provider/$cookiesProvider#defaults + */ + interface ICookiesOptions { + /** + * The cookie will be available only for this path and its sub-paths. + * By default, this would be the URL that appears in your base tag. + */ + path?: string; + /** + * The cookie will be available only for this domain and its sub-domains. + * For obvious security reasons the user agent will not accept the cookie if the + * current domain is not a sub domain or equals to the requested domain. + */ + domain?: string; + /** + * String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" or a Date object + * indicating the exact date/time this cookie will expire. + */ + expires?: string|Date; + /** + * The cookie will be available only in secured connection. + */ + secure?: boolean; + } + + /** + * CookieService + * see http://docs.angularjs.org/api/ngCookies.$cookies + */ + interface ICookiesService { + [index: string]: any; + } + + /** + * CookieStoreService + * see http://docs.angularjs.org/api/ngCookies.$cookieStore + */ + interface ICookiesService { + get(key: string): string; + getObject(key: string): any; + getObject(key: string): T; + getAll(): any; + put(key: string, value: string, options?: ICookiesOptions): void; + putObject(key: string, value: any, options?: ICookiesOptions): void; + remove(key: string, options?: ICookiesOptions): void; + } + + /** + * CookieStoreService DEPRECATED + * see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookieStore + */ + interface ICookieStoreService { + /** + * Returns the value of given cookie key + * @param key Id to use for lookup + */ + get(key: string): any; + /** + * Sets a value for given cookie key + * @param key Id for the value + * @param value Value to be stored + */ + put(key: string, value: any): void; + /** + * Remove given cookie + * @param key Id of the key-value pair to delete + */ + remove(key: string): void; + } + +} diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index d94337273..311388186 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -1,318 +1,318 @@ -// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar , Tony Curtis -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "angular-mocks/ngMock" { - var _: string; - export = _; -} - -declare module "angular-mocks/ngMockE2E" { - var _: string; - export = _; -} - -declare module "angular-mocks/ngAnimateMock" { - var _: string; - export = _; -} - -/////////////////////////////////////////////////////////////////////////////// -// ngMock module (angular-mocks.js) -/////////////////////////////////////////////////////////////////////////////// -declare module angular { - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // We reopen it to add the MockStatic definition - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - mock: IMockStatic; - } - - // see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject - interface IInjectStatic { - (...fns: Function[]): any; - (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works - strictDi(val?: boolean): void; - } - - interface IMockStatic { - // see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump - dump(obj: any): string; - - inject: IInjectStatic - - // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module - module(...modules: any[]): any; - - // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate - TzDate(offset: number, timestamp: number): Date; - TzDate(offset: number, timestamp: string): Date; - } - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler - // see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerProvider extends IServiceProvider { - mode(mode: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see https://docs.angularjs.org/api/ngMock/service/$timeout - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - flush(delay?: number): void; - flushNext(expectedDelay?: number): void; - verifyNoPendingTasks(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // IntervalService - // see https://docs.angularjs.org/api/ngMock/service/$interval - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface IIntervalService { - flush(millis?: number): number; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see https://docs.angularjs.org/api/ngMock/service/$log - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - assertEmpty(): void; - reset(): void; - } - - interface ILogCall { - logs: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see https://docs.angularjs.org/api/ngMock/service/$httpBackend - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - /** - * Flushes all pending requests using the trained responses. - * @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed. - */ - flush(count?: number): void; - - /** - * Resets all request expectations, but preserves all backend definitions. - */ - resetExpectations(): void; - - /** - * Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception. - */ - verifyNoOutstandingExpectation(): void; - - /** - * Verifies that there are no outstanding requests that need to be flushed. - */ - verifyNoOutstandingRequest(): void; - - /** - * Creates a new request expectation. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param method HTTP method. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler; - - /** - * Creates a new request expectation for DELETE requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - */ - expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; - - /** - * Creates a new request expectation for GET requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - */ - expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; - - /** - * Creates a new request expectation for HEAD requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object to be compared with the HTTP headers in the request. - */ - expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; - - /** - * Creates a new request expectation for JSONP requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - */ - expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; - - /** - * Creates a new request expectation for PATCH requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; - - /** - * Creates a new request expectation for POST requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; - - /** - * Creates a new request expectation for PUT requests. - * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; - - /** - * Creates a new backend definition. - * Returns an object with respond method that controls how a matched request is handled. - * @param method HTTP method. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for DELETE requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for GET requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for HEAD requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for JSONP requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for PATCH requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for POST requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - - /** - * Creates a new backend definition for PUT requests. - * Returns an object with respond method that controls how a matched request is handled. - * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. - * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. - * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. - */ - whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; - } - - export module mock { - // returned interface by the the mocked HttpBackendService expect/when methods - interface IRequestHandler { - - /** - * Controls the response for a matched request using a function to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text. - */ - respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler; - - /** - * Controls the response for a matched request using supplied static data to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param status HTTP status code to add to the response. - * @param data Data to add to the response. - * @param headers Headers object to add to the response. - * @param responseText Response text to add to the response. - */ - respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler; - - /** - * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response. - * Returns the RequestHandler object for possible overrides. - * @param data Data to add to the response. - * @param headers Headers object to add to the response. - * @param responseText Response text to add to the response. - */ - respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler; - - // Available when ngMockE2E is loaded - /** - * Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.) - */ - passThrough(): IRequestHandler; - } - - } - -} - -/////////////////////////////////////////////////////////////////////////////// -// functions attached to global object (window) -/////////////////////////////////////////////////////////////////////////////// -//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs. -//declare var module: (...modules: any[]) => any; -declare var inject: angular.IInjectStatic; +// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar , Tony Curtis +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "angular-mocks/ngMock" { + var _: string; + export = _; +} + +declare module "angular-mocks/ngMockE2E" { + var _: string; + export = _; +} + +declare module "angular-mocks/ngAnimateMock" { + var _: string; + export = _; +} + +/////////////////////////////////////////////////////////////////////////////// +// ngMock module (angular-mocks.js) +/////////////////////////////////////////////////////////////////////////////// +declare module angular { + + /////////////////////////////////////////////////////////////////////////// + // AngularStatic + // We reopen it to add the MockStatic definition + /////////////////////////////////////////////////////////////////////////// + interface IAngularStatic { + mock: IMockStatic; + } + + // see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject + interface IInjectStatic { + (...fns: Function[]): any; + (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + strictDi(val?: boolean): void; + } + + interface IMockStatic { + // see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump + dump(obj: any): string; + + inject: IInjectStatic + + // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module + module(...modules: any[]): any; + + // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate + TzDate(offset: number, timestamp: number): Date; + TzDate(offset: number, timestamp: string): Date; + } + + /////////////////////////////////////////////////////////////////////////// + // ExceptionHandlerService + // see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler + // see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider + /////////////////////////////////////////////////////////////////////////// + interface IExceptionHandlerProvider extends IServiceProvider { + mode(mode: string): void; + } + + /////////////////////////////////////////////////////////////////////////// + // TimeoutService + // see https://docs.angularjs.org/api/ngMock/service/$timeout + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface ITimeoutService { + flush(delay?: number): void; + flushNext(expectedDelay?: number): void; + verifyNoPendingTasks(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // IntervalService + // see https://docs.angularjs.org/api/ngMock/service/$interval + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface IIntervalService { + flush(millis?: number): number; + } + + /////////////////////////////////////////////////////////////////////////// + // LogService + // see https://docs.angularjs.org/api/ngMock/service/$log + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface ILogService { + assertEmpty(): void; + reset(): void; + } + + interface ILogCall { + logs: string[]; + } + + /////////////////////////////////////////////////////////////////////////// + // HttpBackendService + // see https://docs.angularjs.org/api/ngMock/service/$httpBackend + /////////////////////////////////////////////////////////////////////////// + interface IHttpBackendService { + /** + * Flushes all pending requests using the trained responses. + * @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed. + */ + flush(count?: number): void; + + /** + * Resets all request expectations, but preserves all backend definitions. + */ + resetExpectations(): void; + + /** + * Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception. + */ + verifyNoOutstandingExpectation(): void; + + /** + * Verifies that there are no outstanding requests that need to be flushed. + */ + verifyNoOutstandingRequest(): void; + + /** + * Creates a new request expectation. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param method HTTP method. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler; + + /** + * Creates a new request expectation for DELETE requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected. + * @param headers HTTP headers object to be compared with the HTTP headers in the request. + */ + expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; + + /** + * Creates a new request expectation for GET requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object to be compared with the HTTP headers in the request. + */ + expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; + + /** + * Creates a new request expectation for HEAD requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object to be compared with the HTTP headers in the request. + */ + expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler; + + /** + * Creates a new request expectation for JSONP requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + */ + expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; + + /** + * Creates a new request expectation for PATCH requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; + + /** + * Creates a new request expectation for POST requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; + + /** + * Creates a new request expectation for PUT requests. + * Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler; + + /** + * Creates a new backend definition. + * Returns an object with respond method that controls how a matched request is handled. + * @param method HTTP method. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for DELETE requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for GET requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for HEAD requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for JSONP requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for PATCH requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for POST requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + + /** + * Creates a new backend definition for PUT requests. + * Returns an object with respond method that controls how a matched request is handled. + * @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation. + * @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation. + * @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation. + */ + whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler; + } + + export module mock { + // returned interface by the the mocked HttpBackendService expect/when methods + interface IRequestHandler { + + /** + * Controls the response for a matched request using a function to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text. + */ + respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler; + + /** + * Controls the response for a matched request using supplied static data to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param status HTTP status code to add to the response. + * @param data Data to add to the response. + * @param headers Headers object to add to the response. + * @param responseText Response text to add to the response. + */ + respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler; + + /** + * Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response. + * Returns the RequestHandler object for possible overrides. + * @param data Data to add to the response. + * @param headers Headers object to add to the response. + * @param responseText Response text to add to the response. + */ + respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler; + + // Available when ngMockE2E is loaded + /** + * Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.) + */ + passThrough(): IRequestHandler; + } + + } + +} + +/////////////////////////////////////////////////////////////////////////////// +// functions attached to global object (window) +/////////////////////////////////////////////////////////////////////////////// +//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs. +//declare var module: (...modules: any[]) => any; +declare var inject: angular.IInjectStatic; diff --git a/angularjs/angular-sanitize.d.ts b/angularjs/angular-sanitize.d.ts index c8ab8e266..d5d541f4e 100644 --- a/angularjs/angular-sanitize.d.ts +++ b/angularjs/angular-sanitize.d.ts @@ -1,40 +1,40 @@ -// Type definitions for Angular JS 1.3 (ngSanitize module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -declare module "angular-sanitize" { - var _: string; - export = _; -} - -/////////////////////////////////////////////////////////////////////////////// -// ngSanitize module (angular-sanitize.js) -/////////////////////////////////////////////////////////////////////////////// -declare module angular.sanitize { - - /////////////////////////////////////////////////////////////////////////// - // SanitizeService - // see http://docs.angularjs.org/api/ngSanitize.$sanitize - /////////////////////////////////////////////////////////////////////////// - interface ISanitizeService { - (html: string): string; - } - - /////////////////////////////////////////////////////////////////////////// - // Filters included with the ngSanitize - // see https://github.com/angular/angular.js/tree/v1.2.0/src/ngSanitize/filter - /////////////////////////////////////////////////////////////////////////// - export module filter { - - // Finds links in text input and turns them into html links. - // Supports http/https/ftp/mailto and plain email address links. - // see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky - interface ILinky { - (text: string, target?: string): string; - } - } -} +// Type definitions for Angular JS 1.3 (ngSanitize module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module "angular-sanitize" { + var _: string; + export = _; +} + +/////////////////////////////////////////////////////////////////////////////// +// ngSanitize module (angular-sanitize.js) +/////////////////////////////////////////////////////////////////////////////// +declare module angular.sanitize { + + /////////////////////////////////////////////////////////////////////////// + // SanitizeService + // see http://docs.angularjs.org/api/ngSanitize.$sanitize + /////////////////////////////////////////////////////////////////////////// + interface ISanitizeService { + (html: string): string; + } + + /////////////////////////////////////////////////////////////////////////// + // Filters included with the ngSanitize + // see https://github.com/angular/angular.js/tree/v1.2.0/src/ngSanitize/filter + /////////////////////////////////////////////////////////////////////////// + export module filter { + + // Finds links in text input and turns them into html links. + // Supports http/https/ftp/mailto and plain email address links. + // see http://code.angularjs.org/1.2.0/docs/api/ngSanitize.filter:linky + interface ILinky { + (text: string, target?: string): string; + } + } +} diff --git a/angularjs/legacy/angular-1.0-tests.ts.tscparams b/angularjs/legacy/angular-1.0-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/angularjs/legacy/angular-1.0-tests.ts.tscparams +++ b/angularjs/legacy/angular-1.0-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams b/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams +++ b/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/ansicolors/ansicolors.d.ts b/ansicolors/ansicolors.d.ts index 2f61b0435..ec5f0af85 100644 --- a/ansicolors/ansicolors.d.ts +++ b/ansicolors/ansicolors.d.ts @@ -1,9 +1,9 @@ -// Type definitions for ansicolors -// Project: https://github.com/thlorenz/ansicolors -// Definitions by: rogierschouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module "ansicolors" { - var colors: {[index: string]: (s: string) => string;}; - export = colors; -} +// Type definitions for ansicolors +// Project: https://github.com/thlorenz/ansicolors +// Definitions by: rogierschouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "ansicolors" { + var colors: {[index: string]: (s: string) => string;}; + export = colors; +} diff --git a/any-db-transaction/any-db-transaction-tests.ts b/any-db-transaction/any-db-transaction-tests.ts index 55ca53bdc..8e38fe5a3 100644 --- a/any-db-transaction/any-db-transaction-tests.ts +++ b/any-db-transaction/any-db-transaction-tests.ts @@ -1,29 +1,29 @@ - -/// -/// - -"use strict"; - -import anyDB = require("any-db"); -import begin = require("any-db-transaction"); - -var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb"); - - -var transaction = begin(conn); -var transaction2 = begin(transaction); - -begin(conn, { autoRollback: true }); -begin(conn, (error: Error, result: begin.Transaction): void => { -}); - -transaction.query("SELECT * FROM MyTable"); - -transaction.commit(); -transaction.commit((error: Error): void => { -}); - -transaction.rollback(); -transaction.rollback((error: Error): void => { -}); - + +/// +/// + +"use strict"; + +import anyDB = require("any-db"); +import begin = require("any-db-transaction"); + +var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb"); + + +var transaction = begin(conn); +var transaction2 = begin(transaction); + +begin(conn, { autoRollback: true }); +begin(conn, (error: Error, result: begin.Transaction): void => { +}); + +transaction.query("SELECT * FROM MyTable"); + +transaction.commit(); +transaction.commit((error: Error): void => { +}); + +transaction.rollback(); +transaction.rollback((error: Error): void => { +}); + diff --git a/any-db-transaction/any-db-transaction.d.ts b/any-db-transaction/any-db-transaction.d.ts index ca5bc84b0..8b4bccfaf 100644 --- a/any-db-transaction/any-db-transaction.d.ts +++ b/any-db-transaction/any-db-transaction.d.ts @@ -1,94 +1,94 @@ -// Type definitions for any-db-transaction 2.2.1 -// Project: https://github.com/grncdr/node-any-db-transaction -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -/// - -declare module "any-db-transaction" { - import anyDB = require("any-db"); - - module begin { - /** - * Transaction objects are are simple wrappers around a Connection that also implement the Queryable API, - * but guarantee that all queries take place within a single database transaction or not at all. Note that - * begin also understands how to acquire (and release) a connection from a ConnectionPool as well, so you - * can simply pass a pool to it: var tx = begin(pool) - * - * By default, any queries that error during a transaction will cause an automatic rollback. If a query has - * no callback, the transaction will also handle (and re-emit) 'error' events for the Query instance. - * This enables handling errors for an entire transaction in a single place. - * - * Transactions may also be nested by passing a Transaction to begin and these nested transactions can - * safely error and rollback without rolling back their parent transaction - * - * Transaction events: - * 'query', query - emitted immediately after .query is called on a connection via tx.query. The argument is a query object. - * 'commit:start' - Emitted when .commit() is called. - * 'commit:complete' - Emitted after the transaction has committed. - * 'rollback:start' - Emitted when .rollback() is called. - * 'rollback:complete' - Emitted after the transaction has rolled back. - * 'close' - Emitted after rollback or commit completes. - * 'error', err - Emitted under three conditions: - * There was an error acquiring a connection. - * Any query performed in this transaction emits an error that would otherwise go unhandled. - * Any of query, begin, commit, or rollback are called after the connection has already been committed or rolled back. - * Note that the 'error' event may be emitted multiple times! depending on the callback you are registering, you way want to wrap it using [once][]. - */ - interface Transaction extends anyDB.Queryable { - - /** - * Issue a COMMIT (or RELEASE ... in the case of nested transactions) statement to the database. - * If a continuation is provided it will be called (possibly with an error) after the COMMIT - * statement completes. The transaction object itself will be unusable after calling commit(). - */ - commit(callback?: (error: Error) => void): void; - - /** - * The same as Transaction.commit but issues a ROLLBACK. Again, the transaction will be unusable after calling this method. - */ - rollback(callback?: (error: Error) => void): void; - } - - interface TransactionOptions { - /** - * Adapter name e.g. 'mysql' - */ - adapter?: anyDB.Adapter; - /** - * SQL statement for beginning a transaction, default 'BEGIN' - */ - begin?: string; - /** - * SQL statement for committing a transaction, default 'COMMIT' - */ - commit?: string; - /** - * SQL statement for rolling back a transaction, default 'ROLLBACK' - */ - rollback?: string; - /** - * Callback for transaction - */ - callback?: (error: Error, transaction: Transaction) => void; - /** - * Rollback automatically on error, default true - */ - autoRollback?: boolean; - } - } - - /** - * Start a transaction - */ - function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; - function begin(q: anyDB.Queryable, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; - function begin(q: anyDB.Queryable, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; - function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; - - export = begin; -} - - - +// Type definitions for any-db-transaction 2.2.1 +// Project: https://github.com/grncdr/node-any-db-transaction +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "any-db-transaction" { + import anyDB = require("any-db"); + + module begin { + /** + * Transaction objects are are simple wrappers around a Connection that also implement the Queryable API, + * but guarantee that all queries take place within a single database transaction or not at all. Note that + * begin also understands how to acquire (and release) a connection from a ConnectionPool as well, so you + * can simply pass a pool to it: var tx = begin(pool) + * + * By default, any queries that error during a transaction will cause an automatic rollback. If a query has + * no callback, the transaction will also handle (and re-emit) 'error' events for the Query instance. + * This enables handling errors for an entire transaction in a single place. + * + * Transactions may also be nested by passing a Transaction to begin and these nested transactions can + * safely error and rollback without rolling back their parent transaction + * + * Transaction events: + * 'query', query - emitted immediately after .query is called on a connection via tx.query. The argument is a query object. + * 'commit:start' - Emitted when .commit() is called. + * 'commit:complete' - Emitted after the transaction has committed. + * 'rollback:start' - Emitted when .rollback() is called. + * 'rollback:complete' - Emitted after the transaction has rolled back. + * 'close' - Emitted after rollback or commit completes. + * 'error', err - Emitted under three conditions: + * There was an error acquiring a connection. + * Any query performed in this transaction emits an error that would otherwise go unhandled. + * Any of query, begin, commit, or rollback are called after the connection has already been committed or rolled back. + * Note that the 'error' event may be emitted multiple times! depending on the callback you are registering, you way want to wrap it using [once][]. + */ + interface Transaction extends anyDB.Queryable { + + /** + * Issue a COMMIT (or RELEASE ... in the case of nested transactions) statement to the database. + * If a continuation is provided it will be called (possibly with an error) after the COMMIT + * statement completes. The transaction object itself will be unusable after calling commit(). + */ + commit(callback?: (error: Error) => void): void; + + /** + * The same as Transaction.commit but issues a ROLLBACK. Again, the transaction will be unusable after calling this method. + */ + rollback(callback?: (error: Error) => void): void; + } + + interface TransactionOptions { + /** + * Adapter name e.g. 'mysql' + */ + adapter?: anyDB.Adapter; + /** + * SQL statement for beginning a transaction, default 'BEGIN' + */ + begin?: string; + /** + * SQL statement for committing a transaction, default 'COMMIT' + */ + commit?: string; + /** + * SQL statement for rolling back a transaction, default 'ROLLBACK' + */ + rollback?: string; + /** + * Callback for transaction + */ + callback?: (error: Error, transaction: Transaction) => void; + /** + * Rollback automatically on error, default true + */ + autoRollback?: boolean; + } + } + + /** + * Start a transaction + */ + function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; + function begin(q: anyDB.Queryable, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; + function begin(q: anyDB.Queryable, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; + function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction; + + export = begin; +} + + + diff --git a/any-db/any-db-tests.ts b/any-db/any-db-tests.ts index 15dc6c7e6..41744c452 100644 --- a/any-db/any-db-tests.ts +++ b/any-db/any-db-tests.ts @@ -1,38 +1,38 @@ - -/// - -"use strict"; - -import anyDB = require("any-db"); - -var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb"); -var sql: string = "SELECT * FROM questions"; - -conn.query(sql, [1, "boo"]); - -conn.query(sql).on("data", (row: Object[]): void => { -// nothing -}); - -conn.query(sql, [1, "s"], (error: Error, result: anyDB.ResultSet): void => { - result.rows.length; - result.fields.length; -}); - -conn.end(); - - -var poolConfig: anyDB.PoolConfig = { - min: 1, - max: 200 -}; - -var pool: anyDB.ConnectionPool = anyDB.createPool("mysql://user:password@localhost/testdb", poolConfig); - -pool.query(sql).on("data", (row: Object[]): void => { -// nothing -}); - -pool.close((error: Error): void => { -}); - + +/// + +"use strict"; + +import anyDB = require("any-db"); + +var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb"); +var sql: string = "SELECT * FROM questions"; + +conn.query(sql, [1, "boo"]); + +conn.query(sql).on("data", (row: Object[]): void => { +// nothing +}); + +conn.query(sql, [1, "s"], (error: Error, result: anyDB.ResultSet): void => { + result.rows.length; + result.fields.length; +}); + +conn.end(); + + +var poolConfig: anyDB.PoolConfig = { + min: 1, + max: 200 +}; + +var pool: anyDB.ConnectionPool = anyDB.createPool("mysql://user:password@localhost/testdb", poolConfig); + +pool.query(sql).on("data", (row: Object[]): void => { +// nothing +}); + +pool.close((error: Error): void => { +}); + diff --git a/any-db/any-db.d.ts b/any-db/any-db.d.ts index f14befb20..8bdd9d706 100644 --- a/any-db/any-db.d.ts +++ b/any-db/any-db.d.ts @@ -1,303 +1,303 @@ -// Type definitions for any-db 2.1.0 -// Project: https://github.com/grncdr/node-any-db -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "any-db" { - import events = require("events"); - import stream = require("stream"); - - export interface ConnectOpts { - adapter: string; - } - - export interface Adapter { - name: string; - /** - * Create a new connection object. In common usage, config will be created by parse-db-url and passed to the adapter by any-db. - * If a continuation is given, it must be called, either with an error or the established connection. - */ - createConnection(opts: ConnectOpts, callback?: (error: Error, result: Connection) => void): Connection; - - /** - * Create a Query that may eventually be executed later on by a Connection. While this function is rarely needed by user code, - * it makes it possible for ConnectionPool.query and Transaction.query to fulfill the Queryable.query contract - * by synchronously returning a Query stream - */ - createQuery(text: string, params?: any[], callback?: (error: Error, result: ResultSet) => void): Query; - createQuery(query: Query): Query; - } - /** - * Other properties are driver specific - */ - export interface Field { - name: string; - } - - /** - * ResultSet objects are just plain data that collect results of a query when a continuation - * is provided to Queryable.query. The lastInsertId is optional, and currently supported by - * sqlite3 and mysql but not postgres, because it is not supported by Postgres itself. - */ - export interface ResultSet { - /** - * Affected rows. Note e.g. for INSERT queries the rows property is not filled even - * though rowCount is non-zero. - */ - rowCount: number; - /** - * Result rows - */ - rows: any[]; - /** - * Result field descriptions - */ - fields: Field[]; - - /** - * Not supported by all drivers. - */ - fieldCount?: number; - /** - * Not supported by all drivers. - */ - lastInsertId?: any; - /** - * Not supported by all drivers. - */ - affectedRows?: number; - /** - * Not supported by all drivers. - */ - changedRows?: number; - } - - /** - * Query objects are returned by the Queryable.query method, available on connections, - * pools, and transactions. Queries are instances of Readable, and as such can be piped - * through transforms and support backpressure for more efficient memory-usage on very - * large results sets. (Note: at this time the sqlite3 driver does not support backpressure) - * - * Internally, Query instances are created by a database Adapter and may have more methods, - * properties, and events than are described here. Consult the documentation for your - * specific adapter to find out about any extensions. - * - * Events: - * - * Error event - * The 'error' event is emitted at most once per query. Note that this event will be - * emitted for errors even if a callback was provided, the callback will - * simply be subscribed to the 'error' event. - * One argument is passed to event listeners: - * error - the error object. - * - * Fields event - * A 'fields' event is emmitted before any 'data' events. - * One argument is passed to event listeners: - * fields - an array of [Field][ResultSet] objects. - * - * The following events are part of the stream.Readable interface which is implemented by Query: - * - * Data event - * A 'data' event is emitted for each row in the query result set. - * One argument is passed to event listeners: - * row contains the contents of a single row in the query result - * - * Close event - * A 'close' event is emitted when the query completes. - * No arguments are passed to event listeners. - * - * End event - * An 'end' event is emitted after all query results have been consumed. - * No arguments are passed to event listeners. - */ - export interface Query extends stream.Readable { - /** - * The SQL query as a string. If you are using MySQL this will contain - * interpolated values after the query has been enqueued by a connection. - */ - text: string; - - /** - * The array of parameter values. - */ - values: any[]; - - /** - * The callback (if any) that was provided to Queryable.query. Note that - * Query objects must not use a closed over reference to their callback, - * as other any-db libraries may rely on modifying the callback property - * of a Query they did not create. - */ - callback: (error: Error, results: ResultSet) => void; - } - - /** - * Events: - * The 'query' event is emitted immediately before a query is executed. One argument is passed to event handlers: - * - query: a Query object - */ - export interface Queryable extends events.EventEmitter { - /** - * The Adapter instance that will be used by this Queryable for creating Query instances and/or connections. - */ - adapter: Adapter; - - /** - * Execute a SQL statement using bound parameters (if they are provided) and return a Query object - * that is a Readable stream of the resulting rows. If a Continuation is provided the rows - * returned by the database will be aggregated into a [ResultSet][] which will be passed to the - * continuation after the query has completed. - * The second form is not needed for normal use, but must be implemented by adapters to work correctly - * with ConnectionPool and Transaction. See Adapter.createQuery for more details. - */ - query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query - - /** - * The second form is not needed for normal use, but must be implemented by adapters to work correctly - * with ConnectionPool and Transaction. See Adapter.createQuery for more details. - */ - // query(query: Query): Query; - } - - /** - * Connection objects are obtained using createConnection from Any-DB or ConnectionPool.acquire, - * both of which delegate to the createConnection implementation of the specified adapter. - * While all Connection objects implement the Queryable interface, the implementations in - * each adapter may add additional methods or emit additional events. If you need to access a - * feature of your database that is not described here (such as Postgres' server-side prepared - * statements), consult the documentation for your adapter. - * - * Events: - * Error event - * The 'error' event is emitted when there is a connection-level error. - * No arguments are passed to event listeners. - * - * Open event - * The 'open' event is emitted when the connection has been established and is ready to query. - * No arguments are passed to event listeners. - * - * Close event - * The 'close' event is emitted when the connection has been closed. - * No arguments are passed to event listeners. - */ - export interface Connection extends Queryable { - /** - * Close the database connection. If a continuation is provided it - * will be called after the connection has closed. - */ - end(callback?: (error: Error) => void): void; - } - - export interface ConnectionStatic { - new(): Connection; - - name: string; - createConnection(): void; - createPool(): void; - } - - /** - * ConnectionPool events - * 'acquire' - emitted whenever pool.acquire is called - * 'release' - emitted whenever pool.release is called - * 'query', query - emitted immediately after .query is called on a - * connection via pool.query. The argument is a Query object. - * 'close' - emitted when the connection pool has closed all of it - * connections after a call to close(). - */ - export interface ConnectionPool extends Queryable { - /** - * Implements Queryable.query by automatically acquiring a connection - * and releasing it when the query completes. - */ - query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query; - - /** - * Remove a connection from the pool. If you use this method you must - * return the connection back to the pool using ConnectionPool.release - */ - acquire(callback: (error: Error, result: Connection) => void): void; - - /** - * Return a connection to the pool. This should only be called with connections - * you've manually acquired. You must not continue to use the connection after releasing it. - */ - release(connection: Connection): void; - - /** - * Stop giving out new connections, and close all existing database connections as they - * are returned to the pool. - */ - close(callback?: (error: Error) => void): void; - } - - /** - * A PoolConfig is generally a plain object with any of the following properties (they are all optional): - */ - export interface PoolConfig { - /** - * min (default 0) The minimum number of connections to keep open in the pool. - */ - min?: number; - /** - * max (default 10) The maximum number of connections to keep open in the pool. - * When this limit is reached further requests for connections will queue waiting - * for an existing connection to be released back into the pool. - */ - max?: number; - /** - * (default 30000) The maximum amount of time a connection can sit idle in the pool before being reaped - */ - idleTimeout?: number; - /** - * (default 1000) How frequently the pool should check for connections that are old enough to be reaped. - */ - reapInterval?: number; - /** - * (default true) When this is true, the pool will reap connections that - * have been idle for more than idleTimeout milliseconds. - */ - refreshIdle?: boolean; - /** - * Called immediately after a connection is first established. Use this to do one-time setup of new connections. - * The supplied Connection will not be added to the pool until you pass it to the done continuation. - */ - onConnect?: (connection: Connection, ready: (error: Error, result: Connection) => void) => void; - /** - * Called each time a connection is returned to the pool. Use this to restore a connection to - * it's original state (e.g. rollback transactions, set the database session vars). If reset - * fails to call the done continuation the connection will be lost in limbo. - */ - reset?: (connection: Connection, done: (error: Error) => void) => void; - /** - * (default function (err) { return true }) - Called when an error is encountered - * by pool.query or emitted by an idle connection. If shouldDestroyConnection(error) - * is truthy the connection will be destroyed, otherwise it will be reset. - */ - shouldDestroyConnection?: (error: Error) => boolean; - } - - /** - * Create a database connection. - * @param url String of the form adapter://user:password@host/database - * @param callback - * @returns Connection object. - */ - export function createConnection(url: string, callback?: (error: Error, connection: Connection) => void): Connection; - - /** - * Create a database connection. - * @param opts Object with adapter name and any properties that the given adapter requires - * @param callback - * @returns Connection object. - */ - export function createConnection(opts: ConnectOpts, callback?: (error: Error, connection: Connection) => void): Connection; - - - export function createPool(url: string, config: PoolConfig): ConnectionPool; - export function createPool(opts: ConnectOpts, config: PoolConfig): ConnectionPool; - -} +// Type definitions for any-db 2.1.0 +// Project: https://github.com/grncdr/node-any-db +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "any-db" { + import events = require("events"); + import stream = require("stream"); + + export interface ConnectOpts { + adapter: string; + } + + export interface Adapter { + name: string; + /** + * Create a new connection object. In common usage, config will be created by parse-db-url and passed to the adapter by any-db. + * If a continuation is given, it must be called, either with an error or the established connection. + */ + createConnection(opts: ConnectOpts, callback?: (error: Error, result: Connection) => void): Connection; + + /** + * Create a Query that may eventually be executed later on by a Connection. While this function is rarely needed by user code, + * it makes it possible for ConnectionPool.query and Transaction.query to fulfill the Queryable.query contract + * by synchronously returning a Query stream + */ + createQuery(text: string, params?: any[], callback?: (error: Error, result: ResultSet) => void): Query; + createQuery(query: Query): Query; + } + /** + * Other properties are driver specific + */ + export interface Field { + name: string; + } + + /** + * ResultSet objects are just plain data that collect results of a query when a continuation + * is provided to Queryable.query. The lastInsertId is optional, and currently supported by + * sqlite3 and mysql but not postgres, because it is not supported by Postgres itself. + */ + export interface ResultSet { + /** + * Affected rows. Note e.g. for INSERT queries the rows property is not filled even + * though rowCount is non-zero. + */ + rowCount: number; + /** + * Result rows + */ + rows: any[]; + /** + * Result field descriptions + */ + fields: Field[]; + + /** + * Not supported by all drivers. + */ + fieldCount?: number; + /** + * Not supported by all drivers. + */ + lastInsertId?: any; + /** + * Not supported by all drivers. + */ + affectedRows?: number; + /** + * Not supported by all drivers. + */ + changedRows?: number; + } + + /** + * Query objects are returned by the Queryable.query method, available on connections, + * pools, and transactions. Queries are instances of Readable, and as such can be piped + * through transforms and support backpressure for more efficient memory-usage on very + * large results sets. (Note: at this time the sqlite3 driver does not support backpressure) + * + * Internally, Query instances are created by a database Adapter and may have more methods, + * properties, and events than are described here. Consult the documentation for your + * specific adapter to find out about any extensions. + * + * Events: + * + * Error event + * The 'error' event is emitted at most once per query. Note that this event will be + * emitted for errors even if a callback was provided, the callback will + * simply be subscribed to the 'error' event. + * One argument is passed to event listeners: + * error - the error object. + * + * Fields event + * A 'fields' event is emmitted before any 'data' events. + * One argument is passed to event listeners: + * fields - an array of [Field][ResultSet] objects. + * + * The following events are part of the stream.Readable interface which is implemented by Query: + * + * Data event + * A 'data' event is emitted for each row in the query result set. + * One argument is passed to event listeners: + * row contains the contents of a single row in the query result + * + * Close event + * A 'close' event is emitted when the query completes. + * No arguments are passed to event listeners. + * + * End event + * An 'end' event is emitted after all query results have been consumed. + * No arguments are passed to event listeners. + */ + export interface Query extends stream.Readable { + /** + * The SQL query as a string. If you are using MySQL this will contain + * interpolated values after the query has been enqueued by a connection. + */ + text: string; + + /** + * The array of parameter values. + */ + values: any[]; + + /** + * The callback (if any) that was provided to Queryable.query. Note that + * Query objects must not use a closed over reference to their callback, + * as other any-db libraries may rely on modifying the callback property + * of a Query they did not create. + */ + callback: (error: Error, results: ResultSet) => void; + } + + /** + * Events: + * The 'query' event is emitted immediately before a query is executed. One argument is passed to event handlers: + * - query: a Query object + */ + export interface Queryable extends events.EventEmitter { + /** + * The Adapter instance that will be used by this Queryable for creating Query instances and/or connections. + */ + adapter: Adapter; + + /** + * Execute a SQL statement using bound parameters (if they are provided) and return a Query object + * that is a Readable stream of the resulting rows. If a Continuation is provided the rows + * returned by the database will be aggregated into a [ResultSet][] which will be passed to the + * continuation after the query has completed. + * The second form is not needed for normal use, but must be implemented by adapters to work correctly + * with ConnectionPool and Transaction. See Adapter.createQuery for more details. + */ + query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query + + /** + * The second form is not needed for normal use, but must be implemented by adapters to work correctly + * with ConnectionPool and Transaction. See Adapter.createQuery for more details. + */ + // query(query: Query): Query; + } + + /** + * Connection objects are obtained using createConnection from Any-DB or ConnectionPool.acquire, + * both of which delegate to the createConnection implementation of the specified adapter. + * While all Connection objects implement the Queryable interface, the implementations in + * each adapter may add additional methods or emit additional events. If you need to access a + * feature of your database that is not described here (such as Postgres' server-side prepared + * statements), consult the documentation for your adapter. + * + * Events: + * Error event + * The 'error' event is emitted when there is a connection-level error. + * No arguments are passed to event listeners. + * + * Open event + * The 'open' event is emitted when the connection has been established and is ready to query. + * No arguments are passed to event listeners. + * + * Close event + * The 'close' event is emitted when the connection has been closed. + * No arguments are passed to event listeners. + */ + export interface Connection extends Queryable { + /** + * Close the database connection. If a continuation is provided it + * will be called after the connection has closed. + */ + end(callback?: (error: Error) => void): void; + } + + export interface ConnectionStatic { + new(): Connection; + + name: string; + createConnection(): void; + createPool(): void; + } + + /** + * ConnectionPool events + * 'acquire' - emitted whenever pool.acquire is called + * 'release' - emitted whenever pool.release is called + * 'query', query - emitted immediately after .query is called on a + * connection via pool.query. The argument is a Query object. + * 'close' - emitted when the connection pool has closed all of it + * connections after a call to close(). + */ + export interface ConnectionPool extends Queryable { + /** + * Implements Queryable.query by automatically acquiring a connection + * and releasing it when the query completes. + */ + query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query; + + /** + * Remove a connection from the pool. If you use this method you must + * return the connection back to the pool using ConnectionPool.release + */ + acquire(callback: (error: Error, result: Connection) => void): void; + + /** + * Return a connection to the pool. This should only be called with connections + * you've manually acquired. You must not continue to use the connection after releasing it. + */ + release(connection: Connection): void; + + /** + * Stop giving out new connections, and close all existing database connections as they + * are returned to the pool. + */ + close(callback?: (error: Error) => void): void; + } + + /** + * A PoolConfig is generally a plain object with any of the following properties (they are all optional): + */ + export interface PoolConfig { + /** + * min (default 0) The minimum number of connections to keep open in the pool. + */ + min?: number; + /** + * max (default 10) The maximum number of connections to keep open in the pool. + * When this limit is reached further requests for connections will queue waiting + * for an existing connection to be released back into the pool. + */ + max?: number; + /** + * (default 30000) The maximum amount of time a connection can sit idle in the pool before being reaped + */ + idleTimeout?: number; + /** + * (default 1000) How frequently the pool should check for connections that are old enough to be reaped. + */ + reapInterval?: number; + /** + * (default true) When this is true, the pool will reap connections that + * have been idle for more than idleTimeout milliseconds. + */ + refreshIdle?: boolean; + /** + * Called immediately after a connection is first established. Use this to do one-time setup of new connections. + * The supplied Connection will not be added to the pool until you pass it to the done continuation. + */ + onConnect?: (connection: Connection, ready: (error: Error, result: Connection) => void) => void; + /** + * Called each time a connection is returned to the pool. Use this to restore a connection to + * it's original state (e.g. rollback transactions, set the database session vars). If reset + * fails to call the done continuation the connection will be lost in limbo. + */ + reset?: (connection: Connection, done: (error: Error) => void) => void; + /** + * (default function (err) { return true }) - Called when an error is encountered + * by pool.query or emitted by an idle connection. If shouldDestroyConnection(error) + * is truthy the connection will be destroyed, otherwise it will be reset. + */ + shouldDestroyConnection?: (error: Error) => boolean; + } + + /** + * Create a database connection. + * @param url String of the form adapter://user:password@host/database + * @param callback + * @returns Connection object. + */ + export function createConnection(url: string, callback?: (error: Error, connection: Connection) => void): Connection; + + /** + * Create a database connection. + * @param opts Object with adapter name and any properties that the given adapter requires + * @param callback + * @returns Connection object. + */ + export function createConnection(opts: ConnectOpts, callback?: (error: Error, connection: Connection) => void): Connection; + + + export function createPool(url: string, config: PoolConfig): ConnectionPool; + export function createPool(opts: ConnectOpts, config: PoolConfig): ConnectionPool; + +} diff --git a/asciify/asciify.ts.tscparams b/asciify/asciify.ts.tscparams index d68b297cb..85542607d 100644 --- a/asciify/asciify.ts.tscparams +++ b/asciify/asciify.ts.tscparams @@ -1 +1 @@ ---noImplicitAny --module commonjs +--noImplicitAny --module commonjs diff --git a/async/async-tests.ts b/async/async-tests.ts index a6dff0af8..037481b6f 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -1,443 +1,443 @@ -/// - -var fs, path; - -function callback() {} - -async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); -async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); -async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err, results) { }); - -async.filter(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.filterSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.filterLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); -async.select(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.selectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.selectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); - -async.reject(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.rejectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.rejectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); - -async.parallel([ - function () { }, - function () { } -], callback); - -async.series([ - function () { }, - function () { } -]); - -var data = []; -function asyncProcess(item, callback) { } -async.map(data, asyncProcess, function (err, results) { - console.log(results); -}); - -var openFiles = ['file1', 'file2']; -var openFilesObj = { - file1: "fileOne", - file2: "fileTwo" -} - -var saveFile = function () { } -async.each(openFiles, saveFile, function (err) { }); -async.eachSeries(openFiles, saveFile, function (err) { }); - -var documents, requestApi; -async.eachLimit(documents, 20, requestApi, function (err) { }); - -// forEachOf* functions. May accept array or object. -function forEachOfIterator(item, key, forEachOfIteratorCallback) { - console.log("ForEach: item=" + item + ", key=" + key); - forEachOfIteratorCallback(); -} -async.forEachOf(openFiles, forEachOfIterator, function (err) { }); -async.forEachOf(openFilesObj, forEachOfIterator, function (err) { }); -async.forEachOfSeries(openFiles, forEachOfIterator, function (err) { }); -async.forEachOfSeries(openFilesObj, forEachOfIterator, function (err) { }); -async.forEachOfLimit(openFiles, 2, forEachOfIterator, function (err) { }); -async.forEachOfLimit(openFilesObj, 2, forEachOfIterator, function (err) { }); - -var process; -var numArray = [1, 2, 3]; -function reducer(memo, item, callback) { - process.nextTick(function () { - callback(null, memo + item) - }); -} -async.reduce(numArray, 0, reducer, function (err, result) { }); -async.inject(numArray, 0, reducer, function (err, result) { }); -async.foldl(numArray, 0, reducer, function (err, result) { }); -async.reduceRight(numArray, 0, reducer, function (err, result) { }); -async.foldr(numArray, 0, reducer, function (err, result) { }); - -async.detect(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.detectSeries(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.detectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); - -async.sortBy(['file1', 'file2', 'file3'], function (file, callback) { - fs.stat(file, function (err, stats) { - callback(err, stats.mtime); - }); -}, function (err, results) { }); - -async.some(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.someLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); -async.any(['file1', 'file2', 'file3'], path.exists, function (result) { }); - -async.every(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.everyLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); -async.all(['file1', 'file2', 'file3'], path.exists, function (result) { }); - -async.concat(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { }); -async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { }); - - -// Control Flow // - -async.series([ - function (callback) { - callback(null, 'one'); - }, - function (callback) { - callback(null, 'two'); - }, -], -function (err, results) { }); - -async.series([ - function (callback) { - callback(null, 'one'); - }, - function (callback) { - callback(null, 'two'); - }, -], -function (err, results) { }); - -async.series({ - one: function (callback) { - setTimeout(function () { - callback(null, 1); - }, 200); - }, - two: function (callback) { - setTimeout(function () { - callback(null, 2); - }, 100); - }, -}, -function (err, results) { }); - -async.series({ - one: function (callback) { - setTimeout(function () { - callback(null, 1); - }, 200); - }, - two: function (callback) { - setTimeout(function () { - callback(null, 2); - }, 100); - }, -}, -function (err, results) { }); - -async.times(5, function(n, next) { - next(null, n) -}, function(err, results) { - console.log(results) -}) - -async.timesSeries(5, function(n, next) { - next(null, n) -}, function(err, results) { - console.log(results) -}) - -async.parallel([ - function (callback) { - setTimeout(function () { - callback(null, 'one'); - }, 200); - }, - function (callback) { - setTimeout(function () { - callback(null, 'two'); - }, 100); - }, -], -function (err, results) { }); - -async.parallel([ - function (callback) { - setTimeout(function () { - callback(null, 'one'); - }, 200); - }, - function (callback) { - setTimeout(function () { - callback(null, 'two'); - }, 100); - }, -], -function (err, results) { }); - - -async.parallel({ - one: function (callback) { - setTimeout(function () { - callback(null, 1); - }, 200); - }, - two: function (callback) { - setTimeout(function () { - callback(null, 2); - }, 100); - }, -}, -function (err, results) { }); - -async.parallel({ - one: function (callback) { - setTimeout(function () { - callback(null, 1); - }, 200); - }, - two: function (callback) { - setTimeout(function () { - callback(null, 2); - }, 100); - }, -}, - function (err, results) { }); - -async.parallelLimit({ - one: function (callback) { - setTimeout(function () { - callback(null, 1); - }, 200); - }, - two: function (callback) { - setTimeout(function () { - callback(null, 2); - }, 100); - }, -}, - 2, - function (err, results) { } -); - - -function whileFn(callback) { - count++; - setTimeout(callback, 1000); -} - -function whileTest() { return count < 5; } -var count = 0; -async.whilst(whileTest, whileFn, function (err) { }); -async.until(whileTest, whileFn, function (err) { }); -async.doWhilst(whileFn, whileTest, function (err) { }); -async.doUntil(whileFn, whileTest, function (err) { }); - -async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) }); -async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) }); -async.forever(function (errBack) { - errBack(new Error("Not going on forever.")); -}, - function (error) { - console.log(error); - } -); - -async.waterfall([ - function (callback) { - callback(null, 'one', 'two'); - }, - function (arg1, arg2, callback) { - callback(null, 'three'); - }, - function (arg1, callback) { - callback(null, 'done'); - } -], function (err, result) { }); - - -var q = async.queue(function (task: any, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -q.drain = function () { - console.log('all items have been processed'); -} - -q.push({ name: 'foo' }); - -q.push({ name: 'bar' }, function (err) { - console.log('finished processing bar'); -}); - -q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { - console.log('finished processing bar'); -}); - -q.unshift({ name: 'foo' }); - -q.unshift({ name: 'bar' }, function (err) { - console.log('finished processing bar'); -}); - -q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { - console.log('finished processing bar'); -}); - -var qLength : number = q.length(); -var qStarted : boolean = q.started; -var qPaused : boolean = q.paused; -var qProcessingCount : number = q.running(); -var qIsIdle : boolean = q.idle(); - -q.saturated = function() { - console.log('queue is saturated.'); -} - -q.empty = function() { - console.log('queue is empty.'); -} - -q.drain = function() { - console.log('queue was drained.'); -} - -q.pause(); -q.resume(); -q.kill(); - -// tests for strongly typed tasks -var q2 = async.queue(function (task: string, callback) { - console.log('Task: ' + task); - callback(); -}, 1); - -q2.push('task1'); - -q2.push('task2', function (error) { - console.log('Finished tasks'); -}); - -q2.push(['task3', 'task4', 'task5'], function (error) { - console.log('Finished tasks'); -}); - -q2.unshift('task1'); - -q2.unshift('task2', function (error) { - console.log('Finished tasks'); -}); - -q2.unshift(['task3', 'task4', 'task5'], function (error) { - console.log('Finished tasks'); -}); - -// create a cargo object with payload 2 -var cargo = async.cargo(function (tasks, callback) { - for (var i = 0; i < tasks.length; i++) { - console.log('hello ' + tasks[i].name); - } - callback(); -}, 2); - - -// add some items -cargo.push({ name: 'foo' }, function (err) { - console.log('finished processing foo'); -}); -cargo.push({ name: 'bar' }, function (err) { - console.log('finished processing bar'); -}); -cargo.push({ name: 'baz' }, function (err) { - console.log('finished processing baz'); -}); - -var filename = ''; -async.auto({ - get_data: function (callback) { }, - make_folder: function (callback) { }, - //arrays with different types are not accepted by TypeScript. - write_file: ['get_data', 'make_folder', function (callback) { - callback(null, filename); - }], - //arrays with different types are not accepted by TypeScript. - email_link: ['write_file', function (callback, results) { }] -}); - -async.retry(3, function (callback, results) { }, function (err, result) { }); -async.retry({ times: 3, interval: 200 }, function (callback, results) { }, function (err, result) { }); - - -async.parallel([ - function (callback) { }, - function (callback) { } -], -function (results) { - async.series([ - function (callback) { }, - function email_link(callback) { } - ]); -}); - -var sys; -var iterator = async.iterator([ - function () { sys.p('one'); }, - function () { sys.p('two'); }, - function () { sys.p('three'); } -]); - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -async.parallel([ - function (callback) { - fs.writeFile('testfile1', 'test1', callback); - }, - function (callback) { - fs.writeFile('testfile2', 'test2', callback); - }, -]); - -var call_order = []; -async.nextTick(function () { - call_order.push('two'); -}); -call_order.push('one'); - -var slow_fn = function (name, callback) { - callback(null, 123); -}; -var fn = async.memoize(slow_fn); -fn('some name', function () {}); -async.unmemoize(fn); -async.ensureAsync(function () { }); -async.constant(42); -async.asyncify(function () { }); - -async.log(function (name, callback) { - setTimeout(function () { - callback(null, 'hello ' + name); - }, 0); -}, "world" - ); - -async.dir(function (name, callback) { - setTimeout(function () { - callback(null, { hello: name }); - }, 1000); -}, "world"); +/// + +var fs, path; + +function callback() {} + +async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); +async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); +async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err, results) { }); + +async.filter(['file1', 'file2', 'file3'], path.exists, function (results) { }); +async.filterSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); +async.filterLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); +async.select(['file1', 'file2', 'file3'], path.exists, function (results) { }); +async.selectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); +async.selectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); + +async.reject(['file1', 'file2', 'file3'], path.exists, function (results) { }); +async.rejectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); +async.rejectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); + +async.parallel([ + function () { }, + function () { } +], callback); + +async.series([ + function () { }, + function () { } +]); + +var data = []; +function asyncProcess(item, callback) { } +async.map(data, asyncProcess, function (err, results) { + console.log(results); +}); + +var openFiles = ['file1', 'file2']; +var openFilesObj = { + file1: "fileOne", + file2: "fileTwo" +} + +var saveFile = function () { } +async.each(openFiles, saveFile, function (err) { }); +async.eachSeries(openFiles, saveFile, function (err) { }); + +var documents, requestApi; +async.eachLimit(documents, 20, requestApi, function (err) { }); + +// forEachOf* functions. May accept array or object. +function forEachOfIterator(item, key, forEachOfIteratorCallback) { + console.log("ForEach: item=" + item + ", key=" + key); + forEachOfIteratorCallback(); +} +async.forEachOf(openFiles, forEachOfIterator, function (err) { }); +async.forEachOf(openFilesObj, forEachOfIterator, function (err) { }); +async.forEachOfSeries(openFiles, forEachOfIterator, function (err) { }); +async.forEachOfSeries(openFilesObj, forEachOfIterator, function (err) { }); +async.forEachOfLimit(openFiles, 2, forEachOfIterator, function (err) { }); +async.forEachOfLimit(openFilesObj, 2, forEachOfIterator, function (err) { }); + +var process; +var numArray = [1, 2, 3]; +function reducer(memo, item, callback) { + process.nextTick(function () { + callback(null, memo + item) + }); +} +async.reduce(numArray, 0, reducer, function (err, result) { }); +async.inject(numArray, 0, reducer, function (err, result) { }); +async.foldl(numArray, 0, reducer, function (err, result) { }); +async.reduceRight(numArray, 0, reducer, function (err, result) { }); +async.foldr(numArray, 0, reducer, function (err, result) { }); + +async.detect(['file1', 'file2', 'file3'], path.exists, function (result) { }); +async.detectSeries(['file1', 'file2', 'file3'], path.exists, function (result) { }); +async.detectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); + +async.sortBy(['file1', 'file2', 'file3'], function (file, callback) { + fs.stat(file, function (err, stats) { + callback(err, stats.mtime); + }); +}, function (err, results) { }); + +async.some(['file1', 'file2', 'file3'], path.exists, function (result) { }); +async.someLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); +async.any(['file1', 'file2', 'file3'], path.exists, function (result) { }); + +async.every(['file1', 'file2', 'file3'], path.exists, function (result) { }); +async.everyLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); +async.all(['file1', 'file2', 'file3'], path.exists, function (result) { }); + +async.concat(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { }); +async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { }); + + +// Control Flow // + +async.series([ + function (callback) { + callback(null, 'one'); + }, + function (callback) { + callback(null, 'two'); + }, +], +function (err, results) { }); + +async.series([ + function (callback) { + callback(null, 'one'); + }, + function (callback) { + callback(null, 'two'); + }, +], +function (err, results) { }); + +async.series({ + one: function (callback) { + setTimeout(function () { + callback(null, 1); + }, 200); + }, + two: function (callback) { + setTimeout(function () { + callback(null, 2); + }, 100); + }, +}, +function (err, results) { }); + +async.series({ + one: function (callback) { + setTimeout(function () { + callback(null, 1); + }, 200); + }, + two: function (callback) { + setTimeout(function () { + callback(null, 2); + }, 100); + }, +}, +function (err, results) { }); + +async.times(5, function(n, next) { + next(null, n) +}, function(err, results) { + console.log(results) +}) + +async.timesSeries(5, function(n, next) { + next(null, n) +}, function(err, results) { + console.log(results) +}) + +async.parallel([ + function (callback) { + setTimeout(function () { + callback(null, 'one'); + }, 200); + }, + function (callback) { + setTimeout(function () { + callback(null, 'two'); + }, 100); + }, +], +function (err, results) { }); + +async.parallel([ + function (callback) { + setTimeout(function () { + callback(null, 'one'); + }, 200); + }, + function (callback) { + setTimeout(function () { + callback(null, 'two'); + }, 100); + }, +], +function (err, results) { }); + + +async.parallel({ + one: function (callback) { + setTimeout(function () { + callback(null, 1); + }, 200); + }, + two: function (callback) { + setTimeout(function () { + callback(null, 2); + }, 100); + }, +}, +function (err, results) { }); + +async.parallel({ + one: function (callback) { + setTimeout(function () { + callback(null, 1); + }, 200); + }, + two: function (callback) { + setTimeout(function () { + callback(null, 2); + }, 100); + }, +}, + function (err, results) { }); + +async.parallelLimit({ + one: function (callback) { + setTimeout(function () { + callback(null, 1); + }, 200); + }, + two: function (callback) { + setTimeout(function () { + callback(null, 2); + }, 100); + }, +}, + 2, + function (err, results) { } +); + + +function whileFn(callback) { + count++; + setTimeout(callback, 1000); +} + +function whileTest() { return count < 5; } +var count = 0; +async.whilst(whileTest, whileFn, function (err) { }); +async.until(whileTest, whileFn, function (err) { }); +async.doWhilst(whileFn, whileTest, function (err) { }); +async.doUntil(whileFn, whileTest, function (err) { }); + +async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) }); +async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) }); +async.forever(function (errBack) { + errBack(new Error("Not going on forever.")); +}, + function (error) { + console.log(error); + } +); + +async.waterfall([ + function (callback) { + callback(null, 'one', 'two'); + }, + function (arg1, arg2, callback) { + callback(null, 'three'); + }, + function (arg1, callback) { + callback(null, 'done'); + } +], function (err, result) { }); + + +var q = async.queue(function (task: any, callback) { + console.log('hello ' + task.name); + callback(); +}, 2); + + +q.drain = function () { + console.log('all items have been processed'); +} + +q.push({ name: 'foo' }); + +q.push({ name: 'bar' }, function (err) { + console.log('finished processing bar'); +}); + +q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { + console.log('finished processing bar'); +}); + +q.unshift({ name: 'foo' }); + +q.unshift({ name: 'bar' }, function (err) { + console.log('finished processing bar'); +}); + +q.unshift([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { + console.log('finished processing bar'); +}); + +var qLength : number = q.length(); +var qStarted : boolean = q.started; +var qPaused : boolean = q.paused; +var qProcessingCount : number = q.running(); +var qIsIdle : boolean = q.idle(); + +q.saturated = function() { + console.log('queue is saturated.'); +} + +q.empty = function() { + console.log('queue is empty.'); +} + +q.drain = function() { + console.log('queue was drained.'); +} + +q.pause(); +q.resume(); +q.kill(); + +// tests for strongly typed tasks +var q2 = async.queue(function (task: string, callback) { + console.log('Task: ' + task); + callback(); +}, 1); + +q2.push('task1'); + +q2.push('task2', function (error) { + console.log('Finished tasks'); +}); + +q2.push(['task3', 'task4', 'task5'], function (error) { + console.log('Finished tasks'); +}); + +q2.unshift('task1'); + +q2.unshift('task2', function (error) { + console.log('Finished tasks'); +}); + +q2.unshift(['task3', 'task4', 'task5'], function (error) { + console.log('Finished tasks'); +}); + +// create a cargo object with payload 2 +var cargo = async.cargo(function (tasks, callback) { + for (var i = 0; i < tasks.length; i++) { + console.log('hello ' + tasks[i].name); + } + callback(); +}, 2); + + +// add some items +cargo.push({ name: 'foo' }, function (err) { + console.log('finished processing foo'); +}); +cargo.push({ name: 'bar' }, function (err) { + console.log('finished processing bar'); +}); +cargo.push({ name: 'baz' }, function (err) { + console.log('finished processing baz'); +}); + +var filename = ''; +async.auto({ + get_data: function (callback) { }, + make_folder: function (callback) { }, + //arrays with different types are not accepted by TypeScript. + write_file: ['get_data', 'make_folder', function (callback) { + callback(null, filename); + }], + //arrays with different types are not accepted by TypeScript. + email_link: ['write_file', function (callback, results) { }] +}); + +async.retry(3, function (callback, results) { }, function (err, result) { }); +async.retry({ times: 3, interval: 200 }, function (callback, results) { }, function (err, result) { }); + + +async.parallel([ + function (callback) { }, + function (callback) { } +], +function (results) { + async.series([ + function (callback) { }, + function email_link(callback) { } + ]); +}); + +var sys; +var iterator = async.iterator([ + function () { sys.p('one'); }, + function () { sys.p('two'); }, + function () { sys.p('three'); } +]); + +async.parallel([ + async.apply(fs.writeFile, 'testfile1', 'test1'), + async.apply(fs.writeFile, 'testfile2', 'test2'), +]); + + +async.parallel([ + function (callback) { + fs.writeFile('testfile1', 'test1', callback); + }, + function (callback) { + fs.writeFile('testfile2', 'test2', callback); + }, +]); + +var call_order = []; +async.nextTick(function () { + call_order.push('two'); +}); +call_order.push('one'); + +var slow_fn = function (name, callback) { + callback(null, 123); +}; +var fn = async.memoize(slow_fn); +fn('some name', function () {}); +async.unmemoize(fn); +async.ensureAsync(function () { }); +async.constant(42); +async.asyncify(function () { }); + +async.log(function (name, callback) { + setTimeout(function () { + callback(null, 'hello ' + name); + }, 0); +}, "world" + ); + +async.dir(function (name, callback) { + setTimeout(function () { + callback(null, { hello: name }); + }, 1000); +}, "world"); diff --git a/async/async-tests.ts.tscparams b/async/async-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/async/async-tests.ts.tscparams +++ b/async/async-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/async/async.d.ts b/async/async.d.ts index 418f5539b..543b3751d 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -1,165 +1,165 @@ -// Type definitions for Async 1.4.2 -// Project: https://github.com/caolan/async -// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -interface Dictionary { [key: string]: T; } - -interface ErrorCallback { (err?: Error): void; } -interface AsyncResultCallback { (err: Error, result: T): void; } -interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } -interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } - -interface AsyncFunction { (callback: (err?: Error, result?: T) => void): void; } -interface AsyncIterator { (item: T, callback: ErrorCallback): void; } -interface AsyncForEachOfIterator { (item: T, key: number, callback: ErrorCallback): void; } -interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } -interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } -interface AsyncBooleanIterator { (item: T, callback: (truthValue: boolean) => void): void; } - -interface AsyncWorker { (task: T, callback: ErrorCallback): void; } -interface AsyncVoidFunction { (callback: ErrorCallback): void; } - -interface AsyncQueue { - length(): number; - started: boolean; - running(): number; - idle(): boolean; - concurrency: number; - push(task: T, callback?: ErrorCallback): void; - push(task: T[], callback?: ErrorCallback): void; - unshift(task: T, callback?: ErrorCallback): void; - unshift(task: T[], callback?: ErrorCallback): void; - saturated: () => any; - empty: () => any; - drain: () => any; - paused: boolean; - pause(): void - resume(): void; - kill(): void; -} - -interface AsyncPriorityQueue { - length(): number; - concurrency: number; - started: boolean; - paused: boolean; - push(task: T, priority: number, callback?: AsyncResultArrayCallback): void; - push(task: T[], priority: number, callback?: AsyncResultArrayCallback): void; - saturated: () => any; - empty: () => any; - drain: () => any; - running(): number; - idle(): boolean; - pause(): void; - resume(): void; - kill(): void; -} - -interface AsyncCargo { - length(): number; - payload: number; - push(task: any, callback? : Function): void; - push(task: any[], callback? : Function): void; - saturated(): void; - empty(): void; - drain(): void; - idle(): boolean; - pause(): void; - resume(): void; - kill(): void; -} - -interface Async { - - // Collections - each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; - eachSeries(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; - eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; - forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOfSeries(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - filter(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - select(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - filterSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - selectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - selectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - reject(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - rejectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - rejectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; - reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; - foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; - detect(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: T) => void): any; - detectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: T) => void): any; - detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: T) => void): any; - sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - some(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - any(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - every(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - all(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - concatSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - - // Control Flow - series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; - series(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; - parallel(tasks: Array>, callback?: AsyncResultArrayCallback): void; - parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; - parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; - parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; - whilst(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; - until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; - during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void; - forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void; - waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void; - compose(...fns: Function[]): void; - seq(...fns: Function[]): void; - applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. - applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. - queue(worker: AsyncWorker, concurrency?: number): AsyncQueue; - priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; - cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; - auto(tasks: any, callback?: (error: Error, results: any) => void): void; - retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: (error: Error, results: any) => void): void; - retry(opts: { times: number, interval: number }, task: (callback: AsyncResultCallback, results : any) => void, callback: (error: Error, results: any) => void): void; - iterator(tasks: Function[]): Function; - apply(fn: Function, ...arguments: any[]): AsyncFunction; - nextTick(callback: Function): void; - setImmediate(callback: Function): void; - - times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; - timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; - timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; - - // Utils - memoize(fn: Function, hasher?: Function): Function; - unmemoize(fn: Function): Function; - ensureAsync(fn: (... argsAndCallback: any[]) => void): Function; - constant(...values: any[]): Function; - asyncify(fn: Function): Function; - wrapSync(fn: Function): Function; - log(fn: Function, ...arguments: any[]): void; - dir(fn: Function, ...arguments: any[]): void; - noConflict(): Async; -} - -declare var async: Async; - -declare module "async" { - export = async; -} +// Type definitions for Async 1.4.2 +// Project: https://github.com/caolan/async +// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Dictionary { [key: string]: T; } + +interface ErrorCallback { (err?: Error): void; } +interface AsyncResultCallback { (err: Error, result: T): void; } +interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } +interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } + +interface AsyncFunction { (callback: (err?: Error, result?: T) => void): void; } +interface AsyncIterator { (item: T, callback: ErrorCallback): void; } +interface AsyncForEachOfIterator { (item: T, key: number, callback: ErrorCallback): void; } +interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } +interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } +interface AsyncBooleanIterator { (item: T, callback: (truthValue: boolean) => void): void; } + +interface AsyncWorker { (task: T, callback: ErrorCallback): void; } +interface AsyncVoidFunction { (callback: ErrorCallback): void; } + +interface AsyncQueue { + length(): number; + started: boolean; + running(): number; + idle(): boolean; + concurrency: number; + push(task: T, callback?: ErrorCallback): void; + push(task: T[], callback?: ErrorCallback): void; + unshift(task: T, callback?: ErrorCallback): void; + unshift(task: T[], callback?: ErrorCallback): void; + saturated: () => any; + empty: () => any; + drain: () => any; + paused: boolean; + pause(): void + resume(): void; + kill(): void; +} + +interface AsyncPriorityQueue { + length(): number; + concurrency: number; + started: boolean; + paused: boolean; + push(task: T, priority: number, callback?: AsyncResultArrayCallback): void; + push(task: T[], priority: number, callback?: AsyncResultArrayCallback): void; + saturated: () => any; + empty: () => any; + drain: () => any; + running(): number; + idle(): boolean; + pause(): void; + resume(): void; + kill(): void; +} + +interface AsyncCargo { + length(): number; + payload: number; + push(task: any, callback? : Function): void; + push(task: any[], callback? : Function): void; + saturated(): void; + empty(): void; + drain(): void; + idle(): boolean; + pause(): void; + resume(): void; + kill(): void; +} + +interface Async { + + // Collections + each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; + eachSeries(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; + eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; + forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOfSeries(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; + forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + filter(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + select(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + filterSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + selectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + selectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + reject(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + rejectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + rejectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (results: T[]) => any): any; + reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; + inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; + foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; + reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; + foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; + detect(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: T) => void): any; + detectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: T) => void): any; + detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: T) => void): any; + sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + some(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; + someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; + any(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; + every(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; + everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; + all(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; + concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + concatSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + + // Control Flow + series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; + series(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; + parallel(tasks: Array>, callback?: AsyncResultArrayCallback): void; + parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; + parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; + parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; + whilst(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; + doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; + until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; + doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; + during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void; + doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void; + forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void; + waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void; + compose(...fns: Function[]): void; + seq(...fns: Function[]): void; + applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. + applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. + queue(worker: AsyncWorker, concurrency?: number): AsyncQueue; + priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; + cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; + auto(tasks: any, callback?: (error: Error, results: any) => void): void; + retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: (error: Error, results: any) => void): void; + retry(opts: { times: number, interval: number }, task: (callback: AsyncResultCallback, results : any) => void, callback: (error: Error, results: any) => void): void; + iterator(tasks: Function[]): Function; + apply(fn: Function, ...arguments: any[]): AsyncFunction; + nextTick(callback: Function): void; + setImmediate(callback: Function): void; + + times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + + // Utils + memoize(fn: Function, hasher?: Function): Function; + unmemoize(fn: Function): Function; + ensureAsync(fn: (... argsAndCallback: any[]) => void): Function; + constant(...values: any[]): Function; + asyncify(fn: Function): Function; + wrapSync(fn: Function): Function; + log(fn: Function, ...arguments: any[]): void; + dir(fn: Function, ...arguments: any[]): void; + noConflict(): Async; +} + +declare var async: Async; + +declare module "async" { + export = async; +} diff --git a/async/asyncamd-tests.ts b/async/asyncamd-tests.ts index fc1c25460..3aa8ab92b 100644 --- a/async/asyncamd-tests.ts +++ b/async/asyncamd-tests.ts @@ -1,5 +1,5 @@ -/// - -import async = require("async"); - -async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { }); +/// + +import async = require("async"); + +async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { }); diff --git a/asyncblock/asyncblock.d.ts b/asyncblock/asyncblock.d.ts index ef49640c3..a99eb98a1 100644 --- a/asyncblock/asyncblock.d.ts +++ b/asyncblock/asyncblock.d.ts @@ -1,73 +1,73 @@ -// Type definitions for asyncblock 2.1.23 -// Project: https://github.com/scriby/asyncblock -// Definitions by: Hiroki Horiuchi -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -declare module "asyncblock" { - function asyncblock(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; - - module asyncblock { - export function nostack(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; - - export interface IFlow { - add(responseFormat?: string[]): IExecuteFunction; - add(key: string, responseFormat?: string[]): IExecuteFunction; - add(key: number, responseFormat?: string[]): IExecuteFunction; - add(options: IFlowOptions): IExecuteFunction; - callback(responseFormat?: string[]): IExecuteFunction; - callback(key: string, responseFormat?: string[]): IExecuteFunction; - callback(key: number, responseFormat?: string[]): IExecuteFunction; - callback(options: IFlowOptions): IExecuteFunction; - wait(key?: string): T; - wait(key?: number): T; - - get(key: string): T; - set(key: string, responseFormat?: string[]): IExecuteFunction; - set(options: IFlowOptions): IExecuteFunction; - del(key: string): void; - - sync(task: any): T; - queue(toExecute: IExecuteFunction): void; - queue(key: string, toExecute: IExecuteFunction): void; - queue(key: number, toExecute: IExecuteFunction): void; - queue(responseFormat: string[], toExecute: IExecuteFunction): void; - queue(key: string, responseFormat: string[], toExecute: IExecuteFunction): void; - queue(key: number, responseFormat: string[], toExecute: IExecuteFunction): void; - queue(options: IFlowOptions, toExecute: IExecuteFunction): void; - doneAdding(): void; - forceWait(): T; - - maxParallel: number; - errorCallback: (err: any) => void; - taskTimeout: number; - timeoutIsError: boolean; - } - - export interface IFlowOptions { - ignoreError?: boolean; // default false - key?: string; // string | number - responseFormat?: string[]; - timeout?: number; - timeoutIsError?: boolean; - dontWait?: boolean; - firstArgIsError?: boolean; // default true - } - - export interface IExecuteFunction { - (err: any, res1: T1, res2: T2, res3: T3): any; - (err: any, res1: T1, res2: T2): any; - (err: any, res: T): any; - (err: any): any; - - // firstArgIsError === false - (res1: T1, res2: T2, res3: T3): any; - (res1: T1, res2: T2): any; - (res: T): any; - } - - } - - export = asyncblock; -} - +// Type definitions for asyncblock 2.1.23 +// Project: https://github.com/scriby/asyncblock +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "asyncblock" { + function asyncblock(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; + + module asyncblock { + export function nostack(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; + + export interface IFlow { + add(responseFormat?: string[]): IExecuteFunction; + add(key: string, responseFormat?: string[]): IExecuteFunction; + add(key: number, responseFormat?: string[]): IExecuteFunction; + add(options: IFlowOptions): IExecuteFunction; + callback(responseFormat?: string[]): IExecuteFunction; + callback(key: string, responseFormat?: string[]): IExecuteFunction; + callback(key: number, responseFormat?: string[]): IExecuteFunction; + callback(options: IFlowOptions): IExecuteFunction; + wait(key?: string): T; + wait(key?: number): T; + + get(key: string): T; + set(key: string, responseFormat?: string[]): IExecuteFunction; + set(options: IFlowOptions): IExecuteFunction; + del(key: string): void; + + sync(task: any): T; + queue(toExecute: IExecuteFunction): void; + queue(key: string, toExecute: IExecuteFunction): void; + queue(key: number, toExecute: IExecuteFunction): void; + queue(responseFormat: string[], toExecute: IExecuteFunction): void; + queue(key: string, responseFormat: string[], toExecute: IExecuteFunction): void; + queue(key: number, responseFormat: string[], toExecute: IExecuteFunction): void; + queue(options: IFlowOptions, toExecute: IExecuteFunction): void; + doneAdding(): void; + forceWait(): T; + + maxParallel: number; + errorCallback: (err: any) => void; + taskTimeout: number; + timeoutIsError: boolean; + } + + export interface IFlowOptions { + ignoreError?: boolean; // default false + key?: string; // string | number + responseFormat?: string[]; + timeout?: number; + timeoutIsError?: boolean; + dontWait?: boolean; + firstArgIsError?: boolean; // default true + } + + export interface IExecuteFunction { + (err: any, res1: T1, res2: T2, res3: T3): any; + (err: any, res1: T1, res2: T2): any; + (err: any, res: T): any; + (err: any): any; + + // firstArgIsError === false + (res1: T1, res2: T2, res3: T3): any; + (res1: T1, res2: T2): any; + (res: T): any; + } + + } + + export = asyncblock; +} + diff --git a/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams b/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams +++ b/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/backbone-relational/backbone-relational-tests.ts.tscparams b/backbone-relational/backbone-relational-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/backbone-relational/backbone-relational-tests.ts.tscparams +++ b/backbone-relational/backbone-relational-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/backbone-relational/backbone-relational.d.ts.tscparams b/backbone-relational/backbone-relational.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/backbone-relational/backbone-relational.d.ts.tscparams +++ b/backbone-relational/backbone-relational.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/backbone/backbone-global.d.ts.tscparams b/backbone/backbone-global.d.ts.tscparams index 7a0dec307..99e26e8cb 100644 --- a/backbone/backbone-global.d.ts.tscparams +++ b/backbone/backbone-global.d.ts.tscparams @@ -1 +1 @@ ---noImplicitAny ./underscore/underscore.d.ts +--noImplicitAny ./underscore/underscore.d.ts diff --git a/backbone/backbone-tests.ts b/backbone/backbone-tests.ts index 506fd7bb6..017546642 100644 --- a/backbone/backbone-tests.ts +++ b/backbone/backbone-tests.ts @@ -1,313 +1,313 @@ -/// -/// - -function test_events() { - - var object = new Backbone.Events(); - object.on("alert", (eventName: string) => alert("Triggered " + eventName)); - - object.trigger("alert", "an event"); - - var onChange = () => alert('whatever'); - var context: any; - - object.off("change", onChange); - object.off("change"); - object.off(null, onChange); - object.off(null, null, context); - object.off(); -} - -class SettingDefaults extends Backbone.Model { - - // 'defaults' could be set in one of the following ways: - - defaults() { - return { - name: "Joe" - } - } - - constructor(attributes?: any, options?: any) { - this.defaults = { - name: "Joe" - } - // super has to come last - super(attributes, options); - } - - // or set it like this - initialize() { - this.defaults = { - name: "Joe" - } - - } - - // same patterns could be used for setting 'Router.routes' and 'View.events' -} - -class Sidebar extends Backbone.Model { - - promptColor() { - var cssColor = prompt("Please enter a CSS color:"); - this.set({ color: cssColor }); - } -} - -class Note extends Backbone.Model { - initialize() { } - author() { } - coordinates() { } - allowedToEdit(account: any) { - return true; - } -} - -class PrivateNote extends Note { - allowedToEdit(account: any) { - return account.owns(this); - } - - set(attributes: any, options?: any): Backbone.Model { - return Backbone.Model.prototype.set.call(this, attributes, options); - } -} - -function test_models() { - - var sidebar = new Sidebar(); - sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color })); - sidebar.set({ color: 'white' }); - sidebar.promptColor(); - - ////////// - - var note = new PrivateNote(); - - note.get("title"); - - note.set({ title: "March 20", content: "In his eyes she eclipses..." }); - - note.set("title", "A Scandal in Bohemia"); -} - -class Employee extends Backbone.Model { - reports: EmployeeCollection; - - constructor(attributes?: any, options?: any) { - super(options); - this.reports = new EmployeeCollection(); - this.reports.url = '../api/employees/' + this.id + '/reports'; - } - - more() { - this.reports.reset(); - } -} - -class EmployeeCollection extends Backbone.Collection { - findByName(key: any) { } -} - -class Book extends Backbone.Model { - title: string; - author: string; - published: boolean; -} - -class Library extends Backbone.Collection { - // This model definition is here only to test type compatibility of the model, but it - // is not necessary in working code as it is automatically inferred through generics. - model: typeof Book; -} - -class Books extends Backbone.Collection { } - -function test_collection() { - - var books = new Books(); - - var book1: Book = new Book({ title: "Title 1", author: "Mike" }); - books.add(book1); - - // Objects can be added to collection by casting to model type. - // Compiler will check if object properties are valid for the cast. - // This gives better type checking than declaring an `any` overload. - books.add({ title: "Title 2", author: "Mikey" }); - - var model: Book = book1.collection.first(); - if (model !== book1) { - throw new Error("Error"); - } - - books.each(book => - book.get("title")); - - var titles = books.map(book => - book.get("title")); - - var publishedBooks = books.filter(book => - book.get("published") === true); - - var alphabetical = books.sortBy((book: Book): number => null); -} - -////////// - -Backbone.history.start(); - -module v1Changes { - module events { - function test_once() { - var model = new Employee; - model.once('invalid', () => { }, this); - model.once('invalid', () => { }); - } - - function test_listenTo() { - var model = new Employee; - var view = new Backbone.View(); - view.listenTo(model, 'invalid', () => { }); - } - - function test_listenToOnce() { - var model = new Employee; - var view = new Backbone.View(); - view.listenToOnce(model, 'invalid', () => { }); - } - - function test_stopListening() { - var model = new Employee; - var view = new Backbone.View(); - view.stopListening(model, 'invalid', () => { }); - view.stopListening(model, 'invalid'); - view.stopListening(model); - } - } - - module ModelAndCollection { - function test_url() { - Employee.prototype.url = () => '/employees'; - EmployeeCollection.prototype.url = () => '/employees'; - } - - function test_parse() { - var model = new Employee(); - model.parse('{}', {}); - var collection = new EmployeeCollection; - collection.parse('{}', {}); - } - - function test_toJSON() { - var model = new Employee(); - model.toJSON({}); - var collection = new EmployeeCollection; - collection.toJSON({}); - } - - function test_sync() { - var model = new Employee(); - model.sync(); - var collection = new EmployeeCollection; - collection.sync(); - } - } - - module Model { - function test_validationError() { - var model = new Employee; - if (model.validationError) { - console.log('has validation errors'); - } - } - - function test_fetch() { - var model = new Employee({ id: 1 }); - model.fetch({ - success: () => { }, - error: () => { } - }); - } - - function test_set() { - var model = new Employee; - model.set({ name: 'JoeDoe', age: 21 }, { validate: false }); - model.set('name', 'JoeDoes', { validate: false }); - } - - function test_destroy() { - var model = new Employee; - model.destroy({ - wait: true, - success: (m?, response?, options?) => { }, - error: (m?, jqxhr?, options?) => { } - }); - - model.destroy({ - success: (m?, response?, options?) => { }, - error: (m?, jqxhr?) => { } - }); - - model.destroy({ - success: () => { }, - error: (m?, jqxhr?) => { } - }); - } - - function test_save() { - var model = new Employee; - - model.save({ - name: 'Joe Doe', - age: 21 - }, - { - wait: true, - validate: false, - success: (m?, response?, options?) => { }, - error: (m?, jqxhr?, options?) => { } - }); - - model.save({ - name: 'Joe Doe', - age: 21 - }, - { - success: () => { }, - error: (m?, jqxhr?) => { } - }); - } - - function test_validate() { - var model = new Employee; - - model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false }) - } - } - - module Collection { - function test_fetch() { - var collection = new EmployeeCollection; - collection.fetch({ reset: true }); - } - - function test_create() { - var collection = new EmployeeCollection; - var model = new Employee; - - collection.create(model, { - validate: false - }); - } - } - - module Router { - function test_navigate() { - var router = new Backbone.Router; - - router.navigate('/employees', { trigger: true }); - router.navigate('/employees', true); - } - } -} +/// +/// + +function test_events() { + + var object = new Backbone.Events(); + object.on("alert", (eventName: string) => alert("Triggered " + eventName)); + + object.trigger("alert", "an event"); + + var onChange = () => alert('whatever'); + var context: any; + + object.off("change", onChange); + object.off("change"); + object.off(null, onChange); + object.off(null, null, context); + object.off(); +} + +class SettingDefaults extends Backbone.Model { + + // 'defaults' could be set in one of the following ways: + + defaults() { + return { + name: "Joe" + } + } + + constructor(attributes?: any, options?: any) { + this.defaults = { + name: "Joe" + } + // super has to come last + super(attributes, options); + } + + // or set it like this + initialize() { + this.defaults = { + name: "Joe" + } + + } + + // same patterns could be used for setting 'Router.routes' and 'View.events' +} + +class Sidebar extends Backbone.Model { + + promptColor() { + var cssColor = prompt("Please enter a CSS color:"); + this.set({ color: cssColor }); + } +} + +class Note extends Backbone.Model { + initialize() { } + author() { } + coordinates() { } + allowedToEdit(account: any) { + return true; + } +} + +class PrivateNote extends Note { + allowedToEdit(account: any) { + return account.owns(this); + } + + set(attributes: any, options?: any): Backbone.Model { + return Backbone.Model.prototype.set.call(this, attributes, options); + } +} + +function test_models() { + + var sidebar = new Sidebar(); + sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color })); + sidebar.set({ color: 'white' }); + sidebar.promptColor(); + + ////////// + + var note = new PrivateNote(); + + note.get("title"); + + note.set({ title: "March 20", content: "In his eyes she eclipses..." }); + + note.set("title", "A Scandal in Bohemia"); +} + +class Employee extends Backbone.Model { + reports: EmployeeCollection; + + constructor(attributes?: any, options?: any) { + super(options); + this.reports = new EmployeeCollection(); + this.reports.url = '../api/employees/' + this.id + '/reports'; + } + + more() { + this.reports.reset(); + } +} + +class EmployeeCollection extends Backbone.Collection { + findByName(key: any) { } +} + +class Book extends Backbone.Model { + title: string; + author: string; + published: boolean; +} + +class Library extends Backbone.Collection { + // This model definition is here only to test type compatibility of the model, but it + // is not necessary in working code as it is automatically inferred through generics. + model: typeof Book; +} + +class Books extends Backbone.Collection { } + +function test_collection() { + + var books = new Books(); + + var book1: Book = new Book({ title: "Title 1", author: "Mike" }); + books.add(book1); + + // Objects can be added to collection by casting to model type. + // Compiler will check if object properties are valid for the cast. + // This gives better type checking than declaring an `any` overload. + books.add({ title: "Title 2", author: "Mikey" }); + + var model: Book = book1.collection.first(); + if (model !== book1) { + throw new Error("Error"); + } + + books.each(book => + book.get("title")); + + var titles = books.map(book => + book.get("title")); + + var publishedBooks = books.filter(book => + book.get("published") === true); + + var alphabetical = books.sortBy((book: Book): number => null); +} + +////////// + +Backbone.history.start(); + +module v1Changes { + module events { + function test_once() { + var model = new Employee; + model.once('invalid', () => { }, this); + model.once('invalid', () => { }); + } + + function test_listenTo() { + var model = new Employee; + var view = new Backbone.View(); + view.listenTo(model, 'invalid', () => { }); + } + + function test_listenToOnce() { + var model = new Employee; + var view = new Backbone.View(); + view.listenToOnce(model, 'invalid', () => { }); + } + + function test_stopListening() { + var model = new Employee; + var view = new Backbone.View(); + view.stopListening(model, 'invalid', () => { }); + view.stopListening(model, 'invalid'); + view.stopListening(model); + } + } + + module ModelAndCollection { + function test_url() { + Employee.prototype.url = () => '/employees'; + EmployeeCollection.prototype.url = () => '/employees'; + } + + function test_parse() { + var model = new Employee(); + model.parse('{}', {}); + var collection = new EmployeeCollection; + collection.parse('{}', {}); + } + + function test_toJSON() { + var model = new Employee(); + model.toJSON({}); + var collection = new EmployeeCollection; + collection.toJSON({}); + } + + function test_sync() { + var model = new Employee(); + model.sync(); + var collection = new EmployeeCollection; + collection.sync(); + } + } + + module Model { + function test_validationError() { + var model = new Employee; + if (model.validationError) { + console.log('has validation errors'); + } + } + + function test_fetch() { + var model = new Employee({ id: 1 }); + model.fetch({ + success: () => { }, + error: () => { } + }); + } + + function test_set() { + var model = new Employee; + model.set({ name: 'JoeDoe', age: 21 }, { validate: false }); + model.set('name', 'JoeDoes', { validate: false }); + } + + function test_destroy() { + var model = new Employee; + model.destroy({ + wait: true, + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?, options?) => { } + }); + + model.destroy({ + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?) => { } + }); + + model.destroy({ + success: () => { }, + error: (m?, jqxhr?) => { } + }); + } + + function test_save() { + var model = new Employee; + + model.save({ + name: 'Joe Doe', + age: 21 + }, + { + wait: true, + validate: false, + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?, options?) => { } + }); + + model.save({ + name: 'Joe Doe', + age: 21 + }, + { + success: () => { }, + error: (m?, jqxhr?) => { } + }); + } + + function test_validate() { + var model = new Employee; + + model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false }) + } + } + + module Collection { + function test_fetch() { + var collection = new EmployeeCollection; + collection.fetch({ reset: true }); + } + + function test_create() { + var collection = new EmployeeCollection; + var model = new Employee; + + collection.create(model, { + validate: false + }); + } + } + + module Router { + function test_navigate() { + var router = new Backbone.Router; + + router.navigate('/employees', { trigger: true }); + router.navigate('/employees', true); + } + } +} diff --git a/backbone/backbone-with-lodash-tests.ts b/backbone/backbone-with-lodash-tests.ts index dc7ebd2de..0138b2603 100644 --- a/backbone/backbone-with-lodash-tests.ts +++ b/backbone/backbone-with-lodash-tests.ts @@ -1,314 +1,314 @@ -/// +/// /// -/// - -function test_events() { - - var object = new Backbone.Events(); - object.on("alert", (eventName: string) => alert("Triggered " + eventName)); - - object.trigger("alert", "an event"); - - var onChange = () => alert('whatever'); - var context: any; - - object.off("change", onChange); - object.off("change"); - object.off(null, onChange); - object.off(null, null, context); - object.off(); -} - -class SettingDefaults extends Backbone.Model { - - // 'defaults' could be set in one of the following ways: - - defaults() { - return { - name: "Joe" - } - } - - constructor(attributes?: any, options?: any) { - this.defaults = { - name: "Joe" - } - // super has to come last - super(attributes, options); - } - - // or set it like this - initialize() { - this.defaults = { - name: "Joe" - } - - } - - // same patterns could be used for setting 'Router.routes' and 'View.events' -} - -class Sidebar extends Backbone.Model { - - promptColor() { - var cssColor = prompt("Please enter a CSS color:"); - this.set({ color: cssColor }); - } -} - -class Note extends Backbone.Model { - initialize() { } - author() { } - coordinates() { } - allowedToEdit(account: any) { - return true; - } -} - -class PrivateNote extends Note { - allowedToEdit(account: any) { - return account.owns(this); - } - - set(attributes: any, options?: any): Backbone.Model { - return Backbone.Model.prototype.set.call(this, attributes, options); - } -} - -function test_models() { - - var sidebar = new Sidebar(); - sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color })); - sidebar.set({ color: 'white' }); - sidebar.promptColor(); - - ////////// - - var note = new PrivateNote(); - - note.get("title"); - - note.set({ title: "March 20", content: "In his eyes she eclipses..." }); - - note.set("title", "A Scandal in Bohemia"); -} - -class Employee extends Backbone.Model { - reports: EmployeeCollection; - - constructor(attributes?: any, options?: any) { - super(options); - this.reports = new EmployeeCollection(); - this.reports.url = '../api/employees/' + this.id + '/reports'; - } - - more() { - this.reports.reset(); - } -} - -class EmployeeCollection extends Backbone.Collection { - findByName(key: any) { } -} - -class Book extends Backbone.Model { - title: string; - author: string; - published: boolean; -} - -class Library extends Backbone.Collection { - // This model definition is here only to test type compatibility of the model, but it - // is not necessary in working code as it is automatically inferred through generics. - model: typeof Book; -} - -class Books extends Backbone.Collection { } - -function test_collection() { - - var books = new Books(); - - var book1: Book = new Book({ title: "Title 1", author: "Mike" }); - books.add(book1); - - // Objects can be added to collection by casting to model type. - // Compiler will check if object properties are valid for the cast. - // This gives better type checking than declaring an `any` overload. - books.add({ title: "Title 2", author: "Mikey" }); - - var model: Book = book1.collection.first(); - if (model !== book1) { - throw new Error("Error"); - } - - books.each(book => - book.get("title")); - - var titles = books.map(book => - book.get("title")); - - var publishedBooks = books.filter(book => - book.get("published") === true); - - var alphabetical = books.sortBy((book: Book): number => null); -} - -////////// - -Backbone.history.start(); - -module v1Changes { - module events { - function test_once() { - var model = new Employee; - model.once('invalid', () => { }, this); - model.once('invalid', () => { }); - } - - function test_listenTo() { - var model = new Employee; - var view = new Backbone.View(); - view.listenTo(model, 'invalid', () => { }); - } - - function test_listenToOnce() { - var model = new Employee; - var view = new Backbone.View(); - view.listenToOnce(model, 'invalid', () => { }); - } - - function test_stopListening() { - var model = new Employee; - var view = new Backbone.View(); - view.stopListening(model, 'invalid', () => { }); - view.stopListening(model, 'invalid'); - view.stopListening(model); - } - } - - module ModelAndCollection { - function test_url() { - Employee.prototype.url = () => '/employees'; - EmployeeCollection.prototype.url = () => '/employees'; - } - - function test_parse() { - var model = new Employee(); - model.parse('{}', {}); - var collection = new EmployeeCollection; - collection.parse('{}', {}); - } - - function test_toJSON() { - var model = new Employee(); - model.toJSON({}); - var collection = new EmployeeCollection; - collection.toJSON({}); - } - - function test_sync() { - var model = new Employee(); - model.sync(); - var collection = new EmployeeCollection; - collection.sync(); - } - } - - module Model { - function test_validationError() { - var model = new Employee; - if (model.validationError) { - console.log('has validation errors'); - } - } - - function test_fetch() { - var model = new Employee({ id: 1 }); - model.fetch({ - success: () => { }, - error: () => { } - }); - } - - function test_set() { - var model = new Employee; - model.set({ name: 'JoeDoe', age: 21 }, { validate: false }); - model.set('name', 'JoeDoes', { validate: false }); - } - - function test_destroy() { - var model = new Employee; - model.destroy({ - wait: true, - success: (m?, response?, options?) => { }, - error: (m?, jqxhr?, options?) => { } - }); - - model.destroy({ - success: (m?, response?, options?) => { }, - error: (m?, jqxhr?) => { } - }); - - model.destroy({ - success: () => { }, - error: (m?, jqxhr?) => { } - }); - } - - function test_save() { - var model = new Employee; - - model.save({ - name: 'Joe Doe', - age: 21 - }, - { - wait: true, - validate: false, - success: (m?, response?, options?) => { }, - error: (m?, jqxhr?, options?) => { } - }); - - model.save({ - name: 'Joe Doe', - age: 21 - }, - { - success: () => { }, - error: (m?, jqxhr?) => { } - }); - } - - function test_validate() { - var model = new Employee; - - model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false }) - } - } - - module Collection { - function test_fetch() { - var collection = new EmployeeCollection; - collection.fetch({ reset: true }); - } - - function test_create() { - var collection = new EmployeeCollection; - var model = new Employee; - - collection.create(model, { - validate: false - }); - } - } - - module Router { - function test_navigate() { - var router = new Backbone.Router; - - router.navigate('/employees', { trigger: true }); - router.navigate('/employees', true); - } - } -} +/// + +function test_events() { + + var object = new Backbone.Events(); + object.on("alert", (eventName: string) => alert("Triggered " + eventName)); + + object.trigger("alert", "an event"); + + var onChange = () => alert('whatever'); + var context: any; + + object.off("change", onChange); + object.off("change"); + object.off(null, onChange); + object.off(null, null, context); + object.off(); +} + +class SettingDefaults extends Backbone.Model { + + // 'defaults' could be set in one of the following ways: + + defaults() { + return { + name: "Joe" + } + } + + constructor(attributes?: any, options?: any) { + this.defaults = { + name: "Joe" + } + // super has to come last + super(attributes, options); + } + + // or set it like this + initialize() { + this.defaults = { + name: "Joe" + } + + } + + // same patterns could be used for setting 'Router.routes' and 'View.events' +} + +class Sidebar extends Backbone.Model { + + promptColor() { + var cssColor = prompt("Please enter a CSS color:"); + this.set({ color: cssColor }); + } +} + +class Note extends Backbone.Model { + initialize() { } + author() { } + coordinates() { } + allowedToEdit(account: any) { + return true; + } +} + +class PrivateNote extends Note { + allowedToEdit(account: any) { + return account.owns(this); + } + + set(attributes: any, options?: any): Backbone.Model { + return Backbone.Model.prototype.set.call(this, attributes, options); + } +} + +function test_models() { + + var sidebar = new Sidebar(); + sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color })); + sidebar.set({ color: 'white' }); + sidebar.promptColor(); + + ////////// + + var note = new PrivateNote(); + + note.get("title"); + + note.set({ title: "March 20", content: "In his eyes she eclipses..." }); + + note.set("title", "A Scandal in Bohemia"); +} + +class Employee extends Backbone.Model { + reports: EmployeeCollection; + + constructor(attributes?: any, options?: any) { + super(options); + this.reports = new EmployeeCollection(); + this.reports.url = '../api/employees/' + this.id + '/reports'; + } + + more() { + this.reports.reset(); + } +} + +class EmployeeCollection extends Backbone.Collection { + findByName(key: any) { } +} + +class Book extends Backbone.Model { + title: string; + author: string; + published: boolean; +} + +class Library extends Backbone.Collection { + // This model definition is here only to test type compatibility of the model, but it + // is not necessary in working code as it is automatically inferred through generics. + model: typeof Book; +} + +class Books extends Backbone.Collection { } + +function test_collection() { + + var books = new Books(); + + var book1: Book = new Book({ title: "Title 1", author: "Mike" }); + books.add(book1); + + // Objects can be added to collection by casting to model type. + // Compiler will check if object properties are valid for the cast. + // This gives better type checking than declaring an `any` overload. + books.add({ title: "Title 2", author: "Mikey" }); + + var model: Book = book1.collection.first(); + if (model !== book1) { + throw new Error("Error"); + } + + books.each(book => + book.get("title")); + + var titles = books.map(book => + book.get("title")); + + var publishedBooks = books.filter(book => + book.get("published") === true); + + var alphabetical = books.sortBy((book: Book): number => null); +} + +////////// + +Backbone.history.start(); + +module v1Changes { + module events { + function test_once() { + var model = new Employee; + model.once('invalid', () => { }, this); + model.once('invalid', () => { }); + } + + function test_listenTo() { + var model = new Employee; + var view = new Backbone.View(); + view.listenTo(model, 'invalid', () => { }); + } + + function test_listenToOnce() { + var model = new Employee; + var view = new Backbone.View(); + view.listenToOnce(model, 'invalid', () => { }); + } + + function test_stopListening() { + var model = new Employee; + var view = new Backbone.View(); + view.stopListening(model, 'invalid', () => { }); + view.stopListening(model, 'invalid'); + view.stopListening(model); + } + } + + module ModelAndCollection { + function test_url() { + Employee.prototype.url = () => '/employees'; + EmployeeCollection.prototype.url = () => '/employees'; + } + + function test_parse() { + var model = new Employee(); + model.parse('{}', {}); + var collection = new EmployeeCollection; + collection.parse('{}', {}); + } + + function test_toJSON() { + var model = new Employee(); + model.toJSON({}); + var collection = new EmployeeCollection; + collection.toJSON({}); + } + + function test_sync() { + var model = new Employee(); + model.sync(); + var collection = new EmployeeCollection; + collection.sync(); + } + } + + module Model { + function test_validationError() { + var model = new Employee; + if (model.validationError) { + console.log('has validation errors'); + } + } + + function test_fetch() { + var model = new Employee({ id: 1 }); + model.fetch({ + success: () => { }, + error: () => { } + }); + } + + function test_set() { + var model = new Employee; + model.set({ name: 'JoeDoe', age: 21 }, { validate: false }); + model.set('name', 'JoeDoes', { validate: false }); + } + + function test_destroy() { + var model = new Employee; + model.destroy({ + wait: true, + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?, options?) => { } + }); + + model.destroy({ + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?) => { } + }); + + model.destroy({ + success: () => { }, + error: (m?, jqxhr?) => { } + }); + } + + function test_save() { + var model = new Employee; + + model.save({ + name: 'Joe Doe', + age: 21 + }, + { + wait: true, + validate: false, + success: (m?, response?, options?) => { }, + error: (m?, jqxhr?, options?) => { } + }); + + model.save({ + name: 'Joe Doe', + age: 21 + }, + { + success: () => { }, + error: (m?, jqxhr?) => { } + }); + } + + function test_validate() { + var model = new Employee; + + model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false }) + } + } + + module Collection { + function test_fetch() { + var collection = new EmployeeCollection; + collection.fetch({ reset: true }); + } + + function test_create() { + var collection = new EmployeeCollection; + var model = new Employee; + + collection.create(model, { + validate: false + }); + } + } + + module Router { + function test_navigate() { + var router = new Backbone.Router; + + router.navigate('/employees', { trigger: true }); + router.navigate('/employees', true); + } + } +} diff --git a/backgrid/backgrid-tests.ts.tscparams b/backgrid/backgrid-tests.ts.tscparams index d45eb7650..3af0fcfed 100644 --- a/backgrid/backgrid-tests.ts.tscparams +++ b/backgrid/backgrid-tests.ts.tscparams @@ -1 +1 @@ ---target ES5 +--target ES5 diff --git a/backgrid/backgrid.d.ts.tscparams b/backgrid/backgrid.d.ts.tscparams index aa5e71c8a..5d4a276bc 100644 --- a/backgrid/backgrid.d.ts.tscparams +++ b/backgrid/backgrid.d.ts.tscparams @@ -1 +1 @@ ---target es5 +--target es5 diff --git a/bitwise-xor/bitwise-xor-tests.ts b/bitwise-xor/bitwise-xor-tests.ts index 66b67a7b5..e55670b85 100644 --- a/bitwise-xor/bitwise-xor-tests.ts +++ b/bitwise-xor/bitwise-xor-tests.ts @@ -1,11 +1,11 @@ - -/// - -"use strict"; - -import xor = require("bitwise-xor"); - -var b: Buffer; - -b = xor("a", "b"); -b = xor(new Buffer("a"), new Buffer("b")); + +/// + +"use strict"; + +import xor = require("bitwise-xor"); + +var b: Buffer; + +b = xor("a", "b"); +b = xor(new Buffer("a"), new Buffer("b")); diff --git a/bitwise-xor/bitwise-xor.d.ts b/bitwise-xor/bitwise-xor.d.ts index 0db872f91..1ea6865c7 100644 --- a/bitwise-xor/bitwise-xor.d.ts +++ b/bitwise-xor/bitwise-xor.d.ts @@ -1,17 +1,17 @@ // Type definitions for bitwise-xor 0.0.0 // Project: https://github.com/czzarr/node-bitwise-xor // Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped - +// Definitions: https://github.com/borisyankov/DefinitelyTyped + /// -declare module "bitwise-xor" { - - /** - * Bitwise XOR between two Buffers or Strings, returns a Buffer - */ - function xor(b1: Buffer, b2: Buffer): Buffer; - function xor(s1: string, s2: string): Buffer; - - export = xor; -} - +declare module "bitwise-xor" { + + /** + * Bitwise XOR between two Buffers or Strings, returns a Buffer + */ + function xor(b1: Buffer, b2: Buffer): Buffer; + function xor(s1: string, s2: string): Buffer; + + export = xor; +} + diff --git a/bootbox/bootbox-tests.ts b/bootbox/bootbox-tests.ts index 463170cd7..5b3a26edd 100644 --- a/bootbox/bootbox-tests.ts +++ b/bootbox/bootbox-tests.ts @@ -1,106 +1,106 @@ -// QUnit Tests for Bootbox 4.4.0 -/// - -bootbox.alert("Are we ok?"); -bootbox.alert("Are we ok with callback?", function () { - console.log("Callback called!"); -}); -bootbox.alert({ - size: "medium", - message: "Are we ok with callback and custom button?", - callback: function () { - console.log("Callback called!"); - } -}); - -bootbox.confirm("Click cancel to pass test", function (result) { - console.log(!result); -}); -bootbox.confirm({ - message: "Click confirm to pass test", - callback: function (result) { - console.log(result); - } -}); - -bootbox.prompt("Enter 'ok' to pass test", function (result) { - console.log(result); -}); -bootbox.prompt({ - message: "Enter 'ok' to pass test", callback: function (result) { - console.log(result); - } -}); -bootbox.prompt({ - size: "large", - message: "Enter 'ok' to pass test", callback: function (result) { - console.log(result); - } -}); - - -bootbox.dialog({ - title: "Wassup?", - message: "Test Dialog", - callback: function (result) { } -}); - -// Testing the return object of the call. Using the pointer to disable the animation on success callback. -var bBox : JQuery; - -bBox = bootbox.dialog({ - message: "Test Dialog", - buttons: { - cancel: { - label: "Cancel" - }, - confirm: { - label: "Continue", - callback: function () { - bBox.removeClass("fade"); - console.log("Outer callback."); - } - } - }, - animate: true, -}); - -var bdo: BootboxDialogOptions; -var sampleButton: BootboxButton = { - label: 'ButtonLabelToUse', - callback: function () { - return 'callback of button click' - }, - className: 'additionalButtonClassName' -}; - -bdo = { - message: '', - className: 'callName', - buttons: { - 'ButtonTextLabel': sampleButton - } -}; - -bootbox.dialog(bdo); - -bootbox.setDefaults({ - locale: 'en_US', - animate: false, - backdrop: false, - className: 'newClassName', - closeButton: true, - show: true -}) - -bootbox.hideAll(); - -var localeOptions: BootboxLocaleValues = { - OK: 'Hus', - CANCEL: 'Nai', - CONFIRM: 'Pakka' -} - -bootbox.addLocale("Nepali", localeOptions); -bootbox.setLocale("Nepali"); +// QUnit Tests for Bootbox 4.4.0 +/// + +bootbox.alert("Are we ok?"); +bootbox.alert("Are we ok with callback?", function () { + console.log("Callback called!"); +}); +bootbox.alert({ + size: "medium", + message: "Are we ok with callback and custom button?", + callback: function () { + console.log("Callback called!"); + } +}); + +bootbox.confirm("Click cancel to pass test", function (result) { + console.log(!result); +}); +bootbox.confirm({ + message: "Click confirm to pass test", + callback: function (result) { + console.log(result); + } +}); + +bootbox.prompt("Enter 'ok' to pass test", function (result) { + console.log(result); +}); +bootbox.prompt({ + message: "Enter 'ok' to pass test", callback: function (result) { + console.log(result); + } +}); +bootbox.prompt({ + size: "large", + message: "Enter 'ok' to pass test", callback: function (result) { + console.log(result); + } +}); + + +bootbox.dialog({ + title: "Wassup?", + message: "Test Dialog", + callback: function (result) { } +}); + +// Testing the return object of the call. Using the pointer to disable the animation on success callback. +var bBox : JQuery; + +bBox = bootbox.dialog({ + message: "Test Dialog", + buttons: { + cancel: { + label: "Cancel" + }, + confirm: { + label: "Continue", + callback: function () { + bBox.removeClass("fade"); + console.log("Outer callback."); + } + } + }, + animate: true, +}); + +var bdo: BootboxDialogOptions; +var sampleButton: BootboxButton = { + label: 'ButtonLabelToUse', + callback: function () { + return 'callback of button click' + }, + className: 'additionalButtonClassName' +}; + +bdo = { + message: '', + className: 'callName', + buttons: { + 'ButtonTextLabel': sampleButton + } +}; + +bootbox.dialog(bdo); + +bootbox.setDefaults({ + locale: 'en_US', + animate: false, + backdrop: false, + className: 'newClassName', + closeButton: true, + show: true +}) + +bootbox.hideAll(); + +var localeOptions: BootboxLocaleValues = { + OK: 'Hus', + CANCEL: 'Nai', + CONFIRM: 'Pakka' +} + +bootbox.addLocale("Nepali", localeOptions); +bootbox.setLocale("Nepali"); bootbox.removeLocale("Nepali"); \ No newline at end of file diff --git a/bootbox/bootbox.d.ts b/bootbox/bootbox.d.ts index 5ec2a7abd..7e0ed9b40 100644 --- a/bootbox/bootbox.d.ts +++ b/bootbox/bootbox.d.ts @@ -1,82 +1,82 @@ -// Type definitions for Bootbox 4.4.0 -// Project: https://github.com/makeusabrew/bootbox -// Definitions by: Vincent Bortone , Kon Pik , Anup Kattel , Dominik Schroeter -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -interface BootboxAlertOptions { - size?: string; - message: string; - callback?: () => any; -} - -interface BootboxConfirmOptions { - size?: string; - message: string; - callback: (result: boolean) => any; -} - -interface BootboxPromptOptions { - size?: string; - message?: string; - callback: (result: string) => any; -} - -interface BootboxButton { - label?: string; - className?: string; - callback?: () => any; -} - -interface BootboxButtonMap { - [key: string]: BootboxButton | Function; -} - -interface BootboxDialogOptions { - message: string | Element; - title?: string | Element; - locale?: string; - callback?: (result: boolean) => any; - onEscape?: () => any | boolean; - show?: boolean; - backdrop?: boolean; - closeButton?: boolean; - animate?: boolean; - className?: string; - size?: string; - buttons?: BootboxButtonMap; // complex object where each key is of type BootboxButton -} - -interface BootboxDefaultOptions { - locale?: string; - show?: boolean; - backdrop?: boolean; - closeButton?: boolean; - animate?: boolean; - className?: string; -} - -interface BootboxLocaleValues { - OK: string; - CANCEL: string; - CONFIRM: string; -} - -interface BootboxStatic { - alert(message: string, callback?: () => void): JQuery; - alert(options: BootboxAlertOptions): JQuery; - confirm(message: string, callback: (result: boolean) => void): JQuery; - confirm(options: BootboxConfirmOptions): JQuery; - prompt(message: string, callback: (result: string) => void): JQuery; - prompt(options: BootboxPromptOptions): JQuery; - dialog(message: string, callback?: (result: string) => void): JQuery; - dialog(options: BootboxDialogOptions): JQuery; - setDefaults(options: BootboxDefaultOptions): void; - hideAll(): void; - - addLocale(name: string, values: BootboxLocaleValues): void; - removeLocale(name: string): void; - setLocale(name: string): void; -} - -declare var bootbox: BootboxStatic; +// Type definitions for Bootbox 4.4.0 +// Project: https://github.com/makeusabrew/bootbox +// Definitions by: Vincent Bortone , Kon Pik , Anup Kattel , Dominik Schroeter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +interface BootboxAlertOptions { + size?: string; + message: string; + callback?: () => any; +} + +interface BootboxConfirmOptions { + size?: string; + message: string; + callback: (result: boolean) => any; +} + +interface BootboxPromptOptions { + size?: string; + message?: string; + callback: (result: string) => any; +} + +interface BootboxButton { + label?: string; + className?: string; + callback?: () => any; +} + +interface BootboxButtonMap { + [key: string]: BootboxButton | Function; +} + +interface BootboxDialogOptions { + message: string | Element; + title?: string | Element; + locale?: string; + callback?: (result: boolean) => any; + onEscape?: () => any | boolean; + show?: boolean; + backdrop?: boolean; + closeButton?: boolean; + animate?: boolean; + className?: string; + size?: string; + buttons?: BootboxButtonMap; // complex object where each key is of type BootboxButton +} + +interface BootboxDefaultOptions { + locale?: string; + show?: boolean; + backdrop?: boolean; + closeButton?: boolean; + animate?: boolean; + className?: string; +} + +interface BootboxLocaleValues { + OK: string; + CANCEL: string; + CONFIRM: string; +} + +interface BootboxStatic { + alert(message: string, callback?: () => void): JQuery; + alert(options: BootboxAlertOptions): JQuery; + confirm(message: string, callback: (result: boolean) => void): JQuery; + confirm(options: BootboxConfirmOptions): JQuery; + prompt(message: string, callback: (result: string) => void): JQuery; + prompt(options: BootboxPromptOptions): JQuery; + dialog(message: string, callback?: (result: string) => void): JQuery; + dialog(options: BootboxDialogOptions): JQuery; + setDefaults(options: BootboxDefaultOptions): void; + hideAll(): void; + + addLocale(name: string, values: BootboxLocaleValues): void; + removeLocale(name: string): void; + setLocale(name: string): void; +} + +declare var bootbox: BootboxStatic; diff --git a/bootstrap.datepicker/bootstrap.datepicker-tests.ts b/bootstrap.datepicker/bootstrap.datepicker-tests.ts index 0bbf2c650..b275ee25a 100644 --- a/bootstrap.datepicker/bootstrap.datepicker-tests.ts +++ b/bootstrap.datepicker/bootstrap.datepicker-tests.ts @@ -1,82 +1,82 @@ -/// - -function tests_simple() { - $('#datepicker').datepicker(); - $('#datepicker').datepicker({ - format: 'mm-dd-yyyy' - }); - $('#datepicker').datepicker('setStartDate'); - $('#datepicker').datepicker('setStartDate', null); - $('#datepicker').datepicker('setEndDate', '2012-12-31'); - $('#date-end') - .datepicker() - .on('changeDate', function (ev) { ev; }); - - var startDate = new Date(2012, 1, 20); - var endDate = new Date(2012, 1, 25); - $('#date-start') - .datepicker() - //.on("changeDate", function (ev) { // bug https://typescript.codeplex.com/workitem/1976 - .on("changeDate", function (ev: DatepickerEventObject) { - if (ev.date.valueOf() > endDate.valueOf()) { - $('#alert').show().find('strong').text('The start date must be before the end date.'); - } else { - $('#alert').hide(); - startDate = ev.date; - $('#date-start-display').text($('#date-start').data('date')); - } - $('#date-start').datepicker('hide'); - }); - $('#date-end') - .datepicker() - //.on('changeDate', function (ev) { // bug https://typescript.codeplex.com/workitem/1976 - .on('changeDate', function (ev: DatepickerEventObject) { - if (ev.date.valueOf() < startDate.valueOf()) { - $('#alert').show().find('strong').text('The end date must be after the start date.'); - } else { - $('#alert').hide(); - endDate = ev.date; - $('#date-end-display').text($('#date-end').data('date')); - } - $('#date-end').datepicker('hide'); - }); -} - -$(function () { - $('#dp1').datepicker({ - format: 'mm-dd-yyyy' - }); - $('#dp2').datepicker(); - $('#dp3').datepicker(); - $('#dp3').datepicker(); - $('#dpYears').datepicker(); - $('#dpMonths').datepicker(); - - - var startDate = new Date(2012, 1, 20); - var endDate = new Date(2012, 1, 25); - $('#dp4').datepicker() - //.on('changeDate', function (ev) { // bug https://typescript.codeplex.com/workitem/1976 - .on('changeDate', function (ev: DatepickerEventObject) { - if (ev.date.valueOf() > endDate.valueOf()) { - $('#alert').show().find('strong').text('The start date can not be greater then the end date'); - } else { - $('#alert').hide(); - startDate = ev.date; - $('#startDate').text($('#dp4').data('date')); - } - $('#dp4').datepicker('hide'); - }); - $('#dp5').datepicker() - //.on('changeDate', function (ev) { // bug https://typescript.codeplex.com/workitem/1976 - .on('changeDate', function (ev: DatepickerEventObject) { - if (ev.date.valueOf() < startDate.valueOf()) { - $('#alert').show().find('strong').text('The end date can not be less then the start date'); - } else { - $('#alert').hide(); - endDate = ev.date; - $('#endDate').text($('#dp5').data('date')); - } - $('#dp5').datepicker('hide'); - }); -}); +/// + +function tests_simple() { + $('#datepicker').datepicker(); + $('#datepicker').datepicker({ + format: 'mm-dd-yyyy' + }); + $('#datepicker').datepicker('setStartDate'); + $('#datepicker').datepicker('setStartDate', null); + $('#datepicker').datepicker('setEndDate', '2012-12-31'); + $('#date-end') + .datepicker() + .on('changeDate', function (ev) { ev; }); + + var startDate = new Date(2012, 1, 20); + var endDate = new Date(2012, 1, 25); + $('#date-start') + .datepicker() + //.on("changeDate", function (ev) { // bug https://typescript.codeplex.com/workitem/1976 + .on("changeDate", function (ev: DatepickerEventObject) { + if (ev.date.valueOf() > endDate.valueOf()) { + $('#alert').show().find('strong').text('The start date must be before the end date.'); + } else { + $('#alert').hide(); + startDate = ev.date; + $('#date-start-display').text($('#date-start').data('date')); + } + $('#date-start').datepicker('hide'); + }); + $('#date-end') + .datepicker() + //.on('changeDate', function (ev) { // bug https://typescript.codeplex.com/workitem/1976 + .on('changeDate', function (ev: DatepickerEventObject) { + if (ev.date.valueOf() < startDate.valueOf()) { + $('#alert').show().find('strong').text('The end date must be after the start date.'); + } else { + $('#alert').hide(); + endDate = ev.date; + $('#date-end-display').text($('#date-end').data('date')); + } + $('#date-end').datepicker('hide'); + }); +} + +$(function () { + $('#dp1').datepicker({ + format: 'mm-dd-yyyy' + }); + $('#dp2').datepicker(); + $('#dp3').datepicker(); + $('#dp3').datepicker(); + $('#dpYears').datepicker(); + $('#dpMonths').datepicker(); + + + var startDate = new Date(2012, 1, 20); + var endDate = new Date(2012, 1, 25); + $('#dp4').datepicker() + //.on('changeDate', function (ev) { // bug https://typescript.codeplex.com/workitem/1976 + .on('changeDate', function (ev: DatepickerEventObject) { + if (ev.date.valueOf() > endDate.valueOf()) { + $('#alert').show().find('strong').text('The start date can not be greater then the end date'); + } else { + $('#alert').hide(); + startDate = ev.date; + $('#startDate').text($('#dp4').data('date')); + } + $('#dp4').datepicker('hide'); + }); + $('#dp5').datepicker() + //.on('changeDate', function (ev) { // bug https://typescript.codeplex.com/workitem/1976 + .on('changeDate', function (ev: DatepickerEventObject) { + if (ev.date.valueOf() < startDate.valueOf()) { + $('#alert').show().find('strong').text('The end date can not be less then the start date'); + } else { + $('#alert').hide(); + endDate = ev.date; + $('#endDate').text($('#dp5').data('date')); + } + $('#dp5').datepicker('hide'); + }); +}); diff --git a/bootstrap.datepicker/bootstrap.datepicker.d.ts b/bootstrap.datepicker/bootstrap.datepicker.d.ts index 23f51cb43..e9ca0159d 100644 --- a/bootstrap.datepicker/bootstrap.datepicker.d.ts +++ b/bootstrap.datepicker/bootstrap.datepicker.d.ts @@ -1,57 +1,57 @@ -// Type definitions for bootstrap.datepicker -// Project: https://github.com/eternicode/bootstrap-datepicker -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -/** - * All options that take a “Date” can handle a Date object; a String - * formatted according to the given format; or a timedelta relative - * to today, eg “-1d”, “+6m +1y”, etc, where valid units are “d” (day), - * “w” (week), “m” (month), and “y” (year). - * - * See online docs for more info: - * http://bootstrap-datepicker.readthedocs.org/en/release/options.html - */ -interface DatepickerOptions { - format?: string; - weekStart?: number; - startDate?: any; - endDate?: any; - autoclose?: boolean; - startView?: number; - todayBtn?: any; - todayHighlight?: boolean; - keyboardNavigation?: boolean; - language?: string; - beforeShowDay?: (date: any) => any; - calendarWeeks?: boolean; - clearBtn?: boolean; - daysOfWeekDisabled?: number[]; - forceParse?: boolean; - inputs?: any[]; - minViewMode?: any; - multidate?: any; - multidateSeparator?: string; - orientation?: string; -} - -interface DatepickerEventObject extends JQueryEventObject { - date: Date; - format(format?: string): string; -} - -interface JQuery { - datepicker(): JQuery; - datepicker(methodName: string): any; - datepicker(methodName: string, params: any): any; - datepicker(options: DatepickerOptions): JQuery; - - off(events: "changeDate", selector?: string, handler?: (eventObject: DatepickerEventObject) => any): JQuery; - off(events: "changeDate", handler: (eventObject: DatepickerEventObject) => any): JQuery; - - on(events: "changeDate", selector: string, data: any, handler?: (eventObject: DatepickerEventObject) => any): JQuery; - on(events: "changeDate", selector: string, handler: (eventObject: DatepickerEventObject) => any): JQuery; - on(events: 'changeDate', handler: (eventObject: DatepickerEventObject) => any): JQuery; -} +// Type definitions for bootstrap.datepicker +// Project: https://github.com/eternicode/bootstrap-datepicker +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/** + * All options that take a “Date” can handle a Date object; a String + * formatted according to the given format; or a timedelta relative + * to today, eg “-1d”, “+6m +1y”, etc, where valid units are “d” (day), + * “w” (week), “m” (month), and “y” (year). + * + * See online docs for more info: + * http://bootstrap-datepicker.readthedocs.org/en/release/options.html + */ +interface DatepickerOptions { + format?: string; + weekStart?: number; + startDate?: any; + endDate?: any; + autoclose?: boolean; + startView?: number; + todayBtn?: any; + todayHighlight?: boolean; + keyboardNavigation?: boolean; + language?: string; + beforeShowDay?: (date: any) => any; + calendarWeeks?: boolean; + clearBtn?: boolean; + daysOfWeekDisabled?: number[]; + forceParse?: boolean; + inputs?: any[]; + minViewMode?: any; + multidate?: any; + multidateSeparator?: string; + orientation?: string; +} + +interface DatepickerEventObject extends JQueryEventObject { + date: Date; + format(format?: string): string; +} + +interface JQuery { + datepicker(): JQuery; + datepicker(methodName: string): any; + datepicker(methodName: string, params: any): any; + datepicker(options: DatepickerOptions): JQuery; + + off(events: "changeDate", selector?: string, handler?: (eventObject: DatepickerEventObject) => any): JQuery; + off(events: "changeDate", handler: (eventObject: DatepickerEventObject) => any): JQuery; + + on(events: "changeDate", selector: string, data: any, handler?: (eventObject: DatepickerEventObject) => any): JQuery; + on(events: "changeDate", selector: string, handler: (eventObject: DatepickerEventObject) => any): JQuery; + on(events: 'changeDate', handler: (eventObject: DatepickerEventObject) => any): JQuery; +} diff --git a/bootstrap.paginator/bootstrap.paginator.d.ts.tscparams b/bootstrap.paginator/bootstrap.paginator.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/bootstrap.paginator/bootstrap.paginator.d.ts.tscparams +++ b/bootstrap.paginator/bootstrap.paginator.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/bootstrap/bootstrap-tests.ts b/bootstrap/bootstrap-tests.ts index fa4409fe3..c497e0abc 100644 --- a/bootstrap/bootstrap-tests.ts +++ b/bootstrap/bootstrap-tests.ts @@ -1,46 +1,46 @@ -/// -/// - -$('body').off('.data-api'); -$('body').off('.alert.data-api'); - -$(".btn.danger").button("toggle").addClass("fat"); -$("#myModal").modal(); -$("#myModal").modal({ keyboard: false }); -$("#myModal").modal('show'); - -$('#myModal').on('show', (e) => e.preventDefault()); - -$('#myModal').modal({ keyboard: false }); -$('#myModal').modal('toggle'); - -$('.dropdown-toggle').dropdown(); - -$('#navbar').scrollspy(); -$('body').scrollspy({ target: '#navbar-example' }); - -$('#element').tooltip('show'); - -$('#element').popover('show'); - -$(".alert").alert(); -$(".alert").alert('close'); - -$('.nav-tabs').button(); -$().button('toggle'); - -$(".collapse").collapse(); - -$('#myCollapsible').collapse({ toggle: false }); - -$('.carousel').carousel(); -$('.carousel').carousel({ interval: 2000 }); - -$('.typeahead').typeahead({ - matcher: item => true, - sorter: (items: any[]) => items, - updater: item => item, - highlighter: item => "" -}); - -$('#navbar').affix(); +/// +/// + +$('body').off('.data-api'); +$('body').off('.alert.data-api'); + +$(".btn.danger").button("toggle").addClass("fat"); +$("#myModal").modal(); +$("#myModal").modal({ keyboard: false }); +$("#myModal").modal('show'); + +$('#myModal').on('show', (e) => e.preventDefault()); + +$('#myModal').modal({ keyboard: false }); +$('#myModal').modal('toggle'); + +$('.dropdown-toggle').dropdown(); + +$('#navbar').scrollspy(); +$('body').scrollspy({ target: '#navbar-example' }); + +$('#element').tooltip('show'); + +$('#element').popover('show'); + +$(".alert").alert(); +$(".alert").alert('close'); + +$('.nav-tabs').button(); +$().button('toggle'); + +$(".collapse").collapse(); + +$('#myCollapsible').collapse({ toggle: false }); + +$('.carousel').carousel(); +$('.carousel').carousel({ interval: 2000 }); + +$('.typeahead').typeahead({ + matcher: item => true, + sorter: (items: any[]) => items, + updater: item => item, + highlighter: item => "" +}); + +$('#navbar').affix(); diff --git a/bootstrap/bootstrap.d.ts b/bootstrap/bootstrap.d.ts index 491eb3045..8037cad6c 100644 --- a/bootstrap/bootstrap.d.ts +++ b/bootstrap/bootstrap.d.ts @@ -1,120 +1,120 @@ -// Type definitions for Bootstrap 3.3.5 -// Project: http://twitter.github.com/bootstrap/ -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -interface ModalOptions { - backdrop?: boolean|string; - keyboard?: boolean; - show?: boolean; - remote?: string; -} - -interface ModalOptionsBackdropString { - backdrop?: string; // for "static" - keyboard?: boolean; - show?: boolean; - remote?: string; -} - -interface ScrollSpyOptions { - offset?: number; - target?: string; -} - -interface TooltipOptions { - animation?: boolean; - html?: boolean; - placement?: string | Function; - selector?: string; - title?: string | Function; - trigger?: string; - template?: string; - delay?: number | Object; - container?: string | boolean; - viewport?: string | Function | Object; -} - -interface PopoverOptions { - animation?: boolean; - html?: boolean; - placement?: string | Function; - selector?: string; - trigger?: string; - title?: string | Function; - template?: string; - content?: any; - delay?: number | Object; - container?: string | boolean; - viewport?: string | Function | Object; -} - -interface CollapseOptions { - parent?: any; - toggle?: boolean; -} - -interface CarouselOptions { - interval?: number; - pause?: string; - wrap?: boolean; - keybord?: boolean; -} - -interface TypeaheadOptions { - source?: any; - items?: number; - minLength?: number; - matcher?: (item: any) => boolean; - sorter?: (items: any[]) => any[]; - updater?: (item: any) => any; - highlighter?: (item: any) => string; -} - -interface AffixOptions { - offset?: number | Function | Object; - target?: any; -} - -interface JQuery { - modal(options?: ModalOptions): JQuery; - modal(options?: ModalOptionsBackdropString): JQuery; - modal(command: string): JQuery; - - dropdown(): JQuery; - dropdown(command: string): JQuery; - - scrollspy(command: string): JQuery; - scrollspy(options?: ScrollSpyOptions): JQuery; - - tab(): JQuery; - tab(command: string): JQuery; - - tooltip(options?: TooltipOptions): JQuery; - tooltip(command: string): JQuery; - - popover(options?: PopoverOptions): JQuery; - popover(command: string): JQuery; - - alert(): JQuery; - alert(command: string): JQuery; - - button(): JQuery; - button(command: string): JQuery; - - collapse(options?: CollapseOptions): JQuery; - collapse(command: string): JQuery; - - carousel(options?: CarouselOptions): JQuery; - carousel(command: string): JQuery; - - typeahead(options?: TypeaheadOptions): JQuery; - - affix(options?: AffixOptions): JQuery; -} - -declare module "bootstrap" { -} +// Type definitions for Bootstrap 3.3.5 +// Project: http://twitter.github.com/bootstrap/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +interface ModalOptions { + backdrop?: boolean|string; + keyboard?: boolean; + show?: boolean; + remote?: string; +} + +interface ModalOptionsBackdropString { + backdrop?: string; // for "static" + keyboard?: boolean; + show?: boolean; + remote?: string; +} + +interface ScrollSpyOptions { + offset?: number; + target?: string; +} + +interface TooltipOptions { + animation?: boolean; + html?: boolean; + placement?: string | Function; + selector?: string; + title?: string | Function; + trigger?: string; + template?: string; + delay?: number | Object; + container?: string | boolean; + viewport?: string | Function | Object; +} + +interface PopoverOptions { + animation?: boolean; + html?: boolean; + placement?: string | Function; + selector?: string; + trigger?: string; + title?: string | Function; + template?: string; + content?: any; + delay?: number | Object; + container?: string | boolean; + viewport?: string | Function | Object; +} + +interface CollapseOptions { + parent?: any; + toggle?: boolean; +} + +interface CarouselOptions { + interval?: number; + pause?: string; + wrap?: boolean; + keybord?: boolean; +} + +interface TypeaheadOptions { + source?: any; + items?: number; + minLength?: number; + matcher?: (item: any) => boolean; + sorter?: (items: any[]) => any[]; + updater?: (item: any) => any; + highlighter?: (item: any) => string; +} + +interface AffixOptions { + offset?: number | Function | Object; + target?: any; +} + +interface JQuery { + modal(options?: ModalOptions): JQuery; + modal(options?: ModalOptionsBackdropString): JQuery; + modal(command: string): JQuery; + + dropdown(): JQuery; + dropdown(command: string): JQuery; + + scrollspy(command: string): JQuery; + scrollspy(options?: ScrollSpyOptions): JQuery; + + tab(): JQuery; + tab(command: string): JQuery; + + tooltip(options?: TooltipOptions): JQuery; + tooltip(command: string): JQuery; + + popover(options?: PopoverOptions): JQuery; + popover(command: string): JQuery; + + alert(): JQuery; + alert(command: string): JQuery; + + button(): JQuery; + button(command: string): JQuery; + + collapse(options?: CollapseOptions): JQuery; + collapse(command: string): JQuery; + + carousel(options?: CarouselOptions): JQuery; + carousel(command: string): JQuery; + + typeahead(options?: TypeaheadOptions): JQuery; + + affix(options?: AffixOptions): JQuery; +} + +declare module "bootstrap" { +} diff --git a/browser-harness/browser-harness-tests.ts.tscparams b/browser-harness/browser-harness-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/browser-harness/browser-harness-tests.ts.tscparams +++ b/browser-harness/browser-harness-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/browser-harness/browser-harness.d.ts.tscparams b/browser-harness/browser-harness.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/browser-harness/browser-harness.d.ts.tscparams +++ b/browser-harness/browser-harness.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/camel-case/camel-case.d.ts b/camel-case/camel-case.d.ts index 9b2ec3fec..24f14e84a 100644 --- a/camel-case/camel-case.d.ts +++ b/camel-case/camel-case.d.ts @@ -1,9 +1,9 @@ -// Type definitions for camel-case -// Project: https://github.com/blakeembrey/camel-case -// Definitions by: Sam Saint-Pettersen -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module "camel-case" { - function camelCase(string: string, locale?: string): string; - export = camelCase; -} +// Type definitions for camel-case +// Project: https://github.com/blakeembrey/camel-case +// Definitions by: Sam Saint-Pettersen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "camel-case" { + function camelCase(string: string, locale?: string): string; + export = camelCase; +} diff --git a/casperjs/casperjs.d.ts b/casperjs/casperjs.d.ts index f03840380..e1fdd7dcf 100644 --- a/casperjs/casperjs.d.ts +++ b/casperjs/casperjs.d.ts @@ -1,312 +1,312 @@ -// Type definitions for CasperJS v1.0.0 -// Project: http://casperjs.org/ -// Definitions by: Jed Mao -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -interface CasperModule { - create(options: CasperOptions): Casper; - selectXPath(expression: string): Object -} - -interface EventEmitter { - removeAllFilters(filter: string): Casper; - setFilter(filter: string, cb: Function): boolean; -} - -interface Casper extends EventEmitter { - test: Tester; - - constructor (options: CasperOptions): Casper; - - options: CasperOptions; - // Properties - __utils__: ClientUtils; - - // Methods - back(): Casper; - base64encode(url: string, method?: string, data?: any): string; - bypass(nb: number): any; - click(selector: string): boolean; - clickLabel(label: string, tag?: string): boolean; - capture(targetFilePath: string, clipRect: ClipRect): Casper; - captureBase64(format: string): string; - captureBase64(format: string, area: string): string; - captureBase64(format: string, area: ClipRect): string; - captureBase64(format: string, area: any): string; - captureSelector(targetFile: string, selector: string): Casper; - clear(): Casper; - debugHTML(selector?: string, outer?: boolean): Casper; - debugPage(): Casper; - die(message: string, status?: number): Casper; - download(url: string, target?: string, method?: string, data?: any): Casper; - each(array: T[], fn: (self: Casper, item: T, index: number) => void): Casper; - echo(message: string, style?: string): Casper; - evaluate(fn: () => T, ...args: any[]): T - evaluateOrDie(fn: () => any, message?: string, status?: number): Casper; - exit(status?: number): Casper; - exists(selector: string): boolean; - fetchText(selector: string): string; - forward(): Casper; - log(message: string, level?: string, space?: string): Casper; - fill(selector: string, values: any, submit?: boolean): void; - fillSelectors(selector: string, values: any, submit?: boolean): void; - fillXPath(selector: string, values: any, submit?: boolean): void; - getCurrentUrl(): string; - getElementAttribute(selector: string, attribute: string): string; - getElementsAttribute(selector: string, attribute: string): string; - getElementBounds(selector: string): ElementBounds; - getElementsBounds(selector: string): ElementBounds[]; - getElementInfo(selector: string): ElementInfo; - getElementsInfo(selector: string): ElementInfo; - getFormValues(selector: string): any; - getGlobal(name: string): any; - getHTML(selector?: string, outer?: boolean): string; - getPageContent(): string; - getTitle(): string; - mouseEvent(type: string, selector: string): boolean; - open(location: string, settings: OpenSettings): Casper; - reload(then?: (response: HttpResponse) => void): Casper; - repeat(times: number, then: Function): Casper; - resourceExists(test: Function): boolean; - resourceExists(test: string): boolean; - run(onComplete: Function, time?: number): Casper; - scrollTo(x: number, y: number): Casper; - scrollToBottom(): Casper; - sendKeys(selector: string, keys: string, options?: any): Casper; - setHttpAuth(username: string, password: string): Casper; - start(url?: string, then?: (response: HttpResponse) => void): Casper; - status(asString: boolean): any; - then(fn: (self?: Casper) => void): Casper; - thenBypass(nb: number): Casper; - thenBypassIf(condition: any, nb: number): Casper; - thenBypassUnless(condition: any, nb: number): Casper; - thenClick(selector: string): Casper; - thenEvaluate(fn: () => any, ...args: any[]): Casper; - thenOpen(location: string, then?: (response: HttpResponse) => void): Casper; - thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper; - thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper; - toString(): string; - unwait(): Casper; - userAgent(agent: string): string; - viewport(width: number, height: number): Casper; - visible(selector: string): boolean; - wait(timeout: number, then?: Function): Casper; - waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForAlert(then: Function, onTimeout?: Function, timeout?: number): Casper; - waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForUrl(url: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForUrl(url: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForText(pattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitForText(pattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitUntilVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - waitWhileVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; - warn(message: string): Casper; - withFrame(frameInfo: string, then: Function): Casper; - withFrame(frameInfo: number, then: Function): Casper; - withPopup(popupInfo: string, step: Function): Casper; - withPopup(popupInfo: RegExp, step: Function): Casper; - zoom(factor: number): Casper; -} - -interface HttpResponse { - contentType: string; - headers: any[]; - id: number; - redirectURL: string; - stage: string; - status: number; - statusText: string; - time: string; - url: string; -} - -interface OpenSettings { - method: string; - data: any; - headers: any; -} - -interface ElementBounds { - top: number; - left: number; - width: number; - height: number; -} - -interface ElementInfo { - nodeName: string; - attributes: any; - tag: string; - html: string; - text: string; - x: number; - y: number; - width: number; - height: number; - visible: boolean; -} - -interface CasperOptions { - clientScripts?: any[]; - exitOnError?: boolean; - httpStatusHandlers?: any; - logLevel?: string; - onAlert?: Function; - onDie?: Function; - onError?: Function; - onLoadError?: Function; - onPageInitialized?: Function; - onResourceReceived?: Function; - onResourceRequested?: Function; - onStepComplete?: Function; - onStepTimeout?: Function; - onTimeout?: Function; - onWaitTimeout?: Function; - page?: WebPage; - pageSettings?: any; - remoteScripts?: any[]; - safeLogs?: boolean; - silentErrors?: boolean; - stepTimeout?: number; - timeout?: number; - verbose?: boolean; - viewportSize?: any; - retryTimeout?: number; - waitTimeout?: number; -} - -interface ClientUtils { - echo(message: string): void; - encode(contents: string): void; - exists(selector: string): void; - findAll(selector: string): void; - findOne(selector: string): void; - getBase64(url: string, method?: string, data?: any): void; - getBinary(url: string, method?: string, data?: any): void; - getDocumentHeight(): void; - getElementBounds(selector: string): void; - getElementsBounds(selector: string): void; - getElementByXPath(expression: string, scope?: HTMLElement): void; - getElementsByXPath(expression: string, scope?: HTMLElement): void; - getFieldValue(inputName: string): void; - getFormValues(selector: string): void; - mouseEvent(type: string, selector: string): void; - removeElementsByXPath(expression: string): void; - sendAJAX(url: string, method?: string, data?: any, async?: boolean): void; - visible(selector: string): void; -} - -interface Colorizer { - colorize(text: string, styleName: string): void; - format(text: string, style: any): void; -} - -interface Tester { - assert(condition: boolean, message?: string): any; - assertDoesntExist(selector: string, message?: string): any; - assertElementCount(selctor: string, expected: number, message?: string): any; - assertEquals(testValue: any, expected: any, message?: string): any; - assertEval(fn: Function, message: string, arguments: any): any; - assertEvalEquals(fn: Function, expected: any, message?: string, arguments?: any): any; - assertExists(selector: string, message?: string): any; - assertFalsy(subject: any, message?: string): any; - assertField(inputName: string, expected: string, message?: string): any; - assertFieldName(inputName: string, expected: string, message?: string, options?: any): any; - assertFieldCSS(cssSelector: string, expected: string, message?: string): any; - assertFieldXPath(xpathSelector: string, expected: string, message?: string): any; - assertHttpStatus(status: number, message?: string): any; - assertMatch(subject: any, pattern: RegExp, message?: string): any; - assertNot(subject: any, message?: string): any; - assertNotEquals(testValue: any, expected: any, message?: string): any; - assertNotVisible(selector: string, message?: string): any; - assertRaises(fn: Function, args: any[], message?: string): any; - assertSelectorDoesntHaveText(selector: string, text: string, message?: string): any; - assertSelectorExists(selector: string, message?: string): any; - assertSelectorHasText(selector: string, text: string, message?: string): any; - assertResourceExists(testFx: Function, message?: string): any; - assertTextExists(expected: string, message?: string): any; - assertTextDoesntExist(unexpected: string, message: string): any; - assertTitle(expected: string, message?: string): any; - assertTitleMatch(pattern: RegExp, message?: string): any; - assertTruthy(subject: any, message?: string): any; - assertType(input: any, type: string, message?: string): any; - assertInstanceOf(input: any, ctor: Function, message?: string): any; - assertUrlMatch(pattern: string, message?: string): any; - assertUrlMatch(pattern: RegExp, message?: string): any; - assertVisible(selector: string, message?: string): any; - - /* since 1.1 */ - begin(description: string, planned: number, suite: Function): any; - begin(description: string, suite: Function): any; - begin(description: string, planned: number, config: Object): any; - begin(description: string, config: Object): any; - - colorize(message: string, style: string): any; - comment(message: string): any; - done(expected?: number): any; - error(message: string): any; - fail(message: string): any; - formatMessage(message: string, style: string): any; - getFailures(): Cases; - getPasses(): Cases; - info(message: string): any; - pass(message: string): any; - renderResults(exit: boolean, status: number, save: string): any; - - setup(fn: Function): any; - skip(nb: number, message: string): any; - tearDown(fn: Function): any; -} - -interface Cases { - length: number; - cases: Case[]; -} - -interface Case { - success: boolean; - type: string; - standard: string; - file: string; - values: CaseValues; -} - -interface CaseValues { - subject: boolean; - expected: boolean; -} - -interface Utils { - betterTypeOf(input: any): any; - dump(value: any): any; - fileExt(file: string): any; - fillBlanks(text: string, pad: number): any; - format(f: string, ...args: any[]): any; - getPropertyPath(obj: any, path: string): any; - inherits(ctor: any, superCtor: any): any; - isArray(value: any): any; - isCasperObject(value: any): any; - isClipRect(value: any): any; - isFalsy(subject: any): any; - isFunction(value: any): any; - isJsFile(file: string): any; - isNull(value: any): any; - isNumber(value: any): any; - isObject(value: any): any; - isRegExp(value: any): any; - isString(value: any): any; - isTruthy(subject: any): any; - isType(what: any, type: string): any; - isUndefined(value: any): any; - isWebPage(what: any): any; - mergeObjects(origin: any, add: any): any; - node(name: string, attributes: any): any; - serialize(value: any): any; - unique(array: any[]): any; -} +// Type definitions for CasperJS v1.0.0 +// Project: http://casperjs.org/ +// Definitions by: Jed Mao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface CasperModule { + create(options: CasperOptions): Casper; + selectXPath(expression: string): Object +} + +interface EventEmitter { + removeAllFilters(filter: string): Casper; + setFilter(filter: string, cb: Function): boolean; +} + +interface Casper extends EventEmitter { + test: Tester; + + constructor (options: CasperOptions): Casper; + + options: CasperOptions; + // Properties + __utils__: ClientUtils; + + // Methods + back(): Casper; + base64encode(url: string, method?: string, data?: any): string; + bypass(nb: number): any; + click(selector: string): boolean; + clickLabel(label: string, tag?: string): boolean; + capture(targetFilePath: string, clipRect: ClipRect): Casper; + captureBase64(format: string): string; + captureBase64(format: string, area: string): string; + captureBase64(format: string, area: ClipRect): string; + captureBase64(format: string, area: any): string; + captureSelector(targetFile: string, selector: string): Casper; + clear(): Casper; + debugHTML(selector?: string, outer?: boolean): Casper; + debugPage(): Casper; + die(message: string, status?: number): Casper; + download(url: string, target?: string, method?: string, data?: any): Casper; + each(array: T[], fn: (self: Casper, item: T, index: number) => void): Casper; + echo(message: string, style?: string): Casper; + evaluate(fn: () => T, ...args: any[]): T + evaluateOrDie(fn: () => any, message?: string, status?: number): Casper; + exit(status?: number): Casper; + exists(selector: string): boolean; + fetchText(selector: string): string; + forward(): Casper; + log(message: string, level?: string, space?: string): Casper; + fill(selector: string, values: any, submit?: boolean): void; + fillSelectors(selector: string, values: any, submit?: boolean): void; + fillXPath(selector: string, values: any, submit?: boolean): void; + getCurrentUrl(): string; + getElementAttribute(selector: string, attribute: string): string; + getElementsAttribute(selector: string, attribute: string): string; + getElementBounds(selector: string): ElementBounds; + getElementsBounds(selector: string): ElementBounds[]; + getElementInfo(selector: string): ElementInfo; + getElementsInfo(selector: string): ElementInfo; + getFormValues(selector: string): any; + getGlobal(name: string): any; + getHTML(selector?: string, outer?: boolean): string; + getPageContent(): string; + getTitle(): string; + mouseEvent(type: string, selector: string): boolean; + open(location: string, settings: OpenSettings): Casper; + reload(then?: (response: HttpResponse) => void): Casper; + repeat(times: number, then: Function): Casper; + resourceExists(test: Function): boolean; + resourceExists(test: string): boolean; + run(onComplete: Function, time?: number): Casper; + scrollTo(x: number, y: number): Casper; + scrollToBottom(): Casper; + sendKeys(selector: string, keys: string, options?: any): Casper; + setHttpAuth(username: string, password: string): Casper; + start(url?: string, then?: (response: HttpResponse) => void): Casper; + status(asString: boolean): any; + then(fn: (self?: Casper) => void): Casper; + thenBypass(nb: number): Casper; + thenBypassIf(condition: any, nb: number): Casper; + thenBypassUnless(condition: any, nb: number): Casper; + thenClick(selector: string): Casper; + thenEvaluate(fn: () => any, ...args: any[]): Casper; + thenOpen(location: string, then?: (response: HttpResponse) => void): Casper; + thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper; + thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper; + toString(): string; + unwait(): Casper; + userAgent(agent: string): string; + viewport(width: number, height: number): Casper; + visible(selector: string): boolean; + wait(timeout: number, then?: Function): Casper; + waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForAlert(then: Function, onTimeout?: Function, timeout?: number): Casper; + waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForUrl(url: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForUrl(url: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForText(pattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitForText(pattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitUntilVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + waitWhileVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper; + warn(message: string): Casper; + withFrame(frameInfo: string, then: Function): Casper; + withFrame(frameInfo: number, then: Function): Casper; + withPopup(popupInfo: string, step: Function): Casper; + withPopup(popupInfo: RegExp, step: Function): Casper; + zoom(factor: number): Casper; +} + +interface HttpResponse { + contentType: string; + headers: any[]; + id: number; + redirectURL: string; + stage: string; + status: number; + statusText: string; + time: string; + url: string; +} + +interface OpenSettings { + method: string; + data: any; + headers: any; +} + +interface ElementBounds { + top: number; + left: number; + width: number; + height: number; +} + +interface ElementInfo { + nodeName: string; + attributes: any; + tag: string; + html: string; + text: string; + x: number; + y: number; + width: number; + height: number; + visible: boolean; +} + +interface CasperOptions { + clientScripts?: any[]; + exitOnError?: boolean; + httpStatusHandlers?: any; + logLevel?: string; + onAlert?: Function; + onDie?: Function; + onError?: Function; + onLoadError?: Function; + onPageInitialized?: Function; + onResourceReceived?: Function; + onResourceRequested?: Function; + onStepComplete?: Function; + onStepTimeout?: Function; + onTimeout?: Function; + onWaitTimeout?: Function; + page?: WebPage; + pageSettings?: any; + remoteScripts?: any[]; + safeLogs?: boolean; + silentErrors?: boolean; + stepTimeout?: number; + timeout?: number; + verbose?: boolean; + viewportSize?: any; + retryTimeout?: number; + waitTimeout?: number; +} + +interface ClientUtils { + echo(message: string): void; + encode(contents: string): void; + exists(selector: string): void; + findAll(selector: string): void; + findOne(selector: string): void; + getBase64(url: string, method?: string, data?: any): void; + getBinary(url: string, method?: string, data?: any): void; + getDocumentHeight(): void; + getElementBounds(selector: string): void; + getElementsBounds(selector: string): void; + getElementByXPath(expression: string, scope?: HTMLElement): void; + getElementsByXPath(expression: string, scope?: HTMLElement): void; + getFieldValue(inputName: string): void; + getFormValues(selector: string): void; + mouseEvent(type: string, selector: string): void; + removeElementsByXPath(expression: string): void; + sendAJAX(url: string, method?: string, data?: any, async?: boolean): void; + visible(selector: string): void; +} + +interface Colorizer { + colorize(text: string, styleName: string): void; + format(text: string, style: any): void; +} + +interface Tester { + assert(condition: boolean, message?: string): any; + assertDoesntExist(selector: string, message?: string): any; + assertElementCount(selctor: string, expected: number, message?: string): any; + assertEquals(testValue: any, expected: any, message?: string): any; + assertEval(fn: Function, message: string, arguments: any): any; + assertEvalEquals(fn: Function, expected: any, message?: string, arguments?: any): any; + assertExists(selector: string, message?: string): any; + assertFalsy(subject: any, message?: string): any; + assertField(inputName: string, expected: string, message?: string): any; + assertFieldName(inputName: string, expected: string, message?: string, options?: any): any; + assertFieldCSS(cssSelector: string, expected: string, message?: string): any; + assertFieldXPath(xpathSelector: string, expected: string, message?: string): any; + assertHttpStatus(status: number, message?: string): any; + assertMatch(subject: any, pattern: RegExp, message?: string): any; + assertNot(subject: any, message?: string): any; + assertNotEquals(testValue: any, expected: any, message?: string): any; + assertNotVisible(selector: string, message?: string): any; + assertRaises(fn: Function, args: any[], message?: string): any; + assertSelectorDoesntHaveText(selector: string, text: string, message?: string): any; + assertSelectorExists(selector: string, message?: string): any; + assertSelectorHasText(selector: string, text: string, message?: string): any; + assertResourceExists(testFx: Function, message?: string): any; + assertTextExists(expected: string, message?: string): any; + assertTextDoesntExist(unexpected: string, message: string): any; + assertTitle(expected: string, message?: string): any; + assertTitleMatch(pattern: RegExp, message?: string): any; + assertTruthy(subject: any, message?: string): any; + assertType(input: any, type: string, message?: string): any; + assertInstanceOf(input: any, ctor: Function, message?: string): any; + assertUrlMatch(pattern: string, message?: string): any; + assertUrlMatch(pattern: RegExp, message?: string): any; + assertVisible(selector: string, message?: string): any; + + /* since 1.1 */ + begin(description: string, planned: number, suite: Function): any; + begin(description: string, suite: Function): any; + begin(description: string, planned: number, config: Object): any; + begin(description: string, config: Object): any; + + colorize(message: string, style: string): any; + comment(message: string): any; + done(expected?: number): any; + error(message: string): any; + fail(message: string): any; + formatMessage(message: string, style: string): any; + getFailures(): Cases; + getPasses(): Cases; + info(message: string): any; + pass(message: string): any; + renderResults(exit: boolean, status: number, save: string): any; + + setup(fn: Function): any; + skip(nb: number, message: string): any; + tearDown(fn: Function): any; +} + +interface Cases { + length: number; + cases: Case[]; +} + +interface Case { + success: boolean; + type: string; + standard: string; + file: string; + values: CaseValues; +} + +interface CaseValues { + subject: boolean; + expected: boolean; +} + +interface Utils { + betterTypeOf(input: any): any; + dump(value: any): any; + fileExt(file: string): any; + fillBlanks(text: string, pad: number): any; + format(f: string, ...args: any[]): any; + getPropertyPath(obj: any, path: string): any; + inherits(ctor: any, superCtor: any): any; + isArray(value: any): any; + isCasperObject(value: any): any; + isClipRect(value: any): any; + isFalsy(subject: any): any; + isFunction(value: any): any; + isJsFile(file: string): any; + isNull(value: any): any; + isNumber(value: any): any; + isObject(value: any): any; + isRegExp(value: any): any; + isString(value: any): any; + isTruthy(subject: any): any; + isType(what: any, type: string): any; + isUndefined(value: any): any; + isWebPage(what: any): any; + mergeObjects(origin: any, add: any): any; + node(name: string, attributes: any): any; + serialize(value: any): any; + unique(array: any[]): any; +} diff --git a/chai/chai-3.2.0.d.ts b/chai/chai-3.2.0.d.ts index e68e6fa3b..3ef3046ac 100644 --- a/chai/chai-3.2.0.d.ts +++ b/chai/chai-3.2.0.d.ts @@ -1,388 +1,388 @@ -// Type definitions for chai 3.2.0 -// Project: http://chaijs.com/ -// Definitions by: Jed Mao , -// Bart van der Schoor , -// Andrew Brown , -// Olivier Chevet -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -// - -declare module Chai { - - interface ChaiStatic { - expect: ExpectStatic; - should(): Should; - /** - * Provides a way to extend the internals of Chai - */ - use(fn: (chai: any, utils: any) => void): any; - assert: AssertStatic; - config: Config; - AssertionError: typeof AssertionError; - } - - export interface ExpectStatic extends AssertionStatic { - fail(actual?: any, expected?: any, message?: string, operator?: string): void; - } - - export interface AssertStatic extends Assert { - } - - export interface AssertionStatic { - (target: any, message?: string): Assertion; - } - - interface ShouldAssertion { - equal(value1: any, value2: any, message?: string): void; - Throw: ShouldThrow; - throw: ShouldThrow; - exist(value: any, message?: string): void; - } - - interface Should extends ShouldAssertion { - not: ShouldAssertion; - fail(actual: any, expected: any, message?: string, operator?: string): void; - } - - interface ShouldThrow { - (actual: Function): void; - (actual: Function, expected: string|RegExp, message?: string): void; - (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; - } - - interface Assertion extends LanguageChains, NumericComparison, TypeComparison { - not: Assertion; - deep: Deep; - any: KeyFilter; - all: KeyFilter; - a: TypeComparison; - an: TypeComparison; - include: Include; - includes: Include; - contain: Include; - contains: Include; - ok: Assertion; - true: Assertion; - false: Assertion; - null: Assertion; - undefined: Assertion; - NaN: Assertion; - exist: Assertion; - empty: Assertion; - arguments: Assertion; - Arguments: Assertion; - equal: Equal; - equals: Equal; - eq: Equal; - eql: Equal; - eqls: Equal; - property: Property; - ownProperty: OwnProperty; - haveOwnProperty: OwnProperty; - ownPropertyDescriptor: OwnPropertyDescriptor; - haveOwnPropertyDescriptor: OwnPropertyDescriptor; - length: Length; - lengthOf: Length; - match: Match; - matches: Match; - string(string: string, message?: string): Assertion; - keys: Keys; - key(string: string): Assertion; - throw: Throw; - throws: Throw; - Throw: Throw; - respondTo: RespondTo; - respondsTo: RespondTo; - itself: Assertion; - satisfy: Satisfy; - satisfies: Satisfy; - closeTo(expected: number, delta: number, message?: string): Assertion; - members: Members; - increase: PropertyChange; - increases: PropertyChange; - decrease: PropertyChange; - decreases: PropertyChange; - change: PropertyChange; - changes: PropertyChange; - extensible: Assertion; - sealed: Assertion; - frozen: Assertion; - - } - - interface LanguageChains { - to: Assertion; - be: Assertion; - been: Assertion; - is: Assertion; - that: Assertion; - which: Assertion; - and: Assertion; - has: Assertion; - have: Assertion; - with: Assertion; - at: Assertion; - of: Assertion; - same: Assertion; - } - - interface NumericComparison { - above: NumberComparer; - gt: NumberComparer; - greaterThan: NumberComparer; - least: NumberComparer; - gte: NumberComparer; - below: NumberComparer; - lt: NumberComparer; - lessThan: NumberComparer; - most: NumberComparer; - lte: NumberComparer; - within(start: number, finish: number, message?: string): Assertion; - } - - interface NumberComparer { - (value: number, message?: string): Assertion; - } - - interface TypeComparison { - (type: string, message?: string): Assertion; - instanceof: InstanceOf; - instanceOf: InstanceOf; - } - - interface InstanceOf { - (constructor: Object, message?: string): Assertion; - } - - interface Deep { - equal: Equal; - include: Include; - property: Property; - members: Members; - } - - interface KeyFilter { - keys: Keys; - } - - interface Equal { - (value: any, message?: string): Assertion; - } - - interface Property { - (name: string, value?: any, message?: string): Assertion; - } - - interface OwnProperty { - (name: string, message?: string): Assertion; - } - - interface OwnPropertyDescriptor { - (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; - (name: string, message?: string): Assertion; - } - - interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Assertion; - } - - interface Include { - (value: Object, message?: string): Assertion; - (value: string, message?: string): Assertion; - (value: number, message?: string): Assertion; - keys: Keys; - members: Members; - any: KeyFilter; - all: KeyFilter; - } - - interface Match { - (regexp: RegExp|string, message?: string): Assertion; - } - - interface Keys { - (...keys: string[]): Assertion; - (keys: any[]): Assertion; - (keys: Object): Assertion; - } - - interface Throw { - (): Assertion; - (expected: string, message?: string): Assertion; - (expected: RegExp, message?: string): Assertion; - (constructor: Error, expected?: string, message?: string): Assertion; - (constructor: Error, expected?: RegExp, message?: string): Assertion; - (constructor: Function, expected?: string, message?: string): Assertion; - (constructor: Function, expected?: RegExp, message?: string): Assertion; - } - - interface RespondTo { - (method: string, message?: string): Assertion; - } - - interface Satisfy { - (matcher: Function, message?: string): Assertion; - } - - interface Members { - (set: any[], message?: string): Assertion; - } - - interface PropertyChange { - (object: Object, prop: string, msg?: string): Assertion; - } - - export interface Assert { - /** - * @param expression Expression to test for truthiness. - * @param message Message to display on error. - */ - (expression: any, message?: string): void; - - fail(actual?: any, expected?: any, msg?: string, operator?: string): void; - - ok(val: any, msg?: string): void; - isOk(val: any, msg?: string): void; - notOk(val: any, msg?: string): void; - isNotOk(val: any, msg?: string): void; - - equal(act: any, exp: any, msg?: string): void; - notEqual(act: any, exp: any, msg?: string): void; - - strictEqual(act: any, exp: any, msg?: string): void; - notStrictEqual(act: any, exp: any, msg?: string): void; - - deepEqual(act: any, exp: any, msg?: string): void; - notDeepEqual(act: any, exp: any, msg?: string): void; - - isTrue(val: any, msg?: string): void; - isFalse(val: any, msg?: string): void; - - isNull(val: any, msg?: string): void; - isNotNull(val: any, msg?: string): void; - - isUndefined(val: any, msg?: string): void; - isDefined(val: any, msg?: string): void; - - isNaN(val: any, msg?: string): void; - isNotNaN(val: any, msg?: string): void; - - isAbove(val: number, abv: number, msg?: string): void; - isBelow(val: number, blw: number, msg?: string): void; - - isFunction(val: any, msg?: string): void; - isNotFunction(val: any, msg?: string): void; - - isObject(val: any, msg?: string): void; - isNotObject(val: any, msg?: string): void; - - isArray(val: any, msg?: string): void; - isNotArray(val: any, msg?: string): void; - - isString(val: any, msg?: string): void; - isNotString(val: any, msg?: string): void; - - isNumber(val: any, msg?: string): void; - isNotNumber(val: any, msg?: string): void; - - isBoolean(val: any, msg?: string): void; - isNotBoolean(val: any, msg?: string): void; - - typeOf(val: any, type: string, msg?: string): void; - notTypeOf(val: any, type: string, msg?: string): void; - - instanceOf(val: any, type: Function, msg?: string): void; - notInstanceOf(val: any, type: Function, msg?: string): void; - - include(exp: string, inc: any, msg?: string): void; - include(exp: any[], inc: any, msg?: string): void; - - notInclude(exp: string, inc: any, msg?: string): void; - notInclude(exp: any[], inc: any, msg?: string): void; - - match(exp: any, re: RegExp, msg?: string): void; - notMatch(exp: any, re: RegExp, msg?: string): void; - - property(obj: Object, prop: string, msg?: string): void; - notProperty(obj: Object, prop: string, msg?: string): void; - deepProperty(obj: Object, prop: string, msg?: string): void; - notDeepProperty(obj: Object, prop: string, msg?: string): void; - - propertyVal(obj: Object, prop: string, val: any, msg?: string): void; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - lengthOf(exp: any, len: number, msg?: string): void; - //alias frenzy - throw(fn: Function, msg?: string): void; - throw(fn: Function, regExp: RegExp): void; - throw(fn: Function, errType: Function, msg?: string): void; - throw(fn: Function, errType: Function, regExp: RegExp): void; - - throws(fn: Function, msg?: string): void; - throws(fn: Function, regExp: RegExp): void; - throws(fn: Function, errType: Function, msg?: string): void; - throws(fn: Function, errType: Function, regExp: RegExp): void; - - Throw(fn: Function, msg?: string): void; - Throw(fn: Function, regExp: RegExp): void; - Throw(fn: Function, errType: Function, msg?: string): void; - Throw(fn: Function, errType: Function, regExp: RegExp): void; - - doesNotThrow(fn: Function, msg?: string): void; - doesNotThrow(fn: Function, regExp: RegExp): void; - doesNotThrow(fn: Function, errType: Function, msg?: string): void; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; - - operator(val: any, operator: string, val2: any, msg?: string): void; - closeTo(act: number, exp: number, delta: number, msg?: string): void; - - sameMembers(set1: any[], set2: any[], msg?: string): void; - sameDeepMembers(set1: any[], set2: any[], msg?: string): void; - includeMembers(superset: any[], subset: any[], msg?: string): void; - - ifError(val: any, msg?: string): void; - - isExtensible(obj: {}, msg?: string): void; - extensible(obj: {}, msg?: string): void; - isNotExtensible(obj: {}, msg?: string): void; - notExtensible(obj: {}, msg?: string): void; - - isSealed(obj: {}, msg?: string): void; - sealed(obj: {}, msg?: string): void; - isNotSealed(obj: {}, msg?: string): void; - notSealed(obj: {}, msg?: string): void; - - isFrozen(obj: Object, msg?: string): void; - frozen(obj: Object, msg?: string): void; - isNotFrozen(obj: Object, msg?: string): void; - notFrozen(obj: Object, msg?: string): void; - - - } - - export interface Config { - includeStack: boolean; - } - - export class AssertionError { - constructor(message: string, _props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; - } -} - -declare var chai: Chai.ChaiStatic; - -declare module "chai" { - export = chai; -} - -interface Object { - should: Chai.Assertion; -} +// Type definitions for chai 3.2.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown , +// Olivier Chevet +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; + AssertionError: typeof AssertionError; + } + + export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (target: any, message?: string): Assertion; + } + + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + any: KeyFilter; + all: KeyFilter; + a: TypeComparison; + an: TypeComparison; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo(expected: number, delta: number, message?: string): Assertion; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + + } + + interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + (keys: Object): Assertion; + } + + interface Throw { + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; + + ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + isNotOk(val: any, msg?: string): void; + + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; + + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; + + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; + + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, msg?: string): void; + + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; + + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; + + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; + + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; + + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; + + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; + + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; + + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; + + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; + + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; + + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; + + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + lengthOf(exp: any, len: number, msg?: string): void; + //alias frenzy + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; + + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; + + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; + + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; + + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 074827b65..80ab1320e 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,401 +1,401 @@ -// Type definitions for chai 3.4.0 -// Project: http://chaijs.com/ -// Definitions by: Jed Mao , -// Bart van der Schoor , -// Andrew Brown , -// Olivier Chevet , -// Matt Wistrand -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -// - -declare module Chai { - - interface ChaiStatic { - expect: ExpectStatic; - should(): Should; - /** - * Provides a way to extend the internals of Chai - */ - use(fn: (chai: any, utils: any) => void): any; - assert: AssertStatic; - config: Config; - AssertionError: typeof AssertionError; - } - - export interface ExpectStatic extends AssertionStatic { - fail(actual?: any, expected?: any, message?: string, operator?: string): void; - } - - export interface AssertStatic extends Assert { - } - - export interface AssertionStatic { - (target: any, message?: string): Assertion; - } - - interface ShouldAssertion { - equal(value1: any, value2: any, message?: string): void; - Throw: ShouldThrow; - throw: ShouldThrow; - exist(value: any, message?: string): void; - } - - interface Should extends ShouldAssertion { - not: ShouldAssertion; - fail(actual: any, expected: any, message?: string, operator?: string): void; - } - - interface ShouldThrow { - (actual: Function): void; - (actual: Function, expected: string|RegExp, message?: string): void; - (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; - } - - interface Assertion extends LanguageChains, NumericComparison, TypeComparison { - not: Assertion; - deep: Deep; - any: KeyFilter; - all: KeyFilter; - a: TypeComparison; - an: TypeComparison; - include: Include; - includes: Include; - contain: Include; - contains: Include; - ok: Assertion; - true: Assertion; - false: Assertion; - null: Assertion; - undefined: Assertion; - NaN: Assertion; - exist: Assertion; - empty: Assertion; - arguments: Assertion; - Arguments: Assertion; - equal: Equal; - equals: Equal; - eq: Equal; - eql: Equal; - eqls: Equal; - property: Property; - ownProperty: OwnProperty; - haveOwnProperty: OwnProperty; - ownPropertyDescriptor: OwnPropertyDescriptor; - haveOwnPropertyDescriptor: OwnPropertyDescriptor; - length: Length; - lengthOf: Length; - match: Match; - matches: Match; - string(string: string, message?: string): Assertion; - keys: Keys; - key(string: string): Assertion; - throw: Throw; - throws: Throw; - Throw: Throw; - respondTo: RespondTo; - respondsTo: RespondTo; - itself: Assertion; - satisfy: Satisfy; - satisfies: Satisfy; - closeTo: CloseTo; - approximately: CloseTo; - members: Members; - increase: PropertyChange; - increases: PropertyChange; - decrease: PropertyChange; - decreases: PropertyChange; - change: PropertyChange; - changes: PropertyChange; - extensible: Assertion; - sealed: Assertion; - frozen: Assertion; - oneOf(list: any[], message?: string): Assertion; - } - - interface LanguageChains { - to: Assertion; - be: Assertion; - been: Assertion; - is: Assertion; - that: Assertion; - which: Assertion; - and: Assertion; - has: Assertion; - have: Assertion; - with: Assertion; - at: Assertion; - of: Assertion; - same: Assertion; - } - - interface NumericComparison { - above: NumberComparer; - gt: NumberComparer; - greaterThan: NumberComparer; - least: NumberComparer; - gte: NumberComparer; - below: NumberComparer; - lt: NumberComparer; - lessThan: NumberComparer; - most: NumberComparer; - lte: NumberComparer; - within(start: number, finish: number, message?: string): Assertion; - } - - interface NumberComparer { - (value: number, message?: string): Assertion; - } - - interface TypeComparison { - (type: string, message?: string): Assertion; - instanceof: InstanceOf; - instanceOf: InstanceOf; - } - - interface InstanceOf { - (constructor: Object, message?: string): Assertion; - } - - interface CloseTo { - (expected: number, delta: number, message?: string): Assertion; - } - - interface Deep { - equal: Equal; - include: Include; - property: Property; - members: Members; - } - - interface KeyFilter { - keys: Keys; - } - - interface Equal { - (value: any, message?: string): Assertion; - } - - interface Property { - (name: string, value?: any, message?: string): Assertion; - } - - interface OwnProperty { - (name: string, message?: string): Assertion; - } - - interface OwnPropertyDescriptor { - (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; - (name: string, message?: string): Assertion; - } - - interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Assertion; - } - - interface Include { - (value: Object, message?: string): Assertion; - (value: string, message?: string): Assertion; - (value: number, message?: string): Assertion; - keys: Keys; - members: Members; - any: KeyFilter; - all: KeyFilter; - } - - interface Match { - (regexp: RegExp|string, message?: string): Assertion; - } - - interface Keys { - (...keys: string[]): Assertion; - (keys: any[]): Assertion; - (keys: Object): Assertion; - } - - interface Throw { - (): Assertion; - (expected: string, message?: string): Assertion; - (expected: RegExp, message?: string): Assertion; - (constructor: Error, expected?: string, message?: string): Assertion; - (constructor: Error, expected?: RegExp, message?: string): Assertion; - (constructor: Function, expected?: string, message?: string): Assertion; - (constructor: Function, expected?: RegExp, message?: string): Assertion; - } - - interface RespondTo { - (method: string, message?: string): Assertion; - } - - interface Satisfy { - (matcher: Function, message?: string): Assertion; - } - - interface Members { - (set: any[], message?: string): Assertion; - } - - interface PropertyChange { - (object: Object, prop: string, msg?: string): Assertion; - } - - export interface Assert { - /** - * @param expression Expression to test for truthiness. - * @param message Message to display on error. - */ - (expression: any, message?: string): void; - - fail(actual?: any, expected?: any, msg?: string, operator?: string): void; - - ok(val: any, msg?: string): void; - isOk(val: any, msg?: string): void; - notOk(val: any, msg?: string): void; - isNotOk(val: any, msg?: string): void; - - equal(act: any, exp: any, msg?: string): void; - notEqual(act: any, exp: any, msg?: string): void; - - strictEqual(act: any, exp: any, msg?: string): void; - notStrictEqual(act: any, exp: any, msg?: string): void; - - deepEqual(act: any, exp: any, msg?: string): void; - notDeepEqual(act: any, exp: any, msg?: string): void; - - isTrue(val: any, msg?: string): void; - isFalse(val: any, msg?: string): void; - - isNotTrue(val: any, msg?: string): void; - isNotFalse(val: any, msg?: string): void; - - isNull(val: any, msg?: string): void; - isNotNull(val: any, msg?: string): void; - - isUndefined(val: any, msg?: string): void; - isDefined(val: any, msg?: string): void; - - isNaN(val: any, msg?: string): void; - isNotNaN(val: any, msg?: string): void; - - isAbove(val: number, abv: number, msg?: string): void; - isBelow(val: number, blw: number, msg?: string): void; - - isAtLeast(val: number, atlst: number, msg?: string): void; - isAtMost(val: number, atmst: number, msg?: string): void; - - isFunction(val: any, msg?: string): void; - isNotFunction(val: any, msg?: string): void; - - isObject(val: any, msg?: string): void; - isNotObject(val: any, msg?: string): void; - - isArray(val: any, msg?: string): void; - isNotArray(val: any, msg?: string): void; - - isString(val: any, msg?: string): void; - isNotString(val: any, msg?: string): void; - - isNumber(val: any, msg?: string): void; - isNotNumber(val: any, msg?: string): void; - - isBoolean(val: any, msg?: string): void; - isNotBoolean(val: any, msg?: string): void; - - typeOf(val: any, type: string, msg?: string): void; - notTypeOf(val: any, type: string, msg?: string): void; - - instanceOf(val: any, type: Function, msg?: string): void; - notInstanceOf(val: any, type: Function, msg?: string): void; - - include(exp: string, inc: any, msg?: string): void; - include(exp: any[], inc: any, msg?: string): void; - - notInclude(exp: string, inc: any, msg?: string): void; - notInclude(exp: any[], inc: any, msg?: string): void; - - match(exp: any, re: RegExp, msg?: string): void; - notMatch(exp: any, re: RegExp, msg?: string): void; - - property(obj: Object, prop: string, msg?: string): void; - notProperty(obj: Object, prop: string, msg?: string): void; - deepProperty(obj: Object, prop: string, msg?: string): void; - notDeepProperty(obj: Object, prop: string, msg?: string): void; - - propertyVal(obj: Object, prop: string, val: any, msg?: string): void; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - lengthOf(exp: any, len: number, msg?: string): void; - //alias frenzy - throw(fn: Function, msg?: string): void; - throw(fn: Function, regExp: RegExp): void; - throw(fn: Function, errType: Function, msg?: string): void; - throw(fn: Function, errType: Function, regExp: RegExp): void; - - throws(fn: Function, msg?: string): void; - throws(fn: Function, regExp: RegExp): void; - throws(fn: Function, errType: Function, msg?: string): void; - throws(fn: Function, errType: Function, regExp: RegExp): void; - - Throw(fn: Function, msg?: string): void; - Throw(fn: Function, regExp: RegExp): void; - Throw(fn: Function, errType: Function, msg?: string): void; - Throw(fn: Function, errType: Function, regExp: RegExp): void; - - doesNotThrow(fn: Function, msg?: string): void; - doesNotThrow(fn: Function, regExp: RegExp): void; - doesNotThrow(fn: Function, errType: Function, msg?: string): void; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; - - operator(val: any, operator: string, val2: any, msg?: string): void; - closeTo(act: number, exp: number, delta: number, msg?: string): void; - approximately(act: number, exp: number, delta: number, msg?: string): void; - - sameMembers(set1: any[], set2: any[], msg?: string): void; - sameDeepMembers(set1: any[], set2: any[], msg?: string): void; - includeMembers(superset: any[], subset: any[], msg?: string): void; - - ifError(val: any, msg?: string): void; - - isExtensible(obj: {}, msg?: string): void; - extensible(obj: {}, msg?: string): void; - isNotExtensible(obj: {}, msg?: string): void; - notExtensible(obj: {}, msg?: string): void; - - isSealed(obj: {}, msg?: string): void; - sealed(obj: {}, msg?: string): void; - isNotSealed(obj: {}, msg?: string): void; - notSealed(obj: {}, msg?: string): void; - - isFrozen(obj: Object, msg?: string): void; - frozen(obj: Object, msg?: string): void; - isNotFrozen(obj: Object, msg?: string): void; - notFrozen(obj: Object, msg?: string): void; - - oneOf(inList: any, list: any[], msg?: string): void; - } - - export interface Config { - includeStack: boolean; - } - - export class AssertionError { - constructor(message: string, _props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; - } -} - -declare var chai: Chai.ChaiStatic; - -declare module "chai" { - export = chai; -} - -interface Object { - should: Chai.Assertion; -} +// Type definitions for chai 3.4.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown , +// Olivier Chevet , +// Matt Wistrand +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; + AssertionError: typeof AssertionError; + } + + export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (target: any, message?: string): Assertion; + } + + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + any: KeyFilter; + all: KeyFilter; + a: TypeComparison; + an: TypeComparison; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo: CloseTo; + approximately: CloseTo; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + oneOf(list: any[], message?: string): Assertion; + } + + interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface CloseTo { + (expected: number, delta: number, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + (keys: Object): Assertion; + } + + interface Throw { + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; + + ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + isNotOk(val: any, msg?: string): void; + + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; + + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; + + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; + + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; + + isNotTrue(val: any, msg?: string): void; + isNotFalse(val: any, msg?: string): void; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, msg?: string): void; + + isAtLeast(val: number, atlst: number, msg?: string): void; + isAtMost(val: number, atmst: number, msg?: string): void; + + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; + + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; + + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; + + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; + + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; + + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; + + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; + + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; + + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; + + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; + + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; + + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + lengthOf(exp: any, len: number, msg?: string): void; + //alias frenzy + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; + + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; + + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; + + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; + + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; + approximately(act: number, exp: number, delta: number, msg?: string): void; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + oneOf(inList: any, list: any[], msg?: string): void; + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} diff --git a/checksum/checksum-tests.ts b/checksum/checksum-tests.ts index de9faaa98..2746bcb9e 100644 --- a/checksum/checksum-tests.ts +++ b/checksum/checksum-tests.ts @@ -1,14 +1,14 @@ -/// - -import checksum = require("checksum"); - -var s: string = checksum("abcd"); -var t: string = checksum("abcd", { algorithm: 'sha1' }); - -checksum.file("myfile.txt", (error: Error, hash: string): void => { - // do nothing -}); - -checksum.file("myfile.txt", { algorithm: 'sha1' }, (error: Error, hash: string): void => { - // do nothing -}); +/// + +import checksum = require("checksum"); + +var s: string = checksum("abcd"); +var t: string = checksum("abcd", { algorithm: 'sha1' }); + +checksum.file("myfile.txt", (error: Error, hash: string): void => { + // do nothing +}); + +checksum.file("myfile.txt", { algorithm: 'sha1' }, (error: Error, hash: string): void => { + // do nothing +}); diff --git a/checksum/checksum.d.ts b/checksum/checksum.d.ts index 63f24224e..45974a061 100644 --- a/checksum/checksum.d.ts +++ b/checksum/checksum.d.ts @@ -1,44 +1,44 @@ -// Type definitions for checksum 0.1.1 -// Project: https://github.com/dshaw/checksum -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module "checksum" { - - module checksum { - /** - * Options object for all functions - */ - interface ChecksumOptions { - /** - * Algorithm to use, default 'sha1' - * Can be 'sha1' or 'md5' (see module 'crypto'). - */ - algorithm?: string; - } - - /** - * Generate the checksum for a file on disk - * @param filename The file name - * @param callback Callback which is called with the result or an error - */ - function file(filename: string, callback: (error: Error, hash: string) => void): void; - /** - * Generate the checksum for a file on disk - * @param filename The file name - * @param options Options object to indicate hash algo - * @param callback Callback which is called with the result or an error - */ - function file(filename: string, options: ChecksumOptions, callback: (error: Error, hash: string) => void): void; - } - - /** - * Generates a checksum for the given value - * @param value Any value - * @param options Allows to set the algorithm - * @returns Checksum - */ - function checksum(value: any, options?: checksum.ChecksumOptions): string; - - export = checksum; -} +// Type definitions for checksum 0.1.1 +// Project: https://github.com/dshaw/checksum +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "checksum" { + + module checksum { + /** + * Options object for all functions + */ + interface ChecksumOptions { + /** + * Algorithm to use, default 'sha1' + * Can be 'sha1' or 'md5' (see module 'crypto'). + */ + algorithm?: string; + } + + /** + * Generate the checksum for a file on disk + * @param filename The file name + * @param callback Callback which is called with the result or an error + */ + function file(filename: string, callback: (error: Error, hash: string) => void): void; + /** + * Generate the checksum for a file on disk + * @param filename The file name + * @param options Options object to indicate hash algo + * @param callback Callback which is called with the result or an error + */ + function file(filename: string, options: ChecksumOptions, callback: (error: Error, hash: string) => void): void; + } + + /** + * Generates a checksum for the given value + * @param value Any value + * @param options Allows to set the algorithm + * @returns Checksum + */ + function checksum(value: any, options?: checksum.ChecksumOptions): string; + + export = checksum; +} diff --git a/cheerio/cheerio-tests.ts b/cheerio/cheerio-tests.ts index cb74619d4..c1b5eda89 100644 --- a/cheerio/cheerio-tests.ts +++ b/cheerio/cheerio-tests.ts @@ -1,294 +1,294 @@ -/// - -import * as cheerio from 'cheerio'; - -/* - * LOADING - */ -let html = -`
    -
  • Apple
  • -
  • Orange
  • -
  • Pear
  • - -
`; - -// Preferred Method -var $ = cheerio.load(html); -// Directly load element -cheerio(html); -cheerio('ul', html); -cheerio('li', 'ul', html); - -$ = cheerio.load(html, { - normalizeWhitespace: true, - xmlMode: true -}); - -$ = cheerio.load(html, { - normalizeWhitespace: true, - xmlMode: true, - decodeEntities: true, - lowerCaseTags: true, - lowerCaseAttributeNames: true, - recognizeCDATA: true, - recognizeSelfClosing: true -}); - -/** - * Selectors - */ -var $el = $('.class'); -var $multiEl = $('selector', 'selector', 'selector'); - -/** - * Attributes - */ - -// attr -$el.attr('id'); -$el.attr('id', 'favorite').html(); - -// data -$el.data(); -$el.data('apple-color'); -$el.data('kind', 'mac'); - -// val -$('input[type="text"]').val(); -$('input[type="text"]').val('test').html(); - -// removeAttr -$el.removeAttr('class').html(); - -// hasClass, addClass, removeClass, toggleClass -$el.addClass('class').addClass('test'); -$el.hasClass('test'); -$el.removeClass('class').removeClass('test'); -$el.addClass('red').removeClass().html(); -$el.toggleClass('fruit green red').html(); - -// is -$el.is('#id'); -$el.is($el); -$el.is(() => { - return true; -}); - -/** - * Forms - */ -// serializeArray -$('
').serializeArray(); - -/** - * Traversing - */ - // find -$el.find('li').length; -$el.find($('.apple')).length; - -// .parent([selector]) -$el.parent().attr('id'); -$el.parent('.class').attr('id'); - -// .parents([selector]) -$el.parents().length; -$el.parents('.class').length; - -// .parentsUntil([selector][,filter]) -$el.parentsUntil().length; -$el.parentsUntil('.class').length; - -// .closest(selector) -$el.closest(); -$el.closest('.class'); - -// .next([selector]) -$el.next().hasClass('class'); -$el.next('.class').hasClass('class'); - -// .nextAll([selector]) -$el.nextAll().length; -$el.nextAll('.class').length; - -// .nextUntil([selector], [filter]) -$el.nextUntil(); -$el.nextUntil('.class'); - -// .prev([selector]) -$el.prev().hasClass('class'); -$el.prev('.class').hasClass('class'); - -// .prevAll([selector]) -$el.prevAll().length; -$el.prevAll('.class').length; - -// .prevUntil([selector], [filter]) -$el.prevUntil(); -$el.prevUntil('.class'); - -// .slice( start, [end] ) -$el.slice(1).eq(0).text(); -$el.slice(1, 2).length; - -// .siblings([selector]) -$el.siblings().length; -$el.siblings('.class').length; - -// .children([selector]) -$el.children().length; -$el.children('.class').text(); - -// .contents() -$el.contents().length; - -// .each( function(index, element) ) -$el.each((i, el) => { - $(el).html(); -}); - -// .map( function(index, element) ) -$el.map((i, el) => { - return $(el).text(); -}).get().join(' '); - -// .filter -$ = cheerio.load(html); -$el.filter('.class').attr('class'); -$el.filter($('.class')).attr('class'); -$el.filter($('.class')[0]).attr('class'); - -$el.filter((i, el) => { - return $(el).attr('class') === 'class'; -}).attr('class'); - -// .not -$el.not('.class').length; -$el.not($('.class')).length; -$el.not($('.class')[0]).length; - -$el.not((i, el) => { - return $(el).attr('class') === 'class'; -}).length; - -// .has -$el.has('.class').attr('id'); -$el.has($el[0]).attr('id'); - -// .first() -$el.children().first().text(); - -// .last() -$el.children().last().text(); - -// .eq( i ) -$el.eq(0).text(); -$el.eq(-1).text(); - -// .get( [i] ) -$el.get(0).tagName; -$el.get().length; - -// .index() -// .index( selector ) -// .index( nodeOrSelection ) -$el.index(); -$el.index('li'); -$el.index($('#fruit, li')); - -// .end() -$el.eq(0).end().length; - -// .add -$el.add('.class').length - -// .addBack( [filter] ) -$el.eq(0).addBack().length -$el.eq(0).addBack('.class').length - -/** - * Manipulation - */ - -// .append( content, [content, ...] ) -$el.append('
  • Plum
  • ').html(); -$el.append('
  • Plum
  • ', '
  • Plum
  • ').html(); - -// .prepend( content, [content, ...] ) -$el.prepend('
  • Plum
  • ').html(); -$el.prepend('
  • Plum
  • ', '
  • Plum
  • ').html(); - -// .after( content, [content, ...] ) -$el.after('
  • Plum
  • ').html(); -$el.after('
  • Plum
  • ', '
  • Plum
  • ').html(); - -// .insertAfter( content ) -$('
  • Plum
  • ').insertAfter('.class').html(); - -// .before( content, [content, ...] ) -$el.before('
  • Plum
  • ').html(); -$el.before('
  • Plum
  • ', '
  • Plum
  • ').html(); - -// .insertBefore( content ) -$('
  • Plum
  • ').insertBefore('.class').html(); - -// .remove( [selector] ) -$el.remove().html(); -$el.remove('.class').html(); - -// .replaceWith( content ) -$el.replaceWith($('
  • Plum
  • ')).html(); - -// .empty() -$el.empty().html(); - -// .html( [htmlString] ) -$el.html(); -$el.html('
  • Mango
  • ').html(); - -// .text( [textString] ) -$el.text(); -$el.text('text'); - -// .wrap( content ) -// See https://github.com/cheeriojs/cheerio/issues/731 -// $el.wrap($('
    ')).html(); - -// .css -$el.css('width'); -$el.css(['width', 'height']); -$el.css('width', '50px'); - -/** - * Rendering - */ -$.html(); -$.html('.class'); -$.xml(); - -/** - * Miscellaneous - */ - -// .clone() #### -$el.clone().html(); - -/** - * Utilities - */ - -// $.root -$.root().append('
      ').html(); - -// $.contains( container, contained ) -$.contains($el[0], $el[0]); - -// $.parseHTML( data [, context ] [, keepScripts ] ) -$.parseHTML(html); -$.parseHTML(html, null, true); - -/** - * Not in doc - */ -$el.toArray(); +/// + +import * as cheerio from 'cheerio'; + +/* + * LOADING + */ +let html = +`
        +
      • Apple
      • +
      • Orange
      • +
      • Pear
      • + +
      `; + +// Preferred Method +var $ = cheerio.load(html); +// Directly load element +cheerio(html); +cheerio('ul', html); +cheerio('li', 'ul', html); + +$ = cheerio.load(html, { + normalizeWhitespace: true, + xmlMode: true +}); + +$ = cheerio.load(html, { + normalizeWhitespace: true, + xmlMode: true, + decodeEntities: true, + lowerCaseTags: true, + lowerCaseAttributeNames: true, + recognizeCDATA: true, + recognizeSelfClosing: true +}); + +/** + * Selectors + */ +var $el = $('.class'); +var $multiEl = $('selector', 'selector', 'selector'); + +/** + * Attributes + */ + +// attr +$el.attr('id'); +$el.attr('id', 'favorite').html(); + +// data +$el.data(); +$el.data('apple-color'); +$el.data('kind', 'mac'); + +// val +$('input[type="text"]').val(); +$('input[type="text"]').val('test').html(); + +// removeAttr +$el.removeAttr('class').html(); + +// hasClass, addClass, removeClass, toggleClass +$el.addClass('class').addClass('test'); +$el.hasClass('test'); +$el.removeClass('class').removeClass('test'); +$el.addClass('red').removeClass().html(); +$el.toggleClass('fruit green red').html(); + +// is +$el.is('#id'); +$el.is($el); +$el.is(() => { + return true; +}); + +/** + * Forms + */ +// serializeArray +$('
      ').serializeArray(); + +/** + * Traversing + */ + // find +$el.find('li').length; +$el.find($('.apple')).length; + +// .parent([selector]) +$el.parent().attr('id'); +$el.parent('.class').attr('id'); + +// .parents([selector]) +$el.parents().length; +$el.parents('.class').length; + +// .parentsUntil([selector][,filter]) +$el.parentsUntil().length; +$el.parentsUntil('.class').length; + +// .closest(selector) +$el.closest(); +$el.closest('.class'); + +// .next([selector]) +$el.next().hasClass('class'); +$el.next('.class').hasClass('class'); + +// .nextAll([selector]) +$el.nextAll().length; +$el.nextAll('.class').length; + +// .nextUntil([selector], [filter]) +$el.nextUntil(); +$el.nextUntil('.class'); + +// .prev([selector]) +$el.prev().hasClass('class'); +$el.prev('.class').hasClass('class'); + +// .prevAll([selector]) +$el.prevAll().length; +$el.prevAll('.class').length; + +// .prevUntil([selector], [filter]) +$el.prevUntil(); +$el.prevUntil('.class'); + +// .slice( start, [end] ) +$el.slice(1).eq(0).text(); +$el.slice(1, 2).length; + +// .siblings([selector]) +$el.siblings().length; +$el.siblings('.class').length; + +// .children([selector]) +$el.children().length; +$el.children('.class').text(); + +// .contents() +$el.contents().length; + +// .each( function(index, element) ) +$el.each((i, el) => { + $(el).html(); +}); + +// .map( function(index, element) ) +$el.map((i, el) => { + return $(el).text(); +}).get().join(' '); + +// .filter +$ = cheerio.load(html); +$el.filter('.class').attr('class'); +$el.filter($('.class')).attr('class'); +$el.filter($('.class')[0]).attr('class'); + +$el.filter((i, el) => { + return $(el).attr('class') === 'class'; +}).attr('class'); + +// .not +$el.not('.class').length; +$el.not($('.class')).length; +$el.not($('.class')[0]).length; + +$el.not((i, el) => { + return $(el).attr('class') === 'class'; +}).length; + +// .has +$el.has('.class').attr('id'); +$el.has($el[0]).attr('id'); + +// .first() +$el.children().first().text(); + +// .last() +$el.children().last().text(); + +// .eq( i ) +$el.eq(0).text(); +$el.eq(-1).text(); + +// .get( [i] ) +$el.get(0).tagName; +$el.get().length; + +// .index() +// .index( selector ) +// .index( nodeOrSelection ) +$el.index(); +$el.index('li'); +$el.index($('#fruit, li')); + +// .end() +$el.eq(0).end().length; + +// .add +$el.add('.class').length + +// .addBack( [filter] ) +$el.eq(0).addBack().length +$el.eq(0).addBack('.class').length + +/** + * Manipulation + */ + +// .append( content, [content, ...] ) +$el.append('
    • Plum
    • ').html(); +$el.append('
    • Plum
    • ', '
    • Plum
    • ').html(); + +// .prepend( content, [content, ...] ) +$el.prepend('
    • Plum
    • ').html(); +$el.prepend('
    • Plum
    • ', '
    • Plum
    • ').html(); + +// .after( content, [content, ...] ) +$el.after('
    • Plum
    • ').html(); +$el.after('
    • Plum
    • ', '
    • Plum
    • ').html(); + +// .insertAfter( content ) +$('
    • Plum
    • ').insertAfter('.class').html(); + +// .before( content, [content, ...] ) +$el.before('
    • Plum
    • ').html(); +$el.before('
    • Plum
    • ', '
    • Plum
    • ').html(); + +// .insertBefore( content ) +$('
    • Plum
    • ').insertBefore('.class').html(); + +// .remove( [selector] ) +$el.remove().html(); +$el.remove('.class').html(); + +// .replaceWith( content ) +$el.replaceWith($('
    • Plum
    • ')).html(); + +// .empty() +$el.empty().html(); + +// .html( [htmlString] ) +$el.html(); +$el.html('
    • Mango
    • ').html(); + +// .text( [textString] ) +$el.text(); +$el.text('text'); + +// .wrap( content ) +// See https://github.com/cheeriojs/cheerio/issues/731 +// $el.wrap($('
      ')).html(); + +// .css +$el.css('width'); +$el.css(['width', 'height']); +$el.css('width', '50px'); + +/** + * Rendering + */ +$.html(); +$.html('.class'); +$.xml(); + +/** + * Miscellaneous + */ + +// .clone() #### +$el.clone().html(); + +/** + * Utilities + */ + +// $.root +$.root().append('
        ').html(); + +// $.contains( container, contained ) +$.contains($el[0], $el[0]); + +// $.parseHTML( data [, context ] [, keepScripts ] ) +$.parseHTML(html); +$.parseHTML(html, null, true); + +/** + * Not in doc + */ +$el.toArray(); diff --git a/cheerio/cheerio.d.ts b/cheerio/cheerio.d.ts index 3b5b998d9..124dae5d9 100644 --- a/cheerio/cheerio.d.ts +++ b/cheerio/cheerio.d.ts @@ -1,266 +1,266 @@ -// Type definitions for Cheerio v0.17.0 -// Project: https://github.com/cheeriojs/cheerio -// Definitions by: Bret Little , VILIC VANE , Wayne Maurer -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -interface Cheerio { - // Document References - // Cheerio https://github.com/cheeriojs/cheerio - // JQuery http://api.jquery.com - - [index: number]: CheerioElement; - length: number; - - // Attributes - - attr(name: string): string; - attr(name: string, value: any): Cheerio; - - data(): any; - data(name: string): any; - data(name: string, value: any): any; - - val(): string; - val(value: string): Cheerio; - - removeAttr(name: string): Cheerio; - - has(selector: string): Cheerio; - has(element: CheerioElement): Cheerio; - - hasClass(className: string): boolean; - addClass(classNames: string): Cheerio; - - removeClass(): Cheerio; - removeClass(className: string): Cheerio; - removeClass(func: (index: number, className: string) => string): Cheerio; - - toggleClass(className: string): Cheerio; - toggleClass(className: string, toggleSwitch: boolean): Cheerio; - toggleClass(toggleSwitch?: boolean): Cheerio; - toggleClass(func: (index: number, className: string, toggleSwitch: boolean) => string, toggleSwitch?: boolean): Cheerio; - - is(selector: string): boolean; - is(element: CheerioElement): boolean; - is(element: CheerioElement[]): boolean; - is(selection: Cheerio): boolean; - is(func: (index: number, element: CheerioElement) => boolean): boolean; - - // Form - serializeArray(): {name: string, value: string}[]; - - // Traversing - - find(selector: string): Cheerio; - find(element: Cheerio): Cheerio; - - parent(selector?: string): Cheerio; - parents(selector?: string): Cheerio; - parentsUntil(selector?: string, filter?: string): Cheerio; - parentsUntil(element: CheerioElement, filter?: string): Cheerio; - parentsUntil(element: Cheerio, filter?: string): Cheerio; - - closest(): Cheerio; - closest(selector: string): Cheerio; - - next(selector?: string): Cheerio; - nextAll(): Cheerio; - nextAll(selector: string): Cheerio; - - nextUntil(selector?: string, filter?: string): Cheerio; - nextUntil(element: CheerioElement, filter?: string): Cheerio; - nextUntil(element: Cheerio, filter?: string): Cheerio; - - prev(selector?: string): Cheerio; - prevAll(): Cheerio; - prevAll(selector: string): Cheerio; - - prevUntil(selector?: string, filter?: string): Cheerio; - prevUntil(element: CheerioElement, filter?: string): Cheerio; - prevUntil(element: Cheerio, filter?: string): Cheerio; - - slice(start: number, end?: number): Cheerio; - - siblings(selector?: string): Cheerio; - - children(selector?: string): Cheerio; - - contents(): Cheerio; - - each(func: (index: number, element: CheerioElement) => any): Cheerio; - map(func: (index: number, element: CheerioElement) => any): Cheerio; - - filter(selector: string): Cheerio; - filter(selection: Cheerio): Cheerio; - filter(element: CheerioElement): Cheerio; - filter(elements: CheerioElement[]): Cheerio; - filter(func: (index: number, element: CheerioElement) => boolean): Cheerio; - - not(selector: string): Cheerio; - not(selection: Cheerio): Cheerio; - not(element: CheerioElement): Cheerio; - not(func: (index: number, element: CheerioElement) => boolean): Cheerio; - - first(): Cheerio; - last(): Cheerio; - - eq(index: number): Cheerio; - - get(): CheerioElement[]; - get(index: number): CheerioElement; - - index(): number; - index(selector: string): number; - index(selection: Cheerio): number; - - end(): Cheerio; - - add(selectorOrHtml: string): Cheerio; - add(selector: string, context: Document): Cheerio; - add(element: CheerioElement): Cheerio; - add(elements: CheerioElement[]): Cheerio; - add(selection: Cheerio): Cheerio; - - addBack():Cheerio; - addBack(filter: string):Cheerio; - - // Manipulation - - append(content: string, ...contents: any[]): Cheerio; - append(content: Document, ...contents: any[]): Cheerio; - append(content: Document[], ...contents: any[]): Cheerio; - append(content: Cheerio, ...contents: any[]): Cheerio; - - prepend(content: string, ...contents: any[]): Cheerio; - prepend(content: Document, ...contents: any[]): Cheerio; - prepend(content: Document[], ...contents: any[]): Cheerio; - prepend(content: Cheerio, ...contents: any[]): Cheerio; - - after(content: string, ...contents: any[]): Cheerio; - after(content: Document, ...contents: any[]): Cheerio; - after(content: Document[], ...contents: any[]): Cheerio; - after(content: Cheerio, ...contents: any[]): Cheerio; - - insertAfter(content: string): Cheerio; - insertAfter(content: Document): Cheerio; - insertAfter(content: Cheerio): Cheerio; - - before(content: string, ...contents: any[]): Cheerio; - before(content: Document, ...contents: any[]): Cheerio; - before(content: Document[], ...contents: any[]): Cheerio; - before(content: Cheerio, ...contents: any[]): Cheerio; - - insertBefore(content: string): Cheerio; - insertBefore(content: Document): Cheerio; - insertBefore(content: Cheerio): Cheerio; - - remove(selector?: string): Cheerio; - - replaceWith(content: string): Cheerio; - replaceWith(content: CheerioElement): Cheerio; - replaceWith(content: CheerioElement[]): Cheerio; - replaceWith(content: Cheerio): Cheerio; - - empty(): Cheerio; - - html(): string; - html(html: string): Cheerio; - - text(): string; - text(text: string): Cheerio; - - // See https://github.com/cheeriojs/cheerio/issues/731 - /*wrap(content: string): Cheerio; - wrap(content: Document): Cheerio; - wrap(content: Cheerio): Cheerio;*/ - - css(propertyName: string): string; - css(propertyNames: string[]): string[]; - css(propertyName: string, value: string): Cheerio; - css(propertyName: string, value: number): Cheerio; - css(propertyName: string, func: (index: number, value: string) => string): Cheerio; - css(propertyName: string, func: (index: number, value: string) => number): Cheerio; - css(properties: Object): Cheerio; - - // Rendering - - // Miscellaneous - - clone(): Cheerio; - - // Not Documented - - toArray(): CheerioElement[]; -} - -interface CheerioOptionsInterface { - // Document References - // Cheerio https://github.com/cheeriojs/cheerio - // HTMLParser2 https://github.com/fb55/htmlparser2/wiki/Parser-options - // DomHandler https://github.com/fb55/DomHandler - - xmlMode?: boolean; - decodeEntities?: boolean; - lowerCaseTags?: boolean; - lowerCaseAttributeNames?: boolean; - recognizeCDATA?: boolean; - recognizeSelfClosing?: boolean; - normalizeWhitespace?: boolean; -} - -interface CheerioSelector { - (selector: string): Cheerio; - (selector: string, context: string): Cheerio; - (selector: string, context: CheerioElement): Cheerio; - (selector: string, context: CheerioElement[]): Cheerio; - (selector: string, context: Cheerio): Cheerio; - (selector: string, context: string, root: string): Cheerio; - (selector: string, context: CheerioElement, root: string): Cheerio; - (selector: string, context: CheerioElement[], root: string): Cheerio; - (selector: string, context: Cheerio, root: string): Cheerio; - (selector: any): Cheerio; -} - -interface CheerioStatic extends CheerioSelector { - // Document References - // Cheerio https://github.com/cheeriojs/cheerio - // JQuery http://api.jquery.com - xml(): string; - root(): Cheerio; - contains(container: CheerioElement, contained: CheerioElement): boolean; - parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[]; - - html(options?: CheerioOptionsInterface): string; - html(selector: string, options?: CheerioOptionsInterface): string; - html(element: Cheerio, options?: CheerioOptionsInterface): string; - html(element: CheerioElement, options?: CheerioOptionsInterface): string; -} - -interface CheerioElement { - // Document References - // Node Console - tagName: string; - type: string; - name: string; - attribs: Object; - children: CheerioElement[]; - childNodes: CheerioElement[]; - lastChild: CheerioElement; - next: CheerioElement; - nextSibling: CheerioElement; - prev: CheerioElement; - previousSibling: CheerioElement; - parent: CheerioElement; - parentNode: CheerioElement; - nodeValue: string; -} - -interface CheerioAPI extends CheerioSelector { - load(html: string, options?: CheerioOptionsInterface): CheerioStatic; -} - -declare var cheerio:CheerioAPI; - -declare module "cheerio" { - export = cheerio; -} +// Type definitions for Cheerio v0.17.0 +// Project: https://github.com/cheeriojs/cheerio +// Definitions by: Bret Little , VILIC VANE , Wayne Maurer +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Cheerio { + // Document References + // Cheerio https://github.com/cheeriojs/cheerio + // JQuery http://api.jquery.com + + [index: number]: CheerioElement; + length: number; + + // Attributes + + attr(name: string): string; + attr(name: string, value: any): Cheerio; + + data(): any; + data(name: string): any; + data(name: string, value: any): any; + + val(): string; + val(value: string): Cheerio; + + removeAttr(name: string): Cheerio; + + has(selector: string): Cheerio; + has(element: CheerioElement): Cheerio; + + hasClass(className: string): boolean; + addClass(classNames: string): Cheerio; + + removeClass(): Cheerio; + removeClass(className: string): Cheerio; + removeClass(func: (index: number, className: string) => string): Cheerio; + + toggleClass(className: string): Cheerio; + toggleClass(className: string, toggleSwitch: boolean): Cheerio; + toggleClass(toggleSwitch?: boolean): Cheerio; + toggleClass(func: (index: number, className: string, toggleSwitch: boolean) => string, toggleSwitch?: boolean): Cheerio; + + is(selector: string): boolean; + is(element: CheerioElement): boolean; + is(element: CheerioElement[]): boolean; + is(selection: Cheerio): boolean; + is(func: (index: number, element: CheerioElement) => boolean): boolean; + + // Form + serializeArray(): {name: string, value: string}[]; + + // Traversing + + find(selector: string): Cheerio; + find(element: Cheerio): Cheerio; + + parent(selector?: string): Cheerio; + parents(selector?: string): Cheerio; + parentsUntil(selector?: string, filter?: string): Cheerio; + parentsUntil(element: CheerioElement, filter?: string): Cheerio; + parentsUntil(element: Cheerio, filter?: string): Cheerio; + + closest(): Cheerio; + closest(selector: string): Cheerio; + + next(selector?: string): Cheerio; + nextAll(): Cheerio; + nextAll(selector: string): Cheerio; + + nextUntil(selector?: string, filter?: string): Cheerio; + nextUntil(element: CheerioElement, filter?: string): Cheerio; + nextUntil(element: Cheerio, filter?: string): Cheerio; + + prev(selector?: string): Cheerio; + prevAll(): Cheerio; + prevAll(selector: string): Cheerio; + + prevUntil(selector?: string, filter?: string): Cheerio; + prevUntil(element: CheerioElement, filter?: string): Cheerio; + prevUntil(element: Cheerio, filter?: string): Cheerio; + + slice(start: number, end?: number): Cheerio; + + siblings(selector?: string): Cheerio; + + children(selector?: string): Cheerio; + + contents(): Cheerio; + + each(func: (index: number, element: CheerioElement) => any): Cheerio; + map(func: (index: number, element: CheerioElement) => any): Cheerio; + + filter(selector: string): Cheerio; + filter(selection: Cheerio): Cheerio; + filter(element: CheerioElement): Cheerio; + filter(elements: CheerioElement[]): Cheerio; + filter(func: (index: number, element: CheerioElement) => boolean): Cheerio; + + not(selector: string): Cheerio; + not(selection: Cheerio): Cheerio; + not(element: CheerioElement): Cheerio; + not(func: (index: number, element: CheerioElement) => boolean): Cheerio; + + first(): Cheerio; + last(): Cheerio; + + eq(index: number): Cheerio; + + get(): CheerioElement[]; + get(index: number): CheerioElement; + + index(): number; + index(selector: string): number; + index(selection: Cheerio): number; + + end(): Cheerio; + + add(selectorOrHtml: string): Cheerio; + add(selector: string, context: Document): Cheerio; + add(element: CheerioElement): Cheerio; + add(elements: CheerioElement[]): Cheerio; + add(selection: Cheerio): Cheerio; + + addBack():Cheerio; + addBack(filter: string):Cheerio; + + // Manipulation + + append(content: string, ...contents: any[]): Cheerio; + append(content: Document, ...contents: any[]): Cheerio; + append(content: Document[], ...contents: any[]): Cheerio; + append(content: Cheerio, ...contents: any[]): Cheerio; + + prepend(content: string, ...contents: any[]): Cheerio; + prepend(content: Document, ...contents: any[]): Cheerio; + prepend(content: Document[], ...contents: any[]): Cheerio; + prepend(content: Cheerio, ...contents: any[]): Cheerio; + + after(content: string, ...contents: any[]): Cheerio; + after(content: Document, ...contents: any[]): Cheerio; + after(content: Document[], ...contents: any[]): Cheerio; + after(content: Cheerio, ...contents: any[]): Cheerio; + + insertAfter(content: string): Cheerio; + insertAfter(content: Document): Cheerio; + insertAfter(content: Cheerio): Cheerio; + + before(content: string, ...contents: any[]): Cheerio; + before(content: Document, ...contents: any[]): Cheerio; + before(content: Document[], ...contents: any[]): Cheerio; + before(content: Cheerio, ...contents: any[]): Cheerio; + + insertBefore(content: string): Cheerio; + insertBefore(content: Document): Cheerio; + insertBefore(content: Cheerio): Cheerio; + + remove(selector?: string): Cheerio; + + replaceWith(content: string): Cheerio; + replaceWith(content: CheerioElement): Cheerio; + replaceWith(content: CheerioElement[]): Cheerio; + replaceWith(content: Cheerio): Cheerio; + + empty(): Cheerio; + + html(): string; + html(html: string): Cheerio; + + text(): string; + text(text: string): Cheerio; + + // See https://github.com/cheeriojs/cheerio/issues/731 + /*wrap(content: string): Cheerio; + wrap(content: Document): Cheerio; + wrap(content: Cheerio): Cheerio;*/ + + css(propertyName: string): string; + css(propertyNames: string[]): string[]; + css(propertyName: string, value: string): Cheerio; + css(propertyName: string, value: number): Cheerio; + css(propertyName: string, func: (index: number, value: string) => string): Cheerio; + css(propertyName: string, func: (index: number, value: string) => number): Cheerio; + css(properties: Object): Cheerio; + + // Rendering + + // Miscellaneous + + clone(): Cheerio; + + // Not Documented + + toArray(): CheerioElement[]; +} + +interface CheerioOptionsInterface { + // Document References + // Cheerio https://github.com/cheeriojs/cheerio + // HTMLParser2 https://github.com/fb55/htmlparser2/wiki/Parser-options + // DomHandler https://github.com/fb55/DomHandler + + xmlMode?: boolean; + decodeEntities?: boolean; + lowerCaseTags?: boolean; + lowerCaseAttributeNames?: boolean; + recognizeCDATA?: boolean; + recognizeSelfClosing?: boolean; + normalizeWhitespace?: boolean; +} + +interface CheerioSelector { + (selector: string): Cheerio; + (selector: string, context: string): Cheerio; + (selector: string, context: CheerioElement): Cheerio; + (selector: string, context: CheerioElement[]): Cheerio; + (selector: string, context: Cheerio): Cheerio; + (selector: string, context: string, root: string): Cheerio; + (selector: string, context: CheerioElement, root: string): Cheerio; + (selector: string, context: CheerioElement[], root: string): Cheerio; + (selector: string, context: Cheerio, root: string): Cheerio; + (selector: any): Cheerio; +} + +interface CheerioStatic extends CheerioSelector { + // Document References + // Cheerio https://github.com/cheeriojs/cheerio + // JQuery http://api.jquery.com + xml(): string; + root(): Cheerio; + contains(container: CheerioElement, contained: CheerioElement): boolean; + parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[]; + + html(options?: CheerioOptionsInterface): string; + html(selector: string, options?: CheerioOptionsInterface): string; + html(element: Cheerio, options?: CheerioOptionsInterface): string; + html(element: CheerioElement, options?: CheerioOptionsInterface): string; +} + +interface CheerioElement { + // Document References + // Node Console + tagName: string; + type: string; + name: string; + attribs: Object; + children: CheerioElement[]; + childNodes: CheerioElement[]; + lastChild: CheerioElement; + next: CheerioElement; + nextSibling: CheerioElement; + prev: CheerioElement; + previousSibling: CheerioElement; + parent: CheerioElement; + parentNode: CheerioElement; + nodeValue: string; +} + +interface CheerioAPI extends CheerioSelector { + load(html: string, options?: CheerioOptionsInterface): CheerioStatic; +} + +declare var cheerio:CheerioAPI; + +declare module "cheerio" { + export = cheerio; +} diff --git a/chosen/chosen-tests.ts b/chosen/chosen-tests.ts index 8f6c3d9ad..818b1e126 100644 --- a/chosen/chosen-tests.ts +++ b/chosen/chosen-tests.ts @@ -1,8 +1,8 @@ -/// - -$(".chzn-select").chosen({ no_results_text: "No results matched" }); -$("#form_field").chosen().change(); -$("#form_field").trigger("liszt:updated"); - -$(".chzn-select").chosen(); +/// + +$(".chzn-select").chosen({ no_results_text: "No results matched" }); +$("#form_field").chosen().change(); +$("#form_field").trigger("liszt:updated"); + +$(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({ allow_single_deselect: true }); \ No newline at end of file diff --git a/chosen/chosen.jquery.d.ts b/chosen/chosen.jquery.d.ts index 14d37fa97..d5c636c40 100644 --- a/chosen/chosen.jquery.d.ts +++ b/chosen/chosen.jquery.d.ts @@ -1,30 +1,30 @@ -// Type definitions for Chosen.JQuery 1.4.2 -// Project: http://harvesthq.github.com/chosen/ -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -interface ChosenOptions { - allow_single_deselect?: boolean; - disable_search?: boolean; - disable_search_threshold?: number; - enable_split_word_search?: boolean; - inherit_select_classes?: boolean; - max_selected_options?: number; - no_results_text?: string; - placeholder_text_multiple?: string; - placeholder_text_single?: string; - search_contains?: boolean; - single_backstroke_delete?: boolean; - width?: number|string; - display_disabled_options?: boolean; - display_selected_options?: boolean; - include_group_label_in_selected?: boolean; -} - -interface JQuery { - chosen(): JQuery; - chosen(options: ChosenOptions): JQuery; -} +// Type definitions for Chosen.JQuery 1.4.2 +// Project: http://harvesthq.github.com/chosen/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +interface ChosenOptions { + allow_single_deselect?: boolean; + disable_search?: boolean; + disable_search_threshold?: number; + enable_split_word_search?: boolean; + inherit_select_classes?: boolean; + max_selected_options?: number; + no_results_text?: string; + placeholder_text_multiple?: string; + placeholder_text_single?: string; + search_contains?: boolean; + single_backstroke_delete?: boolean; + width?: number|string; + display_disabled_options?: boolean; + display_selected_options?: boolean; + include_group_label_in_selected?: boolean; +} + +interface JQuery { + chosen(): JQuery; + chosen(options: ChosenOptions): JQuery; +} diff --git a/chrome/chrome-tests.ts.tscparams b/chrome/chrome-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/chrome/chrome-tests.ts.tscparams +++ b/chrome/chrome-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/codemirror/codemirror-tests.ts b/codemirror/codemirror-tests.ts index d0da7f522..7f555ceb1 100644 --- a/codemirror/codemirror-tests.ts +++ b/codemirror/codemirror-tests.ts @@ -1,48 +1,48 @@ -/// - -var myCodeMirror: CodeMirror.Editor = CodeMirror(document.body); - -var myCodeMirror2: CodeMirror.Editor = CodeMirror(document.body, { - value: "function myScript(){return 100;}\n", - mode: "javascript" -}); - -var myTextArea: HTMLTextAreaElement; -var myCodeMirror3: CodeMirror.Editor = CodeMirror(function (elt) { - myTextArea.parentNode.replaceChild(elt, myTextArea); -}, { value: myTextArea.value }); - -var myCodeMirror4: CodeMirror.Editor = CodeMirror.fromTextArea(myTextArea); - -var doc: CodeMirror.Doc = new CodeMirror.Doc('text'); -var doc2: CodeMirror.Doc = CodeMirror(document.body).getDoc(); - -var lintStateOptions: CodeMirror.LintStateOptions = { - async: true, - hasGutters: true -}; - -var lintOptions: CodeMirror.LintOptions = { - async: true, - hasGutters: true, - getAnnotations: (content: string, - updateLintingCallback: CodeMirror.UpdateLintingCallback, - options: CodeMirror.LintStateOptions, - codeMirror: CodeMirror.Editor) => {} -}; - -var updateLintingCallback: CodeMirror.UpdateLintingCallback = (codeMirror: CodeMirror.Editor, - annotations: CodeMirror.Annotation[]) => {}; - -var annotation: CodeMirror.Annotation = { - from: { - ch: 0, - line: 0 - }, - to: { - ch: 1, - line: 0 - }, - message: "test", - severity: "warning" -}; +/// + +var myCodeMirror: CodeMirror.Editor = CodeMirror(document.body); + +var myCodeMirror2: CodeMirror.Editor = CodeMirror(document.body, { + value: "function myScript(){return 100;}\n", + mode: "javascript" +}); + +var myTextArea: HTMLTextAreaElement; +var myCodeMirror3: CodeMirror.Editor = CodeMirror(function (elt) { + myTextArea.parentNode.replaceChild(elt, myTextArea); +}, { value: myTextArea.value }); + +var myCodeMirror4: CodeMirror.Editor = CodeMirror.fromTextArea(myTextArea); + +var doc: CodeMirror.Doc = new CodeMirror.Doc('text'); +var doc2: CodeMirror.Doc = CodeMirror(document.body).getDoc(); + +var lintStateOptions: CodeMirror.LintStateOptions = { + async: true, + hasGutters: true +}; + +var lintOptions: CodeMirror.LintOptions = { + async: true, + hasGutters: true, + getAnnotations: (content: string, + updateLintingCallback: CodeMirror.UpdateLintingCallback, + options: CodeMirror.LintStateOptions, + codeMirror: CodeMirror.Editor) => {} +}; + +var updateLintingCallback: CodeMirror.UpdateLintingCallback = (codeMirror: CodeMirror.Editor, + annotations: CodeMirror.Annotation[]) => {}; + +var annotation: CodeMirror.Annotation = { + from: { + ch: 0, + line: 0 + }, + to: { + ch: 1, + line: 0 + }, + message: "test", + severity: "warning" +}; diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 81b0d8b03..66133d643 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -1,1117 +1,1117 @@ -// Type definitions for CodeMirror -// Project: https://github.com/marijnh/CodeMirror -// Definitions by: mihailik -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare function CodeMirror(host: HTMLElement, options?: CodeMirror.EditorConfiguration): CodeMirror.Editor; -declare function CodeMirror(callback: (host: HTMLElement) => void , options?: CodeMirror.EditorConfiguration): CodeMirror.Editor; - -declare module CodeMirror { - export var Doc : CodeMirror.DocConstructor; - export var Pos: CodeMirror.PositionConstructor; - export var Pass: any; - - function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea; - - var version: string; - - /** If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension. - This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. */ - function defineExtension(name: string, value: any): void; - - /** Like defineExtension, but the method will be added to the interface for Doc objects instead. */ - function defineDocExtension(name: string, value: any): void; - - /** Similarly, defineOption can be used to define new options for CodeMirror. - The updateFunc will be called with the editor instance and the new value when an editor is initialized, - and whenever the option is modified through setOption. */ - function defineOption(name: string, default_: any, updateFunc: Function): void; - - /** If your extention just needs to run some code whenever a CodeMirror instance is initialized, use CodeMirror.defineInitHook. - Give it a function as its only argument, and from then on, that function will be called (with the instance as argument) - whenever a new CodeMirror instance is initialized. */ - function defineInitHook(func: Function): void; - - - - function on(element: any, eventName: string, handler: Function): void; - function off(element: any, eventName: string, handler: Function): void; - - /** Fired whenever a change occurs to the document. changeObj has a similar type as the object passed to the editor's "change" event, - but it never has a next property, because document change events are not batched (whereas editor change events are). */ - function on(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void ): void; - function off(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void ): void; - - /** See the description of the same event on editor instances. */ - function on(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void ): void; - function off(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void ): void; - - /** Fired whenever the cursor or selection in this document changes. */ - function on(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; - function off(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; - - /** Equivalent to the event by the same name as fired on editor instances. */ - function on(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void ): void; - function off(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void ): void; - - /** Will be fired when the line object is deleted. A line object is associated with the start of the line. - Mostly useful when you need to find out when your gutter markers on a given line are removed. */ - function on(line: LineHandle, eventName: 'delete', handler: () => void ): void; - function off(line: LineHandle, eventName: 'delete', handler: () => void ): void; - - /** Fires when the line's text content is changed in any way (but the line is not deleted outright). - The change object is similar to the one passed to change event on the editor object. */ - function on(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void ): void; - function off(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void ): void; - - /** Fired when the cursor enters the marked range. From this event handler, the editor state may be inspected but not modified, - with the exception that the range on which the event fires may be cleared. */ - function on(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void ): void; - function off(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void ): void; - - /** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method. - Will only be fired once per handle. Note that deleting the range through text editing does not fire this event, - because an undo action might bring the range back into existence. */ - function on(marker: TextMarker, eventName: 'clear', handler: () => void ): void; - function off(marker: TextMarker, eventName: 'clear', handler: () => void ): void; - - /** Fired when the last part of the marker is removed from the document by editing operations. */ - function on(marker: TextMarker, eventName: 'hide', handler: () => void ): void; - function off(marker: TextMarker, eventName: 'hide', handler: () => void ): void; - - /** Fired when, after the marker was removed by editing, a undo operation brought the marker back. */ - function on(marker: TextMarker, eventName: 'unhide', handler: () => void ): void; - function off(marker: TextMarker, eventName: 'unhide', handler: () => void ): void; - - /** Fired whenever the editor re-adds the widget to the DOM. This will happen once right after the widget is added (if it is scrolled into view), - and then again whenever it is scrolled out of view and back in again, or when changes to the editor options - or the line the widget is on require the widget to be redrawn. */ - function on(line: LineWidget, eventName: 'redraw', handler: () => void ): void; - function off(line: LineWidget, eventName: 'redraw', handler: () => void ): void; - - /** Various CodeMirror-related objects emit events, which allow client code to react to various situations. - Handlers for such events can be registered with the on and off methods on the objects that the event fires on. - To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object. */ - function signal(target: any, name: string, ...args: any[]): void; - - interface Editor { - - /** Tells you whether the editor currently has focus. */ - hasFocus(): boolean; - - /** Used to find the target position for horizontal cursor motion.start is a { line , ch } object, - amount an integer(may be negative), and unit one of the string "char", "column", or "word". - Will return a position that is produced by moving amount times the distance specified by unit. - When visually is true , motion in right - to - left text will be visual rather than logical. - When the motion was clipped by hitting the end or start of the document, the returned value will have a hitSide property set to true. */ - findPosH(start: CodeMirror.Position, amount: number, unit: string, visually: boolean): { line: number; ch: number; hitSide?: boolean; }; - - /** Similar to findPosH , but used for vertical motion.unit may be "line" or "page". - The other arguments and the returned value have the same interpretation as they have in findPosH. */ - findPosV(start: CodeMirror.Position, amount: number, unit: string): { line: number; ch: number; hitSide?: boolean; }; - - - /** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */ - setOption(option: string, value: any): void; - - /** Retrieves the current value of the given option for this editor instance. */ - getOption(option: string): any; - - /** Attach an additional keymap to the editor. - This is mostly useful for add - ons that need to register some key handlers without trampling on the extraKeys option. - Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them, - the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed, - in which case they end up below other keymaps added with this method. */ - addKeyMap(map: any, bottom?: boolean): void; - - /** Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string, - which will be compared against the name property of the active keymaps. */ - removeKeyMap(map: any): void; - - /** Enable a highlighting overlay.This is a stateless mini - mode that can be used to add extra highlighting. - For example, the search add - on uses it to highlight the term that's currently being searched. - mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object. - Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null, - to override the styling of the base mode entirely, instead of the two being applied together. */ - addOverlay(mode: any, options?: any): void; - - /** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */ - removeOverlay(mode: any): void; - - - /** Retrieve the currently active document from an editor. */ - getDoc(): CodeMirror.Doc; - - /** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */ - swapDoc(doc: CodeMirror.Doc): CodeMirror.Doc; - - - - /** Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value. - Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. */ - setGutterMarker(line: any, gutterID: string, value: HTMLElement): CodeMirror.LineHandle; - - /** Remove all gutter markers in the gutter with the given ID. */ - clearGutter(gutterID: string): void; - - /** Set a CSS class name for the given line.line can be a number or a line handle. - where determines to which element this class should be applied, can can be one of "text" (the text element, which lies in front of the selection), - "background"(a background element that will be behind the selection), - or "wrap" (the wrapper node that wraps all of the line's elements, including gutter elements). - class should be the name of the class to apply. */ - addLineClass(line: any, where: string, _class_: string): CodeMirror.LineHandle; - - /** Remove a CSS class from a line.line can be a line handle or number. - where should be one of "text", "background", or "wrap"(see addLineClass). - class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */ - removeLineClass(line: any, where: string, class_: string): CodeMirror.LineHandle; - - /** Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle. */ - lineInfo(line: any): { - line: any; - handle: any; - text: string; - /** Object mapping gutter IDs to marker elements. */ - gutterMarks: any; - textClass: string; - bgClass: string; - wrapClass: string; - /** Array of line widgets attached to this line. */ - widgets: any; - }; - - /** Puts node, which should be an absolutely positioned DOM node, into the editor, positioned right below the given { line , ch } position. - When scrollIntoView is true, the editor will ensure that the entire node is visible (if possible). - To remove the widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent). */ - addWidget(pos: CodeMirror.Position, node: HTMLElement, scrollIntoView: boolean): void; - - /** Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. - line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line. - options, when given, should be an object that configures the behavior of the widget. - Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. */ - addLineWidget(line: any, node: HTMLElement, options?: { - /** Whether the widget should cover the gutter. */ - coverGutter: boolean; - /** Whether the widget should stay fixed in the face of horizontal scrolling. */ - noHScroll: boolean; - /** Causes the widget to be placed above instead of below the text of the line. */ - above: boolean; - /** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */ - showIfHidden: boolean; - }): CodeMirror.LineWidget; - - - /** Programatically set the size of the editor (overriding the applicable CSS rules). - width and height height can be either numbers(interpreted as pixels) or CSS units ("100%", for example). - You can pass null for either of them to indicate that that dimension should not be changed. */ - setSize(width: any, height: any): void; - - /** Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect. */ - scrollTo(x: number, y: number): void; - - /** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area, - and the size of the visible area(minus scrollbars). */ - getScrollInfo(): { - left: any; - top: any; - width: any; - height: any; - clientWidth: any; - clientHeight: any; - } - - /** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor. - The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ - scrollIntoView(pos: CodeMirror.Position, margin?: number): void; - - /** Scrolls the given element into view. pos is a { left , top , right , bottom } object, in editor-local coordinates. - The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ - scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number): void; - - /** Scrolls the given element into view. pos is a { line, ch } object, in editor-local coordinates. - The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ - scrollIntoView(pos: { line: number, ch: number }, margin?: number): void; - - /** Scrolls the given element into view. pos is a { from, to } object, in editor-local coordinates. - The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ - scrollIntoView(pos: { from: CodeMirror.Position, to: CodeMirror.Position }, margin: number): void; - - /** Returns an { left , top , bottom } object containing the coordinates of the cursor position. - If mode is "local" , they will be relative to the top-left corner of the editable document. - If it is "page" or not given, they are relative to the top-left corner of the page. - where is a boolean indicating whether you want the start(true) or the end(false) of the selection. */ - cursorCoords(where: boolean, mode: string): { left: number; top: number; bottom: number; }; - - /** Returns an { left , top , bottom } object containing the coordinates of the cursor position. - If mode is "local" , they will be relative to the top-left corner of the editable document. - If it is "page" or not given, they are relative to the top-left corner of the page. - where specifies the precise position at which you want to measure. */ - cursorCoords(where: CodeMirror.Position, mode: string): { left: number; top: number; bottom: number; }; - - /** Returns the position and dimensions of an arbitrary character.pos should be a { line , ch } object. - This differs from cursorCoords in that it'll give the size of the whole character, - rather than just the position that the cursor would have when it would sit at that position. */ - charCoords(pos: CodeMirror.Position, mode: string): { left: number; right: number; top: number; bottom: number; }; - - /** Given an { left , top } object , returns the { line , ch } position that corresponds to it. - The optional mode parameter determines relative to what the coordinates are interpreted. It may be "window" , "page"(the default) , or "local". */ - coordsChar(object: { left: number; top: number; }, mode?: string): CodeMirror.Position; - - /** Returns the line height of the default font for the editor. */ - defaultTextHeight(): number; - - /** Returns the pixel width of an 'x' in the default font for the editor. - (Note that for non - monospace fonts , this is mostly useless, and even for monospace fonts, non - ascii characters might have a different width). */ - defaultCharWidth(): number; - - /** Returns a { from , to } object indicating the start (inclusive) and end (exclusive) of the currently rendered part of the document. - In big documents, when most content is scrolled out of view, CodeMirror will only render the visible part, and a margin around it. - See also the viewportChange event. */ - getViewport(): { from: number; to: number }; - - /** If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it, - you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */ - refresh(): void; - - - /** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */ - getTokenAt(pos: CodeMirror.Position): { - /** The character(on the given line) at which the token starts. */ - start: number; - /** The character at which the token ends. */ - end: number; - /** The token's string. */ - string: string; - /** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */ - type: string; - /** The mode's state at the end of this token. */ - state: any; - }; - - /** Returns the mode's parser state, if any, at the end of the given line number. - If no line number is given, the state at the end of the document is returned. - This can be useful for storing parsing errors in the state, or getting other kinds of contextual information for a line. */ - getStateAfter(line?: number): any; - - /** CodeMirror internally buffers changes and only updates its DOM structure after it has finished performing some operation. - If you need to perform a lot of operations on a CodeMirror instance, you can call this method with a function argument. - It will call the function, buffering up all changes, and only doing the expensive update after the function returns. - This can be a lot faster. The return value from this method will be the return value of your function. */ - operation(fn: ()=> T): T; - - /** Adjust the indentation of the given line. - The second argument (which defaults to "smart") may be one of: - "prev" Base indentation on the indentation of the previous line. - "smart" Use the mode's smart indentation if available, behave like "prev" otherwise. - "add" Increase the indentation of the line by one indent unit. - "subtract" Reduce the indentation of the line. */ - indentLine(line: number, dir?: string): void; - - - /** Give the editor focus. */ - focus(): void; - - /** Returns the hidden textarea used to read input. */ - getInputField(): HTMLTextAreaElement; - - /** Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an editor instance. */ - getWrapperElement(): HTMLElement; - - /** Returns the DOM node that is responsible for the scrolling of the editor. */ - getScrollerElement(): HTMLElement; - - /** Fetches the DOM node that contains the editor gutters. */ - getGutterElement(): HTMLElement; - - - - /** Events are registered with the on method (and removed with the off method). - These are the events that fire on the instance object. The name of the event is followed by the arguments that will be passed to the handler. - The instance argument always refers to the editor instance. */ - on(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void; - off(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void; - - /** Fires every time the content of the editor is changed. */ - on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void; - off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void; - - /** Like the "change" event, but batched per operation, passing an - * array containing all the changes that happened in the operation. - * This event is fired after the operation finished, and display - * changes it makes will trigger a new operation. */ - on(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void; - off(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void; - - /** This event is fired before a change is applied, and its handler may choose to modify or cancel the change. - The changeObj never has a next property, since this is fired for each individual change, and not batched per operation. - Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization. - Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation, - probably cause the editor to become corrupted. */ - on(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void; - off(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void; - - /** Will be fired when the cursor or selection moves, or any change is made to the editor content. */ - on(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; - off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; - - /** This event is fired before the selection is moved. Its handler may modify the resulting selection head and anchor. - Handlers for this event have the same restriction as "beforeChange" handlers � they should not do anything to directly update the state of the editor. */ - on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void; - off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void; - - /** Fires whenever the view port of the editor changes (due to scrolling, editing, or any other factor). - The from and to arguments give the new start and end of the viewport. */ - on(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void; - off(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void; - - /** Fires when the editor gutter (the line-number area) is clicked. Will pass the editor instance as first argument, - the (zero-based) number of the line that was clicked as second argument, the CSS class of the gutter that was clicked as third argument, - and the raw mousedown event object as fourth argument. */ - on(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void; - off(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void; - - /** Fires whenever the editor is focused. */ - on(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void; - off(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void; - - /** Fires whenever the editor is unfocused. */ - on(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void; - off(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void; - - /** Fires when the editor is scrolled. */ - on(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void; - off(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void; - - /** Will be fired whenever CodeMirror updates its DOM display. */ - on(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void; - off(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void; - - /** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document. - The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ - on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; - off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; - - /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ - state: any; - } - - interface EditorFromTextArea extends Editor { - - /** Copy the content of the editor into the textarea. */ - save(): void; - - /** Remove the editor, and restore the original textarea (with the editor's current content). */ - toTextArea(): void; - - /** Returns the textarea that the instance was based on. */ - getTextArea(): HTMLTextAreaElement; - } - - interface DocConstructor { - new (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc; - (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc; - } - - interface Doc { - /** Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ - getValue(seperator?: string): string; - - /** Set the editor content. */ - setValue(content: string): void; - - /** Get the text between the given points in the editor, which should be {line, ch} objects. - An optional third argument can be given to indicate the line separator string to use (defaults to "\n"). */ - getRange(from: Position, to: CodeMirror.Position, seperator?: string): string; - - /** Replace the part of the document between from and to with the given string. - from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */ - replaceRange(replacement: string, from: CodeMirror.Position, to: CodeMirror.Position): void; - - /** Get the content of line n. */ - getLine(n: number): string; - - /** Set the content of line n. */ - setLine(n: number, text: string): void; - - /** Remove the given line from the document. */ - removeLine(n: number): void; - - /** Get the number of lines in the editor. */ - lineCount(): number; - - /** Get the first line of the editor. This will usually be zero but for linked sub-views, - or documents instantiated with a non-zero first line, it might return other values. */ - firstLine(): number; - - /** Get the last line of the editor. This will usually be lineCount() - 1, but for linked sub-views, it might return other values. */ - lastLine(): number; - - /** Fetches the line handle for the given line number. */ - getLineHandle(num: number): CodeMirror.LineHandle; - - /** Given a line handle, returns the current position of that line (or null when it is no longer in the document). */ - getLineNumber(handle: CodeMirror.LineHandle): number; - - /** Iterate over the whole document, and call f for each line, passing the line handle. - This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. - Note that line handles have a text property containing the line's content (as a string). */ - eachLine(f: (line: CodeMirror.LineHandle) => void ): void; - - /** Iterate over the range from start up to (not including) end, and call f for each line, passing the line handle. - This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. - Note that line handles have a text property containing the line's content (as a string). */ - eachLine(start: number, end: number, f: (line: CodeMirror.LineHandle) => void ): void; - - /** Set the editor content as 'clean', a flag that it will retain until it is edited, and which will be set again when such an edit is undone again. - Useful to track whether the content needs to be saved. */ - markClean(): void; - - /** Returns whether the document is currently clean (not modified since initialization or the last call to markClean). */ - isClean(): boolean; - - - - /** Get the currently selected code. */ - getSelection(): string; - - /** Replace the selection with the given string. By default, the new selection will span the inserted text. - The optional collapse argument can be used to change this � passing "start" or "end" will collapse the selection to the start or end of the inserted text. */ - replaceSelection(replacement: string, collapse?: string): void; - - /** start is a an optional string indicating which end of the selection to return. - It may be "start" , "end" , "head"(the side of the selection that moves when you press shift + arrow), - or "anchor"(the fixed side of the selection).Omitting the argument is the same as passing "head".A { line , ch } object will be returned. */ - getCursor(start?: string): CodeMirror.Position; - - /** Retrieves a list of all current selections. These will always be sorted, and never overlap (overlapping selections are merged). - Each object in the array contains anchor and head properties referring to {line, ch} objects. */ - listSelections(): { anchor: CodeMirror.Position; head: CodeMirror.Position }[]; - - /** Return true if any text is selected. */ - somethingSelected(): boolean; - - /** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */ - setCursor(pos: CodeMirror.Position): void; - - /** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */ - setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void; - - /** Similar to setSelection , but will, if shift is held or the extending flag is set, - move the head of the selection while leaving the anchor at its current place. - pos2 is optional , and can be passed to ensure a region (for example a word or paragraph) will end up selected - (in addition to whatever lies between that region and the current anchor). */ - extendSelection(from: CodeMirror.Position, to?: CodeMirror.Position): void; - - /** Sets or clears the 'extending' flag , which acts similar to the shift key, - in that it will cause cursor movement and calls to extendSelection to leave the selection anchor in place. */ - setExtending(value: boolean): void; - - - /** Retrieve the editor associated with a document. May return null. */ - getEditor(): CodeMirror.Editor; - - - /** Create an identical copy of the given doc. When copyHistory is true , the history will also be copied.Can not be called directly on an editor. */ - copy(copyHistory: boolean): CodeMirror.Doc; - - /** Create a new document that's linked to the target document. Linked documents will stay in sync (changes to one are also applied to the other) until unlinked. */ - linkedDoc(options: { - /** When turned on, the linked copy will share an undo history with the original. - Thus, something done in one of the two can be undone in the other, and vice versa. */ - sharedHist?: boolean; - from?: number; - /** Can be given to make the new document a subview of the original. Subviews only show a given range of lines. - Note that line coordinates inside the subview will be consistent with those of the parent, - so that for example a subview starting at line 10 will refer to its first line as line 10, not 0. */ - to?: number; - /** By default, the new document inherits the mode of the parent. This option can be set to a mode spec to give it a different mode. */ - mode: any; - }): CodeMirror.Doc; - - /** Break the link between two documents. After calling this , changes will no longer propagate between the documents, - and, if they had a shared history, the history will become separate. */ - unlinkDoc(doc: CodeMirror.Doc): void; - - /** Will call the given function for all documents linked to the target document. It will be passed two arguments, - the linked document and a boolean indicating whether that document shares history with the target. */ - iterLinkedDocs(fn: (doc: CodeMirror.Doc, sharedHist: boolean) => void ): void; - - /** Undo one edit (if any undo events are stored). */ - undo(): void; - - /** Redo one undone edit. */ - redo(): void; - - /** Returns an object with {undo, redo } properties , both of which hold integers , indicating the amount of stored undo and redo operations. */ - historySize(): { undo: number; redo: number; }; - - /** Clears the editor's undo history. */ - clearHistory(): void; - - /** Get a(JSON - serializeable) representation of the undo history. */ - getHistory(): any; - - /** Replace the editor's undo history with the one provided, which must be a value as returned by getHistory. - Note that this will have entirely undefined results if the editor content isn't also the same as it was when getHistory was called. */ - setHistory(history: any): void; - - - /** Can be used to mark a range of text with a specific CSS class name. from and to should be { line , ch } objects. */ - markText(from: CodeMirror.Position, to: CodeMirror.Position, options?: CodeMirror.TextMarkerOptions): TextMarker; - - /** Inserts a bookmark, a handle that follows the text around it as it is being edited, at the given position. - A bookmark has two methods find() and clear(). The first returns the current position of the bookmark, if it is still in the document, - and the second explicitly removes the bookmark. */ - setBookmark(pos: CodeMirror.Position, options?: { - /** Can be used to display a DOM node at the current location of the bookmark (analogous to the replacedWith option to markText). */ - widget?: HTMLElement; - - /** By default, text typed when the cursor is on top of the bookmark will end up to the right of the bookmark. - Set this option to true to make it go to the left instead. */ - insertLeft?: boolean; - }): CodeMirror.TextMarker; - - /** Returns an array of all the bookmarks and marked ranges found between the given positions. */ - findMarks(from: CodeMirror.Position, to: CodeMirror.Position): TextMarker[]; - - /** Returns an array of all the bookmarks and marked ranges present at the given position. */ - findMarksAt(pos: CodeMirror.Position): TextMarker[]; - - /** Returns an array containing all marked ranges in the document. */ - getAllMarks(): CodeMirror.TextMarker[]; - - - /** Gets the mode object for the editor. Note that this is distinct from getOption("mode"), which gives you the mode specification, - rather than the resolved, instantiated mode object. */ - getMode(): any; - - /** Calculates and returns a { line , ch } object for a zero-based index whose value is relative to the start of the editor's text. - If the index is out of range of the text then the returned object is clipped to start or end of the text respectively. */ - posFromIndex(index: number): CodeMirror.Position; - - /** The reverse of posFromIndex. */ - indexFromPos(object: CodeMirror.Position): number; - - /** Expose the state object, so that the Doc.state.completionActive property is reachable*/ - state: any; - } - - interface LineHandle { - text: string; - } - - interface TextMarker { - /** Remove the mark. */ - clear(): void; - - /** 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.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; - } - - interface LineWidget { - /** Removes the widget. */ - clear(): void; - - /** Call this if you made some change to the widget's DOM node that might affect its height. - It'll force CodeMirror to update the height of the line that contains the widget. */ - changed(): void; - } - - interface EditorChange { - /** Position (in the pre-change coordinate system) where the change started. */ - from: CodeMirror.Position; - /** Position (in the pre-change coordinate system) where the change ended. */ - to: CodeMirror.Position; - /** Array of strings representing the text that replaced the changed range (split by line). */ - text: string[]; - /** Text that used to be between from and to, which is overwritten by this change. */ - removed: string[]; - /** String representing the origin of the change event and wether it can be merged with history */ - origin: string; - } - - interface EditorChangeLinkedList extends CodeMirror.EditorChange { - /** Points to another change object (which may point to another, etc). */ - next?: CodeMirror.EditorChangeLinkedList; - } - - interface EditorChangeCancellable extends CodeMirror.EditorChange { - /** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. */ - update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string): void; - - cancel(): void; - } - - interface PositionConstructor { - 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; - } - - interface EditorConfiguration { - /** string| The starting value of the editor. Can be a string, or a document object. */ - value?: any; - - /** string|object. The mode to use. When not given, this will default to the first mode that was loaded. - It may be a string, which either simply names the mode or is a MIME type associated with the mode. - Alternatively, it may be an object containing configuration options for the mode, - with a name property that names the mode (for example {name: "javascript", json: true}). */ - mode?: any; - - /** The theme to style the editor with. You must make sure the CSS file defining the corresponding .cm-s-[name] styles is loaded. - The default is "default". */ - theme?: string; - - /** How many spaces a block (whatever that means in the edited language) should be indented. The default is 2. */ - indentUnit?: number; - - /** Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to true. */ - smartIndent?: boolean; - - /** The width of a tab character. Defaults to 4. */ - tabSize?: number; - - /** Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. Default is false. */ - indentWithTabs?: boolean; - - /** Configures whether the editor should re-indent the current line when a character is typed - that might change its proper indentation (only works if the mode supports indentation). Default is true. */ - electricChars?: boolean; - - /** Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text - is visual (pressing the left arrow moves the cursor left) - or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text). - The default is false on Windows, and true on other platforms. */ - rtlMoveVisually?: boolean; - - /** Configures the keymap to use. The default is "default", which is the only keymap defined in codemirror.js itself. - Extra keymaps are found in the keymap directory. See the section on keymaps for more information. */ - keyMap?: string; - - /** Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value. */ - extraKeys?: any; - - /** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */ - lineWrapping?: boolean; - - /** Whether to show line numbers to the left of the editor. */ - lineNumbers?: boolean; - - /** At which number to start counting lines. Default is 1. */ - firstLineNumber?: number; - - /** A function used to format line numbers. The function is passed the line number, and should return a string that will be shown in the gutter. */ - lineNumberFormatter?: (line: number) => string; - - /** Can be used to add extra gutters (beyond or instead of the line number gutter). - Should be an array of CSS class names, each of which defines a width (and optionally a background), - and which will be used to draw the background of the gutters. - May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter - (it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker. */ - gutters?: string[]; - - /** Determines whether the gutter scrolls along with the content horizontally (false) - or whether it stays fixed during horizontal scrolling (true, the default). */ - fixedGutter?: boolean; - - /** boolean|string. This disables editing of the editor content by the user. If the special value "nocursor" is given (instead of simply true), focusing of the editor is also disallowed. */ - readOnly?: any; - - /**Whether the cursor should be drawn when a selection is active. Defaults to false. */ - showCursorWhenSelecting?: boolean; - - /** The maximum number of undo levels that the editor stores. Defaults to 40. */ - undoDepth?: number; - - /** The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500. */ - historyEventDelay?: number; - - /** The tab index to assign to the editor. If not given, no tab index will be assigned. */ - tabindex?: number; - - /** Can be used to make CodeMirror focus itself on initialization. Defaults to off. - When fromTextArea is used, and no explicit value is given for this option, it will be set to true when either the source textarea is focused, - or it has an autofocus attribute and no other element is focused. */ - autofocus?: boolean; - - /** Controls whether drag-and - drop is enabled. On by default. */ - dragDrop?: boolean; - - /** When given , this will be called when the editor is handling a dragenter , dragover , or drop event. - It will be passed the editor instance and the event object as arguments. - The callback can choose to handle the event itself , in which case it should return true to indicate that CodeMirror should not do anything further. */ - onDragEvent?: (instance: CodeMirror.Editor, event: Event) => boolean; - - /** This provides a rather low - level hook into CodeMirror's key handling. - If provided, this function will be called on every keydown, keyup, and keypress event that CodeMirror captures. - It will be passed two arguments, the editor instance and the key event. - This key event is pretty much the raw key event, except that a stop() method is always added to it. - You could feed it to, for example, jQuery.Event to further normalize it. - This function can inspect the key event, and handle it if it wants to. - It may return true to tell CodeMirror to ignore the event. - Be wary that, on some browsers, stopping a keydown does not stop the keypress from firing, whereas on others it does. - If you respond to an event, you should probably inspect its type property and only do something when it is keydown - (or keypress for actions that need character data). */ - onKeyEvent?: (instance: CodeMirror.Editor, event: Event) => boolean; - - /** Half - period in milliseconds used for cursor blinking. The default blink rate is 530ms. */ - cursorBlinkRate?: number; - - /** Determines the height of the cursor. Default is 1 , meaning it spans the whole height of the line. - For some fonts (and by some tastes) a smaller height (for example 0.85), - which causes the cursor to not reach all the way to the bottom of the line, looks better */ - cursorHeight?: number; - - /** Highlighting is done by a pseudo background - thread that will work for workTime milliseconds, - and then use timeout to sleep for workDelay milliseconds. - The defaults are 200 and 300, you can change these options to make the highlighting more or less aggressive. */ - workTime?: number; - - /** See workTime. */ - workDelay?: number; - - /** Indicates how quickly CodeMirror should poll its input textarea for changes(when focused). - Most input is captured by events, but some things, like IME input on some browsers, don't generate events that allow CodeMirror to properly detect it. - Thus, it polls. Default is 100 milliseconds. */ - pollInterval?: number - - /** By default, CodeMirror will combine adjacent tokens into a single span if they have the same class. - This will result in a simpler DOM tree, and thus perform better. With some kinds of styling(such as rounded corners), - this will change the way the document looks. You can set this option to false to disable this behavior. */ - flattenSpans?: boolean; - - /** When highlighting long lines, in order to stay responsive, the editor will give up and simply style - the rest of the line as plain text when it reaches a certain position. The default is 10000. - You can set this to Infinity to turn off this behavior. */ - maxHighlightLength?: number; - - /** Specifies the amount of lines that are rendered above and below the part of the document that's currently scrolled into view. - This affects the amount of updates needed when scrolling, and the amount of work that such an update does. - You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered, - and thus the browser's text search works on it. This will have bad effects on performance of big documents. */ - 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. */ - placeholder?: string; - } - - interface TextMarkerOptions { - /** Assigns a CSS class to the marked stretch of text. */ - className?: string; - - /** Determines whether text inserted on the left of the marker will end up inside or outside of it. */ - inclusiveLeft?: boolean; - - /** Like inclusiveLeft , but for the right side. */ - inclusiveRight?: boolean; - - /** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them. - In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed - respectively directly before and directly after the range. */ - atomic?: boolean; - - /** Collapsed ranges do not show up in the display.Setting a range to be collapsed will automatically make it atomic. */ - collapsed?: boolean; - - /** When enabled, will cause the mark to clear itself whenever the cursor enters its range. - This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them. - The "clear" event fired on the range handle can be used to be notified when this happens. */ - clearOnEnter?: boolean; - - /** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */ - clearWhenEmpty?: boolean; - - /** Use a given node to display this range.Implies both collapsed and atomic. - The given DOM node must be an inline element(as opposed to a block element). */ - replacedWith?: HTMLElement; - - /** When replacedWith is given, this determines whether the editor will - * capture mouse and drag events occurring in this widget. Default is - * false—the events will be left alone for the default browser handler, - * or specific handlers on the widget, to capture. */ - handleMouseEvents?: boolean; - - /** A read - only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document. - Note: adding a read - only span currently clears the undo history of the editor, - because existing undo events being partially nullified by read - only spans would corrupt the history (in the current implementation). */ - readOnly?: boolean; - - /** When set to true (default is false), adding this marker will create an event in the undo history that can be individually undone(clearing the marker). */ - addToHistory?: boolean; - - /** Can be used to specify an extra CSS class to be applied to the leftmost span that is part of the marker. */ - startStyle?: string; - - /** Equivalent to startStyle, but for the rightmost span. */ - endStyle?: string; - - /** A string of CSS to be applied to the covered text. For example "color: #fe3". */ - css?: string; - - /** When given, will give the nodes created for this span a HTML title attribute with the given value. */ - title?: string; - - /** When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents. - By default, a marker appears only in its target document. */ - shared?: boolean; - } - - interface StringStream { - lastColumnPos: number; - lastColumnValue: number; - lineStart: number; - - /** - * Current position in the string. - */ - pos: number; - - /** - * Where the stream's position was when it was first passed to the token function. - */ - start: number; - - /** - * The current line's content. - */ - string: string; - - /** - * Number of spaces per tab character. - */ - tabSize: number; - - /** - * Returns true only if the stream is at the end of the line. - */ - eol(): boolean; - - /** - * Returns true only if the stream is at the start of the line. - */ - sol(): boolean; - - /** - * Returns the next character in the stream without advancing it. Will return an null at the end of the line. - */ - peek(): string; - - /** - * Returns the next character in the stream and advances it. Also returns null when no more characters are available. - */ - next(): string; - - /** - * match can be a character, a regular expression, or a function that takes a character and returns a boolean. - * If the next character in the stream 'matches' the given argument, it is consumed and returned. - * Otherwise, undefined is returned. - */ - eat(match: string): string; - eat(match: RegExp): string; - eat(match: (char: string) => boolean): string; - - /** - * Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten. - */ - eatWhile(match: string): boolean; - eatWhile(match: RegExp): boolean; - eatWhile(match: (char: string) => boolean): boolean; - - /** - * Shortcut for eatWhile when matching white-space. - */ - eatSpace(): boolean; - - /** - * Moves the position to the end of the line. - */ - skipToEnd(): void; - - /** - * Skips to the next occurrence of the given character, if found on the current line (doesn't advance the stream if - * the character does not occur on the line). - * - * Returns true if the character was found. - */ - skipTo(ch: string): boolean; - - /** - * Act like a multi-character eat - if consume is true or not given - or a look-ahead that doesn't update the stream - * position - if it is false. pattern can be either a string or a regular expression starting with ^. When it is a - * string, caseFold can be set to true to make the match case-insensitive. When successfully matching a regular - * expression, the returned value will be the array returned by match, in case you need to extract matched groups. - */ - match(pattern: string, consume?: boolean, caseFold?: boolean): boolean; - match(pattern: RegExp, consume?: boolean): string[]; - - /** - * Backs up the stream n characters. Backing it up further than the start of the current token will cause things to - * break, so be careful. - */ - backUp(n: number): void; - - /** - * Returns the column (taking into account tabs) at which the current token starts. - */ - column(): number; - - /** - * Tells you how far the current line has been indented, in spaces. Corrects for tab characters. - */ - indentation(): number; - - /** - * Get the string between the start of the current token and the current stream position. - */ - current(): string; - } - - /** - * A Mode is, in the simplest case, a lexer (tokenizer) for your language — a function that takes a character stream as input, - * advances it past a token, and returns a style for that token. More advanced modes can also handle indentation for the language. - */ - interface Mode { - /** - * This function should read one token from the stream it is given as an argument, optionally update its state, - * and return a style string, or null for tokens that do not have to be styled. Multiple styles can be returned, separated by spaces. - */ - token(stream: StringStream, state: T): string; - - /** - * A function that produces a state object to be used at the start of a document. - */ - startState?: () => T; - /** - * For languages that have significant blank lines, you can define a blankLine(state) method on your mode that will get called - * whenever a blank line is passed over, so that it can update the parser state. - */ - blankLine?: (state: T) => void; - /** - * Given a state returns a safe copy of that state. - */ - copyState?: (state: T) => T; - - /** - * The indentation method should inspect the given state object, and optionally the textAfter string, which contains the text on - * the line that is being indented, and return an integer, the amount of spaces to indent. - */ - indent?: (state: T, textAfter: string) => number; - - /** The four below strings are used for working with the commenting addon. */ - /** - * String that starts a line comment. - */ - lineComment?: string; - /** - * String that starts a block comment. - */ - blockCommentStart?: string; - /** - * String that ends a block comment. - */ - blockCommentEnd?: string; - /** - * String to put at the start of continued lines in a block comment. - */ - blockCommentLead?: string; - - /** - * Trigger a reindent whenever one of the characters in the string is typed. - */ - electricChars?: string - /** - * Trigger a reindent whenever the regex matches the part of the line before the cursor. - */ - electricinput?: RegExp - } - - /** - * A function that, given a CodeMirror configuration object and an optional mode configuration object, returns a mode object. - */ - interface ModeFactory { - (config: CodeMirror.EditorConfiguration, modeOptions?: any): Mode - } - - /** - * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function - * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. - */ - function defineMode(id: string, modefactory: ModeFactory): void; - - /** - * The first argument is a configuration object as passed to the mode constructor function, and the second argument - * is a mode specification as in the EditorConfiguration mode option. - */ - function getMode(config: CodeMirror.EditorConfiguration, mode: any): Mode; - - /** - * Utility function from the overlay.js addon that allows modes to be combined. The mode given as the base argument takes care of - * most of the normal mode functionality, but a second (typically simple) mode is used, which can override the style of text. - * Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless - * the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined. - */ - function overlayMode(base: Mode, overlay: Mode, combine?: boolean): Mode - - /** - * async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror - * gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on - * initialization of the CodeMirror instance. - */ - interface LintStateOptions { - async: boolean; - hasGutters: boolean; - } - - /** - * Adds the getAnnotations callback to LintStateOptions which may be overridden by the user if they choose use their own - * linter. - */ - interface LintOptions extends LintStateOptions { - getAnnotations: AnnotationsCallback; - } - - /** - * A function that calls the updateLintingCallback with any errors found during the linting process. - */ - interface AnnotationsCallback { - (content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void; - } - - /** - * A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations - */ - interface UpdateLintingCallback { - (codeMirror: Editor, annotations: Annotation[]): void; - } - - /** - * An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error, - * and an explaination as to why the error was thrown. - */ - interface Annotation { - from: Position; - message?: string; - severity?: string; - to?: Position; - } -} - -declare module "codemirror" { - export = CodeMirror; -} +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: mihailik +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function CodeMirror(host: HTMLElement, options?: CodeMirror.EditorConfiguration): CodeMirror.Editor; +declare function CodeMirror(callback: (host: HTMLElement) => void , options?: CodeMirror.EditorConfiguration): CodeMirror.Editor; + +declare module CodeMirror { + export var Doc : CodeMirror.DocConstructor; + export var Pos: CodeMirror.PositionConstructor; + export var Pass: any; + + function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea; + + var version: string; + + /** If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension. + This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. */ + function defineExtension(name: string, value: any): void; + + /** Like defineExtension, but the method will be added to the interface for Doc objects instead. */ + function defineDocExtension(name: string, value: any): void; + + /** Similarly, defineOption can be used to define new options for CodeMirror. + The updateFunc will be called with the editor instance and the new value when an editor is initialized, + and whenever the option is modified through setOption. */ + function defineOption(name: string, default_: any, updateFunc: Function): void; + + /** If your extention just needs to run some code whenever a CodeMirror instance is initialized, use CodeMirror.defineInitHook. + Give it a function as its only argument, and from then on, that function will be called (with the instance as argument) + whenever a new CodeMirror instance is initialized. */ + function defineInitHook(func: Function): void; + + + + function on(element: any, eventName: string, handler: Function): void; + function off(element: any, eventName: string, handler: Function): void; + + /** Fired whenever a change occurs to the document. changeObj has a similar type as the object passed to the editor's "change" event, + but it never has a next property, because document change events are not batched (whereas editor change events are). */ + function on(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void ): void; + function off(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void ): void; + + /** See the description of the same event on editor instances. */ + function on(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void ): void; + function off(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void ): void; + + /** Fired whenever the cursor or selection in this document changes. */ + function on(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; + function off(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; + + /** Equivalent to the event by the same name as fired on editor instances. */ + function on(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void ): void; + function off(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void ): void; + + /** Will be fired when the line object is deleted. A line object is associated with the start of the line. + Mostly useful when you need to find out when your gutter markers on a given line are removed. */ + function on(line: LineHandle, eventName: 'delete', handler: () => void ): void; + function off(line: LineHandle, eventName: 'delete', handler: () => void ): void; + + /** Fires when the line's text content is changed in any way (but the line is not deleted outright). + The change object is similar to the one passed to change event on the editor object. */ + function on(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void ): void; + function off(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void ): void; + + /** Fired when the cursor enters the marked range. From this event handler, the editor state may be inspected but not modified, + with the exception that the range on which the event fires may be cleared. */ + function on(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void ): void; + function off(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void ): void; + + /** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method. + Will only be fired once per handle. Note that deleting the range through text editing does not fire this event, + because an undo action might bring the range back into existence. */ + function on(marker: TextMarker, eventName: 'clear', handler: () => void ): void; + function off(marker: TextMarker, eventName: 'clear', handler: () => void ): void; + + /** Fired when the last part of the marker is removed from the document by editing operations. */ + function on(marker: TextMarker, eventName: 'hide', handler: () => void ): void; + function off(marker: TextMarker, eventName: 'hide', handler: () => void ): void; + + /** Fired when, after the marker was removed by editing, a undo operation brought the marker back. */ + function on(marker: TextMarker, eventName: 'unhide', handler: () => void ): void; + function off(marker: TextMarker, eventName: 'unhide', handler: () => void ): void; + + /** Fired whenever the editor re-adds the widget to the DOM. This will happen once right after the widget is added (if it is scrolled into view), + and then again whenever it is scrolled out of view and back in again, or when changes to the editor options + or the line the widget is on require the widget to be redrawn. */ + function on(line: LineWidget, eventName: 'redraw', handler: () => void ): void; + function off(line: LineWidget, eventName: 'redraw', handler: () => void ): void; + + /** Various CodeMirror-related objects emit events, which allow client code to react to various situations. + Handlers for such events can be registered with the on and off methods on the objects that the event fires on. + To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object. */ + function signal(target: any, name: string, ...args: any[]): void; + + interface Editor { + + /** Tells you whether the editor currently has focus. */ + hasFocus(): boolean; + + /** Used to find the target position for horizontal cursor motion.start is a { line , ch } object, + amount an integer(may be negative), and unit one of the string "char", "column", or "word". + Will return a position that is produced by moving amount times the distance specified by unit. + When visually is true , motion in right - to - left text will be visual rather than logical. + When the motion was clipped by hitting the end or start of the document, the returned value will have a hitSide property set to true. */ + findPosH(start: CodeMirror.Position, amount: number, unit: string, visually: boolean): { line: number; ch: number; hitSide?: boolean; }; + + /** Similar to findPosH , but used for vertical motion.unit may be "line" or "page". + The other arguments and the returned value have the same interpretation as they have in findPosH. */ + findPosV(start: CodeMirror.Position, amount: number, unit: string): { line: number; ch: number; hitSide?: boolean; }; + + + /** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */ + setOption(option: string, value: any): void; + + /** Retrieves the current value of the given option for this editor instance. */ + getOption(option: string): any; + + /** Attach an additional keymap to the editor. + This is mostly useful for add - ons that need to register some key handlers without trampling on the extraKeys option. + Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them, + the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed, + in which case they end up below other keymaps added with this method. */ + addKeyMap(map: any, bottom?: boolean): void; + + /** Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string, + which will be compared against the name property of the active keymaps. */ + removeKeyMap(map: any): void; + + /** Enable a highlighting overlay.This is a stateless mini - mode that can be used to add extra highlighting. + For example, the search add - on uses it to highlight the term that's currently being searched. + mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object. + Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null, + to override the styling of the base mode entirely, instead of the two being applied together. */ + addOverlay(mode: any, options?: any): void; + + /** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */ + removeOverlay(mode: any): void; + + + /** Retrieve the currently active document from an editor. */ + getDoc(): CodeMirror.Doc; + + /** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */ + swapDoc(doc: CodeMirror.Doc): CodeMirror.Doc; + + + + /** Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value. + Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. */ + setGutterMarker(line: any, gutterID: string, value: HTMLElement): CodeMirror.LineHandle; + + /** Remove all gutter markers in the gutter with the given ID. */ + clearGutter(gutterID: string): void; + + /** Set a CSS class name for the given line.line can be a number or a line handle. + where determines to which element this class should be applied, can can be one of "text" (the text element, which lies in front of the selection), + "background"(a background element that will be behind the selection), + or "wrap" (the wrapper node that wraps all of the line's elements, including gutter elements). + class should be the name of the class to apply. */ + addLineClass(line: any, where: string, _class_: string): CodeMirror.LineHandle; + + /** Remove a CSS class from a line.line can be a line handle or number. + where should be one of "text", "background", or "wrap"(see addLineClass). + class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */ + removeLineClass(line: any, where: string, class_: string): CodeMirror.LineHandle; + + /** Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle. */ + lineInfo(line: any): { + line: any; + handle: any; + text: string; + /** Object mapping gutter IDs to marker elements. */ + gutterMarks: any; + textClass: string; + bgClass: string; + wrapClass: string; + /** Array of line widgets attached to this line. */ + widgets: any; + }; + + /** Puts node, which should be an absolutely positioned DOM node, into the editor, positioned right below the given { line , ch } position. + When scrollIntoView is true, the editor will ensure that the entire node is visible (if possible). + To remove the widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent). */ + addWidget(pos: CodeMirror.Position, node: HTMLElement, scrollIntoView: boolean): void; + + /** Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. + line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line. + options, when given, should be an object that configures the behavior of the widget. + Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. */ + addLineWidget(line: any, node: HTMLElement, options?: { + /** Whether the widget should cover the gutter. */ + coverGutter: boolean; + /** Whether the widget should stay fixed in the face of horizontal scrolling. */ + noHScroll: boolean; + /** Causes the widget to be placed above instead of below the text of the line. */ + above: boolean; + /** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */ + showIfHidden: boolean; + }): CodeMirror.LineWidget; + + + /** Programatically set the size of the editor (overriding the applicable CSS rules). + width and height height can be either numbers(interpreted as pixels) or CSS units ("100%", for example). + You can pass null for either of them to indicate that that dimension should not be changed. */ + setSize(width: any, height: any): void; + + /** Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect. */ + scrollTo(x: number, y: number): void; + + /** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area, + and the size of the visible area(minus scrollbars). */ + getScrollInfo(): { + left: any; + top: any; + width: any; + height: any; + clientWidth: any; + clientHeight: any; + } + + /** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: CodeMirror.Position, margin?: number): void; + + /** Scrolls the given element into view. pos is a { left , top , right , bottom } object, in editor-local coordinates. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number): void; + + /** Scrolls the given element into view. pos is a { line, ch } object, in editor-local coordinates. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: { line: number, ch: number }, margin?: number): void; + + /** Scrolls the given element into view. pos is a { from, to } object, in editor-local coordinates. + The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */ + scrollIntoView(pos: { from: CodeMirror.Position, to: CodeMirror.Position }, margin: number): void; + + /** Returns an { left , top , bottom } object containing the coordinates of the cursor position. + If mode is "local" , they will be relative to the top-left corner of the editable document. + If it is "page" or not given, they are relative to the top-left corner of the page. + where is a boolean indicating whether you want the start(true) or the end(false) of the selection. */ + cursorCoords(where: boolean, mode: string): { left: number; top: number; bottom: number; }; + + /** Returns an { left , top , bottom } object containing the coordinates of the cursor position. + If mode is "local" , they will be relative to the top-left corner of the editable document. + If it is "page" or not given, they are relative to the top-left corner of the page. + where specifies the precise position at which you want to measure. */ + cursorCoords(where: CodeMirror.Position, mode: string): { left: number; top: number; bottom: number; }; + + /** Returns the position and dimensions of an arbitrary character.pos should be a { line , ch } object. + This differs from cursorCoords in that it'll give the size of the whole character, + rather than just the position that the cursor would have when it would sit at that position. */ + charCoords(pos: CodeMirror.Position, mode: string): { left: number; right: number; top: number; bottom: number; }; + + /** Given an { left , top } object , returns the { line , ch } position that corresponds to it. + The optional mode parameter determines relative to what the coordinates are interpreted. It may be "window" , "page"(the default) , or "local". */ + coordsChar(object: { left: number; top: number; }, mode?: string): CodeMirror.Position; + + /** Returns the line height of the default font for the editor. */ + defaultTextHeight(): number; + + /** Returns the pixel width of an 'x' in the default font for the editor. + (Note that for non - monospace fonts , this is mostly useless, and even for monospace fonts, non - ascii characters might have a different width). */ + defaultCharWidth(): number; + + /** Returns a { from , to } object indicating the start (inclusive) and end (exclusive) of the currently rendered part of the document. + In big documents, when most content is scrolled out of view, CodeMirror will only render the visible part, and a margin around it. + See also the viewportChange event. */ + getViewport(): { from: number; to: number }; + + /** If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it, + you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */ + refresh(): void; + + + /** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */ + getTokenAt(pos: CodeMirror.Position): { + /** The character(on the given line) at which the token starts. */ + start: number; + /** The character at which the token ends. */ + end: number; + /** The token's string. */ + string: string; + /** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */ + type: string; + /** The mode's state at the end of this token. */ + state: any; + }; + + /** Returns the mode's parser state, if any, at the end of the given line number. + If no line number is given, the state at the end of the document is returned. + This can be useful for storing parsing errors in the state, or getting other kinds of contextual information for a line. */ + getStateAfter(line?: number): any; + + /** CodeMirror internally buffers changes and only updates its DOM structure after it has finished performing some operation. + If you need to perform a lot of operations on a CodeMirror instance, you can call this method with a function argument. + It will call the function, buffering up all changes, and only doing the expensive update after the function returns. + This can be a lot faster. The return value from this method will be the return value of your function. */ + operation(fn: ()=> T): T; + + /** Adjust the indentation of the given line. + The second argument (which defaults to "smart") may be one of: + "prev" Base indentation on the indentation of the previous line. + "smart" Use the mode's smart indentation if available, behave like "prev" otherwise. + "add" Increase the indentation of the line by one indent unit. + "subtract" Reduce the indentation of the line. */ + indentLine(line: number, dir?: string): void; + + + /** Give the editor focus. */ + focus(): void; + + /** Returns the hidden textarea used to read input. */ + getInputField(): HTMLTextAreaElement; + + /** Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an editor instance. */ + getWrapperElement(): HTMLElement; + + /** Returns the DOM node that is responsible for the scrolling of the editor. */ + getScrollerElement(): HTMLElement; + + /** Fetches the DOM node that contains the editor gutters. */ + getGutterElement(): HTMLElement; + + + + /** Events are registered with the on method (and removed with the off method). + These are the events that fire on the instance object. The name of the event is followed by the arguments that will be passed to the handler. + The instance argument always refers to the editor instance. */ + on(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void; + off(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void; + + /** Fires every time the content of the editor is changed. */ + on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void; + off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void; + + /** Like the "change" event, but batched per operation, passing an + * array containing all the changes that happened in the operation. + * This event is fired after the operation finished, and display + * changes it makes will trigger a new operation. */ + on(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void; + off(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void; + + /** This event is fired before a change is applied, and its handler may choose to modify or cancel the change. + The changeObj never has a next property, since this is fired for each individual change, and not batched per operation. + Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization. + Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation, + probably cause the editor to become corrupted. */ + on(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void; + off(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void; + + /** Will be fired when the cursor or selection moves, or any change is made to the editor content. */ + on(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; + off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; + + /** This event is fired before the selection is moved. Its handler may modify the resulting selection head and anchor. + Handlers for this event have the same restriction as "beforeChange" handlers � they should not do anything to directly update the state of the editor. */ + on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void; + off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void; + + /** Fires whenever the view port of the editor changes (due to scrolling, editing, or any other factor). + The from and to arguments give the new start and end of the viewport. */ + on(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void; + off(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void; + + /** Fires when the editor gutter (the line-number area) is clicked. Will pass the editor instance as first argument, + the (zero-based) number of the line that was clicked as second argument, the CSS class of the gutter that was clicked as third argument, + and the raw mousedown event object as fourth argument. */ + on(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void; + off(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void; + + /** Fires whenever the editor is focused. */ + on(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void; + off(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void; + + /** Fires whenever the editor is unfocused. */ + on(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void; + off(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void; + + /** Fires when the editor is scrolled. */ + on(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void; + off(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void; + + /** Will be fired whenever CodeMirror updates its DOM display. */ + on(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void; + off(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void; + + /** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document. + The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ + on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; + off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; + + /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ + state: any; + } + + interface EditorFromTextArea extends Editor { + + /** Copy the content of the editor into the textarea. */ + save(): void; + + /** Remove the editor, and restore the original textarea (with the editor's current content). */ + toTextArea(): void; + + /** Returns the textarea that the instance was based on. */ + getTextArea(): HTMLTextAreaElement; + } + + interface DocConstructor { + new (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc; + (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc; + } + + interface Doc { + /** Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ + getValue(seperator?: string): string; + + /** Set the editor content. */ + setValue(content: string): void; + + /** Get the text between the given points in the editor, which should be {line, ch} objects. + An optional third argument can be given to indicate the line separator string to use (defaults to "\n"). */ + getRange(from: Position, to: CodeMirror.Position, seperator?: string): string; + + /** Replace the part of the document between from and to with the given string. + from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */ + replaceRange(replacement: string, from: CodeMirror.Position, to: CodeMirror.Position): void; + + /** Get the content of line n. */ + getLine(n: number): string; + + /** Set the content of line n. */ + setLine(n: number, text: string): void; + + /** Remove the given line from the document. */ + removeLine(n: number): void; + + /** Get the number of lines in the editor. */ + lineCount(): number; + + /** Get the first line of the editor. This will usually be zero but for linked sub-views, + or documents instantiated with a non-zero first line, it might return other values. */ + firstLine(): number; + + /** Get the last line of the editor. This will usually be lineCount() - 1, but for linked sub-views, it might return other values. */ + lastLine(): number; + + /** Fetches the line handle for the given line number. */ + getLineHandle(num: number): CodeMirror.LineHandle; + + /** Given a line handle, returns the current position of that line (or null when it is no longer in the document). */ + getLineNumber(handle: CodeMirror.LineHandle): number; + + /** Iterate over the whole document, and call f for each line, passing the line handle. + This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. + Note that line handles have a text property containing the line's content (as a string). */ + eachLine(f: (line: CodeMirror.LineHandle) => void ): void; + + /** Iterate over the range from start up to (not including) end, and call f for each line, passing the line handle. + This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. + Note that line handles have a text property containing the line's content (as a string). */ + eachLine(start: number, end: number, f: (line: CodeMirror.LineHandle) => void ): void; + + /** Set the editor content as 'clean', a flag that it will retain until it is edited, and which will be set again when such an edit is undone again. + Useful to track whether the content needs to be saved. */ + markClean(): void; + + /** Returns whether the document is currently clean (not modified since initialization or the last call to markClean). */ + isClean(): boolean; + + + + /** Get the currently selected code. */ + getSelection(): string; + + /** Replace the selection with the given string. By default, the new selection will span the inserted text. + The optional collapse argument can be used to change this � passing "start" or "end" will collapse the selection to the start or end of the inserted text. */ + replaceSelection(replacement: string, collapse?: string): void; + + /** start is a an optional string indicating which end of the selection to return. + It may be "start" , "end" , "head"(the side of the selection that moves when you press shift + arrow), + or "anchor"(the fixed side of the selection).Omitting the argument is the same as passing "head".A { line , ch } object will be returned. */ + getCursor(start?: string): CodeMirror.Position; + + /** Retrieves a list of all current selections. These will always be sorted, and never overlap (overlapping selections are merged). + Each object in the array contains anchor and head properties referring to {line, ch} objects. */ + listSelections(): { anchor: CodeMirror.Position; head: CodeMirror.Position }[]; + + /** Return true if any text is selected. */ + somethingSelected(): boolean; + + /** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */ + setCursor(pos: CodeMirror.Position): void; + + /** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */ + setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void; + + /** Similar to setSelection , but will, if shift is held or the extending flag is set, + move the head of the selection while leaving the anchor at its current place. + pos2 is optional , and can be passed to ensure a region (for example a word or paragraph) will end up selected + (in addition to whatever lies between that region and the current anchor). */ + extendSelection(from: CodeMirror.Position, to?: CodeMirror.Position): void; + + /** Sets or clears the 'extending' flag , which acts similar to the shift key, + in that it will cause cursor movement and calls to extendSelection to leave the selection anchor in place. */ + setExtending(value: boolean): void; + + + /** Retrieve the editor associated with a document. May return null. */ + getEditor(): CodeMirror.Editor; + + + /** Create an identical copy of the given doc. When copyHistory is true , the history will also be copied.Can not be called directly on an editor. */ + copy(copyHistory: boolean): CodeMirror.Doc; + + /** Create a new document that's linked to the target document. Linked documents will stay in sync (changes to one are also applied to the other) until unlinked. */ + linkedDoc(options: { + /** When turned on, the linked copy will share an undo history with the original. + Thus, something done in one of the two can be undone in the other, and vice versa. */ + sharedHist?: boolean; + from?: number; + /** Can be given to make the new document a subview of the original. Subviews only show a given range of lines. + Note that line coordinates inside the subview will be consistent with those of the parent, + so that for example a subview starting at line 10 will refer to its first line as line 10, not 0. */ + to?: number; + /** By default, the new document inherits the mode of the parent. This option can be set to a mode spec to give it a different mode. */ + mode: any; + }): CodeMirror.Doc; + + /** Break the link between two documents. After calling this , changes will no longer propagate between the documents, + and, if they had a shared history, the history will become separate. */ + unlinkDoc(doc: CodeMirror.Doc): void; + + /** Will call the given function for all documents linked to the target document. It will be passed two arguments, + the linked document and a boolean indicating whether that document shares history with the target. */ + iterLinkedDocs(fn: (doc: CodeMirror.Doc, sharedHist: boolean) => void ): void; + + /** Undo one edit (if any undo events are stored). */ + undo(): void; + + /** Redo one undone edit. */ + redo(): void; + + /** Returns an object with {undo, redo } properties , both of which hold integers , indicating the amount of stored undo and redo operations. */ + historySize(): { undo: number; redo: number; }; + + /** Clears the editor's undo history. */ + clearHistory(): void; + + /** Get a(JSON - serializeable) representation of the undo history. */ + getHistory(): any; + + /** Replace the editor's undo history with the one provided, which must be a value as returned by getHistory. + Note that this will have entirely undefined results if the editor content isn't also the same as it was when getHistory was called. */ + setHistory(history: any): void; + + + /** Can be used to mark a range of text with a specific CSS class name. from and to should be { line , ch } objects. */ + markText(from: CodeMirror.Position, to: CodeMirror.Position, options?: CodeMirror.TextMarkerOptions): TextMarker; + + /** Inserts a bookmark, a handle that follows the text around it as it is being edited, at the given position. + A bookmark has two methods find() and clear(). The first returns the current position of the bookmark, if it is still in the document, + and the second explicitly removes the bookmark. */ + setBookmark(pos: CodeMirror.Position, options?: { + /** Can be used to display a DOM node at the current location of the bookmark (analogous to the replacedWith option to markText). */ + widget?: HTMLElement; + + /** By default, text typed when the cursor is on top of the bookmark will end up to the right of the bookmark. + Set this option to true to make it go to the left instead. */ + insertLeft?: boolean; + }): CodeMirror.TextMarker; + + /** Returns an array of all the bookmarks and marked ranges found between the given positions. */ + findMarks(from: CodeMirror.Position, to: CodeMirror.Position): TextMarker[]; + + /** Returns an array of all the bookmarks and marked ranges present at the given position. */ + findMarksAt(pos: CodeMirror.Position): TextMarker[]; + + /** Returns an array containing all marked ranges in the document. */ + getAllMarks(): CodeMirror.TextMarker[]; + + + /** Gets the mode object for the editor. Note that this is distinct from getOption("mode"), which gives you the mode specification, + rather than the resolved, instantiated mode object. */ + getMode(): any; + + /** Calculates and returns a { line , ch } object for a zero-based index whose value is relative to the start of the editor's text. + If the index is out of range of the text then the returned object is clipped to start or end of the text respectively. */ + posFromIndex(index: number): CodeMirror.Position; + + /** The reverse of posFromIndex. */ + indexFromPos(object: CodeMirror.Position): number; + + /** Expose the state object, so that the Doc.state.completionActive property is reachable*/ + state: any; + } + + interface LineHandle { + text: string; + } + + interface TextMarker { + /** Remove the mark. */ + clear(): void; + + /** 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.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; + } + + interface LineWidget { + /** Removes the widget. */ + clear(): void; + + /** Call this if you made some change to the widget's DOM node that might affect its height. + It'll force CodeMirror to update the height of the line that contains the widget. */ + changed(): void; + } + + interface EditorChange { + /** Position (in the pre-change coordinate system) where the change started. */ + from: CodeMirror.Position; + /** Position (in the pre-change coordinate system) where the change ended. */ + to: CodeMirror.Position; + /** Array of strings representing the text that replaced the changed range (split by line). */ + text: string[]; + /** Text that used to be between from and to, which is overwritten by this change. */ + removed: string[]; + /** String representing the origin of the change event and wether it can be merged with history */ + origin: string; + } + + interface EditorChangeLinkedList extends CodeMirror.EditorChange { + /** Points to another change object (which may point to another, etc). */ + next?: CodeMirror.EditorChangeLinkedList; + } + + interface EditorChangeCancellable extends CodeMirror.EditorChange { + /** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. */ + update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string): void; + + cancel(): void; + } + + interface PositionConstructor { + 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; + } + + interface EditorConfiguration { + /** string| The starting value of the editor. Can be a string, or a document object. */ + value?: any; + + /** string|object. The mode to use. When not given, this will default to the first mode that was loaded. + It may be a string, which either simply names the mode or is a MIME type associated with the mode. + Alternatively, it may be an object containing configuration options for the mode, + with a name property that names the mode (for example {name: "javascript", json: true}). */ + mode?: any; + + /** The theme to style the editor with. You must make sure the CSS file defining the corresponding .cm-s-[name] styles is loaded. + The default is "default". */ + theme?: string; + + /** How many spaces a block (whatever that means in the edited language) should be indented. The default is 2. */ + indentUnit?: number; + + /** Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to true. */ + smartIndent?: boolean; + + /** The width of a tab character. Defaults to 4. */ + tabSize?: number; + + /** Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. Default is false. */ + indentWithTabs?: boolean; + + /** Configures whether the editor should re-indent the current line when a character is typed + that might change its proper indentation (only works if the mode supports indentation). Default is true. */ + electricChars?: boolean; + + /** Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text + is visual (pressing the left arrow moves the cursor left) + or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text). + The default is false on Windows, and true on other platforms. */ + rtlMoveVisually?: boolean; + + /** Configures the keymap to use. The default is "default", which is the only keymap defined in codemirror.js itself. + Extra keymaps are found in the keymap directory. See the section on keymaps for more information. */ + keyMap?: string; + + /** Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value. */ + extraKeys?: any; + + /** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */ + lineWrapping?: boolean; + + /** Whether to show line numbers to the left of the editor. */ + lineNumbers?: boolean; + + /** At which number to start counting lines. Default is 1. */ + firstLineNumber?: number; + + /** A function used to format line numbers. The function is passed the line number, and should return a string that will be shown in the gutter. */ + lineNumberFormatter?: (line: number) => string; + + /** Can be used to add extra gutters (beyond or instead of the line number gutter). + Should be an array of CSS class names, each of which defines a width (and optionally a background), + and which will be used to draw the background of the gutters. + May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter + (it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker. */ + gutters?: string[]; + + /** Determines whether the gutter scrolls along with the content horizontally (false) + or whether it stays fixed during horizontal scrolling (true, the default). */ + fixedGutter?: boolean; + + /** boolean|string. This disables editing of the editor content by the user. If the special value "nocursor" is given (instead of simply true), focusing of the editor is also disallowed. */ + readOnly?: any; + + /**Whether the cursor should be drawn when a selection is active. Defaults to false. */ + showCursorWhenSelecting?: boolean; + + /** The maximum number of undo levels that the editor stores. Defaults to 40. */ + undoDepth?: number; + + /** The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500. */ + historyEventDelay?: number; + + /** The tab index to assign to the editor. If not given, no tab index will be assigned. */ + tabindex?: number; + + /** Can be used to make CodeMirror focus itself on initialization. Defaults to off. + When fromTextArea is used, and no explicit value is given for this option, it will be set to true when either the source textarea is focused, + or it has an autofocus attribute and no other element is focused. */ + autofocus?: boolean; + + /** Controls whether drag-and - drop is enabled. On by default. */ + dragDrop?: boolean; + + /** When given , this will be called when the editor is handling a dragenter , dragover , or drop event. + It will be passed the editor instance and the event object as arguments. + The callback can choose to handle the event itself , in which case it should return true to indicate that CodeMirror should not do anything further. */ + onDragEvent?: (instance: CodeMirror.Editor, event: Event) => boolean; + + /** This provides a rather low - level hook into CodeMirror's key handling. + If provided, this function will be called on every keydown, keyup, and keypress event that CodeMirror captures. + It will be passed two arguments, the editor instance and the key event. + This key event is pretty much the raw key event, except that a stop() method is always added to it. + You could feed it to, for example, jQuery.Event to further normalize it. + This function can inspect the key event, and handle it if it wants to. + It may return true to tell CodeMirror to ignore the event. + Be wary that, on some browsers, stopping a keydown does not stop the keypress from firing, whereas on others it does. + If you respond to an event, you should probably inspect its type property and only do something when it is keydown + (or keypress for actions that need character data). */ + onKeyEvent?: (instance: CodeMirror.Editor, event: Event) => boolean; + + /** Half - period in milliseconds used for cursor blinking. The default blink rate is 530ms. */ + cursorBlinkRate?: number; + + /** Determines the height of the cursor. Default is 1 , meaning it spans the whole height of the line. + For some fonts (and by some tastes) a smaller height (for example 0.85), + which causes the cursor to not reach all the way to the bottom of the line, looks better */ + cursorHeight?: number; + + /** Highlighting is done by a pseudo background - thread that will work for workTime milliseconds, + and then use timeout to sleep for workDelay milliseconds. + The defaults are 200 and 300, you can change these options to make the highlighting more or less aggressive. */ + workTime?: number; + + /** See workTime. */ + workDelay?: number; + + /** Indicates how quickly CodeMirror should poll its input textarea for changes(when focused). + Most input is captured by events, but some things, like IME input on some browsers, don't generate events that allow CodeMirror to properly detect it. + Thus, it polls. Default is 100 milliseconds. */ + pollInterval?: number + + /** By default, CodeMirror will combine adjacent tokens into a single span if they have the same class. + This will result in a simpler DOM tree, and thus perform better. With some kinds of styling(such as rounded corners), + this will change the way the document looks. You can set this option to false to disable this behavior. */ + flattenSpans?: boolean; + + /** When highlighting long lines, in order to stay responsive, the editor will give up and simply style + the rest of the line as plain text when it reaches a certain position. The default is 10000. + You can set this to Infinity to turn off this behavior. */ + maxHighlightLength?: number; + + /** Specifies the amount of lines that are rendered above and below the part of the document that's currently scrolled into view. + This affects the amount of updates needed when scrolling, and the amount of work that such an update does. + You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered, + and thus the browser's text search works on it. This will have bad effects on performance of big documents. */ + 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. */ + placeholder?: string; + } + + interface TextMarkerOptions { + /** Assigns a CSS class to the marked stretch of text. */ + className?: string; + + /** Determines whether text inserted on the left of the marker will end up inside or outside of it. */ + inclusiveLeft?: boolean; + + /** Like inclusiveLeft , but for the right side. */ + inclusiveRight?: boolean; + + /** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them. + In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed + respectively directly before and directly after the range. */ + atomic?: boolean; + + /** Collapsed ranges do not show up in the display.Setting a range to be collapsed will automatically make it atomic. */ + collapsed?: boolean; + + /** When enabled, will cause the mark to clear itself whenever the cursor enters its range. + This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them. + The "clear" event fired on the range handle can be used to be notified when this happens. */ + clearOnEnter?: boolean; + + /** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */ + clearWhenEmpty?: boolean; + + /** Use a given node to display this range.Implies both collapsed and atomic. + The given DOM node must be an inline element(as opposed to a block element). */ + replacedWith?: HTMLElement; + + /** When replacedWith is given, this determines whether the editor will + * capture mouse and drag events occurring in this widget. Default is + * false—the events will be left alone for the default browser handler, + * or specific handlers on the widget, to capture. */ + handleMouseEvents?: boolean; + + /** A read - only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document. + Note: adding a read - only span currently clears the undo history of the editor, + because existing undo events being partially nullified by read - only spans would corrupt the history (in the current implementation). */ + readOnly?: boolean; + + /** When set to true (default is false), adding this marker will create an event in the undo history that can be individually undone(clearing the marker). */ + addToHistory?: boolean; + + /** Can be used to specify an extra CSS class to be applied to the leftmost span that is part of the marker. */ + startStyle?: string; + + /** Equivalent to startStyle, but for the rightmost span. */ + endStyle?: string; + + /** A string of CSS to be applied to the covered text. For example "color: #fe3". */ + css?: string; + + /** When given, will give the nodes created for this span a HTML title attribute with the given value. */ + title?: string; + + /** When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents. + By default, a marker appears only in its target document. */ + shared?: boolean; + } + + interface StringStream { + lastColumnPos: number; + lastColumnValue: number; + lineStart: number; + + /** + * Current position in the string. + */ + pos: number; + + /** + * Where the stream's position was when it was first passed to the token function. + */ + start: number; + + /** + * The current line's content. + */ + string: string; + + /** + * Number of spaces per tab character. + */ + tabSize: number; + + /** + * Returns true only if the stream is at the end of the line. + */ + eol(): boolean; + + /** + * Returns true only if the stream is at the start of the line. + */ + sol(): boolean; + + /** + * Returns the next character in the stream without advancing it. Will return an null at the end of the line. + */ + peek(): string; + + /** + * Returns the next character in the stream and advances it. Also returns null when no more characters are available. + */ + next(): string; + + /** + * match can be a character, a regular expression, or a function that takes a character and returns a boolean. + * If the next character in the stream 'matches' the given argument, it is consumed and returned. + * Otherwise, undefined is returned. + */ + eat(match: string): string; + eat(match: RegExp): string; + eat(match: (char: string) => boolean): string; + + /** + * Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten. + */ + eatWhile(match: string): boolean; + eatWhile(match: RegExp): boolean; + eatWhile(match: (char: string) => boolean): boolean; + + /** + * Shortcut for eatWhile when matching white-space. + */ + eatSpace(): boolean; + + /** + * Moves the position to the end of the line. + */ + skipToEnd(): void; + + /** + * Skips to the next occurrence of the given character, if found on the current line (doesn't advance the stream if + * the character does not occur on the line). + * + * Returns true if the character was found. + */ + skipTo(ch: string): boolean; + + /** + * Act like a multi-character eat - if consume is true or not given - or a look-ahead that doesn't update the stream + * position - if it is false. pattern can be either a string or a regular expression starting with ^. When it is a + * string, caseFold can be set to true to make the match case-insensitive. When successfully matching a regular + * expression, the returned value will be the array returned by match, in case you need to extract matched groups. + */ + match(pattern: string, consume?: boolean, caseFold?: boolean): boolean; + match(pattern: RegExp, consume?: boolean): string[]; + + /** + * Backs up the stream n characters. Backing it up further than the start of the current token will cause things to + * break, so be careful. + */ + backUp(n: number): void; + + /** + * Returns the column (taking into account tabs) at which the current token starts. + */ + column(): number; + + /** + * Tells you how far the current line has been indented, in spaces. Corrects for tab characters. + */ + indentation(): number; + + /** + * Get the string between the start of the current token and the current stream position. + */ + current(): string; + } + + /** + * A Mode is, in the simplest case, a lexer (tokenizer) for your language — a function that takes a character stream as input, + * advances it past a token, and returns a style for that token. More advanced modes can also handle indentation for the language. + */ + interface Mode { + /** + * This function should read one token from the stream it is given as an argument, optionally update its state, + * and return a style string, or null for tokens that do not have to be styled. Multiple styles can be returned, separated by spaces. + */ + token(stream: StringStream, state: T): string; + + /** + * A function that produces a state object to be used at the start of a document. + */ + startState?: () => T; + /** + * For languages that have significant blank lines, you can define a blankLine(state) method on your mode that will get called + * whenever a blank line is passed over, so that it can update the parser state. + */ + blankLine?: (state: T) => void; + /** + * Given a state returns a safe copy of that state. + */ + copyState?: (state: T) => T; + + /** + * The indentation method should inspect the given state object, and optionally the textAfter string, which contains the text on + * the line that is being indented, and return an integer, the amount of spaces to indent. + */ + indent?: (state: T, textAfter: string) => number; + + /** The four below strings are used for working with the commenting addon. */ + /** + * String that starts a line comment. + */ + lineComment?: string; + /** + * String that starts a block comment. + */ + blockCommentStart?: string; + /** + * String that ends a block comment. + */ + blockCommentEnd?: string; + /** + * String to put at the start of continued lines in a block comment. + */ + blockCommentLead?: string; + + /** + * Trigger a reindent whenever one of the characters in the string is typed. + */ + electricChars?: string + /** + * Trigger a reindent whenever the regex matches the part of the line before the cursor. + */ + electricinput?: RegExp + } + + /** + * A function that, given a CodeMirror configuration object and an optional mode configuration object, returns a mode object. + */ + interface ModeFactory { + (config: CodeMirror.EditorConfiguration, modeOptions?: any): Mode + } + + /** + * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function + * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. + */ + function defineMode(id: string, modefactory: ModeFactory): void; + + /** + * The first argument is a configuration object as passed to the mode constructor function, and the second argument + * is a mode specification as in the EditorConfiguration mode option. + */ + function getMode(config: CodeMirror.EditorConfiguration, mode: any): Mode; + + /** + * Utility function from the overlay.js addon that allows modes to be combined. The mode given as the base argument takes care of + * most of the normal mode functionality, but a second (typically simple) mode is used, which can override the style of text. + * Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless + * the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined. + */ + function overlayMode(base: Mode, overlay: Mode, combine?: boolean): Mode + + /** + * async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror + * gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on + * initialization of the CodeMirror instance. + */ + interface LintStateOptions { + async: boolean; + hasGutters: boolean; + } + + /** + * Adds the getAnnotations callback to LintStateOptions which may be overridden by the user if they choose use their own + * linter. + */ + interface LintOptions extends LintStateOptions { + getAnnotations: AnnotationsCallback; + } + + /** + * A function that calls the updateLintingCallback with any errors found during the linting process. + */ + interface AnnotationsCallback { + (content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void; + } + + /** + * A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations + */ + interface UpdateLintingCallback { + (codeMirror: Editor, annotations: Annotation[]): void; + } + + /** + * An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error, + * and an explaination as to why the error was thrown. + */ + interface Annotation { + from: Position; + message?: string; + severity?: string; + to?: Position; + } +} + +declare module "codemirror" { + export = CodeMirror; +} diff --git a/content-type/content-type-tests.ts b/content-type/content-type-tests.ts index 4bf63e2ab..872b3cded 100644 --- a/content-type/content-type-tests.ts +++ b/content-type/content-type-tests.ts @@ -1,47 +1,47 @@ -/// - -import MediaType = require('content-type'); - -// https://github.com/deoxxa/content-type/blob/master/README.md -function new_test(): void { - var p = new MediaType('text/html;level=1;q=0.5'); - p.q === 0.5; - p.params.level === "1"; - - var q = new MediaType('application/json', { profile: 'http://example.com/schema.json' }); - q.type === "application/json"; - q.params.profile === "http://example.com/schema.json"; - - q.q = 1; - q.toString() === 'application/json;q=1;profile="http://example.com/schema.json"'; -} - -function mediaCmp_test(): void { - MediaType.mediaCmp(MediaType.parseMedia('text/html'), MediaType.parseMedia('text/html')) === 0; - MediaType.mediaCmp(MediaType.parseMedia('*/*'), MediaType.parseMedia('text/html')) === 1; - MediaType.mediaCmp(MediaType.parseMedia('text/html;level=1'), MediaType.parseMedia('text/html')) === -1; - MediaType.mediaCmp(MediaType.parseMedia('application/json;profile="v1.json"'), MediaType.parseMedia('application/json;profile="v2.json"')) === null; -} - -// https://github.com/deoxxa/content-type/blob/master/example.js -function example(): void { - var representations = [ - 'application/json', - 'text/html', - 'application/json;profile="schema.json"', - 'application/json;profile="different.json"', - ]; - - var accept = [ - 'text/html;q=0.50', - '*/*;q=0.01', - 'application/json;profile=different.json', - 'application/json;profile="a,b;c.json?d=1;f=2";q=0.2', - ]; - - console.log('Formats:\n\t' + representations.map(MediaType.parseMedia).join('\n\t')); - - console.log('Accept:\n\t' + accept.map(MediaType.parseMedia).join('\n\t')); - - console.log('Selected:', (MediaType.select(representations.map(MediaType.parseMedia), accept.map(MediaType.parseMedia)) || 'None').toString()); +/// + +import MediaType = require('content-type'); + +// https://github.com/deoxxa/content-type/blob/master/README.md +function new_test(): void { + var p = new MediaType('text/html;level=1;q=0.5'); + p.q === 0.5; + p.params.level === "1"; + + var q = new MediaType('application/json', { profile: 'http://example.com/schema.json' }); + q.type === "application/json"; + q.params.profile === "http://example.com/schema.json"; + + q.q = 1; + q.toString() === 'application/json;q=1;profile="http://example.com/schema.json"'; +} + +function mediaCmp_test(): void { + MediaType.mediaCmp(MediaType.parseMedia('text/html'), MediaType.parseMedia('text/html')) === 0; + MediaType.mediaCmp(MediaType.parseMedia('*/*'), MediaType.parseMedia('text/html')) === 1; + MediaType.mediaCmp(MediaType.parseMedia('text/html;level=1'), MediaType.parseMedia('text/html')) === -1; + MediaType.mediaCmp(MediaType.parseMedia('application/json;profile="v1.json"'), MediaType.parseMedia('application/json;profile="v2.json"')) === null; +} + +// https://github.com/deoxxa/content-type/blob/master/example.js +function example(): void { + var representations = [ + 'application/json', + 'text/html', + 'application/json;profile="schema.json"', + 'application/json;profile="different.json"', + ]; + + var accept = [ + 'text/html;q=0.50', + '*/*;q=0.01', + 'application/json;profile=different.json', + 'application/json;profile="a,b;c.json?d=1;f=2";q=0.2', + ]; + + console.log('Formats:\n\t' + representations.map(MediaType.parseMedia).join('\n\t')); + + console.log('Accept:\n\t' + accept.map(MediaType.parseMedia).join('\n\t')); + + console.log('Selected:', (MediaType.select(representations.map(MediaType.parseMedia), accept.map(MediaType.parseMedia)) || 'None').toString()); } \ No newline at end of file diff --git a/content-type/content-type.d.ts b/content-type/content-type.d.ts index fbca9c96b..71b8152da 100644 --- a/content-type/content-type.d.ts +++ b/content-type/content-type.d.ts @@ -1,32 +1,32 @@ -// Type definitions for content-type v0.0.1 -// Project: https://github.com/deoxxa/content-type -// Definitions by: Pine Mizune -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module ContentType { - interface MediaType { - type: string; - q?: number; - params: any; - toString(): string; - } - - interface SelectOptions { - sortAvailable?: boolean; - sortAccepted?: boolean; - } - - interface MediaTypeStatic { - new (s: string, p?: any): MediaType; - parseMedia(type: string): MediaType; - splitQuotedString(str: string, delimiter?: string, quote?: string): string[]; - splitContentTypes(str: string): string[]; - select(availableTypes: MediaType[], acceptedTypes: MediaType[], options?: SelectOptions): string; - mediaCmp(a: MediaType, b: MediaType): number; - } -} - -declare module "content-type" { - var x: ContentType.MediaTypeStatic; - export = x; +// Type definitions for content-type v0.0.1 +// Project: https://github.com/deoxxa/content-type +// Definitions by: Pine Mizune +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module ContentType { + interface MediaType { + type: string; + q?: number; + params: any; + toString(): string; + } + + interface SelectOptions { + sortAvailable?: boolean; + sortAccepted?: boolean; + } + + interface MediaTypeStatic { + new (s: string, p?: any): MediaType; + parseMedia(type: string): MediaType; + splitQuotedString(str: string, delimiter?: string, quote?: string): string[]; + splitContentTypes(str: string): string[]; + select(availableTypes: MediaType[], acceptedTypes: MediaType[], options?: SelectOptions): string; + mediaCmp(a: MediaType, b: MediaType): number; + } +} + +declare module "content-type" { + var x: ContentType.MediaTypeStatic; + export = x; } \ No newline at end of file diff --git a/convert-source-map/convert-source-map-tests.ts b/convert-source-map/convert-source-map-tests.ts index 1701e0065..b53e1bd2c 100644 --- a/convert-source-map/convert-source-map-tests.ts +++ b/convert-source-map/convert-source-map-tests.ts @@ -1,15 +1,15 @@ -/// - -import convert = require("convert-source-map"); - -var json = convert - .fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') - .toJSON(); - -var modified = convert - .fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') - .setProperty('sources', ['CONSOLE.LOG("HI");']) - .toJSON(); - -console.log(json); -console.log(modified); +/// + +import convert = require("convert-source-map"); + +var json = convert + .fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') + .toJSON(); + +var modified = convert + .fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=') + .setProperty('sources', ['CONSOLE.LOG("HI");']) + .toJSON(); + +console.log(json); +console.log(modified); diff --git a/convert-source-map/convert-source-map.d.ts b/convert-source-map/convert-source-map.d.ts index 34a0b2c8e..b53dfd69e 100644 --- a/convert-source-map/convert-source-map.d.ts +++ b/convert-source-map/convert-source-map.d.ts @@ -1,27 +1,27 @@ -// Type definitions for convert-source-map -// Project: https://github.com/thlorenz/convert-source-map -// Definitions by: Andrew Gaspar -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module "convert-source-map" { - export interface SourceMapConverter { - toObject(): any; - toJSON(space?: any): string; - toBase64(): string; - toComment(): string; - - addProperty(key: string, value: any): SourceMapConverter; - setProperty(key: string, value: any): SourceMapConverter; - - getProperty(key: string): any; - } - - export function removeComments(src: string): string; - export var commentRegex: RegExp; - - export function fromObject(obj: any): SourceMapConverter; - export function fromJSON(json: string): SourceMapConverter; - export function fromBase64(base64: string): SourceMapConverter; - export function fromComment(comment: string): SourceMapConverter; - export function fromSource(source: string): SourceMapConverter; -} +// Type definitions for convert-source-map +// Project: https://github.com/thlorenz/convert-source-map +// Definitions by: Andrew Gaspar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "convert-source-map" { + export interface SourceMapConverter { + toObject(): any; + toJSON(space?: any): string; + toBase64(): string; + toComment(): string; + + addProperty(key: string, value: any): SourceMapConverter; + setProperty(key: string, value: any): SourceMapConverter; + + getProperty(key: string): any; + } + + export function removeComments(src: string): string; + export var commentRegex: RegExp; + + export function fromObject(obj: any): SourceMapConverter; + export function fromJSON(json: string): SourceMapConverter; + export function fromBase64(base64: string): SourceMapConverter; + export function fromComment(comment: string): SourceMapConverter; + export function fromSource(source: string): SourceMapConverter; +} diff --git a/cookie/cookie-tests.ts b/cookie/cookie-tests.ts index fccb4b0d3..f8b585048 100644 --- a/cookie/cookie-tests.ts +++ b/cookie/cookie-tests.ts @@ -1,33 +1,33 @@ -/// - -import cookie = require('cookie'); - -function test_serialize(): void { - var retVal: string; - - retVal = cookie.serialize('foo', 'bar'); - retVal = cookie.serialize('foo', 'bar', { httpOnly: true }); -} - -function test_parse(): void { - var retVal: { [key: string]: string }; - - retVal = cookie.parse('foo=bar; bar=baz;'); - retVal = cookie.parse('foo=bar; bar=baz', { decode: x => x }); -} - -function test_options(): void { - var serializeOptions: CookieSerializeOptions = { - encode: (x: string) => x, - path: '/', - expires: new Date(), - maxAge: 200, - domain: 'example.com', - secure: false, - httpOnly: false - }; - - var parseOptios: CookieParseOptions = { - decode: (x: string) => x - }; -} +/// + +import cookie = require('cookie'); + +function test_serialize(): void { + var retVal: string; + + retVal = cookie.serialize('foo', 'bar'); + retVal = cookie.serialize('foo', 'bar', { httpOnly: true }); +} + +function test_parse(): void { + var retVal: { [key: string]: string }; + + retVal = cookie.parse('foo=bar; bar=baz;'); + retVal = cookie.parse('foo=bar; bar=baz', { decode: x => x }); +} + +function test_options(): void { + var serializeOptions: CookieSerializeOptions = { + encode: (x: string) => x, + path: '/', + expires: new Date(), + maxAge: 200, + domain: 'example.com', + secure: false, + httpOnly: false + }; + + var parseOptios: CookieParseOptions = { + decode: (x: string) => x + }; +} diff --git a/cookie/cookie.d.ts b/cookie/cookie.d.ts index a7151fc9f..c6cb17213 100644 --- a/cookie/cookie.d.ts +++ b/cookie/cookie.d.ts @@ -1,28 +1,28 @@ -// Type definitions for cookie v0.1.2 -// Project: https://github.com/jshttp/cookie -// Definitions by: Pine Mizune -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -interface CookieSerializeOptions { - encode?: (val: string) => string; - path?: string; - expires?: Date; - maxAge?: number; - domain?: string; - secure?: boolean; - httpOnly?: boolean; -} - -interface CookieParseOptions { - decode?: (val: string) => string; -} - -interface CookieStatic { - serialize(name: string, val: string, options?: CookieSerializeOptions): string; - parse(str: string, options?: CookieParseOptions): { [key: string]: string }; -} - -declare module "cookie" { - var cookie: CookieStatic; - export = cookie; -} +// Type definitions for cookie v0.1.2 +// Project: https://github.com/jshttp/cookie +// Definitions by: Pine Mizune +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface CookieSerializeOptions { + encode?: (val: string) => string; + path?: string; + expires?: Date; + maxAge?: number; + domain?: string; + secure?: boolean; + httpOnly?: boolean; +} + +interface CookieParseOptions { + decode?: (val: string) => string; +} + +interface CookieStatic { + serialize(name: string, val: string, options?: CookieSerializeOptions): string; + parse(str: string, options?: CookieParseOptions): { [key: string]: string }; +} + +declare module "cookie" { + var cookie: CookieStatic; + export = cookie; +} diff --git a/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts b/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts index 9472ccf35..f071d6cfa 100644 --- a/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts +++ b/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts @@ -1,33 +1,33 @@ -// Type definitions for Apache Cordova Email Composer plugin -// Project: https://github.com/katzer/cordova-plugin-email-composer -// Definitions by: Dave Taylor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/** - * The plugin provides access to the standard interface that manages the - * editing and sending an email message - */ -interface CordovaPluginEmailComposer { - /** Determine if the device is capable to send emails */ - isAvailable(callback:(isAvailable:boolean) => void, scope?:any):void; - /** Open a pre-filled email draft */ - open(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void; - openDraft(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void; -} - -interface ICordovaPluginEmailComposerOpenOptions { - /** An configured email account is required to send emails */ - to?:string[]; - body?:string; - cc?:string[]; - bcc?:string[]; - /** Attachments can be either base64 encoded datas, files from the the device storage or assets from within the www folder */ - attachments?:any[]; - subject?:string; - /** The default value for isHTML is true */ - isHtml?:boolean; -} - -interface CordovaPlugins { - email:CordovaPluginEmailComposer; -} +// Type definitions for Apache Cordova Email Composer plugin +// Project: https://github.com/katzer/cordova-plugin-email-composer +// Definitions by: Dave Taylor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * The plugin provides access to the standard interface that manages the + * editing and sending an email message + */ +interface CordovaPluginEmailComposer { + /** Determine if the device is capable to send emails */ + isAvailable(callback:(isAvailable:boolean) => void, scope?:any):void; + /** Open a pre-filled email draft */ + open(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void; + openDraft(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void; +} + +interface ICordovaPluginEmailComposerOpenOptions { + /** An configured email account is required to send emails */ + to?:string[]; + body?:string; + cc?:string[]; + bcc?:string[]; + /** Attachments can be either base64 encoded datas, files from the the device storage or assets from within the www folder */ + attachments?:any[]; + subject?:string; + /** The default value for isHTML is true */ + isHtml?:boolean; +} + +interface CordovaPlugins { + email:CordovaPluginEmailComposer; +} diff --git a/core-js/core-js-tests.ts b/core-js/core-js-tests.ts index 8a4ec2c0b..bc690d434 100644 --- a/core-js/core-js-tests.ts +++ b/core-js/core-js-tests.ts @@ -1,502 +1,502 @@ -/// - -interface Point { x: number; y: number; } -interface Point3D extends Point { z: number; } - -let a: any; -let s: string; -let i: number; -let b: boolean; -let f: () => void; -let o: Object; -let r: RegExp; -let sym: symbol; -let e: Error; -let date: Date; -let key: PropertyKey; -let point: Point; -let point3d: Point3D; -let arrayOfPoint: Point[]; -let arrayOfPoint3D: Point3D[]; -let arrayOfSymbol: symbol[]; -let arrayOfPropertyKey: PropertyKey[]; -let arrayOfAny: any[]; -let arrayOfStringAny: [string, any][]; -let arrayLikeOfAny: ArrayLike; -let iterableOfPoint: Iterable; -let iterableOfStringPoint: Iterable<[string, Point]>; -let iterableOfPointPoint3D: Iterable<[Point, Point3D]>; -let iterableIteratorOfPoint: IterableIterator; -let iterableIteratorOfNumberPoint: IterableIterator<[number, Point]>; -let iterableIteratorOfNumber: IterableIterator; -let iterableIteratorOfString: IterableIterator; -let iterableIteratorOfPointPoint: IterableIterator<[Point, Point]>; -let iterableIteratorOfNode: IterableIterator; -let iterableIteratorOfStringPoint: IterableIterator<[string, Point]>; -let iterableIteratorOfAny: IterableIterator; -let iterableIteratorOfPropertyKey: IterableIterator; -let iterableIteratorOfPropertyKeyPoint: IterableIterator<[PropertyKey, Point]>; -let nodeList: NodeList; -let pd: PropertyDescriptor; -let pdm: PropertyDescriptorMap; -let map: Map; -let set: Set; -let weakMap: WeakMap; -let weakSet: WeakSet; -let $forOfPoint: $for; -let $forOfPoint3D: $for; -let promiseLikeOfPoint: PromiseLike; -let promiseLikeOfPoint3D: PromiseLike; -let promiseOfPoint: Promise; -let promiseOfPoint3D: Promise; -let promiseOfArrayOfPoint: Promise; -let promiseOfVoid: Promise; -let dictOfPoint: Dict; -let dictOfPoint3D: Dict; -let dictOfAny: Dict; - -// ############################################################################################# -// ECMAScript 6: Object & Function -// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, -// es6.object.to-string, es6.function.name and es6.function.has-instance. -// ############################################################################################# - -point = Object.assign(point, point); -b = Object.is(point, point); -Object.setPrototypeOf(point, point); -s = f.name; -b = f[Symbol.hasInstance](point); - -// ############################################################################################# -// ECMAScript 6: Array -// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find, -// and es6.array.find-index -// ############################################################################################# - -point = arrayOfPoint.find(p => b); -i = arrayOfPoint.findIndex(p => b); -arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length); -arrayOfPoint = arrayOfPoint.copyWithin(i, i, i); -a = arrayOfPoint[Symbol.unscopables]; -arrayOfPoint = Array.from(arrayOfPoint); -arrayOfPoint = Array.from(iterableOfPoint); -arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d); -arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a); -arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d); -arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a); -arrayOfPoint = Array.of(point, point); - -// ############################################################################################# -// ECMAScript 6: String & RegExp -// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, -// es6.string.ends-with, es6.string.includes, es6.string.repeat, -// es6.string.starts-with, and es6.regexp -// ############################################################################################# - -i = s.codePointAt(i); -b = s.includes(s, i); -b = s.endsWith(s, i); -s = s.repeat(i); -b = s.startsWith(s, i); -s = String.fromCodePoint(i, i); -s = String.raw`abc`; -s = r.flags; - -// ############################################################################################# -// ECMAScript 6: Number & Math -// Modules: es6.number.constructor, es6.number.statics, and es6.math -// ############################################################################################# - -i = Number.EPSILON; -b = Number.isFinite(i); -b = Number.isInteger(i); -b = Number.isNaN(i); -b = Number.isSafeInteger(i); -i = Number.MAX_SAFE_INTEGER; -i = Number.MIN_SAFE_INTEGER; -i = Number.parseFloat(s); -i = Number.parseInt(s); -i = Number.parseInt(s, i); -i = Math.clz32(i); -i = Math.imul(i, i); -i = Math.sign(i); -i = Math.log10(i); -i = Math.log2(i); -i = Math.log1p(i); -i = Math.expm1(i); -i = Math.cosh(i); -i = Math.sinh(i); -i = Math.tanh(i); -i = Math.acosh(i); -i = Math.asinh(i); -i = Math.atanh(i); -i = Math.hypot(i, i); -i = Math.trunc(i); -i = Math.fround(i); -i = Math.cbrt(i); - -// ############################################################################################# -// ECMAScript 6: Symbols -// Modules: es6.symbol -// ############################################################################################# - -sym = Symbol(); -sym = Symbol(s); -sym = Symbol.for(s); -s = Symbol.keyFor(sym); -sym = Symbol.hasInstance; -sym = Symbol.isConcatSpreadable; -sym = Symbol.iterator; -sym = Symbol.match; -sym = Symbol.replace; -sym = Symbol.search; -sym = Symbol.species; -sym = Symbol.split; -sym = Symbol.toPrimitive; -sym = Symbol.toStringTag; -sym = Symbol.unscopables; -b = o.hasOwnProperty(sym); -b = o.hasOwnProperty(i); -b = o.propertyIsEnumerable(sym); -b = o.propertyIsEnumerable(i); -arrayOfSymbol = Object.getOwnPropertySymbols(a); -pd = Object.getOwnPropertyDescriptor(a, sym); -pd = Object.getOwnPropertyDescriptor(a, i); -Object.defineProperty(a, sym, pd); -Object.defineProperty(a, i, pd); -s = Math[Symbol.toStringTag]; -s = JSON[Symbol.toStringTag]; - -// Non-standard -Symbol.useSimple(); -Symbol.userSetter(); - -// ############################################################################################# -// ECMAScript 6: Collections -// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set -// ############################################################################################# - -map.clear(); -map.delete(s); -map.forEach((value: Point, key: string) => { }); -point = map.get(s); -b = map.has(s); -map = map.set(s, point); -i = map.size; -map = new Map(); -map = new Map(iterableOfStringPoint); - -set.clear(); -set.delete(point); -set.forEach((value: Point, key: Point) => { }); -b = set.has(point); -set = set.add(point); -i = set.size; -set = new Set(); -set = new Set(iterableOfPoint); - -weakMap.delete(point); -point3d = weakMap.get(point); -b = weakMap.has(point); -weakMap = weakMap.set(point, point3d); -weakMap = new WeakMap(); -weakMap = new WeakMap(iterableOfPointPoint3D); - -weakSet.delete(point); -weakSet = weakSet.add(point); -b = weakSet.has(point); -weakSet = new WeakSet(); -weakSet = new WeakSet(iterableOfPoint); - -// ############################################################################################# -// ECMAScript 6: Iterators -// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable -// ############################################################################################# - -iterableIteratorOfPoint = arrayOfPoint[Symbol.iterator](); -iterableIteratorOfNumberPoint = arrayOfPoint.entries(); -iterableIteratorOfNumber = arrayOfPoint.keys(); -iterableIteratorOfPoint = arrayOfPoint.values(); -iterableIteratorOfStringPoint = map.entries(); -iterableIteratorOfString = map.keys(); -iterableIteratorOfPoint = map.values(); -iterableIteratorOfStringPoint = map[Symbol.iterator](); -iterableIteratorOfPointPoint = set.entries(); -iterableIteratorOfPoint = set.keys(); -iterableIteratorOfPoint = set.values(); -iterableIteratorOfPoint = set[Symbol.iterator](); -iterableIteratorOfNode = nodeList[Symbol.iterator](); - -$for(iterableOfPoint).of((value: Point) => { }); -arrayOfPoint = $for(iterableOfPoint).array(); -arrayOfPoint3D = $for(iterableOfPoint).array(p => point3d); -$forOfPoint = $for(iterableOfPoint).filter(p => b); -$forOfPoint3D = $for(iterableOfPoint).map(p => point3d); - -// ############################################################################################# -// ECMAScript 6: Promises -// Modules: es6.promise -// ############################################################################################# - -promiseLikeOfPoint.then((point: Point) => { }); -promiseLikeOfPoint = promiseLikeOfPoint.then(); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { }); -promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { }); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { }); -promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { }); -promiseOfPoint.then((point: Point) => { }); -promiseOfPoint = promiseOfPoint.then(); -promiseOfPoint = promiseOfPoint.then(p => point); -promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint); -promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint); -promiseOfPoint = promiseOfPoint.then(p => point, e => point); -promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point); -promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point); -promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint); -promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint); -promiseOfPoint = promiseOfPoint.then(p => point, e => { }); -promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { }); -promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { }); -promiseOfPoint3D = promiseOfPoint.then(p => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); -promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { }); -promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { }); -promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { }); -promiseOfPoint = promiseOfPoint.catch(e => point); -promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint); -promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint); -promiseOfPoint = promiseOfPoint.catch(e => { }); -promiseOfPoint3D = promiseOfPoint.catch(e => point3d); -promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D); -promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D); -promiseOfPoint = new Promise((resolve, reject) => resolve(point)); -promiseOfPoint = new Promise((resolve, reject) => resolve(promiseOfPoint)); -promiseOfPoint = new Promise((resolve, reject) => resolve(promiseLikeOfPoint)); -promiseOfPoint = new Promise((resolve, reject) => reject(e)); -promiseOfArrayOfPoint = Promise.all(arrayOfPoint); -promiseOfArrayOfPoint = Promise.all(iterableOfPoint); -promiseOfPoint = Promise.race(arrayOfPoint); -promiseOfPoint = Promise.race(iterableOfPoint); -promiseOfVoid = Promise.resolve(); -promiseOfPoint = Promise.resolve(point3d); -promiseOfPoint = Promise.resolve(promiseOfPoint); -promiseOfPoint = Promise.resolve(promiseLikeOfPoint); -promiseOfVoid = Promise.reject(e); -promiseOfPoint = Promise.reject(e); - -// ############################################################################################# -// ECMAScript 6: Reflect -// Modules: es6.reflect -// ############################################################################################# - -a = Reflect.apply(f, a, arrayLikeOfAny); -a = Reflect.construct(f, arrayLikeOfAny, a); -b = Reflect.defineProperty(a, s, pd); -b = Reflect.defineProperty(a, i, pd); -b = Reflect.defineProperty(a, sym, pd); -b = Reflect.deleteProperty(a, s); -b = Reflect.deleteProperty(a, i); -b = Reflect.deleteProperty(a, sym); -iterableIteratorOfAny = Reflect.enumerate(a); -a = Reflect.get(a, s, a); -a = Reflect.get(a, i, a); -a = Reflect.get(a, sym, a); -pd = Reflect.getOwnPropertyDescriptor(a, s); -pd = Reflect.getOwnPropertyDescriptor(a, i); -pd = Reflect.getOwnPropertyDescriptor(a, sym); -a = Reflect.getPrototypeOf(a); -b = Reflect.has(a, s); -b = Reflect.has(a, i); -b = Reflect.has(a, sym); -b = Reflect.isExtensible(a); -arrayOfPropertyKey = Reflect.ownKeys(a); -b = Reflect.preventExtensions(a); -b = Reflect.set(a, s, a, a); -b = Reflect.set(a, i, a, a); -b = Reflect.set(a, sym, a, a); -b = Reflect.setPrototypeOf(a, a); - -// ############################################################################################# -// ECMAScript 7 -// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, -// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, -// es7.map.to-json, and es7.set.to-json -// ############################################################################################# - -b = arrayOfPoint.includes(point, i); -s = s.at(i); -s = s.lpad(i, s); -s = s.rpad(i, s); -arrayOfAny = Object.values(a); -arrayOfStringAny = Object.entries(a); -pdm = Object.getOwnPropertyDescriptors(a); -s = RegExp.escape(s); -a = map.toJSON(); -a = set.toJSON(); - -// ############################################################################################# -// Mozilla JavaScript: Array generics -// Modules: js.array.statics -// ############################################################################################# - -i = Array.push(arrayOfPoint, point, point); -point = Array.pop(arrayOfPoint); -arrayOfPoint = Array.concat(arrayOfPoint, arrayOfPoint); -s = Array.join(arrayOfPoint, s); -arrayOfPoint = Array.reverse(arrayOfPoint); -point = Array.shift(arrayOfPoint); -arrayOfPoint = Array.slice(arrayOfPoint, i, i); -arrayOfPoint = Array.sort(arrayOfPoint, (a: Point, b: Point) => i); -arrayOfPoint = Array.splice(arrayOfPoint, i); -arrayOfPoint = Array.splice(arrayOfPoint, i, i, point, point); -i = Array.unshift(arrayOfPoint, point, point); -i = Array.indexOf(arrayOfPoint, point, i); -i = Array.lastIndexOf(arrayOfPoint, point, i); -b = Array.every(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a); -b = Array.some(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a); -Array.forEach(arrayOfPoint, (value: Point, index: number, array: Point[]) => { }, a); -arrayOfPoint3D = Array.map(arrayOfPoint, (value: Point, index: number, array: Point[]) => point3d, a); -arrayOfPoint = Array.filter(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a); -point = Array.reduce(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point); -point3d = Array.reduce(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d); -point = Array.reduceRight(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point); -point3d = Array.reduceRight(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d); -iterableIteratorOfNumberPoint = Array.entries(arrayOfPoint); -iterableIteratorOfNumber = Array.keys(arrayOfPoint); -iterableIteratorOfPoint = Array.values(arrayOfPoint); -point = Array.find(arrayOfPoint, p => b); -i = Array.findIndex(arrayOfPoint, p => b); -arrayOfPoint = Array.fill(arrayOfPoint, point, i, arrayOfPoint.length); -arrayOfPoint = Array.copyWithin(arrayOfPoint, i, i, i); -b = Array.includes(arrayOfPoint, point, i); -arrayOfPoint = Array.turn(arrayOfPoint, (memo: Point[], value: Point, index: number, array: Point[]) => arrayOfPoint, arrayOfPoint); -arrayOfPoint3D = Array.turn(arrayOfPoint, (memo: Point3D[], value: Point, index: number, array: Point[]) => arrayOfPoint3D, arrayOfPoint3D); - -// ############################################################################################# -// Object - https://github.com/zloirock/core-js/#object -// Modules: core.object -// ############################################################################################# - -// Non-standard -b = Object.isObject(a); -s = Object.classof(a); -point = Object.define(point, a); -point = Object.make(point, a); - -// ############################################################################################# -// Console - https://github.com/zloirock/core-js/#console -// Modules: core.log -// ############################################################################################# - -// Non-standard -log(a, a, a); -log.log(a, a, a); -log.enable(); -log.disable(); - -// ############################################################################################# -// Dict - https://github.com/zloirock/core-js/#dict -// Modules: core.dict -// ############################################################################################# - -// Non-standard -point = dictOfPoint[s]; -point = dictOfPoint[i]; -point = dictOfPoint[sym]; -dictOfPoint = new Dict(dictOfPoint); -dictOfAny = new Dict(point); -dictOfPoint = Dict(dictOfPoint); -dictOfAny = Dict(point); -b = Dict.isDict(a); -iterableIteratorOfPoint = Dict.values(dictOfPoint); -iterableIteratorOfPropertyKey = Dict.keys(dictOfPoint); -iterableIteratorOfPropertyKeyPoint = Dict.entries(dictOfPoint); -b = Dict.has(dictOfPoint, s); -b = Dict.has(dictOfPoint, i); -b = Dict.has(dictOfPoint, sym); -point = Dict.get(dictOfPoint, s); -point = Dict.get(dictOfPoint, i); -point = Dict.get(dictOfPoint, sym); -dictOfPoint = Dict.set(dictOfPoint, s, point); -dictOfPoint = Dict.set(dictOfPoint, i, point); -dictOfPoint = Dict.set(dictOfPoint, sym, point); -Dict.forEach(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => { }, a); -dictOfPoint3D = Dict.map(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => point3d, a); -dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => [s, point3d], a); -dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => [i, point3d], a); -dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => [sym, point3d], a); -dictOfPoint = Dict.filter(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); -b = Dict.some(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); -b = Dict.every(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); -point = Dict.find(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); -key = Dict.findKey(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); -key = Dict.keyOf(dictOfPoint, point); -b = Dict.includes(dictOfPoint, point); -point = Dict.reduce(dictOfPoint, (prev: Point, value: Point, key: PropertyKey, dict: Dict) => point, point); -point3d = Dict.reduce(dictOfPoint, (prev: Point3D, value: Point, key: PropertyKey, dict: Dict) => point3d, point3d); -dictOfPoint = Dict.turn(dictOfPoint, (memo: Dict, value: Point, key: PropertyKey, dict: Dict) => { }, dictOfPoint); -dictOfPoint3D = Dict.turn(dictOfPoint, (memo: Dict, value: Point, key: PropertyKey, dict: Dict) => { }, dictOfPoint3D); - -// ############################################################################################# -// Partial application - https://github.com/zloirock/core-js/#partial-application -// Modules: core.function.part -// ############################################################################################# - -// Non-standard -a = f.part(a, a); - -// ############################################################################################# -// Date formatting - https://github.com/zloirock/core-js/#date-formatting -// Modules: core.date -// ############################################################################################# - -// Non-standard -s = date.format(s, s); -s = date.formatUTC(s, s); - -// ############################################################################################# -// Array - https://github.com/zloirock/core-js/#array -// Modules: core.array.turn -// ############################################################################################# - -// Non-standard -arrayOfPoint = arrayOfPoint.turn((memo: Point[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint); -arrayOfPoint3D = arrayOfPoint.turn((memo: Point3D[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint3D); - -// ############################################################################################# -// Number - https://github.com/zloirock/core-js/#number -// Modules: core.number.iterator -// ############################################################################################# - -iterableIteratorOfNumber = i[Symbol.iterator](); - -// ############################################################################################# -// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters -// Modules: core.string.escape-html -// ############################################################################################# - -s = s.escapeHTML(); -s = s.unescapeHTML(); - -// ############################################################################################# -// delay - https://github.com/zloirock/core-js/#delay -// Modules: core.delay -// ############################################################################################# - -promiseOfVoid = delay(i); +/// + +interface Point { x: number; y: number; } +interface Point3D extends Point { z: number; } + +let a: any; +let s: string; +let i: number; +let b: boolean; +let f: () => void; +let o: Object; +let r: RegExp; +let sym: symbol; +let e: Error; +let date: Date; +let key: PropertyKey; +let point: Point; +let point3d: Point3D; +let arrayOfPoint: Point[]; +let arrayOfPoint3D: Point3D[]; +let arrayOfSymbol: symbol[]; +let arrayOfPropertyKey: PropertyKey[]; +let arrayOfAny: any[]; +let arrayOfStringAny: [string, any][]; +let arrayLikeOfAny: ArrayLike; +let iterableOfPoint: Iterable; +let iterableOfStringPoint: Iterable<[string, Point]>; +let iterableOfPointPoint3D: Iterable<[Point, Point3D]>; +let iterableIteratorOfPoint: IterableIterator; +let iterableIteratorOfNumberPoint: IterableIterator<[number, Point]>; +let iterableIteratorOfNumber: IterableIterator; +let iterableIteratorOfString: IterableIterator; +let iterableIteratorOfPointPoint: IterableIterator<[Point, Point]>; +let iterableIteratorOfNode: IterableIterator; +let iterableIteratorOfStringPoint: IterableIterator<[string, Point]>; +let iterableIteratorOfAny: IterableIterator; +let iterableIteratorOfPropertyKey: IterableIterator; +let iterableIteratorOfPropertyKeyPoint: IterableIterator<[PropertyKey, Point]>; +let nodeList: NodeList; +let pd: PropertyDescriptor; +let pdm: PropertyDescriptorMap; +let map: Map; +let set: Set; +let weakMap: WeakMap; +let weakSet: WeakSet; +let $forOfPoint: $for; +let $forOfPoint3D: $for; +let promiseLikeOfPoint: PromiseLike; +let promiseLikeOfPoint3D: PromiseLike; +let promiseOfPoint: Promise; +let promiseOfPoint3D: Promise; +let promiseOfArrayOfPoint: Promise; +let promiseOfVoid: Promise; +let dictOfPoint: Dict; +let dictOfPoint3D: Dict; +let dictOfAny: Dict; + +// ############################################################################################# +// ECMAScript 6: Object & Function +// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, +// es6.object.to-string, es6.function.name and es6.function.has-instance. +// ############################################################################################# + +point = Object.assign(point, point); +b = Object.is(point, point); +Object.setPrototypeOf(point, point); +s = f.name; +b = f[Symbol.hasInstance](point); + +// ############################################################################################# +// ECMAScript 6: Array +// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find, +// and es6.array.find-index +// ############################################################################################# + +point = arrayOfPoint.find(p => b); +i = arrayOfPoint.findIndex(p => b); +arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length); +arrayOfPoint = arrayOfPoint.copyWithin(i, i, i); +a = arrayOfPoint[Symbol.unscopables]; +arrayOfPoint = Array.from(arrayOfPoint); +arrayOfPoint = Array.from(iterableOfPoint); +arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d); +arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a); +arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d); +arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a); +arrayOfPoint = Array.of(point, point); + +// ############################################################################################# +// ECMAScript 6: String & RegExp +// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, +// es6.string.ends-with, es6.string.includes, es6.string.repeat, +// es6.string.starts-with, and es6.regexp +// ############################################################################################# + +i = s.codePointAt(i); +b = s.includes(s, i); +b = s.endsWith(s, i); +s = s.repeat(i); +b = s.startsWith(s, i); +s = String.fromCodePoint(i, i); +s = String.raw`abc`; +s = r.flags; + +// ############################################################################################# +// ECMAScript 6: Number & Math +// Modules: es6.number.constructor, es6.number.statics, and es6.math +// ############################################################################################# + +i = Number.EPSILON; +b = Number.isFinite(i); +b = Number.isInteger(i); +b = Number.isNaN(i); +b = Number.isSafeInteger(i); +i = Number.MAX_SAFE_INTEGER; +i = Number.MIN_SAFE_INTEGER; +i = Number.parseFloat(s); +i = Number.parseInt(s); +i = Number.parseInt(s, i); +i = Math.clz32(i); +i = Math.imul(i, i); +i = Math.sign(i); +i = Math.log10(i); +i = Math.log2(i); +i = Math.log1p(i); +i = Math.expm1(i); +i = Math.cosh(i); +i = Math.sinh(i); +i = Math.tanh(i); +i = Math.acosh(i); +i = Math.asinh(i); +i = Math.atanh(i); +i = Math.hypot(i, i); +i = Math.trunc(i); +i = Math.fround(i); +i = Math.cbrt(i); + +// ############################################################################################# +// ECMAScript 6: Symbols +// Modules: es6.symbol +// ############################################################################################# + +sym = Symbol(); +sym = Symbol(s); +sym = Symbol.for(s); +s = Symbol.keyFor(sym); +sym = Symbol.hasInstance; +sym = Symbol.isConcatSpreadable; +sym = Symbol.iterator; +sym = Symbol.match; +sym = Symbol.replace; +sym = Symbol.search; +sym = Symbol.species; +sym = Symbol.split; +sym = Symbol.toPrimitive; +sym = Symbol.toStringTag; +sym = Symbol.unscopables; +b = o.hasOwnProperty(sym); +b = o.hasOwnProperty(i); +b = o.propertyIsEnumerable(sym); +b = o.propertyIsEnumerable(i); +arrayOfSymbol = Object.getOwnPropertySymbols(a); +pd = Object.getOwnPropertyDescriptor(a, sym); +pd = Object.getOwnPropertyDescriptor(a, i); +Object.defineProperty(a, sym, pd); +Object.defineProperty(a, i, pd); +s = Math[Symbol.toStringTag]; +s = JSON[Symbol.toStringTag]; + +// Non-standard +Symbol.useSimple(); +Symbol.userSetter(); + +// ############################################################################################# +// ECMAScript 6: Collections +// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set +// ############################################################################################# + +map.clear(); +map.delete(s); +map.forEach((value: Point, key: string) => { }); +point = map.get(s); +b = map.has(s); +map = map.set(s, point); +i = map.size; +map = new Map(); +map = new Map(iterableOfStringPoint); + +set.clear(); +set.delete(point); +set.forEach((value: Point, key: Point) => { }); +b = set.has(point); +set = set.add(point); +i = set.size; +set = new Set(); +set = new Set(iterableOfPoint); + +weakMap.delete(point); +point3d = weakMap.get(point); +b = weakMap.has(point); +weakMap = weakMap.set(point, point3d); +weakMap = new WeakMap(); +weakMap = new WeakMap(iterableOfPointPoint3D); + +weakSet.delete(point); +weakSet = weakSet.add(point); +b = weakSet.has(point); +weakSet = new WeakSet(); +weakSet = new WeakSet(iterableOfPoint); + +// ############################################################################################# +// ECMAScript 6: Iterators +// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable +// ############################################################################################# + +iterableIteratorOfPoint = arrayOfPoint[Symbol.iterator](); +iterableIteratorOfNumberPoint = arrayOfPoint.entries(); +iterableIteratorOfNumber = arrayOfPoint.keys(); +iterableIteratorOfPoint = arrayOfPoint.values(); +iterableIteratorOfStringPoint = map.entries(); +iterableIteratorOfString = map.keys(); +iterableIteratorOfPoint = map.values(); +iterableIteratorOfStringPoint = map[Symbol.iterator](); +iterableIteratorOfPointPoint = set.entries(); +iterableIteratorOfPoint = set.keys(); +iterableIteratorOfPoint = set.values(); +iterableIteratorOfPoint = set[Symbol.iterator](); +iterableIteratorOfNode = nodeList[Symbol.iterator](); + +$for(iterableOfPoint).of((value: Point) => { }); +arrayOfPoint = $for(iterableOfPoint).array(); +arrayOfPoint3D = $for(iterableOfPoint).array(p => point3d); +$forOfPoint = $for(iterableOfPoint).filter(p => b); +$forOfPoint3D = $for(iterableOfPoint).map(p => point3d); + +// ############################################################################################# +// ECMAScript 6: Promises +// Modules: es6.promise +// ############################################################################################# + +promiseLikeOfPoint.then((point: Point) => { }); +promiseLikeOfPoint = promiseLikeOfPoint.then(); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { }); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { }); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { }); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { }); +promiseOfPoint.then((point: Point) => { }); +promiseOfPoint = promiseOfPoint.then(); +promiseOfPoint = promiseOfPoint.then(p => point); +promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint); +promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint); +promiseOfPoint = promiseOfPoint.then(p => point, e => point); +promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point); +promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point); +promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint); +promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint); +promiseOfPoint = promiseOfPoint.then(p => point, e => { }); +promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { }); +promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { }); +promiseOfPoint3D = promiseOfPoint.then(p => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { }); +promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { }); +promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { }); +promiseOfPoint = promiseOfPoint.catch(e => point); +promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint); +promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint); +promiseOfPoint = promiseOfPoint.catch(e => { }); +promiseOfPoint3D = promiseOfPoint.catch(e => point3d); +promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D); +promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D); +promiseOfPoint = new Promise((resolve, reject) => resolve(point)); +promiseOfPoint = new Promise((resolve, reject) => resolve(promiseOfPoint)); +promiseOfPoint = new Promise((resolve, reject) => resolve(promiseLikeOfPoint)); +promiseOfPoint = new Promise((resolve, reject) => reject(e)); +promiseOfArrayOfPoint = Promise.all(arrayOfPoint); +promiseOfArrayOfPoint = Promise.all(iterableOfPoint); +promiseOfPoint = Promise.race(arrayOfPoint); +promiseOfPoint = Promise.race(iterableOfPoint); +promiseOfVoid = Promise.resolve(); +promiseOfPoint = Promise.resolve(point3d); +promiseOfPoint = Promise.resolve(promiseOfPoint); +promiseOfPoint = Promise.resolve(promiseLikeOfPoint); +promiseOfVoid = Promise.reject(e); +promiseOfPoint = Promise.reject(e); + +// ############################################################################################# +// ECMAScript 6: Reflect +// Modules: es6.reflect +// ############################################################################################# + +a = Reflect.apply(f, a, arrayLikeOfAny); +a = Reflect.construct(f, arrayLikeOfAny, a); +b = Reflect.defineProperty(a, s, pd); +b = Reflect.defineProperty(a, i, pd); +b = Reflect.defineProperty(a, sym, pd); +b = Reflect.deleteProperty(a, s); +b = Reflect.deleteProperty(a, i); +b = Reflect.deleteProperty(a, sym); +iterableIteratorOfAny = Reflect.enumerate(a); +a = Reflect.get(a, s, a); +a = Reflect.get(a, i, a); +a = Reflect.get(a, sym, a); +pd = Reflect.getOwnPropertyDescriptor(a, s); +pd = Reflect.getOwnPropertyDescriptor(a, i); +pd = Reflect.getOwnPropertyDescriptor(a, sym); +a = Reflect.getPrototypeOf(a); +b = Reflect.has(a, s); +b = Reflect.has(a, i); +b = Reflect.has(a, sym); +b = Reflect.isExtensible(a); +arrayOfPropertyKey = Reflect.ownKeys(a); +b = Reflect.preventExtensions(a); +b = Reflect.set(a, s, a, a); +b = Reflect.set(a, i, a, a); +b = Reflect.set(a, sym, a, a); +b = Reflect.setPrototypeOf(a, a); + +// ############################################################################################# +// ECMAScript 7 +// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, +// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, +// es7.map.to-json, and es7.set.to-json +// ############################################################################################# + +b = arrayOfPoint.includes(point, i); +s = s.at(i); +s = s.lpad(i, s); +s = s.rpad(i, s); +arrayOfAny = Object.values(a); +arrayOfStringAny = Object.entries(a); +pdm = Object.getOwnPropertyDescriptors(a); +s = RegExp.escape(s); +a = map.toJSON(); +a = set.toJSON(); + +// ############################################################################################# +// Mozilla JavaScript: Array generics +// Modules: js.array.statics +// ############################################################################################# + +i = Array.push(arrayOfPoint, point, point); +point = Array.pop(arrayOfPoint); +arrayOfPoint = Array.concat(arrayOfPoint, arrayOfPoint); +s = Array.join(arrayOfPoint, s); +arrayOfPoint = Array.reverse(arrayOfPoint); +point = Array.shift(arrayOfPoint); +arrayOfPoint = Array.slice(arrayOfPoint, i, i); +arrayOfPoint = Array.sort(arrayOfPoint, (a: Point, b: Point) => i); +arrayOfPoint = Array.splice(arrayOfPoint, i); +arrayOfPoint = Array.splice(arrayOfPoint, i, i, point, point); +i = Array.unshift(arrayOfPoint, point, point); +i = Array.indexOf(arrayOfPoint, point, i); +i = Array.lastIndexOf(arrayOfPoint, point, i); +b = Array.every(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a); +b = Array.some(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a); +Array.forEach(arrayOfPoint, (value: Point, index: number, array: Point[]) => { }, a); +arrayOfPoint3D = Array.map(arrayOfPoint, (value: Point, index: number, array: Point[]) => point3d, a); +arrayOfPoint = Array.filter(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a); +point = Array.reduce(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point); +point3d = Array.reduce(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d); +point = Array.reduceRight(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point); +point3d = Array.reduceRight(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d); +iterableIteratorOfNumberPoint = Array.entries(arrayOfPoint); +iterableIteratorOfNumber = Array.keys(arrayOfPoint); +iterableIteratorOfPoint = Array.values(arrayOfPoint); +point = Array.find(arrayOfPoint, p => b); +i = Array.findIndex(arrayOfPoint, p => b); +arrayOfPoint = Array.fill(arrayOfPoint, point, i, arrayOfPoint.length); +arrayOfPoint = Array.copyWithin(arrayOfPoint, i, i, i); +b = Array.includes(arrayOfPoint, point, i); +arrayOfPoint = Array.turn(arrayOfPoint, (memo: Point[], value: Point, index: number, array: Point[]) => arrayOfPoint, arrayOfPoint); +arrayOfPoint3D = Array.turn(arrayOfPoint, (memo: Point3D[], value: Point, index: number, array: Point[]) => arrayOfPoint3D, arrayOfPoint3D); + +// ############################################################################################# +// Object - https://github.com/zloirock/core-js/#object +// Modules: core.object +// ############################################################################################# + +// Non-standard +b = Object.isObject(a); +s = Object.classof(a); +point = Object.define(point, a); +point = Object.make(point, a); + +// ############################################################################################# +// Console - https://github.com/zloirock/core-js/#console +// Modules: core.log +// ############################################################################################# + +// Non-standard +log(a, a, a); +log.log(a, a, a); +log.enable(); +log.disable(); + +// ############################################################################################# +// Dict - https://github.com/zloirock/core-js/#dict +// Modules: core.dict +// ############################################################################################# + +// Non-standard +point = dictOfPoint[s]; +point = dictOfPoint[i]; +point = dictOfPoint[sym]; +dictOfPoint = new Dict(dictOfPoint); +dictOfAny = new Dict(point); +dictOfPoint = Dict(dictOfPoint); +dictOfAny = Dict(point); +b = Dict.isDict(a); +iterableIteratorOfPoint = Dict.values(dictOfPoint); +iterableIteratorOfPropertyKey = Dict.keys(dictOfPoint); +iterableIteratorOfPropertyKeyPoint = Dict.entries(dictOfPoint); +b = Dict.has(dictOfPoint, s); +b = Dict.has(dictOfPoint, i); +b = Dict.has(dictOfPoint, sym); +point = Dict.get(dictOfPoint, s); +point = Dict.get(dictOfPoint, i); +point = Dict.get(dictOfPoint, sym); +dictOfPoint = Dict.set(dictOfPoint, s, point); +dictOfPoint = Dict.set(dictOfPoint, i, point); +dictOfPoint = Dict.set(dictOfPoint, sym, point); +Dict.forEach(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => { }, a); +dictOfPoint3D = Dict.map(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => point3d, a); +dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => [s, point3d], a); +dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => [i, point3d], a); +dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => [sym, point3d], a); +dictOfPoint = Dict.filter(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); +b = Dict.some(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); +b = Dict.every(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); +point = Dict.find(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); +key = Dict.findKey(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict) => b, a); +key = Dict.keyOf(dictOfPoint, point); +b = Dict.includes(dictOfPoint, point); +point = Dict.reduce(dictOfPoint, (prev: Point, value: Point, key: PropertyKey, dict: Dict) => point, point); +point3d = Dict.reduce(dictOfPoint, (prev: Point3D, value: Point, key: PropertyKey, dict: Dict) => point3d, point3d); +dictOfPoint = Dict.turn(dictOfPoint, (memo: Dict, value: Point, key: PropertyKey, dict: Dict) => { }, dictOfPoint); +dictOfPoint3D = Dict.turn(dictOfPoint, (memo: Dict, value: Point, key: PropertyKey, dict: Dict) => { }, dictOfPoint3D); + +// ############################################################################################# +// Partial application - https://github.com/zloirock/core-js/#partial-application +// Modules: core.function.part +// ############################################################################################# + +// Non-standard +a = f.part(a, a); + +// ############################################################################################# +// Date formatting - https://github.com/zloirock/core-js/#date-formatting +// Modules: core.date +// ############################################################################################# + +// Non-standard +s = date.format(s, s); +s = date.formatUTC(s, s); + +// ############################################################################################# +// Array - https://github.com/zloirock/core-js/#array +// Modules: core.array.turn +// ############################################################################################# + +// Non-standard +arrayOfPoint = arrayOfPoint.turn((memo: Point[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint); +arrayOfPoint3D = arrayOfPoint.turn((memo: Point3D[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint3D); + +// ############################################################################################# +// Number - https://github.com/zloirock/core-js/#number +// Modules: core.number.iterator +// ############################################################################################# + +iterableIteratorOfNumber = i[Symbol.iterator](); + +// ############################################################################################# +// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters +// Modules: core.string.escape-html +// ############################################################################################# + +s = s.escapeHTML(); +s = s.unescapeHTML(); + +// ############################################################################################# +// delay - https://github.com/zloirock/core-js/#delay +// Modules: core.delay +// ############################################################################################# + +promiseOfVoid = delay(i); diff --git a/core-js/core-js.d.ts b/core-js/core-js.d.ts index e976c4361..fa98da248 100644 --- a/core-js/core-js.d.ts +++ b/core-js/core-js.d.ts @@ -1,3032 +1,3032 @@ -// Type definitions for core-js v0.9.7 -// Project: https://github.com/zloirock/core-js/ -// Definitions by: Ron Buckton -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/* ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -declare type PropertyKey = string | number | symbol; - -// ############################################################################################# -// ECMAScript 6: Object & Function -// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, -// es6.object.to-string, es6.function.name and es6.function.has-instance. -// ############################################################################################# - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - * @remarks Requires `__proto__` support. - */ - setPrototypeOf(o: any, proto: any): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - name: string; - - /** - * Determines if a constructor object recognizes an object as one of the - * constructor’s instances. - * @param value The object to test. - */ - [Symbol.hasInstance](value: any): boolean; -} - -// ############################################################################################# -// ECMAScript 6: Array -// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find, -// and es6.array.find-index -// ############################################################################################# - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; - - [Symbol.unscopables]: any; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -// ############################################################################################# -// ECMAScript 6: String & RegExp -// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, -// es6.string.ends-with, es6.string.includes, es6.string.repeat, -// es6.string.starts-with, and es6.regexp -// ############################################################################################# - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - flags: string; -} - -// ############################################################################################# -// ECMAScript 6: Number & Math -// Modules: es6.number.constructor, es6.number.statics, and es6.math -// ############################################################################################# - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[]): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - -// ############################################################################################# -// ECMAScript 6: Symbols -// Modules: es6.symbol -// ############################################################################################# - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - [Symbol.toStringTag]: string; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - split: symbol; - - /** - * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive - * abstract operation. - */ - toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the with - * environment bindings of the associated objects. - */ - unscopables: symbol; - - /** - * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill - */ - useSimple(): void; - - /** - * Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill - */ - userSetter(): void; -} - -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Math { - [Symbol.toStringTag]: string; -} - -interface JSON { - [Symbol.toStringTag]: string; -} - -// ############################################################################################# -// ECMAScript 6: Collections -// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set -// ############################################################################################# - -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): Map; - size: number; -} - -interface MapConstructor { - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} - -declare var Map: MapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - size: number; -} - -interface SetConstructor { - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} - -declare var Set: SetConstructor; - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} - -declare var WeakMap: WeakMapConstructor; - -interface WeakSet { - add(value: T): WeakSet; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} - -declare var WeakSet: WeakSetConstructor; - -// ############################################################################################# -// ECMAScript 6: Iterators -// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable -// ############################################################################################# - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Map { - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[K, V]>; -} - -interface Set { - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator; -} - -interface $for extends IterableIterator { - of(callbackfn: (value: T, key: any) => void, thisArg?: any): void; - array(): T[]; - array(callbackfn: (value: T, key: any) => U, thisArg?: any): U[]; - filter(callbackfn: (value: T, key: any) => boolean, thisArg?: any): $for; - map(callbackfn: (value: T, key: any) => U, thisArg?: any): $for; -} - -declare function $for(iterable: Iterable): $for; - -// ############################################################################################# -// ECMAScript 6: Promises -// Modules: es6.promise -// ############################################################################################# - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - -declare var Promise: PromiseConstructor; - -// ############################################################################################# -// ECMAScript 6: Reflect -// Modules: es6.reflect -// ############################################################################################# - -declare module Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -// ############################################################################################# -// ECMAScript 7 -// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, -// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, -// es7.map.to-json, and es7.set.to-json -// ############################################################################################# - -interface Array { - includes(value: T, fromIndex?: number): boolean; -} - -interface String { - at(index: number): string; - lpad(length: number, fillStr?: string): string; - rpad(length: number, fillStr?: string): string; -} - -interface ObjectConstructor { - values(object: any): any[]; - entries(object: any): [string, any][]; - getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; -} - -interface RegExpConstructor { - escape(str: string): string; -} - -interface Map { - toJSON(): any; -} - -interface Set { - toJSON(): any; -} - -// ############################################################################################# -// Mozilla JavaScript: Array generics -// Modules: js.array.statics -// ############################################################################################# - -interface ArrayConstructor { - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(array: ArrayLike, ...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(array: ArrayLike): T; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(array: ArrayLike, separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(array: ArrayLike): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(array: ArrayLike): T; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(array: ArrayLike, start?: number, end?: number): T[]; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; - - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(array: ArrayLike, start: number): T[]; - - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; - - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(array: ArrayLike, ...items: T[]): number; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(array: ArrayLike): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(array: ArrayLike): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(array: ArrayLike): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; - - includes(array: ArrayLike, value: T, fromIndex?: number): boolean; - turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; - turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; -} - -// ############################################################################################# -// Object - https://github.com/zloirock/core-js/#object -// Modules: core.object -// ############################################################################################# - -interface ObjectConstructor { - /** - * Non-standard. - */ - isObject(value: any): boolean; - - /** - * Non-standard. - */ - classof(value: any): string; - - /** - * Non-standard. - */ - define(target: T, mixin: any): T; - - /** - * Non-standard. - */ - make(proto: T, mixin?: any): T; -} - -// ############################################################################################# -// Console - https://github.com/zloirock/core-js/#console -// Modules: core.log -// ############################################################################################# - -interface Log extends Console { - (message?: any, ...optionalParams: any[]): void; - enable(): void; - disable(): void; -} - -/** - * Non-standard. - */ -declare var log: Log; - -// ############################################################################################# -// Dict - https://github.com/zloirock/core-js/#dict -// Modules: core.dict -// ############################################################################################# - -interface Dict { - [key: string]: T; - [key: number]: T; - //[key: symbol]: T; -} - -interface DictConstructor { - prototype: Dict; - - new (value?: Dict): Dict; - new (value?: any): Dict; - (value?: Dict): Dict; - (value?: any): Dict; - - isDict(value: any): boolean; - values(object: Dict): IterableIterator; - keys(object: Dict): IterableIterator; - entries(object: Dict): IterableIterator<[PropertyKey, T]>; - has(object: Dict, key: PropertyKey): boolean; - get(object: Dict, key: PropertyKey): T; - set(object: Dict, key: PropertyKey, value: T): Dict; - forEach(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => void, thisArg?: any): void; - map(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => U, thisArg?: any): Dict; - mapPairs(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => [PropertyKey, U], thisArg?: any): Dict; - filter(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): Dict; - some(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): boolean; - every(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): boolean; - find(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): T; - findKey(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): PropertyKey; - keyOf(object: Dict, value: T): PropertyKey; - includes(object: Dict, value: T): boolean; - reduce(object: Dict, callbackfn: (previousValue: U, value: T, key: PropertyKey, dict: Dict) => U, initialValue: U): U; - reduce(object: Dict, callbackfn: (previousValue: T, value: T, key: PropertyKey, dict: Dict) => T, initialValue?: T): T; - turn(object: Dict, callbackfn: (memo: Dict, value: T, key: PropertyKey, dict: Dict) => void, memo: Dict): Dict; - turn(object: Dict, callbackfn: (memo: Dict, value: T, key: PropertyKey, dict: Dict) => void, memo?: Dict): Dict; -} - -/** - * Non-standard. - */ -declare var Dict: DictConstructor; - -// ############################################################################################# -// Partial application - https://github.com/zloirock/core-js/#partial-application -// Modules: core.function.part -// ############################################################################################# - -interface Function { - /** - * Non-standard. - */ - part(...args: any[]): any; -} - -// ############################################################################################# -// Date formatting - https://github.com/zloirock/core-js/#date-formatting -// Modules: core.date -// ############################################################################################# - -interface Date { - /** - * Non-standard. - */ - format(template: string, locale?: string): string; - - /** - * Non-standard. - */ - formatUTC(template: string, locale?: string): string; -} - -// ############################################################################################# -// Array - https://github.com/zloirock/core-js/#array -// Modules: core.array.turn -// ############################################################################################# - -interface Array { - /** - * Non-standard. - */ - turn(callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; - - /** - * Non-standard. - */ - turn(callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; -} - -// ############################################################################################# -// Number - https://github.com/zloirock/core-js/#number -// Modules: core.number.iterator -// ############################################################################################# - -interface Number { - /** - * Non-standard. - */ - [Symbol.iterator](): IterableIterator; -} - -// ############################################################################################# -// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters -// Modules: core.string.escape-html -// ############################################################################################# - -interface String { - /** - * Non-standard. - */ - escapeHTML(): string; - - /** - * Non-standard. - */ - unescapeHTML(): string; -} - -// ############################################################################################# -// delay - https://github.com/zloirock/core-js/#delay -// Modules: core.delay -// ############################################################################################# - -declare function delay(msec: number): Promise; - -declare module core { - module Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; - } - - var Object: { - getPrototypeOf(o: any): any; - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - getOwnPropertyNames(o: any): string[]; - create(o: any, properties?: PropertyDescriptorMap): any; - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - defineProperties(o: any, properties: PropertyDescriptorMap): any; - seal(o: T): T; - freeze(o: T): T; - preventExtensions(o: T): T; - isSealed(o: any): boolean; - isFrozen(o: any): boolean; - isExtensible(o: any): boolean; - keys(o: any): string[]; - assign(target: any, ...sources: any[]): any; - is(value1: any, value2: any): boolean; - setPrototypeOf(o: any, proto: any): any; - getOwnPropertySymbols(o: any): symbol[]; - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; - values(object: any): any[]; - entries(object: any): any[]; - getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; - isObject(value: any): boolean; - classof(value: any): string; - define(target: T, mixin: any): T; - make(proto: T, mixin?: any): T; - }; - - var Function: { - bind(target: Function, thisArg: any, ...argArray: any[]): any; - part(target: Function, ...args: any[]): any; - }; - - var Array: { - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - from(arrayLike: ArrayLike): Array; - from(iterable: Iterable): Array; - of(...items: T[]): Array; - push(array: ArrayLike, ...items: T[]): number; - pop(array: ArrayLike): T; - concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; - join(array: ArrayLike, separator?: string): string; - reverse(array: ArrayLike): T[]; - shift(array: ArrayLike): T; - slice(array: ArrayLike, start?: number, end?: number): T[]; - sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; - splice(array: ArrayLike, start: number): T[]; - splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; - unshift(array: ArrayLike, ...items: T[]): number; - indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; - lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; - every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - entries(array: ArrayLike): IterableIterator<[number, T]>; - keys(array: ArrayLike): IterableIterator; - values(array: ArrayLike): IterableIterator; - find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; - fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; - copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; - includes(array: ArrayLike, value: T, fromIndex?: number): boolean; - turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; - turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; - }; - - var String: { - codePointAt(text: string, pos: number): number; - includes(text: string, searchString: string, position?: number): boolean; - endsWith(text: string, searchString: string, endPosition?: number): boolean; - repeat(text: string, count: number): string; - fromCodePoint(...codePoints: number[]): string; - raw(template: TemplateStringsArray, ...substitutions: any[]): string; - startsWith(text: string, searchString: string, position?: number): boolean; - at(text: string, index: number): string; - lpad(text: string, length: number, fillStr?: string): string; - rpad(text: string, length: number, fillStr?: string): string; - escapeHTML(text: string): string; - unescapeHTML(text: string): string; - }; - - var Date: { - now(): number; - toISOString(date: Date): string; - format(date: Date, template: string, locale?: string): string; - formatUTC(date: Date, template: string, locale?: string): string; - }; - - var Number: { - EPSILON: number; - isFinite(number: number): boolean; - isInteger(number: number): boolean; - isNaN(number: number): boolean; - isSafeInteger(number: number): boolean; - MAX_SAFE_INTEGER: number; - MIN_SAFE_INTEGER: number; - parseFloat(string: string): number; - parseInt(string: string, radix?: number): number; - clz32(x: number): number; - imul(x: number, y: number): number; - sign(x: number): number; - log10(x: number): number; - log2(x: number): number; - log1p(x: number): number; - expm1(x: number): number; - cosh(x: number): number; - sinh(x: number): number; - tanh(x: number): number; - acosh(x: number): number; - asinh(x: number): number; - atanh(x: number): number; - hypot(...values: number[]): number; - trunc(x: number): number; - fround(x: number): number; - cbrt(x: number): number; - random(lim?: number): number; - }; - - var Math: { - clz32(x: number): number; - imul(x: number, y: number): number; - sign(x: number): number; - log10(x: number): number; - log2(x: number): number; - log1p(x: number): number; - expm1(x: number): number; - cosh(x: number): number; - sinh(x: number): number; - tanh(x: number): number; - acosh(x: number): number; - asinh(x: number): number; - atanh(x: number): number; - hypot(...values: number[]): number; - trunc(x: number): number; - fround(x: number): number; - cbrt(x: number): number; - }; - - var RegExp: { - escape(str: string): string; - }; - - var Map: MapConstructor; - var Set: SetConstructor; - var WeakMap: WeakMapConstructor; - var WeakSet: WeakSetConstructor; - var Promise: PromiseConstructor; - var Symbol: SymbolConstructor; - var Dict: DictConstructor; - var global: any; - var log: Log; - var _: boolean; - - function setTimeout(handler: any, timeout?: any, ...args: any[]): number; - - function setInterval(handler: any, timeout?: any, ...args: any[]): number; - - function setImmediate(expression: any, ...args: any[]): number; - - function clearImmediate(handle: number): void; - - function $for(iterable: Iterable): $for; - - function isIterable(value: any): boolean; - - function getIterator(iterable: Iterable): Iterator; - - interface Locale { - weekdays: string; - months: string; - } - - function addLocale(lang: string, locale: Locale): typeof core; - - function locale(lang?: string): string; - - function delay(msec: number): Promise; -} - -declare module "core-js" { - export = core; -} -declare module "core-js/shim" { - export = core; -} -declare module "core-js/core" { - export = core; -} -declare module "core-js/core/$for" { - import $for = core.$for; - export = $for; -} -declare module "core-js/core/_" { - var _: typeof core._; - export = _; -} -declare module "core-js/core/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/core/date" { - var Date: typeof core.Date; - export = Date; -} -declare module "core-js/core/delay" { - var delay: typeof core.delay; - export = delay; -} -declare module "core-js/core/dict" { - var Dict: typeof core.Dict; - export = Dict; -} -declare module "core-js/core/function" { - var Function: typeof core.Function; - export = Function; -} -declare module "core-js/core/global" { - var global: typeof core.global; - export = global; -} -declare module "core-js/core/log" { - var log: typeof core.log; - export = log; -} -declare module "core-js/core/number" { - var Number: typeof core.Number; - export = Number; -} -declare module "core-js/core/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/core/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/fn/$for" { - import $for = core.$for; - export = $for; -} -declare module "core-js/fn/_" { - var _: typeof core._; - export = _; -} -declare module "core-js/fn/clear-immediate" { - var clearImmediate: typeof core.clearImmediate; - export = clearImmediate; -} -declare module "core-js/fn/delay" { - var delay: typeof core.delay; - export = delay; -} -declare module "core-js/fn/dict" { - var Dict: typeof core.Dict; - export = Dict; -} -declare module "core-js/fn/get-iterator" { - var getIterator: typeof core.getIterator; - export = getIterator; -} -declare module "core-js/fn/global" { - var global: typeof core.global; - export = global; -} -declare module "core-js/fn/is-iterable" { - var isIterable: typeof core.isIterable; - export = isIterable; -} -declare module "core-js/fn/log" { - var log: typeof core.log; - export = log; -} -declare module "core-js/fn/map" { - var Map: typeof core.Map; - export = Map; -} -declare module "core-js/fn/promise" { - var Promise: typeof core.Promise; - export = Promise; -} -declare module "core-js/fn/set" { - var Set: typeof core.Set; - export = Set; -} -declare module "core-js/fn/set-immediate" { - var setImmediate: typeof core.setImmediate; - export = setImmediate; -} -declare module "core-js/fn/set-interval" { - var setInterval: typeof core.setInterval; - export = setInterval; -} -declare module "core-js/fn/set-timeout" { - var setTimeout: typeof core.setTimeout; - export = setTimeout; -} -declare module "core-js/fn/weak-map" { - var WeakMap: typeof core.WeakMap; - export = WeakMap; -} -declare module "core-js/fn/weak-set" { - var WeakSet: typeof core.WeakSet; - export = WeakSet; -} -declare module "core-js/fn/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/fn/array/concat" { - var concat: typeof core.Array.concat; - export = concat; -} -declare module "core-js/fn/array/copy-within" { - var copyWithin: typeof core.Array.copyWithin; - export = copyWithin; -} -declare module "core-js/fn/array/entries" { - var entries: typeof core.Array.entries; - export = entries; -} -declare module "core-js/fn/array/every" { - var every: typeof core.Array.every; - export = every; -} -declare module "core-js/fn/array/fill" { - var fill: typeof core.Array.fill; - export = fill; -} -declare module "core-js/fn/array/filter" { - var filter: typeof core.Array.filter; - export = filter; -} -declare module "core-js/fn/array/find" { - var find: typeof core.Array.find; - export = find; -} -declare module "core-js/fn/array/find-index" { - var findIndex: typeof core.Array.findIndex; - export = findIndex; -} -declare module "core-js/fn/array/for-each" { - var forEach: typeof core.Array.forEach; - export = forEach; -} -declare module "core-js/fn/array/from" { - var from: typeof core.Array.from; - export = from; -} -declare module "core-js/fn/array/includes" { - var includes: typeof core.Array.includes; - export = includes; -} -declare module "core-js/fn/array/index-of" { - var indexOf: typeof core.Array.indexOf; - export = indexOf; -} -declare module "core-js/fn/array/join" { - var join: typeof core.Array.join; - export = join; -} -declare module "core-js/fn/array/keys" { - var keys: typeof core.Array.keys; - export = keys; -} -declare module "core-js/fn/array/last-index-of" { - var lastIndexOf: typeof core.Array.lastIndexOf; - export = lastIndexOf; -} -declare module "core-js/fn/array/map" { - var map: typeof core.Array.map; - export = map; -} -declare module "core-js/fn/array/of" { - var of: typeof core.Array.of; - export = of; -} -declare module "core-js/fn/array/pop" { - var pop: typeof core.Array.pop; - export = pop; -} -declare module "core-js/fn/array/push" { - var push: typeof core.Array.push; - export = push; -} -declare module "core-js/fn/array/reduce" { - var reduce: typeof core.Array.reduce; - export = reduce; -} -declare module "core-js/fn/array/reduce-right" { - var reduceRight: typeof core.Array.reduceRight; - export = reduceRight; -} -declare module "core-js/fn/array/reverse" { - var reverse: typeof core.Array.reverse; - export = reverse; -} -declare module "core-js/fn/array/shift" { - var shift: typeof core.Array.shift; - export = shift; -} -declare module "core-js/fn/array/slice" { - var slice: typeof core.Array.slice; - export = slice; -} -declare module "core-js/fn/array/some" { - var some: typeof core.Array.some; - export = some; -} -declare module "core-js/fn/array/sort" { - var sort: typeof core.Array.sort; - export = sort; -} -declare module "core-js/fn/array/splice" { - var splice: typeof core.Array.splice; - export = splice; -} -declare module "core-js/fn/array/turn" { - var turn: typeof core.Array.turn; - export = turn; -} -declare module "core-js/fn/array/unshift" { - var unshift: typeof core.Array.unshift; - export = unshift; -} -declare module "core-js/fn/array/values" { - var values: typeof core.Array.values; - export = values; -} -declare module "core-js/fn/date" { - var Date: typeof core.Date; - export = Date; -} -declare module "core-js/fn/date/add-locale" { - var addLocale: typeof core.addLocale; - export = addLocale; -} -declare module "core-js/fn/date/format" { - var format: typeof core.Date.format; - export = format; -} -declare module "core-js/fn/date/formatUTC" { - var formatUTC: typeof core.Date.formatUTC; - export = formatUTC; -} -declare module "core-js/fn/function" { - var Function: typeof core.Function; - export = Function; -} -declare module "core-js/fn/function/has-instance" { - var hasInstance: (value: any) => boolean; - export = hasInstance; -} -declare module "core-js/fn/function/name" -{ -} -declare module "core-js/fn/function/part" { - var part: typeof core.Function.part; - export = part; -} -declare module "core-js/fn/math" { - var Math: typeof core.Math; - export = Math; -} -declare module "core-js/fn/math/acosh" { - var acosh: typeof core.Math.acosh; - export = acosh; -} -declare module "core-js/fn/math/asinh" { - var asinh: typeof core.Math.asinh; - export = asinh; -} -declare module "core-js/fn/math/atanh" { - var atanh: typeof core.Math.atanh; - export = atanh; -} -declare module "core-js/fn/math/cbrt" { - var cbrt: typeof core.Math.cbrt; - export = cbrt; -} -declare module "core-js/fn/math/clz32" { - var clz32: typeof core.Math.clz32; - export = clz32; -} -declare module "core-js/fn/math/cosh" { - var cosh: typeof core.Math.cosh; - export = cosh; -} -declare module "core-js/fn/math/expm1" { - var expm1: typeof core.Math.expm1; - export = expm1; -} -declare module "core-js/fn/math/fround" { - var fround: typeof core.Math.fround; - export = fround; -} -declare module "core-js/fn/math/hypot" { - var hypot: typeof core.Math.hypot; - export = hypot; -} -declare module "core-js/fn/math/imul" { - var imul: typeof core.Math.imul; - export = imul; -} -declare module "core-js/fn/math/log10" { - var log10: typeof core.Math.log10; - export = log10; -} -declare module "core-js/fn/math/log1p" { - var log1p: typeof core.Math.log1p; - export = log1p; -} -declare module "core-js/fn/math/log2" { - var log2: typeof core.Math.log2; - export = log2; -} -declare module "core-js/fn/math/sign" { - var sign: typeof core.Math.sign; - export = sign; -} -declare module "core-js/fn/math/sinh" { - var sinh: typeof core.Math.sinh; - export = sinh; -} -declare module "core-js/fn/math/tanh" { - var tanh: typeof core.Math.tanh; - export = tanh; -} -declare module "core-js/fn/math/trunc" { - var trunc: typeof core.Math.trunc; - export = trunc; -} -declare module "core-js/fn/number" { - var Number: typeof core.Number; - export = Number; -} -declare module "core-js/fn/number/epsilon" { - var EPSILON: typeof core.Number.EPSILON; - export = EPSILON; -} -declare module "core-js/fn/number/is-finite" { - var isFinite: typeof core.Number.isFinite; - export = isFinite; -} -declare module "core-js/fn/number/is-integer" { - var isInteger: typeof core.Number.isInteger; - export = isInteger; -} -declare module "core-js/fn/number/is-nan" { - var isNaN: typeof core.Number.isNaN; - export = isNaN; -} -declare module "core-js/fn/number/is-safe-integer" { - var isSafeInteger: typeof core.Number.isSafeInteger; - export = isSafeInteger; -} -declare module "core-js/fn/number/max-safe-integer" { - var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; - export = MAX_SAFE_INTEGER; -} -declare module "core-js/fn/number/min-safe-interger" { - var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; - export = MIN_SAFE_INTEGER; -} -declare module "core-js/fn/number/parse-float" { - var parseFloat: typeof core.Number.parseFloat; - export = parseFloat; -} -declare module "core-js/fn/number/parse-int" { - var parseInt: typeof core.Number.parseInt; - export = parseInt; -} -declare module "core-js/fn/number/random" { - var random: typeof core.Number.random; - export = random; -} -declare module "core-js/fn/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/fn/object/assign" { - var assign: typeof core.Object.assign; - export = assign; -} -declare module "core-js/fn/object/classof" { - var classof: typeof core.Object.classof; - export = classof; -} -declare module "core-js/fn/object/create" { - var create: typeof core.Object.create; - export = create; -} -declare module "core-js/fn/object/define" { - var define: typeof core.Object.define; - export = define; -} -declare module "core-js/fn/object/define-properties" { - var defineProperties: typeof core.Object.defineProperties; - export = defineProperties; -} -declare module "core-js/fn/object/define-property" { - var defineProperty: typeof core.Object.defineProperty; - export = defineProperty; -} -declare module "core-js/fn/object/entries" { - var entries: typeof core.Object.entries; - export = entries; -} -declare module "core-js/fn/object/freeze" { - var freeze: typeof core.Object.freeze; - export = freeze; -} -declare module "core-js/fn/object/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; - export = getOwnPropertyDescriptor; -} -declare module "core-js/fn/object/get-own-property-descriptors" { - var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; - export = getOwnPropertyDescriptors; -} -declare module "core-js/fn/object/get-own-property-names" { - var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; - export = getOwnPropertyNames; -} -declare module "core-js/fn/object/get-own-property-symbols" { - var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; - export = getOwnPropertySymbols; -} -declare module "core-js/fn/object/get-prototype-of" { - var getPrototypeOf: typeof core.Object.getPrototypeOf; - export = getPrototypeOf; -} -declare module "core-js/fn/object/is" { - var is: typeof core.Object.is; - export = is; -} -declare module "core-js/fn/object/is-extensible" { - var isExtensible: typeof core.Object.isExtensible; - export = isExtensible; -} -declare module "core-js/fn/object/is-frozen" { - var isFrozen: typeof core.Object.isFrozen; - export = isFrozen; -} -declare module "core-js/fn/object/is-object" { - var isObject: typeof core.Object.isObject; - export = isObject; -} -declare module "core-js/fn/object/is-sealed" { - var isSealed: typeof core.Object.isSealed; - export = isSealed; -} -declare module "core-js/fn/object/keys" { - var keys: typeof core.Object.keys; - export = keys; -} -declare module "core-js/fn/object/make" { - var make: typeof core.Object.make; - export = make; -} -declare module "core-js/fn/object/prevent-extensions" { - var preventExtensions: typeof core.Object.preventExtensions; - export = preventExtensions; -} -declare module "core-js/fn/object/seal" { - var seal: typeof core.Object.seal; - export = seal; -} -declare module "core-js/fn/object/set-prototype-of" { - var setPrototypeOf: typeof core.Object.setPrototypeOf; - export = setPrototypeOf; -} -declare module "core-js/fn/object/values" { - var values: typeof core.Object.values; - export = values; -} -declare module "core-js/fn/reflect" { - var Reflect: typeof core.Reflect; - export = Reflect; -} -declare module "core-js/fn/reflect/apply" { - var apply: typeof core.Reflect.apply; - export = apply; -} -declare module "core-js/fn/reflect/construct" { - var construct: typeof core.Reflect.construct; - export = construct; -} -declare module "core-js/fn/reflect/define-property" { - var defineProperty: typeof core.Reflect.defineProperty; - export = defineProperty; -} -declare module "core-js/fn/reflect/delete-property" { - var deleteProperty: typeof core.Reflect.deleteProperty; - export = deleteProperty; -} -declare module "core-js/fn/reflect/enumerate" { - var enumerate: typeof core.Reflect.enumerate; - export = enumerate; -} -declare module "core-js/fn/reflect/get" { - var get: typeof core.Reflect.get; - export = get; -} -declare module "core-js/fn/reflect/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; - export = getOwnPropertyDescriptor; -} -declare module "core-js/fn/reflect/get-prototype-of" { - var getPrototypeOf: typeof core.Reflect.getPrototypeOf; - export = getPrototypeOf; -} -declare module "core-js/fn/reflect/has" { - var has: typeof core.Reflect.has; - export = has; -} -declare module "core-js/fn/reflect/is-extensible" { - var isExtensible: typeof core.Reflect.isExtensible; - export = isExtensible; -} -declare module "core-js/fn/reflect/own-keys" { - var ownKeys: typeof core.Reflect.ownKeys; - export = ownKeys; -} -declare module "core-js/fn/reflect/prevent-extensions" { - var preventExtensions: typeof core.Reflect.preventExtensions; - export = preventExtensions; -} -declare module "core-js/fn/reflect/set" { - var set: typeof core.Reflect.set; - export = set; -} -declare module "core-js/fn/reflect/set-prototype-of" { - var setPrototypeOf: typeof core.Reflect.setPrototypeOf; - export = setPrototypeOf; -} -declare module "core-js/fn/regexp" { - var RegExp: typeof core.RegExp; - export = RegExp; -} -declare module "core-js/fn/regexp/escape" { - var escape: typeof core.RegExp.escape; - export = escape; -} -declare module "core-js/fn/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/fn/string/at" { - var at: typeof core.String.at; - export = at; -} -declare module "core-js/fn/string/code-point-at" { - var codePointAt: typeof core.String.codePointAt; - export = codePointAt; -} -declare module "core-js/fn/string/ends-with" { - var endsWith: typeof core.String.endsWith; - export = endsWith; -} -declare module "core-js/fn/string/escape-html" { - var escapeHTML: typeof core.String.escapeHTML; - export = escapeHTML; -} -declare module "core-js/fn/string/from-code-point" { - var fromCodePoint: typeof core.String.fromCodePoint; - export = fromCodePoint; -} -declare module "core-js/fn/string/includes" { - var includes: typeof core.String.includes; - export = includes; -} -declare module "core-js/fn/string/lpad" { - var lpad: typeof core.String.lpad; - export = lpad; -} -declare module "core-js/fn/string/raw" { - var raw: typeof core.String.raw; - export = raw; -} -declare module "core-js/fn/string/repeat" { - var repeat: typeof core.String.repeat; - export = repeat; -} -declare module "core-js/fn/string/rpad" { - var rpad: typeof core.String.rpad; - export = rpad; -} -declare module "core-js/fn/string/starts-with" { - var startsWith: typeof core.String.startsWith; - export = startsWith; -} -declare module "core-js/fn/string/unescape-html" { - var unescapeHTML: typeof core.String.unescapeHTML; - export = unescapeHTML; -} -declare module "core-js/fn/symbol" { - var Symbol: typeof core.Symbol; - export = Symbol; -} -declare module "core-js/fn/symbol/for" { - var _for: typeof core.Symbol.for; - export = _for; -} -declare module "core-js/fn/symbol/has-instance" { - var hasInstance: typeof core.Symbol.hasInstance; - export = hasInstance; -} -declare module "core-js/fn/symbol/is-concat-spreadable" { - var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; - export = isConcatSpreadable; -} -declare module "core-js/fn/symbol/iterator" { - var iterator: typeof core.Symbol.iterator; - export = iterator; -} -declare module "core-js/fn/symbol/key-for" { - var keyFor: typeof core.Symbol.keyFor; - export = keyFor; -} -declare module "core-js/fn/symbol/match" { - var match: typeof core.Symbol.match; - export = match; -} -declare module "core-js/fn/symbol/replace" { - var replace: typeof core.Symbol.replace; - export = replace; -} -declare module "core-js/fn/symbol/search" { - var search: typeof core.Symbol.search; - export = search; -} -declare module "core-js/fn/symbol/species" { - var species: typeof core.Symbol.species; - export = species; -} -declare module "core-js/fn/symbol/split" { - var split: typeof core.Symbol.split; - export = split; -} -declare module "core-js/fn/symbol/to-primitive" { - var toPrimitive: typeof core.Symbol.toPrimitive; - export = toPrimitive; -} -declare module "core-js/fn/symbol/to-string-tag" { - var toStringTag: typeof core.Symbol.toStringTag; - export = toStringTag; -} -declare module "core-js/fn/symbol/unscopables" { - var unscopables: typeof core.Symbol.unscopables; - export = unscopables; -} -declare module "core-js/es5" { - export = core; -} -declare module "core-js/es6" { - export = core; -} -declare module "core-js/es6/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/es6/function" { - var Function: typeof core.Function; - export = Function; -} -declare module "core-js/es6/map" { - var Map: typeof core.Map; - export = Map; -} -declare module "core-js/es6/math" { - var Math: typeof core.Math; - export = Math; -} -declare module "core-js/es6/number" { - var Number: typeof core.Number; - export = Number; -} -declare module "core-js/es6/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/es6/promise" { - var Promise: typeof core.Promise; - export = Promise; -} -declare module "core-js/es6/reflect" { - var Reflect: typeof core.Reflect; - export = Reflect; -} -declare module "core-js/es6/regexp" { - var RegExp: typeof core.RegExp; - export = RegExp; -} -declare module "core-js/es6/set" { - var Set: typeof core.Set; - export = Set; -} -declare module "core-js/es6/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/es6/symbol" { - var Symbol: typeof core.Symbol; - export = Symbol; -} -declare module "core-js/es6/weak-map" { - var WeakMap: typeof core.WeakMap; - export = WeakMap; -} -declare module "core-js/es6/weak-set" { - var WeakSet: typeof core.WeakSet; - export = WeakSet; -} -declare module "core-js/es7" { - export = core; -} -declare module "core-js/es7/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/es7/map" { - var Map: typeof core.Map; - export = Map; -} -declare module "core-js/es7/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/es7/regexp" { - var RegExp: typeof core.RegExp; - export = RegExp; -} -declare module "core-js/es7/set" { - var Set: typeof core.Set; - export = Set; -} -declare module "core-js/es7/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/js" { - export = core; -} -declare module "core-js/js/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/web" { - export = core; -} -declare module "core-js/web/dom" { - export = core; -} -declare module "core-js/web/immediate" { - export = core; -} -declare module "core-js/web/timers" { - export = core; -} -declare module "core-js/library" { - export = core; -} -declare module "core-js/library/shim" { - export = core; -} -declare module "core-js/library/core" { - export = core; -} -declare module "core-js/library/core/$for" { - import $for = core.$for; - export = $for; -} -declare module "core-js/library/core/_" { - var _: typeof core._; - export = _; -} -declare module "core-js/library/core/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/library/core/date" { - var Date: typeof core.Date; - export = Date; -} -declare module "core-js/library/core/delay" { - var delay: typeof core.delay; - export = delay; -} -declare module "core-js/library/core/dict" { - var Dict: typeof core.Dict; - export = Dict; -} -declare module "core-js/library/core/function" { - var Function: typeof core.Function; - export = Function; -} -declare module "core-js/library/core/global" { - var global: typeof core.global; - export = global; -} -declare module "core-js/library/core/log" { - var log: typeof core.log; - export = log; -} -declare module "core-js/library/core/number" { - var Number: typeof core.Number; - export = Number; -} -declare module "core-js/library/core/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/library/core/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/library/fn/$for" { - import $for = core.$for; - export = $for; -} -declare module "core-js/library/fn/_" { - var _: typeof core._; - export = _; -} -declare module "core-js/library/fn/clear-immediate" { - var clearImmediate: typeof core.clearImmediate; - export = clearImmediate; -} -declare module "core-js/library/fn/delay" { - var delay: typeof core.delay; - export = delay; -} -declare module "core-js/library/fn/dict" { - var Dict: typeof core.Dict; - export = Dict; -} -declare module "core-js/library/fn/get-iterator" { - var getIterator: typeof core.getIterator; - export = getIterator; -} -declare module "core-js/library/fn/global" { - var global: typeof core.global; - export = global; -} -declare module "core-js/library/fn/is-iterable" { - var isIterable: typeof core.isIterable; - export = isIterable; -} -declare module "core-js/library/fn/log" { - var log: typeof core.log; - export = log; -} -declare module "core-js/library/fn/map" { - var Map: typeof core.Map; - export = Map; -} -declare module "core-js/library/fn/promise" { - var Promise: typeof core.Promise; - export = Promise; -} -declare module "core-js/library/fn/set" { - var Set: typeof core.Set; - export = Set; -} -declare module "core-js/library/fn/set-immediate" { - var setImmediate: typeof core.setImmediate; - export = setImmediate; -} -declare module "core-js/library/fn/set-interval" { - var setInterval: typeof core.setInterval; - export = setInterval; -} -declare module "core-js/library/fn/set-timeout" { - var setTimeout: typeof core.setTimeout; - export = setTimeout; -} -declare module "core-js/library/fn/weak-map" { - var WeakMap: typeof core.WeakMap; - export = WeakMap; -} -declare module "core-js/library/fn/weak-set" { - var WeakSet: typeof core.WeakSet; - export = WeakSet; -} -declare module "core-js/library/fn/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/library/fn/array/concat" { - var concat: typeof core.Array.concat; - export = concat; -} -declare module "core-js/library/fn/array/copy-within" { - var copyWithin: typeof core.Array.copyWithin; - export = copyWithin; -} -declare module "core-js/library/fn/array/entries" { - var entries: typeof core.Array.entries; - export = entries; -} -declare module "core-js/library/fn/array/every" { - var every: typeof core.Array.every; - export = every; -} -declare module "core-js/library/fn/array/fill" { - var fill: typeof core.Array.fill; - export = fill; -} -declare module "core-js/library/fn/array/filter" { - var filter: typeof core.Array.filter; - export = filter; -} -declare module "core-js/library/fn/array/find" { - var find: typeof core.Array.find; - export = find; -} -declare module "core-js/library/fn/array/find-index" { - var findIndex: typeof core.Array.findIndex; - export = findIndex; -} -declare module "core-js/library/fn/array/for-each" { - var forEach: typeof core.Array.forEach; - export = forEach; -} -declare module "core-js/library/fn/array/from" { - var from: typeof core.Array.from; - export = from; -} -declare module "core-js/library/fn/array/includes" { - var includes: typeof core.Array.includes; - export = includes; -} -declare module "core-js/library/fn/array/index-of" { - var indexOf: typeof core.Array.indexOf; - export = indexOf; -} -declare module "core-js/library/fn/array/join" { - var join: typeof core.Array.join; - export = join; -} -declare module "core-js/library/fn/array/keys" { - var keys: typeof core.Array.keys; - export = keys; -} -declare module "core-js/library/fn/array/last-index-of" { - var lastIndexOf: typeof core.Array.lastIndexOf; - export = lastIndexOf; -} -declare module "core-js/library/fn/array/map" { - var map: typeof core.Array.map; - export = map; -} -declare module "core-js/library/fn/array/of" { - var of: typeof core.Array.of; - export = of; -} -declare module "core-js/library/fn/array/pop" { - var pop: typeof core.Array.pop; - export = pop; -} -declare module "core-js/library/fn/array/push" { - var push: typeof core.Array.push; - export = push; -} -declare module "core-js/library/fn/array/reduce" { - var reduce: typeof core.Array.reduce; - export = reduce; -} -declare module "core-js/library/fn/array/reduce-right" { - var reduceRight: typeof core.Array.reduceRight; - export = reduceRight; -} -declare module "core-js/library/fn/array/reverse" { - var reverse: typeof core.Array.reverse; - export = reverse; -} -declare module "core-js/library/fn/array/shift" { - var shift: typeof core.Array.shift; - export = shift; -} -declare module "core-js/library/fn/array/slice" { - var slice: typeof core.Array.slice; - export = slice; -} -declare module "core-js/library/fn/array/some" { - var some: typeof core.Array.some; - export = some; -} -declare module "core-js/library/fn/array/sort" { - var sort: typeof core.Array.sort; - export = sort; -} -declare module "core-js/library/fn/array/splice" { - var splice: typeof core.Array.splice; - export = splice; -} -declare module "core-js/library/fn/array/turn" { - var turn: typeof core.Array.turn; - export = turn; -} -declare module "core-js/library/fn/array/unshift" { - var unshift: typeof core.Array.unshift; - export = unshift; -} -declare module "core-js/library/fn/array/values" { - var values: typeof core.Array.values; - export = values; -} -declare module "core-js/library/fn/date" { - var Date: typeof core.Date; - export = Date; -} -declare module "core-js/library/fn/date/add-locale" { - var addLocale: typeof core.addLocale; - export = addLocale; -} -declare module "core-js/library/fn/date/format" { - var format: typeof core.Date.format; - export = format; -} -declare module "core-js/library/fn/date/formatUTC" { - var formatUTC: typeof core.Date.formatUTC; - export = formatUTC; -} -declare module "core-js/library/fn/function" { - var Function: typeof core.Function; - export = Function; -} -declare module "core-js/library/fn/function/has-instance" { - var hasInstance: (value: any) => boolean; - export = hasInstance; -} -declare module "core-js/library/fn/function/name" { -} -declare module "core-js/library/fn/function/part" { - var part: typeof core.Function.part; - export = part; -} -declare module "core-js/library/fn/math" { - var Math: typeof core.Math; - export = Math; -} -declare module "core-js/library/fn/math/acosh" { - var acosh: typeof core.Math.acosh; - export = acosh; -} -declare module "core-js/library/fn/math/asinh" { - var asinh: typeof core.Math.asinh; - export = asinh; -} -declare module "core-js/library/fn/math/atanh" { - var atanh: typeof core.Math.atanh; - export = atanh; -} -declare module "core-js/library/fn/math/cbrt" { - var cbrt: typeof core.Math.cbrt; - export = cbrt; -} -declare module "core-js/library/fn/math/clz32" { - var clz32: typeof core.Math.clz32; - export = clz32; -} -declare module "core-js/library/fn/math/cosh" { - var cosh: typeof core.Math.cosh; - export = cosh; -} -declare module "core-js/library/fn/math/expm1" { - var expm1: typeof core.Math.expm1; - export = expm1; -} -declare module "core-js/library/fn/math/fround" { - var fround: typeof core.Math.fround; - export = fround; -} -declare module "core-js/library/fn/math/hypot" { - var hypot: typeof core.Math.hypot; - export = hypot; -} -declare module "core-js/library/fn/math/imul" { - var imul: typeof core.Math.imul; - export = imul; -} -declare module "core-js/library/fn/math/log10" { - var log10: typeof core.Math.log10; - export = log10; -} -declare module "core-js/library/fn/math/log1p" { - var log1p: typeof core.Math.log1p; - export = log1p; -} -declare module "core-js/library/fn/math/log2" { - var log2: typeof core.Math.log2; - export = log2; -} -declare module "core-js/library/fn/math/sign" { - var sign: typeof core.Math.sign; - export = sign; -} -declare module "core-js/library/fn/math/sinh" { - var sinh: typeof core.Math.sinh; - export = sinh; -} -declare module "core-js/library/fn/math/tanh" { - var tanh: typeof core.Math.tanh; - export = tanh; -} -declare module "core-js/library/fn/math/trunc" { - var trunc: typeof core.Math.trunc; - export = trunc; -} -declare module "core-js/library/fn/number" { - var Number: typeof core.Number; - export = Number; -} -declare module "core-js/library/fn/number/epsilon" { - var EPSILON: typeof core.Number.EPSILON; - export = EPSILON; -} -declare module "core-js/library/fn/number/is-finite" { - var isFinite: typeof core.Number.isFinite; - export = isFinite; -} -declare module "core-js/library/fn/number/is-integer" { - var isInteger: typeof core.Number.isInteger; - export = isInteger; -} -declare module "core-js/library/fn/number/is-nan" { - var isNaN: typeof core.Number.isNaN; - export = isNaN; -} -declare module "core-js/library/fn/number/is-safe-integer" { - var isSafeInteger: typeof core.Number.isSafeInteger; - export = isSafeInteger; -} -declare module "core-js/library/fn/number/max-safe-integer" { - var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; - export = MAX_SAFE_INTEGER; -} -declare module "core-js/library/fn/number/min-safe-interger" { - var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; - export = MIN_SAFE_INTEGER; -} -declare module "core-js/library/fn/number/parse-float" { - var parseFloat: typeof core.Number.parseFloat; - export = parseFloat; -} -declare module "core-js/library/fn/number/parse-int" { - var parseInt: typeof core.Number.parseInt; - export = parseInt; -} -declare module "core-js/library/fn/number/random" { - var random: typeof core.Number.random; - export = random; -} -declare module "core-js/library/fn/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/library/fn/object/assign" { - var assign: typeof core.Object.assign; - export = assign; -} -declare module "core-js/library/fn/object/classof" { - var classof: typeof core.Object.classof; - export = classof; -} -declare module "core-js/library/fn/object/create" { - var create: typeof core.Object.create; - export = create; -} -declare module "core-js/library/fn/object/define" { - var define: typeof core.Object.define; - export = define; -} -declare module "core-js/library/fn/object/define-properties" { - var defineProperties: typeof core.Object.defineProperties; - export = defineProperties; -} -declare module "core-js/library/fn/object/define-property" { - var defineProperty: typeof core.Object.defineProperty; - export = defineProperty; -} -declare module "core-js/library/fn/object/entries" { - var entries: typeof core.Object.entries; - export = entries; -} -declare module "core-js/library/fn/object/freeze" { - var freeze: typeof core.Object.freeze; - export = freeze; -} -declare module "core-js/library/fn/object/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; - export = getOwnPropertyDescriptor; -} -declare module "core-js/library/fn/object/get-own-property-descriptors" { - var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; - export = getOwnPropertyDescriptors; -} -declare module "core-js/library/fn/object/get-own-property-names" { - var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; - export = getOwnPropertyNames; -} -declare module "core-js/library/fn/object/get-own-property-symbols" { - var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; - export = getOwnPropertySymbols; -} -declare module "core-js/library/fn/object/get-prototype-of" { - var getPrototypeOf: typeof core.Object.getPrototypeOf; - export = getPrototypeOf; -} -declare module "core-js/library/fn/object/is" { - var is: typeof core.Object.is; - export = is; -} -declare module "core-js/library/fn/object/is-extensible" { - var isExtensible: typeof core.Object.isExtensible; - export = isExtensible; -} -declare module "core-js/library/fn/object/is-frozen" { - var isFrozen: typeof core.Object.isFrozen; - export = isFrozen; -} -declare module "core-js/library/fn/object/is-object" { - var isObject: typeof core.Object.isObject; - export = isObject; -} -declare module "core-js/library/fn/object/is-sealed" { - var isSealed: typeof core.Object.isSealed; - export = isSealed; -} -declare module "core-js/library/fn/object/keys" { - var keys: typeof core.Object.keys; - export = keys; -} -declare module "core-js/library/fn/object/make" { - var make: typeof core.Object.make; - export = make; -} -declare module "core-js/library/fn/object/prevent-extensions" { - var preventExtensions: typeof core.Object.preventExtensions; - export = preventExtensions; -} -declare module "core-js/library/fn/object/seal" { - var seal: typeof core.Object.seal; - export = seal; -} -declare module "core-js/library/fn/object/set-prototype-of" { - var setPrototypeOf: typeof core.Object.setPrototypeOf; - export = setPrototypeOf; -} -declare module "core-js/library/fn/object/values" { - var values: typeof core.Object.values; - export = values; -} -declare module "core-js/library/fn/reflect" { - var Reflect: typeof core.Reflect; - export = Reflect; -} -declare module "core-js/library/fn/reflect/apply" { - var apply: typeof core.Reflect.apply; - export = apply; -} -declare module "core-js/library/fn/reflect/construct" { - var construct: typeof core.Reflect.construct; - export = construct; -} -declare module "core-js/library/fn/reflect/define-property" { - var defineProperty: typeof core.Reflect.defineProperty; - export = defineProperty; -} -declare module "core-js/library/fn/reflect/delete-property" { - var deleteProperty: typeof core.Reflect.deleteProperty; - export = deleteProperty; -} -declare module "core-js/library/fn/reflect/enumerate" { - var enumerate: typeof core.Reflect.enumerate; - export = enumerate; -} -declare module "core-js/library/fn/reflect/get" { - var get: typeof core.Reflect.get; - export = get; -} -declare module "core-js/library/fn/reflect/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; - export = getOwnPropertyDescriptor; -} -declare module "core-js/library/fn/reflect/get-prototype-of" { - var getPrototypeOf: typeof core.Reflect.getPrototypeOf; - export = getPrototypeOf; -} -declare module "core-js/library/fn/reflect/has" { - var has: typeof core.Reflect.has; - export = has; -} -declare module "core-js/library/fn/reflect/is-extensible" { - var isExtensible: typeof core.Reflect.isExtensible; - export = isExtensible; -} -declare module "core-js/library/fn/reflect/own-keys" { - var ownKeys: typeof core.Reflect.ownKeys; - export = ownKeys; -} -declare module "core-js/library/fn/reflect/prevent-extensions" { - var preventExtensions: typeof core.Reflect.preventExtensions; - export = preventExtensions; -} -declare module "core-js/library/fn/reflect/set" { - var set: typeof core.Reflect.set; - export = set; -} -declare module "core-js/library/fn/reflect/set-prototype-of" { - var setPrototypeOf: typeof core.Reflect.setPrototypeOf; - export = setPrototypeOf; -} -declare module "core-js/library/fn/regexp" { - var RegExp: typeof core.RegExp; - export = RegExp; -} -declare module "core-js/library/fn/regexp/escape" { - var escape: typeof core.RegExp.escape; - export = escape; -} -declare module "core-js/library/fn/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/library/fn/string/at" { - var at: typeof core.String.at; - export = at; -} -declare module "core-js/library/fn/string/code-point-at" { - var codePointAt: typeof core.String.codePointAt; - export = codePointAt; -} -declare module "core-js/library/fn/string/ends-with" { - var endsWith: typeof core.String.endsWith; - export = endsWith; -} -declare module "core-js/library/fn/string/escape-html" { - var escapeHTML: typeof core.String.escapeHTML; - export = escapeHTML; -} -declare module "core-js/library/fn/string/from-code-point" { - var fromCodePoint: typeof core.String.fromCodePoint; - export = fromCodePoint; -} -declare module "core-js/library/fn/string/includes" { - var includes: typeof core.String.includes; - export = includes; -} -declare module "core-js/library/fn/string/lpad" { - var lpad: typeof core.String.lpad; - export = lpad; -} -declare module "core-js/library/fn/string/raw" { - var raw: typeof core.String.raw; - export = raw; -} -declare module "core-js/library/fn/string/repeat" { - var repeat: typeof core.String.repeat; - export = repeat; -} -declare module "core-js/library/fn/string/rpad" { - var rpad: typeof core.String.rpad; - export = rpad; -} -declare module "core-js/library/fn/string/starts-with" { - var startsWith: typeof core.String.startsWith; - export = startsWith; -} -declare module "core-js/library/fn/string/unescape-html" { - var unescapeHTML: typeof core.String.unescapeHTML; - export = unescapeHTML; -} -declare module "core-js/library/fn/symbol" { - var Symbol: typeof core.Symbol; - export = Symbol; -} -declare module "core-js/library/fn/symbol/for" { - var _for: typeof core.Symbol.for; - export = _for; -} -declare module "core-js/library/fn/symbol/has-instance" { - var hasInstance: typeof core.Symbol.hasInstance; - export = hasInstance; -} -declare module "core-js/library/fn/symbol/is-concat-spreadable" { - var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; - export = isConcatSpreadable; -} -declare module "core-js/library/fn/symbol/iterator" { - var iterator: typeof core.Symbol.iterator; - export = iterator; -} -declare module "core-js/library/fn/symbol/key-for" { - var keyFor: typeof core.Symbol.keyFor; - export = keyFor; -} -declare module "core-js/library/fn/symbol/match" { - var match: typeof core.Symbol.match; - export = match; -} -declare module "core-js/library/fn/symbol/replace" { - var replace: typeof core.Symbol.replace; - export = replace; -} -declare module "core-js/library/fn/symbol/search" { - var search: typeof core.Symbol.search; - export = search; -} -declare module "core-js/library/fn/symbol/species" { - var species: typeof core.Symbol.species; - export = species; -} -declare module "core-js/library/fn/symbol/split" { - var split: typeof core.Symbol.split; - export = split; -} -declare module "core-js/library/fn/symbol/to-primitive" { - var toPrimitive: typeof core.Symbol.toPrimitive; - export = toPrimitive; -} -declare module "core-js/library/fn/symbol/to-string-tag" { - var toStringTag: typeof core.Symbol.toStringTag; - export = toStringTag; -} -declare module "core-js/library/fn/symbol/unscopables" { - var unscopables: typeof core.Symbol.unscopables; - export = unscopables; -} -declare module "core-js/library/es5" { - export = core; -} -declare module "core-js/library/es6" { - export = core; -} -declare module "core-js/library/es6/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/library/es6/function" { - var Function: typeof core.Function; - export = Function; -} -declare module "core-js/library/es6/map" { - var Map: typeof core.Map; - export = Map; -} -declare module "core-js/library/es6/math" { - var Math: typeof core.Math; - export = Math; -} -declare module "core-js/library/es6/number" { - var Number: typeof core.Number; - export = Number; -} -declare module "core-js/library/es6/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/library/es6/promise" { - var Promise: typeof core.Promise; - export = Promise; -} -declare module "core-js/library/es6/reflect" { - var Reflect: typeof core.Reflect; - export = Reflect; -} -declare module "core-js/library/es6/regexp" { - var RegExp: typeof core.RegExp; - export = RegExp; -} -declare module "core-js/library/es6/set" { - var Set: typeof core.Set; - export = Set; -} -declare module "core-js/library/es6/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/library/es6/symbol" { - var Symbol: typeof core.Symbol; - export = Symbol; -} -declare module "core-js/library/es6/weak-map" { - var WeakMap: typeof core.WeakMap; - export = WeakMap; -} -declare module "core-js/library/es6/weak-set" { - var WeakSet: typeof core.WeakSet; - export = WeakSet; -} -declare module "core-js/library/es7" { - export = core; -} -declare module "core-js/library/es7/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/library/es7/map" { - var Map: typeof core.Map; - export = Map; -} -declare module "core-js/library/es7/object" { - var Object: typeof core.Object; - export = Object; -} -declare module "core-js/library/es7/regexp" { - var RegExp: typeof core.RegExp; - export = RegExp; -} -declare module "core-js/library/es7/set" { - var Set: typeof core.Set; - export = Set; -} -declare module "core-js/library/es7/string" { - var String: typeof core.String; - export = String; -} -declare module "core-js/library/js" { - export = core; -} -declare module "core-js/library/js/array" { - var Array: typeof core.Array; - export = Array; -} -declare module "core-js/library/web" { - export = core; -} -declare module "core-js/library/web/dom" { - export = core; -} -declare module "core-js/library/web/immediate" { - export = core; -} -declare module "core-js/library/web/timers" { - export = core; -} +// Type definitions for core-js v0.9.7 +// Project: https://github.com/zloirock/core-js/ +// Definitions by: Ron Buckton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare type PropertyKey = string | number | symbol; + +// ############################################################################################# +// ECMAScript 6: Object & Function +// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, +// es6.object.to-string, es6.function.name and es6.function.has-instance. +// ############################################################################################# + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + * @remarks Requires `__proto__` support. + */ + setPrototypeOf(o: any, proto: any): any; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + name: string; + + /** + * Determines if a constructor object recognizes an object as one of the + * constructor’s instances. + * @param value The object to test. + */ + [Symbol.hasInstance](value: any): boolean; +} + +// ############################################################################################# +// ECMAScript 6: Array +// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find, +// and es6.array.find-index +// ############################################################################################# + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; + + [Symbol.unscopables]: any; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +// ############################################################################################# +// ECMAScript 6: String & RegExp +// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, +// es6.string.ends-with, es6.string.includes, es6.string.repeat, +// es6.string.starts-with, and es6.regexp +// ############################################################################################# + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; +} + +// ############################################################################################# +// ECMAScript 6: Number & Math +// Modules: es6.number.constructor, es6.number.statics, and es6.math +// ############################################################################################# + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[]): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +// ############################################################################################# +// ECMAScript 6: Symbols +// Modules: es6.symbol +// ############################################################################################# + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string; + + // Well-known Symbols + + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + isConcatSpreadable: symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + iterator: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; + + /** + * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive + * abstract operation. + */ + toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the with + * environment bindings of the associated objects. + */ + unscopables: symbol; + + /** + * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill + */ + useSimple(): void; + + /** + * Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill + */ + userSetter(): void; +} + +declare var Symbol: SymbolConstructor; + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface Math { + [Symbol.toStringTag]: string; +} + +interface JSON { + [Symbol.toStringTag]: string; +} + +// ############################################################################################# +// ECMAScript 6: Collections +// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set +// ############################################################################################# + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): Map; + size: number; +} + +interface MapConstructor { + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} + +declare var Map: MapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + size: number; +} + +interface SetConstructor { + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} + +declare var Set: SetConstructor; + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} + +declare var WeakMap: WeakMapConstructor; + +interface WeakSet { + add(value: T): WeakSet; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} + +declare var WeakSet: WeakSetConstructor; + +// ############################################################################################# +// ECMAScript 6: Iterators +// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable +// ############################################################################################# + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Map { + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator<[K, V]>; +} + +interface Set { + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator; +} + +interface $for extends IterableIterator { + of(callbackfn: (value: T, key: any) => void, thisArg?: any): void; + array(): T[]; + array(callbackfn: (value: T, key: any) => U, thisArg?: any): U[]; + filter(callbackfn: (value: T, key: any) => boolean, thisArg?: any): $for; + map(callbackfn: (value: T, key: any) => U, thisArg?: any): $for; +} + +declare function $for(iterable: Iterable): $for; + +// ############################################################################################# +// ECMAScript 6: Promises +// Modules: es6.promise +// ############################################################################################# + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +// ############################################################################################# +// ECMAScript 6: Reflect +// Modules: es6.reflect +// ############################################################################################# + +declare module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} + +// ############################################################################################# +// ECMAScript 7 +// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, +// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, +// es7.map.to-json, and es7.set.to-json +// ############################################################################################# + +interface Array { + includes(value: T, fromIndex?: number): boolean; +} + +interface String { + at(index: number): string; + lpad(length: number, fillStr?: string): string; + rpad(length: number, fillStr?: string): string; +} + +interface ObjectConstructor { + values(object: any): any[]; + entries(object: any): [string, any][]; + getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; +} + +interface RegExpConstructor { + escape(str: string): string; +} + +interface Map { + toJSON(): any; +} + +interface Set { + toJSON(): any; +} + +// ############################################################################################# +// Mozilla JavaScript: Array generics +// Modules: js.array.statics +// ############################################################################################# + +interface ArrayConstructor { + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(array: ArrayLike, ...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(array: ArrayLike): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(array: ArrayLike, separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(array: ArrayLike): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(array: ArrayLike): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(array: ArrayLike, start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(array: ArrayLike, start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(array: ArrayLike, ...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(array: ArrayLike): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(array: ArrayLike): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(array: ArrayLike): IterableIterator; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; + + includes(array: ArrayLike, value: T, fromIndex?: number): boolean; + turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; +} + +// ############################################################################################# +// Object - https://github.com/zloirock/core-js/#object +// Modules: core.object +// ############################################################################################# + +interface ObjectConstructor { + /** + * Non-standard. + */ + isObject(value: any): boolean; + + /** + * Non-standard. + */ + classof(value: any): string; + + /** + * Non-standard. + */ + define(target: T, mixin: any): T; + + /** + * Non-standard. + */ + make(proto: T, mixin?: any): T; +} + +// ############################################################################################# +// Console - https://github.com/zloirock/core-js/#console +// Modules: core.log +// ############################################################################################# + +interface Log extends Console { + (message?: any, ...optionalParams: any[]): void; + enable(): void; + disable(): void; +} + +/** + * Non-standard. + */ +declare var log: Log; + +// ############################################################################################# +// Dict - https://github.com/zloirock/core-js/#dict +// Modules: core.dict +// ############################################################################################# + +interface Dict { + [key: string]: T; + [key: number]: T; + //[key: symbol]: T; +} + +interface DictConstructor { + prototype: Dict; + + new (value?: Dict): Dict; + new (value?: any): Dict; + (value?: Dict): Dict; + (value?: any): Dict; + + isDict(value: any): boolean; + values(object: Dict): IterableIterator; + keys(object: Dict): IterableIterator; + entries(object: Dict): IterableIterator<[PropertyKey, T]>; + has(object: Dict, key: PropertyKey): boolean; + get(object: Dict, key: PropertyKey): T; + set(object: Dict, key: PropertyKey, value: T): Dict; + forEach(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => void, thisArg?: any): void; + map(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => U, thisArg?: any): Dict; + mapPairs(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => [PropertyKey, U], thisArg?: any): Dict; + filter(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): Dict; + some(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): boolean; + every(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): boolean; + find(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): T; + findKey(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): PropertyKey; + keyOf(object: Dict, value: T): PropertyKey; + includes(object: Dict, value: T): boolean; + reduce(object: Dict, callbackfn: (previousValue: U, value: T, key: PropertyKey, dict: Dict) => U, initialValue: U): U; + reduce(object: Dict, callbackfn: (previousValue: T, value: T, key: PropertyKey, dict: Dict) => T, initialValue?: T): T; + turn(object: Dict, callbackfn: (memo: Dict, value: T, key: PropertyKey, dict: Dict) => void, memo: Dict): Dict; + turn(object: Dict, callbackfn: (memo: Dict, value: T, key: PropertyKey, dict: Dict) => void, memo?: Dict): Dict; +} + +/** + * Non-standard. + */ +declare var Dict: DictConstructor; + +// ############################################################################################# +// Partial application - https://github.com/zloirock/core-js/#partial-application +// Modules: core.function.part +// ############################################################################################# + +interface Function { + /** + * Non-standard. + */ + part(...args: any[]): any; +} + +// ############################################################################################# +// Date formatting - https://github.com/zloirock/core-js/#date-formatting +// Modules: core.date +// ############################################################################################# + +interface Date { + /** + * Non-standard. + */ + format(template: string, locale?: string): string; + + /** + * Non-standard. + */ + formatUTC(template: string, locale?: string): string; +} + +// ############################################################################################# +// Array - https://github.com/zloirock/core-js/#array +// Modules: core.array.turn +// ############################################################################################# + +interface Array { + /** + * Non-standard. + */ + turn(callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + + /** + * Non-standard. + */ + turn(callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; +} + +// ############################################################################################# +// Number - https://github.com/zloirock/core-js/#number +// Modules: core.number.iterator +// ############################################################################################# + +interface Number { + /** + * Non-standard. + */ + [Symbol.iterator](): IterableIterator; +} + +// ############################################################################################# +// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters +// Modules: core.string.escape-html +// ############################################################################################# + +interface String { + /** + * Non-standard. + */ + escapeHTML(): string; + + /** + * Non-standard. + */ + unescapeHTML(): string; +} + +// ############################################################################################# +// delay - https://github.com/zloirock/core-js/#delay +// Modules: core.delay +// ############################################################################################# + +declare function delay(msec: number): Promise; + +declare module core { + module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; + } + + var Object: { + getPrototypeOf(o: any): any; + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + getOwnPropertyNames(o: any): string[]; + create(o: any, properties?: PropertyDescriptorMap): any; + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + defineProperties(o: any, properties: PropertyDescriptorMap): any; + seal(o: T): T; + freeze(o: T): T; + preventExtensions(o: T): T; + isSealed(o: any): boolean; + isFrozen(o: any): boolean; + isExtensible(o: any): boolean; + keys(o: any): string[]; + assign(target: any, ...sources: any[]): any; + is(value1: any, value2: any): boolean; + setPrototypeOf(o: any, proto: any): any; + getOwnPropertySymbols(o: any): symbol[]; + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; + values(object: any): any[]; + entries(object: any): any[]; + getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; + isObject(value: any): boolean; + classof(value: any): string; + define(target: T, mixin: any): T; + make(proto: T, mixin?: any): T; + }; + + var Function: { + bind(target: Function, thisArg: any, ...argArray: any[]): any; + part(target: Function, ...args: any[]): any; + }; + + var Array: { + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + from(arrayLike: ArrayLike): Array; + from(iterable: Iterable): Array; + of(...items: T[]): Array; + push(array: ArrayLike, ...items: T[]): number; + pop(array: ArrayLike): T; + concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; + join(array: ArrayLike, separator?: string): string; + reverse(array: ArrayLike): T[]; + shift(array: ArrayLike): T; + slice(array: ArrayLike, start?: number, end?: number): T[]; + sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; + splice(array: ArrayLike, start: number): T[]; + splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; + unshift(array: ArrayLike, ...items: T[]): number; + indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; + lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; + every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + entries(array: ArrayLike): IterableIterator<[number, T]>; + keys(array: ArrayLike): IterableIterator; + values(array: ArrayLike): IterableIterator; + find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; + fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; + copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; + includes(array: ArrayLike, value: T, fromIndex?: number): boolean; + turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; + turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + }; + + var String: { + codePointAt(text: string, pos: number): number; + includes(text: string, searchString: string, position?: number): boolean; + endsWith(text: string, searchString: string, endPosition?: number): boolean; + repeat(text: string, count: number): string; + fromCodePoint(...codePoints: number[]): string; + raw(template: TemplateStringsArray, ...substitutions: any[]): string; + startsWith(text: string, searchString: string, position?: number): boolean; + at(text: string, index: number): string; + lpad(text: string, length: number, fillStr?: string): string; + rpad(text: string, length: number, fillStr?: string): string; + escapeHTML(text: string): string; + unescapeHTML(text: string): string; + }; + + var Date: { + now(): number; + toISOString(date: Date): string; + format(date: Date, template: string, locale?: string): string; + formatUTC(date: Date, template: string, locale?: string): string; + }; + + var Number: { + EPSILON: number; + isFinite(number: number): boolean; + isInteger(number: number): boolean; + isNaN(number: number): boolean; + isSafeInteger(number: number): boolean; + MAX_SAFE_INTEGER: number; + MIN_SAFE_INTEGER: number; + parseFloat(string: string): number; + parseInt(string: string, radix?: number): number; + clz32(x: number): number; + imul(x: number, y: number): number; + sign(x: number): number; + log10(x: number): number; + log2(x: number): number; + log1p(x: number): number; + expm1(x: number): number; + cosh(x: number): number; + sinh(x: number): number; + tanh(x: number): number; + acosh(x: number): number; + asinh(x: number): number; + atanh(x: number): number; + hypot(...values: number[]): number; + trunc(x: number): number; + fround(x: number): number; + cbrt(x: number): number; + random(lim?: number): number; + }; + + var Math: { + clz32(x: number): number; + imul(x: number, y: number): number; + sign(x: number): number; + log10(x: number): number; + log2(x: number): number; + log1p(x: number): number; + expm1(x: number): number; + cosh(x: number): number; + sinh(x: number): number; + tanh(x: number): number; + acosh(x: number): number; + asinh(x: number): number; + atanh(x: number): number; + hypot(...values: number[]): number; + trunc(x: number): number; + fround(x: number): number; + cbrt(x: number): number; + }; + + var RegExp: { + escape(str: string): string; + }; + + var Map: MapConstructor; + var Set: SetConstructor; + var WeakMap: WeakMapConstructor; + var WeakSet: WeakSetConstructor; + var Promise: PromiseConstructor; + var Symbol: SymbolConstructor; + var Dict: DictConstructor; + var global: any; + var log: Log; + var _: boolean; + + function setTimeout(handler: any, timeout?: any, ...args: any[]): number; + + function setInterval(handler: any, timeout?: any, ...args: any[]): number; + + function setImmediate(expression: any, ...args: any[]): number; + + function clearImmediate(handle: number): void; + + function $for(iterable: Iterable): $for; + + function isIterable(value: any): boolean; + + function getIterator(iterable: Iterable): Iterator; + + interface Locale { + weekdays: string; + months: string; + } + + function addLocale(lang: string, locale: Locale): typeof core; + + function locale(lang?: string): string; + + function delay(msec: number): Promise; +} + +declare module "core-js" { + export = core; +} +declare module "core-js/shim" { + export = core; +} +declare module "core-js/core" { + export = core; +} +declare module "core-js/core/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/core/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/core/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/core/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/core/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/core/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/core/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/core/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/core/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/core/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/core/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/core/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/fn/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/fn/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/fn/clear-immediate" { + var clearImmediate: typeof core.clearImmediate; + export = clearImmediate; +} +declare module "core-js/fn/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/fn/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/fn/get-iterator" { + var getIterator: typeof core.getIterator; + export = getIterator; +} +declare module "core-js/fn/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/fn/is-iterable" { + var isIterable: typeof core.isIterable; + export = isIterable; +} +declare module "core-js/fn/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/fn/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/fn/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/fn/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/fn/set-immediate" { + var setImmediate: typeof core.setImmediate; + export = setImmediate; +} +declare module "core-js/fn/set-interval" { + var setInterval: typeof core.setInterval; + export = setInterval; +} +declare module "core-js/fn/set-timeout" { + var setTimeout: typeof core.setTimeout; + export = setTimeout; +} +declare module "core-js/fn/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/fn/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/fn/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/fn/array/concat" { + var concat: typeof core.Array.concat; + export = concat; +} +declare module "core-js/fn/array/copy-within" { + var copyWithin: typeof core.Array.copyWithin; + export = copyWithin; +} +declare module "core-js/fn/array/entries" { + var entries: typeof core.Array.entries; + export = entries; +} +declare module "core-js/fn/array/every" { + var every: typeof core.Array.every; + export = every; +} +declare module "core-js/fn/array/fill" { + var fill: typeof core.Array.fill; + export = fill; +} +declare module "core-js/fn/array/filter" { + var filter: typeof core.Array.filter; + export = filter; +} +declare module "core-js/fn/array/find" { + var find: typeof core.Array.find; + export = find; +} +declare module "core-js/fn/array/find-index" { + var findIndex: typeof core.Array.findIndex; + export = findIndex; +} +declare module "core-js/fn/array/for-each" { + var forEach: typeof core.Array.forEach; + export = forEach; +} +declare module "core-js/fn/array/from" { + var from: typeof core.Array.from; + export = from; +} +declare module "core-js/fn/array/includes" { + var includes: typeof core.Array.includes; + export = includes; +} +declare module "core-js/fn/array/index-of" { + var indexOf: typeof core.Array.indexOf; + export = indexOf; +} +declare module "core-js/fn/array/join" { + var join: typeof core.Array.join; + export = join; +} +declare module "core-js/fn/array/keys" { + var keys: typeof core.Array.keys; + export = keys; +} +declare module "core-js/fn/array/last-index-of" { + var lastIndexOf: typeof core.Array.lastIndexOf; + export = lastIndexOf; +} +declare module "core-js/fn/array/map" { + var map: typeof core.Array.map; + export = map; +} +declare module "core-js/fn/array/of" { + var of: typeof core.Array.of; + export = of; +} +declare module "core-js/fn/array/pop" { + var pop: typeof core.Array.pop; + export = pop; +} +declare module "core-js/fn/array/push" { + var push: typeof core.Array.push; + export = push; +} +declare module "core-js/fn/array/reduce" { + var reduce: typeof core.Array.reduce; + export = reduce; +} +declare module "core-js/fn/array/reduce-right" { + var reduceRight: typeof core.Array.reduceRight; + export = reduceRight; +} +declare module "core-js/fn/array/reverse" { + var reverse: typeof core.Array.reverse; + export = reverse; +} +declare module "core-js/fn/array/shift" { + var shift: typeof core.Array.shift; + export = shift; +} +declare module "core-js/fn/array/slice" { + var slice: typeof core.Array.slice; + export = slice; +} +declare module "core-js/fn/array/some" { + var some: typeof core.Array.some; + export = some; +} +declare module "core-js/fn/array/sort" { + var sort: typeof core.Array.sort; + export = sort; +} +declare module "core-js/fn/array/splice" { + var splice: typeof core.Array.splice; + export = splice; +} +declare module "core-js/fn/array/turn" { + var turn: typeof core.Array.turn; + export = turn; +} +declare module "core-js/fn/array/unshift" { + var unshift: typeof core.Array.unshift; + export = unshift; +} +declare module "core-js/fn/array/values" { + var values: typeof core.Array.values; + export = values; +} +declare module "core-js/fn/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/fn/date/add-locale" { + var addLocale: typeof core.addLocale; + export = addLocale; +} +declare module "core-js/fn/date/format" { + var format: typeof core.Date.format; + export = format; +} +declare module "core-js/fn/date/formatUTC" { + var formatUTC: typeof core.Date.formatUTC; + export = formatUTC; +} +declare module "core-js/fn/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/fn/function/has-instance" { + var hasInstance: (value: any) => boolean; + export = hasInstance; +} +declare module "core-js/fn/function/name" +{ +} +declare module "core-js/fn/function/part" { + var part: typeof core.Function.part; + export = part; +} +declare module "core-js/fn/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/fn/math/acosh" { + var acosh: typeof core.Math.acosh; + export = acosh; +} +declare module "core-js/fn/math/asinh" { + var asinh: typeof core.Math.asinh; + export = asinh; +} +declare module "core-js/fn/math/atanh" { + var atanh: typeof core.Math.atanh; + export = atanh; +} +declare module "core-js/fn/math/cbrt" { + var cbrt: typeof core.Math.cbrt; + export = cbrt; +} +declare module "core-js/fn/math/clz32" { + var clz32: typeof core.Math.clz32; + export = clz32; +} +declare module "core-js/fn/math/cosh" { + var cosh: typeof core.Math.cosh; + export = cosh; +} +declare module "core-js/fn/math/expm1" { + var expm1: typeof core.Math.expm1; + export = expm1; +} +declare module "core-js/fn/math/fround" { + var fround: typeof core.Math.fround; + export = fround; +} +declare module "core-js/fn/math/hypot" { + var hypot: typeof core.Math.hypot; + export = hypot; +} +declare module "core-js/fn/math/imul" { + var imul: typeof core.Math.imul; + export = imul; +} +declare module "core-js/fn/math/log10" { + var log10: typeof core.Math.log10; + export = log10; +} +declare module "core-js/fn/math/log1p" { + var log1p: typeof core.Math.log1p; + export = log1p; +} +declare module "core-js/fn/math/log2" { + var log2: typeof core.Math.log2; + export = log2; +} +declare module "core-js/fn/math/sign" { + var sign: typeof core.Math.sign; + export = sign; +} +declare module "core-js/fn/math/sinh" { + var sinh: typeof core.Math.sinh; + export = sinh; +} +declare module "core-js/fn/math/tanh" { + var tanh: typeof core.Math.tanh; + export = tanh; +} +declare module "core-js/fn/math/trunc" { + var trunc: typeof core.Math.trunc; + export = trunc; +} +declare module "core-js/fn/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/fn/number/epsilon" { + var EPSILON: typeof core.Number.EPSILON; + export = EPSILON; +} +declare module "core-js/fn/number/is-finite" { + var isFinite: typeof core.Number.isFinite; + export = isFinite; +} +declare module "core-js/fn/number/is-integer" { + var isInteger: typeof core.Number.isInteger; + export = isInteger; +} +declare module "core-js/fn/number/is-nan" { + var isNaN: typeof core.Number.isNaN; + export = isNaN; +} +declare module "core-js/fn/number/is-safe-integer" { + var isSafeInteger: typeof core.Number.isSafeInteger; + export = isSafeInteger; +} +declare module "core-js/fn/number/max-safe-integer" { + var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; + export = MAX_SAFE_INTEGER; +} +declare module "core-js/fn/number/min-safe-interger" { + var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; + export = MIN_SAFE_INTEGER; +} +declare module "core-js/fn/number/parse-float" { + var parseFloat: typeof core.Number.parseFloat; + export = parseFloat; +} +declare module "core-js/fn/number/parse-int" { + var parseInt: typeof core.Number.parseInt; + export = parseInt; +} +declare module "core-js/fn/number/random" { + var random: typeof core.Number.random; + export = random; +} +declare module "core-js/fn/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/fn/object/assign" { + var assign: typeof core.Object.assign; + export = assign; +} +declare module "core-js/fn/object/classof" { + var classof: typeof core.Object.classof; + export = classof; +} +declare module "core-js/fn/object/create" { + var create: typeof core.Object.create; + export = create; +} +declare module "core-js/fn/object/define" { + var define: typeof core.Object.define; + export = define; +} +declare module "core-js/fn/object/define-properties" { + var defineProperties: typeof core.Object.defineProperties; + export = defineProperties; +} +declare module "core-js/fn/object/define-property" { + var defineProperty: typeof core.Object.defineProperty; + export = defineProperty; +} +declare module "core-js/fn/object/entries" { + var entries: typeof core.Object.entries; + export = entries; +} +declare module "core-js/fn/object/freeze" { + var freeze: typeof core.Object.freeze; + export = freeze; +} +declare module "core-js/fn/object/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/fn/object/get-own-property-descriptors" { + var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; + export = getOwnPropertyDescriptors; +} +declare module "core-js/fn/object/get-own-property-names" { + var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; + export = getOwnPropertyNames; +} +declare module "core-js/fn/object/get-own-property-symbols" { + var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; + export = getOwnPropertySymbols; +} +declare module "core-js/fn/object/get-prototype-of" { + var getPrototypeOf: typeof core.Object.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/fn/object/is" { + var is: typeof core.Object.is; + export = is; +} +declare module "core-js/fn/object/is-extensible" { + var isExtensible: typeof core.Object.isExtensible; + export = isExtensible; +} +declare module "core-js/fn/object/is-frozen" { + var isFrozen: typeof core.Object.isFrozen; + export = isFrozen; +} +declare module "core-js/fn/object/is-object" { + var isObject: typeof core.Object.isObject; + export = isObject; +} +declare module "core-js/fn/object/is-sealed" { + var isSealed: typeof core.Object.isSealed; + export = isSealed; +} +declare module "core-js/fn/object/keys" { + var keys: typeof core.Object.keys; + export = keys; +} +declare module "core-js/fn/object/make" { + var make: typeof core.Object.make; + export = make; +} +declare module "core-js/fn/object/prevent-extensions" { + var preventExtensions: typeof core.Object.preventExtensions; + export = preventExtensions; +} +declare module "core-js/fn/object/seal" { + var seal: typeof core.Object.seal; + export = seal; +} +declare module "core-js/fn/object/set-prototype-of" { + var setPrototypeOf: typeof core.Object.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/fn/object/values" { + var values: typeof core.Object.values; + export = values; +} +declare module "core-js/fn/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/fn/reflect/apply" { + var apply: typeof core.Reflect.apply; + export = apply; +} +declare module "core-js/fn/reflect/construct" { + var construct: typeof core.Reflect.construct; + export = construct; +} +declare module "core-js/fn/reflect/define-property" { + var defineProperty: typeof core.Reflect.defineProperty; + export = defineProperty; +} +declare module "core-js/fn/reflect/delete-property" { + var deleteProperty: typeof core.Reflect.deleteProperty; + export = deleteProperty; +} +declare module "core-js/fn/reflect/enumerate" { + var enumerate: typeof core.Reflect.enumerate; + export = enumerate; +} +declare module "core-js/fn/reflect/get" { + var get: typeof core.Reflect.get; + export = get; +} +declare module "core-js/fn/reflect/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/fn/reflect/get-prototype-of" { + var getPrototypeOf: typeof core.Reflect.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/fn/reflect/has" { + var has: typeof core.Reflect.has; + export = has; +} +declare module "core-js/fn/reflect/is-extensible" { + var isExtensible: typeof core.Reflect.isExtensible; + export = isExtensible; +} +declare module "core-js/fn/reflect/own-keys" { + var ownKeys: typeof core.Reflect.ownKeys; + export = ownKeys; +} +declare module "core-js/fn/reflect/prevent-extensions" { + var preventExtensions: typeof core.Reflect.preventExtensions; + export = preventExtensions; +} +declare module "core-js/fn/reflect/set" { + var set: typeof core.Reflect.set; + export = set; +} +declare module "core-js/fn/reflect/set-prototype-of" { + var setPrototypeOf: typeof core.Reflect.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/fn/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/fn/regexp/escape" { + var escape: typeof core.RegExp.escape; + export = escape; +} +declare module "core-js/fn/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/fn/string/at" { + var at: typeof core.String.at; + export = at; +} +declare module "core-js/fn/string/code-point-at" { + var codePointAt: typeof core.String.codePointAt; + export = codePointAt; +} +declare module "core-js/fn/string/ends-with" { + var endsWith: typeof core.String.endsWith; + export = endsWith; +} +declare module "core-js/fn/string/escape-html" { + var escapeHTML: typeof core.String.escapeHTML; + export = escapeHTML; +} +declare module "core-js/fn/string/from-code-point" { + var fromCodePoint: typeof core.String.fromCodePoint; + export = fromCodePoint; +} +declare module "core-js/fn/string/includes" { + var includes: typeof core.String.includes; + export = includes; +} +declare module "core-js/fn/string/lpad" { + var lpad: typeof core.String.lpad; + export = lpad; +} +declare module "core-js/fn/string/raw" { + var raw: typeof core.String.raw; + export = raw; +} +declare module "core-js/fn/string/repeat" { + var repeat: typeof core.String.repeat; + export = repeat; +} +declare module "core-js/fn/string/rpad" { + var rpad: typeof core.String.rpad; + export = rpad; +} +declare module "core-js/fn/string/starts-with" { + var startsWith: typeof core.String.startsWith; + export = startsWith; +} +declare module "core-js/fn/string/unescape-html" { + var unescapeHTML: typeof core.String.unescapeHTML; + export = unescapeHTML; +} +declare module "core-js/fn/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/fn/symbol/for" { + var _for: typeof core.Symbol.for; + export = _for; +} +declare module "core-js/fn/symbol/has-instance" { + var hasInstance: typeof core.Symbol.hasInstance; + export = hasInstance; +} +declare module "core-js/fn/symbol/is-concat-spreadable" { + var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; + export = isConcatSpreadable; +} +declare module "core-js/fn/symbol/iterator" { + var iterator: typeof core.Symbol.iterator; + export = iterator; +} +declare module "core-js/fn/symbol/key-for" { + var keyFor: typeof core.Symbol.keyFor; + export = keyFor; +} +declare module "core-js/fn/symbol/match" { + var match: typeof core.Symbol.match; + export = match; +} +declare module "core-js/fn/symbol/replace" { + var replace: typeof core.Symbol.replace; + export = replace; +} +declare module "core-js/fn/symbol/search" { + var search: typeof core.Symbol.search; + export = search; +} +declare module "core-js/fn/symbol/species" { + var species: typeof core.Symbol.species; + export = species; +} +declare module "core-js/fn/symbol/split" { + var split: typeof core.Symbol.split; + export = split; +} +declare module "core-js/fn/symbol/to-primitive" { + var toPrimitive: typeof core.Symbol.toPrimitive; + export = toPrimitive; +} +declare module "core-js/fn/symbol/to-string-tag" { + var toStringTag: typeof core.Symbol.toStringTag; + export = toStringTag; +} +declare module "core-js/fn/symbol/unscopables" { + var unscopables: typeof core.Symbol.unscopables; + export = unscopables; +} +declare module "core-js/es5" { + export = core; +} +declare module "core-js/es6" { + export = core; +} +declare module "core-js/es6/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/es6/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/es6/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/es6/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/es6/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/es6/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/es6/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/es6/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/es6/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/es6/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/es6/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/es6/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/es6/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/es6/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/es7" { + export = core; +} +declare module "core-js/es7/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/es7/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/es7/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/es7/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/es7/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/es7/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/js" { + export = core; +} +declare module "core-js/js/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/web" { + export = core; +} +declare module "core-js/web/dom" { + export = core; +} +declare module "core-js/web/immediate" { + export = core; +} +declare module "core-js/web/timers" { + export = core; +} +declare module "core-js/library" { + export = core; +} +declare module "core-js/library/shim" { + export = core; +} +declare module "core-js/library/core" { + export = core; +} +declare module "core-js/library/core/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/library/core/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/library/core/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/library/core/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/library/core/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/library/core/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/library/core/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/library/core/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/library/core/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/library/core/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/library/core/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/library/core/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/library/fn/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/library/fn/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/library/fn/clear-immediate" { + var clearImmediate: typeof core.clearImmediate; + export = clearImmediate; +} +declare module "core-js/library/fn/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/library/fn/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/library/fn/get-iterator" { + var getIterator: typeof core.getIterator; + export = getIterator; +} +declare module "core-js/library/fn/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/library/fn/is-iterable" { + var isIterable: typeof core.isIterable; + export = isIterable; +} +declare module "core-js/library/fn/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/library/fn/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/library/fn/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/library/fn/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/library/fn/set-immediate" { + var setImmediate: typeof core.setImmediate; + export = setImmediate; +} +declare module "core-js/library/fn/set-interval" { + var setInterval: typeof core.setInterval; + export = setInterval; +} +declare module "core-js/library/fn/set-timeout" { + var setTimeout: typeof core.setTimeout; + export = setTimeout; +} +declare module "core-js/library/fn/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/library/fn/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/library/fn/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/library/fn/array/concat" { + var concat: typeof core.Array.concat; + export = concat; +} +declare module "core-js/library/fn/array/copy-within" { + var copyWithin: typeof core.Array.copyWithin; + export = copyWithin; +} +declare module "core-js/library/fn/array/entries" { + var entries: typeof core.Array.entries; + export = entries; +} +declare module "core-js/library/fn/array/every" { + var every: typeof core.Array.every; + export = every; +} +declare module "core-js/library/fn/array/fill" { + var fill: typeof core.Array.fill; + export = fill; +} +declare module "core-js/library/fn/array/filter" { + var filter: typeof core.Array.filter; + export = filter; +} +declare module "core-js/library/fn/array/find" { + var find: typeof core.Array.find; + export = find; +} +declare module "core-js/library/fn/array/find-index" { + var findIndex: typeof core.Array.findIndex; + export = findIndex; +} +declare module "core-js/library/fn/array/for-each" { + var forEach: typeof core.Array.forEach; + export = forEach; +} +declare module "core-js/library/fn/array/from" { + var from: typeof core.Array.from; + export = from; +} +declare module "core-js/library/fn/array/includes" { + var includes: typeof core.Array.includes; + export = includes; +} +declare module "core-js/library/fn/array/index-of" { + var indexOf: typeof core.Array.indexOf; + export = indexOf; +} +declare module "core-js/library/fn/array/join" { + var join: typeof core.Array.join; + export = join; +} +declare module "core-js/library/fn/array/keys" { + var keys: typeof core.Array.keys; + export = keys; +} +declare module "core-js/library/fn/array/last-index-of" { + var lastIndexOf: typeof core.Array.lastIndexOf; + export = lastIndexOf; +} +declare module "core-js/library/fn/array/map" { + var map: typeof core.Array.map; + export = map; +} +declare module "core-js/library/fn/array/of" { + var of: typeof core.Array.of; + export = of; +} +declare module "core-js/library/fn/array/pop" { + var pop: typeof core.Array.pop; + export = pop; +} +declare module "core-js/library/fn/array/push" { + var push: typeof core.Array.push; + export = push; +} +declare module "core-js/library/fn/array/reduce" { + var reduce: typeof core.Array.reduce; + export = reduce; +} +declare module "core-js/library/fn/array/reduce-right" { + var reduceRight: typeof core.Array.reduceRight; + export = reduceRight; +} +declare module "core-js/library/fn/array/reverse" { + var reverse: typeof core.Array.reverse; + export = reverse; +} +declare module "core-js/library/fn/array/shift" { + var shift: typeof core.Array.shift; + export = shift; +} +declare module "core-js/library/fn/array/slice" { + var slice: typeof core.Array.slice; + export = slice; +} +declare module "core-js/library/fn/array/some" { + var some: typeof core.Array.some; + export = some; +} +declare module "core-js/library/fn/array/sort" { + var sort: typeof core.Array.sort; + export = sort; +} +declare module "core-js/library/fn/array/splice" { + var splice: typeof core.Array.splice; + export = splice; +} +declare module "core-js/library/fn/array/turn" { + var turn: typeof core.Array.turn; + export = turn; +} +declare module "core-js/library/fn/array/unshift" { + var unshift: typeof core.Array.unshift; + export = unshift; +} +declare module "core-js/library/fn/array/values" { + var values: typeof core.Array.values; + export = values; +} +declare module "core-js/library/fn/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/library/fn/date/add-locale" { + var addLocale: typeof core.addLocale; + export = addLocale; +} +declare module "core-js/library/fn/date/format" { + var format: typeof core.Date.format; + export = format; +} +declare module "core-js/library/fn/date/formatUTC" { + var formatUTC: typeof core.Date.formatUTC; + export = formatUTC; +} +declare module "core-js/library/fn/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/library/fn/function/has-instance" { + var hasInstance: (value: any) => boolean; + export = hasInstance; +} +declare module "core-js/library/fn/function/name" { +} +declare module "core-js/library/fn/function/part" { + var part: typeof core.Function.part; + export = part; +} +declare module "core-js/library/fn/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/library/fn/math/acosh" { + var acosh: typeof core.Math.acosh; + export = acosh; +} +declare module "core-js/library/fn/math/asinh" { + var asinh: typeof core.Math.asinh; + export = asinh; +} +declare module "core-js/library/fn/math/atanh" { + var atanh: typeof core.Math.atanh; + export = atanh; +} +declare module "core-js/library/fn/math/cbrt" { + var cbrt: typeof core.Math.cbrt; + export = cbrt; +} +declare module "core-js/library/fn/math/clz32" { + var clz32: typeof core.Math.clz32; + export = clz32; +} +declare module "core-js/library/fn/math/cosh" { + var cosh: typeof core.Math.cosh; + export = cosh; +} +declare module "core-js/library/fn/math/expm1" { + var expm1: typeof core.Math.expm1; + export = expm1; +} +declare module "core-js/library/fn/math/fround" { + var fround: typeof core.Math.fround; + export = fround; +} +declare module "core-js/library/fn/math/hypot" { + var hypot: typeof core.Math.hypot; + export = hypot; +} +declare module "core-js/library/fn/math/imul" { + var imul: typeof core.Math.imul; + export = imul; +} +declare module "core-js/library/fn/math/log10" { + var log10: typeof core.Math.log10; + export = log10; +} +declare module "core-js/library/fn/math/log1p" { + var log1p: typeof core.Math.log1p; + export = log1p; +} +declare module "core-js/library/fn/math/log2" { + var log2: typeof core.Math.log2; + export = log2; +} +declare module "core-js/library/fn/math/sign" { + var sign: typeof core.Math.sign; + export = sign; +} +declare module "core-js/library/fn/math/sinh" { + var sinh: typeof core.Math.sinh; + export = sinh; +} +declare module "core-js/library/fn/math/tanh" { + var tanh: typeof core.Math.tanh; + export = tanh; +} +declare module "core-js/library/fn/math/trunc" { + var trunc: typeof core.Math.trunc; + export = trunc; +} +declare module "core-js/library/fn/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/library/fn/number/epsilon" { + var EPSILON: typeof core.Number.EPSILON; + export = EPSILON; +} +declare module "core-js/library/fn/number/is-finite" { + var isFinite: typeof core.Number.isFinite; + export = isFinite; +} +declare module "core-js/library/fn/number/is-integer" { + var isInteger: typeof core.Number.isInteger; + export = isInteger; +} +declare module "core-js/library/fn/number/is-nan" { + var isNaN: typeof core.Number.isNaN; + export = isNaN; +} +declare module "core-js/library/fn/number/is-safe-integer" { + var isSafeInteger: typeof core.Number.isSafeInteger; + export = isSafeInteger; +} +declare module "core-js/library/fn/number/max-safe-integer" { + var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; + export = MAX_SAFE_INTEGER; +} +declare module "core-js/library/fn/number/min-safe-interger" { + var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; + export = MIN_SAFE_INTEGER; +} +declare module "core-js/library/fn/number/parse-float" { + var parseFloat: typeof core.Number.parseFloat; + export = parseFloat; +} +declare module "core-js/library/fn/number/parse-int" { + var parseInt: typeof core.Number.parseInt; + export = parseInt; +} +declare module "core-js/library/fn/number/random" { + var random: typeof core.Number.random; + export = random; +} +declare module "core-js/library/fn/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/library/fn/object/assign" { + var assign: typeof core.Object.assign; + export = assign; +} +declare module "core-js/library/fn/object/classof" { + var classof: typeof core.Object.classof; + export = classof; +} +declare module "core-js/library/fn/object/create" { + var create: typeof core.Object.create; + export = create; +} +declare module "core-js/library/fn/object/define" { + var define: typeof core.Object.define; + export = define; +} +declare module "core-js/library/fn/object/define-properties" { + var defineProperties: typeof core.Object.defineProperties; + export = defineProperties; +} +declare module "core-js/library/fn/object/define-property" { + var defineProperty: typeof core.Object.defineProperty; + export = defineProperty; +} +declare module "core-js/library/fn/object/entries" { + var entries: typeof core.Object.entries; + export = entries; +} +declare module "core-js/library/fn/object/freeze" { + var freeze: typeof core.Object.freeze; + export = freeze; +} +declare module "core-js/library/fn/object/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/library/fn/object/get-own-property-descriptors" { + var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; + export = getOwnPropertyDescriptors; +} +declare module "core-js/library/fn/object/get-own-property-names" { + var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; + export = getOwnPropertyNames; +} +declare module "core-js/library/fn/object/get-own-property-symbols" { + var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; + export = getOwnPropertySymbols; +} +declare module "core-js/library/fn/object/get-prototype-of" { + var getPrototypeOf: typeof core.Object.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/library/fn/object/is" { + var is: typeof core.Object.is; + export = is; +} +declare module "core-js/library/fn/object/is-extensible" { + var isExtensible: typeof core.Object.isExtensible; + export = isExtensible; +} +declare module "core-js/library/fn/object/is-frozen" { + var isFrozen: typeof core.Object.isFrozen; + export = isFrozen; +} +declare module "core-js/library/fn/object/is-object" { + var isObject: typeof core.Object.isObject; + export = isObject; +} +declare module "core-js/library/fn/object/is-sealed" { + var isSealed: typeof core.Object.isSealed; + export = isSealed; +} +declare module "core-js/library/fn/object/keys" { + var keys: typeof core.Object.keys; + export = keys; +} +declare module "core-js/library/fn/object/make" { + var make: typeof core.Object.make; + export = make; +} +declare module "core-js/library/fn/object/prevent-extensions" { + var preventExtensions: typeof core.Object.preventExtensions; + export = preventExtensions; +} +declare module "core-js/library/fn/object/seal" { + var seal: typeof core.Object.seal; + export = seal; +} +declare module "core-js/library/fn/object/set-prototype-of" { + var setPrototypeOf: typeof core.Object.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/library/fn/object/values" { + var values: typeof core.Object.values; + export = values; +} +declare module "core-js/library/fn/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/library/fn/reflect/apply" { + var apply: typeof core.Reflect.apply; + export = apply; +} +declare module "core-js/library/fn/reflect/construct" { + var construct: typeof core.Reflect.construct; + export = construct; +} +declare module "core-js/library/fn/reflect/define-property" { + var defineProperty: typeof core.Reflect.defineProperty; + export = defineProperty; +} +declare module "core-js/library/fn/reflect/delete-property" { + var deleteProperty: typeof core.Reflect.deleteProperty; + export = deleteProperty; +} +declare module "core-js/library/fn/reflect/enumerate" { + var enumerate: typeof core.Reflect.enumerate; + export = enumerate; +} +declare module "core-js/library/fn/reflect/get" { + var get: typeof core.Reflect.get; + export = get; +} +declare module "core-js/library/fn/reflect/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/library/fn/reflect/get-prototype-of" { + var getPrototypeOf: typeof core.Reflect.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/library/fn/reflect/has" { + var has: typeof core.Reflect.has; + export = has; +} +declare module "core-js/library/fn/reflect/is-extensible" { + var isExtensible: typeof core.Reflect.isExtensible; + export = isExtensible; +} +declare module "core-js/library/fn/reflect/own-keys" { + var ownKeys: typeof core.Reflect.ownKeys; + export = ownKeys; +} +declare module "core-js/library/fn/reflect/prevent-extensions" { + var preventExtensions: typeof core.Reflect.preventExtensions; + export = preventExtensions; +} +declare module "core-js/library/fn/reflect/set" { + var set: typeof core.Reflect.set; + export = set; +} +declare module "core-js/library/fn/reflect/set-prototype-of" { + var setPrototypeOf: typeof core.Reflect.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/library/fn/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/library/fn/regexp/escape" { + var escape: typeof core.RegExp.escape; + export = escape; +} +declare module "core-js/library/fn/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/library/fn/string/at" { + var at: typeof core.String.at; + export = at; +} +declare module "core-js/library/fn/string/code-point-at" { + var codePointAt: typeof core.String.codePointAt; + export = codePointAt; +} +declare module "core-js/library/fn/string/ends-with" { + var endsWith: typeof core.String.endsWith; + export = endsWith; +} +declare module "core-js/library/fn/string/escape-html" { + var escapeHTML: typeof core.String.escapeHTML; + export = escapeHTML; +} +declare module "core-js/library/fn/string/from-code-point" { + var fromCodePoint: typeof core.String.fromCodePoint; + export = fromCodePoint; +} +declare module "core-js/library/fn/string/includes" { + var includes: typeof core.String.includes; + export = includes; +} +declare module "core-js/library/fn/string/lpad" { + var lpad: typeof core.String.lpad; + export = lpad; +} +declare module "core-js/library/fn/string/raw" { + var raw: typeof core.String.raw; + export = raw; +} +declare module "core-js/library/fn/string/repeat" { + var repeat: typeof core.String.repeat; + export = repeat; +} +declare module "core-js/library/fn/string/rpad" { + var rpad: typeof core.String.rpad; + export = rpad; +} +declare module "core-js/library/fn/string/starts-with" { + var startsWith: typeof core.String.startsWith; + export = startsWith; +} +declare module "core-js/library/fn/string/unescape-html" { + var unescapeHTML: typeof core.String.unescapeHTML; + export = unescapeHTML; +} +declare module "core-js/library/fn/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/library/fn/symbol/for" { + var _for: typeof core.Symbol.for; + export = _for; +} +declare module "core-js/library/fn/symbol/has-instance" { + var hasInstance: typeof core.Symbol.hasInstance; + export = hasInstance; +} +declare module "core-js/library/fn/symbol/is-concat-spreadable" { + var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; + export = isConcatSpreadable; +} +declare module "core-js/library/fn/symbol/iterator" { + var iterator: typeof core.Symbol.iterator; + export = iterator; +} +declare module "core-js/library/fn/symbol/key-for" { + var keyFor: typeof core.Symbol.keyFor; + export = keyFor; +} +declare module "core-js/library/fn/symbol/match" { + var match: typeof core.Symbol.match; + export = match; +} +declare module "core-js/library/fn/symbol/replace" { + var replace: typeof core.Symbol.replace; + export = replace; +} +declare module "core-js/library/fn/symbol/search" { + var search: typeof core.Symbol.search; + export = search; +} +declare module "core-js/library/fn/symbol/species" { + var species: typeof core.Symbol.species; + export = species; +} +declare module "core-js/library/fn/symbol/split" { + var split: typeof core.Symbol.split; + export = split; +} +declare module "core-js/library/fn/symbol/to-primitive" { + var toPrimitive: typeof core.Symbol.toPrimitive; + export = toPrimitive; +} +declare module "core-js/library/fn/symbol/to-string-tag" { + var toStringTag: typeof core.Symbol.toStringTag; + export = toStringTag; +} +declare module "core-js/library/fn/symbol/unscopables" { + var unscopables: typeof core.Symbol.unscopables; + export = unscopables; +} +declare module "core-js/library/es5" { + export = core; +} +declare module "core-js/library/es6" { + export = core; +} +declare module "core-js/library/es6/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/library/es6/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/library/es6/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/library/es6/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/library/es6/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/library/es6/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/library/es6/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/library/es6/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/library/es6/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/library/es6/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/library/es6/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/library/es6/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/library/es6/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/library/es6/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/library/es7" { + export = core; +} +declare module "core-js/library/es7/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/library/es7/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/library/es7/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/library/es7/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/library/es7/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/library/es7/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/library/js" { + export = core; +} +declare module "core-js/library/js/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/library/web" { + export = core; +} +declare module "core-js/library/web/dom" { + export = core; +} +declare module "core-js/library/web/immediate" { + export = core; +} +declare module "core-js/library/web/timers" { + export = core; +} diff --git a/csv-stringify/csv-stringify-tests.ts b/csv-stringify/csv-stringify-tests.ts index e28ddb8f8..842a2f106 100644 --- a/csv-stringify/csv-stringify-tests.ts +++ b/csv-stringify/csv-stringify-tests.ts @@ -1,22 +1,22 @@ -/// - -import stringify = require("csv-stringify"); - - -stringify([["1", "2", "3"], ["4", "5", "6"]], (error: Error, output: string): void => { - // nothing -}); - -stringify([["1", "2", "3"], ["4", "5", "6"]], { - delimiter: "," -}, (error: Error, output: string): void => { - // nothing -}); - - -var s = stringify({ delimiter: "," }); -s.write(["1", "2", "3"]); - - - - +/// + +import stringify = require("csv-stringify"); + + +stringify([["1", "2", "3"], ["4", "5", "6"]], (error: Error, output: string): void => { + // nothing +}); + +stringify([["1", "2", "3"], ["4", "5", "6"]], { + delimiter: "," +}, (error: Error, output: string): void => { + // nothing +}); + + +var s = stringify({ delimiter: "," }); +s.write(["1", "2", "3"]); + + + + diff --git a/csv-stringify/csv-stringify.d.ts b/csv-stringify/csv-stringify.d.ts index 7f46d53f6..6e5eb8c82 100644 --- a/csv-stringify/csv-stringify.d.ts +++ b/csv-stringify/csv-stringify.d.ts @@ -1,83 +1,83 @@ -// Type definitions for csv-stringify 0.0.6 -// Project: https://github.com/wdavidw/node-csv-stringify -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "csv-stringify" { - - module stringify { - interface StringifyOpts { - /** - * List of fields, applied when transform returns an object, order matters, read the transformer documentation for additionnal information, columns are auto discovered when the user write object, see the "header" option on how to print columns names on the first line. - */ - columns?: string[]; - /** - * Set the field delimiter, one character only, defaults to a comma. - */ - delimiter?: string; - /** - * Add the value of "options.rowDelimiter" on the last line, default to true. - */ - eof?: boolean; - /** - * Defaults to the escape read option. - */ - escape?: boolean; - /** - * Display the column names on the first line if the columns option is provided or discovered. - */ - header?: boolean; - /** - * String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). - */ - lineBreaks?: string; - /** - * Defaults to the quote read option. - */ - quote?: string; - /** - * Boolean, default to false, quote all the non-empty fields even if not required. - */ - quoted?: boolean; - /** - * Boolean, no default, quote empty fields? If specified, overrides quotedString for empty strings. - */ - quotedEmpty?: boolean; - /** - * Boolean, default to false, quote all fields of type string even if not required. - */ - quotedString?: boolean; - /** - * String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). - */ - rowDelimiter?: string; - - } - - interface Stringifier extends NodeJS.ReadWriteStream { - - // Stringifier stream takes array of strings - write(line: string[]): boolean; - - // repeat declarations from NodeJS.WritableStream to avoid compile error - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - } - } - - /** - * Callback version: string in --> callback with string out - */ - function stringify(input: any[][], opts: stringify.StringifyOpts, callback: (error: Error, output: string) => void): void; - function stringify(input: any[][], callback: (error: Error, output: string) => void): void; - - /** - * Streaming stringifier - */ - function stringify(opts: stringify.StringifyOpts): stringify.Stringifier; - - export = stringify; -} +// Type definitions for csv-stringify 0.0.6 +// Project: https://github.com/wdavidw/node-csv-stringify +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "csv-stringify" { + + module stringify { + interface StringifyOpts { + /** + * List of fields, applied when transform returns an object, order matters, read the transformer documentation for additionnal information, columns are auto discovered when the user write object, see the "header" option on how to print columns names on the first line. + */ + columns?: string[]; + /** + * Set the field delimiter, one character only, defaults to a comma. + */ + delimiter?: string; + /** + * Add the value of "options.rowDelimiter" on the last line, default to true. + */ + eof?: boolean; + /** + * Defaults to the escape read option. + */ + escape?: boolean; + /** + * Display the column names on the first line if the columns option is provided or discovered. + */ + header?: boolean; + /** + * String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). + */ + lineBreaks?: string; + /** + * Defaults to the quote read option. + */ + quote?: string; + /** + * Boolean, default to false, quote all the non-empty fields even if not required. + */ + quoted?: boolean; + /** + * Boolean, no default, quote empty fields? If specified, overrides quotedString for empty strings. + */ + quotedEmpty?: boolean; + /** + * Boolean, default to false, quote all fields of type string even if not required. + */ + quotedString?: boolean; + /** + * String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). + */ + rowDelimiter?: string; + + } + + interface Stringifier extends NodeJS.ReadWriteStream { + + // Stringifier stream takes array of strings + write(line: string[]): boolean; + + // repeat declarations from NodeJS.WritableStream to avoid compile error + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + } + } + + /** + * Callback version: string in --> callback with string out + */ + function stringify(input: any[][], opts: stringify.StringifyOpts, callback: (error: Error, output: string) => void): void; + function stringify(input: any[][], callback: (error: Error, output: string) => void): void; + + /** + * Streaming stringifier + */ + function stringify(opts: stringify.StringifyOpts): stringify.Stringifier; + + export = stringify; +} diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index f8b560607..d6ada278c 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -1,40 +1,40 @@ -/// - -function StepSample() { - type Callback = cucumber.CallbackStepDefinition; - var step = this; - var hook = this; - - hook.Before(function(scenario, callback){ - scenario.isFailed() && callback.pending(); - }) - - hook.Around(function(scenario, runScenario) { - scenario.isFailed() && runScenario(null, function(){ - console.log('finish tasks'); - }); - }); - - hook.registerHandler('AfterFeatures', function (event, callback) { - callback(); - }); - - step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback:Callback) { - this.visit('https://github.com/cucumber/cucumber-js', callback); - }); - - step.When(/^I go to the README file$/, function(title:string, callback:Callback) { - callback.pending(); - }); - - step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback:Callback) { - var pageTitle = this.browser.text('title'); - - if (title === pageTitle) { - callback(); - } else { - callback(new Error("Expected to be on page with title " + title)); - } - }); -} - +/// + +function StepSample() { + type Callback = cucumber.CallbackStepDefinition; + var step = this; + var hook = this; + + hook.Before(function(scenario, callback){ + scenario.isFailed() && callback.pending(); + }) + + hook.Around(function(scenario, runScenario) { + scenario.isFailed() && runScenario(null, function(){ + console.log('finish tasks'); + }); + }); + + hook.registerHandler('AfterFeatures', function (event, callback) { + callback(); + }); + + step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback:Callback) { + this.visit('https://github.com/cucumber/cucumber-js', callback); + }); + + step.When(/^I go to the README file$/, function(title:string, callback:Callback) { + callback.pending(); + }); + + step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback:Callback) { + var pageTitle = this.browser.text('title'); + + if (title === pageTitle) { + callback(); + } else { + callback(new Error("Expected to be on page with title " + title)); + } + }); +} + diff --git a/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams b/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams +++ b/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams b/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams +++ b/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams b/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams +++ b/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams b/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams +++ b/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/domo/domo-tests.ts b/domo/domo-tests.ts index 2f56be606..cce14fb68 100644 --- a/domo/domo-tests.ts +++ b/domo/domo-tests.ts @@ -1,66 +1,66 @@ -/// - -function opacity(pct) { - return { opacity: String(pct / 100), filter: "alpha(opacity=" + pct + ")" } -} - -HTML({ lang: "en" }, - HEAD( - TITLE("Welcome to d?mo"), - STYLE({ type: "text/css" }, - STYLE.on("body", { textAlign: "center", fontSize: 50 }), - STYLE.on("h1", opacity(50), { background: "#000", color: "#fff" }) - ) - ), - BODY(H1("Welcome to d?mo")) -); - -var withDomo = A({ href: "http://domo-js.com" }, "Learn about d?mo"); - -var withoutDomo = document.createElement("a"); -withoutDomo.setAttribute("href", "http://domo-js.com"); -withoutDomo.appendChild(document.createTextNode("Learn about d?mo")); - -var styleSheet = - STYLE({ type: "text/css" }, - STYLE.on("a", { color: "red" }), - STYLE.on("*", { margin: 0, padding: 0 }) - ); - -var blue = "#3B5998"; -var gray = "#3B3B3B"; -var defaultRadius = 10; - -function roundedCorners(radius) { - return { - borderRadius: radius, - WebkitBorderRadius: radius, - MozBorderRadius: radius - } -}; - -var styleSheet2 = - STYLE({ type: "text/css" }, - STYLE.on("h2", { color: gray }, roundedCorners(defaultRadius)), - STYLE.on("h1", { color: blue }, roundedCorners(defaultRadius * 2)) - ); - -var nestedStyles = - STYLE({ type: "text/css" }, - STYLE.on("a", { color: "red" }, - STYLE.on("img", { borderWidth: 0 }) - ) - ); - -var normalStyles = - STYLE({ type: "text/css" }, - STYLE.on("a", { color: "red" }), - STYLE.on("a img", { borderWidth: 0 }) - ); - -var domo = domo.global(false); - -domo.HTML( - domo.HEAD(domo.TITLE("Hello, world.")), - domo.BODY("Hello, world.") +/// + +function opacity(pct) { + return { opacity: String(pct / 100), filter: "alpha(opacity=" + pct + ")" } +} + +HTML({ lang: "en" }, + HEAD( + TITLE("Welcome to d?mo"), + STYLE({ type: "text/css" }, + STYLE.on("body", { textAlign: "center", fontSize: 50 }), + STYLE.on("h1", opacity(50), { background: "#000", color: "#fff" }) + ) + ), + BODY(H1("Welcome to d?mo")) +); + +var withDomo = A({ href: "http://domo-js.com" }, "Learn about d?mo"); + +var withoutDomo = document.createElement("a"); +withoutDomo.setAttribute("href", "http://domo-js.com"); +withoutDomo.appendChild(document.createTextNode("Learn about d?mo")); + +var styleSheet = + STYLE({ type: "text/css" }, + STYLE.on("a", { color: "red" }), + STYLE.on("*", { margin: 0, padding: 0 }) + ); + +var blue = "#3B5998"; +var gray = "#3B3B3B"; +var defaultRadius = 10; + +function roundedCorners(radius) { + return { + borderRadius: radius, + WebkitBorderRadius: radius, + MozBorderRadius: radius + } +}; + +var styleSheet2 = + STYLE({ type: "text/css" }, + STYLE.on("h2", { color: gray }, roundedCorners(defaultRadius)), + STYLE.on("h1", { color: blue }, roundedCorners(defaultRadius * 2)) + ); + +var nestedStyles = + STYLE({ type: "text/css" }, + STYLE.on("a", { color: "red" }, + STYLE.on("img", { borderWidth: 0 }) + ) + ); + +var normalStyles = + STYLE({ type: "text/css" }, + STYLE.on("a", { color: "red" }), + STYLE.on("a img", { borderWidth: 0 }) + ); + +var domo = domo.global(false); + +domo.HTML( + domo.HEAD(domo.TITLE("Hello, world.")), + domo.BODY("Hello, world.") ); \ No newline at end of file diff --git a/domo/domo-tests.ts.tscparams b/domo/domo-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/domo/domo-tests.ts.tscparams +++ b/domo/domo-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/domo/domo.d.ts b/domo/domo.d.ts index 73555dcf8..d7d0d940f 100644 --- a/domo/domo.d.ts +++ b/domo/domo.d.ts @@ -1,121 +1,121 @@ -// Type definitions for Domo 0.5 -// Project: http://domo-js.com/ -// Definitions by: Steve Fenton -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -interface Domo { - (attributes?: Object): string; - (attributes?: Object, ...content: string[]): string; - on(element: string, ...styles: Object[]): string; -} - -declare var A: Domo; -declare var ABBR: Domo; -declare var ACRONYM: Domo; -declare var ADDRESS: Domo; -declare var AREA: Domo; -declare var ARTICLE: Domo; -declare var ASIDE: Domo; -declare var AUDIO: Domo; -declare var B: Domo; -declare var BDI: Domo; -declare var BDO: Domo; -declare var BIG: Domo; -declare var BLOCKQUOTE: Domo; -declare var BODY: Domo; -declare var BR: Domo; -declare var BUTTON: Domo; -declare var CANVAS: Domo; -declare var CAPTION: Domo; -declare var CITE: Domo; -declare var CODE: Domo; -declare var COL: Domo; -declare var COLGROUP: Domo; -declare var COMMAND: Domo; -declare var DATALIST: Domo; -declare var DD: Domo; -declare var DEL: Domo; -declare var DETAILS: Domo; -declare var DFN: Domo; -declare var DIV: Domo; -declare var DL: Domo; -declare var DT: Domo; -declare var EM: Domo; -declare var EMBED: Domo; -declare var FIELDSET: Domo; -declare var FIGCAPTION: Domo; -declare var FIGURE: Domo; -declare var FOOTER: Domo; -declare var FORM: Domo; -declare var FRAME: Domo; -declare var FRAMESET: Domo; -declare var H1: Domo; -declare var H2: Domo; -declare var H3: Domo; -declare var H4: Domo; -declare var H5: Domo; -declare var H6: Domo; -declare var HEAD: Domo; -declare var HEADER: Domo; -declare var HGROUP: Domo; -declare var HR: Domo; -declare var HTML: Domo; -declare var I: Domo; -declare var IFRAME: Domo; -declare var IMG: Domo; -declare var INPUT: Domo; -declare var INS: Domo; -declare var KBD: Domo; -declare var KEYGEN: Domo; -declare var LABEL: Domo; -declare var LEGEND: Domo; -declare var LI: Domo; -declare var LINK: Domo; -declare var MAP: Domo; -declare var MARK: Domo; -declare var META: Domo; -declare var METER: Domo; -declare var NAV: Domo; -declare var NOSCRIPT: Domo; -declare var OBJECT: Domo; -declare var OL: Domo; -declare var OPTGROUP: Domo; -declare var OPTION: Domo; -declare var OUTPUT: Domo; -declare var P: Domo; -declare var PARAM: Domo; -declare var PRE: Domo; -declare var PROGRESS: Domo; -declare var Q: Domo; -declare var RP: Domo; -declare var RT: Domo; -declare var RUBY: Domo; -declare var SAMP: Domo; -declare var SCRIPT: Domo; -declare var SECTION: Domo; -declare var SELECT: Domo; -declare var SMALL: Domo; -declare var SOURCE: Domo; -declare var SPAN: Domo; -declare var SPLIT: Domo; -declare var STRONG: Domo; -declare var STYLE: Domo; -declare var SUB: Domo; -declare var SUMMARY: Domo; -declare var SUP: Domo; -declare var TABLE: Domo; -declare var TBODY: Domo; -declare var TD: Domo; -declare var TEXTAREA: Domo; -declare var TFOOT: Domo; -declare var TH: Domo; -declare var THEAD: Domo; -declare var TIME: Domo; -declare var TITLE: Domo; -declare var TR: Domo; -declare var TRACK: Domo; -declare var TT: Domo; -declare var UL: Domo; -declare var VAR: Domo; -declare var VIDEO: Domo; -declare var WBR: Domo; +// Type definitions for Domo 0.5 +// Project: http://domo-js.com/ +// Definitions by: Steve Fenton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Domo { + (attributes?: Object): string; + (attributes?: Object, ...content: string[]): string; + on(element: string, ...styles: Object[]): string; +} + +declare var A: Domo; +declare var ABBR: Domo; +declare var ACRONYM: Domo; +declare var ADDRESS: Domo; +declare var AREA: Domo; +declare var ARTICLE: Domo; +declare var ASIDE: Domo; +declare var AUDIO: Domo; +declare var B: Domo; +declare var BDI: Domo; +declare var BDO: Domo; +declare var BIG: Domo; +declare var BLOCKQUOTE: Domo; +declare var BODY: Domo; +declare var BR: Domo; +declare var BUTTON: Domo; +declare var CANVAS: Domo; +declare var CAPTION: Domo; +declare var CITE: Domo; +declare var CODE: Domo; +declare var COL: Domo; +declare var COLGROUP: Domo; +declare var COMMAND: Domo; +declare var DATALIST: Domo; +declare var DD: Domo; +declare var DEL: Domo; +declare var DETAILS: Domo; +declare var DFN: Domo; +declare var DIV: Domo; +declare var DL: Domo; +declare var DT: Domo; +declare var EM: Domo; +declare var EMBED: Domo; +declare var FIELDSET: Domo; +declare var FIGCAPTION: Domo; +declare var FIGURE: Domo; +declare var FOOTER: Domo; +declare var FORM: Domo; +declare var FRAME: Domo; +declare var FRAMESET: Domo; +declare var H1: Domo; +declare var H2: Domo; +declare var H3: Domo; +declare var H4: Domo; +declare var H5: Domo; +declare var H6: Domo; +declare var HEAD: Domo; +declare var HEADER: Domo; +declare var HGROUP: Domo; +declare var HR: Domo; +declare var HTML: Domo; +declare var I: Domo; +declare var IFRAME: Domo; +declare var IMG: Domo; +declare var INPUT: Domo; +declare var INS: Domo; +declare var KBD: Domo; +declare var KEYGEN: Domo; +declare var LABEL: Domo; +declare var LEGEND: Domo; +declare var LI: Domo; +declare var LINK: Domo; +declare var MAP: Domo; +declare var MARK: Domo; +declare var META: Domo; +declare var METER: Domo; +declare var NAV: Domo; +declare var NOSCRIPT: Domo; +declare var OBJECT: Domo; +declare var OL: Domo; +declare var OPTGROUP: Domo; +declare var OPTION: Domo; +declare var OUTPUT: Domo; +declare var P: Domo; +declare var PARAM: Domo; +declare var PRE: Domo; +declare var PROGRESS: Domo; +declare var Q: Domo; +declare var RP: Domo; +declare var RT: Domo; +declare var RUBY: Domo; +declare var SAMP: Domo; +declare var SCRIPT: Domo; +declare var SECTION: Domo; +declare var SELECT: Domo; +declare var SMALL: Domo; +declare var SOURCE: Domo; +declare var SPAN: Domo; +declare var SPLIT: Domo; +declare var STRONG: Domo; +declare var STYLE: Domo; +declare var SUB: Domo; +declare var SUMMARY: Domo; +declare var SUP: Domo; +declare var TABLE: Domo; +declare var TBODY: Domo; +declare var TD: Domo; +declare var TEXTAREA: Domo; +declare var TFOOT: Domo; +declare var TH: Domo; +declare var THEAD: Domo; +declare var TIME: Domo; +declare var TITLE: Domo; +declare var TR: Domo; +declare var TRACK: Domo; +declare var TT: Domo; +declare var UL: Domo; +declare var VAR: Domo; +declare var VIDEO: Domo; +declare var WBR: Domo; diff --git a/domready/domready-tests.ts b/domready/domready-tests.ts index 7b7c40dfb..3f4768c21 100644 --- a/domready/domready-tests.ts +++ b/domready/domready-tests.ts @@ -1,5 +1,5 @@ -/// - -domready(function () { - // dom is loaded! +/// + +domready(function () { + // dom is loaded! }) \ No newline at end of file diff --git a/domready/domready.d.ts b/domready/domready.d.ts index 7dc9c7749..61ac76531 100644 --- a/domready/domready.d.ts +++ b/domready/domready.d.ts @@ -1,10 +1,10 @@ -// Type definitions for domready -// Project: https://github.com/ded/domready -// Definitions by: Christian Holm Nielsen -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare function domready(callback: () => any) : void; - -declare module "domready" { - export = domready; -} +// Type definitions for domready +// Project: https://github.com/ded/domready +// Definitions by: Christian Holm Nielsen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function domready(callback: () => any) : void; + +declare module "domready" { + export = domready; +} diff --git a/durandal/durandal-1.x.d.ts.tscparams b/durandal/durandal-1.x.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/durandal/durandal-1.x.d.ts.tscparams +++ b/durandal/durandal-1.x.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams b/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams +++ b/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams b/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams index d3f5a12fa..8b1378917 100644 --- a/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams +++ b/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams @@ -1 +1 @@ - + diff --git a/dynatable/dynatable-tests.ts b/dynatable/dynatable-tests.ts index 27834af2c..25f3fb257 100644 --- a/dynatable/dynatable-tests.ts +++ b/dynatable/dynatable-tests.ts @@ -1,229 +1,229 @@ -/// -/// - - -// Using the global setup option -// ============================= -$.dynatableSetup({ features: { pushState: false }, dataset: { perPageDefault: 5, perPageOptions: [2, 5, 10] } }); - - -// Without any settings (using all defaults) -// ========================================= -var dynatableWithDefaultSettings = $('#example-table').dynatable(); - - -// Building a config piece by piece -// ================================ -// JQueryDynatable.Features -var featsConfig: JQueryDynatable.Features = { - paginate: true, - sort: false, - pushState: true, - search: true, - recordCount: true, - perPageSelect: true -}; -var featsPartialConfig: JQueryDynatable.Features = { - search: false, - paginate: false -}; -// JQueryDynatable.Column -var col: JQueryDynatable.Column = { - index: 0, - label: 'Col from JS', - id: 'someColId', - attributeWriter: function myAttrWriter(data: any): any { - return data[this.id]; - }, - attributeReader: function myAttrReader(cell: Element, data: any): string { - return $(cell).html(); - }, - sorts: ['un', 'deux'], - hidden: false, - textAlign: 'right' -}; -// JQueryDynatable.Table -var tableConfig: JQueryDynatable.Table = { - defaultColumnIdStyle: 'underscore', - columns: [col], // Just for fun & testing... because will be reset by dynatable - headRowSelector: '.my-head-row-selector', - bodyRowSelector: 'tbody tr', - headRowClass: 'custom-head-row-class' -}; -var tablePartialConfig: JQueryDynatable.Table = { - defaultColumnIdStyle: 'trimDash' -}; -// JQueryDynatable.Inputs -var tableInputs: JQueryDynatable.Inputs = { - // Must match exactly target value, strict comparison! - queries: $('#countryFilter, #yearFilter'), - // I believe this setting is unused! - sorts: null, - multisort: ['shiftKey'], - // I believe this setting is unused! - page: null, - queryEvent: 'keyup', - recordCountTarget: $('#record-count'), - recordCountPlacement: 'after', - paginationLinkTarget: '#record-count', - paginationLinkPlacement: 'before', - paginationClass: 'paginationClass', - paginationLinkClass: 'paginationLinkClass', - paginationPrevClass: 'paginationPrevClass', - paginationNextClass: 'paginationNextClass', - paginationActiveClass: 'paginationActiveClass', - paginationDisabledClass: 'paginationDisabledClass', - paginationPrev: '< Prev.', - paginationNext: 'Next >', - paginationGap: [3, 1, 1, 3], - searchTarget: $('#record-count').get(0), - searchPlacement: 'after', - searchText: 'Search: ', - perPageTarget: '#record-count', - perPagePlacement: 'before', - perPageText: 'Display: ', - pageText: 'Pages: ', - recordCountPageBoundTemplate: '{pageLowerBound} t-o {pageUpperBound} o-f', - recordCountPageUnboundedTemplate: '{recordsShown} -of-', - recordCountTotalTemplate: '{recordsQueryCount} x {collectionName}', - recordCountFilteredTemplate: ' (found from {recordsTotal} total entries)', - recordCountText: 'Rendering', - recordCountTextTemplate: '{text} {pageTemplate} {totalTemplate} {filteredTemplate}', - recordCountTemplate: '!!{textTemplate}!!', - processingText: 'Working...' -}; -// JQueryDynatable.Dataset -var tableDataset: JQueryDynatable.Dataset = { - ajax: false, - ajaxUrl: null, - ajaxCache: null, - ajaxOnLoad: false, - ajaxMethod: 'GET', - ajaxDataType: 'json', - totalRecordCount: null, - queries: {}, - queryRecordCount: null, - page: null, - perPageDefault: 3, - perPageOptions: [2, 3, 10], - sorts: {}, - sortsKeys: [], - sortTypes: {}, - records: null -}; -// JQueryDynatable.Writers -var tableWriters: JQueryDynatable.Writers = { - _rowWriter: function exampleRowWriter(rowIndex, record, columns, cellWriter) { - var tr = ''; - // grab the record's attribute for each column - for (var i = 0, len = columns.length; i < len; i++) { - tr += cellWriter(columns[i], record); - } - return '' + tr + ''; - }, - _cellWriter: function exampleCellWriter(column, record) { - var html = column.attributeWriter(record), - td = '