bblfsh / sdk

Babelfish driver SDK
GNU General Public License v3.0
23 stars 27 forks source link

Implement node children iterator #406

Closed dennwc closed 5 years ago

dennwc commented 5 years ago

This issue came up multiple times recently. Some client functions want to list all children nodes exactly one level deep. This code is not a one-liner since it requires the user to check the type of the node and indirect, if necessary. It also requires to flatten arrays for object fields.

Thus, it seems we need to add some helper to expose this functionality to clients. The best way, in my opinion, is to make a new iteration order.

This PR adds a new Children iteration order that does all required checks and indirections.

Also, while here, add documentation for types and methods in the package.

Signed-off-by: Denys Smirnov denys@sourced.tech


This change is Reviewable

dennwc commented 5 years ago

@bzz Friendly ping.

dennwc commented 5 years ago

Merging, since it hits the review deadline of one week. @bzz let me know if you have any comments on this one.

bzz commented 5 years ago

Sorry for somehow letting it slip - this is a great improvement! I was just thinking what would it take to surface it in all the clients..