@daysnap/utils 0.0.35 → 0.0.37
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/docs/modules.md +273 -56
- package/es/filterCRLF.d.ts +4 -0
- package/es/filterCRLF.js +6 -0
- package/es/getBlobByUrl.js +1 -0
- package/es/getRandomColor.d.ts +4 -0
- package/es/getRandomColor.js +6 -0
- package/es/index.d.ts +9 -0
- package/es/index.js +10 -1
- package/es/isArray.d.ts +6 -0
- package/es/isArray.js +8 -0
- package/es/isWeixin.d.ts +4 -0
- package/es/isWeixin.js +6 -0
- package/es/loadResource.d.ts +7 -0
- package/es/loadResource.js +31 -0
- package/es/padding.d.ts +7 -0
- package/es/padding.js +11 -0
- package/es/parseObject.d.ts +4 -0
- package/es/parseObject.js +12 -0
- package/es/stringTrim.d.ts +4 -0
- package/es/stringTrim.js +21 -0
- package/es/typeOf.d.ts +6 -0
- package/es/typeOf.js +8 -0
- package/lib/filterCRLF.d.ts +4 -0
- package/lib/filterCRLF.js +12 -0
- package/lib/getBlobByUrl.js +1 -0
- package/lib/getRandomColor.d.ts +4 -0
- package/lib/getRandomColor.js +12 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +99 -0
- package/lib/isArray.d.ts +6 -0
- package/lib/isArray.js +14 -0
- package/lib/isWeixin.d.ts +4 -0
- package/lib/isWeixin.js +12 -0
- package/lib/loadResource.d.ts +7 -0
- package/lib/loadResource.js +37 -0
- package/lib/padding.d.ts +7 -0
- package/lib/padding.js +17 -0
- package/lib/parseObject.d.ts +4 -0
- package/lib/parseObject.js +18 -0
- package/lib/stringTrim.d.ts +4 -0
- package/lib/stringTrim.js +27 -0
- package/lib/typeOf.d.ts +6 -0
- package/lib/typeOf.js +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stringTrim = stringTrim;
|
|
7
|
+
/**
|
|
8
|
+
*去除字符串空格
|
|
9
|
+
*/
|
|
10
|
+
function stringTrim(str, type) {
|
|
11
|
+
var _type;
|
|
12
|
+
// 1-所有空格,2-前后空格,3-前空格,4-后空格
|
|
13
|
+
// eslint-disable-next-line no-param-reassign
|
|
14
|
+
type = (_type = type) !== null && _type !== void 0 ? _type : 1;
|
|
15
|
+
switch (type) {
|
|
16
|
+
case 1:
|
|
17
|
+
return str.replace(/\s+/g, '');
|
|
18
|
+
case 2:
|
|
19
|
+
return str.replace(/(^\s*)|(\s*$)/g, '');
|
|
20
|
+
case 3:
|
|
21
|
+
return str.replace(/(^\s*)/g, '');
|
|
22
|
+
case 4:
|
|
23
|
+
return str.replace(/(\s*$)/g, '');
|
|
24
|
+
default:
|
|
25
|
+
return str;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/lib/typeOf.d.ts
ADDED
package/lib/typeOf.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.typeOf = typeOf;
|
|
7
|
+
/**
|
|
8
|
+
* 判断类型
|
|
9
|
+
* @param val 待判断数据
|
|
10
|
+
* @returns 'undefined'|'null'|'boolean'|'string'|'number'|'object'|'array'|'function'|'symbol'|'map'|'weakmap'|'bigint'|'regexp'|'date'
|
|
11
|
+
*/
|
|
12
|
+
function typeOf(val) {
|
|
13
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase();
|
|
14
|
+
}
|