> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Make absence

explicit.


An Option type for values that may not exist.


[Read the guide
](/guide/start/introduction)[API reference
](/api/modules/Option)

![](https://cdn.simpleicons.org/npm/CB3837)npm![](https://cdn.simpleicons.org/pnpm/F69220)pnpm![](https://cdn.simpleicons.org/yarn/2C8EBB)yarn![](https://cdn.simpleicons.org/bun/FBF0DF)bun

$`npm install byenull`

````
import
&#x20;
{ Option }&#x20;
from
&#x20;
"byenull"
;


// A lookup may not return a value

const
&#x20;findUser = Option.
fn
((id:&#x20;
string
) =>

&#x20; users.
find
((user) => user.id === id),

);


const
&#x20;name = Option.
pipe
(

&#x20;&#x20;
findUser
(
"u1"
),

&#x20; Option.
map
((user) => user.name),

&#x20; Option.
unwrap
(
"Anonymous"
),

);

````

THE BASICS
01 / OPTION

A SMALL, EXPLICIT TYPE

## Values may be missing.

Make that visible.


An&#x20;
`Option
`&#x20;is either&#x20;
`Some
`, containing a value, or&#x20;
`None
`. Transform the value when it exists; let absence pass through when it doesn’t.


{ }

### Plain objects


Options are data, not class instances. Inspect, serialize, and pass them around like ordinary JavaScript objects.


`{ type: "Some", value: 42 }`

\>\_

### Composable operations


Use&#x20;
`map
`,&#x20;
`andThen
`, and&#x20;
`orElse
`&#x20;in a pipeline. A None skips the remaining value transformations.


[Explore pipelines
](/guide/tutorial/transforming/pipe-basics)

\~

### Sync and async


Use the same operations with Options and promises of Options. Await the result when your pipeline is asynchronous.


[How async works
](/guide/explanation/sync-and-async)

INTEROPERABILITY
02 / RESULT

OPTION + RESULT

## A companion to&#x20;
byethrow.


byenull follows the API design of&#x20;
[byethrow
](https://praha-inc.github.io/byethrow/)&#x20;and provides conversions between Option and Result. The libraries have different authors; byenull is independently maintained and works on its own.


[Read the conversion guide
](/guide/how-to/converting-between-option-and-result)

byenull
**Option\<T>
**presence / absence

`toResult(error)
`

──────────────

`fromResult
`

byethrow
**Result\<T, E>
**success / failure

GET STARTED

## Start with an Option.


Install the package, then follow the guide to your first pipeline.


[Quick start
](/guide/start/quick)[View on GitHub
](https://github.com/JohannesKlauss/byenull)

**byenull
.
**Open source · MIT License

[Guide
](/guide/start/introduction)[API
](/api/modules/Option)[GitHub
](https://github.com/JohannesKlauss/byenull)