You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
512 B

  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var CSS = global.CSS;
  6. var env = process.env.NODE_ENV;
  7. var escapeRegex = /([[\].#*$><+~=|^:(),"'`])/g;
  8. exports['default'] = function (str) {
  9. // We don't need to escape it in production, because we are not using user's
  10. // input for selectors, we are generating a valid selector.
  11. if (env === 'production') return str;
  12. if (!CSS || !CSS.escape) {
  13. return str.replace(escapeRegex, '\\$1');
  14. }
  15. return CSS.escape(str);
  16. };