# typerator

> JSON schema detector

Latest version **0.1.0** (published 2015-03-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install typerator
pnpm add typerator
yarn add typerator
bun add typerator
```

## 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.1.0 |
| Published | 2015-03-31 |
| First published | 2015-03-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ThomasC__ |
| Maintainers | thomasc__ |
| Keywords | json, schema |

## Links

- npm: https://www.npmjs.com/package/typerator
- Repository: https://github.com/ThomasCrvsr/typerator
- Issues: https://github.com/ThomasCrvsr/typerator/issues
- npm.io page: https://npm.io/package/typerator

## Dependencies (1)

- [ramda](https://npm.io/package/ramda.md) ^0.13.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-03-31
- 0.0.1 (beta) — 2015-03-29

## README

# typerator : get JSON-schema from your data

## How to get it

The module is only available on npm for the moment : ```npm install typerator```

## How to use it

### getType

Returns the JSON schema of the passed parameter.

Example :

```
var typerator = require('typerator');

var a = 42;
var b = 'yolo';
var c = {
    a: {
        f: 'test'
    },
    b: 34
};
var d = [1, 2, [1, 3], {a: 23}];

var typeA = typerator.getType(a);
var typeB = typerator.getType(b);
var typeC = typerator.getType(c);
var typeD = typerator.getType(d);
```

### union(typeA, typeB)

Returns the JSON schema resulting of the union of the schema typeA and typeB.

```
// Using types defined in the previous part
var unionAB = typerator.union(typeA, typeB);

// etc ...
```

### typeToString(type)

Format a JSON schema into string

```
console.log(typerator.typeToString(typeA));
```

## Hacking the source code

This project uses Ramda, some ES6 features and Gulp to transpile the library into ES5.

You'll need to install : gulp, gulp-babel and gulp-rename.

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