Handle one value.
Based on the bound key, a respective handler will be called.
If value is not an object, or doesn’t have a key property, the special
“invalid” handler will be called.
If value has an unknown key, the special “unknown” handler will be called.
All arguments, and the context object (this), are passed through to the
handler, and it’s result is returned.
Special handler called if a value doesn’t have a key property.
If not set, undefined is returned for invalid values.
one.unknown
Special handler called if a value does not have a matching
handler.
If not set, undefined is returned for unknown values.
function handler(value[, rest…])
Handle one value.
Types
This package is fully typed with TypeScript.
It exports the types Handler, UnknownHandler, InvalidHandler, and
Options.
Compatibility
This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 14.14+ and 16.0+.
It also works in Deno and modern browsers.