Took a step toward eliminating duplication by reconciling two functions.
Extract EsNode object to be polymorphic.
hasOwnProperty works even if actual captured value is undefined
Extract EsNode class out.