lib/resource-handler-spec.js
function extractSetterFromNode( handler, node ) {

	assignSetterFnForNode( handler, node );

	if ( node.children ) {
		// Recurse down to this node's children
		Object.keys( node.children ).forEach( ( key ) => {
			extractSetterFromNode( handler, node.children[ key ] );
		} );
	}
}
function extractSetterFromNode( handler, node ) {

	assignSetterFnForNode( handler, node );

	if ( node.children ) {
		// Recurse down to this node's children
		Object.keys( node.children ).forEach( ( key ) => {
			extractSetterFromNode( handler, node.children[ key ] );
		} );
	}
}
function extractSetterFromNode ( handler , node ) { assignSetterFnForNode ( handler , node ) ; if ( node . children ) { // Recurse down to this node's children Object . keys ( node . children ) . forEach ( ( key ) => { extractSetterFromNode ( handler , node . children [ key ] ) ; } ) ; } }
Walk the tree of a specific resource node to create the setter methods

The API we want to produce from the node tree looks like this:

wp.posts();                        /wp/v2/posts
wp.posts().id( 7 );                /wp/v2/posts/7
wp.posts().id( 7 ).revisions();    /wp/v2/posts/7/revisions
wp.posts().id( 7 ).revisions( 8 ); /wp/v2/posts/7/revisions/8

^ That last one's the tricky one: we can deduce that this parameter is "id", but
that param will already be taken by the post ID, so sub-collections have to be
set up as `.revisions()` to get the collection, and `.revisions( id )` to get a
specific resource.

@private
@param  {Object} node            A node object
@param  {Object} [node.children] An object of child nodes
// @returns {isLeaf} A boolean indicating whether the processed node is a leaf
Walk the tree of a specific resource node to create the setter methods