Skip to content

๐ŸŒพ **Typha** โ€“ A lightweight library to parse JSON strings into typed objects with schemas. Perfect for JavaScript and TypeScript developers who want safe and predictable data parsing.

License

Notifications You must be signed in to change notification settings

raulmaciasdev/typha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Typha ๐ŸŒพ

Typha is a lightweight TypeScript/JavaScript library for parsing JSON strings into typed objects using schemas.
It ensures that your data respects the type definitions you specify, handling numbers, booleans, strings, dates, arrays, and nested objects automatically.


Features

  • โœ… Parse JSON strings safely into typed objects
  • โœ… Supports primitives: string, number, boolean, Date
  • โœ… Handles arrays and nested objects
  • โœ… TypeScript ready with full type definitions
  • โœ… Lightweight and zero dependencies

Installation

npm install typha

Usage

import { parseWithSchema } from "typha";

// Define your schema
const schema = {
  name: String,
  age: Number,
  active: Boolean,
  createdAt: Date,
  tags: [String],
  profile: {
    bio: String,
    score: Number
  }
};

// Example JSON string
const raw = JSON.stringify({
  name: "raulmaciasdev",
  age: "40",
  active: "true",
  createdAt: "2025-08-21T10:30:00.000Z",
  tags: ["js", "ts"],
  profile: { bio: "Dev", score: "99" }
});

// Parse using Typha
const obj = parseWithSchema(raw, schema);

console.log(obj);
/*
{
  name: "raulmaciasdev",
  age: 40,
  active: true,
  createdAt: 2025-08-21T10:30:00.000Z,
  tags: ["js","ts"],
  profile: { bio: "Dev", score: 99 }
}
*/

Contributing

Typha is open source! Feel free to fork, open issues, or submit pull requests.

License

MIT

About

๐ŸŒพ **Typha** โ€“ A lightweight library to parse JSON strings into typed objects with schemas. Perfect for JavaScript and TypeScript developers who want safe and predictable data parsing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published