🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@berish/validate

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@berish/validate - npm Package Compare versions

Comparing version

to
0.0.5

3

build/index.d.ts
export * from './pluginSystem';
export * from './globalModule';
export * from './rule';
export * from './validateMap';

@@ -6,7 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const pluginSystem_1 = require("./pluginSystem");
const globalModule = require("./globalModule");
pluginSystem_1.callPlugin(globalModule, (plugin, mod) => pluginSystem_1.useUpgradeGlobalModule(plugin, mod));
__export(require("./pluginSystem"));
__export(require("./globalModule"));
__export(require("./rule"));
__export(require("./validateMap"));
//# sourceMappingURL=index.js.map
import { IValidateRule } from '../rule';
import * as globalModule from '../globalModule';
import * as globalMethodsImport from '../index';
export interface IRulePlugin {
upgradeRuleBeforeInit?(rule: IValidateRule<any>): IValidateRule<any> | void;
upgradeRuleAfterInit?(rule: IValidateRule<any>): IValidateRule<any> | void;
upgradeGlobalModule?(module: typeof globalModule): typeof globalModule | {
upgradeMethods?(globalMethods: typeof globalMethodsImport): typeof globalMethodsImport | {
[key: string]: any;

@@ -8,0 +8,0 @@ } | void;

import { IRulePlugin } from './abstract';
import { IValidateRule } from '../rule';
import * as globalModule from '../globalModule';
import * as globalMethodsImport from '../index';
export declare function useUpgradeRuleBeforeInit(plugin: IRulePlugin, rule: IValidateRule<any>): IValidateRule<any>;
export declare function useUpgradeRuleAfterInit(plugin: IRulePlugin, rule: IValidateRule<any>): IValidateRule<any>;
export declare function useUpgradeGlobalModule(plugin: IRulePlugin, module: typeof globalModule): typeof globalModule;
export declare function useUpgradeMethods(plugin: IRulePlugin, globalMethods: typeof globalMethodsImport): typeof globalMethodsImport;

@@ -21,14 +21,14 @@ "use strict";

exports.useUpgradeRuleAfterInit = useUpgradeRuleAfterInit;
function useUpgradeGlobalModule(plugin, module) {
function useUpgradeMethods(plugin, globalMethods) {
try {
const newModule = (plugin && plugin.upgradeGlobalModule && plugin.upgradeGlobalModule(module)) || module;
if (newModule !== module)
Object.entries(newModule).forEach(([key, value]) => Object.defineProperty(module, key, { value }));
return module;
const newGlobalMethods = (plugin && plugin.upgradeMethods && plugin.upgradeMethods(globalMethods)) || globalMethods;
if (newGlobalMethods !== globalMethods)
Object.entries(newGlobalMethods).forEach(([key, value]) => typeof globalMethods[key] === 'undefined' && Object.defineProperty(globalMethods, key, { value }));
return globalMethods;
}
catch (err) {
return module;
return globalMethods;
}
}
exports.useUpgradeGlobalModule = useUpgradeGlobalModule;
exports.useUpgradeMethods = useUpgradeMethods;
//# sourceMappingURL=system.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const system_1 = require("./system");
const globalMethods = require("../index");
exports.plugins = [];
function usePlugin(...include) {
include = include.filter(m => exports.plugins.indexOf(m) === -1);
exports.plugins.push(...include);
if (include.length > 0) {
exports.plugins.push(...include);
include.reduce((out, plugin) => system_1.useUpgradeMethods(plugin, out), globalMethods);
}
}

@@ -8,0 +13,0 @@ exports.usePlugin = usePlugin;

{
"name": "@berish/validate",
"version": "0.0.4",
"version": "0.0.5",
"description": "Validation of complex objects with support for validation maps, rules and decorators",

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

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