judocss
Version:
The functional CSS toolkit designed for minimal effort and maximum efficiency.
31 lines (21 loc) • 887 B
JavaScript
;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
(function () {
function apply(className, entry) {
var type = _typeof(entry.value);
var res = "";
if (type === "string") {
res = entry.value;
}
if (type === "function") {
var args = entry.regex.exec(className).splice(1);
res = entry.value.apply(undefined, args);
}
var childSelector = /(.+)(?:\*)$/.exec(className);
if (childSelector) {
className = childSelector[1] + "\\* > *";
}
return ['.', className.replace(/[%#.]/g, "\\$&"), ' ', res].join('');
}
module.exports = apply;
})();