New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mityli

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mityli

A minimal runtime type-checking library for JavaScript using Valibot

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

MITYLI ⚓

mi-nimal type-checking library

A minimal JavaScript library providing runtime type-checking powered by Valibot.

Features

  • Automatic Schema Inference: Build Valibot schemas from arbitrary JavaScript values (primitives, arrays, objects)
  • One-Shot Validation: Validate any value against its inferred schema in a single call
  • Simple API: Just 3 core functions - parse(), inferSchema(), and validate()

One‑Shot Validation: Validate any value against its inferred schema in a single call.

Assignment Enforcement: Wrap validated data in a Proxy to intercept property and array-index assignments, ensuring all mutations conform to the original schema.

Installation

npm install mitili
# or
yarn add mitili

Usage

import { parse, inferSchema, validate } from 'mityli';

// 1️⃣ Infer and validate a value
const raw = { name: 'Alice', age: 30 };
const user = parse(raw);

console.log(user.name); // "Alice"

// 2️⃣ Safe assignments (via Proxy)
user.age = 31;    // OK
user.age = '31';  // throws ValiError: Expected number

// 3️⃣ Reuse schema for other data
const schema = inferSchema(raw);
try {
  const other = validate(schema, { name: 'Bob', age: '25' });
} catch (err) {
  console.error('Invalid data:', err);
}

API

inferSchema(value)

Infer a Valibot schema from any JS value.

validate(schema, data)

Validate a value against a given schema (alias to Valibot parse).

parse(value)

Infer, validate, and return a Proxy‑wrapped object/array for runtime assignment checks.

Contributing

Contributions, bug reports, and feature requests are welcome! Please open an issue or pull request on GitHub.

License

MIT

Keywords

runtime

FAQs

Package last updated on 15 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts