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

json-logic-js

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-logic-js - npm Package Compare versions

Comparing version 1.2.3 to 2.0.0

CHANGELOG.md

4

logic.js

@@ -173,6 +173,2 @@ /* globals define,module */

},
"method": function(obj, method, args) {
return obj[method].apply(obj, args);
},
};

@@ -179,0 +175,0 @@

{
"name": "json-logic-js",
"version": "1.2.3",
"version": "2.0.0",
"description": "Build complex rules, serialize them as JSON, and execute them in JavaScript",

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

@@ -207,36 +207,2 @@ var jsonLogic = require("../logic.js");

QUnit.test( "Expanding functionality with method", function( assert) {
// Data contains a real object with methods and local state
var a = {
count: 0,
increment: function() {
return this.count += 1;
},
add: function(b) {
return this.count += b;
},
};
// Look up "a" in data, and run the increment method on it with no args.
assert.equal(
jsonLogic.apply(
{"method": [{"var": "a"}, "increment"]},
{"a": a}
),
1 // Happy return value
);
assert.equal(a.count, 1); // Happy state change
// Run the add method with an argument
assert.equal(
jsonLogic.apply(
{"method": [{"var": "a"}, "add", [41]]},
{"a": a}
),
42 // Happy return value
);
assert.equal(a.count, 42); // Happy state change
});
QUnit.test("Control structures don't eval depth-first", function(assert) {

@@ -243,0 +209,0 @@ // Depth-first recursion was wasteful but not harmful until we added custom operations that could have side-effects.

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