Module: Validations

Methods


<inner> isNumber(exp)

Valida si una expresión numérica es válida.
Parameters:
Name Type Description
exp expression Una expresión numérica de tipo string '1234', '0x12ff' o number.
Version:
  • 0.0.1
Returns:
Type
boolean
Example
let numb = isNumber(13);
console.log(numb);
// returns true

let numb = isNumber('0b1010');
// o
let numb = isNumber('110011');
console.log(numb);
// returns true

let numb = isNumber('Hello');
console.log(numb);
// returns false

<inner> isBinary(n)

Valida si la expresión puede ser usada como un binario.
Parameters:
Name Type Description
n string Cadena de texto con representación binaria: '110011' ó '0b11011'.
Version:
  • 0.0.1
Returns:
Type
boolean
Example
let bin = isBinary('0b1010');
// o
let bin = isBinary('110011');
console.log(bin);
// returns true

let bine = isBinary('Hello');
console.log(bin);
// returns false

<inner> isOctal(n)

Valida si la expresión puede ser usada como un octal.
Parameters:
Name Type Description
n string Cadena de texto con representación octal: '01234567' ó '0o01234567'.
Version:
  • 0.0.1
Returns:
Type
boolean
Example
let oct = isOctal('0o17');
// o
let oct = isOctal('735');
console.log(oct);
// returns true

let oct = isOctal('Hello');
console.log(oct);
// returns false

<inner> isHex(n)

Valida si la expresión puede ser usada como un hexadecimal.
Parameters:
Name Type Description
n string Cadena de texto con representación hexadecimal: ^[0-9a-f] ó ^0x[0-9A-F].
Version:
  • 0.0.1
Returns:
Type
boolean
Example
let hex = isHex('0x13FF');
// o
let hex = isHex('ff331');
console.log(hex);
// returns true

let hex = isHex('Hello');
console.log(hex);
// returns false

Type Definitions


expression

Una expresión numérica ya sea un string '0x11aaff', '1234ff' o de tipo number.
Type:
  • number | string