@haluo/util 2.0.6 → 2.0.7

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.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs.js +89 -0
  3. package/dist/index.d.ts +12 -0
  4. package/dist/index.esm.js +87 -0
  5. package/dist/index.js +36 -50
  6. package/dist/lib-list.d.ts +2 -0
  7. package/dist/modules/cookie/index.d.ts +27 -0
  8. package/dist/modules/cookie/index.js +54 -55
  9. package/dist/modules/date/index.d.ts +1 -0
  10. package/dist/modules/date/index.js +192 -192
  11. package/dist/modules/dom/index.d.ts +1 -0
  12. package/dist/modules/dom/index.js +62 -62
  13. package/dist/modules/filter/index.d.ts +26 -0
  14. package/dist/modules/filter/index.js +57 -48
  15. package/dist/modules/format/index.d.ts +13 -0
  16. package/dist/modules/format/index.js +21 -22
  17. package/dist/modules/match/index.d.ts +1 -0
  18. package/dist/modules/match/index.js +31 -31
  19. package/dist/modules/monitor/index.js +17 -17
  20. package/dist/modules/monitor/lib/jsError.js +61 -53
  21. package/dist/modules/monitor/lib/timing.js +69 -69
  22. package/dist/modules/monitor/lib/xhr.js +50 -48
  23. package/dist/modules/monitor/utils/onload.js +11 -11
  24. package/dist/modules/monitor/utils/tracker.js +84 -63
  25. package/dist/modules/number/index.d.ts +39 -0
  26. package/dist/modules/number/index.js +102 -103
  27. package/dist/modules/sentry/index.d.ts +15 -0
  28. package/dist/modules/sentry/index.js +78 -81
  29. package/dist/modules/tools/index.d.ts +1 -0
  30. package/dist/modules/tools/index.js +393 -393
  31. package/dist/tsconfig.tsbuildinfo +2915 -1
  32. package/dist/types/index.d.ts +3 -24
  33. package/dist/types/index.js +2 -2
  34. package/dist/types/modules/cookie/index.d.ts +25 -27
  35. package/dist/types/modules/date/index.d.ts +1 -52
  36. package/dist/types/modules/dom/index.d.ts +1 -28
  37. package/dist/types/modules/filter/index.d.ts +26 -24
  38. package/dist/types/modules/format/index.d.ts +13 -15
  39. package/dist/types/modules/match/index.d.ts +1 -12
  40. package/dist/types/modules/monitor/index.d.ts +3 -3
  41. package/dist/types/modules/monitor/lib/jsError.d.ts +1 -1
  42. package/dist/types/modules/monitor/lib/timing.d.ts +1 -1
  43. package/dist/types/modules/monitor/lib/xhr.d.ts +1 -1
  44. package/dist/types/modules/monitor/utils/onload.d.ts +1 -1
  45. package/dist/types/modules/monitor/utils/tracker.d.ts +8 -7
  46. package/dist/types/modules/number/index.d.ts +39 -41
  47. package/dist/types/modules/sentry/index.d.ts +15 -15
  48. package/dist/types/modules/tools/index.d.ts +1 -166
  49. package/dist/types/types/index.d.ts +3 -3
  50. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ### @haluo/util
2
2
 
3
- > 哈罗摩托工具库
3
+ > 摩托范工具库
4
4
 
5
5
 
6
6
 
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @file Cookie
5
+ * @Author: wanghui
6
+ * @createBy: @2021.01.21
7
+ */
8
+ var CookieClass = /** @class */ (function () {
9
+ function CookieClass() {
10
+ }
11
+ /**
12
+ * 获取cookie
13
+ * @param {String} name
14
+ * @return {String}
15
+ */
16
+ CookieClass.prototype.getCookie = function (name) {
17
+ var _name = name + '=';
18
+ var ca = document.cookie.split(';');
19
+ for (var i = 0; i < ca.length; i++) {
20
+ var c = ca[i];
21
+ while (c.charAt(0) === ' ')
22
+ c = c.substring(1);
23
+ if (c.includes(_name))
24
+ return c.substring(_name.length, c.length);
25
+ }
26
+ return '';
27
+ };
28
+ /**
29
+ * 设置cookie
30
+ * @param {Object} ICookie
31
+ */
32
+ CookieClass.prototype.setCookie = function (_a) {
33
+ var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c, _d = _a.exdays, exdays = _d === void 0 ? -1 : _d, _e = _a.path, path = _e === void 0 ? '/' : _e, _f = _a.domain, domain = _f === void 0 ? '.jddmoto.com' : _f;
34
+ var d = new Date();
35
+ d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
36
+ var expires = "expires=" + d.toUTCString();
37
+ document.cookie = name + "=" + value + ";" + expires + ";path=" + path + ";domain=" + domain + ";";
38
+ };
39
+ /**
40
+ * 清除Cookie
41
+ * @param {String} name
42
+ */
43
+ CookieClass.prototype.clearCookie = function (name) {
44
+ this.setCookie({
45
+ name: name,
46
+ value: '',
47
+ exdays: -1,
48
+ });
49
+ };
50
+ return CookieClass;
51
+ }());
52
+ var cookie = new CookieClass();
53
+
54
+ /**
55
+ * @Author: wanghui
56
+ * createBy: @2020.05.21
57
+ */
58
+ // import date from './modules/date'
59
+ // import dom from './modules/dom'
60
+ // import filter from './modules/filter'
61
+ // import format from './modules/format'
62
+ // import match from './modules/match'
63
+ // import number from './modules/number'
64
+ // import tools from './modules/tools'
65
+ var modules = {
66
+ cookie: cookie,
67
+ };
68
+ var Utils = /** @class */ (function () {
69
+ function Utils() {
70
+ Object.assign(this, modules);
71
+ }
72
+ /**
73
+ * 挂载各组件
74
+ * 示例:this.$cookie、this.$date、this.$match、this.$number、this.$tools
75
+ * @param {Object} app 需要挂载的目标对象
76
+ */
77
+ Utils.prototype.install = function (app) {
78
+ Object.keys(modules).forEach(function (key) {
79
+ if (key === 'filter') {
80
+ return modules[key].install(app);
81
+ }
82
+ app.config.globalProperties['$' + key] = modules[key];
83
+ });
84
+ };
85
+ return Utils;
86
+ }());
87
+ var utils = new Utils();
88
+
89
+ module.exports = utils;
@@ -0,0 +1,12 @@
1
+ declare class Utils {
2
+ [key: string]: Object;
3
+ constructor();
4
+ /**
5
+ * 挂载各组件
6
+ * 示例:this.$cookie、this.$date、this.$match、this.$number、this.$tools
7
+ * @param {Object} app 需要挂载的目标对象
8
+ */
9
+ install(app: any): void;
10
+ }
11
+ declare const utils: Utils;
12
+ export default utils;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @file Cookie
3
+ * @Author: wanghui
4
+ * @createBy: @2021.01.21
5
+ */
6
+ var CookieClass = /** @class */ (function () {
7
+ function CookieClass() {
8
+ }
9
+ /**
10
+ * 获取cookie
11
+ * @param {String} name
12
+ * @return {String}
13
+ */
14
+ CookieClass.prototype.getCookie = function (name) {
15
+ var _name = name + '=';
16
+ var ca = document.cookie.split(';');
17
+ for (var i = 0; i < ca.length; i++) {
18
+ var c = ca[i];
19
+ while (c.charAt(0) === ' ')
20
+ c = c.substring(1);
21
+ if (c.includes(_name))
22
+ return c.substring(_name.length, c.length);
23
+ }
24
+ return '';
25
+ };
26
+ /**
27
+ * 设置cookie
28
+ * @param {Object} ICookie
29
+ */
30
+ CookieClass.prototype.setCookie = function (_a) {
31
+ var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c, _d = _a.exdays, exdays = _d === void 0 ? -1 : _d, _e = _a.path, path = _e === void 0 ? '/' : _e, _f = _a.domain, domain = _f === void 0 ? '.jddmoto.com' : _f;
32
+ var d = new Date();
33
+ d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
34
+ var expires = "expires=" + d.toUTCString();
35
+ document.cookie = name + "=" + value + ";" + expires + ";path=" + path + ";domain=" + domain + ";";
36
+ };
37
+ /**
38
+ * 清除Cookie
39
+ * @param {String} name
40
+ */
41
+ CookieClass.prototype.clearCookie = function (name) {
42
+ this.setCookie({
43
+ name: name,
44
+ value: '',
45
+ exdays: -1,
46
+ });
47
+ };
48
+ return CookieClass;
49
+ }());
50
+ var cookie = new CookieClass();
51
+
52
+ /**
53
+ * @Author: wanghui
54
+ * createBy: @2020.05.21
55
+ */
56
+ // import date from './modules/date'
57
+ // import dom from './modules/dom'
58
+ // import filter from './modules/filter'
59
+ // import format from './modules/format'
60
+ // import match from './modules/match'
61
+ // import number from './modules/number'
62
+ // import tools from './modules/tools'
63
+ var modules = {
64
+ cookie: cookie,
65
+ };
66
+ var Utils = /** @class */ (function () {
67
+ function Utils() {
68
+ Object.assign(this, modules);
69
+ }
70
+ /**
71
+ * 挂载各组件
72
+ * 示例:this.$cookie、this.$date、this.$match、this.$number、this.$tools
73
+ * @param {Object} app 需要挂载的目标对象
74
+ */
75
+ Utils.prototype.install = function (app) {
76
+ Object.keys(modules).forEach(function (key) {
77
+ if (key === 'filter') {
78
+ return modules[key].install(app);
79
+ }
80
+ app.config.globalProperties['$' + key] = modules[key];
81
+ });
82
+ };
83
+ return Utils;
84
+ }());
85
+ var utils = new Utils();
86
+
87
+ export { utils as default };
package/dist/index.js CHANGED
@@ -1,50 +1,36 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.tools = exports.number = exports.match = exports.format = exports.filter = exports.dom = exports.date = exports.cookie = void 0;
7
- var cookie_1 = __importDefault(require("./modules/cookie"));
8
- exports.cookie = cookie_1.default;
9
- var date_1 = __importDefault(require("./modules/date"));
10
- exports.date = date_1.default;
11
- var dom_1 = __importDefault(require("./modules/dom"));
12
- exports.dom = dom_1.default;
13
- var filter_1 = __importDefault(require("./modules/filter"));
14
- exports.filter = filter_1.default;
15
- var format_1 = __importDefault(require("./modules/format"));
16
- exports.format = format_1.default;
17
- var match_1 = __importDefault(require("./modules/match"));
18
- exports.match = match_1.default;
19
- var number_1 = __importDefault(require("./modules/number"));
20
- exports.number = number_1.default;
21
- var tools_1 = __importDefault(require("./modules/tools"));
22
- exports.tools = tools_1.default;
23
- var modules = {
24
- cookie: cookie_1.default,
25
- date: date_1.default,
26
- dom: dom_1.default,
27
- filter: filter_1.default,
28
- format: format_1.default,
29
- match: match_1.default,
30
- number: number_1.default,
31
- tools: tools_1.default,
32
- };
33
- var Utils = /** @class */ (function () {
34
- function Utils() {
35
- Object.assign(this, modules);
36
- }
37
- /**
38
- * 挂载各组件
39
- * 示例:this.$cookie、this.$date、this.$match、this.$number、this.$tools
40
- * @param {Object} Vue 需要挂载的目标对象
41
- */
42
- Utils.prototype.install = function (app) {
43
- Object.keys(modules).forEach(function (key) {
44
- var globalProperties = app.config.globalProperties;
45
- globalProperties['$' + key] = modules[key];
46
- });
47
- };
48
- return Utils;
49
- }());
50
- exports.default = new Utils();
1
+ /**
2
+ * @Author: wanghui
3
+ * createBy: @2020.05.21
4
+ */
5
+ 'use strict';
6
+ var modules = {
7
+ cookie: require('./modules/cookie'),
8
+ date: require('./modules/date'),
9
+ dom: require('./modules/dom'),
10
+ filter: require('./modules/filter'),
11
+ format: require('./modules/format'),
12
+ match: require('./modules/match'),
13
+ number: require('./modules/number'),
14
+ tools: require('./modules/tools'),
15
+ };
16
+ var Utils = /** @class */ (function () {
17
+ function Utils() {
18
+ Object.assign(this, modules);
19
+ }
20
+ /**
21
+ * 挂载各组件
22
+ * 示例:this.$cookie、this.$date、this.$match、this.$number、this.$tools
23
+ * @param {Object} Vue 需要挂载的目标对象
24
+ */
25
+ Utils.prototype.install = function (Vue) {
26
+ Object.keys(modules).forEach(function (key) {
27
+ if (key === 'filter') {
28
+ return modules[key].install(Vue);
29
+ }
30
+ Vue.prototype['$' + key] = modules[key];
31
+ Vue['$' + key] = modules[key];
32
+ });
33
+ };
34
+ return Utils;
35
+ }());
36
+ module.exports = new Utils();
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,27 @@
1
+ interface ICookie {
2
+ name: string;
3
+ value: string;
4
+ exdays: number;
5
+ path?: string;
6
+ domain?: string;
7
+ }
8
+ declare class CookieClass {
9
+ /**
10
+ * 获取cookie
11
+ * @param {String} name
12
+ * @return {String}
13
+ */
14
+ getCookie(name: string): string;
15
+ /**
16
+ * 设置cookie
17
+ * @param {Object} ICookie
18
+ */
19
+ setCookie({ name, value, exdays, path, domain, }: ICookie): void;
20
+ /**
21
+ * 清除Cookie
22
+ * @param {String} name
23
+ */
24
+ clearCookie(name: string): void;
25
+ }
26
+ declare const _default: CookieClass;
27
+ export default _default;
@@ -1,55 +1,54 @@
1
- /**
2
- * @file Cookie
3
- * @Author: wanghui
4
- * @createBy: @2021.01.21
5
- */
6
- 'use strict';
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- var CookieClass = /** @class */ (function () {
9
- function CookieClass() {
10
- }
11
- /**
12
- * 获取cookie
13
- * @param {String} name
14
- * @return {String}
15
- */
16
- CookieClass.prototype.getCookie = function (name) {
17
- var _name = name + '=';
18
- var ca = document.cookie.split(';');
19
- for (var i = 0; i < ca.length; i++) {
20
- var c = ca[i];
21
- while (c.charAt(0) === ' ')
22
- c = c.substring(1);
23
- if (c.includes(_name))
24
- return c.substring(_name.length, c.length);
25
- }
26
- return '';
27
- };
28
- /**
29
- * 设置cookie
30
- * @param {Object} ICookie
31
- */
32
- CookieClass.prototype.setCookie = function (_a) {
33
- var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c, _d = _a.exdays, exdays = _d === void 0 ? -1 : _d, _e = _a.path, path = _e === void 0 ? '/' : _e, _f = _a.domain, domain = _f === void 0 ? '.jddmoto.com' : _f;
34
- var d = new Date();
35
- d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
36
- var expires = "expires=".concat(d.toUTCString());
37
- document.cookie = "".concat(name, "=").concat(value, ";").concat(expires, ";path=").concat(path, ";domain=").concat(domain, ";");
38
- };
39
- /**
40
- * 清除Cookie
41
- * @param {String} name
42
- */
43
- CookieClass.prototype.clearCookie = function (_a) {
44
- var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.path, path = _c === void 0 ? '/' : _c, _d = _a.domain, domain = _d === void 0 ? '.jddmoto.com' : _d;
45
- this.setCookie({
46
- name: name,
47
- value: '',
48
- exdays: -1,
49
- path: path,
50
- domain: domain
51
- });
52
- };
53
- return CookieClass;
54
- }());
55
- exports.default = new CookieClass();
1
+ /**
2
+ * @file Cookie
3
+ * @Author: wanghui
4
+ * @createBy: @2021.01.21
5
+ */
6
+ 'use strict';
7
+ var CookieClass = /** @class */ (function () {
8
+ function CookieClass() {
9
+ }
10
+ /**
11
+ * 获取cookie
12
+ * @param {String} name
13
+ * @return {String}
14
+ */
15
+ CookieClass.prototype.getCookie = function (name) {
16
+ var _name = name + '=';
17
+ var ca = document.cookie.split(';');
18
+ for (var i = 0; i < ca.length; i++) {
19
+ var c = ca[i];
20
+ while (c.charAt(0) === ' ')
21
+ c = c.substring(1);
22
+ if (c.includes(_name))
23
+ return c.substring(_name.length, c.length);
24
+ }
25
+ return '';
26
+ };
27
+ /**
28
+ * 设置cookie
29
+ * @param {Object} ICookie
30
+ */
31
+ CookieClass.prototype.setCookie = function (_a) {
32
+ var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c, _d = _a.exdays, exdays = _d === void 0 ? -1 : _d, _e = _a.path, path = _e === void 0 ? '/' : _e, _f = _a.domain, domain = _f === void 0 ? '.jddmoto.com' : _f;
33
+ var d = new Date();
34
+ d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
35
+ var expires = "expires=" + d.toUTCString();
36
+ document.cookie = name + "=" + value + ";" + expires + ";path=" + path + ";domain=" + domain + ";";
37
+ };
38
+ /**
39
+ * 清除Cookie
40
+ * @param {String} name
41
+ */
42
+ CookieClass.prototype.clearCookie = function (_a) {
43
+ var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.path, path = _c === void 0 ? '/' : _c, _d = _a.domain, domain = _d === void 0 ? '.jddmoto.com' : _d;
44
+ this.setCookie({
45
+ name: name,
46
+ value: '',
47
+ exdays: -1,
48
+ path: path,
49
+ domain: domain
50
+ });
51
+ };
52
+ return CookieClass;
53
+ }());
54
+ module.exports = new CookieClass();
@@ -0,0 +1 @@
1
+ export {};