UNPKG

@thinql/parse

Version:
15 lines (11 loc) 368 B
import jju from 'jju/index.js' import unquotedString from '../tokens/unquotedString.js' const unquotedStringRegExp = new RegExp(`^${unquotedString.match.source}$`) const stringify = (content, literal = false) => { if (!literal && unquotedStringRegExp.test(content)) { return content } else { return jju.stringify(content) } } export default stringify