Closed alexchornyi closed 3 years ago
Merging #16 (af00117) into master (a4d6647) will decrease coverage by
0.02%
. The diff coverage is95.23%
.
@@ Coverage Diff @@
## master #16 +/- ##
==========================================
- Coverage 98.32% 98.30% -0.03%
==========================================
Files 31 31
Lines 3282 3298 +16
==========================================
+ Hits 3227 3242 +15
- Misses 55 56 +1
Impacted Files | Coverage Δ | |
---|---|---|
Sources/jsonlogic/Parser.swift | 95.36% <90.90%> (-0.18%) |
:arrow_down: |
...cTests/AccessingDataOperations/ArrayMapTests.swift | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update a4d6647...af00117. Read the comment docs.
Hello @alexchornyi Thanks for your contribution!
If I understand this correctly you add support for using array index as part of the keypath string for accessing the data
So the rule
{ "var" : "person.name.1" }
applied to
{ "person" : { "name" : ["John", "Green"] } }
will produce "Green"
I had missed this capability in the original implementation.
Can you also add a unit test for this? something like
func testAccessingVariableWithArrayIndexPath() {
let rule =
"""
{ "var" : "person.name.1" }
"""
let data =
"""
{ "person" : { "name" : ["John", "Green"] } }
"""
XCTAssertEqual("John", try applyRule(rule, to: data))
}
fixed to parsing rule array with index like "payload.r.0.fr"