Common functions that are useful for any type

Static methods

static_n<A, B>(value:A, input:B):B

An extension that always returns some input and drops the original value

69._n("nice") == "nice";

staticinlinediscard<A>(_:A):Void

An extension that drops its value into a Void

staticinlinediscardWithPos<A>(_:A, ?pos:Null<PosInfos>):Void

An extension that drops its value and position info into a Void

staticinlinedoNothing():Void

A no-op function

staticinlineequals<A>(x:A, y:A):Bool

Composable version of the == operator

staticinlineidentity<A>(a:A):A

A function that always returns its input unchanged

Some(123).map(identity) == Some(123);

staticinlinekeyFor<K, V>(key:K, value:V):KeyValuePair<K, V>

Composable way to create a Key/Value pair

123.keyFor("abc") == { key: 123, value: "abc" };

staticinlinekeyedWith<K, V>(value:V, key:K):KeyValuePair<K, V>

Composable way to create a Key/Value pair

"abc".keyedWith(123) == { key: 123, value: "abc" };

staticinlinelet<T, K>(v:T, transformer:T ‑> K):K

Fluent method for transforming a value
Similar to map but for any value

123.let(Std.string) == "123";

staticinlinemut<T>(v:T, mutator:T ‑> Void):T

Fluent method for mutating a value or whatever else
Similar to mutate but for any value

staticinlinenotEquals<A>(x:A, y:A):Bool

Composable version of the != operator

staticinlinenotb(b:Bool):Bool

Composable version of the ! (not) operator

staticv_<A, B>(value:A, input:B):A

An extension that always returns the original value and drops any input

69.v_("nice") == 69;