Explicit comparisons between two objects of the same kind. Positions implement it, and the result always agrees with the order of their strings.
The type of the compared objects.
Compares this with other, like a sort comparator.
this
other
The object to compare with.
"less" if this goes before other, "equal" if they have the same value, "greater" if it goes after.
"less"
"equal"
"greater"
import Staquia from "staquia";const system = Staquia.create("!", "a", "z", 5, 15, 0.15);const a = system.forge("mmmmm!m");const b = system.forge("mmmmn");if (a.ok && b.ok) console.log(a.value.compare(b.value)); // "less" Copy
import Staquia from "staquia";const system = Staquia.create("!", "a", "z", 5, 15, 0.15);const a = system.forge("mmmmm!m");const b = system.forge("mmmmn");if (a.ok && b.ok) console.log(a.value.compare(b.value)); // "less"
Checks if this and other have the same value.
true if both have the same value.
true
import Staquia from "staquia";const system = Staquia.create("!", "a", "z", 5, 15, 0.15);const a = system.forge("mmmmm");const b = system.forge("mmmmm!");// Zeroes to the right don't change the valueif (a.ok && b.ok) console.log(a.value.equal(b.value)); // true Copy
import Staquia from "staquia";const system = Staquia.create("!", "a", "z", 5, 15, 0.15);const a = system.forge("mmmmm");const b = system.forge("mmmmm!");// Zeroes to the right don't change the valueif (a.ok && b.ok) console.log(a.value.equal(b.value)); // true
Checks if this goes after other.
The left side of the comparison.
The right side of the comparison.
true if this > other.
this > other
Checks if this goes after other or has the same value.
true if this >= other.
this >= other
Checks if this goes before other.
true if this < other.
this < other
import Staquia from "staquia";const system = Staquia.create("!", "a", "z", 5, 15, 0.15);const a = system.forge("mmmmm!m");const b = system.forge("mmmmn");if (a.ok && b.ok) { console.log(a.value.less(b.value)); // true console.log(a.value.greater(b.value)); // false} Copy
import Staquia from "staquia";const system = Staquia.create("!", "a", "z", 5, 15, 0.15);const a = system.forge("mmmmm!m");const b = system.forge("mmmmn");if (a.ok && b.ok) { console.log(a.value.less(b.value)); // true console.log(a.value.greater(b.value)); // false}
Checks if this goes before other or has the same value.
true if this <= other.
this <= other
Explicit comparisons between two objects of the same kind. Positions implement it, and the result always agrees with the order of their strings.