The type of the value stored.
Readonly[toThe well-known symbol Symbol.toStringTag used by Object.prototype.toString().
Returns 'Once' so that Object.prototype.toString.call(once) produces '[object Once]'.
Sets the contents to value.
The value to store.
Ok(undefined) if empty, Err(value) if already initialized.
Sets the contents to value if empty, returning a reference to the value.
Unlike set(), this method returns the stored value on success,
and returns both the current and passed values on failure.
The value to store.
Ok(value) if empty, Err([currentValue, passedValue]) if already initialized.
A container which can be written to only once.
Useful for lazy initialization of global data or expensive computations that should only happen once.
Since
1.6.0
See
Example
Example