Allow for distinct JSONLogic instances#70
Allow for distinct JSONLogic instances#70briandamaged wants to merge 2 commits intojwadhams:masterfrom
Conversation
| @@ -36,429 +36,439 @@ http://ricostacruz.com/cheatsheets/umdjs.html | |||
| return a; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
Most of the changes in this file are just due to indentation. (Specifically: wrapping the existing logic w/ another function)
|
|
||
| retval.JSONLogic = JSONLogic; | ||
|
|
||
| return retval; |
There was a problem hiding this comment.
Lines 468 - 472 are the only real "change" to this file. They simply:
- Create an instance of JSONLogic. (ie: by invoking the factory function)
- Inject the factory function into this instance. (So that developers can create separate isolated instances of JSONLogic)
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Added a few tests to ensure that the individual JSONLogic instances weren't accidentally sharing state.
|
@jwadhams : Howdy! Is there any possibility that you could review/release this update in the next few days? The change is 100% backwards-compatible with the previous version of the code, and it does not change any of the underlying logic. It simply allows developers to create separate distinct instances of the JSONLogic interpreter. We need this capability on an upcoming project because we intend to use JSONLogic within multiple distinct contexts. We can fork this project if necessary, but we'd prefer to continue using the mainline release. Thanks in advance! |
|
Actually: I've come up w/ a way to achieve the same thing wo/ changing the indentation. So, I'll create a new PR soon. |
|
Closing this out in favor of #71 . This achieves exactly the same goal, but it eliminates a lot of the re-indentation. (Which should make it a lot easier to avoid merge conflicts in other PRs) |
This change exposes the JSONLogic factory function so that multiple independent instances of JSONLogic can be instantiated at once. For example: