New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@decs/typeschema

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@decs/typeschema - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

dist/adapters/arktype.d.ts

6

dist/index.d.ts

@@ -1,2 +0,4 @@

export { assert } from './assert';
export type { Infer, Schema } from './types';
import type { Schema } from './adapters';
export type { Schema } from './adapters';
export type Infer<TSchema> = TSchema extends Schema<infer T> ? T : never;
export declare function assert<T>(schema: Schema<T>, data: unknown): Promise<T>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.assert = void 0;
var assert_1 = require("./assert");
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_1.assert; } });
const adapters_1 = require("./adapters");
function assert(schema, data) {
return __awaiter(this, void 0, void 0, function* () {
return (yield (0, adapters_1.wrap)(schema)).assert(data);
});
}
exports.assert = assert;
{
"name": "@decs/typeschema",
"version": "0.1.3",
"description": "Unified interface for TypeScript schema validations",
"version": "0.2.0",
"description": "Universal adapter for schema validation",
"keywords": [

@@ -13,3 +13,3 @@ "typescript",

],
"homepage": "https://github.com/decs/typeschema#readme",
"homepage": "https://typeschema.com",
"license": "MIT",

@@ -38,2 +38,3 @@ "author": {

"devDependencies": {
"@sinclair/typebox": "^0.29.4",
"@types/node": "^20.3.3",

@@ -65,3 +66,39 @@ "@typescript-eslint/eslint-plugin": "^5.60.1",

"zod": "^3.21.4"
},
"peerDependencies": {
"@sinclair/typebox": "^0.29.4",
"arktype": "^1.0.14-alpha",
"joi": "^17.9.2",
"runtypes": "^6.7.0",
"superstruct": "^1.0.3",
"typia": "^4.1.2",
"yup": "^1.2.0",
"zod": "^3.21.4"
},
"peerDependenciesMeta": {
"@sinclair/typebox": {
"optional": true
},
"arktype": {
"optional": true
},
"joi": {
"optional": true
},
"runtypes": {
"optional": true
},
"superstruct": {
"optional": true
},
"typia": {
"optional": true
},
"yup": {
"optional": true
},
"zod": {
"optional": true
}
}
}

@@ -1,9 +0,11 @@

<h1 align="center">🛵 TypeSchema</h1>
<p align="center">Unified interface for TypeScript schema validations</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/decs/typeschema" alt="License"></a>
<a href="https://www.npmjs.com/package/@decs/typeschema" rel="nofollow"><img src="https://img.shields.io/npm/dw/@decs/typeschema.svg" alt="NPM Downloads"></a>
</p>
<div id="header">
<h1 align="center">🛵 TypeSchema</h1>
<p align="center">Universal adapter for schema validation</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/decs/typeschema" alt="License"></a>
<a href="https://www.npmjs.com/package/@decs/typeschema" rel="nofollow"><img src="https://img.shields.io/npm/dw/@decs/typeschema.svg" alt="NPM Downloads"></a>
</p>
<br />
<br />
</div>

@@ -21,3 +23,3 @@ Many libraries rely on some sort of type validation. Their maintainers have the choice of either to:

- 🚀 Decouple your code from validation libraries
- 🍃 Less than 3 kB, zero dependencies
- 🍃 Tiny client footprint, zero dependencies
- ✨ Easy-to-use, minimal API

@@ -66,2 +68,3 @@

#### Types
- `Schema<T>`<br />Generic interface for schemas

@@ -71,2 +74,3 @@ - `Infer<T as Schema<unknown>>`<br />Extracts the equivalent TypeScript type of a schema

#### Functions
- `assert<T>(schema: Schema<T>, data: unknown): Promise<T>`<br />Returns the validated data or throws an exception

@@ -76,14 +80,14 @@

| Project | Popularity | Example schema | Support |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------ | ------------------ |
| [zod](https://zod.dev) | ![GitHub Stars](https://img.shields.io/github/stars/colinhacks/zod.svg?style=social) | `z.string()` | ✅ |
| [yup](https://github.com/jquense/yup) | ![GitHub Stars](https://img.shields.io/github/stars/jquense/yup.svg?style=social) | `string()` | ✅ |
| [joi](https://joi.dev) | ![GitHub Stars](https://img.shields.io/github/stars/hapijs/joi.svg?style=social) | `Joi.string()` | ✅ |
| [superstruct](https://docs.superstructjs.org) | ![GitHub Stars](https://img.shields.io/github/stars/ianstormtaylor/superstruct.svg?style=social) | `string()` | ✅ |
| [io-ts](https://gcanti.github.io/io-ts) | ![GitHub Stars](https://img.shields.io/github/stars/gcanti/io-ts.svg?style=social) | `t.string` | ❌ |
| [ow](https://sindresorhus.com/ow) | ![GitHub Stars](https://img.shields.io/github/stars/sindresorhus/ow.svg?style=social) | `ow.string` | ❌ |
| [typebox](https://github.com/sinclairzx81/typebox) | ![GitHub Stars](https://img.shields.io/github/stars/sinclairzx81/typebox.svg?style=social) | `Type.String()` | ❌ |
| [typia](https://typia.io) | ![GitHub Stars](https://img.shields.io/github/stars/samchon/typia.svg?style=social) | `typia.createAssert<string>()` | ✅ |
| [runtypes](https://github.com/pelotom/runtypes) | ![GitHub Stars](https://img.shields.io/github/stars/pelotom/runtypes.svg?style=social) | `String` | ✅ |
| [arktype](https://arktype.io) | ![GitHub Stars](https://img.shields.io/github/stars/arktypeio/arktype.svg?style=social) | `type('string')` | ✅ |
| Project | Popularity | Example schema | Support |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------ | ------- |
| [zod](https://zod.dev) | ![GitHub Stars](https://img.shields.io/github/stars/colinhacks/zod.svg?style=social) | `z.string()` | ✅ |
| [yup](https://github.com/jquense/yup) | ![GitHub Stars](https://img.shields.io/github/stars/jquense/yup.svg?style=social) | `string()` | ✅ |
| [joi](https://joi.dev) | ![GitHub Stars](https://img.shields.io/github/stars/hapijs/joi.svg?style=social) | `Joi.string()` | ✅ |
| [superstruct](https://docs.superstructjs.org) | ![GitHub Stars](https://img.shields.io/github/stars/ianstormtaylor/superstruct.svg?style=social) | `string()` | ✅ |
| [io-ts](https://gcanti.github.io/io-ts) | ![GitHub Stars](https://img.shields.io/github/stars/gcanti/io-ts.svg?style=social) | `t.string` | ❌ |
| [ow](https://sindresorhus.com/ow) | ![GitHub Stars](https://img.shields.io/github/stars/sindresorhus/ow.svg?style=social) | `ow.string` | ❌ |
| [typebox](https://github.com/sinclairzx81/typebox) | ![GitHub Stars](https://img.shields.io/github/stars/sinclairzx81/typebox.svg?style=social) | `Type.String()` | ✅ |
| [typia](https://typia.io) | ![GitHub Stars](https://img.shields.io/github/stars/samchon/typia.svg?style=social) | `typia.createAssert<string>()` | ✅ |
| [runtypes](https://github.com/pelotom/runtypes) | ![GitHub Stars](https://img.shields.io/github/stars/pelotom/runtypes.svg?style=social) | `String` | ✅ |
| [arktype](https://arktype.io) | ![GitHub Stars](https://img.shields.io/github/stars/arktypeio/arktype.svg?style=social) | `type('string')` | ✅ |

@@ -106,2 +110,2 @@ Custom validations are also supported:

* Inspired by [tRPC](https://trpc.io/)'s [input & output validators](https://trpc.io/docs/server/validators)
- Inspired by [tRPC](https://trpc.io/)'s [input & output validators](https://trpc.io/docs/server/validators)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc