initial commit

This commit is contained in:
2026-03-30 08:34:35 +02:00
commit 49d8ea67ba
103 changed files with 22387 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
import { bench, describe } from 'vitest';
import { STANDARD } from '../helpers/bench-options.js';
import {
some,
none,
OxSome,
OxNone,
O,
pipe,
} from '../helpers/imports.js';
// ---------------------------------------------------------------------------
// toNullable — Some path
// ---------------------------------------------------------------------------
describe('Option.toNullable — Some', () => {
const nm = some(42);
const ox = OxSome(42);
const fp = O.some(42);
bench('native-monad', () => { nm.toNullable(); }, STANDARD);
bench('oxide.ts', () => { ox.into(); }, STANDARD);
bench('fp-ts', () => { pipe(fp, O.toNullable); }, STANDARD);
});
// ---------------------------------------------------------------------------
// toNullable — None path
// ---------------------------------------------------------------------------
describe('Option.toNullable — None', () => {
const nm = none();
const ox = OxNone;
const fp = O.none;
bench('native-monad', () => { nm.toNullable(); }, STANDARD);
bench('oxide.ts', () => { ox.into(); }, STANDARD);
bench('fp-ts', () => { pipe(fp, O.toNullable); }, STANDARD);
});
// ---------------------------------------------------------------------------
// toString
// ---------------------------------------------------------------------------
describe('Option.toString — Some', () => {
const nm = some(42);
bench('native-monad', () => { nm.toString(); }, STANDARD);
// Most other libraries don't have toString
});
describe('Option.toString — None', () => {
const nm = none();
bench('native-monad', () => { nm.toString(); }, STANDARD);
});