UNPKG

putout

Version:

🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json

18 lines (13 loc) 355 B
import {codeFrameColumns} from '@putout/babel'; export const codeframe = ({source, error, highlightCode = true}) => { const {message, loc} = error; if (!loc) return message; const location = { start: loc, }; return codeFrameColumns(source, location, { highlightCode, message, }); };