kazaam
kazaam copied to clipboard
Feature Request - Reverse-indexing of arrays
First of all, I would like to thank everyone for contributing to this project, it's really great and works very well. 👍
Feature :
Currently, we can access the first element of an array of JSON objects with indexing.
The first element of an array: array[0]
Nth element of an array: array[n]
Can we please add a feature to do reverse indexing of the array? This would be very useful when one would be aware of the length of an array.
Or access the last element of an array with index -1
.
I would like to take up this task if it can be accepted.
Hi @jnanasagar, thank you for this! We would support this functionality but it is not in our current scope, so if you want to take it on please do!
Currently we retrieve elements from array with the underlying qntfy/jsonparser
as seen here so you would want to add this functionality there and then make sure kazaam could pick up the new version (I can take care of that part for you). I believe the underlying code you'd want to update is here and we would also need a few new test cases to cover this in jsonparser
. If you want to submit the MR to qntfy/jsonparser
and tag me I'm happy to review.
Thank you!!
Hi Josh,
That's great of you. I will go ahead and create a branch and get started.
Thanks a lot.
-Jnana.
On Tue, Jun 26, 2018 at 11:13 PM JoshKCarroll [email protected] wrote:
Hi @jnanasagar https://github.com/jnanasagar, thank you for this! We would support this functionality but it is not in our current scope, so if you want to take it on please do!
Currently we retrieve elements from array with the underlying qntfy/jsonparser as seen here https://github.com/qntfy/kazaam/blob/master/transform/util.go#L118 so you would want to add this functionality there and then make sure kazaam could pick up the new version (I can take care of that part for you). I believe the underlying code you'd want to update is here https://github.com/qntfy/jsonparser/blob/master/parser.go#L283-L304 and we would also need a few new test cases to cover this in jsonparser. If you want to submit the MR to qntfy/jsonparser and tag me I'm happy to review.
Thank you!!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qntfy/kazaam/issues/79#issuecomment-400402818, or mute the thread https://github.com/notifications/unsubscribe-auth/AECseLFoUDuTRG_BuFTBZkTMJPkTa9NTks5uAnLBgaJpZM4U04I2 .