Conversation
d2dadc1 to
ee9fa49
Compare
ee9fa49 to
e6e627f
Compare
bbe1d8a to
e68d842
Compare
c5b26ed to
859945b
Compare
04edfe0 to
f68c165
Compare
| { | ||
| "name": "json-logic-js", | ||
| "name": "@axa-ch/json-logic-js", | ||
| "version": "1.2.2", |
There was a problem hiding this comment.
I would bump the version to 2.0.0 🤔
|
@mjenny |
| return are_missing; | ||
| } | ||
|
|
||
| missing.withApply = true; |
There was a problem hiding this comment.
@lina-salih
@mjenny
I don't like this hacks of meta data like withApply and code...
The reason I have them is, that some operations need to call apply recursively, and others have names within the API like == which is not a valid JavaScript function or variable name., so:
withApply: adds theapplyfunction as a callback as the first argumentcode: overrides the functions key within theoperationsobject, e.g.equal()function gets overridden by it'scodeproperty being==
This is too complex and error prone 💣
There was a problem hiding this comment.
Do you plan on changing this at some point?
There was a problem hiding this comment.
Oh.... do you want to change this in the current PR or open an issue? 😖
| } | ||
|
|
||
| missingSome.code = 'missing_some'; | ||
| missingSome.withApply = true; |
There was a problem hiding this comment.
@lina-salih @mjenny
Same here code, withApply as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
| return data; | ||
| } | ||
|
|
||
| variable.code = 'var'; |
There was a problem hiding this comment.
@lina-salih @mjenny
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
var is a reserved keyword and can't be used as function name
| }, 0); | ||
| } | ||
|
|
||
| add.code = '+'; |
There was a problem hiding this comment.
@lina-salih @mjenny
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
+ is an existing operator
| return a / b; | ||
| } | ||
|
|
||
| divide.code = '/'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
/ is an existing operator
| return a % b; | ||
| } | ||
|
|
||
| modulo.code = '%'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
% is an existing operator
| return a - b; | ||
| } | ||
|
|
||
| substract.code = '-'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
- is an existing operator
| return a == b; | ||
| } | ||
|
|
||
| equal.code = '=='; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
== is an existing operator
| return !truthy(a); | ||
| } | ||
|
|
||
| falsy.code = '!'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
! is an existing operator
| return a != b; | ||
| } | ||
|
|
||
| notEqual.code = '!='; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
!= is an existing operator
| return a === b; | ||
| } | ||
|
|
||
| strictEqual.code = '==='; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
=== is an existing operator
| return a !== b; | ||
| } | ||
|
|
||
| strictNotEqual.code = '!=='; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
!== is an existing operator
| @@ -0,0 +1,3 @@ | |||
| import truthy from '../../helpers/truthy'; | |||
| truthy.code = '!!'; | |||
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
! is an existing operator
| return b.indexOf(a) !== -1; | ||
| } | ||
|
|
||
| indexOf.code = 'in'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
in is an existing operator
| return a > b; | ||
| } | ||
|
|
||
| greater.code = '>'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
> is an existing operator
| return a >= b; | ||
| } | ||
|
|
||
| greaterEqual.code = '>='; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
>= is an existing operator
| return c === undefined ? a < b : a < b && b < c; | ||
| } | ||
|
|
||
| lower.code = '<'; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
< is an existing operator
| return c === undefined ? a <= b : a <= b && b <= c; | ||
| } | ||
|
|
||
| lowerEqual.code = '<='; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
<= is an existing operator
| return null; | ||
| } | ||
|
|
||
| condition.code = ['if', '?:']; |
There was a problem hiding this comment.
Same here code as described in https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014
/if is an existing operator and ?: not a valid variable name and it's and array...
storm1ng
left a comment
There was a problem hiding this comment.
Other than https://github.com/axa-ch/json-logic-js/pull/1/files#r259730014 this LGTM
| return are_missing; | ||
| } | ||
|
|
||
| missing.withApply = true; |
There was a problem hiding this comment.
Do you plan on changing this at some point?
|
Awesome PR, using once again up-to-date components 👍 |
| @@ -0,0 +1,12 @@ | |||
| function add() { | |||
| return a === b; | ||
| } | ||
|
|
||
| strictEqual.code = '==='; |
| }; | ||
| } | ||
|
|
||
| export default createJsonLogic; |
| const not_found = b === undefined ? null : b; | ||
| let data = this; | ||
|
|
||
| if (typeof a === 'undefined' || a === '' || a === null) { |
Uh oh!
There was an error while loading. Please reload this page.