# simple-shape

> A simple function for building JSON Schema

Latest version **0.0.3** (published 2022-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-shape
pnpm add simple-shape
yarn add simple-shape
bun add simple-shape
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2022-09-13 |
| First published | 2022-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sho Miyamoto |
| Maintainers | shqld |

## Links

- npm: https://www.npmjs.com/package/simple-shape
- Repository: https://github.com/shqld/simple-shape
- npm.io page: https://npm.io/package/simple-shape

## Dependencies (1)

- [jsonschema](https://npm.io/package/jsonschema.md) ^1.4.1

## Recent versions

- 0.0.3 (latest) — 2022-09-13
- 0.0.2 — 2022-09-13
- 0.0.1 — 2022-09-12

## README

simple-shape
===

A simple function for building JSON Schema.


Basic Usage
--- 

```ts
import Ajv from "ajv"
import { shape } from 'simple-shape'

const ajv = new Ajv()

const Message = shape({
  id: Number,
  type: anyOf('short', 'long'),
  text: String,
})

// TypeOf<typeof Message> -> { id: number, type: 'short' | 'long', text: string }

const message = {
    id: 1,
    type: 'short',
    text: 'Hello, world!',
}

ajv.validate(shape, message);
```

---
_Source: https://npm.io/package/simple-shape · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
