code: function toInteger(val, def) {
      if (!is_1.isValue(val))
          return toDefault(null, def);
      var parsed = function_1.tryWrap(parseInt, val)(def);
      if (is_1.isInteger(parsed))
          return parsed;
      if (toBoolean(val))
          return 1;
      return 0;
  }
docs: To Integer
  Convert value to integer.
  
  @param val the value to convert to integer.
  @param def optional default value on null or error.