+2
-42
@@ -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 |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"cnbuilder.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"sources":["./dist/cnbuilder.js"],"names":["global","factory","exports","module","define","amd","self","cnbuilder","this","arrayReducer","result","item","type","Array","isArray","tmp","length","reduce","i","hasOwnProperty","args"],"mappings":"CAAC,SAAUA,EAAQC,GACE,iBAAZC,SAA0C,oBAAXC,OAAyBA,OAAOD,QAAUD,IAC9D,mBAAXG,QAAyBA,OAAOC,IAAMD,OAAOH,IACnDD,EAASA,GAAUM,MAAaC,UAAYN,IAH/C,CAIEO,KAAM,WAAc,aASpB,MAAMC,EAAe,CAACC,EAAQC,KAC1B,IAAIC,SAAcD,EAClB,GAAa,WAATC,EACA,OAAOD,EAAOD,GAAUA,GAAU,KAAOC,EAAOD,EAEpD,GAAIG,MAAMC,QAAQH,GAAO,CACrB,IAAII,EAAMJ,EAAKK,OACTL,EAAKK,OAAS,EACVL,EAAKM,OAAOR,EAAc,IAC1BA,EAAa,GAAIE,EAAK,IAC1B,GACN,OAAOI,EAAML,GAAUA,GAAU,KAAOK,EAAML,EAElD,GAAa,WAATE,GAAqBD,EAAM,CAC3B,IAAII,EAAM,GACV,IAAK,IAAIG,KAAKP,EACNA,EAAKO,IAAMP,EAAKQ,eAAeD,KAC/BH,IAAQA,GAAO,KAAOG,GAG9B,OAAOH,EAAML,GAAUA,GAAU,KAAOK,EAAML,EAElD,OAAOA,GAGX,OAhCA,YAAgBU,GACZ,OAASA,EAAKJ,OACRI,EAAKJ,OAAS,EACVI,EAAKH,OAAOR,EAAc,IAC1BA,EAAa,GAAIW,EAAK,IAC1B","sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.cnbuilder = factory());\n}(this, function () { 'use strict';\n\n function cnb(...args) {\r\n return ((args.length\r\n ? args.length > 1\r\n ? args.reduce(arrayReducer, \"\")\r\n : arrayReducer(\"\", args[0])\r\n : \"\"));\r\n }\r\n const arrayReducer = (result, item) => {\r\n let type = typeof item;\r\n if (type === \"string\") {\r\n return item ? result + (result && \" \") + item : result;\r\n }\r\n if (Array.isArray(item)) {\r\n let tmp = item.length\r\n ? item.length > 1\r\n ? item.reduce(arrayReducer, \"\")\r\n : arrayReducer(\"\", item[0])\r\n : \"\";\r\n return tmp ? result + (result && \" \") + tmp : result;\r\n }\r\n if (type === \"object\" && item) {\r\n let tmp = \"\";\r\n for (let i in item) {\r\n if (item[i] && item.hasOwnProperty(i)) {\r\n tmp += (tmp && \" \") + i;\r\n }\r\n }\r\n return tmp ? result + (result && \" \") + tmp : result;\r\n }\r\n return result;\r\n };\n\n return cnb;\n\n}));\n//# sourceMappingURL=cnbuilder.js.map\n"]} |
+5
-2
| { | ||
| "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", |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
13781
13.01%42
-46.15%1
Infinity%