Context
Context manipulation library
context(entries)
returns a new context that includes all specified entries
Name | Required | Type | Description |
---|---|---|---|
entries |
Yes |
context |
Examples
context([{key: "key1", value: 1}, {key: "key2", value: 2}]) => {key1: 1, key2:2}
context merge(contexts)
return a new context that includes all entries from the given contexts merged together
Name | Required | Type | Description |
---|---|---|---|
contexts |
Yes |
context |
Examples
context merge([{key1: 1}, {key2:2}]) => {key1:1, key2:2}
context merge([{key1: 1, key2: 2}, {key2: 0, key3:3}]) => {key1:1, key2:0, key3:3}
context put(context, key, value)
return a new context that includes all entries from context with the addition of the new entry composed of key and value. If the key already exist it is overwritten
Name | Required | Type | Description |
---|---|---|---|
context |
Yes |
context |
|
key |
Yes |
Text |
|
value |
Yes |
Any |
Examples
context put({key1: 1}, "key2", 2) => {key1:1, key2:2}
context put({key1: 1, key2:2}, "key2", 7) => {key1:1, key2:7}
context put(context, keys, value)
return a new context that includes all entries from context with the addition of the new entry composed of keys and value. If the key already exist it is overwritten
Name | Required | Type | Description |
---|---|---|---|
context |
Yes |
context |
|
keys |
Yes |
Collection of Text |
|
value |
Yes |
Any |
Examples
context put({key1: 1}, ["key2"], 2) => {key1:1, key2:2}
context put({key1: 1, key2: {sub: "V"}}, ["key2", "sub"], "N") => {key1:1, key2:{sub:"N"}}