lib/actions/toggle-block-comment.js
function commentsInRange(model, range) {
	const intersects = token => getRange(token).intersectsWith(range, true);

	if (model.type === 'html') {
		// in html model, comments are nodes in model
		return iterate(model.dom, node => node.type === 'comment' && intersects(node));
	}

	if (model.type === 'stylesheet') {
		// in stylesheet model, comments are stored as separate tokens, they
		// can’t be a part of model since they might be a part of selector or
		// property value
		return model.dom.comments.filter(intersects);
	}

	return [];
}
function commentsInRange(model, range) {
	const intersects = token => getRange(token).intersectsWith(range, true);

	if (model.type === 'html') {
		// in html model, comments are nodes in model
		return iterate(model.dom, node => node.type === 'comment' && intersects(node));
	}

	if (model.type === 'stylesheet') {
		// in stylesheet model, comments are stored as separate tokens, they
		// can’t be a part of model since they might be a part of selector or
		// property value
		return model.dom.comments.filter(intersects);
	}

	return [];
}
function commentsInRange ( model , range ) { const intersects = token => getRange ( token ) . intersectsWith ( range , true ) ; if ( model . type === 'html' ) { // in html model, comments are nodes in model return iterate ( model . dom , node => node . type === 'comment' && intersects ( node ) ) ; } if ( model . type === 'stylesheet' ) { // in stylesheet model, comments are stored as separate tokens, they // can’t be a part of model since they might be a part of selector or // property value return model . dom . comments . filter ( intersects ) ; } return [ ] ; }
Finds all comment ranges that matches given range
@param  {SyntaxModel} model
@param  {Range}       range
@return {Range[]}
Finds all comment ranges that matches given range