Repository URL to install this package:
|
Version:
1.2.16 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = escape;
const escapeRegex = /[[\].#*$><+~=|^:(),"'`-]+/g;
const dashesAtEnds = /(^-|-$)/g;
/**
* TODO: Explore using CSS.escape when it becomes more available
* in evergreen browsers.
*/
function escape(str) {
return str // Replace all possible CSS selectors
.replace(escapeRegex, '-') // Remove extraneous hyphens at the start and end
.replace(dashesAtEnds, '');
}