name:
dist/Utilities/MoreUtils.d.ts
-rw-r--r--
4248
1/**
2 * If the value is UNDEFINED, return true.
3 * @param value - Value to check if undefined.
4 * @returns {boolean}
5 */
6declare function isUndefined(value: any): boolean;
7/**
8 * If the value is DEFINED, return true.
9 * @param value - Value to check if is defined.
10 * @returns {boolean}
11 */
12declare function isDefined(value: any): boolean;
13/**
14 * Returns true if value is an instance of a Array.
15 * @param value
16 * @returns {boolean}
17 */
18declare function isArray(value: any): boolean;
19/**
20 * Alphabetical character to number.
21 * @param chr
22 * @returns {number}
23 */
24declare function characterToNumber(chr: any): number;
25/**
26 * Converts a number to an alphabetical character.
27 * @param num
28 * @returns {string}
29 */
30declare function numberToCharacter(num: any): string;
31/**
32 * Converts a quoted string to an un-quoted string: `"hey"` to `hey`
33 * @param str
34 * @returns {string}
35 */
36declare function string(str: any): any;
37/**
38 * Converts XY coordinates (eg {0, 0}) to A1 coordinates (eg {A1}).
39 * @param x
40 * @param y
41 * @returns {string}
42 */
43declare function convertXYtoA1Coordinates(x: any, y: any): any;
44/**
45 * Returns RowCol coordinates of an A1 cellId
46 * @param cellId
47 * @returns {Object}
48 */
49declare function A1toRowColCoordinates(cellId: any): {
50 row: number;
51 col: number;
52};
53/**
54 * Class for building formatted strings with commas, forced number of leading and trailing zeros, and arbitrary leading
55 * and trailing strings.
56 */
57declare class NumberStringBuilder {
58 private n;
59 private shouldUseComma;
60 private integerZeroCount;
61 private decimalZeroCount;
62 private maxDecimalPlaces;
63 private headString;
64 private tailString;
65 /**
66 * Static builder, easier than `new`.
67 * @returns {NumberStringBuilder}
68 */
69 static start(): NumberStringBuilder;
70 /**
71 * Pads a given string with "0" on the right or left side until it is a certain width.
72 * @param {string} str - String to pad.
73 * @param {number} width - Width to pad to. If this is less than the strings length, will do nothing.
74 * @param {string} type - "right" or "left" side to append zeroes.
75 * @returns {string}
76 */
77 private static pad(str, width, type);
78 /**
79 * Rounds a number n to a certain number of digits.
80 * @param n - Number to round.
81 * @param digits - Digits to round to.
82 * @returns {number}
83 */
84 private static round(n, digits);
85 /**
86 * Set the number that we'll be formatting.
87 * @param {number} n - Number.
88 * @returns {NumberStringBuilder}
89 */
90 number(n: number): NumberStringBuilder;
91 /**
92 * The number of zeros to force on the left side of the decimal.
93 * @param {number} zeros
94 * @returns {NumberStringBuilder}
95 */
96 integerZeros(zeros: number): NumberStringBuilder;
97 /**
98 * The number of zeros to force on the right side of the decimal.
99 * @param {number} zeros
100 * @returns {NumberStringBuilder}
101 */
102 decimalZeros(zeros: number): NumberStringBuilder;
103 /**
104 * If you would like to force the maximum number of decimal places, without padding with zeros, set this.
105 * WARNING: Should not be used in conjunction with decimalZeros().
106 * @param {number} maxDecimalPlaces
107 * @returns {NumberStringBuilder}
108 */
109 maximumDecimalPlaces(maxDecimalPlaces: number): NumberStringBuilder;
110 /**
111 * Should digits to the left side of the decimal use comma-notation?
112 * @param {boolean} shouldUseComma
113 * @returns {NumberStringBuilder}
114 */
115 commafy(shouldUseComma: boolean): NumberStringBuilder;
116 /**
117 * String to append to the beginning of the final formatted number.
118 * @param {string} head
119 * @returns {NumberStringBuilder}
120 */
121 head(head: string): NumberStringBuilder;
122 /**
123 * String to append to the end of the final formatted number.
124 * @param {string} tail
125 * @returns {NumberStringBuilder}
126 */
127 tail(tail: string): NumberStringBuilder;
128 /**
129 * Building the string using the rules set in this builder.
130 * @returns {string}
131 */
132 build(): string;
133}
134export { isDefined, isUndefined, isArray, string, numberToCharacter, convertXYtoA1Coordinates, A1toRowColCoordinates, characterToNumber, NumberStringBuilder };