@aiot-toolkit/shared-utils 2.0.1-alpha.7 → 2.0.1-alpha.9

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.
@@ -12,5 +12,7 @@ declare class StringUtil {
12
12
  static middleLinetoCame(value: string): string;
13
13
  /** 首字母大写 */
14
14
  static capitalizeFirstLetter([first, ...rest]: string): string;
15
+ /** 逗号分割的字符串转数组 */
16
+ static string2arrayByComma(value?: string): string[];
15
17
  }
16
18
  export default StringUtil;
@@ -20,6 +20,12 @@ class StringUtil {
20
20
  static capitalizeFirstLetter([first, ...rest]) {
21
21
  return [first.toUpperCase(), ...rest].join('');
22
22
  }
23
+ /** 逗号分割的字符串转数组 */
24
+ static string2arrayByComma(value) {
25
+ if (!value)
26
+ return [];
27
+ return value.replace(' ', '').split(',');
28
+ }
23
29
  }
24
30
  exports.default = StringUtil;
25
31
 
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/StringUtil.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAM,UAAU;IACd,6BAA6B;IAC7B,MAAM,CAAC,YAAY,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAC5C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAa;QACnC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IAC/E,CAAC;IAED,YAAY;IACZ,MAAM,CAAC,qBAAqB,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAS;QACnD,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAChD,CAAC;CACF;AACD,kBAAe,UAAU,CAAA","file":"StringUtil.js","sourcesContent":["/**\n * StringUtil\n */\nclass StringUtil {\n /** 使用正则表达式去除开头和结尾的 ' \" ` */\n static removeQuotes(str: string) {\n return str.replace(/^['\"`]+|['\"`]+$/g, '')\n }\n\n /**\n * 中划线文本转为驼峰\n * @param value\n * @returns\n */\n static middleLinetoCame(value: string) {\n return value?.replace(/-([a-z])/g, (_, match: string) => match.toUpperCase())\n }\n\n /** 首字母大写 */\n static capitalizeFirstLetter([first, ...rest]: string) {\n return [first.toUpperCase(), ...rest].join('')\n }\n}\nexport default StringUtil\n"],"sourceRoot":"../../src"}
1
+ {"version":3,"sources":["utils/StringUtil.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAM,UAAU;IACd,6BAA6B;IAC7B,MAAM,CAAC,YAAY,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAC5C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAa;QACnC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IAC/E,CAAC;IAED,YAAY;IACZ,MAAM,CAAC,qBAAqB,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAS;QACnD,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAChD,CAAC;IAED,kBAAkB;IAClB,MAAM,CAAC,mBAAmB,CAAC,KAAc;QACvC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAA;QACrB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1C,CAAC;CACF;AACD,kBAAe,UAAU,CAAA","file":"StringUtil.js","sourcesContent":["/**\n * StringUtil\n */\nclass StringUtil {\n /** 使用正则表达式去除开头和结尾的 ' \" ` */\n static removeQuotes(str: string) {\n return str.replace(/^['\"`]+|['\"`]+$/g, '')\n }\n\n /**\n * 中划线文本转为驼峰\n * @param value\n * @returns\n */\n static middleLinetoCame(value: string) {\n return value?.replace(/-([a-z])/g, (_, match: string) => match.toUpperCase())\n }\n\n /** 首字母大写 */\n static capitalizeFirstLetter([first, ...rest]: string) {\n return [first.toUpperCase(), ...rest].join('')\n }\n\n /** 逗号分割的字符串转数组 */\n static string2arrayByComma(value?: string) {\n if (!value) return []\n return value.replace(' ', '').split(',')\n }\n}\nexport default StringUtil\n"],"sourceRoot":"../../src"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/shared-utils",
3
- "version": "2.0.1-alpha.7",
3
+ "version": "2.0.1-alpha.9",
4
4
  "description": "The common method functions of the aiot-toolkit.",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -29,5 +29,5 @@
29
29
  "devDependencies": {
30
30
  "@types/qrcode-terminal": "^0.12.0"
31
31
  },
32
- "gitHead": "9fbe39dfddc2745c97d472827ff10273ab67b499"
32
+ "gitHead": "d593999b9ca345bce8b3ba40a7d11f6685ac03b5"
33
33
  }