UNPKG

tcomb-json-schema

Version:

Transforms a JSON Schema to a tcomb type

19 lines (14 loc) 326 B
'use strict'; var t = require('tcomb'); function isInteger(n) { return typeof n === 'number' && isFinite(n) && Math.floor(n) === n; } var Null = t.irreducible('Null', function(x) { return x === null; }); var Int = t.irreducible('Int', isInteger); module.exports = { isInteger: isInteger, Null: Null, Int: Int };