UNPKG
ip-utils
Version:
latest (2.4.0)
2.4.0
2.3.0
2.2.2
2.2.1
2.1.1
2.1.0
2.0.3
2.0.2
2.0.1
2.0.0
Library of useful functions related to IP
github.com/librasean/IP-Utils
librasean/IP-Utils
ip-utils
/
lib
/
module
/
esnext
/
Mask.js
7 lines
(6 loc)
•
217 B
JavaScript
View Raw
1
2
3
4
5
6
7
import
{ fromLong }
from
'./FromLong'
;
export
function
mask
(
subnet
) {
let
split = subnet.
split
(
'/'
);
let
longMask =
Math
.
pow
(
2
,
32
) -
Math
.
pow
(
2
,
32
-
parseInt
(split[
1
],
10
));
return
fromLong
(longMask); }