UNPKG
@planjs/utils
Version:
latest (1.18.4)
1.18.4
1.18.3
1.18.2
1.18.1
1.18.0
1.17.1
1.17.0
1.16.0
1.15.15
1.15.14
1.15.13
1.15.12
1.15.11
1.15.10
1.15.9
1.15.8
1.15.7
1.15.6
1.15.5
1.15.4
1.15.3
1.15.2
1.15.1
1.15.0
1.14.0
1.13.2
1.13.1
1.13.0
1.12.0
1.11.7
1.11.6
1.11.5
1.11.4
1.11.3
1.11.2
1.11.1
1.11.0
1.10.0
1.9.3
1.9.2
1.9.1
1.9.0
1.8.4
1.8.3
1.8.2
1.8.1
1.8.0
1.7.3
1.7.2
1.7.1
1.7.0
1.6.1
1.6.0
1.5.1
1.5.0
1.4.0
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.0
1.1.2
1.1.1
1.1.0
1.0.40
1.0.39
1.0.38
1.0.37
1.0.36
1.0.35
1.0.34
1.0.33
1.0.32
1.0.31
1.0.30
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.15
1.0.14
1.0.13
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.1
1.0.0
🔧 Common tools collection
planjs.github.io/utils/
planjs/utils
@planjs/utils
/
es
/
number
/
modulo.js
19 lines
(16 loc)
•
209 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/** * 取模 *
@param
n
*
@param
d
*
@category
Number
*/
function
modulo
(
n, d
) {
if
(d ===
0
) {
return
n; }
if
(d <
0
) {
return
NaN
; }
return
(n % d + d) % d; }
export
default
modulo;