@shelf/is-string-in-quotes
Version:
Check if string is inside quotation marks (22 styles)
14 lines (12 loc) • 636 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isStringInQuotes = isStringInQuotes;
exports.regexps = void 0;
// @see https://en.wikipedia.org/wiki/Quotation_mark#Summary_table
const regexps = [/^'.*'$/, /^".*"$/, /^,.*‘$/, /^“.*”$/, /^«.*»$/, /^„.*“$/, /^».*«$/, /^».*»$/, /^”.*“$/, /^‘.*’$/, /^’.*‘$/, /^’.*’$/, /^‚.*‘$/, /^‚.*’$/, /^”.*”$/, /^„.*”$/, /^‹.*›$/, /^›.*‹$/, /^〈.*〉$/, /^《.*》$/, /^「.*」$/, /^『.*』$/];
exports.regexps = regexps;
function isStringInQuotes(str = '') {
return regexps.some(r => r.test(str));
}