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.3 to 3.0.4

14

package.json
{
"name": "abolish",
"version": "3.0.3",
"version": "3.0.4",
"description": "A javascript object validator.",

@@ -12,3 +12,3 @@ "main": "index.js",

"scripts": {
"bp": "tsc && ts-node build && cd js && npm publish",
"bp": "tsc && ts-node build && npm publish js",
"watch": "tsc --watch",

@@ -23,9 +23,9 @@ "play": "ts-node-dev --respawn play.ts"

"devDependencies": {
"@types/node": "^14.14.16",
"axios": "^0.21.1",
"ts-node-dev": "^1.1.1",
"typescript": "^4.1.3",
"@types/lodash.has": "^4.5.6",
"@types/lodash.startcase": "^4.4.6",
"@types/lodash.unset": "^4.5.6"
"@types/lodash.unset": "^4.5.6",
"@types/node": "^14.14.31",
"axios": "^0.21.1",
"ts-node-dev": "^1.1.6",
"typescript": "^4.2.3"
},

@@ -32,0 +32,0 @@ "keywords": [

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

*/
const objectValue = validated[rule];
const objectValue = Functions_1.Get(validated, rule);
/**

@@ -377,3 +377,3 @@ * If is async push needed data to asyncData

*/
const objectValue = validated[rule];
const objectValue = Functions_1.Get(validated, rule);
let validationResult = false;

@@ -380,0 +380,0 @@ try {

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

export declare function Set(object: any, path: any, value: any): any;
export declare function Get(obj: any, path: string, defaultValue: any): any;
export declare function Get(obj: any, path: string, defaultValue?: any): any;

@@ -91,9 +91,14 @@ "use strict";

function Get(obj, path, defaultValue) {
const travel = (regexp) => String.prototype.split
.call(path, regexp)
.filter(Boolean)
.reduce((res, key) => (res !== null && res !== undefined ? res[key] : res), obj);
const result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/);
return result === undefined || result === obj ? defaultValue : result;
if (path.indexOf('.') >= 0) {
const travel = (regexp) => String.prototype.split
.call(path, regexp)
.filter(Boolean)
.reduce((res, key) => (res !== null && res !== undefined ? res[key] : res), obj);
const result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/);
return result === undefined || result === obj ? defaultValue : result;
}
else {
return obj[path];
}
}
exports.Get = Get;
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