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

@simplism/core

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplism/core - npm Package Compare versions

Comparing version 10.3.62 to 10.3.63

16

dist/extension/ObjectConstructorExt.d.ts

@@ -16,20 +16,18 @@ import "./ArrayExt";

validate(value: any, def: ValidateDef): IValidateResult | undefined;
validates(source: any, defs: ((item: any) => {
[key: string]: IValidateDef;
}), throwNotUse?: boolean): IValidateResult[];
validates(source: any, defs: {
[key: string]: ValidateDef;
}): IValidateResult[];
}, throwNotUse?: boolean): IValidateResult[];
validatesArray<T, K extends keyof T>(arr: T[], displayName: string, def: ((item: T) => {
[P in K]: IArrayValidateDef;
[P in K]: IValidateDef;
})): void;
validatesArray<T, K extends keyof T>(arr: T[], displayName: string, def: {
[P in K]: IArrayValidateDef;
[P in K]: IValidateDef;
}): void;
}
}
export interface IArrayValidateDef {
displayName: string;
type?: Type<any> | Type<any>[];
notnull?: boolean;
validator?(value: any): boolean;
}
export interface IValidateDef {
displayName?: string;
type?: Type<any> | Type<any>[];

@@ -36,0 +34,0 @@ notnull?: boolean;

{
"name": "@simplism/core",
"version": "10.3.62",
"version": "10.3.63",
"description": "Simplism Core Package",

@@ -5,0 +5,0 @@ "repository": "github:kslhunter/simplism",

@@ -17,18 +17,14 @@ import "./ArrayExt";

validates(source: any, defs: { [key: string]: ValidateDef }): IValidateResult[];
validates(source: any, defs: ((item: any) => { [key: string]: IValidateDef }), throwNotUse?: boolean): IValidateResult[];
validatesArray<T, K extends keyof T>(arr: T[], displayName: string, def: ((item: T) => { [P in K]: IArrayValidateDef })): void;
validatesArray<T, K extends keyof T>(arr: T[], displayName: string, def: { [P in K]: IArrayValidateDef }): void;
}
}
validates(source: any, defs: { [key: string]: ValidateDef }, throwNotUse?: boolean): IValidateResult[];
export interface IArrayValidateDef {
displayName: string;
type?: Type<any> | Type<any>[];
notnull?: boolean;
validatesArray<T, K extends keyof T>(arr: T[], displayName: string, def: ((item: T) => { [P in K]: IValidateDef })): void;
validator?(value: any): boolean;
validatesArray<T, K extends keyof T>(arr: T[], displayName: string, def: { [P in K]: IValidateDef }): void;
}
}
export interface IValidateDef {
displayName?: string;
type?: Type<any> | Type<any>[];

@@ -181,6 +177,7 @@ notnull?: boolean;

Object.validates = function (source: any, defs: { [propertyKey: string]: ValidateDef }): IValidateResult[] {
Object.validates = function (source: any, defs: { [propertyKey: string]: ValidateDef } | ((item: any) => { [propertyKey: string]: ValidateDef }), throwNotUse?: boolean): IValidateResult[] {
const result: IValidateResult[] = [];
for (const propertyKey of Object.keys(defs)) {
const validateResult = this.validate(source[propertyKey], defs[propertyKey]);
const defsObj = typeof defs === "function" ? defs(source) : defs;
for (const propertyKey of Object.keys(defsObj)) {
const validateResult = this.validate(source[propertyKey], defsObj[propertyKey]);
if (validateResult) {

@@ -194,11 +191,17 @@ result.push({

if (result.length > 0 && !throwNotUse) {
const propertyDisplayNames = result.map(item1 => defsObj[item1.propertyKey!]["displayName"]);
throw new Error(`ėž…ë Ĩ값ė´ ėž˜ëĒģ되ė—ˆėŠĩ니다.\r\n - ${propertyDisplayNames.join("', '")}'`);
}
return result;
};
Object.validatesArray = function (arr: any[], displayName: string, def: { [propertyKey: string]: ValidateDef } | ((item: any) => { [propertyKey: string]: IArrayValidateDef })): void {
Object.validatesArray = function (arr: any[], displayName: string, def: { [propertyKey: string]: ValidateDef } | ((item: any) => { [propertyKey: string]: ValidateDef })): void {
const errorMessages = [];
for (const item of arr) {
const result = Object.validates(item, typeof def === "function" ? def(item) : def);
const defObj = typeof def === "function" ? def(item) : def;
const result = Object.validates(item, defObj, true);
if (result.length > 0) {
const propertyDisplayNames = result.map(item1 => def[item1.propertyKey!]["displayName"]);
const propertyDisplayNames = result.map(item1 => defObj[item1.propertyKey!]["displayName"]);
errorMessages.push(`- '${displayName}'ė˜ ${arr.indexOf(item) + 1}번ė§¸ 항ëĒŠė¤‘ '${propertyDisplayNames.join("', '")}'`);

@@ -210,2 +213,2 @@ }

}
};
};

Sorry, the diff of this file is too big to display

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