empty-schema
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "empty-schema", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Generate empty placeholder data from JSON Schemas", | ||
"main": "dist/index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "build": "node ./node_modules/.bin/babel src --out-dir lib", |
@@ -21,3 +21,3 @@ # empty-schema | ||
```js | ||
import empty from 'empty-schema' | ||
import {empty} from 'empty-schema' | ||
@@ -24,0 +24,0 @@ const schema = { |
@@ -18,3 +18,3 @@ import deref from 'simple-json-schema-deref' | ||
*/ | ||
export default function empty(schema, global) { | ||
export default function _empty(schema, global) { | ||
const { | ||
@@ -37,3 +37,3 @@ type, | ||
// var s = deref($ref, global) | ||
// return empty(s, global) | ||
// return _empty(s, global) | ||
} else if (type) { | ||
@@ -74,7 +74,7 @@ let kind | ||
} else if (allOf) { | ||
return empty(merge(allOf), global) | ||
return _empty(merge(allOf), global) | ||
} else if (anyOf) { | ||
return empty(anyOf[0], global) | ||
return _empty(anyOf[0], global) | ||
} else if ( oneOf ) { | ||
return empty(oneOf[0], global) | ||
return _empty(oneOf[0], global) | ||
} else { | ||
@@ -81,0 +81,0 @@ throw new Error(`cannot generate data from schema ${schema}`) |
import deref from 'simple-json-schema-deref' | ||
import _empty from './empty' | ||
export { _empty } from './empty' | ||
export { _array } from './array' | ||
@@ -12,6 +14,8 @@ export { _boolean } from './boolean' | ||
export default function(schema) { | ||
export const empty = (schema) => { | ||
const denormed = deref(schema) | ||
return empty(denormed, denormed) | ||
return _empty(denormed, denormed) | ||
} | ||
export { empty as default } |
20469
586