1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | Number.prototype.toPaddedString = function (length, radix) {
|
13 | var str = this.toString(radix || 10);
|
14 | return "0".repeat(length - str.length) + str;
|
15 | };
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | Number.isOdd = function (num) {
|
23 | return num % 2 === 1;
|
24 | };
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | Number.isEven = function (num) {
|
32 | return num % 2 === 0;
|
33 | };
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | Number.isBetween = function (num, min, max, match) {
|
44 | if (match === void 0) { match = false; }
|
45 | min = min || 0;
|
46 | max = max || 0;
|
47 | if (min > max) {
|
48 | min ^= max;
|
49 | max ^= min;
|
50 | min ^= max;
|
51 | }
|
52 | return match == true ? num >= min && num <= max : num > min && num < max;
|
53 | };
|
54 |
|
\ | No newline at end of file |