diff --git a/notNeededPackages.json b/notNeededPackages.json
index 88ce062809..67cda351a3 100644
--- a/notNeededPackages.json
+++ b/notNeededPackages.json
@@ -196,6 +196,12 @@
"typingsPackageName": "upper-case-first",
"sourceRepoUrl": "https://github.com/blakeembrey/upper-case-first",
"asOfVersion": "1.1.2"
+ },
+ {
+ "libraryName": "Sugar",
+ "typingsPackageName": "sugar",
+ "sourceRepoURL": "https://github.com/andrewplummer/Sugar",
+ "asOfVersion": "2.0.2"
}
]
}
diff --git a/sugar/index.d.ts b/sugar/index.d.ts
deleted file mode 100644
index 8a5b9f645a..0000000000
--- a/sugar/index.d.ts
+++ /dev/null
@@ -1,5025 +0,0 @@
-// Type definitions for Sugar 1.3.9
-// Project: http://sugarjs.com/
-// Definitions by: Josh Baldwin
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-/*
-sugar-1.3.9.d.ts may be freely distributed under the MIT license.
-
-Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/sugar.d.ts
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-interface String {
-
- /**
- * Adds at [index]. Negative values are also allowed.
- * @param str String to add.
- * @param index Index where is added. Default = str.length
- * @returns Original string with added at [index].
- * @extra %insert% is provided as an alias, and is generally more readable when using an index.
- * @example
- * 'schfifty'.add(' five') -> schfifty five
- * 'dopamine'.insert('e', 3) -> dopeamine
- * 'spelling eror'.insert('r', -3) -> spelling error
- **/
- add(str: string, index?: number): string;
-
- /**
- * @see add
- **/
- insert(str: string, index?: number): string;
-
- /**
- * Assigns variables to tokens in a string.
- * @param objs Variable tokens to assign in the string.
- * @returns String with assigned to variables in the original string.
- * @extra If an object is passed, it's properties can be assigned using
- * the object's keys. If a non-object (string, number, etc.)
- * is passed it can be accessed by the argument number beginning
- * with 1 (as with regex tokens). Multiple objects can be passed
- * and will be merged together (original objects are unaffected).
- * @example
- * 'Welcome, Mr. {name}.'.assign({ name: 'Franklin' }) -> 'Welcome, Mr. Franklin.'
- * 'You are {1} years old today.'.assign(14) -> 'You are 14 years old today.'
- * '{n} and {r}'.assign({ n: 'Cheech' }, { r: 'Chong' }) -> 'Cheech and Chong'
- **/
- assign(...objs: any[]): string;
-
- /***
- * Gets the character(s) at a given index.
- * @param index Indicies of the character(s) requested.
- * @param loop Loop around the string or stop at the end, default = true.
- * @returns Character(s) at the specified indices.
- * @extra When [loop] is true, overshooting the end of the string
- * (or the beginning) will begin counting from the other end.
- * As an alternate syntax, passing multiple indexes will get
- * the characters at those indexes.
- * @example
- * 'jumpy'.at(0) -> 'j'
- * 'jumpy'.at(2) -> 'm'
- * 'jumpy'.at(5) -> 'j'
- * 'jumpy'.at(5, false) -> ''
- * 'jumpy'.at(-1) -> 'y'
- * 'lucky charms'.at(2,4,6,8) -> ['u','k','y',c']
- ***/
- at(index: number, loop?: boolean): string;
-
- /**
- * @see at
- * @limitation Typescript does not allow for arguments after a variable argument list.
- **/
- at(...indicies: number[]): string[];
-
- /**
- * Converts underscores and hyphens to camel case.
- * @param first If [first] is true the first letter will also be capitalized, default = true
- * @returns Camel case version of the string.
- * @extra If the Inflections package is included acryonyms can also
- * be defined that will be used when camelizing.
- * @example
- * 'caps_lock'.camelize() -> 'CapsLock'
- * 'moz-border-radius'.camelize() -> 'MozBorderRadius'
- * 'moz-border-radius'.camelize(false) -> 'mozBorderRadius'
- **/
- camelize(first?: boolean): string;
-
- /**
- * Capitalizes the first character in the string.
- * @method capitalize([all] = false)
- * @param all Default = false
- * @returns String
- * @extra If [all] is true, all words in the string will be capitalized.
- * @example
- *
- * 'hello'.capitalize() -> 'Hello'
- * 'hello kitty'.capitalize() -> 'Hello kitty'
- * 'hello kitty'.capitalize(true) -> 'Hello Kitty'
- *
- **/
- capitalize(all?: boolean): string;
-
- /**
- * Runs callback [fn] against each character in the string.
- * Returns an array of characters.
- * @param fn Callback function for each character in the string.
- * @returns string[] with each element containing one character
- * in the string.
- * @example
- * 'jumpy'.chars() -> ['j','u','m','p','y']
- * 'jumpy'.chars(function(c) {
- * // Called 5 times: "j","u","m","p","y"
- * });
- **/
- chars(fn?: (c: string) => void ): string[];
-
- /**
- * Runs callback [fn] against each character code in the string.
- Returns an array of character codes.
- * @param fn Callback function for each character code in the string.
- * @returns number[] with each element containing one character code
- * in the string.
- * @example
- * 'jumpy'.codes() -> [106,117,109,112,121]
- * 'jumpy'.codes(function(c) {
- * // Called 5 times: 106, 117, 109, 112, 121
- * });
- ***/
- codes(fn?: (c: string) => void ): number[];
-
- /**
- * Compacts all white space in the string to a single space and trims the ends.
- * @returns String with all whitespace compated to a single space.
- * @example
- * 'too \n much \n space'.compact() -> 'too much space'
- * 'enough \n '.compact() -> 'enough'
- **/
- compact(): string;
-
- /**
- * Converts underscores and camel casing to hypens.
- * @returns String with underscores and camel casing changed to hypens.
- * @example
- * 'a_farewell_to_arms'.dasherize() -> 'a-farewell-to-arms'
- * 'capsLock'.dasherize() -> 'caps-lock'
- **/
- dasherize(): string;
-
- /**
- * Decodes the string from base64 encoding.
- * @returns Decoded base64 string.
- * @extra This method wraps the browser native %atob% when available,
- * and uses a custom implementation when not available.
- * @example
- * 'aHR0cDovL3R3aXR0ZXIuY29tLw=='.decodeBase64() -> 'http://twitter.com/'
- * 'anVzdCBnb3QgZGVjb2RlZA=='.decodeBase64() -> 'just got decoded!'
- **/
- decodeBase64(): string;
-
- /**
- * Runs callback [fn] against each occurence of [search].
- * @param fn Callback function for each occurance of [search].
- * If [search] is not provided each character is matched.
- * @param search Search item to look for in the string.
- * @returns string[] of each item matched in the string.
- * @extra Returns an array of matches. [search] may be either
- * a string or regex, and defaults to every character in the string.
- * @example
- * 'jumpy'.each() -> ['j','u','m','p','y']
- * 'jumpy'.each(/[r-z]/) -> ['u','y']
- * 'jumpy'.each(/[r-z]/, function(m) {
- * // Called twice: "u", "y"
- * });
- **/
- each(search: string, fn?: (m: string) => void): string[];
-
- /**
- * @see each
- **/
- each(search: RegExp, fn?: (m: string) => void): string[];
-
- /**
- * @see each
- **/
- each(fn?: (m: string) => void ): string[];
-
- /**
- * Encodes the string into base64 encoding.
- * @returns Base64 encoded string.
- * @extra This method wraps the browser native %btoa% when available,
- * and uses a custom implementation when not available.
- * @example
- * 'gonna get encoded!'.encodeBase64() -> 'Z29ubmEgZ2V0IGVuY29kZWQh'
- * 'http://twitter.com/'.encodeBase64() -> 'aHR0cDovL3R3aXR0ZXIuY29tLw=='
- **/
- encodeBase64(): string;
-
- /**
- * Returns true if the string ends with .
- * @param find String or RegExp to find at the end of the string.
- * @param pos Ending position to search for, defaults to the end of the string.
- * @param case_ True for case sensitive, default = true.
- * @returns True if the string ends with .
- * @example
- * 'jumpy'.endsWith('py') -> true
- * 'jumpy'.endsWith(/[q-z]/) -> true
- * 'jumpy'.endsWith('MPY') -> false
- * 'jumpy'.endsWith('MPY', false) -> true
- **/
- endsWith(find: string, pos?: number, case_?: boolean): boolean;
-
- /**
- * @see endsWith
- **/
- endsWith(find: string, case_?: boolean): boolean;
-
- /**
- * @see endsWith
- **/
- endsWith(find: RegExp, pos?: number, case_?: boolean): boolean;
-
- /**
- * @see endsWith
- **/
- endsWith(find: RegExp, case_?: boolean): boolean;
-
- /**
- * Converts HTML characters to their entity equivalents.
- * @returns HTML escaped string.
- * @example
- * '
some text
'.escapeHTML() -> '<p>some text</p>'
- * 'one & two'.escapeHTML() -> 'one & two'
- **/
- escapeHTML(): string;
-
- /**
- * Escapes all RegExp tokens in the string.
- * @returns RegExp escaped string.
- * @example
- * 'really?'.escapeRegExp() -> 'really\?'
- * 'yes.'.escapeRegExp() -> 'yes\.'
- * '(not really)'.escapeRegExp() -> '\(not really\)'
- **/
- escapeRegExp(): string;
-
- /**
- * Escapes characters in a string to make a valid URL.
- * @returns URL escaped string.
- * @extra If [param] is true, it will also escape valid URL
- * characters for use as a URL parameter.
- * @example
- * 'http://foo.com/"bar"'.escapeURL() -> 'http://foo.com/%22bar%22'
- * 'http://foo.com/"bar"'.escapeURL(true) -> 'http%3A%2F%2Ffoo.com%2F%22bar%22'
- **/
- escapeURL(param?: boolean): string;
-
- /**
- * Returns the first [n] characters of the string.
- * @returns String
- * @example
- * 'lucky charms'.first() -> 'l'
- * 'lucky charms'.first(3) -> 'luc'
- **/
- first(n?: number): string;
-
- /**
- * Returns a section of the string starting from [index].
- * @returns String
- * @example
- * 'lucky charms'.from() -> 'lucky charms'
- * 'lucky charms'.from(7) -> 'harms'
- **/
- from(index?: number): string;
-
- /**
- * Converts full-width characters (zenkaku) to half-width (hankaku).
- * @param mode default = 'all'
- * @returns Converted string to hankaku.
- * @extra [mode] accepts any combination of
- * "a" (alphabet),
- * "n" (numbers),
- * "k" (katakana),
- * "s" (spaces),
- * "p" (punctuation),
- * or "all".
- * @example
- * '??? YAMADA??!'.hankaku() -> '??? YAMADA??!'
- * '??? YAMADA??!'.hankaku('a') -> '??? YAMADA??!'
- * '??? YAMADA??!'.hankaku('alphabet') -> '??? YAMADA??!'
- * '?????! 25???!'.hankaku('katakana', 'numbers') -> '?????! 25???!'
- * '?????! 25???!'.hankaku('k', 'n') -> '?????! 25???!'
- * '?????! 25???!'.hankaku('kn') -> '?????! 25???!'
- * '?????! 25???!'.hankaku('sp') -> '?????! 25???!'
- **/
- hankaku(mode?: string): string;
-
- /**
- * @see hankaku
- **/
- hankaku(...modes: string[]): string;
-
- /**
- * Returns true if the string matches .
- * @param find Search parameters.
- * @returns True if the string matchs , otherwise false.
- * @example
- * 'jumpy'.has('py') -> true
- * 'broken'.has(/[a-n]/) -> true
- * 'broken'.has(/[s-z]/) -> false
- **/
- has(find: string): boolean;
-
- /**
- * @see has
- **/
- has(find: RegExp): boolean;
-
- /**
- * Returns true if the string contains any characters in Arabic.
- * @returns True if the string contains Arabic.
- * @example
- * '?????'.hasArabic() -> true
- * '?????'.hasCyrillic() -> true
- * '? ?????!'.hasHangul() -> true
- * '??????'.hasKatakana() -> true
- * "l'année".hasLatin() -> true
- **/
- hasArabic(): boolean;
-
- /**
- * Returns true if the string contains any characters in Cyrillic.
- * @returns True if the string contains Cyrillic.
- **/
- hasCyrillic(): boolean;
-
- /**
- * Returns true if the string contains any characters in Greek.
- * @returns True if the string contains Greek.
- **/
- hasGreek(): boolean;
-
- /**
- * Returns true if the string contains any characters in Hangul.
- * @returns True if the string contains Hangul.
- **/
- hasHangul(): boolean;
-
- /**
- * Returns true if the string contains any characters in Han.
- * @returns True if the string contains Han.
- **/
- hasHan(): boolean;
-
- /**
- * Returns true if the string contains any characters in Kanji.
- * @returns True if the string contains Kanji.
- **/
- hasKanji(): boolean;
-
- /**
- * Returns true if the string contains any characters in Hebrew.
- * @returns True if the string contains Hebrew.
- **/
- hasHebrew(): boolean;
-
- /**
- * Returns true if the string contains any characters in Hiragana.
- * @returns True if the string contains Hiragana.
- **/
- hasHiragana(): boolean;
-
- /**
- * Returns true if the string contains any characters in Kana.
- * @returns True if the string contains Kana.
- **/
- hasKana(): boolean;
-
- /**
- * Returns true if the string contains any characters in Katakana.
- * @returns True if the string contains Katakana.
- **/
- hasKatakana(): boolean;
-
- /**
- * Returns true if the string contains any characters in Latin.
- * @returns True if the string contains Latin.
- **/
- hasLatin(): boolean;
-
- /**
- * Returns true if the string contains any characters in Thai.
- * @returns True if the string contains Thai.
- **/
- hasThai(): boolean;
-
- /**
- * Returns true if the string contains any characters in Devanagari.
- * @returns True if the string contains Devanagari.
- **/
- hasDevanagari(): boolean;
-
- /**
- * Converts katakana into hiragana.
- * @param all If [all] is false, only full-width katakana will be converted, default = true.
- * @returns Converted string to hiragana.
- * @example
- * '????'.hiragana() -> '????'
- * '?????'.hiragana() -> '?????'
- * '????'.hiragana() -> '????'
- * '????'.hiragana(false) -> '????'
- **/
- hiragana(all?: boolean): string;
-
- /**
- * Creates a human readable string.
- * @returns Pretty printed version of the string.
- * @extra Capitalizes the first word and turns underscores into spaces and strips a
- * trailing '_id', if any. Like String#titleize, this is meant for creating pretty output.
- * @example
- * 'employee_salary'.humanize() -> 'Employee salary'
- * 'author_id'.humanize() -> 'Author'
- **/
- humanize(): string;
-
- /**
- * Returns true if the string has a length of 0 or contains only whitespace.
- * @returns True if the string has a length of 0 or contains only whitespace.
- * @example
- * ''.isBlank() -> true
- * ' '.isBlank() -> true
- * 'noway'.isBlank() -> false
- **/
- isBlank(): boolean;
-
- /**
- * Returns true if the string contains only characters in Arabic. Whitespace is ignored.
- * @returns True if the string containsly only characters in Arabic.
- * @example
- * '?????'.isArabic() -> true
- * '?????'.isCyrillic() -> true
- * '? ?????!'.isHangul() -> true
- * '??????'.isKatakana() -> false
- * "l'année".isLatin() -> true
- **/
- isArabic(): boolean;
-
- /**
- * Returns true if the string contains only characters in Cyrillic. Whitespace is ignored.
- * @returns True if the string containsly only characters in Cyrillic.
- **/
- isCyrillic(): boolean;
-
- /**
- * Returns true if the string contains only characters in Greek. Whitespace is ignored.
- * @returns True if the string containsly only characters in Greek.
- **/
- isGreek(): boolean;
-
- /**
- * Returns true if the string contains only characters in Hangul. Whitespace is ignored.
- * @returns True if the string containsly only characters in Hangul.
- **/
- isHangul(): boolean;
-
- /**
- * Returns true if the string contains only characters in Han. Whitespace is ignored.
- * @returns True if the string containsly only characters in Han.
- **/
- isHan(): boolean;
-
- /**
- * Returns true if the string contains only characters in Kanji. Whitespace is ignored.
- * @returns True if the string containsly only characters in Kanji.
- **/
- isKanji(): boolean;
-
- /**
- * Returns true if the string contains only characters in Hebrew. Whitespace is ignored.
- * @returns True if the string containsly only characters in Hebrew.
- **/
- isHebrew(): boolean;
-
- /**
- * Returns true if the string contains only characters in Hiragana. Whitespace is ignored.
- * @returns True if the string containsly only characters in Hiragana.
- **/
- isHiragana(): boolean;
-
- /**
- * Returns true if the string contains only characters in Kana. Whitespace is ignored.
- * @returns True if the string containsly only characters in Kana.
- **/
- isKana(): boolean;
-
- /**
- * Returns true if the string contains only characters in Katakana. Whitespace is ignored.
- * @returns True if the string containsly only characters in Katakana.
- **/
- isKatakana(): boolean;
-
- /**
- * Returns true if the string contains only characters in Latin. Whitespace is ignored.
- * @returns True if the string containsly only characters in Latin.
- **/
- isLatin(): boolean;
-
- /**
- * Returns true if the string contains only characters in Thai. Whitespace is ignored.
- * @returns True if the string containsly only characters in Thai.
- **/
- isThai(): boolean;
-
- /**
- * Returns true if the string contains only characters in Devanagari. Whitespace is ignored.
- * @returns True if the string containsly only characters in Devanagari.
- **/
- isDevanagari(): boolean;
-
- /**
- * Converts hiragana into katakana.
- * @returns Converted string to katakana.
- * @example
- * '????'.katakana() -> '????'
- * '?????'.katakana() -> '?????'
- **/
- katakana(): string;
-
- /**
- * Returns the last [n] characters of the string.
- * @param last Default = 1.
- * @returns The last [n] characters of the string.
- * @example
- * 'lucky charms'.last() -> 's'
- * 'lucky charms'.last(3) -> 'rms'
- **/
- last(n?: number): string;
-
- /**
- * Runs callback [fn] against each line in the string.
- * @param fn Callback against each line in the original string.
- * @returns A string[] where each element is a line in the original string.
- * @example
- * 'broken wear\nand\njumpy jump'.lines() -> ['broken wear','and','jumpy jump']
- * 'broken wear\nand\njumpy jump'.lines(function(l) {
- * // Called three times: "broken wear", "and", "jumpy jump"
- * });
- **/
- lines(fn?: (l: string) => void): string[];
-
- /**
- * Returns the string with accented and non-standard Latin-based
- * characters converted into ASCII approximate equivalents.
- * @returns String
- * @example
- * 'á'.normalize() -> 'a'
- * 'Ménage à trois'.normalize() -> 'Menage a trois'
- * 'Volkswagen'.normalize() -> 'Volkswagen'
- * 'FULLWIDTH'.normalize() -> 'FULLWIDTH'
- **/
- normalize(): string;
-
- /**
- * Pads either/both sides of the string.
- * @param padding The padding characters to add to the string.
- * @param num The number of to add to the string, default = 1.
- * @returns String
- * @extra [num] is the number of characters on each side,
- * and [padding] is the character to pad with.
- * @example
- * 'wasabi'.pad('-') -> '-wasabi-'
- * 'wasabi'.pad('-', 2) -> '--wasabi--'
- * 'wasabi'.padLeft('-', 2) -> '--wasabi'
- * 'wasabi'.padRight('-', 2) -> 'wasabi--'
- **/
- pad(padding: string, num?: number): string;
-
- /**
- * @see pad
- **/
- padLeft(padding: string, num?: number): string;
-
- /**
- * @see pad
- **/
- padRight(padding: string, num?: number): string;
-
- /**
- * Runs callback [fn] against each paragraph in the string.
- * @param fn Callback function called for each paragraph in the string.
- * @returns Returns a string[] where each element is a paragraph in the original string.
- * @extra A paragraph here is defined as a block of text bounded
- * by two or more line breaks.
- * @example
- * 'Once upon a time.\n\nIn the land of oz...'.paragraphs() -> ['Once upon a time.','In the land of oz...']
- * 'Once upon a time.\n\nIn the land of oz...'.paragraphs(function(p) {
- * // Called twice: "Once upon a time.", "In teh land of oz..."
- * });
- **/
- paragraphs(fn?: (p: string) => void): string[];
-
- /**
- * Replaces special characters in a string so that it may be used as part of a pretty URL.
- * @returns URL parameterizes the string.
- * @example
- * 'hell, no!'.parameterize() -> 'hell-no'
- **/
- parameterize(): string;
-
- /**
- * Returns the plural form of the word in the string.
- * @method pluralize()
- * @returns String
- * @example
- * 'post'.pluralize() -> 'posts'
- * 'octopus'.pluralize() -> 'octopi'
- * 'sheep'.pluralize() -> 'sheep'
- * 'words'.pluralize() -> 'words'
- * 'CamelOctopus'.pluralize() -> 'CamelOctopi'
- **/
- pluralize(): string;
-
- /**
- * Removes any part of the string that matches .
- * @param find Remove this from the string.
- * @returns String with all instances of removed.
- * @extra can be a string or a regex.
- * @example
- * 'schfifty five'.remove('f') -> 'schity ive'
- * 'schfifty five'.remove(/[a-f]/g) -> 'shity iv'
- **/
- remove(find: string): string;
-
- /**
- * @see remove
- **/
- remove(find: RegExp): string;
-
- /**
- * Removes all HTML tags and their contents from the string
- * @param tags Remove these HTML tags.
- * @returns String with HTML tags removed.
- * @extra Tags to remove may be enumerated in the parameters, otherwise will remove all.
- * @example
- * '
just some text
'.removeTags() -> ''
- * '
just some text
'.removeTags('b') -> '
just text
'
- **/
- removeTags(...tags: string[]): string;
-
- /**
- * Returns the string repeated [num] times.
- * @param num Number of times to repeat the string, default = 0.
- * @returns Repeated [num] string.
- * @example
- * 'jumpy'.repeat(2) -> 'jumpyjumpy'
- * 'a'.repeat(5) -> 'aaaaa'
- * 'a'.repeat(0) -> ''
- **/
- repeat(num?: number): string;
-
- /**
- * Reverses the string.
- * @returns Reversed string.
- * @example
- * 'jumpy'.reverse() -> 'ypmuj'
- * 'lucky charms'.reverse() -> 'smrahc ykcul'
- **/
- reverse(): string;
-
- /**
- * Shifts each character in the string places in the character map.
- * @param num Number of characters to shift in the character map.
- * @returns String with characters shifted .
- * @example
- * 'a'.shift(1) -> 'b'
- * '?'.shift(1) -> '?'
- **/
- shift(num: number): string[];
-
- /**
- * The reverse of String#pluralize.
- * @returns Returns the singular form of a word in a string.
- * @example
- * 'posts'.singularize() -> 'post'
- * 'octopi'.singularize() -> 'octopus'
- * 'sheep'.singularize() -> 'sheep'
- * 'word'.singularize() -> 'word'
- * 'CamelOctopi'.singularize() -> 'CamelOctopus'
- **/
- singularize(): string;
-
- /**
- * Converts camel case, underscores, and hyphens to a properly spaced string.
- * @returns String
- * @example
- * 'camelCase'.spacify() -> 'camel case'
- * 'an-ugly-string'.spacify() -> 'an ugly string'
- * 'oh-no_youDid-not'.spacify().capitalize(true) -> 'something else'
- **/
- spacify(): string;
-
- /**
- * Returns true if the string starts with .
- * @param find String or RegExp to look for at the beginning of the string.
- * @param pos Starting position to start searching, default = 0.
- * @param case_ True for case sensitive, default = true.
- * @returns True if the string starts with `find`.
- * @example
- * 'hello'.startsWith('hell') -> true
- * 'hello'.startsWith(/[a-h]/) -> true
- * 'hello'.startsWith('HELL') -> false
- * 'hello'.startsWith('HELL', false) -> true
- **/
- startsWith(find: string, pos?: number, case_?: boolean): boolean;
-
- /**
- * @see startsWith
- **/
- startsWith(find: string, case_?: boolean): boolean;
-
- /**
- * @see startsWith
- **/
- startsWith(find: RegExp, pos?: number, case_?: boolean): boolean;
-
- /**
- * @see startsWith
- **/
- startsWith(find: RegExp, case_?: boolean): boolean;
-
- /**
- * Strips all HTML tags from the string.
- * @param tags HTML tags to strip from the string.
- * @returns Returns the string with all HTML removed.
- * @extra Tags to strip may be enumerated in the parameters, otherwise will strip all.
- * @example
- * '
just some text
'.stripTags() -> 'just some text'
- * '
just some text
'.stripTags('p') -> 'just some text'
- **/
- stripTags(...tags: string[]): string;
-
- /**
- * Creates a title version of the string.
- * @returns Returns a titlized version of the string.
- * @extra Capitalizes all the words and replaces some characters
- * in the string to create a nicer looking title.
- * String#titleize is meant for creating pretty output.
- * @example
- * 'man from the boondocks'.titleize() -> 'Man from the Boondocks'
- * 'x-men: the last stand'.titleize() -> 'X Men: The Last Stand'
- * 'TheManWithoutAPast'.titleize() -> 'The Man Without a Past'
- * 'raiders_of_the_lost_ark'.titleize() -> 'Raiders of the Lost Ark'
- **/
- titleize(): string;
-
- /**
- * Returns a section of the string ending at [index].
- * @param index Ending position in the substring, default = string.length.
- * @returns Substring ending at [index].
- * @example
- * 'lucky charms'.to() -> 'lucky charms'
- * 'lucky charms'.to(7) -> 'lucky ch'
- **/
- to(index?: number): string;
-
- /**
- * Converts the string into a number in base [base].
- * @param base The base to parse the number in, default = 10.
- * @returns Parsed number.
- * @extra Any value with a "." fill be converted to a floating point value,
- * otherwise an integer.
- * @example
- * '153'.toNumber() -> 153
- * '12,000'.toNumber() -> 12000
- * '10px'.toNumber() -> 10
- * 'ff'.toNumber(16) -> 255
- **/
- toNumber(base?: number): number;
-
- /**
- * Removes leading and/or trailing whitespace from the string.
- * @returns Returns a string with leading and trailing whitespace removed.
- * @extra Whitespace is defined as line breaks, tabs, and any character
- * in the "Space, Separator" Unicode category, conforming to the
- * the ES5 spec. The standard %trim% method is only added when
- * not fully supported natively.
- * @example
- * ' wasabi '.trim() -> 'wasabi'
- * ' wasabi '.trimLeft() -> 'wasabi '
- * ' wasabi '.trimRight() -> ' wasabi'
- **/
- // Trim is already available on lib.d.ts interface definition.
- //trim(): string;
-
- /**
- * Removes leading whitespace from the string.
- * @see trim
- * @return Returns a string with leading whitespace removed.
- **/
- trimLeft(): string;
-
- /**
- * Removes trailing whitespace from the string.
- * @see trim
- * @return Returns a string with trailing whitespace removed.
- **/
- trimRight(): string;
-
- /**
- * Truncates a string.
- * @param length The length to keep in the string before truncating.
- * @param split True to split words, false keeps them intact but may truncate earlier.
- * @param from Where to truncate the string from, default = 'right'.
- * @param ellipsis Character to use as ellipsis.
- * @returns Truncated string.
- * @extra If [split] is %false%, will not split words up, and instead
- * discard the word where the truncation occurred. [from] can
- * also be %"middle"% or %"left"%.
- * @example
- * 'just sittin on the dock of the bay'.truncate(20) -> 'just sittin on the do...'
- * 'just sittin on the dock of the bay'.truncate(20, false) -> 'just sittin on the...'
- * 'just sittin on the dock of the bay'.truncate(20, true, 'middle') -> 'just sitt...of the bay'
- * 'just sittin on the dock of the bay'.truncate(20, true, 'left') -> '...the dock of the bay'
- **/
- truncate(length: number, split?: boolean, from?: string, ellipsis?: string): string;
-
- /**
- * Converts hyphens and camel casing to underscores.
- * @returns Returns a converted string.
- * @example
- * 'a-farewell-to-arms'.underscore() -> 'a_farewell_to_arms'
- * 'capsLock'.underscore() -> 'caps_lock'
- * @note Not to be confused with the populate underscore.js library.
- **/
- underscore(): string;
-
- /**
- * Restores escaped HTML characters.
- * @returns Returns unescaped HTML string.
- * @example
- * '<p>some text</p>'.unescapeHTML() -> '
some text
'
- * 'one & two'.unescapeHTML() -> 'one & two'
- **/
- unescapeHTML(): string;
-
- /**
- * Restores escaped characters in a URL escaped string.
- * @param partial If true only escape non-valid URL characters, default = false.
- * @returns String
- * @extra If [partial] is true, it will only unescape non-valid URL characters. [partial] is included here for completeness, but should very rarely be needed.
- * @example
- * 'http%3A%2F%2Ffoo.com%2Fthe%20bar'.unescapeURL() -> 'http://foo.com/the bar'
- * 'http%3A%2F%2Ffoo.com%2Fthe%20bar'.unescapeURL(true) -> 'http%3A%2F%2Ffoo.com%2Fthe bar'
- **/
- unescapeURL(partial?: boolean): string;
-
- /**
- * Runs callback [fn] against each word in the string.
- * @param fn Callback to run against each word in the string.
- * @returns Returns an string[] with each element containing a word.
- * @extra A "word" here is defined as any sequence of non-whitespace characters.
- * @example
- * 'broken wear'.words() -> ['broken','wear']
- * 'broken wear'.words(function(w) {
- * // Called twice: "broken", "wear"
- * });
- **/
- words(fn?: (word: string) => void): string[];
-
- /**
- * Converts half-width characters (hankaku) to full-width (zenkaku).
- * @param modes Types of characters to convert, default = 'all'.
- * @returns String
- * @extra [mode] accepts any combination of
- * "a" (alphabet),
- * "n" (numbers),
- * "k" (katakana),
- * "s" (spaces),
- * "p" (punctuation),
- * or "all".
- * @example
- * '??? YAMADA??!'.zenkaku() -> '??? YAMADA??!'
- * '??? YAMADA??!'.zenkaku('a') -> '??? YAMADA??!'
- * '??? YAMADA??!'.zenkaku('alphabet') -> '??? YAMADA??!'
- * '?????! 25???!'.zenkaku('katakana', 'numbers') -> '?????! 25???!'
- * '?????! 25???!'.zenkaku('k', 'n') -> '?????! 25???!'
- * '?????! 25???!'.zenkaku('kn') -> '?????! 25???!'
- * '?????! 25???!'.zenkaku('sp') -> '?????! 25???!'
- **/
- zenkaku(...modes: string[]): string;
-}
-
-// Todo: fix when TypeScript supports adding static functions to native types.
-interface NumberConstructor {
-
- /**
- * Returns a random integer between [n1] and [n2].
- * @param n1 Lower bound, default = 0.
- * @param n2 Uppder bound, default = 1.
- * @returns Random number between [n1] and [n2].
- * @extra If only 1 number is passed, the other will be 0. If none are passed, the number will be either 0 or 1.
- * @example
- * Number.random(50, 100) -> ex. 85
- * Number.random(50) -> ex. 27
- * Number.random() -> ex. 0
- **/
- random(n1?: number, n2?: number): number;
-}
-
-interface Number {
-
- /**
- * Returns an abbreviated form of the number.
- * @param precision Rounding precision, default = 0.
- * @returns Abbreviated string representation of the number.
- * @extra [precision] will round to the given precision.
- * @example
- * (1000).abbr() -> "1k"
- * (1000000).abbr() -> "1m"
- * (1280).abbr(1) -> "1.3k"
- **/
- abbr(precision?: number): string;
-
- /**
- * Returns an abbreviated form of the number, considered to be "Bytes".
- * @param precision Rounding precision, default = 0.
- * @param limit Upper limit for the units, default = 4 which is terabytes.
- * @returns Abbreviated string representation of the number in bytes.
- * @extra [precision] will round to the given precision.
- * [limit] is the upper limit for the units.
- * The default is %4%, which is "terabytes" (TB).
- * If [limit] is %false%, the upper limit will be "exa".
- * @example
- * (1000).bytes() -> "1kB"
- * (1000).bytes(2) -> "0.98kB"
- * ((10).pow(20)).bytes() -> "90,949,470TB"
- * ((10).pow(20)).bytes(0, false) -> "87EB"
- **/
- bytes(precision?: number, limit?: number): string;
-
- /*
- * @see bytes
- * @limit If false upper limit for units is 'exa'.
- **/
- bytes(precision?: number, limit?: boolean): string;
-
- /**
- * Shortcut for %Math.ceil% that also allows a .
- * @param precision Rounding precision, default = 0.
- * @returns Ceiling rounded number.
- * @example
- * (3.241).ceil() -> 4
- * (-3.241).ceil() -> -3
- * (3.241).ceil(2) -> 3.25
- * (3748).ceil(-2) -> 3800
- **/
- ceil(precision?: number): number;
-
- /**
- * Returns a string at the code point of the number.
- * @returns String from character code.
- * @example
- * (65).chr() -> "A"
- * (75).chr() -> "K"
- **/
- chr(): string;
-
- /**
- * Returns an array containing numbers from the number down to .
- * @param num Number to count down to.
- * @param fn Callback function to call for each number.
- * @param step Number to subtract each iteration, default = 1.
- * @returns number[] containing numbers from number down to .
- * @extra Optionally calls [fn] callback for each number in that array.
- * [step] allows multiples greater than 1.
- * @example
- * (8).downto(3) -> [8, 7, 6, 5, 4, 3]
- * (8).downto(3, function(n) {
- * // This function is called 6 times receiving n as the value.
- * });
- * (8).downto(2, null, 2) -> [8, 6, 4, 2]
- **/
- downto(num: number, fn?: (n: number) => void, step?: number): number[];
-
- /**
- * Takes the number as milliseconds and returns a unit-adjusted localized string.
- * @param locale Locale to convert the ms to, default = currentLocale.
- * @returns String representation of the duration in [locale].
- * @extra This method is the same as %Date#relative% without
- * the localized equivalent of "from now" or "ago".
- * [locale] can be passed as the first (and only) parameter.
- * Note that this method is only available when the dates
- * package is included.
- * @example
- * (500).duration() -> '500 milliseconds'
- * (1200).duration() -> '1 second'
- * (75).minutes().duration() -> '1 hour'
- * (75).minutes().duration('es') -> '1 hora'
- **/
- duration(locale?: string): string;
-
- /**
- * Shortcut for %Math.floor% that also allows a .
- * @param precision Rounding precision, default = 0.
- * @returns Floor rounded number.
- * @example
- * (3.241).floor() -> 3
- * (-3.841).floor() -> -4
- * (3.241).floor(2) -> 3.24
- * (3748).floor(-2) -> 3700
- **/
- floor(precision?: number): number;
-
- /**
- * Formats the number to a readable string.
- * @method format([place] = 0, [thousands] = ',', [decimal] = '.')
- * @param place default = 0.
- * @param thousands Thousands character, default = ','.
- * @param decimal Decimal character, default = '.'.
- * @returns String
- * @extra If [place] is %undefined%, will automatically determine the place.
- * [thousands] is the character used for the thousands separator.
- * [decimal] is the character used for the decimal point.
- * @example
- * (56782).format() -> '56,782'
- * (56782).format(2) -> '56,782.00'
- * (4388.43).format(2, ' ') -> '4 388.43'
- * (4388.43).format(2, '.', ',') -> '4.388,43'
- **/
- format(place?: number, thousands?: string, decimal?: string): string;
-
- /**
- * Converts the number to hexidecimal.
- * @method hex([pad] = 1)
- * @param pad Number of characters to pad.
- * @returns Hexidecimal number.
- * @extra [pad] will pad the resulting string to that many places.
- * @example
- * (255).hex() -> 'ff';
- * (255).hex(4) -> '00ff';
- * (23654).hex() -> '5c66';
- **/
- hex(pad?: number): string;
-
- /**
- * Returns true if the number is even.
- * @returns True if the number is even, otherwise false.
- * @example
- * (6).isEven() -> true
- * (17).isEven() -> false
- **/
- isEven(): boolean;
-
- /**
- * Returns true if the number has no trailing decimal.
- * @returns True if the number is an integer, otherwise false.
- * @example
- * (420).isInteger() -> true
- * (4.5).isInteger() -> false
- **/
- isInteger(): boolean;
-
- /**
- * Returns true if the number is a multiple of .
- * @param num Number to check for multiple of.
- * @returns True if the number is a multiple of .
- * @example
- * (6).isMultipleOf(2) -> true
- * (17).isMultipleOf(2) -> false
- * (32).isMultipleOf(4) -> true
- * (34).isMultipleOf(4) -> false
- **/
- isMultipleOf(num: number): boolean;
-
- /**
- * Returns true if the number is odd.
- * @returns True if the number is odd, otherwise false.
- * @example
- * (3).isOdd() -> true
- * (18).isOdd() -> false
- **/
- isOdd(): boolean;
-
- /**
- * Returns the logarithm of the number with base ,
- * or natural logarithm of the number if is undefined.
- * @param base default = Math.E.
- * @returns Logarithm of the number with base .
- * @example
- * (64).log(2) -> 6
- * (9).log(3) -> 2
- * (5).log() -> 1.6094379124341003
- **/
- log(base?: number): number;
-
- /**
- * Determines the absolute value of the number.
- * @returns Absolute value of the number.
- * @example
- * (-3).abs() -> 3
- **/
- abs(): number;
-
- /**
- * sine
- **/
- sin(): number;
-
- /**
- * arcsine
- **/
- asin(): number;
-
- /**
- * cosine
- **/
- cos(): number;
-
- /**
- * arccosine
- **/
- acos(): number;
-
- /**
- * tangent
- **/
- tan(): number;
-
- /**
- * arctangent
- **/
- atan(): number;
-
- /**
- * @example
- * (1024).sqrt() -> 32
- **/
- sqrt(): number;
-
- /**
- * E^X
- **/
- exp(): number;
-
- /**
- * n^m
- * @example
- * (3).pow(3) -> 27
- **/
- pow(num: number): number;
-
- /***
- * Returns the number as a string in metric notation.
- * @method metric([precision] = 0, [limit] = 1)
- * @param precision Rounding precision, default = 0.
- * @param limit Upper limit for the metric units, default = 1 which is kilo.
- * @returns Metric string notation for the number.
- * @extra [precision] will round to the given precision.
- * Both very large numbers and very small numbers are supported.
- * [limit] is the upper limit for the units.
- * The default is %1%, which is "kilo".
- * If [limit] is %false%, the upper limit will be "exa".
- * The lower limit is "nano", and cannot be changed.
- * @example
- * (1000).metric() -> "1k"
- * (1000000).metric() -> "1,000k"
- * (1000000).metric(0, false) -> "1M"
- * (1249).metric(2) + 'g' -> "1.25kg"
- * (0.025).metric() + 'm' -> "25mm"
- **/
- metric(precision?: number, limit?: number): string;
-
- /**
- * @see metric
- * @limit If false the upper limit for the metric units will be 'exa'.
- **/
- metric(precision?: number, limit?: boolean): string;
-
- /**
- * Returns an ordinalized (English) string, i.e. "1st", "2nd", etc.
- * @returns Ordinalized string number equivalent.
- * @example
- * (1).ordinalize() -> '1st';
- * (2).ordinalize() -> '2nd';
- * (8).ordinalize() -> '8th';
- **/
- ordinalize(): string;
-
- /**
- * Pads a number with "0" to .
- * @method pad( = 0, [sign] = false, [base] = 10)
- * @param place Pad up to this many characters, default = 0.
- * @param sign True to force the sign (+/-), default = false.
- * @param base The base of the new number, default = 10.
- * @returns Padded number.
- * @extra [sign] allows you to force the sign as well (+05, etc). [base] can change the base for numeral conversion.
- * @example
- * (5).pad(2) -> '05'
- * (-5).pad(4) -> '-0005'
- * (82).pad(3, true) -> '+082'
- **/
- pad(place?: number, sign?: boolean, base?: number): string;
-
- /**
- * Shortcut for %Math.round% that also allows a [precision].
- * @param precision Rounding precision, default = 0.
- * @returns Rounded number to [precision].
- * @example
- * (3.241).round() -> 3
- * (-3.841).round() -> -4
- * (3.241).round(2) -> 3.24
- * (3748).round(-2) -> 3800
- **/
- round(precision?: number): number;
-
- /***
- * Calls a number of times equivalent to the number.
- * @param fn Callback function to call n times.
- * @returns The original number.
- * @example
- * (8).times(function(i) {
- * // This function is called 8 times.
- * });
- ***/
- times(fn: (i: number) => void): number;
-
- /***
- * Returns a number. This is mostly for compatibility reasons.
- * @returns The original number.
- * @example
- * (420).toNumber() -> 420
- ***/
- toNumber(): number;
-
- /**
- * Takes the number as a corresponding unit of time and converts to [unit].
- * @method [unit]()
- * @returns Number
- * @extra Method names can be both singular and plural.
- * Note that as "a month" is ambiguous as a unit of time,
- * %months% will be equivalent to 30.4375 days, the average
- * number in a month. Be careful using %months% if you need
- * exact precision.
- * @set
- * millisecond
- * milliseconds
- * second
- * seconds
- * minute
- * minutes
- * hour
- * hours
- * day
- * days
- * week
- * weeks
- * month
- * months
- * year
- * years
- * @example
- * (5).milliseconds() -> 5
- * (10).hours() -> 36000000
- * (1).day() -> 86400000
- **/
- millisecond(): number;
-
- /**
- * @see millisecond
- **/
- milliseconds(): number;
-
- /**
- * @see millisecond
- **/
- second(): number;
-
- /**
- * @see millisecond
- **/
- seconds(): number;
-
- /**
- * @see millisecond
- **/
- minute(): number;
-
- /**
- * @see millisecond
- **/
- minutes(): number;
-
- /**
- * @see millisecond
- **/
- hour(): number;
-
- /**
- * @see millisecond
- **/
- hours(): number;
-
- /**
- * @see millisecond
- **/
- day(): number;
-
- /**
- * @see millisecond
- **/
- days(): number;
-
- /**
- * @see millisecond
- **/
- week(): number;
-
- /**
- * @see millisecond
- **/
- weeks(): number;
-
- /**
- * @see millisecond
- **/
- month(): number;
-
- /**
- * @see millisecond
- **/
- months(): number;
-
- /**
- * @see millisecond
- **/
- year(): number;
-
- /**
- * @see millisecond
- **/
- years(): number;
-
- /**
- * Returns a date units after , where is the number.
- * @method [unit]After([d], [locale] = currentLocale)
- * @param d Date to start from.
- * @param locale Locale for return Date, default = currentLocale.
- * @returns Date units after .
- * @extra [d] will accept a date object, timestamp, or text format.
- * Note that "months" is ambiguous as a unit of time. If the
- * target date falls on a day that does not exist
- * (ie. August 31 -> February 31), the date will be shifted
- * to the last day of the month. Be careful using %monthsAfter%
- * if you need exact precision. See @date_format for more.
- * @set
- * millisecondAfter
- * millisecondsAfter
- * secondAfter
- * secondsAfter
- * minuteAfter
- * minutesAfter
- * hourAfter
- * hoursAfter
- * dayAfter
- * daysAfter
- * weekAfter
- * weeksAfter
- * monthAfter
- * monthsAfter
- * yearAfter
- * yearsAfter
- * @example
- * (5).daysAfter('tuesday') -> 5 days after tuesday of this week
- * (1).yearAfter('January 23, 1997') -> January 23, 1998
- **/
- millisecondAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- millisecondAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- millisecondsAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- millisecondsAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- secondAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- secondAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- secondsAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- secondsAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- minuteAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- minuteAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- minutesAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- minutesAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- hourAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- hourAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- hoursAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- hoursAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- dayAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- dayAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- daysAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- daysAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- weekAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- weekAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- weeksAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- weeksAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- monthAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- monthAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- monthsAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- yearAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- yearAfter(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- yearsAfter(d: string, locale?: string): Date;
-
- /**
- * @see millisecondAfter
- **/
- yearsAfter(d: Date, locale?: string): Date;
-
- /**
- * Returns a date that is units ago.
- * @method [unit]Ago()
- * @returns Date
- * @extra Note that "months" is ambiguous as a unit of time.
- * If the target date falls on a day that does not exist
- * (ie. August 31 -> February 31), the date will be shifted
- * to the last day of the month. Be careful using %monthsAgo%
- * if you need exact precision.
- * @set
- * millisecondAgo
- * millisecondsAgo
- * secondAgo
- * secondsAgo
- * minuteAgo
- * minutesAgo
- * hourAgo
- * hoursAgo
- * dayAgo
- * daysAgo
- * weekAgo
- * weeksAgo
- * monthAgo
- * monthsAgo
- * yearAgo
- * yearsAgo
- * @example
- * (5).weeksAgo() -> 5 weeks ago
- * (1).yearAgo() -> January 23, 1996
- **/
- millisecondAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- millisecondsAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- secondAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- secondsAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- minuteAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- minutesAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- hourAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- hoursAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- dayAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- daysAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- weekAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- weeksAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- monthAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- monthsAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- yearAgo(): Date;
-
- /**
- * @see millisecondAgo
- **/
- yearsAgo(): Date;
-
- /**
- * Returns a date that is units before , where is the number.
- * @method [unit]Before([d], [locale] = currentLocale)
- * @param d Date to start from.
- * @param locale Locale for return Date, default = currentLocale.
- * @returns Date units before .
- * @extra [d] will accept a date object, timestamp, or text format.
- * Note that "months" is ambiguous as a unit of time. If the
- * target date falls on a day that does not exist
- * (ie. August 31 -> February 31), the date will be shifted to
- * the last day of the month. Be careful using %monthsBefore%
- * if you need exact precision. See @date_format for more.
- * @set
- * millisecondBefore
- * millisecondsBefore
- * secondBefore
- * secondsBefore
- * minuteBefore
- * minutesBefore
- * hourBefore
- * hoursBefore
- * dayBefore
- * daysBefore
- * weekBefore
- * weeksBefore
- * monthBefore
- * monthsBefore
- * yearBefore
- * yearsBefore
- * @example
- * (5).daysBefore('tuesday') -> 5 days before tuesday of this week
- * (1).yearBefore('January 23, 1997') -> January 23, 1996
- **/
- millisecondBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- millisecondBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- millisecondsBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- millisecondsBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- secondBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- secondBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- secondsBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- secondsBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- minuteBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- minuteBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- minutesBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- minutesBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- hourBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- hourBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- hoursBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- hoursBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- dayBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- dayBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- daysBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- daysBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- weekBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- weekBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- weeksBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- weeksBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- monthBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- monthBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- monthsBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- monthsBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- yearBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- yearBefore(d: Date, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- yearsBefore(d: string, locale?: string): Date;
-
- /**
- * @see millisecondBefore
- **/
- yearsBefore(d: Date, locale?: string): Date;
-
- /**
- * Returns a date units from now.
- * @method [unit]FromNow()
- * @returns Date
- * @extra Note that "months" is ambiguous as a unit of time.
- * If the target date falls on a day that does not exist
- * (ie. August 31 -> February 31), the date will be shifted
- * to the last day of the month. Be careful using %monthsFromNow%
- * if you need exact precision.
- * @set
- * millisecondFromNow
- * millisecondsFromNow
- * secondFromNow
- * secondsFromNow
- * minuteFromNow
- * minutesFromNow
- * hourFromNow
- * hoursFromNow
- * dayFromNow
- * daysFromNow
- * weekFromNow
- * weeksFromNow
- * monthFromNow
- * monthsFromNow
- * yearFromNow
- * yearsFromNow
- * @example
- * (5).weeksFromNow() -> 5 weeks ago
- * (1).yearFromNow() -> January 23, 1998
- **/
- millisecondFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- millisecondsFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- secondFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- secondsFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- minuteFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- minutesFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- hourFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- hoursFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- dayFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- daysFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- weekFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- weeksFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- monthFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- monthsFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- yearFromNow(): Date;
-
- /**
- * @see millisecondFromNow
- **/
- yearsFromNow(): Date;
-
- /**
- * Returns an array containing numbers from the number up to .
- * @param num Number to count down to.
- * @param fn Callback function to call for each number.
- * @param step Number to add each iteration, default = 1.
- * @returns number[] containing numbers from number up to .
- * @extra Optionally calls [fn] callback for each number in that array.
- * [step] allows multiples greater than 1.
- * @example
- * (2).upto(6) -> [2, 3, 4, 5, 6]
- * (2).upto(6, function(n) {
- * // This function is called 5 times receiving n as the value.
- * });
- * (2).upto(8, null, 2) -> [2, 4, 6, 8]
- **/
- upto(num: number, fn?: Function, step?: number): number[];
-}
-
-//Static members on native types.
-interface ArrayConstructor {
-
- /**
- * Alternate array constructor.
- * @param args Elements to create the array from.
- * @returns Array containing the elements in .
- * @extra This method will create a single array by calling %concat%
- * on all arguments passed. In addition to ensuring that an unknown
- * variable is in a single, flat array (the standard constructor will
- * create nested arrays, this one will not), it is also a useful
- * shorthand to convert a function's arguments object into a standard
- * array.
- * @example
- * Array.create('one', true, 3) -> ['one', true, 3]
- * Array.create(['one', true, 3]) -> ['one', true, 3]
- * Array.create(function(n) {
- * return arguments;
- * }('howdy', 'doody'));
- **/
- create(...args: T[]): T[];
-
- /**
- * Returns true if is an Array.
- * @param obj Object to check if it is an Array.
- * @returns True if is of type Array.
- * @extra This method is provided for browsers that don't support it internally.
- * @example
- * Array.isArray(3) -> false
- * Array.isArray(true) -> false
- * Array.isArray('wasabi') -> false
- * Array.isArray([1,2,3]) -> true
- **/
- isArray(obj: any): boolean;
-}
-
-interface Array {
-
- /**
- * Adds to the array.
- * @param el Elements to add to the array.
- * @param index Specifies the index where to insert/add into the array, default = Array.length
- * @returns Array containing the added elements at position .
- * @extra If [index] is specified, it will add at [index], otherwise
- * adds to the end of the array. %add% behaves like %concat%
- * in that if is an array it will be joined, not inserted.
- * This method will change the array! Use %include% for a
- * non-destructive alias. Also, %insert% is provided as an
- * alias that reads better when using an index.
- * @example
- * [1,2,3,4].add(5) -> [1,2,3,4,5]
- * [1,2,3,4].add([5,6,7]) -> [1,2,3,4,5,6,7]
- * [1,2,3,4].insert(8, 1) -> [1,8,2,3,4]
- **/
- add(el: T, index?: number): T[];
-
- /**
- * @see add
- **/
- add(el: T[], index?: number): T[];
-
- /**
- * @see add
- **/
- insert(el: T, index?: number): T[];
-
- /**
- * @see add
- **/
- insert(el: T[], index?: number): T[];
-
- /***
- * Gets the element(s) at a given index.
- * @param index Element's index to retrieve.
- * @param loop Continue counting if the index overshoots the Array.length
- * @returns The element at .
- * @extra When [loop] is true, overshooting the end of the array (or the beginning)
- * will begin counting from the other end. As an alternate syntax, passing
- * multiple indexes will get the elements at those indexes.
- * @example
- * [1,2,3].at(0) -> 1
- * [1,2,3].at(2) -> 3
- * [1,2,3].at(4) -> 2
- * [1,2,3].at(4, false) -> null
- * [1,2,3].at(-1) -> 3
- * [1,2,3].at(0,1) -> [1,2]
- **/
- at(index: number, loop?: boolean): T;
-
- /**
- * @see at
- * @param start Start index.
- * @param end End index.
- * @return Elements between and
- **/
- at(start: number, stop: number): T[];
-
- /**
- * Averages all values in the array.
- * @param map Maps each element to a number.
- * @returns The average of the entire array.
- * @extra [map] may be a function mapping the value to be averaged or
- * a string acting as a shortcut.
- * @example
- * [1,2,3].average() -> 2
- * [{age:35},{age:11},{age:11}].average(function(n) {
- * return n.age;
- * }); -> 19
- * [{age:35},{age:11},{age:11}].average('age') -> 19
- **/
- average(map?: (e: T) => number): number;
-
- /**
- * Clones the array.
- * @returns Cloned array.
- * @example
- * [1,2,3].clone() -> [1,2,3]
- **/
- clone(): T[];
-
- /**
- * Removes all instances of %undefined%, %null%, and %NaN% from the array.
- * @param all Remove false elements, default = false.
- * @returns The same array with the special values removed.
- * @extra If [all] is %true%, all "falsy" elements will be removed. This includes empty strings, 0, and false.
- * @example
- * [1,null,2,undefined,3].compact() -> [1,2,3]
- * [1,'',2,false,3].compact() -> [1,'',2,false,3]
- * [1,'',2,false,3].compact(true) -> [1,2,3]
- **/
- compact(all?: boolean): T[];
-
- /**
- * Counts all elements in the array that match .
- * @param f object to match against in the array.
- * @returns Number of elements in the array that match .
- * @extra will match a string, number, array, object, or alternately test against a function or regex. This method implements @array_matching.
- * @example
- * [1,2,3,1].count(1) -> 2
- * ['a','b','c'].count(/b/) -> 1
- * [{a:1},{b:2}].count(function(n) {
- * return n['a'] > 1;
- * }); -> 0
- **/
- count(f: T): number;
-
- /**
- * Runs against each element in the array. Enhanced version of %Array#forEach%.
- * @param fn Callback function for applied to each element in the array.
- * @param index Starting index, default = 0.
- * @param loop Continue from the beginning if the end of the array is reached, default = false.
- * @returns Original array.
- * @extra Parameters passed to are identical to %forEach%,
- * ie. the first parameter is the current element, second
- * parameter is the current index, and third parameter is
- * the array itself. If returns %false% at any time
- * it will break out of the loop. Once %each% finishes,
- * it will return the array. If [index] is passed, will
- * begin at that index and work its way to the end. If [loop]
- * is true, it will then start over from the beginning of the
- * array and continue until it reaches [index] - 1.
- * @example
- * [1,2,3,4].each(function(n) {
- * // Called 4 times: 1, 2, 3, 4
- * });
- * [1,2,3,4].each(function(n) {
- * // Called 4 times: 3, 4, 1, 2
- * }, 2, true);
- **/
- each(
- fn: (element: T, index?: number, array?: T[]) => any,
- index?: number,
- loop?: boolean): T[];
-
- /**
- * Returns true if all elements in the array match .
- * @param f Match all elements to this.
- * @param scope [this] object.
- * @returns Boolean
- * @extra [scope] is the %this% object. %all% is provided an alias.
- * In addition to providing this method for browsers that don't
- * support it natively, this method also implements @array_matching.
- * @example
- * ['a','a','a'].every(function(n) {
- * return n == 'a';
- * });
- * ['a','a','a'].every('a') -> true
- * [{a:2},{a:2}].every({a:2}) -> true
- **/
- every(f: T, scope?: any): boolean;
-
- /**
- * @see every
- * @note Already defined in lib.d.ts.
- **/
- //every(f: (element: T, index: number, array: T[]) => boolean, scope?: any): boolean;
-
- /**
- * @see every
- **/
- all(f: T, scope?: any): boolean;
-
- /**
- * @see every
- **/
- all(f: (element: T, index: number, array: T[]) => boolean, scope?: any): boolean;
-
- /**
- * Removes any element in the array that matches [f1], [f2], etc.
- * @param f Elements to find in the array and remove.
- * @returns A copy of the original array with all instances of removed.
- * @extra This is a non-destructive alias for %remove%. It will not change the original array. This method implements @array_matching.
- * @example
- * [1,2,3].exclude(3) -> [1,2]
- * ['a','b','c'].exclude(/b/) -> ['a','c']
- * [{a:1},{b:2}].exclude(function(n) {
- * return n['a'] == 1;
- * }); -> [{b:2}]
- **/
- exclude(...f: T[]): T[];
-
- /**
- * @see exclude
- **/
- exclude(f: (element: T, index: number, array: T[]) => boolean): T[];
-
- /**
- * Returns any elements in the array that match .
- * @param f Find these elements in the array.
- * @param scope %this% object while filtering.
- * @returns Array containing th items found in the array.
- * @extra [scope] is the %this% object. In addition to providing this
- * method for browsers that don't support it natively, this method
- * also implements @array_matching.
- * @example
- * [1,2,3].filter(function(n) {
- * return n > 1;
- * });
- * [1,2,2,4].filter(2) -> 2
- **/
- filter(f: T, scope?: any): T[];
-
- /**
- * @see filter
- * @note Already defined in lib.d.ts.
- **/
- //filter(f: (element: T, index: number, array: T[]) => boolean, scope?: any): T[];
-
- /**
- * Returns the first element that matches .
- * @param f Elements to match against.
- * @param index Index to start searching from, default = 0.
- * @param loop Loop around the end of the array, default = false.
- * @returns First element matching .
- * @extra will match a string, number, array, object, or alternately
- * test against a function or regex. Starts at [index], and will
- * continue once from index = 0 if [loop] is true. This method
- * implements @array_matching.
- * @example
- * [{a:1,b:2},{a:1,b:3},{a:1,b:4}].find(function(n) {
- * return n['a'] == 1;
- * }); -> {a:1,b:3}
- * ['cuba','japan','canada'].find(/^c/, 2) -> 'canada'
- **/
- find(f: T, index?: number, loop?: boolean): T;
-
- /**
- * @see find
- **/
- find(f: (element: T, index: number, array: T[]) => boolean, index?: number, loop?: boolean): T;
-
- /**
- * Returns all elements that match .
- * @param f Element to match against.
- * @param index Index to start searching from, default = 0.
- * @param loop Loop around the end of the array, default = false.
- * @returns Elements matching .
- * @extra will match a string, number, array, object, or alternately
- * test against a function or regex. Starts at [index], and will
- * continue once from index = 0 if [loop] is true. This method
- * implements @array_matching.
- * @example
- * [{a:1,b:2},{a:1,b:3},{a:2,b:4}].findAll(function(n) {
- * return n['a'] == 1;
- * }); -> [{a:1,b:3},{a:1,b:4}]
- * ['cuba','japan','canada'].findAll(/^c/) -> 'cuba','canada'
- * ['cuba','japan','canada'].findAll(/^c/, 2) -> 'canada'
- **/
- findAll(f: T, index?: number, loop?: boolean): T[];
-
- /**
- * @see findAll
- **/
- findAll(f: (element: T, index: number, array: T[]) => boolean, index?: number, loop?: boolean): T[];
-
- /**
- * Returns the index of the first element that matches
- * or -1 if not found.
- * @method findIndex(, [startIndex] = 0, [loop] = false)
- * @param f Element to match against.
- * @param startIndex Index to start searching from, default = 0.
- * @param loop Loop around the end of th array, default = false.
- * @returns Index at which is found.
- * @extra This method has a few notable differences to native %indexOf%.
- * Although will similarly match a primitive such as a string
- * or number, it will also match deep objects and arrays that are
- * not equal by reference (%===%). Additionally, if a function is
- * passed it will be run as a matching function (similar to the
- * behavior of %Array#filter%) rather than attempting to find that
- * function itself by reference in the array. Starts at [index],
- * and will continue once from index = 0 if [loop] is true.
- * This method implements @array_matching.
- * @example
- * [1,2,3,4].findIndex(3); -> 2
- * [1,2,3,4].findIndex(function(n) {
- * return n % 2 == 0;
- * }); -> 1
- * ['one','two','three'].findIndex(/th/); -> 2
- **/
- findIndex(f: T, startIndex?: number, loop?: boolean): number;
-
- /**
- * @see findIndex
- **/
- findIndex(f: (element: T, index: number, array: T[]) => boolean, startIndex?: number, loop?: boolean): number;
-
- /**
- * Returns the first element(s) in the array.
- * @param num Retrieve this many elements in the array, default = 1.
- * @returns first elements in the array.
- * @extra When is passed, returns the first elements in the array.
- * @note If is omitted then the return type is the element itself, not an array of the element,
- * For example 1 instead of [1], however if is present the result is always wrapped in an
- * array like first(1) -> [1], not 1.
- * @example
- * [1,2,3].first() -> 1
- * [1,2,3].first(2) -> [1,2]
- **/
- first(): T;
-
- /**
- * @see first
- **/
- first(num: number): T[];
-
- /**
- * Returns a flattened, one-dimensional copy of the array.
- * @param limit Limit the flattening to this depth, default = Infinity.
- * @returns Flattened array.
- * @extra You can optionally specify a [limit], which will only flatten
- * that depth.
- * @example
- * [[1], 2, [3]].flatten() -> [1,2,3]
- * [['a'],[],'b','c'].flatten() -> ['a','b','c']
- **/
- flatten(limit?: number): T[];
-
- /**
- * Iterates over the array, calling [fn] on each loop.
- * @param fn Callback function for each element in the array.
- * @param scope Scope during [fn] callbacks, default = this.
- * @returns Nothing
- * @extra This method is only provided for those browsers that do not support
- * it natively. [scope] becomes the %this% object.
- * @example
- * ['a','b','c'].forEach(function(a) {
- * // Called 3 times: 'a','b','c'
- * });
- * @note Already defined in lib.d.ts.
- **/
- //forEach(fn: (element: T, index: number, array: T[]) => void, scope?: any): void;
-
- /**
- * Returns a slice of the array from .
- * @param index Index to start the slice from.
- * @returns Subarray starting from [index] to the end of the original array.
- * @example
- * [1,2,3].from(1) -> [2,3]
- * [1,2,3].from(2) -> [3]
- **/
- from(index: number): T[];
-
- /**
- * Groups the array by