Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-schema-defaults

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-defaults - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

2

bower.json
{
"name": "json-schema-defaults",
"main": "index.js",
"version": "0.1.1",
"version": "0.2.0",
"authors": [

@@ -6,0 +6,0 @@ "Chute <hello@getchute.com>"

@@ -0,1 +1,7 @@

<a name="0.2.0"></a>
## 0.2.0 (2016-08-05)
* array defaults ([7d98ffb6](https://github.com/chute/json-schema-defaults/commit/7d98ffb634507816bc70dd9551785cae7e32ef4f))
<a name="0.1.1"></a>

@@ -2,0 +8,0 @@ ### 0.1.1 (2015-03-17)

@@ -168,4 +168,33 @@ (function(root, factory) {

if (!schema.items) { return []; }
return [defaults(schema.items, definitions)];
// minimum item count
var ct = schema.minItems || 0;
// tuple-typed arrays
if (schema.items.constructor === Array) {
var values = schema.items.map(function (item) {
return defaults(item, definitions);
});
// remove undefined items at the end (unless required by minItems)
for (var i = values.length - 1; i >= 0; i--) {
if (typeof values[i] !== 'undefined') {
break;
}
if (i + 1 > ct) {
values.pop();
}
}
return values;
}
// object-typed arrays
var value = defaults(schema.items, definitions);
if (typeof value === 'undefined') {
return [];
} else {
var values = [];
for (var i = 0; i < Math.max(1, ct); i++) {
values.push(value);
}
return values;
}
}

@@ -172,0 +201,0 @@

{
"name": "json-schema-defaults",
"version": "0.1.1",
"version": "0.2.0",
"description": "Generate JSON object from default values in JSON Schema",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/chute/grunt-json-schema-defaults",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc