schematized
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -0,1 +1,8 @@ | ||
## [1.8.1](https://github.com/ryparker/schematized/compare/v1.8.0...v1.8.1) (2020-08-12) | ||
### Performance Improvements | ||
* **removed unnecessary toschema() declarations:** also bumped deps ([df9e42c](https://github.com/ryparker/schematized/commit/df9e42cad39bc95c3cbe175a34a6e35245cf351e)) | ||
# [1.8.0](https://github.com/ryparker/schematized/compare/v1.7.2...v1.8.0) (2020-08-07) | ||
@@ -2,0 +9,0 @@ |
@@ -32,9 +32,7 @@ "use strict"; | ||
toSchema() { | ||
let schema = super.toSchema(); | ||
schema = { | ||
...schema, | ||
return { | ||
...super.toSchema(), | ||
...this.maximumStrategy.toSchema(), | ||
...this.minimumStrategy.toSchema() | ||
}; | ||
return schema; | ||
} | ||
@@ -41,0 +39,0 @@ } |
@@ -19,2 +19,3 @@ import { SchemaNode } from '../../schema-node'; | ||
private propertiesToSchema; | ||
private addSchemaProperties; | ||
} |
@@ -56,10 +56,3 @@ "use strict"; | ||
if (properties) { | ||
for (const [key, value] of Object.entries(properties)) { | ||
if (value) { | ||
if (!(this.properties[key] instanceof schema_node_1.SchemaNode)) { | ||
this.properties[key] = new schema_node_1.SchemaNode(); | ||
} | ||
this.properties[key].addSchema(value); | ||
} | ||
} | ||
this.addSchemaProperties(properties); | ||
} | ||
@@ -100,4 +93,15 @@ this.PatternPropertiesStrategy.addSchema(schema); | ||
} | ||
addSchemaProperties(properties) { | ||
for (const [key, value] of Object.entries(properties)) { | ||
if (!value) { | ||
continue; | ||
} | ||
if (!(this.properties[key] instanceof schema_node_1.SchemaNode)) { | ||
this.properties[key] = new schema_node_1.SchemaNode(); | ||
} | ||
this.properties[key].addSchema(value); | ||
} | ||
} | ||
} | ||
exports.ObjectStrategy = ObjectStrategy; | ||
//# sourceMappingURL=index.js.map |
@@ -10,3 +10,4 @@ export declare class PatternProperties { | ||
findPattern(prop: string): string; | ||
filterProperties(properties: Record<string, any>): any; | ||
private propertiesToSchema; | ||
} |
@@ -54,2 +54,6 @@ "use strict"; | ||
} | ||
filterProperties(properties) { | ||
const patterns = Object.keys(this.patternProperties); | ||
return properties.filter((property) => patterns.find((pattern) => new RegExp(pattern).test(property))); | ||
} | ||
propertiesToSchema(properties) { | ||
@@ -56,0 +60,0 @@ const schemaProperties = {}; |
@@ -42,5 +42,4 @@ "use strict"; | ||
toSchema() { | ||
let schema = super.toSchema(); | ||
schema = { | ||
...schema, | ||
return { | ||
...super.toSchema(), | ||
...this.maxLengthStrategy.toSchema(), | ||
@@ -50,3 +49,2 @@ ...this.minLengthStrategy.toSchema(), | ||
}; | ||
return schema; | ||
} | ||
@@ -53,0 +51,0 @@ } |
{ | ||
"name": "schematized", | ||
"description": "Turn objects into JSON schemas! The more examples you provide, the better your schema will be.", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"files": [ | ||
@@ -86,3 +86,3 @@ "dist" | ||
"cz-conventional-changelog": "3.2.0", | ||
"eslint-config-xo-typescript": "^0.31.0", | ||
"eslint-config-xo-typescript": "^0.32.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
@@ -97,3 +97,3 @@ "husky": "^4.2.5", | ||
"typescript": "^3.9.7", | ||
"xo": "^0.32.1" | ||
"xo": "^0.33.0" | ||
}, | ||
@@ -100,0 +100,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
79726
1113