leaf-converter
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.5.0"></a> | ||
# [1.5.0](https://github.com/forsigner/leaf-converter/compare/v1.4.3...v1.5.0) (2018-01-17) | ||
### Features | ||
* set default for structToSchema ([116cfda](https://github.com/forsigner/leaf-converter/commit/116cfda)) | ||
<a name="1.4.3"></a> | ||
@@ -7,0 +17,0 @@ ## [1.4.3](https://github.com/forsigner/leaf-converter/compare/v1.4.2...v1.4.3) (2018-01-17) |
@@ -10,3 +10,3 @@ 'use strict'; | ||
var rules = [[_.isString, function (value) { | ||
return { type: value }; | ||
return handle(value); | ||
}], | ||
@@ -28,2 +28,19 @@ // Empty array -> array of any items | ||
function handle(value) { | ||
return { | ||
type: value, | ||
default: getDefault(value), | ||
description: 'Description for this field' | ||
}; | ||
} | ||
function getDefault(value) { | ||
var maps = { | ||
string: 'default value', | ||
number: 100, | ||
boolean: true | ||
}; | ||
return maps[value] ? maps[value] : maps.string; | ||
} | ||
function structToSchema(data) { | ||
@@ -30,0 +47,0 @@ var _iteratorNormalCompletion = true; |
{ | ||
"name": "leaf-converter", | ||
"description": "", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31468
811