News for hackers. Stuff that matters.
Re:Jtc – CLI tool to extract, manipulate and transform sourc... by zeroimpl on Wednesday October 09, 2019 @07:58PM (#21209500)
Something like this would do the same, if somebody implemented a tool called jsed:

    jsed '
        Object.fromEntries( 
            $("Directory").map( 
                x => [ 
                    x.name + " has children", 
                    x.children && x.children.length != 0
                ]
            )
        )'  
Interestingly enough there is already a tool called jsed which seems to kind of do this... https://www.npmjs.com/package/jsed

Edit: Note the jQuery part of it is for advanced cases like searching for specific nodes in the tree, then navigating back up to the parent. Basically the cases like "<Work>[-1][children]" from the jtc guide, I would write as: '$("Work").parent().find("children")'

There are no comments on this comment yet.