1 | /**
|
---|
2 | * Assigns (shallow copies) the properties of `src` onto `dest`, if the
|
---|
3 | * corresponding property on `dest` === `undefined`.
|
---|
4 | *
|
---|
5 | * @param {Object} dest The destination object.
|
---|
6 | * @param {Object} src The source object.
|
---|
7 | * @return {Object} The destination object (`dest`)
|
---|
8 | */
|
---|
9 | export declare function defaults(dest: any, src: any): any;
|
---|
10 | /**
|
---|
11 | * Truncates the `str` at `len - ellipsisChars.length`, and adds the `ellipsisChars` to the
|
---|
12 | * end of the string (by default, two periods: '..'). If the `str` length does not exceed
|
---|
13 | * `len`, the string will be returned unchanged.
|
---|
14 | *
|
---|
15 | * @param {String} str The string to truncate and add an ellipsis to.
|
---|
16 | * @param {Number} truncateLen The length to truncate the string at.
|
---|
17 | * @param {String} [ellipsisChars=...] The ellipsis character(s) to add to the end of `str`
|
---|
18 | * when truncated. Defaults to '...'
|
---|
19 | */
|
---|
20 | export declare function ellipsis(str: string, truncateLen: number, ellipsisChars?: string): string;
|
---|
21 | /**
|
---|
22 | * Supports `Array.prototype.indexOf()` functionality for old IE (IE8 and below).
|
---|
23 | *
|
---|
24 | * @param {Array} arr The array to find an element of.
|
---|
25 | * @param {*} element The element to find in the array, and return the index of.
|
---|
26 | * @return {Number} The index of the `element`, or -1 if it was not found.
|
---|
27 | */
|
---|
28 | export declare function indexOf<T>(arr: T[], element: T): number;
|
---|
29 | /**
|
---|
30 | * Removes array elements based on a filtering function. Mutates the input
|
---|
31 | * array.
|
---|
32 | *
|
---|
33 | * Using this instead of the ES5 Array.prototype.filter() function, to allow
|
---|
34 | * Autolinker compatibility with IE8, and also to prevent creating many new
|
---|
35 | * arrays in memory for filtering.
|
---|
36 | *
|
---|
37 | * @param {Array} arr The array to remove elements from. This array is
|
---|
38 | * mutated.
|
---|
39 | * @param {Function} fn A function which should return `true` to
|
---|
40 | * remove an element.
|
---|
41 | * @return {Array} The mutated input `arr`.
|
---|
42 | */
|
---|
43 | export declare function remove<T>(arr: T[], fn: (item: T) => boolean): void;
|
---|
44 | /**
|
---|
45 | * Performs the functionality of what modern browsers do when `String.prototype.split()` is called
|
---|
46 | * with a regular expression that contains capturing parenthesis.
|
---|
47 | *
|
---|
48 | * For example:
|
---|
49 | *
|
---|
50 | * // Modern browsers:
|
---|
51 | * "a,b,c".split( /(,)/ ); // --> [ 'a', ',', 'b', ',', 'c' ]
|
---|
52 | *
|
---|
53 | * // Old IE (including IE8):
|
---|
54 | * "a,b,c".split( /(,)/ ); // --> [ 'a', 'b', 'c' ]
|
---|
55 | *
|
---|
56 | * This method emulates the functionality of modern browsers for the old IE case.
|
---|
57 | *
|
---|
58 | * @param {String} str The string to split.
|
---|
59 | * @param {RegExp} splitRegex The regular expression to split the input `str` on. The splitting
|
---|
60 | * character(s) will be spliced into the array, as in the "modern browsers" example in the
|
---|
61 | * description of this method.
|
---|
62 | * Note #1: the supplied regular expression **must** have the 'g' flag specified.
|
---|
63 | * Note #2: for simplicity's sake, the regular expression does not need
|
---|
64 | * to contain capturing parenthesis - it will be assumed that any match has them.
|
---|
65 | * @return {String[]} The split array of strings, with the splitting character(s) included.
|
---|
66 | */
|
---|
67 | export declare function splitAndCapture(str: string, splitRegex: RegExp): string[];
|
---|
68 | /**
|
---|
69 | * Function that should never be called but is used to check that every
|
---|
70 | * enum value is handled using TypeScript's 'never' type.
|
---|
71 | */
|
---|
72 | export declare function throwUnhandledCaseError(theValue: never): void;
|
---|