function codeFrame(code, loc, { before = 2, after = 3 } = {}) {
	let line, column;
	if (typeof loc === 'number') {
		let before = code.substring(0, loc).split('\n');
		line = before.length;
		column = before[before.length - 1].length;
	} else {
		({ line, column } = loc);
	}

	return wmrCodeFrame(code, line - 1, column, { before, after, colors: true });
}
Print source code with line numbers and error location pointer.
@param {string} code
@param {{ line: number, column: number } | number} loc A source position, or character offset within `code`.
@param {object} [options]
@param {number} [options.before] Lines to show before error line
@param {number} [options.after] Lines to show after error line