UNPKG

pg-query-config

Version:
11 lines (10 loc) 415 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wrap = void 0; const isWrappable = (str) => !/[\!\@\#\$\%\^\&\*\)\(\+\=\.\<\>\{\}\[\]\:\;\'\"\|\~\`\_\-]/.test(str); const wrapToDoubleQuote = (str) => str .split('.') .map((str) => str === '*' ? str : `"${str}"`) .join('.'); const wrap = (str) => isWrappable(str) ? wrapToDoubleQuote(str) : str; exports.wrap = wrap;