KeyValueBasedCollection

Methods for key-value-based collections.

set(key, value)

Set a value.

returns Stringarrow-up-right | Numberarrow-up-right | Objectarrow-up-right | Arrayarrow-up-right

Example:

user_settings.set("USER_1", {"friend_requests": true});
/*
  {
    "friend_requests": true
  }
*/

get(key)

Get a value.

Parameter
Description

returns Stringarrow-up-right | Numberarrow-up-right | Objectarrow-up-right | Arrayarrow-up-right

Example:

user_settings.get("USER_1.friend_requests"); // -> true

push(key, data)

Push a data to array.

Parameter
Description

returns Arrayarrow-up-right

Example:

remove(key, data)

Remove a data from array.

Parameter
Description

returns Arrayarrow-up-right

Example:

find(key, params)

Find a data from array.

Parameter
Description

params

Functionarrow-up-right | Objectarrow-up-right The parameters you will use to find the data.

returns Objectarrow-up-right

Example:

filter(key, params)

Filter data from array.

Parameter
Description

params

Functionarrow-up-right | Objectarrow-up-right The parameters you will use to filter the data.

returns Arrayarrow-up-right

Example:

has(key, params)

Check if they have key or data.

Parameter
Description

params

Functionarrow-up-right | Objectarrow-up-right | Stringarrow-up-right | Numberarrow-up-right (optional) The parameters you will use to check the data.

returns Booleanarrow-up-right

Example:

increase(key, value)

Increase the number in the value.

Parameter
Description

value

Numberarrow-up-right The number to be incremented.

returns Numberarrow-up-right

Example:

decrease(key, value)

Decrease the number in the value.

Parameter
Description

value

Numberarrow-up-right The number to be decremented.

returns Numberarrow-up-right

Example:

delete(key)

Delete a key.

Parameter
Description

returns Numberarrow-up-right

Example:

Last updated