Los métodos isNumber, isBinary, isOctal, isHex y convert, retornados por estos métodos
no requieren parámetros, ya que estos métodos retornan referencia a esas funciones con
valores ya establecidos.
Methods
-
<inner> bin(exp)
-
Manejador de expresiones binarias
Parameters:
Name Type Description exp
string Cadena de texto con representación numérica. - Version:
-
- 0.0.1
Throws:
-
-
Código 10001 si la expresión no es de tipo string. Método isBinary.
- Type
- InputError
-
-
-
Código 10002 si la expresión es de tipo string, pero su conversión es NaN. Método isBinary.
- Type
- InputError
-
Returns:
-
isNumber
Éste return no requiere parámetros.- Type
- isNumber
-
isBinary
Éste return no requiere parámetros.- Type
- isBinary
-
convert
Éste return no requiere parámetros.- Type
- convert
Example
// bin isNumber bin('1100').isNumber() // returns true bin('Hello').isNumber() // returns false // bin.isBinary bin('110011').isBinary() // returns true bin('012340').isBinary() // returne false // bin.convert // convert a su vez nos devuelve 3 métodos para el handler bin // bin().convert().oct() //Nos convierte la expresión binaria a octal // bin().convert().dec() //Nos convierte la expresión binaria a decimal // bin().convert().hex() //Nos convierte la expresión binaria a hexadecimal // Ejemplo bin('1010').convert().dec() // returns 10 (number) bin('1010').convert().oct() // returns 12 (string)
-
<inner> oct(exp)
-
Manejador de expresiones octales
Parameters:
Name Type Description exp
string Cadena de texto con representación numérica. - Version:
-
- 0.0.1
Throws:
-
-
Código 10001 si la expresión no es de tipo string. Método isOctal.
- Type
- InputError
-
-
-
Código 10002 si la expresión es de tipo string, pero su conversión es NaN. Método isOctal.
- Type
- InputError
-
Returns:
-
isNumber
Éste return no requiere parámetros.- Type
- isNumber
-
isOctal
Éste return no requiere parámetros.- Type
- isOctal
-
convert
Éste return no requiere parámetros.- Type
- convert
Example
// oct isNumber oct('14').isNumber() // returns true oct('Hello').isNumber() // returns false // oct.isOctal oct('047').isOctal() // returns true oct('9814').isOctal() // returne false // oct.convert // convert a su vez nos devuelve 3 métodos para el handler oct // oct().convert().bin() //Nos convierte la expresión octal a binaria // oct().convert().dec() //Nos convierte la expresión octal a decimal // oct().convert().hex() //Nos convierte la expresión octal a hexadecimal // Ejemplo oct('12').convert().dec() // returns 10 (number) oct('20').convert().hex() // returns 10 (string)
-
<inner> hex(exp)
-
Manejador de expresiones hexadecimales
Parameters:
Name Type Description exp
string Cadena de texto con representación numérica. - Version:
-
- 0.0.1
Throws:
-
-
Código 10001 si la expresión no es de tipo string. Método isHex.
- Type
- InputError
-
-
-
Código 10002 si la expresión es de tipo string, pero su conversión es NaN. Método isHex.
- Type
- InputError
-
Returns:
-
isNumber
Éste return no requiere parámetros.- Type
- isNumber
-
isHex
Éste return no requiere parámetros.- Type
- isHex
-
convert
Éste return no requiere parámetros.- Type
- convert
Example
// hex isNumber hex('1ff').isNumber() // returns true hex('Hello').isNumber() // returns false // hex.isHex hex('10f').isHex() // returns true hex('hi').isHex() // returne false // hex.convert // convert a su vez nos devuelve 3 métodos para el handler hex // hex().convert().bin() //Nos convierte la expresión hexadecimal a binaria // hex().convert().oct() //Nos convierte la expresión hexadecimal a octal // hex().convert().dec() //Nos convierte la expresión hexadecimal a decimal // Ejemplo hex('f').convert().dec() // returns 15 (number) hex('a').convert().bin() // returns 1010 (string)
-
<inner> hex(num)
-
Manejador de expresiones numéricas
Parameters:
Name Type Description num
number Cadena de texto con representación numérica. - Version:
-
- 0.0.1
Throws:
-
Código 10003 si la expresión no es de tipo number.
- Type
- InputError
Returns:
convert
Éste return no requiere parámetros.- Type
- convert
Example
// num no devuelve los métodos isNumber ni otro tipo de validación // ya que solo admite expresiones numéricas // num.convert // convert a su vez nos devuelve 3 métodos para el handler num // num().convert().bin() //Nos convierte la expresión decimal a binaria // num().convert().oct() //Nos convierte la expresión decimal a octal // num().convert().hex() //Nos convierte la expresión decimal a hexadecimal // Ejemplo num(10).convert().hex() // returns a (string) num(10).convert().bin() // returns 1010 (string)