code: function nodeForPoint(model, point, direction) {
  	const node = model.nodeForPoint(point);
  
  	if (node) {
  		return node;
  	}
  
  	// Looks like caret is outside of any top-level node.
  	const topLevelNodes = model.dom.children;
  
  	if (direction === 'next') {
  		// Find next node, which is closest top-level to given position
  		return topLevelNodes.find(node => node.start.isGreaterThanOrEqual(point));
  	}
  
  	// Find previous node, which is deepest child of closest previous node
  	for (let i = topLevelNodes.length - 1; i >= 0; i--) {
  		if (topLevelNodes[i].end.isLessThanOrEqual(point)) {
  			return deepestChild(topLevelNodes[i]);
  		}
  	}
  }
docs: Returns best matching node for given position. If on direct position match,
  tries to find closest one on givrn direction
  @param  {SyntaxModel} model
  @param  {Point} point
  @param  {String} direction 'next' or 'previous'
  @return {Node}