Module: Converters

Methods

(static) convertArray(val, contentType) → {Array}

Convert a value to array
Parameters:
Name Type Description
val string | Array A value to convert to array
contentType string The type of values contained in the array
Source:
Throws:
ConversionError
Returns:
the converting value
Type
Array

(static) convertBoolean(val) → {boolean}

Convert a value to boolean
Parameters:
Name Type Description
val * A value to convert to boolean
Source:
Throws:
ConversionError
Returns:
the converting value
Type
boolean

(static) convertNumber(val) → {number}

Convert a value to Number
Parameters:
Name Type Description
val * A value to convert to number
Source:
Throws:
ConversionError
Returns:
the converting value
Type
number

(static) hashCode(s) → {number}

Returns a hash code for a string. (Compatible to Java's String.hashCode()) The hash code for a string object is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] using number arithmetic, where s[i] is the i th character of the given string, n is the length of the string, and ^ indicates exponentiation. (The hash value of the empty string is zero.)
Parameters:
Name Type Description
s string A string
Source:
Returns:
a hash code value for the given string.
Type
number