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.5.0 to 2.6.0

3

index.js

@@ -1,4 +0,5 @@

const { default: Schema } = require('./lib/node')
const { default: Schema, ...utils } = require('./lib/node')
module.exports = Schema
module.exports.default = Schema
Object.assign(module.exports, utils)

@@ -9,6 +9,18 @@ var __defProp = Object.defineProperty;

__name(isNullable, "isNullable");
function isObject(data) {
function isPlainObject(data) {
return data && typeof data === "object" && !Array.isArray(data);
}
__name(isObject, "isObject");
__name(isPlainObject, "isPlainObject");
function clone(source) {
if (!source || typeof source !== "object")
return source;
if (Array.isArray(source))
return source.map(clone);
if (source instanceof Date)
return new Date(source.valueOf());
if (source instanceof RegExp)
return new RegExp(source.source, source.flags);
return Object.fromEntries(Object.entries(source).map(([key, value]) => [key, clone(value)]));
}
__name(clone, "clone");
var kSchema = Symbol("schemastery");

@@ -61,3 +73,3 @@ var Schema = /* @__PURE__ */ __name(function(options) {

return [data];
data = fallback;
data = clone(fallback);
}

@@ -156,3 +168,3 @@ const callback = resolvers[schema.type];

Schema.extend("dict", (data, { inner, sKey }, strict) => {
if (!isObject(data))
if (!isPlainObject(data))
throw new TypeError(`expected object but got ${data}`);

@@ -193,3 +205,3 @@ const result = {};

Schema.extend("object", (data, { dict }, strict) => {
if (!isObject(data))
if (!isPlainObject(data))
throw new TypeError(`expected object but got ${data}`);

@@ -224,3 +236,3 @@ const result = {};

}
if (!strict && isObject(data))
if (!strict && isPlainObject(data))
merge(result, data);

@@ -231,3 +243,3 @@ return [result];

const [result, adapted = data] = Schema.resolve(data, inner, true);
if (isObject(data)) {
if (isPlainObject(data)) {
const temp = {};

@@ -311,4 +323,7 @@ for (const key in result) {

export {
src_default as default
clone,
src_default as default,
isNullable,
isPlainObject
};
//# sourceMappingURL=browser.js.map

@@ -1,5 +0,8 @@

declare type Dict<T = any, K extends string = string> = {
export declare type Dict<T = any, K extends string = string> = {
[key in K]?: T;
};
declare type Intersect<U> = (U extends any ? (arg: U) => void : never) extends ((arg: infer I) => void) ? I : never;
export declare type Intersect<U> = (U extends any ? (arg: U) => void : never) extends ((arg: infer I) => void) ? I : never;
export declare function isNullable(value: any): boolean;
export declare function isPlainObject(data: any): boolean;
export declare function clone<T>(source: T): T;
interface Schema<S = any, T = S> extends Schema.Base<T> {

@@ -6,0 +9,0 @@ (data: S): T;

@@ -27,3 +27,6 @@ var __defProp = Object.defineProperty;

__export(exports, {
default: () => src_default
clone: () => clone,
default: () => src_default,
isNullable: () => isNullable,
isPlainObject: () => isPlainObject
});

@@ -34,6 +37,18 @@ function isNullable(value) {

__name(isNullable, "isNullable");
function isObject(data) {
function isPlainObject(data) {
return data && typeof data === "object" && !Array.isArray(data);
}
__name(isObject, "isObject");
__name(isPlainObject, "isPlainObject");
function clone(source) {
if (!source || typeof source !== "object")
return source;
if (Array.isArray(source))
return source.map(clone);
if (source instanceof Date)
return new Date(source.valueOf());
if (source instanceof RegExp)
return new RegExp(source.source, source.flags);
return Object.fromEntries(Object.entries(source).map(([key, value]) => [key, clone(value)]));
}
__name(clone, "clone");
var kSchema = Symbol("schemastery");

@@ -86,3 +101,3 @@ var Schema = /* @__PURE__ */ __name(function(options) {

return [data];
data = fallback;
data = clone(fallback);
}

@@ -182,3 +197,3 @@ const callback = resolvers[schema.type];

Schema.extend("dict", (data, { inner, sKey }, strict) => {
if (!isObject(data))
if (!isPlainObject(data))
throw new TypeError(`expected object but got ${data}`);

@@ -219,3 +234,3 @@ const result = {};

Schema.extend("object", (data, { dict }, strict) => {
if (!isObject(data))
if (!isPlainObject(data))
throw new TypeError(`expected object but got ${data}`);

@@ -250,3 +265,3 @@ const result = {};

}
if (!strict && isObject(data))
if (!strict && isPlainObject(data))
merge(result, data);

@@ -257,3 +272,3 @@ return [result];

const [result, adapted = data] = Schema.resolve(data, inner, true);
if (isObject(data)) {
if (isPlainObject(data)) {
const temp = {};

@@ -337,3 +352,7 @@ for (const key in result) {

// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
0 && (module.exports = {
clone,
isNullable,
isPlainObject
});
//# sourceMappingURL=node.js.map
{
"name": "schemastery",
"description": "type driven schema validator",
"version": "2.5.0",
"version": "2.6.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