⚡ Ultra Fast
400,000+ operations per second with interface mode. Built for maximum performance with object pooling and minimal GC pressure.
🎯 Auto-Detection
Automatically detects Zod schemas, TypeScript classes, and interfaces. No configuration needed - just pass your type and start building.
🎨 Functional Programming
Build immutable objects with composable functions using pipe, compose, transducers, and higher-order functions. Perfect for React/Redux.
🎭 DynamicPick
MongoDB/GraphQL-style field projection with nested paths and arrays. Remove sensitive fields, sanitize API responses, 300k+ ops/sec with auto-caching.
🔒 Type Safe
Full TypeScript support with zero runtime overhead. Catch errors at compile time, not in production.
✅ Validated
Automatic validation with Zod schemas. Keep your data safe at API boundaries with sync or async validation.
🔧 Flexible
Choose OOP or FP based on your needs, or mix both approaches. Works great with existing codebases.
OOP Builder
import { builder } from '@noony-serverless/type-builder';
import { z } from 'zod';
const UserSchema = z.object({
name: z.string(),
email: z.string().email()
});
const createUser = builder(UserSchema);
const user = createUser()
.withName('Alice')
.withEmail('alice@example.com')
.build(); // ✅ Validated!Functional Programming
import { createImmutableBuilder, pipe }
from '@noony-serverless/type-builder';
const userBuilder = createImmutableBuilder<User>(
['id', 'name', 'email']
);
const user = userBuilder.build(
pipe<User>(
userBuilder.withId(1),
userBuilder.withName('Alice'),
userBuilder.withEmail('alice@example.com')
)(userBuilder.empty())
); // ✅ Immutable!DynamicPick
import { customPicker } from '@noony-serverless/type-builder';
const dbUser = {
id: 1,
name: 'Alice',
email: 'alice@example.com',
password: 'secret123',
sessionToken: 'xyz'
};
// Remove sensitive fields
const apiUser = customPicker(dbUser, [
'id',
'name',
'email'
]);
// ✅ { id: 1, name: 'Alice', email: 'alice@example.com' }Performance Benchmarks
| Mode | Operations/sec | Memory/op | Use Case |
|---|---|---|---|
| Interface (OOP) | 400,000+ | ~60 bytes | Internal DTOs |
| DynamicPick | 300,000+ | ~50 bytes | Field Projection |
| Class (OOP) | 300,000+ | ~80 bytes | Domain Models |
| Immutable (FP) | 150,000+ | ~120 bytes | Complex Transformations |
| Zod (OOP) | 100,000+ | ~120 bytes | API Validation |