code: function (net) {
  
      if (typeof net === "string")
        net = this.parseIp(net);
  
      let s = 0;
      let d = 0;
      let t = net & 1;
      let wild = t;
      for (let i = 0; i < 32; i++) {
        d += t ^ net & 1;
        t = net & 1;
        net >>>= 1;
        s += t;
      }
      if (d !== 1) {
        throw new Error('Invalid Netmask ' + net);
      }
      if (wild)
        s = 32 - s;
      return s;
    }
docs: Source: http://www.xarg.org/tools/subnet-calculator/