Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .well-known/agent-skills/tsentials-errors/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function findUser(id: string): Result<User> {

```typescript
import { Result } from 'tsentials/result';
import { Err } from 'tsentials/errors';
import { Err, ErrorType } from 'tsentials/errors';

function divide(a: number, b: number): Result<number> {
if (b === 0) return Result.failure(Err.validation('Math.DivideByZero', 'Cannot divide by zero.'));
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Result.then(safeJsonParse(raw), data => validatePayload(data));

```bash
npm run build # tsc compile
npm test # vitest run (762 tests)
npm test # vitest run (1079 tests)
npm run check # biome lint + format check
npm run lint:fix # auto-fix lint
```
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ toUnderscoreCamelCase('helloWorld') // "_helloWorld"
- `"sideEffects": false` in package.json for full tree-shaking

## Testing
Vitest — `npm test` runs all 1075 tests across 33 test files.
Vitest — `npm test` runs all 1079 tests across 33 test files.
Test files mirror src/ structure under `tests/`.

## Publishing
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thank you for your interest in contributing!

```bash
git clone https://github.com/senrecep/tsentials.git
cd TypeScriptEssentials
cd tsentials
npm install
npm run build
npm test
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ Result.ok();
### Pipeline (sync)

```typescript
import { Result } from 'tsentials/result';
import { Result, chain } from 'tsentials/result';
import { Err } from 'tsentials/errors';

const price = Result.success(100)
|> Result.map(_, n => n * 1.2)
|> Result.ensure(_, n => n < 200, Err.validation('Price.TooHigh', 'Exceeds limit'))
|> Result.map(_, n => `$${n.toFixed(2)}`);
const price = chain(Result.success(100))
.map(n => n * 1.2)
.ensure(n => n < 200, Err.validation('Price.TooHigh', 'Exceeds limit'))
.map(n => `$${n.toFixed(2)}`)
.unwrap();
// => { ok: true, value: "$120.00" }

// Dynamic error from value
Expand Down Expand Up @@ -786,12 +787,12 @@ const sure = asNonEmptyArray([1, 2]); // Some([1, 2])
Composable, type-safe equality and ordering.

```typescript
import { Eq, Ord } from 'tsentials/eq';
import { sortBy, min, max, clamp } from 'tsentials/ord';
import { Eq } from 'tsentials/eq';
import { Ord, sortBy, min, max, clamp } from 'tsentials/ord';

interface User { readonly id: number; readonly name: string; }
interface User { readonly id: number; readonly name: string; readonly age: number; }

const eqUser = Eq.struct<User>({ id: Eq.number, name: Eq.string });
const eqUser = Eq.struct<User>({ id: Eq.number, name: Eq.string, age: Eq.number });

const byAge = Ord.contramap(Ord.number, (u: User) => u.age);
const sorted = sortBy(users, byAge);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsentials",
"version": "0.1.9",
"version": "0.1.10",
"description": "Railway-oriented programming for TypeScript — Result<T>, Maybe<T>, Rule Engine, and DDD base classes with full async pipeline support",
"type": "module",
"main": "./dist/index.js",
Expand Down
Loading