xcn 1.1.1 → 1.1.2

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 CHANGED
@@ -23,7 +23,3 @@ import { xcn } from 'xcn';
23
23
 
24
24
  'a b d'
25
25
  ```
26
-
27
- ## 文档地址
28
-
29
- 参看 [https://earthnut.dev/npm/xcn/](https://earthnut.dev/npm/xcn/)
package/cjs/index.js CHANGED
@@ -5,11 +5,39 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var aTypeOfJs = require('a-type-of-js');
6
6
 
7
7
  /**
8
+ * 以空格为分隔符拼接字符串
9
+ * @param classNameList 待拼接的字符串
10
+ * @return string 拼接后的字符串
11
+ * @example
12
+ * ```ts
13
+ * import { xcn } from 'xcn';
8
14
  *
9
- * 合并 class
15
+ * // 以纯字符串为参数
16
+ * // 'a b c'
17
+ * xcn('a', 'b', 'c');
10
18
  *
11
- * merge class name
19
+ * // 剔除多余的空格
20
+ * // 'a b c'
21
+ * xcn('a ', ' b ', 'c ');
12
22
  *
23
+ * // 参数可以是字符串数组
24
+ * // 'a b c d e'
25
+ * xcn(['a', 'b'], ['c', 'd'], 'e');
26
+ *
27
+ * // 参数可为可执行返回值为字符串的或字符串数组的函数
28
+ * // 'a b c d e f g'
29
+ * xcn('a', ' b ', ['c', 'd'] , ()=> 'e', () => ['f', 'g']);
30
+ *
31
+ * // 参数可为简单对象,以键入参,以值为断
32
+ * // 'a b c e g'
33
+ * xcn('a', 'b', {
34
+ * c: true,
35
+ * d: false,
36
+ * e: !0,
37
+ * f: !1,
38
+ * g: 1 > 0
39
+ * });
40
+ * ```
13
41
  */
14
42
  function xcn(...classNameList) {
15
43
  /** 临时 */
package/es/index.js CHANGED
@@ -1,11 +1,39 @@
1
1
  import { isTrue, isArray, isString, isNumber, isFunction, isUndefined } from 'a-type-of-js';
2
2
 
3
3
  /**
4
+ * 以空格为分隔符拼接字符串
5
+ * @param classNameList 待拼接的字符串
6
+ * @return string 拼接后的字符串
7
+ * @example
8
+ * ```ts
9
+ * import { xcn } from 'xcn';
4
10
  *
5
- * 合并 class
11
+ * // 以纯字符串为参数
12
+ * // 'a b c'
13
+ * xcn('a', 'b', 'c');
6
14
  *
7
- * merge class name
15
+ * // 剔除多余的空格
16
+ * // 'a b c'
17
+ * xcn('a ', ' b ', 'c ');
8
18
  *
19
+ * // 参数可以是字符串数组
20
+ * // 'a b c d e'
21
+ * xcn(['a', 'b'], ['c', 'd'], 'e');
22
+ *
23
+ * // 参数可为可执行返回值为字符串的或字符串数组的函数
24
+ * // 'a b c d e f g'
25
+ * xcn('a', ' b ', ['c', 'd'] , ()=> 'e', () => ['f', 'g']);
26
+ *
27
+ * // 参数可为简单对象,以键入参,以值为断
28
+ * // 'a b c e g'
29
+ * xcn('a', 'b', {
30
+ * c: true,
31
+ * d: false,
32
+ * e: !0,
33
+ * f: !1,
34
+ * g: 1 > 0
35
+ * });
36
+ * ```
9
37
  */
10
38
  function xcn(...classNameList) {
11
39
  /** 临时 */
@@ -13,11 +13,39 @@ export type EnTypeofClassNameItem<T> = T extends null | boolean | undefined ? ''
13
13
  */
14
14
  export type EnXcn<T> = T extends [infer U, ...infer V] ? `${U & string} ${EnXcn<V>}` : '';
15
15
  /**
16
+ * 以空格为分隔符拼接字符串
17
+ * @param classNameList 待拼接的字符串
18
+ * @return string 拼接后的字符串
19
+ * @example
20
+ * ```ts
21
+ * import { xcn } from 'xcn';
16
22
  *
17
- * 合并 class
23
+ * // 以纯字符串为参数
24
+ * // 'a b c'
25
+ * xcn('a', 'b', 'c');
18
26
  *
19
- * merge class name
27
+ * // 剔除多余的空格
28
+ * // 'a b c'
29
+ * xcn('a ', ' b ', 'c ');
20
30
  *
31
+ * // 参数可以是字符串数组
32
+ * // 'a b c d e'
33
+ * xcn(['a', 'b'], ['c', 'd'], 'e');
34
+ *
35
+ * // 参数可为可执行返回值为字符串的或字符串数组的函数
36
+ * // 'a b c d e f g'
37
+ * xcn('a', ' b ', ['c', 'd'] , ()=> 'e', () => ['f', 'g']);
38
+ *
39
+ * // 参数可为简单对象,以键入参,以值为断
40
+ * // 'a b c e g'
41
+ * xcn('a', 'b', {
42
+ * c: true,
43
+ * d: false,
44
+ * e: !0,
45
+ * f: !1,
46
+ * g: 1 > 0
47
+ * });
48
+ * ```
21
49
  */
22
50
  export declare function xcn<T extends EnClassNameItem[]>(...classNameList: T): EnXcn<{
23
51
  [K in keyof T]: EnTypeofClassNameItem<T[K]>;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "xcn",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.1.2",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
7
- "types": "es/src/index.d.ts",
7
+ "types": "es/types/src/index.d.ts",
8
8
  "author": {
9
9
  "name": "泥豆君",
10
10
  "email": "Mr.MudBean@outlook.com",
11
- "url": "https://earthnut.dev"
11
+ "url": "https://lmssee.com"
12
12
  },
13
13
  "publishConfig": {
14
14
  "access": "public",
@@ -28,7 +28,7 @@
28
28
  "import": "./es/index.js",
29
29
  "default": "./es/index.js",
30
30
  "require": "./cjs/index.js",
31
- "types": "./es/src/index.d.ts"
31
+ "types": "./es/types/src/index.d.ts"
32
32
  }
33
33
  },
34
34
  "keywords": [
@@ -36,9 +36,9 @@
36
36
  "混合 className",
37
37
  "拼接字符串"
38
38
  ],
39
- "homepage": "https://earthnut.dev/npm/xcn",
39
+ "homepage": "https://lmssee.com/npm/xcn",
40
40
  "dependencies": {
41
- "a-type-of-js": "^2.0.0"
41
+ "a-type-of-js": "^2.0.1"
42
42
  },
43
43
  "bugs": {
44
44
  "url": "https://github.com/MrMudBean/xcn/issues",