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

abolish

Package Overview
Dependencies
Maintainers
1
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abolish - npm Package Compare versions

Comparing version 3.0.5 to 3.1.0

2

package.json
{
"name": "abolish",
"version": "3.0.5",
"version": "3.1.0",
"description": "A javascript object validator.",

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

@@ -167,4 +167,8 @@ "use strict";

*/
if (typeof ruleData === "string")
if (typeof ruleData === "string") {
ruleData = StringToRules_1.default(ruleData);
}
else if (Array.isArray(ruleData)) {
ruleData = Functions_1.ParseRules(ruleData);
}
/**

@@ -171,0 +175,0 @@ * if ruleData has property of $skip then check

@@ -29,1 +29,2 @@ import Abolish from "./Abolish";

export declare function Get(obj: any, path: string, defaultValue?: any): any;
export declare function ParseRules<Rules = Record<string, any>>(rules: Record<keyof Rules | string, any>): Rules;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Get = exports.Set = exports.Pick = exports.Rule = exports.StartCase = exports.UpperFirst = void 0;
exports.ParseRules = exports.Get = exports.Set = exports.Pick = exports.Rule = exports.StartCase = exports.UpperFirst = void 0;
const StringToRules_1 = __importDefault(require("./StringToRules"));

@@ -105,1 +105,25 @@ const lodash_startcase_1 = __importDefault(require("lodash.startcase"));

exports.Get = Get;
function ParseRules(rules) {
/**
* Stores generated rules
*/
let generatedRule = {};
/**
* Loop Through each rule
*
* 1. convert to object if string
* 2. add rule to generatedRule object
*/
for (let key of Object.keys(rules)) {
let rule = rules[key];
if (typeof rule === "string") {
rule = StringToRules_1.default(rule);
}
else if (Array.isArray(rule)) {
rule = Rule(rule);
}
generatedRule[key] = rule;
}
return generatedRule;
}
exports.ParseRules = ParseRules;
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