Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 3x 3x 3x 1x 2x 2x 2x 2x 2x 1x 5x 3x 1x 1x 2x 1x 1x | import sqlFormatter from 'sql-formatter' import formatHtml from 'pretty' import beautify from 'js-beautify' const parse = value => value const stringify = value => (value ?? '').toString() export const editorTypes = { sql: { mode: 'text/x-sql', format: value => sqlFormatter.format(value), parse, stringify }, json: { mode: 'application/json', format: value => { try { Eif (typeof value === 'string') { return JSON.stringify(JSON.parse(value), null, 2) } return JSON.stringify(value, null, 2) } catch { return value } }, parse: value => { try { Eif (typeof value === 'string') return JSON.parse(value) } catch { return value } }, stringify: value => { if (value) { if (typeof value === 'string') return value try { return JSON.stringify(value, null, 2) } catch { return value } } return '' } }, html: { mode: 'text/html', format: value => formatHtml(value), parse, stringify }, javascript: { mode: 'javascript', format: value => beautify(value, { indent_size: 2, space_in_empty_paren: true }), parse, stringify } } |