Front end of the Slack clone application.

escape.js 255B

123456789101112
  1. // Thanks to Andrew Clover:
  2. // http://stackoverflow.com/questions/3561493
  3. // /is-there-a-regexp-escape-function-in-javascript
  4. "use strict";
  5. var re = /[-/\\^$*+?.()|[\]{}]/g;
  6. module.exports = function (str) {
  7. return String(str).replace(re, "\\$&");
  8. };