Module jsxd

Data Types

jsxarray()

jsxarray() = [value()] | [{}]

key()

key() = integer() | map_key()

keys()

keys() = key() | [key()]

map_key()

map_key() = binary() | atom()

object()

object() = [{map_key(), value()}] | #{}

value()

value() = binary() | number() | object() | jsxarray() | null | true | false

Function Index

append/3Appends a value to a jsxd structure.
delete/2Deletes a value from a jsxd structure, the key behaves the same way os it does for get/2.
fold/3Folds over an jsxd structure.
from_list/1Converts a tuple list (or 'array' list) to a object jsxd understands.
get/2Gets a possibly nested key in a jsxd structure, if the key is a binary it is assumed to be 'unparsed' and will be translated.
get/3Gets a possibly nested key in a jsxd structure, if the key is a binary it is assumed to be 'unparsed' and will be translated.
map/2Maps each value of a jsxd structure using a function.
merge/2Merges two objects, where the 2nd objects overwrites values in the first object.
merge/3Merges two objects, using a given function to resolve conflicts.
new/0Creates an empty jsxd structure.
prepend/3Prepends a value to a jsxd structure.
select/2Selects a set of key from a jsxd structure, discarding all others.
set/3Sets a value of a jsxd structure, the key behaves the same way os it does for get/2.
thread/2Threads mutliple changes to jsxd structure, the result from the nth opperation is passed in as new object in the nth+1 opperation.
update/3Updates a value from a jsxd structure using a function, the key behaves the same way os it does for get/2.
update/4Updates a value from a jsxd structure using a function, the key behaves the same way os it does for get/2.

Function Details

append/3

append(Keys, Value, Obj) -> any()

Appends a value to a jsxd structure. The value appended to must be either undefined or a 'array'.

delete/2

delete(Key, Obj) -> any()

Deletes a value from a jsxd structure, the key behaves the same way os it does for get/2.

fold/3

fold(FoldFn, Acc0, Obj) -> any()

Folds over an jsxd structure.

The key is either the map key or the array index.

from_list/1

from_list(Obj::value()) -> value()

Converts a tuple list (or 'array' list) to a object jsxd understands.

Maps can be passed in directly without needing conversion.

get/2

get(Key::keys(), Obj::object() | jsxarray()) -> {ok, value()} | undefined

Gets a possibly nested key in a jsxd structure, if the key is a binary it is assumed to be 'unparsed' and will be translated.

To set a single binary key direcntly pass in [Key].

If the key is not found undefined is returned.

get/3

get(Key::keys(), Default::value(), Obj::object() | jsxarray()) -> value()

Gets a possibly nested key in a jsxd structure, if the key is a binary it is assumed to be 'unparsed' and will be translated.

To set a single binary key direcntly pass in [Key].

If the key is not found the default value is returned.

map/2

map(MapFn, Obj) -> any()

Maps each value of a jsxd structure using a function.

The key is either the map key or the array index. However while passed into the function the key can not be changed.

merge/2

merge(Obj1::object(), Obj2::object()) -> object()

Merges two objects, where the 2nd objects overwrites values in the first object.

The object can not be an array.

merge/3

merge(ConflictFn, Obj1, Obj2) -> any()

Merges two objects, using a given function to resolve conflicts.

The object can not be an array.

new/0

new() -> jsxarray() | object()

Creates an empty jsxd structure.

prepend/3

prepend(Keys, Value, Obj) -> any()

Prepends a value to a jsxd structure. The value appended to must be either undefined or a 'array'.

select/2

select(Keys::[key()], Obj::object()) -> Obj::object()

Selects a set of key from a jsxd structure, discarding all others. This does not work in nested fasion!

set/3

set(Key, Val, Obj) -> any()

Sets a value of a jsxd structure, the key behaves the same way os it does for get/2.

thread/2

thread(As, Obj) -> any()

Threads mutliple changes to jsxd structure, the result from the nth opperation is passed in as new object in the nth+1 opperation.

update/3

update(Keys, UpdateFn, Obj) -> any()

Updates a value from a jsxd structure using a function, the key behaves the same way os it does for get/2.

If the key does not exist no change is applied.

update/4

update(Keys, UpdateFn, Default, Obj) -> any()

Updates a value from a jsxd structure using a function, the key behaves the same way os it does for get/2.

If the key does not exist the default value is set as new value.


Generated by EDoc, Sep 20 2016, 06:40:55.