0.0.5 • Published 6 years ago

jts-templates v0.0.5

Weekly downloads
70
License
ISC
Repository
github
Last release
6 years ago

JTS Templates

A library to help in writing less verbose JSON transformation schema.

The Why

  • JSON Transformation schema could be a little verbose. This library provide an alternate way to write JTS.

Example

/* JTS with JTS templates */
const schema = {
	person: {
		name: type('string'),
		age: optional(type('number')),
		hobbies: type(optional('array')),
	},
}

/* JTS vanila */
const schema = {
	person: {
		type: 'object',
		properties: {
			name: {
				type: 'string',
			},
			age: {
				type: 'number',
				required: false,
			},
			hobbies: {
				type: 'array',
				required: false,
			},
		},
	},
}

For more examples, check the examples dir.

Installation

$ npm install jts-templates

Use Cases

  • Some usecases.

Keys

  • A short list of things to understand the package, better.

Notes

  • Some notes.

Development

Setup

$ sh ./setup.sh

ToDo

  • Add a cheatsheet example.