@colibri-engine/dictionary v2.0.5
Dictionary library
Presentation
The engine is based on incremental computation algorithms. When a calculation is submitted to the engine, all the computed values are memorized. So, if you change some variable and query an evaluation, the engine is able to compute the result very fast because it recomputes only what has changed.
Libraries
The API provides several libraries that each comes with dozens of operators.
- @colibri-engine/boolean
- @colibri-engine/number
- @colibri-engine/string
- @colibri-engine/date
- @colibri-engine/math
- @colibri-engine/structural
Imports
Typescript
import {/* required operators */} from '@colibri-engine/dictionary';
Javascript
const {/* required operators */} = require('@colibri-engine/dictionary');
Operators
dictionary
dictionary(value) ➜ xdictionary
dictionary() ➜ xdictionary
The dictionary operator allows to create an dictionary expression which evals to the given value. If no value is provided the expression is a variable and can be affected
const {dictionary} = new ColibriDictionaryLibrary();
const x = dictionary({
key: value,
...
});
x.affect({
key: value,
...
})
const y = dictionary();
y.affect({
key: value,
...
})
get boolean
getBoolean(xdictionary, ystring) ➜ zboolean
xdictionary.getBoolean(ystring) ➜ zboolean
The getBoolean operator allows to create a boolean expression which evals to a boolean value of an dictionary accessed by a given key
const {dictionary, getBoolean} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y = string();
const z = getBoolean(x, y) | x.getBoolean(y);
get number
getNumber(xdictionary, ystring) ➜ znumber
xdictionary.getNumber(ystring) ➜ znumber
The getNumber operator allows to create a number expression which evals to a number value of an dictionary accessed by a given key
const {dictionary, getNumber} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y = string();
const z = getNumber(x, y) | x.getNumber(y);
get string
getString(xdictionary, ystring) ➜ zstring
xdictionary.getString(ystring) ➜ zstring
The getString operator allows to create a string expression which evals to a string value of an dictionary accessed by a given key
const {dictionary, getString} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y = string();
const z = getString(x, y) | x.getString(y);
get date
getDate(xdictionary, ystring) ➜ zdate
xdictionary.getDate(ystring) ➜ zdate
The getDate operator allows to create a date expression which evals to a date value of an dictionary accessed by a given key
const {dictionary, getDate} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y = string();
const z = getDate(x, y) | x.getDate(y);
get dictionary
getDictionary(xdictionary, ystring) ➜ zdictionary
xdictionary.getDictionary(ystring) ➜ zdictionary
The getDictionary operator allows to create an dictionary expression which evals to an dictionary value of an dictionary accessed by a given key
const {dictionary, getDictionary} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y = string();
const z = getDictionary(x, y) | x.getDictionary(y);
set boolean
setBoolean(xdictionary, y1string, x2boolean) ➜ zdictionary
xdictionary.setBoolean(y1string, x2boolean) ➜ zdictionary
The setBoolean operator allows to create an dictionary expression which evals to the given dictionary with a new pair of key/value.
const {dictionary, setBoolean} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const {boolean} = new ColibriBooleanLibrary();
const x = dictionary();
const y1 = string();
const y2 = boolean();
const z = setBoolean(x, y1, y2) | x.setBoolean(y1, y2);
set number
setNumber(xdictionary, y1string, y2number) ➜ zdictionary
xdictionary.setNumber(y1string, y2number) ➜ zdictionary
The setNumber operator allows to create an dictionary expression which evals to the given dictionary with a new pair of key/value.
const {dictionary, setNumber} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const {number} = new ColibriNumberLibrary();
const x = dictionary();
const y1 = string();
const y2 = number();
const z = setNumber(x, y1, y2) | x.setNumber(y1, y2);
set string
setString(xdictionary, y1string, y2string) ➜ zdictionary
xdictionary.setString(y1string, y2string) ➜ zdictionary
The setString operator allows to create an dictionary expression which evals to the given dictionary with a new pair of key/value.
const {dictionary, setString} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y1 = string();
const y2 = string();
const z = setString(x, y1, y2) | x.setString(y1, y2);
set date
setDate(xdictionary, y1string, y2date) ➜ zdictionary
xdictionary.setDate(y1string, y2date) ➜ zdictionary
The setDate operator allows to create an dictionary expression which evals to the given dictionary with a new pair of key/value.
const {dictionary, setDate} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const {date} = new ColibriDateLibrary();
const x = dictionary();
const y1 = string();
const y2 = date();
const z = setDate(x, y1, y2) | x.setDate(y1, y2);
set dictionary
setBoolean(xdictionary, y1string, y2dictionary) ➜ zdictionary
xdictionary.setBoolean(y1string, y2dictionary) ➜ zdictionary
The setDictionary operator allows to create an dictionary expression which evals to the given dictionary with a new pair of key/value.
const {dictionary, setBoolean} = new ColibriDictionaryLibrary();
const {string} = new ColibriStringLibrary();
const x = dictionary();
const y1 = string();
const y2 = dictionary();
const z = setDictionary(x, y1, y2) | x.setDictionary(y1, y2);