Search…
Mathematical Methods
This page is a work in progress and may not have the polish of a usual Evie-Written document!
Some quick docs:

## enmap.math(key, operation, operator, [objectPath])

1
// Assuming
2
points.set("number", 42);
3
points.set("numberInObject", {sub: { anInt: 5 }});
4
5
points.math("number", "/", 2); // 21
6
7
points.math("number", "modulo", 3); // 2
8
points.math("numberInObject", "+", 10, "sub.anInt");
Copied!
Possible Operators (accepts all variations listed below, as strings):
`+`, `add`, `addition`: Increments the value in the enmap by the provided value.
`-`, `sub`, `subtract`: Decrements the value in the enmap by the provided value.
`*`, `mult`, `multiply`: Multiply the value in the enmap by the provided value.
`/`, `div`, `divide`: Divide the value in the enmap by the provided value.
`%`, `mod`, `modulo`: Gets the modulo of the value in the enmap by the provided value.
`^`, `exp`, `exponential`: Raises the value in the enmap by the power of the provided value.

## enmap.inc(key, [objectPath])

1
// Assuming
2
points.set("number", 42);
3
points.set("numberInObject", {sub: { anInt: 5 }});
4
5
points.inc("number"); // 43
6
points.inc("numberInObject", "sub.anInt"); // {sub: { anInt: 6 }}
Copied!

## enmap.dec(key. [objectPath])

1
// Assuming
2
points.set("number", 42);
3
points.set("numberInObject", {sub: { anInt: 5 }});
4
5
points.dec("number"); // 41
6
points.dec("numberInObject", "sub.anInt"); // {sub: { anInt: 4 }}
Copied!