Add ability to do a deep lookup into a JSON tree#1
Add ability to do a deep lookup into a JSON tree#1NathanAhlstrom wants to merge 5 commits intokushalpandya:masterfrom
Conversation
…eckRequest), using underscore + custom lookup function to do deep JSON lookups - necessary to run matches on project.name = 'repoName'; correctly handle non-POST request by exiting silently.
kushalpandya
left a comment
There was a problem hiding this comment.
Thanks for working on this @NathanAhlstrom, I forgot that I had this project lying around and that it could be cleaned up/improved further. 😄
For now, I've suggested some changes, while you update your PR, I'll also check out the branch locally as this app is due for some major revision. 🙂
| * execute permission on the command line scripts. | ||
| */ | ||
| fnValidateConfig = function(sH) { | ||
| for (var i = 0; i < sH.length; i++) { |
There was a problem hiding this comment.
I know this file for the most part is ES5 code, but we can change this loop to sH.forEach and then also use template strings within _.lookup for cleaner string concatenation. What do you think? 🙂
| return false; | ||
| } | ||
|
|
||
| if ( token === secretKey ) { |
There was a problem hiding this comment.
We can just do return token === secretKey; here and get rid of entire condition block.
| fs.constants.F_OK | fs.constants.R_OK | | ||
| fs.constants.X_OK); | ||
| } catch (e) { | ||
| console.log("Missing file or execute permissions on file: " + file); |
There was a problem hiding this comment.
Using console.error would be appropriate here.
needed for our environment the ability to do a deep lookup into a JSON object, so I've added some bits from lookup.js into this node application. Thanks for building this tool.