New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

schemastery

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schemastery - npm Package Compare versions

Comparing version 2.6.0 to 3.0.0

30

lib/browser.js

@@ -43,7 +43,8 @@ var __defProp = Object.defineProperty;

}, "toBSON");
for (const key of ["required", "hidden", "adaptive"]) {
for (const key of ["required", "hidden"]) {
Object.assign(Schema.prototype, {
[key]() {
this.meta[key] = true;
return this;
[key](value = true) {
const schema = Schema(this);
schema.meta = { ...schema.meta, [key]: value };
return schema;
}

@@ -55,4 +56,5 @@ });

[key](value) {
this.meta[key] = value;
return this;
const schema = Schema(this);
schema.meta = { ...schema.meta, [key]: value };
return schema;
}

@@ -91,11 +93,11 @@ });

case String:
return Schema.string();
return Schema.string().required();
case Number:
return Schema.number();
return Schema.number().required();
case Boolean:
return Schema.boolean();
return Schema.boolean().required();
case Function:
return Schema.function();
return Schema.function().required();
default:
return Schema.is(source);
return Schema.is(source).required();
}

@@ -263,3 +265,3 @@ } else {

case "sKey":
schema.sKey = Schema.from(args[index]);
schema.sKey = args[index] ?? Schema.string();
break;

@@ -283,6 +285,2 @@ case "inner":

schema.meta.default = [];
} else if (name === "union") {
const child = schema.list.find((item) => !isNullable(item.meta.default));
if (child)
schema.meta.default = child.meta.default;
}

@@ -289,0 +287,0 @@ return schema;

@@ -16,5 +16,4 @@ export declare type Dict<T = any, K extends string = string> = {

toBSON(): Schema.Base<T>;
required(): Schema<S, T>;
hidden(): Schema<S, T>;
adaptive(): Schema<S, T>;
required(value?: boolean): Schema<S, T>;
hidden(value?: boolean): Schema<S, T>;
role(text: string): Schema<S, T>;

@@ -51,3 +50,2 @@ link(link: string): Schema<S, T>;

hidden?: boolean;
adaptive?: boolean;
role?: string;

@@ -88,3 +86,3 @@ link?: string;

array<X>(inner: X): Schema<TypeS<X>[], TypeT<X>[]>;
dict<X, Y extends string | Schema<any, string>>(inner: X, sKey?: Y): Schema<Dict<TypeS<X>, TypeS<Y>>, Dict<TypeT<X>, TypeT<Y>>>;
dict<X, Y extends Schema<any, string> = Schema<string>>(inner: X, sKey?: Y): Schema<Dict<TypeS<X>, TypeS<Y>>, Dict<TypeT<X>, TypeT<Y>>>;
tuple<X extends readonly any[]>(list: X): Schema<TupleS<X>, TupleT<X>>;

@@ -91,0 +89,0 @@ object<X extends Dict>(dict: X): Schema<ObjectS<X>, ObjectT<X>>;

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;

@@ -17,2 +19,3 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;

};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });

@@ -71,7 +74,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });

}, "toBSON");
for (const key of ["required", "hidden", "adaptive"]) {
for (const key of ["required", "hidden"]) {
Object.assign(Schema.prototype, {
[key]() {
this.meta[key] = true;
return this;
[key](value = true) {
const schema = Schema(this);
schema.meta = __spreadProps(__spreadValues({}, schema.meta), { [key]: value });
return schema;
}

@@ -83,4 +87,5 @@ });

[key](value) {
this.meta[key] = value;
return this;
const schema = Schema(this);
schema.meta = __spreadProps(__spreadValues({}, schema.meta), { [key]: value });
return schema;
}

@@ -119,11 +124,11 @@ });

case String:
return Schema.string();
return Schema.string().required();
case Number:
return Schema.number();
return Schema.number().required();
case Boolean:
return Schema.boolean();
return Schema.boolean().required();
case Function:
return Schema.function();
return Schema.function().required();
default:
return Schema.is(source);
return Schema.is(source).required();
}

@@ -290,5 +295,6 @@ } else {

keys.forEach((key, index) => {
var _a;
switch (key) {
case "sKey":
schema.sKey = Schema.from(args[index]);
schema.sKey = (_a = args[index]) != null ? _a : Schema.string();
break;

@@ -312,6 +318,2 @@ case "inner":

schema.meta.default = [];
} else if (name === "union") {
const child = schema.list.find((item) => !isNullable(item.meta.default));
if (child)
schema.meta.default = child.meta.default;
}

@@ -318,0 +320,0 @@ return schema;

{
"name": "schemastery",
"description": "type driven schema validator",
"version": "2.6.0",
"version": "3.0.0",
"main": "index.js",

@@ -6,0 +6,0 @@ "module": "lib/browser.js",

Sorry, the diff of this file is not supported yet

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