ddan-js 2.9.4 → 2.9.6

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 (131) hide show
  1. package/bin/types/browser.d.ts +1 -1
  2. package/bin/types/index.d.ts +1 -1
  3. package/bin/types/modules/node/aliyun.d.ts +1 -1
  4. package/bin/types/upload.d.ts +2 -0
  5. package/bin/upload.js +1 -0
  6. package/package.json +18 -13
  7. package/bin/lib/browser.js +0 -111
  8. package/bin/lib/class/event.js +0 -104
  9. package/bin/lib/class/getset.js +0 -12
  10. package/bin/lib/class/icon.js +0 -94
  11. package/bin/lib/class/joker.js +0 -121
  12. package/bin/lib/class/kvalue.js +0 -29
  13. package/bin/lib/class/mapping.js +0 -82
  14. package/bin/lib/class/persist.js +0 -65
  15. package/bin/lib/class/pipeTask.js +0 -42
  16. package/bin/lib/class/pipeparallel.js +0 -24
  17. package/bin/lib/class/store.js +0 -87
  18. package/bin/lib/class/tracker.js +0 -125
  19. package/bin/lib/class/watermark.js +0 -63
  20. package/bin/lib/common/_Symbol.js +0 -5
  21. package/bin/lib/common/_freeGlobal.js +0 -5
  22. package/bin/lib/common/_object.js +0 -40
  23. package/bin/lib/common/_root.js +0 -10
  24. package/bin/lib/common/internal/asciiToArray.js +0 -13
  25. package/bin/lib/common/internal/castSlice.js +0 -18
  26. package/bin/lib/common/internal/createCaseFirst.js +0 -30
  27. package/bin/lib/common/internal/hasUnicode.js +0 -26
  28. package/bin/lib/common/internal/nodeTypes.js +0 -26
  29. package/bin/lib/common/internal/slice.js +0 -46
  30. package/bin/lib/common/internal/stringToArray.js +0 -18
  31. package/bin/lib/common/internal/unicodeToArray.js +0 -40
  32. package/bin/lib/common/internal/unicodeWords.js +0 -67
  33. package/bin/lib/index.js +0 -114
  34. package/bin/lib/modules/browser/ecdh.js +0 -124
  35. package/bin/lib/modules/browser/index.js +0 -4
  36. package/bin/lib/modules/cdn.js +0 -62
  37. package/bin/lib/modules/convert/base.js +0 -125
  38. package/bin/lib/modules/convert/base64.js +0 -114
  39. package/bin/lib/modules/convert/index.js +0 -99
  40. package/bin/lib/modules/convert/md5.js +0 -222
  41. package/bin/lib/modules/convert/pkcs.js +0 -16
  42. package/bin/lib/modules/convert/utf8.js +0 -106
  43. package/bin/lib/modules/crypto/base64.js +0 -14
  44. package/bin/lib/modules/crypto/const.js +0 -7
  45. package/bin/lib/modules/crypto/index.js +0 -30
  46. package/bin/lib/modules/crypto/rsa.js +0 -143
  47. package/bin/lib/modules/crypto/tea.js +0 -79
  48. package/bin/lib/modules/crypto/uuid.js +0 -34
  49. package/bin/lib/modules/css.js +0 -137
  50. package/bin/lib/modules/decorator.js +0 -14
  51. package/bin/lib/modules/fetch.js +0 -82
  52. package/bin/lib/modules/gbk.js +0 -46
  53. package/bin/lib/modules/hook/base.js +0 -60
  54. package/bin/lib/modules/hook/hooker.js +0 -39
  55. package/bin/lib/modules/hook/index.js +0 -49
  56. package/bin/lib/modules/hook/log.js +0 -54
  57. package/bin/lib/modules/hook/modules/bezier.js +0 -121
  58. package/bin/lib/modules/hook/modules/debounce.js +0 -127
  59. package/bin/lib/modules/hook/modules/mutex.js +0 -22
  60. package/bin/lib/modules/hook/modules/pipeline.js +0 -59
  61. package/bin/lib/modules/hook/modules/polling.js +0 -20
  62. package/bin/lib/modules/hook/modules/safeTask.js +0 -25
  63. package/bin/lib/modules/hook/modules/throttle.js +0 -30
  64. package/bin/lib/modules/html.js +0 -293
  65. package/bin/lib/modules/http/index.js +0 -171
  66. package/bin/lib/modules/http/interceptor.js +0 -22
  67. package/bin/lib/modules/list/base.js +0 -37
  68. package/bin/lib/modules/list/index.js +0 -90
  69. package/bin/lib/modules/logger.js +0 -55
  70. package/bin/lib/modules/math/index.js +0 -118
  71. package/bin/lib/modules/mini/diff.js +0 -97
  72. package/bin/lib/modules/mini/http/index.js +0 -155
  73. package/bin/lib/modules/mini/index.js +0 -71
  74. package/bin/lib/modules/node/aliyun.js +0 -156
  75. package/bin/lib/modules/node/brotli.js +0 -46
  76. package/bin/lib/modules/node/child.js +0 -18
  77. package/bin/lib/modules/node/ecdh-web.js +0 -11
  78. package/bin/lib/modules/node/ecdh.js +0 -115
  79. package/bin/lib/modules/node/file.js +0 -25
  80. package/bin/lib/modules/node/index.js +0 -11
  81. package/bin/lib/modules/node/proxy.js +0 -147
  82. package/bin/lib/modules/node/rsa-web.js +0 -19
  83. package/bin/lib/modules/node/socks5.js +0 -424
  84. package/bin/lib/modules/obj/index.js +0 -184
  85. package/bin/lib/modules/qs/base.js +0 -5
  86. package/bin/lib/modules/qs/decode.js +0 -45
  87. package/bin/lib/modules/qs/encode.js +0 -53
  88. package/bin/lib/modules/qs/index.js +0 -152
  89. package/bin/lib/modules/regex.js +0 -16
  90. package/bin/lib/modules/rsa.js +0 -18
  91. package/bin/lib/modules/rule/async-validator/index.js +0 -306
  92. package/bin/lib/modules/rule/async-validator/interface.js +0 -2
  93. package/bin/lib/modules/rule/async-validator/messages.js +0 -59
  94. package/bin/lib/modules/rule/async-validator/rule/enum.js +0 -13
  95. package/bin/lib/modules/rule/async-validator/rule/index.js +0 -16
  96. package/bin/lib/modules/rule/async-validator/rule/pattern.js +0 -27
  97. package/bin/lib/modules/rule/async-validator/rule/range.js +0 -54
  98. package/bin/lib/modules/rule/async-validator/rule/required.js +0 -12
  99. package/bin/lib/modules/rule/async-validator/rule/type.js +0 -98
  100. package/bin/lib/modules/rule/async-validator/rule/url.js +0 -55
  101. package/bin/lib/modules/rule/async-validator/rule/whitespace.js +0 -20
  102. package/bin/lib/modules/rule/async-validator/util.js +0 -255
  103. package/bin/lib/modules/rule/async-validator/validator/any.js +0 -16
  104. package/bin/lib/modules/rule/async-validator/validator/array.js +0 -19
  105. package/bin/lib/modules/rule/async-validator/validator/boolean.js +0 -20
  106. package/bin/lib/modules/rule/async-validator/validator/date.js +0 -31
  107. package/bin/lib/modules/rule/async-validator/validator/enum.js +0 -20
  108. package/bin/lib/modules/rule/async-validator/validator/float.js +0 -20
  109. package/bin/lib/modules/rule/async-validator/validator/index.js +0 -36
  110. package/bin/lib/modules/rule/async-validator/validator/integer.js +0 -20
  111. package/bin/lib/modules/rule/async-validator/validator/method.js +0 -19
  112. package/bin/lib/modules/rule/async-validator/validator/number.js +0 -23
  113. package/bin/lib/modules/rule/async-validator/validator/object.js +0 -19
  114. package/bin/lib/modules/rule/async-validator/validator/pattern.js +0 -19
  115. package/bin/lib/modules/rule/async-validator/validator/regexp.js +0 -19
  116. package/bin/lib/modules/rule/async-validator/validator/required.js +0 -10
  117. package/bin/lib/modules/rule/async-validator/validator/string.js +0 -24
  118. package/bin/lib/modules/rule/async-validator/validator/type.js +0 -20
  119. package/bin/lib/modules/rule/index.js +0 -67
  120. package/bin/lib/modules/string/index.js +0 -121
  121. package/bin/lib/modules/string/words.js +0 -33
  122. package/bin/lib/modules/time/const.js +0 -11
  123. package/bin/lib/modules/time/dtime.js +0 -132
  124. package/bin/lib/modules/time/frame.js +0 -49
  125. package/bin/lib/modules/time/index.js +0 -84
  126. package/bin/lib/typings/index.js +0 -2
  127. package/bin/lib/util/function.js +0 -33
  128. package/bin/lib/util/includes.js +0 -96
  129. package/bin/lib/util/index.js +0 -26
  130. package/bin/lib/util/is.js +0 -148
  131. package/bin/lib/util/to.js +0 -47
@@ -1,121 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const createCaseFirst_1 = require("../../common/internal/createCaseFirst");
4
- const is_1 = require("../../util/is");
5
- const words_1 = require("./words");
6
- const INFINITY = 1 / 0;
7
- function toString(value) {
8
- if (value == null) {
9
- return '';
10
- }
11
- // Exit early for strings to avoid a performance hit in some environments.
12
- if (typeof value === 'string') {
13
- return value;
14
- }
15
- if (Array.isArray(value)) {
16
- // Recursively convert values (susceptible to call stack limits).
17
- return `${value.map((other) => (other == null ? other : toString(other)))}`;
18
- }
19
- if (is_1.default.isSymbol(value)) {
20
- return value.toString();
21
- }
22
- const result = `${value}`;
23
- return result == '0' && 1 / value == -INFINITY ? '-0' : result;
24
- }
25
- const upperFirst = (0, createCaseFirst_1.default)('toUpperCase');
26
- const lowerFirst = (0, createCaseFirst_1.default)('toLowerCase');
27
- const snakeCase = (string) => (0, words_1.default)(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? '_' : '') + word.toLowerCase(), '');
28
- const kebabCase = (string) => (0, words_1.default)(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? '-' : '') + word.toLowerCase(), '');
29
- const upperCase = (string) => (0, words_1.default)(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? ' ' : '') + word.toUpperCase(), '');
30
- const camelCase = (string) => (0, words_1.default)(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => {
31
- word = word.toLowerCase();
32
- return result + (index ? upperFirst(word) : word);
33
- }, '');
34
- const lowerCase = (string) => (0, words_1.default)(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? ' ' : '') + word.toLowerCase(), '');
35
- /**
36
- * startCase('--foo-bar--')
37
- * // => 'Foo Bar'
38
- *
39
- * startCase('fooBar')
40
- * // => 'Foo Bar'
41
- *
42
- * startCase('__FOO_BAR__')
43
- * // => 'FOO BAR'
44
- */
45
- const startCase = (string) => (0, words_1.default)(`${string}`.replace(/['\u2019]/g, '')).reduce((result, word, index) => result + (index ? ' ' : '') + upperFirst(word), '');
46
- const splitOnFirst = (string, separator) => {
47
- if (!(typeof string === 'string' && typeof separator === 'string')) {
48
- throw new TypeError('Expected the arguments to be of type `string`');
49
- }
50
- if (string === '' || separator === '') {
51
- return [];
52
- }
53
- const separatorIndex = string.indexOf(separator);
54
- if (separatorIndex === -1) {
55
- return [];
56
- }
57
- return [string.slice(0, separatorIndex), string.slice(separatorIndex + separator.length)];
58
- };
59
- const parseValue = (value, { number = false, boolean = false } = {}) => {
60
- let val = value;
61
- if (!value || typeof value !== 'string')
62
- return val;
63
- if (number && !Number.isNaN(Number(value)) && typeof value === 'string' && value.trim() !== '') {
64
- val = Number(value);
65
- }
66
- else if (boolean &&
67
- value !== null &&
68
- (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
69
- val = value.toLowerCase() === 'true';
70
- }
71
- return val;
72
- };
73
- const replace = (source, rules) => {
74
- if (!source)
75
- return source;
76
- if (!rules)
77
- return source;
78
- let result = source;
79
- const _arr = Array.isArray(rules) ? rules : [rules];
80
- (_arr || []).forEach((e) => {
81
- if (e.key && e.value) {
82
- result = result.replace(new RegExp(e.key, e.flag || ''), e.value);
83
- }
84
- });
85
- return result;
86
- };
87
- const jsonFormat = (jsonString) => {
88
- try {
89
- if (!jsonString)
90
- return '';
91
- const json = JSON.parse(jsonString);
92
- return JSON.stringify(json, null, 2);
93
- }
94
- catch (error) {
95
- return jsonString;
96
- }
97
- };
98
- const toLines = (content, separator = '\n') => {
99
- if (!content)
100
- return [];
101
- return content
102
- .split(separator)
103
- .map((line) => line.trim())
104
- .filter((txt) => !!txt);
105
- };
106
- exports.default = {
107
- toString,
108
- startCase,
109
- snakeCase,
110
- kebabCase,
111
- camelCase,
112
- upperCase,
113
- upperFirst,
114
- lowerCase,
115
- lowerFirst,
116
- splitOnFirst,
117
- parseValue,
118
- replace,
119
- jsonFormat,
120
- toLines,
121
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const unicodeWords_1 = require("../../common/internal/unicodeWords");
4
- const hasUnicodeWord = RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);
5
- /** Used to match words composed of alphanumeric characters. */
6
- const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
7
- function asciiWords(string) {
8
- return string.match(reAsciiWord);
9
- }
10
- /**
11
- * Splits `string` into an array of its words.
12
- *
13
- * @since 3.0.0
14
- * @category String
15
- * @param {string} [string=''] The string to inspect.
16
- * @param {RegExp|string} [pattern] The pattern to match words.
17
- * @returns {Array} Returns the words of `string`.
18
- * @example
19
- *
20
- * words('fred, barney, & pebbles')
21
- * // => ['fred', 'barney', 'pebbles']
22
- *
23
- * words('fred, barney, & pebbles', /[^, ]+/g)
24
- * // => ['fred', 'barney', '&', 'pebbles']
25
- */
26
- function words(string, pattern) {
27
- if (pattern === undefined) {
28
- const result = hasUnicodeWord(string) ? (0, unicodeWords_1.default)(string) : asciiWords(string);
29
- return result || [];
30
- }
31
- return string.match(pattern) || [];
32
- }
33
- exports.default = words;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** 1天ms数 */
4
- const oneDay = 86400000;
5
- /** 1小时ms数 */
6
- const oneHour = 3600000;
7
- /** 1分ms数 */
8
- const oneMinute = 60000;
9
- /** 1秒ms数 */
10
- const oneSecond = 1000;
11
- exports.default = { oneDay, oneHour, oneMinute, oneSecond };
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const const_1 = require("./const");
4
- class DTime {
5
- date;
6
- timestamp = 0;
7
- yyyy = 0;
8
- yy = '';
9
- M = 0;
10
- MM = '';
11
- d = 0;
12
- dd = '';
13
- h = 0;
14
- hh = '';
15
- m = 0;
16
- mm = '';
17
- s = 0;
18
- ss = '';
19
- S = 0;
20
- SS = '';
21
- SSS = '';
22
- constructor(time) {
23
- if (!time)
24
- return;
25
- const date = typeof time === 'string' || typeof time === 'number' ? new Date(time) : time;
26
- if (!date)
27
- return;
28
- this.date = date;
29
- this.timestamp = date.getTime();
30
- // 默认日期格式
31
- this.toDate();
32
- }
33
- toDate() {
34
- if (!this.date)
35
- return this;
36
- this.yyyy = this.date.getFullYear();
37
- this.yy = `${this.yyyy}`.substr(2);
38
- this.M = this.date.getMonth() + 1;
39
- this.MM = (this.M < 10 ? '0' : '') + this.M;
40
- this.d = this.date.getDate();
41
- this.dd = (this.d < 10 ? '0' : '') + this.d;
42
- this.h = this.date.getHours();
43
- this.hh = (this.h < 10 ? '0' : '') + this.h;
44
- this.m = this.date.getMinutes();
45
- this.mm = (this.m < 10 ? '0' : '') + this.m;
46
- this.s = this.date.getSeconds();
47
- this.ss = (this.s < 10 ? '0' : '') + this.s;
48
- this.S = this.date.getMilliseconds();
49
- this.SS = (this.S < 10 ? '0' : '') + this.S;
50
- this.SSS = this.S.toString().padStart(3, '0');
51
- return this;
52
- }
53
- toCountdown(regFormat = '') {
54
- const result = {
55
- countdown: 0,
56
- timestamp: 0,
57
- seconds: 0,
58
- d: 0,
59
- dd: '',
60
- h: 0,
61
- hh: '',
62
- m: 0,
63
- mm: '',
64
- s: 0,
65
- ss: '',
66
- S: 0,
67
- SS: '',
68
- SSS: '',
69
- desc: '',
70
- };
71
- if (!this.timestamp)
72
- return result;
73
- result.timestamp = this.timestamp;
74
- result.countdown = Math.max(result.timestamp - Date.now(), 0);
75
- result.seconds = Math.floor(result.countdown / const_1.default.oneSecond);
76
- let amount = result.countdown;
77
- result.d = Math.floor(amount / const_1.default.oneDay);
78
- result.dd = (result.d < 10 ? '0' : '') + result.d;
79
- amount = amount % const_1.default.oneDay;
80
- result.h = Math.floor(amount / const_1.default.oneHour);
81
- result.hh = (result.h < 10 ? '0' : '') + result.h;
82
- amount = amount % const_1.default.oneHour;
83
- result.m = Math.floor(amount / const_1.default.oneMinute);
84
- result.mm = (result.m < 10 ? '0' : '') + result.m;
85
- amount = amount % const_1.default.oneMinute;
86
- result.s = Math.floor(amount / const_1.default.oneSecond);
87
- result.ss = (result.s < 10 ? '0' : '') + result.s;
88
- amount = amount % const_1.default.oneSecond;
89
- result.S = amount;
90
- result.SS = (result.S < 10 ? '0' : '') + result.S;
91
- result.SSS = result.S.toString().padStart(3, '0');
92
- let _reg = regFormat;
93
- if (!_reg) {
94
- if (result.countdown > const_1.default.oneHour) {
95
- _reg = 'hh:mm:ss';
96
- }
97
- else if (result.countdown > const_1.default.oneMinute) {
98
- _reg = 'mm:ss';
99
- }
100
- else {
101
- _reg = 'ss';
102
- }
103
- }
104
- result.desc = _reg.replace(/\bdd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g, ($1) => result[$1]);
105
- return result;
106
- }
107
- add(ms = 0) {
108
- if (!ms)
109
- return this;
110
- this.timestamp = this.timestamp + ms;
111
- this.date = new Date(this.timestamp);
112
- this.toDate();
113
- return this;
114
- }
115
- format(reg = 'yyyy-MM-dd hh:mm:ss') {
116
- return reg.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g, ($1) => this[$1]);
117
- }
118
- static get timezoneOffset() {
119
- return new Date().getTimezoneOffset() / 60;
120
- }
121
- static getLocalTime(timezoneOffset = 0) {
122
- const d = new Date();
123
- //得到1970年一月一日到现在的秒数
124
- const t = d.getTime();
125
- //本地时间与GMT时间的时间偏移差(注意:GMT这是UTC的民间名称。GMT=UTC)
126
- const offset = d.getTimezoneOffset() * 60000;
127
- //得到现在的格林尼治时间
128
- const utcTime = t + offset;
129
- return new Date(utcTime + 3600000 * timezoneOffset);
130
- }
131
- }
132
- exports.default = DTime;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const event_1 = require("../../class/event");
4
- class DLoopFrame {
5
- _loopTimer;
6
- _event = new event_1.default();
7
- started = false;
8
- interval = 0;
9
- constructor(interval = 0) {
10
- this.interval = interval || 500;
11
- }
12
- start() {
13
- if (this.started)
14
- return this;
15
- this.stop();
16
- this._loopTimer = setInterval(() => {
17
- this._handleLoop();
18
- }, this.interval);
19
- this.started = true;
20
- return this;
21
- }
22
- stop() {
23
- if (!this._loopTimer)
24
- return this;
25
- clearInterval(this._loopTimer);
26
- this._loopTimer = 0;
27
- this.started = false;
28
- return this;
29
- }
30
- restart() {
31
- this.stop();
32
- this.start();
33
- return this;
34
- }
35
- on(cb) {
36
- this._event.on("frame", cb);
37
- return this;
38
- }
39
- off(cb) {
40
- if (!cb)
41
- return this;
42
- this._event.off("frame", cb);
43
- return this;
44
- }
45
- _handleLoop() {
46
- this._event.emit("frame");
47
- }
48
- }
49
- exports.default = DLoopFrame;
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const frame_1 = require("./frame");
4
- const dtime_1 = require("./dtime");
5
- const const_1 = require("./const");
6
- /**
7
- * 是否是今天
8
- * @param {*} date
9
- * @returns
10
- */
11
- const isToday = (date) => date && new Date().toDateString() === new Date(date).toDateString();
12
- /**
13
- * 当天零点
14
- */
15
- const todayZero = () => parseTimestamp({}); // new Date(format(Date.now(), "yyyy/MM/dd 00:00:00")).getTime();
16
- /**
17
- * 时间格式化
18
- * @param {string|number|Date} time
19
- * @param {string} reg "yyyyMMdd hhmmss"
20
- * @returns
21
- */
22
- const format = (time, reg = 'yyyy-MM-dd hh:mm:ss') => {
23
- const date = typeof time === 'string' || typeof time === 'number' ? new Date(time) : time;
24
- if (!date)
25
- return '';
26
- return dtime(date).format(reg);
27
- };
28
- /**
29
- *
30
- * @param time 时间戳|日期时间字符串|Date
31
- * @returns
32
- */
33
- const dtime = (time) => {
34
- const date = typeof time === 'string' || typeof time === 'number' ? new Date(time) : time;
35
- if (!date)
36
- return new dtime_1.default(0);
37
- return new dtime_1.default(date);
38
- };
39
- /**
40
- * 解析时间
41
- * @param param0
42
- * @returns
43
- */
44
- function parseTimestamp({ year = 0, month = 0, date = 0, hour = 0, minute = 0, second = 0 }) {
45
- const _format = `${year || 'yyyy'}/${month || 'MM'}/${date || 'dd'} ${hour}:${minute}:${second}`;
46
- return new Date(format(Date.now(), _format)).getTime();
47
- }
48
- /**
49
- * 当前时间格式类
50
- * @returns
51
- */
52
- function now() {
53
- return dtime(new Date());
54
- }
55
- /**
56
- * 倒计时格式
57
- * @param endTime 结束时间
58
- * @param reg 格式
59
- * @returns
60
- */
61
- const countdown = (endTime, reg = '') => {
62
- const date = typeof endTime === 'string' || typeof endTime === 'number' ? new Date(endTime) : endTime;
63
- if (!date)
64
- return '';
65
- const map = dtime(date);
66
- return map.toCountdown(reg);
67
- };
68
- const loopFrame = (interval = 500) => {
69
- return new frame_1.default(interval);
70
- };
71
- const getTimezoneOffset = () => dtime_1.default.timezoneOffset;
72
- exports.default = {
73
- ...const_1.default,
74
- now,
75
- isToday,
76
- parseTimestamp,
77
- todayZero,
78
- format,
79
- countdown,
80
- dtime,
81
- loopFrame,
82
- getTimezoneOffset,
83
- getLocalTime: dtime_1.default.getLocalTime,
84
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getset_1 = require("../class/getset");
4
- /**
5
- * 设置单例模式
6
- * @returns
7
- */
8
- function singleton() {
9
- class Singleton {
10
- static __instance__;
11
- // eslint-disable-next-line @typescript-eslint/no-empty-function
12
- constructor() { }
13
- static get Instance() {
14
- if (!Singleton.__instance__) {
15
- Singleton.__instance__ = new this();
16
- }
17
- return Singleton.__instance__;
18
- }
19
- static get I() {
20
- return this.Instance;
21
- }
22
- }
23
- return Singleton;
24
- }
25
- function getset(t) {
26
- const result = new getset_1.default();
27
- // 初始化
28
- if (t !== undefined) {
29
- result.set(t);
30
- }
31
- return result;
32
- }
33
- exports.default = { singleton, getset };
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const is_1 = require("./is");
4
- const to_1 = require("./to");
5
- const _object_1 = require("../common/_object");
6
- function arrayMap(array, iteratee) {
7
- var index = -1, length = array ? array.length : 0, result = Array(length);
8
- while (++index < length) {
9
- result[index] = iteratee(array[index], index, array);
10
- }
11
- return result;
12
- }
13
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
14
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
15
- while ((fromRight ? index-- : ++index < length)) {
16
- if (predicate(array[index], index, array)) {
17
- return index;
18
- }
19
- }
20
- return -1;
21
- }
22
- function baseIndexOf(array, value, fromIndex) {
23
- if (value !== value)
24
- return baseFindIndex(array, baseIsNaN, fromIndex);
25
- var index = fromIndex - 1, length = array.length;
26
- while (++index < length) {
27
- if (array[index] === value) {
28
- return index;
29
- }
30
- }
31
- return -1;
32
- }
33
- function baseIsNaN(value) {
34
- return value !== value;
35
- }
36
- function baseTimes(n, iteratee) {
37
- var index = -1, result = Array(n);
38
- while (++index < n) {
39
- result[index] = iteratee(index);
40
- }
41
- return result;
42
- }
43
- function baseValues(object, props) {
44
- return arrayMap(props, function (key) {
45
- return object[key];
46
- });
47
- }
48
- function overArg(func, transform) {
49
- return function (arg) {
50
- return func(transform(arg));
51
- };
52
- }
53
- var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max;
54
- function arrayLikeKeys(value, inherited) {
55
- var result = (is_1.default.isArray(value) || is_1.default.isArguments(value))
56
- ? baseTimes(value.length, String)
57
- : [];
58
- var length = result.length, skipIndexes = !!length;
59
- for (var key in value) {
60
- if ((inherited || _object_1.default.hasOwnProperty.call(value, key)) &&
61
- !(skipIndexes && (key == 'length' || is_1.default.isIndex(key, length)))) {
62
- result.push(key);
63
- }
64
- }
65
- return result;
66
- }
67
- function baseKeys(object) {
68
- if (!is_1.default.isPrototype(object)) {
69
- return nativeKeys(object);
70
- }
71
- var result = [];
72
- for (var key in Object(object)) {
73
- if (_object_1.default.hasOwnProperty.call(object, key) && key != 'constructor') {
74
- result.push(key);
75
- }
76
- }
77
- return result;
78
- }
79
- function includes(collection, value, fromIndex, guard) {
80
- collection = is_1.default.isArrayLike(collection) ? collection : values(collection);
81
- fromIndex = (fromIndex && !guard) ? to_1.default.toInteger(fromIndex) : 0;
82
- var length = collection.length;
83
- if (fromIndex < 0) {
84
- fromIndex = nativeMax(length + fromIndex, 0);
85
- }
86
- return is_1.default.isString(collection)
87
- ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
88
- : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
89
- }
90
- function keys(object) {
91
- return is_1.default.isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
92
- }
93
- function values(object) {
94
- return object ? baseValues(object, keys(object)) : [];
95
- }
96
- exports.default = includes;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const is_1 = require("./is");
4
- const includes_1 = require("./includes");
5
- const _object_1 = require("../common/_object");
6
- const obj_1 = require("../modules/obj");
7
- const function_1 = require("./function");
8
- const forof = (source, cb) => {
9
- if (!source)
10
- return;
11
- let entries;
12
- if (!is_1.default.isObject(source))
13
- return;
14
- if (is_1.default.isArray(source)) {
15
- entries = source.entries();
16
- }
17
- else {
18
- entries = Object.entries(source);
19
- }
20
- if (!entries)
21
- return;
22
- for (const [key, value] of entries) {
23
- cb && cb(key, value);
24
- }
25
- };
26
- exports.default = { ...is_1.default, ..._object_1.default, ...obj_1.default, ...function_1.default, includes: includes_1.default, forof };