ok
Constructs a success Result.
Usage
ok(value)
Use ok when you want to return a Result directly without going through attempt. Common in validation functions, parsers, or any code that wants to return a Result as its native shape.
Parameters
valueTrequired
the success value. Can be null, undefined, or any other type — the ok: true discriminant determines success, not the value's truthiness.
Returns
{ ok: true, value, error: null }.
See also
err— construct a failure resultattempt— wrap an unsafe call- Result & Errors concept guide