Socket
Socket
Sign inDemoInstall

ts-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-json-schema - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

37

lib/JsonSchemaBuilder.js

@@ -272,20 +272,23 @@ "use strict";

var propBuilder;
var rootSchema = this.schema;
var rootSchemaProperty;
if (Array.isArray(path)) {
rootSchemaProperty = path[path.length - 1];
for (var i = 1; i < path.length; i++) {
var propPath = path[i - 1];
if (!rootSchema.properties) {
rootSchema.properties = {};
}
if (!rootSchema.properties[propPath]) {
rootSchema.properties[propPath] = {};
}
rootSchema = rootSchema.properties[propPath];
}
var propertyRoot = this.schema;
var propertyKey;
if (typeof path === 'string') {
propertyKey = path;
path = [path];
}
else {
rootSchemaProperty = path;
propertyKey = path[path.length - 1];
}
for (var i = 0; i < path.length; i++) {
var curentKey = path[i];
if (!propertyRoot.properties) {
propertyRoot.properties = {};
}
if (!propertyRoot.properties[curentKey]) {
propertyRoot.properties[curentKey] = {};
}
if (i < path.length - 1) {
propertyRoot = propertyRoot.properties[curentKey];
}
}
if (typeof schema === 'function') {

@@ -295,5 +298,5 @@ cb = schema;

else if (schema) {
rootSchema.properties[rootSchemaProperty] = schema;
propertyRoot.properties[propertyKey] = schema;
}
propBuilder = new JsonSchemaPropertyBuilder(rootSchemaProperty, rootSchema);
propBuilder = new JsonSchemaPropertyBuilder(propertyKey, propertyRoot);
if (cb) {

@@ -300,0 +303,0 @@ cb(propBuilder);

{
"name": "ts-json-schema",
"version": "1.1.0",
"version": "1.1.1",
"description": "A fluent builder for json schemas",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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