api-elements
Advanced tools
Comparing version 0.3.0 to 0.3.1
# API Elements (JavaScript) CHANGELOG | ||
## 0.3.1 (2020-09-07) | ||
### Bug Fixes | ||
- Generating a value from an element will now prefer sample/default values for | ||
objects which contain only undefined property values. | ||
## 0.3.0 (2020-08-05) | ||
@@ -4,0 +11,0 @@ |
@@ -89,2 +89,3 @@ /* eslint-disable no-bitwise, no-underscore-dangle */ | ||
const isArrayElement = e => e instanceof ArrayElement; | ||
const isObjectElement = e => e instanceof ObjectElement; | ||
@@ -98,2 +99,5 @@ const hasSample = e => findFirstSample(e) !== null; | ||
const isNonEmptyArrayElement = e => isArrayElement(e) && e.content && !e.isEmpty; | ||
const isEmptyArray = e => isArrayElement(e) && e.content.every(isNoValuePrimitive); | ||
const isObjectWithUndefinedValues = e => isObjectElement(e) | ||
&& e.content.every(prop => prop.value === undefined || prop.value.content === undefined); | ||
@@ -128,3 +132,3 @@ | ||
if (e.content && !(isArrayElement(e) && e.content.every(isNoValuePrimitive))) { | ||
if (e.content && !isEmptyArray(e) && !isObjectWithUndefinedValues(e)) { | ||
const result = f(e, opts, elements, 'content'); | ||
@@ -232,3 +236,3 @@ | ||
if (e instanceof ObjectElement) { | ||
if (isObjectElement(e)) { | ||
let result = {}; | ||
@@ -235,0 +239,0 @@ |
{ | ||
"name": "api-elements", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "API Elements JavaScript", | ||
@@ -35,3 +35,3 @@ "author": "Apiary.io <support@apiary.io>", | ||
}, | ||
"gitHead": "8c8c429fb233f691b4dd64dabc4cc01d765f06ef" | ||
"gitHead": "d226305421ff42dfa30041568eb639a0755aa16b" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
48089
1118
1