Global

Methods

_extend(ctor, superCtor)

Inherit the prototype methods from one constructor into another. The Function.prototype.inherits from lang.js rewritten as a standalone function (not on Function.prototype). NOTE: If this file is to be loaded during bootstrapping this function needs to be rewritten using some native functions as prototype setup using normal JavaScript does not work as expected during bootstrapping (see mirror.js in r114903).
Parameters:
Name Type Description
ctor function Constructor function which needs to inherit the prototype.
superCtor function Constructor function to inherit prototype from.
Source:

Buffer()

The Buffer constructor returns instances of `Uint8Array` that have their prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, so the returned instances will have all the node `Buffer` methods and the `Uint8Array` methods. Square bracket notation works as expected -- it returns a single octet. The `Uint8Array` prototype remains unmodified.
Source:

find(obj, fn) → {Any}

Find a value in a given element.
Parameters:
Name Type Description
obj Array | Object Element to find a value in.
fn function Testing function to call.
Source:
Returns:
Returns the value of the first element that satisfies the provided testing function or undefined.
Type
Any

hasProperty(obj, property) → {Boolean}

Check if an object has the specified property.
Parameters:
Name Type Description
obj Object Object to check.
property String Property to check for.
Source:
Returns:
True if the object has the specified property.
Type
Boolean

hasValue(obj, value) → {Boolean}

Check if an object has the specified value.
Parameters:
Name Type Description
obj Array | Object Array or Object to check.
value Any Value to check for.
Source:
Returns:
True if the object has the specified value.
Type
Boolean

isAlpha(str) → {Boolean}

Determine if the environment is alpha.
Parameters:
Name Type Description
str String String to compare.
Source:
Returns:
True if the environment is alpha.
Type
Boolean

isArray(arr) → {Boolean}

Test if the object is an array.
Parameters:
Name Type Description
arr Array Array to test.
Source:
Returns:
True if the object is an array.
Type
Boolean

isBeta(str) → {Boolean}

Determine if the environment is beta.
Parameters:
Name Type Description
str String String to compare.
Source:
Returns:
True if the environment is beta.
Type
Boolean

isEqual(value1, value2) → {Boolean}

Check if 2 values are equal.
Parameters:
Name Type Description
value1 Any First value.
value2 Any Second value.
Source:
Returns:
True if the two values are equal.
Type
Boolean

isObject(obj) → {Boolean}

Test if an object is really an object.
Parameters:
Name Type Description
obj Object An object.
Source:
Returns:
True if the object is really an object.
Type
Boolean

isProduction(str) → {Boolean}

Determine if the environment is production.
Parameters:
Name Type Description
str String String to compare.
Source:
Returns:
True if the environment is production.
Type
Boolean

toBoolean(value) → {Boolean}

Convert something to a boolean value.
Parameters:
Name Type Description
value Any A value to try and convert.
Source:
Returns:
Returns a boolean value or null.
Type
Boolean

toCallback(func) → {Promise}

Convert a promise into a node style callback.
This:
  • func
Parameters:
Name Type Description
func function Function to turn into a node style callback.
Source:
Returns:
Promise as a node style callback.
Type
Promise

toDecimals(value, decimalsopt) → {Number}

Round a number to the specified significant digits.
Parameters:
Name Type Attributes Default Description
value Number Value to round.
decimals Number <optional>
zero Decimals to round to.
Source:
Returns:
Returns the rounded number.
Type
Number

toFlatArray(obj) → {Array}

Flatten an array.
Parameters:
Name Type Description
obj Array | Object Array or Object to convert.
Source:
Returns:
The converted Array or Object.
Type
Array

toLowercaseKeys(obj) → {Object}

Convert object keys to lowercase.
Parameters:
Name Type Description
obj Object An object.
Source:
Returns:
Returns an object with lowercase keys.
Type
Object

toPromise(func) → {Promise}

Convert a node style callback into a promise.
This:
  • func
Parameters:
Name Type Description
func function Function to turn into a promise.
Source:
Returns:
Callback as a promise.
Type
Promise