UNPKG

putout

Version:

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

20 lines (14 loc) 367 B
'use strict'; const {codeFrameColumns} = require('@putout/babel'); module.exports = ({source, error, highlightCode = true}) => { const {message, loc} = error; if (!loc) return message; const location = { start: loc, }; return codeFrameColumns(source, location, { highlightCode, message, }); };