Module: helpers

Methods

(static) helpers.fromBase64(str) → {*}

Converts a base-64 encoded string to a Javascript value.

Parameters:
Name Type Description
str string

a base-64 encoded string.

Source:
Returns:

a Javascript value.

Type
*

(static) helpers.goodFastHash(obj, seed) → {number}

A simple 53-bits hashing algorithm with good enough distribution.

Parameters:
Name Type Description
obj *

the value to hash.

seed number

a seed.

License:
  • The code is extracted from https://stackoverflow.com/a/52171480.
Source:
Returns:

the hashed value.

Type
number

(static) helpers.stringify(value) → {string}

A version of JSON.stringify that returns a canonical JSON format.

'Canonical JSON' means that the same object should always be stringified to the exact same string. JavaScripts native JSON.stringify does not guarantee any order for object keys when serializing.

Parameters:
Name Type Description
value

the value to stringify.

License:
  • The code is extracted from https://github.com/mirkokiefer/canonical-json.
Source:
Returns:

the stringified value.

Type
string

(static) helpers.toBase64(obj) → {string}

Converts a Javascript value to a base-64 encoded string.

Parameters:
Name Type Description
obj *

a Javascript value, usually an object or array, to be converted.

Source:
Returns:

a base-64 encoded string.

Type
string