Comparing version 0.1.3 to 0.1.4
"use strict"; | ||
var _interopRequireWildcard = require("reshow-runtime/helpers/interopRequireWildcard"); | ||
exports.__esModule = true; | ||
exports.getClassReg = void 0; | ||
var _getSafeReg = _interopRequireWildcard(require("get-safe-reg")); | ||
var getRegString = function getRegString(name) { | ||
return "(?:^|\\s+)" + (0, _getSafeReg["default"])(name) + "(?:\\s+|$)"; | ||
}; | ||
var cache = (0, _getSafeReg.cacheReg)({})(getRegString); | ||
var getClassReg = function getClassReg(name) { | ||
return cache(name); | ||
}; | ||
exports.getClassReg = getClassReg; |
@@ -5,5 +5,3 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _getClassReg = require("./getClassReg.js"); | ||
//@ts-check | ||
@@ -19,5 +17,4 @@ | ||
}; | ||
var _default = hasClass; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
"use strict"; | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.toggleClass = exports.removeClass = exports.mixClass = exports.hasClass = void 0; | ||
exports.toggleClass = exports.toTailwindObj = exports.removeClass = exports.mixClass = exports.hasClass = void 0; | ||
var _mixClass = _interopRequireDefault(require("./mixClass.js")); | ||
exports.mixClass = _mixClass["default"]; | ||
var _hasClass = _interopRequireDefault(require("./hasClass.js")); | ||
exports.hasClass = _hasClass["default"]; | ||
var _removeClass = _interopRequireDefault(require("./removeClass.js")); | ||
exports.removeClass = _removeClass["default"]; | ||
var _toggleClass = _interopRequireDefault(require("./toggleClass.js")); | ||
exports.toggleClass = _toggleClass["default"]; | ||
exports.toggleClass = _toggleClass["default"]; | ||
var _toTailwind = require("./toTailwind.js"); | ||
exports.toTailwindObj = _toTailwind.toTailwindObj; |
"use strict"; | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports["default"] = void 0; | ||
var _toConsumableArray2 = _interopRequireDefault(require("reshow-runtime/helpers/toConsumableArray")); | ||
var _reshowConstant = require("reshow-constant"); | ||
var _array = _interopRequireDefault(require("array.dedup")); | ||
var strToArray = function strToArray(maybeString) { | ||
return (maybeString + "").split(" "); | ||
}; | ||
var mixClass = function mixClass() { | ||
var classes = []; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
args.forEach(function (arg) { | ||
@@ -29,5 +21,3 @@ if (!arg) { | ||
} | ||
var argType = typeof arg; | ||
if (argType === _reshowConstant.NUMBER || argType === _reshowConstant.STRING) { | ||
@@ -47,5 +37,4 @@ classes.push.apply(classes, (0, _toConsumableArray2["default"])(strToArray(arg))); | ||
}; | ||
var _default = mixClass; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
"use strict"; | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports["default"] = void 0; | ||
var _getClassReg = require("./getClassReg.js"); | ||
var _hasClass = _interopRequireDefault(require("./hasClass.js")); | ||
//@ts-check | ||
@@ -22,3 +18,2 @@ | ||
classes = classes.replace((0, _getClassReg.getClassReg)(name), " ").replace(/(^\s+)|\s+$/g, ""); | ||
if ((0, _hasClass["default"])(classes, name)) { | ||
@@ -29,8 +24,6 @@ // in case of multiple adjacent | ||
} | ||
return classes; | ||
}; | ||
var _default = removeClass; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
"use strict"; | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports["default"] = void 0; | ||
var _hasClass = _interopRequireDefault(require("./hasClass.js")); | ||
var _removeClass = _interopRequireDefault(require("./removeClass.js")); | ||
var _mixClass = _interopRequireDefault(require("./mixClass.js")); | ||
var toggleClass = function toggleClass(classes, name) { | ||
@@ -20,8 +15,6 @@ if ((0, _hasClass["default"])(classes, name)) { | ||
} | ||
return classes; | ||
}; | ||
var _default = toggleClass; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
{ | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"name": "class-lib", | ||
@@ -12,8 +12,2 @@ "repository": { | ||
"keywords": [], | ||
"main": "./build/cjs/src/index.js", | ||
"module": "./build/es/src/index.mjs", | ||
"exports": { | ||
"require": "./build/cjs/src/index.js", | ||
"import": "./build/es/src/index.mjs" | ||
}, | ||
"author": "Hill <hill@kimo.com>", | ||
@@ -29,15 +23,19 @@ "license": "MIT", | ||
"@babel/cli": "^7.x", | ||
"chai": "*", | ||
"jsdom": "*", | ||
"jsdom-global": "*", | ||
"mocha": "*" | ||
"reshow-unit-dom": "*" | ||
}, | ||
"exports": { | ||
"require": "./build/cjs/src/index.js", | ||
"import": "./build/es/src/index.mjs" | ||
}, | ||
"main": "./build/cjs/src/index.js", | ||
"module": "./build/es/src/index.mjs", | ||
"scripts": { | ||
"clean": "find ./build -name '*.*' | xargs rm -rf", | ||
"clean": "find ./build ./types -name '*.*' | xargs rm -rf", | ||
"build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src --ignore /**/__tests__ --root-mode upward", | ||
"build:es": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs --root-mode upward", | ||
"build:type": "npx -p typescript tsc src/index.js src/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types", | ||
"build:type": "npx -p typescript tsc src/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types", | ||
"build": "npm run clean && npm run build:cjs && npm run build:es && npm run build:type", | ||
"mochaFor": "mocha -r global-jsdom/register", | ||
"mocha": "npm run mochaFor -- 'build/es/**/__tests__/*.mjs'", | ||
"test:report": "npm run build && npm run mochaFor -- --reporter mocha-junit-reporter --reporter-options mochaFile=./test_output/mocha.xml 'build/es/**/__tests__/*.mjs'", | ||
"test": "npm run build && npm run mocha", | ||
@@ -44,0 +42,0 @@ "prepublishOnly": "npm run test" |
@@ -1,1 +0,1 @@ | ||
export function getClassReg(name: any): any; | ||
export function getClassReg(name: any): RegExp; |
@@ -5,1 +5,2 @@ export { default as mixClass } from "./mixClass"; | ||
export { default as toggleClass } from "./toggleClass"; | ||
export { toTailwindObj } from "./toTailwind"; |
export default mixClass; | ||
declare function mixClass(...args: any[]): any; | ||
declare function mixClass(...args: any[]): string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
14676
2
28
336