Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "genmo", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Generates models based off of json-schemas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,2 +1,9 @@ | ||
var any = require('./any') | ||
module.exports = function (schema) { | ||
var value = any(schema) | ||
if (value) { | ||
return value | ||
} | ||
var max = getMax(schema) | ||
@@ -3,0 +10,0 @@ var min = getMin(schema) |
@@ -0,2 +1,9 @@ | ||
var any = require('./any') | ||
module.exports = function (schema) { | ||
var value = any(schema) | ||
if (value) { | ||
return value | ||
} | ||
var max = getMax(schema) | ||
@@ -3,0 +10,0 @@ var min = getMin(schema) |
var loremIpsum = require('lorem-ipsum') | ||
var randexp = require('randexp').randexp | ||
var any = require('./any') | ||
module.exports = function (schema) { | ||
var value = any(schema) | ||
if (value) { | ||
return value | ||
} | ||
var minLength = schema.minLength || 1 | ||
@@ -6,0 +12,0 @@ var maxLength = schema.maxLength || minLength + 10 |
@@ -92,1 +92,10 @@ var tape = require('tape') | ||
}) | ||
tape('integer returns a value from enum if present', function (t) { | ||
var schema = { | ||
type: 'integer', | ||
enum: [1,2,3,4,5,6,7,8,9,0] | ||
} | ||
t.notEqual(schema.enum.indexOf(integer(schema)), -1) | ||
t.end() | ||
}) |
@@ -84,1 +84,10 @@ var tape = require('tape') | ||
}) | ||
tape('number returns a value from enum if present', function (t) { | ||
var schema = { | ||
type: 'integer', | ||
enum: [1,2,3,4,5,6,7,8,9,0] | ||
} | ||
t.notEqual(schema.enum.indexOf(number(schema)), -1) | ||
t.end() | ||
}) |
@@ -45,5 +45,13 @@ var tape = require('tape') | ||
var s = string(schema) | ||
console.log(s) | ||
t.equal(new RegExp(regex).test(s), true) | ||
t.end() | ||
}) | ||
tape('string returns a value from enum if present', function (t) { | ||
var schema = { | ||
type: 'integer', | ||
enum: ['a', 'b', 'c', 'd', 'e', 'f', 'g'] | ||
} | ||
t.notEqual(schema.enum.indexOf(string(schema)), -1) | ||
t.end() | ||
}) |
17293
21
658