-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnumber.js
141 lines (110 loc) · 3.95 KB
/
number.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function warn(type, method, notPrototype){
if(type && method){
console.warn("Rearmed-js Overriding " + type + (notPrototype ? '.' : '.prototype.') + method, '. If this is a built-in browser method please report on Rearmed-js github issues.');
}else{
throw("incorrect number of arguments")
}
};
module.exports = warn;
},{}],2:[function(require,module,exports){
require('./number/ceil');
require('./number/floor');
require('./number/isDecimal');
require('./number/isEven');
require('./number/isInteger');
require('./number/isOdd');
require('./number/round');
},{"./number/ceil":3,"./number/floor":4,"./number/isDecimal":5,"./number/isEven":6,"./number/isInteger":7,"./number/isOdd":8,"./number/round":9}],3:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.ceil){
warn('Number', 'ceil');
}
Number.prototype.ceil = function(){
return Math.ceil(this);
};
Object.defineProperty(Number.prototype, "ceil", {enumerable: false});
}(this));
},{"./../functions/warn":1}],4:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.floor){
warn('Number', 'floor');
}
Number.prototype.floor = function(){
return Math.floor(this);
};
Object.defineProperty(Number.prototype, "floor", {enumerable: false});
}(this));
},{"./../functions/warn":1}],5:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.isDecimal){
warn('Number', 'isDecimal');
}
Number.prototype.isDecimal = function(){
if(Number.isInteger){
return !Number.isInteger(this);
}else{
return isFinite(this) && Math.floor(this) !== this;
}
}
Object.defineProperty(Number.prototype, "isDecimal", {enumerable: false});
}(this));
},{"./../functions/warn":1}],6:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.isEven){
warn('Number', 'isEven');
}
Number.prototype.isEven = function(){
return isFinite(this) && this % 2 === 0;
};
Object.defineProperty(Number.prototype, "isEven", {enumerable: false});
}(this));
},{"./../functions/warn":1}],7:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.isInteger){
warn('Number', 'isInteger');
}
Number.prototype.isInteger = function(){
if(Number.isInteger){
return Number.isInteger(this);
}else{
return isFinite(this) && Math.floor(this) === this;
}
};
Object.defineProperty(Number.prototype, "isInteger", {enumerable: false});
}(this));
},{"./../functions/warn":1}],8:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.isOdd){
warn('Number', 'isOdd');
}
Number.prototype.isOdd = function(){
return isFinite(this) && Math.abs(this % 2) === 1;
};
Object.defineProperty(Number.prototype, "isOdd", {enumerable: false});
}(this));
},{"./../functions/warn":1}],9:[function(require,module,exports){
(function(){
"use strict";
var warn = require('./../functions/warn');
if(Number.prototype.round){
warn('Number', 'round');
}
Number.prototype.round = function(){
return Math.round(this);
};
Object.defineProperty(Number.prototype, "round", {enumerable: false});
}(this));
},{"./../functions/warn":1}]},{},[2]);