-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for distinct JSONLogic instances #70
Conversation
@@ -36,429 +36,439 @@ http://ricostacruz.com/cheatsheets/umdjs.html | |||
return a; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: