Repository URL to install this package:
|
Version:
1.2.9 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// @flow
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, ''));
}
exports.default = escape;
//# sourceMappingURL=escape.js.map