Sha256: d7170b45e3faf26da2fcb2b4a2fac19af142b44d2ec5ae7760700896749a5886
Contents?: true
Size: 461 Bytes
Versions: 69
Compression:
Stored size: 461 Bytes
Contents
'use strict'; module.exports = string => { if (typeof string !== 'string') { throw new TypeError('Expected a string'); } // Escape characters with special meaning either inside or outside character sets. // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. return string .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') .replace(/-/g, '\\x2d'); };
Version data entries
69 entries across 69 versions & 4 rubygems