API
Common
Functions that work on many different types of values. Also see the experimental JSON functions.
equal
Returns true if the two values passed in are equal, false otherwise. Does not work for Squiggle functions, but works for most other types.
infix: ==
Namespace optional
Common.equal(any, any) => Bool
unequal
infix: !=
Namespace optional
Common.unequal(any, any) => Bool
typeOf
Returns the type of the value passed in as a string. This is useful when you want to treat a value differently depending on its type.
Namespace optional
Common.typeOf(any) => String
inspect
Runs Console.log() in the Javascript developer console and returns the value passed in.
Namespace optional
Common.inspect('A, String?) => 'A
throw
Throws an error. You can use try
to recover from this error.
Namespace optional
Common.throw(String?) => any
try
Try to run a function and return its result. If the function throws an error, return the result of the fallback function instead.
Namespace optional
Common.try(() => 'A, () => 'B) => 'A|'B