xcn 0.1.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/xcn) [?logo=github>)](https://github.com/earthnutDev/xcn/issues)
|
|
4
4
|
|
|
5
|
-
xcn = mix + class name
|
|
6
|
-
|
|
7
|
-
组装 html 元素的 class 属性值.
|
|
5
|
+
`xcn = mix + class name` 组装 html 元素的 class 属性值,`xcn` 仅是 `mix-cn` 的缩写。
|
|
8
6
|
|
|
9
7
|
## 安装
|
|
10
8
|
|
|
11
9
|
```sh
|
|
12
10
|
npm install --save xcn@latest
|
|
11
|
+
# 或者
|
|
12
|
+
npm install --save mix-cn@latest
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## 使用
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=require("a-type-of-js");exports.xcn=function
|
|
1
|
+
"use strict";var i=require("a-type-of-js");exports.xcn=function r(...e){const t=[],n=i=>i.trim().replace(/undefined/g," ").replace(/\s+/g," ").split(" ").sort().join(" "),s=r=>{if(i.isUndefined(r)||!i.isString(r))return;const e=n(r).split(" ");e.length&&t.push(...e)};return e.forEach(e=>{if(e&&!i.isTrue(e))if(i.isArray(e))e.forEach(i=>s(r(i)));else if(i.isString(e)||i.isNumber(e))s(e.toString());else if(i.isFunction(e)){const t=e();i.isString(t)?s(t):t.forEach(i=>s(r(i)))}else for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){!0===e[i]&&s(i)}}),n(Array.from(new Set(t)).filter(Boolean).join(" "))??void 0};
|
package/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isTrue as e,isArray as
|
|
1
|
+
import{isTrue as e,isArray as o,isString as r,isNumber as t,isFunction as i,isUndefined as n}from"a-type-of-js";function f(...s){const c=[],l=e=>e.trim().replace(/undefined/g," ").replace(/\s+/g," ").split(" ").sort().join(" "),p=e=>{if(n(e)||!r(e))return;const o=l(e).split(" ");o.length&&c.push(...o)};s.forEach(n=>{if(n&&!e(n))if(o(n))n.forEach(e=>p(f(e)));else if(r(n)||t(n))p(n.toString());else if(i(n)){const e=n();r(e)?p(e):e.forEach(e=>p(f(e)))}else for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){!0===n[e]&&p(e)}});return l(Array.from(new Set(c)).filter(Boolean).join(" "))??void 0}export{f as xcn};
|