You can similarly search/replace JS code, but using pattern matching and CSS style selectors instead of writing code, with Grasp. It's usable from the command line like sed.
For instance changing all calls to "calc" from taking two arguments to taking one object literal instead (eg. `calc(1, 2)` to `calc({from: 1, to: 2})`, is as easy as:
Yes, this is great! I'd love to be able to integrate graspjs with jscodeshift somehow. Ideally there would be multiple possible ways to find the nodes you want to change (pattern matching, tree traversal, etc), and multiple ways to specify how to replace them (e.g. a template like in your example vs a function where you can do anything you want).
Simple transforms should definitely be possible with little "code" like in your example and we certainly have to improve jscodeshift in this regard.
I spent some time with Self in the late 90s (at college of course!) and it was impressive on several counts: first, it's JIT compiler allowed Smalltalk to run faster when implemented in Self than without - the same JIT technique was later re-used in Java Hotspots [1]; second, the programming environment was a multi-user environment called Kansas that allowed a whole classroom of students to develop "prototypes" in the same environment (Kansas [2] [3])
Except for the part where what Self calls prototype has no equivalent in javascript (constructors are close to Self's `copy` message, but not quite the same) and what javascript calls prototype Self calls mixin (or traits, depending whether they've got ancestors up to the lobby themselves). And a Self object can have multiple mixins and add or remove them at runtime.
The "JavaScript is like Self" fallacy is just another variant of the "JavaScript is like Scheme" fallacy. It sounds great to the person claiming it, and to an unsuspecting audience. But on closer inspection, the similarities between the two languages are minimal at best.
Newtonscript was also a descendent. Although I like Objective-C, I do miss Newtonscript and the soup. Prototype-based programming often had a nicer feel than [edit]class[/edit] systems.
Cool project! As monjaro mentions, the two examples are not equivalent however - the grasp example replaces every binary expression (alias: bi) with an addition operation with the right and left hand sides switched. This is a very trivial example, but hints at the great power available.
Grasp has two different query types, the default, squery - selector query, CSS style selectors, and equery (-e, --equery) - example query, JS code examples with wildcards.
In the grasp example above, we are using squery. jsgrep is similar to equery. You could do the following search in equery, and it would be more equivalent to the example you posted:
f(__ < __, __ == __)
The only thing missing is the named wildcards for easy replace - that's a good idea and a feature to add to grasp 0.2.0!