All files / dynamic-class-list/lib get-class-names.js

93.94% Statements 31/33
75.76% Branches 25/33
90.91% Functions 10/11
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

139x
"use strict";function _typeof(obj){"@babel/helpers - typeof";Eif(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function isBadValue(obj){return obj===null||typeof obj==="undefined"||obj===undefined}function handleFunction(fn,key,classList){var result=false;try{result=fn();if(result){classList.push(key.trim())}}catch(e){}}function handleObject(objArg,classList){Object.keys(objArg).forEach(function(fieldName){if(typeof objArg[fieldName]==="function"){handleFunction(objArg[fieldName],fieldName,classList)}else if(objArg[fieldName]){classList.push(fieldName)}})}function handleArray(params,classList){params.forEach(function(param){var res=getClassNames(param);if(res.trim()){classList.push(res)}})}function getClassNames(){var classList=[];var parameters=Array.prototype.slice.call(arguments);parameters.forEach(function(param){if(!isBadValue(param)){if(typeof param==="number"||typeof param==="string"){classList.push(String(param).trim())}else if(Array.isArray(param)){handleArray(param,classList)}else Eif(_typeof(param)==="object"){handleObject(param,classList)}}});return classList.length>0?classList.join(" ").trim():""}module.exports={getClassNames:getClassNames,classList:getClassNames};