Comparing version 1.0.3 to 1.0.4
@@ -1,42 +0,2 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = global || self, global.cnbuilder = factory()); | ||
}(this, function () { 'use strict'; | ||
function cnb(...args) { | ||
return ((args.length | ||
? args.length > 1 | ||
? args.reduce(arrayReducer, "") | ||
: arrayReducer("", args[0]) | ||
: "")); | ||
} | ||
const arrayReducer = (result, item) => { | ||
let type = typeof item; | ||
if (type === "string") { | ||
return item ? result + (result && " ") + item : result; | ||
} | ||
if (Array.isArray(item)) { | ||
let tmp = item.length | ||
? item.length > 1 | ||
? item.reduce(arrayReducer, "") | ||
: arrayReducer("", item[0]) | ||
: ""; | ||
return tmp ? result + (result && " ") + tmp : result; | ||
} | ||
if (type === "object" && item) { | ||
let tmp = ""; | ||
for (let i in item) { | ||
if (item[i] && item.hasOwnProperty(i)) { | ||
tmp += (tmp && " ") + i; | ||
} | ||
} | ||
return tmp ? result + (result && " ") + tmp : result; | ||
} | ||
return result; | ||
}; | ||
return cnb; | ||
})); | ||
//# sourceMappingURL=cnbuilder.js.map | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).cnbuilder=t()}(this,function(){"use strict";const e=(t,n)=>{let r=typeof n;if("string"===r)return n?t+(t&&" ")+n:t;if(Array.isArray(n)){let r=n.length?n.length>1?n.reduce(e,""):e("",n[0]):"";return r?t+(t&&" ")+r:t}if("object"===r&&n){let e="";for(let t in n)n[t]&&n.hasOwnProperty(t)&&(e+=(e&&" ")+t);return e?t+(t&&" ")+e:t}return t};return function(...t){return t.length?t.length>1?t.reduce(e,""):e("",t[0]):""}}); | ||
//# sourceMappingURL=cnbuilder.js.map |
{ | ||
"name": "cnbuilder", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/cnbuilder.js", | ||
@@ -8,2 +8,5 @@ "module": "dist/cnbuilder.esm.js", | ||
"description": "Yet another classname string builder", | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
@@ -46,3 +49,3 @@ "classname", | ||
"format": "prettier --write src/**/*.ts tests/**/*.ts benchmark/src/**/*.ts", | ||
"build": "rimraf ./dist && rollup --config", | ||
"build": "rimraf ./dist && rollup --config && npm run minify", | ||
"minify": "terser ./dist/cnbuilder.js -o ./dist/cnbuilder.js -mc pure_funcs=['Object.defineProperty'] --source-map includeSources,url=cnbuilder.js.map", | ||
@@ -49,0 +52,0 @@ "test": "jest", |
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
13781
42