This repository has been archived by the owner on Mar 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy paths-alert-tools.js
71 lines (63 loc) · 2.23 KB
/
s-alert-tools.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.sAlertTools = mod.exports;
}
})(this, function (exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var actualGlobalConfig = void 0;
var sAlertTools = {
randomId: function randomId() {
return Math.random().toString(36).split('.')[1];
},
returnFirstDefined: function returnFirstDefined() {
var value = void 0;
var i = void 0;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
for (i = 0; i < args.length; i++) {
if (typeof args[i] !== 'undefined') {
value = args[i];
break;
}
}
return value;
},
styleToObj: function styleToObj(input) {
var result = {},
i = void 0,
entry = void 0,
attributes = input && input.split(';').filter(Boolean);
for (i = 0; i < attributes.length; i++) {
entry = attributes[i].split(':');
result[entry.splice(0, 1)[0].trim()] = entry.join(':').trim();
}
return result;
},
setGlobalConfig: function setGlobalConfig(config) {
if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object') {
actualGlobalConfig = config;
}
},
getGlobalConfig: function getGlobalConfig() {
return actualGlobalConfig;
}
};
exports.default = sAlertTools;
});