Comparing version 0.0.0 to 0.0.1
@@ -6,5 +6,10 @@ 'use strict'; | ||
}); | ||
var cache = {}; | ||
var getClassReg = function getClassReg(name) { | ||
var sReg = '(?:^|\\s+)' + name + '(?:\\s+|$)'; | ||
return sReg; | ||
if (!cache[name]) { | ||
var sReg = '(?:^|\\s+)' + name + '(?:\\s+|$)'; | ||
cache[name] = new RegExp(sReg); | ||
} | ||
return cache[name]; | ||
}; | ||
@@ -11,0 +16,0 @@ |
@@ -14,5 +14,3 @@ 'use strict'; | ||
var hasClass = function hasClass(classes, name) { | ||
var sReg = (0, _getClassReg2.default)(name); | ||
var oReg = new RegExp(sReg); | ||
return oReg.test(classes); | ||
return (0, _getClassReg2.default)(name).test(classes); | ||
}; | ||
@@ -19,0 +17,0 @@ |
@@ -19,4 +19,3 @@ 'use strict'; | ||
if (classes && (0, _hasClass2.default)(classes, name)) { | ||
var sReg = (0, _getClassReg2.default)(name); | ||
classes = classes.replace(sReg, ' ').replace(/(^\s+)|\s+$/g, ''); | ||
classes = classes.replace((0, _getClassReg2.default)(name), ' ').replace(/(^\s+)|\s+$/g, ''); | ||
if ((0, _hasClass2.default)(classes, name)) { | ||
@@ -23,0 +22,0 @@ // in case of multiple adjacent |
{ | ||
"name": "class-lib", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "ClassName Library", | ||
@@ -5,0 +5,0 @@ "repository": "react-atomic/react-atomic-organism", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5252
108