ddan-js 2.9.3 → 2.9.5

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 (133) hide show
  1. package/bin/ddan-js.browser.js +1 -1
  2. package/bin/ddan-js.esm.js +1 -1
  3. package/bin/ddan-js.js +1 -1
  4. package/bin/types/browser.d.ts +3 -3
  5. package/bin/types/index.d.ts +4 -3
  6. package/bin/types/modules/fetch.d.ts +1 -1
  7. package/bin/types/modules/node/index.d.ts +2 -0
  8. package/package.json +18 -13
  9. package/bin/lib/browser.js +0 -111
  10. package/bin/lib/class/event.js +0 -104
  11. package/bin/lib/class/getset.js +0 -12
  12. package/bin/lib/class/icon.js +0 -94
  13. package/bin/lib/class/joker.js +0 -121
  14. package/bin/lib/class/kvalue.js +0 -29
  15. package/bin/lib/class/mapping.js +0 -82
  16. package/bin/lib/class/persist.js +0 -65
  17. package/bin/lib/class/pipeTask.js +0 -42
  18. package/bin/lib/class/pipeparallel.js +0 -24
  19. package/bin/lib/class/store.js +0 -87
  20. package/bin/lib/class/tracker.js +0 -125
  21. package/bin/lib/class/watermark.js +0 -63
  22. package/bin/lib/common/_Symbol.js +0 -5
  23. package/bin/lib/common/_freeGlobal.js +0 -5
  24. package/bin/lib/common/_object.js +0 -40
  25. package/bin/lib/common/_root.js +0 -10
  26. package/bin/lib/common/internal/asciiToArray.js +0 -13
  27. package/bin/lib/common/internal/castSlice.js +0 -18
  28. package/bin/lib/common/internal/createCaseFirst.js +0 -30
  29. package/bin/lib/common/internal/hasUnicode.js +0 -26
  30. package/bin/lib/common/internal/nodeTypes.js +0 -26
  31. package/bin/lib/common/internal/slice.js +0 -46
  32. package/bin/lib/common/internal/stringToArray.js +0 -18
  33. package/bin/lib/common/internal/unicodeToArray.js +0 -40
  34. package/bin/lib/common/internal/unicodeWords.js +0 -67
  35. package/bin/lib/index.js +0 -114
  36. package/bin/lib/modules/browser/ecdh.js +0 -124
  37. package/bin/lib/modules/browser/index.js +0 -4
  38. package/bin/lib/modules/cdn.js +0 -62
  39. package/bin/lib/modules/convert/base.js +0 -125
  40. package/bin/lib/modules/convert/base64.js +0 -114
  41. package/bin/lib/modules/convert/index.js +0 -99
  42. package/bin/lib/modules/convert/md5.js +0 -222
  43. package/bin/lib/modules/convert/pkcs.js +0 -16
  44. package/bin/lib/modules/convert/utf8.js +0 -106
  45. package/bin/lib/modules/crypto/base64.js +0 -14
  46. package/bin/lib/modules/crypto/const.js +0 -7
  47. package/bin/lib/modules/crypto/index.js +0 -30
  48. package/bin/lib/modules/crypto/rsa.js +0 -143
  49. package/bin/lib/modules/crypto/tea.js +0 -79
  50. package/bin/lib/modules/crypto/uuid.js +0 -34
  51. package/bin/lib/modules/css.js +0 -137
  52. package/bin/lib/modules/decorator.js +0 -14
  53. package/bin/lib/modules/fetch.js +0 -82
  54. package/bin/lib/modules/gbk.js +0 -46
  55. package/bin/lib/modules/hook/base.js +0 -60
  56. package/bin/lib/modules/hook/hooker.js +0 -39
  57. package/bin/lib/modules/hook/index.js +0 -49
  58. package/bin/lib/modules/hook/log.js +0 -54
  59. package/bin/lib/modules/hook/modules/bezier.js +0 -121
  60. package/bin/lib/modules/hook/modules/debounce.js +0 -127
  61. package/bin/lib/modules/hook/modules/mutex.js +0 -22
  62. package/bin/lib/modules/hook/modules/pipeline.js +0 -59
  63. package/bin/lib/modules/hook/modules/polling.js +0 -20
  64. package/bin/lib/modules/hook/modules/safeTask.js +0 -25
  65. package/bin/lib/modules/hook/modules/throttle.js +0 -30
  66. package/bin/lib/modules/html.js +0 -293
  67. package/bin/lib/modules/http/index.js +0 -171
  68. package/bin/lib/modules/http/interceptor.js +0 -22
  69. package/bin/lib/modules/list/base.js +0 -37
  70. package/bin/lib/modules/list/index.js +0 -90
  71. package/bin/lib/modules/logger.js +0 -55
  72. package/bin/lib/modules/math/index.js +0 -118
  73. package/bin/lib/modules/mini/diff.js +0 -97
  74. package/bin/lib/modules/mini/http/index.js +0 -155
  75. package/bin/lib/modules/mini/index.js +0 -71
  76. package/bin/lib/modules/node/aliyun.js +0 -156
  77. package/bin/lib/modules/node/brotli.js +0 -46
  78. package/bin/lib/modules/node/child.js +0 -18
  79. package/bin/lib/modules/node/ecdh-web.js +0 -11
  80. package/bin/lib/modules/node/ecdh.js +0 -115
  81. package/bin/lib/modules/node/file.js +0 -25
  82. package/bin/lib/modules/node/index.js +0 -11
  83. package/bin/lib/modules/node/proxy.js +0 -147
  84. package/bin/lib/modules/node/rsa-web.js +0 -19
  85. package/bin/lib/modules/node/socks5.js +0 -424
  86. package/bin/lib/modules/obj/index.js +0 -184
  87. package/bin/lib/modules/qs/base.js +0 -5
  88. package/bin/lib/modules/qs/decode.js +0 -45
  89. package/bin/lib/modules/qs/encode.js +0 -53
  90. package/bin/lib/modules/qs/index.js +0 -114
  91. package/bin/lib/modules/regex.js +0 -16
  92. package/bin/lib/modules/rsa.js +0 -18
  93. package/bin/lib/modules/rule/async-validator/index.js +0 -306
  94. package/bin/lib/modules/rule/async-validator/interface.js +0 -2
  95. package/bin/lib/modules/rule/async-validator/messages.js +0 -59
  96. package/bin/lib/modules/rule/async-validator/rule/enum.js +0 -13
  97. package/bin/lib/modules/rule/async-validator/rule/index.js +0 -16
  98. package/bin/lib/modules/rule/async-validator/rule/pattern.js +0 -27
  99. package/bin/lib/modules/rule/async-validator/rule/range.js +0 -54
  100. package/bin/lib/modules/rule/async-validator/rule/required.js +0 -12
  101. package/bin/lib/modules/rule/async-validator/rule/type.js +0 -98
  102. package/bin/lib/modules/rule/async-validator/rule/url.js +0 -55
  103. package/bin/lib/modules/rule/async-validator/rule/whitespace.js +0 -20
  104. package/bin/lib/modules/rule/async-validator/util.js +0 -255
  105. package/bin/lib/modules/rule/async-validator/validator/any.js +0 -16
  106. package/bin/lib/modules/rule/async-validator/validator/array.js +0 -19
  107. package/bin/lib/modules/rule/async-validator/validator/boolean.js +0 -20
  108. package/bin/lib/modules/rule/async-validator/validator/date.js +0 -31
  109. package/bin/lib/modules/rule/async-validator/validator/enum.js +0 -20
  110. package/bin/lib/modules/rule/async-validator/validator/float.js +0 -20
  111. package/bin/lib/modules/rule/async-validator/validator/index.js +0 -36
  112. package/bin/lib/modules/rule/async-validator/validator/integer.js +0 -20
  113. package/bin/lib/modules/rule/async-validator/validator/method.js +0 -19
  114. package/bin/lib/modules/rule/async-validator/validator/number.js +0 -23
  115. package/bin/lib/modules/rule/async-validator/validator/object.js +0 -19
  116. package/bin/lib/modules/rule/async-validator/validator/pattern.js +0 -19
  117. package/bin/lib/modules/rule/async-validator/validator/regexp.js +0 -19
  118. package/bin/lib/modules/rule/async-validator/validator/required.js +0 -10
  119. package/bin/lib/modules/rule/async-validator/validator/string.js +0 -24
  120. package/bin/lib/modules/rule/async-validator/validator/type.js +0 -20
  121. package/bin/lib/modules/rule/index.js +0 -67
  122. package/bin/lib/modules/string/index.js +0 -121
  123. package/bin/lib/modules/string/words.js +0 -33
  124. package/bin/lib/modules/time/const.js +0 -11
  125. package/bin/lib/modules/time/dtime.js +0 -132
  126. package/bin/lib/modules/time/frame.js +0 -49
  127. package/bin/lib/modules/time/index.js +0 -84
  128. package/bin/lib/typings/index.js +0 -2
  129. package/bin/lib/util/function.js +0 -33
  130. package/bin/lib/util/includes.js +0 -96
  131. package/bin/lib/util/index.js +0 -26
  132. package/bin/lib/util/is.js +0 -148
  133. package/bin/lib/util/to.js +0 -47
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const kvalue_1 = require("./kvalue");
4
- class Mapping {
5
- _map = new Map();
6
- constructor() {
7
- this._map.clear();
8
- }
9
- get keys() {
10
- return Array.from(this._map.keys());
11
- }
12
- get values() {
13
- return Array.from(this._map.values());
14
- }
15
- get(key) {
16
- if (!key)
17
- return undefined;
18
- const kv = this._map.get(key);
19
- if (!kv)
20
- return undefined;
21
- return kv.value;
22
- }
23
- getKV(key) {
24
- if (!key)
25
- return undefined;
26
- return this._map.get(key);
27
- }
28
- set(key, value) {
29
- if (!key)
30
- return;
31
- const kv = this._map.get(key);
32
- if (!kv) {
33
- this._map.set(key, new kvalue_1.default(key, value));
34
- return;
35
- }
36
- else {
37
- kv.set(value);
38
- }
39
- this.clean();
40
- }
41
- delete(key, cb) {
42
- if (!key)
43
- return;
44
- const kv = this._map.get(key);
45
- cb && cb(kv?.value);
46
- this._map.delete(key);
47
- }
48
- clear() {
49
- this._map.clear();
50
- }
51
- clean(max = 100, cb) {
52
- try {
53
- if (this._map.size <= max)
54
- return;
55
- const temps = this.keys.filter(key => {
56
- if (!this._map.has(key))
57
- return false;
58
- const kv = this._map.get(key);
59
- if (!kv)
60
- return true;
61
- return !kv.value;
62
- });
63
- temps.forEach(key => {
64
- this._map.delete(key);
65
- });
66
- if (this._map.size <= max)
67
- return;
68
- const vals = this.values.sort((kvA, kvB) => kvA.timestamp - kvB.timestamp);
69
- const count = vals.length - max;
70
- if (count <= 0)
71
- return;
72
- const removed = vals.splice(0, count);
73
- removed.forEach(kv => {
74
- this.delete(kv.key, cb);
75
- });
76
- }
77
- catch (error) {
78
- console.log(`mapping clean`, error);
79
- }
80
- }
81
- }
82
- exports.default = Mapping;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.persistConfig = void 0;
4
- const hook_1 = require("../modules/hook");
5
- const obj_1 = require("../modules/obj");
6
- const persistConfig = (key, fields, storage) => {
7
- const persit = {
8
- key,
9
- fields,
10
- storage
11
- };
12
- return persit;
13
- };
14
- exports.persistConfig = persistConfig;
15
- class DPersist {
16
- key;
17
- storage;
18
- fields = [];
19
- constructor(config) {
20
- this.key = config?.key || "";
21
- this.fields = config?.fields || [];
22
- this.storage = config?.storage || undefined;
23
- }
24
- save = hook_1.default.debounce((data) => {
25
- if (!this.key || !this.storage)
26
- return;
27
- try {
28
- const { setItem, setStorageSync } = this.storage;
29
- if (setStorageSync) {
30
- return setStorageSync(this.key, data);
31
- }
32
- if (setItem) {
33
- return setItem(this.key, JSON.stringify(data));
34
- }
35
- }
36
- catch (error) {
37
- console.error("persit save ", error);
38
- }
39
- });
40
- read() {
41
- if (!this.key || !this.storage)
42
- return undefined;
43
- try {
44
- const { getItem, getStorageSync } = this.storage;
45
- if (getStorageSync) {
46
- return getStorageSync(this.key);
47
- }
48
- if (getItem) {
49
- const value = getItem(this.key);
50
- return JSON.parse(value);
51
- }
52
- }
53
- catch (error) {
54
- console.error("persit read ", error);
55
- return undefined;
56
- }
57
- }
58
- handleSave(target, key) {
59
- if (!this.fields.includes(key) || !target)
60
- return;
61
- const data = obj_1.default.copy(target, { fields: this.fields });
62
- this.save(data);
63
- }
64
- }
65
- exports.default = DPersist;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const is_1 = require("../util/is");
4
- class DPipeTask {
5
- __list = [];
6
- constructor(_task) {
7
- this.push(_task);
8
- }
9
- push(_task) {
10
- _task && this.__list.push(_task);
11
- return this;
12
- }
13
- clear() {
14
- this.__list = [];
15
- return this;
16
- }
17
- _exec(task, payload) {
18
- let temp;
19
- if (is_1.default.isFunction(task)) {
20
- temp = task(payload);
21
- }
22
- else if (is_1.default.isPromise(task)) {
23
- return task.then(res => {
24
- return { ...payload, ...res };
25
- });
26
- }
27
- else {
28
- temp = task;
29
- }
30
- return is_1.default.isPromise(temp) ? temp : Promise.resolve({ ...temp, ...payload });
31
- }
32
- run(param) {
33
- try {
34
- const result = this.__list.reduce((prev, curTask) => prev.then((res) => this._exec(curTask, res)), Promise.resolve(param));
35
- return result.then(data => [undefined, data]).catch(err => [err, undefined]);
36
- }
37
- catch (err) {
38
- return Promise.reject([err, undefined]);
39
- }
40
- }
41
- }
42
- exports.default = DPipeTask;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const hook_1 = require("../modules/hook");
4
- class DPipeparallel {
5
- __list = [];
6
- constructor() {
7
- this.clear();
8
- }
9
- add(_task) {
10
- const _p = hook_1.default.run(_task);
11
- this.__list.push(_p);
12
- return this;
13
- }
14
- clear() {
15
- this.__list = [];
16
- return this;
17
- }
18
- wait() {
19
- const _tempList = this.__list;
20
- this.clear();
21
- return Promise.allSettled(_tempList);
22
- }
23
- }
24
- exports.default = DPipeparallel;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeRef = void 0;
4
- const hook_1 = require("../modules/hook");
5
- const event_1 = require("./event");
6
- const obj_1 = require("../modules/obj");
7
- const is_1 = require("../util/is");
8
- const persist_1 = require("./persist");
9
- class DStore extends event_1.default {
10
- setters = {};
11
- getters = {};
12
- actions = {};
13
- persist;
14
- constructor() {
15
- super();
16
- }
17
- async dispatch(key, payload = undefined) {
18
- const self = this;
19
- const action = Reflect.get(self.actions, key);
20
- if (!is_1.default.isFunction(action))
21
- return undefined;
22
- const [, data] = await hook_1.default.run(action({
23
- ...self,
24
- commit: self.commit.bind(self),
25
- query: self.query.bind(self),
26
- dispatch: self.dispatch.bind(self),
27
- }, payload));
28
- return data;
29
- }
30
- /**
31
- * 查询
32
- * @param key 字段
33
- * @returns
34
- */
35
- async query(key) {
36
- const val = Reflect.get(this, key);
37
- let result = undefined;
38
- if (val !== null && val !== undefined && val !== '') {
39
- // result = JSON.parse(JSON.stringify(val));
40
- result = obj_1.default.copy(val);
41
- }
42
- else {
43
- const [, data] = await hook_1.default.exec(() => this.dispatch(key), `${this.__eventId}_${key}`);
44
- result = data;
45
- }
46
- return result;
47
- }
48
- /**
49
- * 提交
50
- * @param name 字段
51
- * @param payload 值
52
- */
53
- commit(name, payload) {
54
- if (is_1.default.isObject(payload)) {
55
- payload = obj_1.default.copy(payload);
56
- }
57
- this[name] = payload;
58
- }
59
- }
60
- exports.default = DStore;
61
- const storeRef = (source, persistConfig) => {
62
- const _initSource = Object.assign(new DStore(), source || {});
63
- _initSource.__persist = new persist_1.default(persistConfig || _initSource.persist);
64
- const _initData = _initSource.__persist.read();
65
- const _source = _initData ? Object.assign(_initSource, _initData) : _initSource;
66
- return new Proxy(_source, {
67
- get: (target, key, receiver) => {
68
- const getFunc = Reflect.get(target.getters, key);
69
- if (is_1.default.isFunction(getFunc))
70
- return getFunc(target);
71
- return Reflect.get(target, key, receiver);
72
- },
73
- set: (target, key, value, receiver) => {
74
- const setFunc = Reflect.get(target.setters, key);
75
- if (is_1.default.isFunction(setFunc) && !setFunc(target, value))
76
- return true;
77
- const ret = Reflect.set(target, key, value, receiver);
78
- if (ret) {
79
- target.emit(key.toString(), value);
80
- target?.__persist?.handleSave(target, key.toString());
81
- }
82
- return ret;
83
- },
84
- has: (target, key) => Reflect.has(target, key),
85
- });
86
- };
87
- exports.storeRef = storeRef;
@@ -1,125 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DTracker = exports.DTrack = void 0;
4
- const list_1 = require("../modules/list");
5
- const obj_1 = require("../modules/obj");
6
- const uuid_1 = require("../modules/crypto/uuid");
7
- const time_1 = require("../modules/time");
8
- class DTrack {
9
- id = "";
10
- /** 开始时间戳 */
11
- start = 0;
12
- /** 结束时间戳 */
13
- end = 0;
14
- /** 耗时 */
15
- cost = 0;
16
- name = "";
17
- type = "";
18
- desc = "";
19
- /** 开始时间描述 */
20
- timeStartDesc = "";
21
- /** 结束时间描述 */
22
- timeEndDesc = "";
23
- /** 是否完成 */
24
- isDone = false;
25
- /** 标志 0:默认,1:结束 */
26
- flag = 0;
27
- constructor() {
28
- this.id = (0, uuid_1.default)();
29
- this.start = Date.now();
30
- this.timeStartDesc = time_1.default.format(this.start, "hh:mm:ss.SSS");
31
- }
32
- /** 执行时间戳 */
33
- get time() {
34
- return this.flag ? this.end : this.start;
35
- }
36
- /** 执行时间描述 */
37
- get timeDesc() {
38
- return this.flag ? this.timeEndDesc : this.timeStartDesc;
39
- }
40
- done = (t = Date.now()) => {
41
- if (!this.start)
42
- return;
43
- this.end = t;
44
- this.cost = this.end - this.start;
45
- this.timeEndDesc = time_1.default.format(this.end, "hh:mm:ss.SSS");
46
- this.isDone = true;
47
- };
48
- }
49
- exports.DTrack = DTrack;
50
- class DTracker {
51
- __map = new Map();
52
- __trackList = [];
53
- opened = true;
54
- clear() {
55
- this.__map.clear();
56
- this.__trackList = [];
57
- return this;
58
- }
59
- add(name, { desc = "", type = "" } = {}) {
60
- if (!name || !this.opened)
61
- return "";
62
- const _track = new DTrack();
63
- _track.name = name;
64
- _track.type = type;
65
- _track.desc = desc;
66
- this.__trackList.push(_track);
67
- return _track.id;
68
- }
69
- done(id) {
70
- if (!id || !this.opened)
71
- return;
72
- const _track = this.__trackList.find(e => e.id === id);
73
- if (!_track || _track.isDone)
74
- return;
75
- _track.done();
76
- const endTrack = obj_1.default.cloneClass(_track); // Object.assign({}, _track);
77
- endTrack.id = this._endId(id);
78
- endTrack.flag = 1;
79
- endTrack.desc = `${_track.desc} | end`;
80
- this.__trackList.push(endTrack);
81
- }
82
- getTrack(id) {
83
- return this.__trackList.find(e => e.id === id);
84
- }
85
- getLine(id) {
86
- if (!id || id.endsWith("-end"))
87
- return [];
88
- const idx_s = this.__trackList.findIndex(e => e.id === id);
89
- if (idx_s < 0)
90
- return [];
91
- const endid = this._endId(id);
92
- const idx_e = this.__trackList.findIndex(e => e.id === endid);
93
- const count = idx_e < 0 ? this.__trackList.length - idx_s : idx_e - idx_s + 1;
94
- return list_1.default.take(this.__trackList, count, idx_s);
95
- }
96
- getList(name, id = "") {
97
- if (!name)
98
- return [];
99
- const _nameList = this.__trackList.filter(e => e.name === name);
100
- if (_nameList.length <= 0)
101
- return [];
102
- if (!id)
103
- return _nameList;
104
- const endid = this._endId(id);
105
- return this.__trackList.filter(e => e.id === id || e.id === endid);
106
- }
107
- get list() {
108
- return this.__trackList;
109
- }
110
- get size() {
111
- return this.__trackList.length;
112
- }
113
- _endId = (id) => `${id}-end`;
114
- report(cb) {
115
- // report(cb?: dd.Callback <[DTrack, number]>) {
116
- const arr = this.list;
117
- if (!arr || arr.length <= 0)
118
- return;
119
- const start = arr[0].time;
120
- arr.forEach((e) => cb && cb(e, start));
121
- }
122
- }
123
- exports.DTracker = DTracker;
124
- const tracker = new DTracker();
125
- exports.default = tracker;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DWatermark = void 0;
4
- const crypto_1 = require("../modules/crypto");
5
- const qs_1 = require("../modules/qs");
6
- class DWatermark {
7
- host = "";
8
- list = [];
9
- constructor(bg, size = {}) {
10
- this._parseHost(bg);
11
- const { width = 500, height = 400 } = size;
12
- const _kv = qs_1.default.parseUrl(bg)?.params || {};
13
- _kv["x-oss-process"] = `image/resize,w_${width},h_${height},m_fill`;
14
- const query = qs_1.default.stringify(_kv, { uri: false });
15
- this.list.push(`${bg}?${query}`);
16
- }
17
- _parseHost(url) {
18
- if (!url || this.host)
19
- return;
20
- if (/^http[s]?:\/\/([\w.]+)/.test(url)) {
21
- this.host = url.replace(/^http[s]?:\/\/([\w.]+)[\w\W]+/, "$1");
22
- }
23
- ;
24
- }
25
- /**
26
- * 图片
27
- * @param url
28
- * @param params
29
- * @returns
30
- */
31
- image(url, params = {}) {
32
- if (!url || !url.includes(this.host))
33
- return;
34
- if (this.list.length <= 0)
35
- return;
36
- const opts = { g: "nw", ...params };
37
- const link = url.replace(/^http[s]?:\/\/[\w.]+\/([\w-.,_/?%&=]+)$/, "$1");
38
- const watermark = crypto_1.default.base64.encodeByOss(link);
39
- const str = qs_1.default.stringify({ image: watermark, ...opts }, { sep: ",", eq: "_" });
40
- this.list.push(`/watermark,${str}`);
41
- }
42
- /**
43
- * 文本内容
44
- * @param content
45
- * @param params
46
- * @param iText
47
- * @returns
48
- */
49
- text(content, params = {}, iText = {}) {
50
- if (!content)
51
- return;
52
- const opts = { g: "nw", ...params };
53
- const watermark = crypto_1.default.base64.encodeByOss(content);
54
- const str = qs_1.default.stringify({ text: watermark, ...opts, ...iText, }, { sep: ",", eq: "_" });
55
- this.list.push(`/watermark,${str}`);
56
- }
57
- result() {
58
- return this.list.join("");
59
- }
60
- }
61
- exports.DWatermark = DWatermark;
62
- const watermark = (bg, size) => new DWatermark(bg, size);
63
- exports.default = watermark;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _root_1 = require("./_root");
4
- const Symbol = _root_1.default.Symbol;
5
- exports.default = Symbol;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** Detect free variable `global` from Node.js. */
4
- const freeGlobal = typeof global === 'object' && global !== null && global.Object === Object && global;
5
- exports.default = freeGlobal;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _Symbol_1 = require("./_Symbol");
4
- const { toString, hasOwnProperty, propertyIsEnumerable } = Object.prototype;
5
- /** Built-in value references. */
6
- const symToStringTag = _Symbol_1.default ? _Symbol_1.default.toStringTag : undefined;
7
- function getRawTag(value) {
8
- const isOwn = hasOwnProperty.call(value, symToStringTag);
9
- const tag = value[symToStringTag];
10
- let unmasked = false;
11
- try {
12
- value[symToStringTag] = undefined;
13
- unmasked = true;
14
- }
15
- catch (e) { }
16
- const result = toString.call(value);
17
- if (unmasked) {
18
- if (isOwn) {
19
- value[symToStringTag] = tag;
20
- }
21
- else {
22
- delete value[symToStringTag];
23
- }
24
- }
25
- return result;
26
- }
27
- function getTag(value) {
28
- if (value == null) {
29
- return value === undefined ? "[object Undefined]" : "[object Null]";
30
- }
31
- return (symToStringTag && symToStringTag in Object(value))
32
- ? getRawTag(value)
33
- : toString.call(value);
34
- }
35
- function getType(value) {
36
- let str = getTag(value);
37
- const mat = str.match(/\w+/g) || ["object", "Undefined"];
38
- return mat[1] || "";
39
- }
40
- exports.default = { getTag, getType, toString, hasOwnProperty, propertyIsEnumerable };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _freeGlobal_1 = require("./_freeGlobal");
4
- /** Detect free variable `globalThis` */
5
- const freeGlobalThis = typeof globalThis === 'object' && globalThis !== null && globalThis.Object === Object && globalThis;
6
- /** Detect free variable `self`. */
7
- const freeSelf = typeof self === 'object' && self !== null && self.Object === Object && self;
8
- /** Used as a reference to the global object. */
9
- const root = freeGlobalThis || _freeGlobal_1.default || freeSelf || Function('return this')();
10
- exports.default = root;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Converts an ASCII `string` to an array.
5
- *
6
- * @private
7
- * @param {string} string The string to convert.
8
- * @returns {Array} Returns the converted array.
9
- */
10
- function asciiToArray(string) {
11
- return string.split('');
12
- }
13
- exports.default = asciiToArray;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const slice_1 = require("./slice");
4
- /**
5
- * Casts `array` to a slice if it's needed.
6
- *
7
- * @private
8
- * @param {Array} array The array to inspect.
9
- * @param {number} start The start position.
10
- * @param {number} [end=array.length] The end position.
11
- * @returns {Array} Returns the cast slice.
12
- */
13
- function castSlice(array, start, end) {
14
- const { length } = array;
15
- end = end === undefined ? length : end;
16
- return (!start && end >= length) ? array : (0, slice_1.default)(array, start, end);
17
- }
18
- exports.default = castSlice;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const castSlice_1 = require("./castSlice");
4
- const hasUnicode_1 = require("./hasUnicode");
5
- const stringToArray_1 = require("./stringToArray");
6
- /**
7
- * Creates a function like `lowerFirst`.
8
- *
9
- * @private
10
- * @param {string} methodName The name of the `String` case method to use.
11
- * @returns {Function} Returns the new case function.
12
- */
13
- function createCaseFirst(methodName) {
14
- return (string) => {
15
- if (!string) {
16
- return '';
17
- }
18
- const strSymbols = (0, hasUnicode_1.default)(string)
19
- ? (0, stringToArray_1.default)(string)
20
- : undefined;
21
- const chr = strSymbols
22
- ? strSymbols[0]
23
- : string[0];
24
- const trailing = strSymbols
25
- ? (0, castSlice_1.default)(strSymbols, 1).join('')
26
- : string.slice(1);
27
- return chr[methodName]() + trailing;
28
- };
29
- }
30
- exports.default = createCaseFirst;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** Used to compose unicode character classes. */
4
- const rsAstralRange = '\\ud800-\\udfff';
5
- const rsComboMarksRange = '\\u0300-\\u036f';
6
- const reComboHalfMarksRange = '\\ufe20-\\ufe2f';
7
- const rsComboSymbolsRange = '\\u20d0-\\u20ff';
8
- const rsComboMarksExtendedRange = '\\u1ab0-\\u1aff';
9
- const rsComboMarksSupplementRange = '\\u1dc0-\\u1dff';
10
- const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange;
11
- const rsVarRange = '\\ufe0e\\ufe0f';
12
- /** Used to compose unicode capture groups. */
13
- const rsZWJ = '\\u200d';
14
- /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
15
- const reHasUnicode = RegExp(`[${rsZWJ + rsAstralRange + rsComboRange + rsVarRange}]`);
16
- /**
17
- * Checks if `string` contains Unicode symbols.
18
- *
19
- * @private
20
- * @param {string} string The string to inspect.
21
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
22
- */
23
- function hasUnicode(string) {
24
- return reHasUnicode.test(string);
25
- }
26
- exports.default = hasUnicode;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _freeGlobal_1 = require("../_freeGlobal");
4
- /** Detect free variable `exports`. */
5
- const freeExports = typeof exports === 'object' && exports !== null && !exports.nodeType && exports;
6
- /** Detect free variable `module`. */
7
- // @ts-ignore
8
- const freeModule = freeExports && typeof module === 'object' && module !== null && !module.nodeType && module;
9
- /** Detect the popular CommonJS extension `module.exports`. */
10
- const moduleExports = freeModule && freeModule.exports === freeExports;
11
- /** Detect free variable `process` from Node.js. */
12
- const freeProcess = moduleExports && _freeGlobal_1.default.process;
13
- /** Used to access faster Node.js helpers. */
14
- const nodeTypes = ((() => {
15
- try {
16
- /* Detect public `util.types` helpers for Node.js v10+. */
17
- /* Node.js deprecation code: DEP0103. */
18
- const typesHelper = freeModule && freeModule.require && freeModule.require('util').types;
19
- return typesHelper
20
- ? typesHelper
21
- /* Legacy process.binding('util') for Node.js earlier than v10. */
22
- : freeProcess && freeProcess.binding && freeProcess.binding('util');
23
- }
24
- catch (e) { }
25
- })());
26
- exports.default = nodeTypes;