function createCursorWithPadding(
	tokens,
	comments,
	indexMap,
	startLoc,
	endLoc,
	beforeCount,
	afterCount,
) {
	if (
		typeof beforeCount === "undefined" &&
		typeof afterCount === "undefined"
	) {
		return new ForwardTokenCursor(
			tokens,
			comments,
			indexMap,
			startLoc,
			endLoc,
		);
	}
	if (typeof beforeCount === "number" || typeof beforeCount === "undefined") {
		return new PaddedTokenCursor(
			tokens,
			comments,
			indexMap,
			startLoc,
			endLoc,
			beforeCount | 0,
			afterCount | 0,
		);
	}
	return createCursorWithCount(
		cursors.forward,
		tokens,
		comments,
		indexMap,
		startLoc,
		endLoc,
		beforeCount,
	);
}
Creates the cursor iterates tokens with options.
@param {Token[]} tokens The array of tokens.
@param {Comment[]} comments The array of comments.
@param {Object} indexMap The map from locations to indices in `tokens`.
@param {number} startLoc The start location of the iteration range.
@param {number} endLoc The end location of the iteration range.
@param {number} [beforeCount=0] The number of tokens before the node to retrieve.
@param {boolean} [afterCount=0] The number of tokens after the node to retrieve.
@returns {Cursor} The created cursor.
@private