UNPKG

ip-utils

Version:

Library of useful functions related to IP

7 lines (6 loc) 217 B
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); }