How to use the is_js.integer function in is_js

To help you get started, we’ve selected a few is_js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github komlev / forx / src / path.js View on Github external
getPath = (path, parseInteger = true) => {
    if (isPath(path)) return path
    let result = path
    if (is.function(result)) {
      result = getPath(result(), parseInteger)
    }
    if (!is.existy(result)) return result
    if (is.array(result)) {
      result = map(partialRight(getPath, [parseInteger]), result)
    }
    if (is.string(result)) {
      result = pathSplit(result)
      if (parseInteger && result) result = mapIndexes(result)
    }
    if (is.integer(result)) result = [result]
    return flattenFilter(result)
  },
  toLens = lensPath,
github Albert-Gao / veasy / src / ruleHandlers / numberRules.js View on Github external
export const isIntOrDecimal = (name, value) => ({
  isValid: is.integer(value * 1) || is.decimal(value * 1),
  errorText: `${name} should be either integer or decimal.`
});
github Albert-Gao / veasy / src / ruleHandlers / numberRules.js View on Github external
export const isInt = (name, value) => ({
  isValid: is.integer(value * 1),
  errorText: `${name} should be integer.`
});
github recursivefunk / good-env / index.js View on Github external
getNumber (key, defaultVal) {
      const value = this.get(key, defaultVal)
      const intVal = parseInt(value, 10)
      const valIsInt = is.integer(intVal)

      if (value === defaultVal) {
        return value
      } else if (valIsInt) {
        return intVal
      }
    },
github Albert-Gao / veasy / src / numberHandlers.js View on Github external
export function isIntHandler(value, schema) {
  const isValid = is.integer(value * 1);
  if (isValid) return;

  const errorText = `${NAME_PLACEHOLDER} should be integer.`;
  throwError(value, errorText);
}
github fernando-mc / serverless-finch / lib / validate.js View on Github external
conditionProps.forEach(p => {
          if (r.condition[p]) {
            if (p === 'httpErrorCodeReturnedEquals') {
              if (!is.integer(r.condition[p])) {
                validationErrors.push('httpErrorCodeReturnedEquals must be an integer');
              }
            } else {
              if (!is.string(r.condition[p])) {
                validationErrors.push(`${p} must be a string`);
              }
            }
          }
        });
      }
github komlev / forx / src / path.js View on Github external
isPathItemValid = (p) => {
    let result = is.string(p) && p.indexOf('.') === -1
    if (isIndex(p)) result = result && is.integer(p)
    return result
  },
  areAllItemsValid = all(isPathItemValid),