@m4l/gclick 0.0.2 → 0.1.0
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/@types/types.d.ts +15 -7
- package/components/GaugeCircular/GaugeCircular.d.ts +8 -0
- package/components/GaugeCircular/GaugeCircular.js +30 -0
- package/components/GaugeCircular/GaugeCircular.styles.d.ts +2 -0
- package/components/GaugeCircular/GaugeCircular.styles.js +52 -0
- package/components/GaugeCircular/constants.d.ts +2 -0
- package/components/GaugeCircular/constants.js +8 -0
- package/components/GaugeCircular/index.d.ts +1 -0
- package/components/GaugeCircular/slots/GaugeCircularEnum.d.ts +5 -0
- package/components/GaugeCircular/slots/GaugeCircularEnum.js +9 -0
- package/components/GaugeCircular/slots/GaugeCircularSlots.d.ts +3 -0
- package/components/GaugeCircular/slots/GaugeCircularSlots.js +21 -0
- package/components/GaugeCircular/subcomponents/CircularProgress/CircularProgress.d.ts +8 -0
- package/components/GaugeCircular/subcomponents/CircularProgress/CircularProgress.js +44 -0
- package/components/GaugeCircular/subcomponents/CircularProgress/constants.d.ts +2 -0
- package/components/GaugeCircular/subcomponents/CircularProgress/constants.js +6 -0
- package/components/GaugeCircular/subcomponents/CircularProgress/index.d.ts +1 -0
- package/components/GaugeCircular/test/GaugeCircular.test.d.ts +1 -0
- package/components/GaugeCircular/types.d.ts +25 -0
- package/components/index.d.ts +1 -1
- package/components/indicators/IndicatorBattery/IndicatorBattery.d.ts +7 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.js +102 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.styles.d.ts +2 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.styles.js +110 -0
- package/components/indicators/IndicatorBattery/constants.d.ts +2 -0
- package/components/indicators/IndicatorBattery/constants.js +8 -0
- package/components/indicators/IndicatorBattery/dictionary.d.ts +14 -0
- package/components/indicators/IndicatorBattery/dictionary.js +16 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/constants.d.ts +9 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/constants.js +35 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/test/useBattery.test.d.ts +1 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/types.d.ts +38 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/useBatteryStatus.d.ts +7 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/useBatteryStatus.js +68 -0
- package/components/indicators/IndicatorBattery/icons.d.ts +4 -0
- package/components/indicators/IndicatorBattery/icons.js +7 -0
- package/components/indicators/IndicatorBattery/index.d.ts +1 -0
- package/components/indicators/IndicatorBattery/index.js +1 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBaterySlots.d.ts +27 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBaterySlots.js +52 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBatteryEnum.d.ts +11 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBatteryEnum.js +15 -0
- package/components/indicators/IndicatorBattery/test/IndicatorBattery.test.d.ts +1 -0
- package/components/indicators/IndicatorBattery/types.d.ts +69 -0
- package/components/indicators/IndicatorCSQ/IndicatorCSQ.js +21 -0
- package/components/indicators/IndicatorCSQ/IndicatorCSQ.styles.js +70 -0
- package/components/indicators/IndicatorCSQ/constants.js +7 -0
- package/components/indicators/IndicatorCSQ/dictionary.js +16 -0
- package/components/indicators/IndicatorCSQ/helpers/getQualityLabel/getQualityLabel.js +43 -0
- package/components/indicators/IndicatorCSQ/index.js +1 -0
- package/components/indicators/IndicatorCSQ/slots/IndicatorCSQEnum.js +11 -0
- package/components/indicators/IndicatorCSQ/slots/IndicatorCSQSlots.js +32 -0
- package/components/indicators/IndicatorCSQ/subcomponents/SignalIcon/SignalIcon.js +19 -0
- package/components/indicators/IndicatorCSQ/subcomponents/SignalIcon/index.js +1 -0
- package/components/indicators/IndicatorValueStatus/IndicatorValueStatus.d.ts +7 -0
- package/components/indicators/IndicatorValueStatus/IndicatorValueStatus.styles.d.ts +2 -0
- package/components/indicators/IndicatorValueStatus/constants.d.ts +2 -0
- package/components/indicators/IndicatorValueStatus/index.d.ts +1 -0
- package/components/indicators/IndicatorValueStatus/slots/IndicatorValueStatusEnum.d.ts +7 -0
- package/components/indicators/IndicatorValueStatus/slots/IndicatorValueStatusSlots.d.ts +15 -0
- package/components/indicators/IndicatorValueStatus/test/DemoFormatter.d.ts +11 -0
- package/components/indicators/IndicatorValueStatus/test/IndicatorValueStatus.test.d.ts +1 -0
- package/components/indicators/IndicatorValueStatus/types.d.ts +40 -0
- package/components/indicators/index.d.ts +2 -0
- package/components/indicators/index.js +1 -0
- package/contexts/RealTimeProducerContext/sourceDataMechanisms/athmospherejs/index.js +1 -1
- package/index.js +18 -14
- package/mockServiceWorker.js +1 -1
- package/package.json +29 -24
- package/.storybook/constants.d.ts +0 -30
- package/.storybook/decorators/StorybookWithMapProvider/constants.d.ts +0 -2
- package/.storybook/decorators/StorybookWithMapProvider/index.d.ts +0 -1
- package/.storybook/decorators/WithContexts/constants.d.ts +0 -10
- package/.storybook/decorators/WithContexts/index.d.ts +0 -1
- package/.storybook/decorators/WithContexts/types.d.ts +0 -7
- package/.storybook/decorators/WithWindowsContainer/index.d.ts +0 -2
- package/.storybook/decorators/WithWindowsContainer/subcomponents/WindowsContainer/index.d.ts +0 -1
- package/.storybook/decorators/WithWindowsContainer/subcomponents/WindowsContainer/types.d.ts +0 -4
- package/.storybook/main.d.ts +0 -3
- package/.storybook/mocks/config-msw.d.ts +0 -21
- package/.storybook/mocks/index.d.ts +0 -2
- package/.storybook/mocks/network-mocks.d.ts +0 -1
- package/.storybook/storybook.vite.d.ts +0 -2
- package/components/gauges/Gauge/Gauge.d.ts +0 -22
- package/components/gauges/Gauge/Gauge.js +0 -25
- package/components/gauges/Gauge/Gauge.styles.d.ts +0 -2
- package/components/gauges/Gauge/Gauge.styles.js +0 -9
- package/components/gauges/Gauge/constants.d.ts +0 -2
- package/components/gauges/Gauge/constants.js +0 -8
- package/components/gauges/Gauge/index.d.ts +0 -1
- package/components/gauges/Gauge/slots/GaugeEnum.d.ts +0 -3
- package/components/gauges/Gauge/slots/GaugeEnum.js +0 -7
- package/components/gauges/Gauge/slots/GaugeSlots.d.ts +0 -3
- package/components/gauges/Gauge/slots/GaugeSlots.js +0 -12
- package/components/gauges/Gauge/types.d.ts +0 -16
- package/components/gauges/index.d.ts +0 -1
- package/not_recognized/index.js +0 -406
- /package/components/{gauges/Gauge → GaugeCircular}/index.js +0 -0
- /package/components/{gauges → GaugeCircular/subcomponents/CircularProgress}/index.js +0 -0
package/not_recognized/index.js
DELETED
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
const isObject$1 = (value) => typeof value === "object" && value !== null;
|
|
2
|
-
const isObjectCustom = (value) => isObject$1(value) && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
|
|
3
|
-
const mapObjectSkip = Symbol("mapObjectSkip");
|
|
4
|
-
const _mapObject = (object, mapper, options, isSeen = /* @__PURE__ */ new WeakMap()) => {
|
|
5
|
-
options = {
|
|
6
|
-
deep: false,
|
|
7
|
-
target: {},
|
|
8
|
-
...options
|
|
9
|
-
};
|
|
10
|
-
if (isSeen.has(object)) {
|
|
11
|
-
return isSeen.get(object);
|
|
12
|
-
}
|
|
13
|
-
isSeen.set(object, options.target);
|
|
14
|
-
const { target } = options;
|
|
15
|
-
delete options.target;
|
|
16
|
-
const mapArray = (array) => array.map((element) => isObjectCustom(element) ? _mapObject(element, mapper, options, isSeen) : element);
|
|
17
|
-
if (Array.isArray(object)) {
|
|
18
|
-
return mapArray(object);
|
|
19
|
-
}
|
|
20
|
-
for (const [key, value] of Object.entries(object)) {
|
|
21
|
-
const mapResult = mapper(key, value, object);
|
|
22
|
-
if (mapResult === mapObjectSkip) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
let [newKey, newValue, { shouldRecurse = true } = {}] = mapResult;
|
|
26
|
-
if (newKey === "__proto__") {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (options.deep && shouldRecurse && isObjectCustom(newValue)) {
|
|
30
|
-
newValue = Array.isArray(newValue) ? mapArray(newValue) : _mapObject(newValue, mapper, options, isSeen);
|
|
31
|
-
}
|
|
32
|
-
target[newKey] = newValue;
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
|
-
function mapObject(object, mapper, options) {
|
|
37
|
-
if (!isObject$1(object)) {
|
|
38
|
-
throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
|
|
39
|
-
}
|
|
40
|
-
return _mapObject(object, mapper, options);
|
|
41
|
-
}
|
|
42
|
-
const UPPERCASE = /[\p{Lu}]/u;
|
|
43
|
-
const LOWERCASE = /[\p{Ll}]/u;
|
|
44
|
-
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
45
|
-
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
46
|
-
const SEPARATORS = /[_.\- ]+/;
|
|
47
|
-
const LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
48
|
-
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
49
|
-
const NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
50
|
-
const preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
|
51
|
-
let isLastCharLower = false;
|
|
52
|
-
let isLastCharUpper = false;
|
|
53
|
-
let isLastLastCharUpper = false;
|
|
54
|
-
let isLastLastCharPreserved = false;
|
|
55
|
-
for (let index = 0; index < string.length; index++) {
|
|
56
|
-
const character = string[index];
|
|
57
|
-
isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
|
|
58
|
-
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
59
|
-
string = string.slice(0, index) + "-" + string.slice(index);
|
|
60
|
-
isLastCharLower = false;
|
|
61
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
62
|
-
isLastCharUpper = true;
|
|
63
|
-
index++;
|
|
64
|
-
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
|
65
|
-
string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
|
|
66
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
67
|
-
isLastCharUpper = false;
|
|
68
|
-
isLastCharLower = true;
|
|
69
|
-
} else {
|
|
70
|
-
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
71
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
72
|
-
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return string;
|
|
76
|
-
};
|
|
77
|
-
const preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
78
|
-
LEADING_CAPITAL.lastIndex = 0;
|
|
79
|
-
return input.replaceAll(LEADING_CAPITAL, (match) => toLowerCase(match));
|
|
80
|
-
};
|
|
81
|
-
const postProcess = (input, toUpperCase) => {
|
|
82
|
-
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
83
|
-
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
84
|
-
return input.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
85
|
-
};
|
|
86
|
-
function camelCase(input, options) {
|
|
87
|
-
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
88
|
-
throw new TypeError("Expected the input to be `string | string[]`");
|
|
89
|
-
}
|
|
90
|
-
options = {
|
|
91
|
-
pascalCase: false,
|
|
92
|
-
preserveConsecutiveUppercase: false,
|
|
93
|
-
...options
|
|
94
|
-
};
|
|
95
|
-
if (Array.isArray(input)) {
|
|
96
|
-
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
97
|
-
} else {
|
|
98
|
-
input = input.trim();
|
|
99
|
-
}
|
|
100
|
-
if (input.length === 0) {
|
|
101
|
-
return "";
|
|
102
|
-
}
|
|
103
|
-
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
104
|
-
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
105
|
-
if (input.length === 1) {
|
|
106
|
-
if (SEPARATORS.test(input)) {
|
|
107
|
-
return "";
|
|
108
|
-
}
|
|
109
|
-
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
110
|
-
}
|
|
111
|
-
const hasUpperCase = input !== toLowerCase(input);
|
|
112
|
-
if (hasUpperCase) {
|
|
113
|
-
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
114
|
-
}
|
|
115
|
-
input = input.replace(LEADING_SEPARATORS, "");
|
|
116
|
-
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
117
|
-
if (options.pascalCase) {
|
|
118
|
-
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
119
|
-
}
|
|
120
|
-
return postProcess(input, toUpperCase);
|
|
121
|
-
}
|
|
122
|
-
class QuickLRU extends Map {
|
|
123
|
-
constructor(options = {}) {
|
|
124
|
-
super();
|
|
125
|
-
if (!(options.maxSize && options.maxSize > 0)) {
|
|
126
|
-
throw new TypeError("`maxSize` must be a number greater than 0");
|
|
127
|
-
}
|
|
128
|
-
if (typeof options.maxAge === "number" && options.maxAge === 0) {
|
|
129
|
-
throw new TypeError("`maxAge` must be a number greater than 0");
|
|
130
|
-
}
|
|
131
|
-
this.maxSize = options.maxSize;
|
|
132
|
-
this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
|
|
133
|
-
this.onEviction = options.onEviction;
|
|
134
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
135
|
-
this.oldCache = /* @__PURE__ */ new Map();
|
|
136
|
-
this._size = 0;
|
|
137
|
-
}
|
|
138
|
-
// TODO: Use private class methods when targeting Node.js 16.
|
|
139
|
-
_emitEvictions(cache2) {
|
|
140
|
-
if (typeof this.onEviction !== "function") {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
for (const [key, item] of cache2) {
|
|
144
|
-
this.onEviction(key, item.value);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
_deleteIfExpired(key, item) {
|
|
148
|
-
if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
|
|
149
|
-
if (typeof this.onEviction === "function") {
|
|
150
|
-
this.onEviction(key, item.value);
|
|
151
|
-
}
|
|
152
|
-
return this.delete(key);
|
|
153
|
-
}
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
_getOrDeleteIfExpired(key, item) {
|
|
157
|
-
const deleted = this._deleteIfExpired(key, item);
|
|
158
|
-
if (deleted === false) {
|
|
159
|
-
return item.value;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
_getItemValue(key, item) {
|
|
163
|
-
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
|
|
164
|
-
}
|
|
165
|
-
_peek(key, cache2) {
|
|
166
|
-
const item = cache2.get(key);
|
|
167
|
-
return this._getItemValue(key, item);
|
|
168
|
-
}
|
|
169
|
-
_set(key, value) {
|
|
170
|
-
this.cache.set(key, value);
|
|
171
|
-
this._size++;
|
|
172
|
-
if (this._size >= this.maxSize) {
|
|
173
|
-
this._size = 0;
|
|
174
|
-
this._emitEvictions(this.oldCache);
|
|
175
|
-
this.oldCache = this.cache;
|
|
176
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
_moveToRecent(key, item) {
|
|
180
|
-
this.oldCache.delete(key);
|
|
181
|
-
this._set(key, item);
|
|
182
|
-
}
|
|
183
|
-
*_entriesAscending() {
|
|
184
|
-
for (const item of this.oldCache) {
|
|
185
|
-
const [key, value] = item;
|
|
186
|
-
if (!this.cache.has(key)) {
|
|
187
|
-
const deleted = this._deleteIfExpired(key, value);
|
|
188
|
-
if (deleted === false) {
|
|
189
|
-
yield item;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
for (const item of this.cache) {
|
|
194
|
-
const [key, value] = item;
|
|
195
|
-
const deleted = this._deleteIfExpired(key, value);
|
|
196
|
-
if (deleted === false) {
|
|
197
|
-
yield item;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
get(key) {
|
|
202
|
-
if (this.cache.has(key)) {
|
|
203
|
-
const item = this.cache.get(key);
|
|
204
|
-
return this._getItemValue(key, item);
|
|
205
|
-
}
|
|
206
|
-
if (this.oldCache.has(key)) {
|
|
207
|
-
const item = this.oldCache.get(key);
|
|
208
|
-
if (this._deleteIfExpired(key, item) === false) {
|
|
209
|
-
this._moveToRecent(key, item);
|
|
210
|
-
return item.value;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
set(key, value, { maxAge = this.maxAge } = {}) {
|
|
215
|
-
const expiry = typeof maxAge === "number" && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : void 0;
|
|
216
|
-
if (this.cache.has(key)) {
|
|
217
|
-
this.cache.set(key, {
|
|
218
|
-
value,
|
|
219
|
-
expiry
|
|
220
|
-
});
|
|
221
|
-
} else {
|
|
222
|
-
this._set(key, { value, expiry });
|
|
223
|
-
}
|
|
224
|
-
return this;
|
|
225
|
-
}
|
|
226
|
-
has(key) {
|
|
227
|
-
if (this.cache.has(key)) {
|
|
228
|
-
return !this._deleteIfExpired(key, this.cache.get(key));
|
|
229
|
-
}
|
|
230
|
-
if (this.oldCache.has(key)) {
|
|
231
|
-
return !this._deleteIfExpired(key, this.oldCache.get(key));
|
|
232
|
-
}
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
peek(key) {
|
|
236
|
-
if (this.cache.has(key)) {
|
|
237
|
-
return this._peek(key, this.cache);
|
|
238
|
-
}
|
|
239
|
-
if (this.oldCache.has(key)) {
|
|
240
|
-
return this._peek(key, this.oldCache);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
delete(key) {
|
|
244
|
-
const deleted = this.cache.delete(key);
|
|
245
|
-
if (deleted) {
|
|
246
|
-
this._size--;
|
|
247
|
-
}
|
|
248
|
-
return this.oldCache.delete(key) || deleted;
|
|
249
|
-
}
|
|
250
|
-
clear() {
|
|
251
|
-
this.cache.clear();
|
|
252
|
-
this.oldCache.clear();
|
|
253
|
-
this._size = 0;
|
|
254
|
-
}
|
|
255
|
-
resize(newSize) {
|
|
256
|
-
if (!(newSize && newSize > 0)) {
|
|
257
|
-
throw new TypeError("`maxSize` must be a number greater than 0");
|
|
258
|
-
}
|
|
259
|
-
const items = [...this._entriesAscending()];
|
|
260
|
-
const removeCount = items.length - newSize;
|
|
261
|
-
if (removeCount < 0) {
|
|
262
|
-
this.cache = new Map(items);
|
|
263
|
-
this.oldCache = /* @__PURE__ */ new Map();
|
|
264
|
-
this._size = items.length;
|
|
265
|
-
} else {
|
|
266
|
-
if (removeCount > 0) {
|
|
267
|
-
this._emitEvictions(items.slice(0, removeCount));
|
|
268
|
-
}
|
|
269
|
-
this.oldCache = new Map(items.slice(removeCount));
|
|
270
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
271
|
-
this._size = 0;
|
|
272
|
-
}
|
|
273
|
-
this.maxSize = newSize;
|
|
274
|
-
}
|
|
275
|
-
*keys() {
|
|
276
|
-
for (const [key] of this) {
|
|
277
|
-
yield key;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
*values() {
|
|
281
|
-
for (const [, value] of this) {
|
|
282
|
-
yield value;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
*[Symbol.iterator]() {
|
|
286
|
-
for (const item of this.cache) {
|
|
287
|
-
const [key, value] = item;
|
|
288
|
-
const deleted = this._deleteIfExpired(key, value);
|
|
289
|
-
if (deleted === false) {
|
|
290
|
-
yield [key, value.value];
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
for (const item of this.oldCache) {
|
|
294
|
-
const [key, value] = item;
|
|
295
|
-
if (!this.cache.has(key)) {
|
|
296
|
-
const deleted = this._deleteIfExpired(key, value);
|
|
297
|
-
if (deleted === false) {
|
|
298
|
-
yield [key, value.value];
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
*entriesDescending() {
|
|
304
|
-
let items = [...this.cache];
|
|
305
|
-
for (let i = items.length - 1; i >= 0; --i) {
|
|
306
|
-
const item = items[i];
|
|
307
|
-
const [key, value] = item;
|
|
308
|
-
const deleted = this._deleteIfExpired(key, value);
|
|
309
|
-
if (deleted === false) {
|
|
310
|
-
yield [key, value.value];
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
items = [...this.oldCache];
|
|
314
|
-
for (let i = items.length - 1; i >= 0; --i) {
|
|
315
|
-
const item = items[i];
|
|
316
|
-
const [key, value] = item;
|
|
317
|
-
if (!this.cache.has(key)) {
|
|
318
|
-
const deleted = this._deleteIfExpired(key, value);
|
|
319
|
-
if (deleted === false) {
|
|
320
|
-
yield [key, value.value];
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
*entriesAscending() {
|
|
326
|
-
for (const [key, value] of this._entriesAscending()) {
|
|
327
|
-
yield [key, value.value];
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
get size() {
|
|
331
|
-
if (!this._size) {
|
|
332
|
-
return this.oldCache.size;
|
|
333
|
-
}
|
|
334
|
-
let oldCacheSize = 0;
|
|
335
|
-
for (const key of this.oldCache.keys()) {
|
|
336
|
-
if (!this.cache.has(key)) {
|
|
337
|
-
oldCacheSize++;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return Math.min(this._size + oldCacheSize, this.maxSize);
|
|
341
|
-
}
|
|
342
|
-
entries() {
|
|
343
|
-
return this.entriesAscending();
|
|
344
|
-
}
|
|
345
|
-
forEach(callbackFunction, thisArgument = this) {
|
|
346
|
-
for (const [key, value] of this.entriesAscending()) {
|
|
347
|
-
callbackFunction.call(thisArgument, value, key, this);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
get [Symbol.toStringTag]() {
|
|
351
|
-
return JSON.stringify([...this.entriesAscending()]);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
const has = (array, key) => array.some((element) => {
|
|
355
|
-
if (typeof element === "string") {
|
|
356
|
-
return element === key;
|
|
357
|
-
}
|
|
358
|
-
element.lastIndex = 0;
|
|
359
|
-
return element.test(key);
|
|
360
|
-
});
|
|
361
|
-
const cache = new QuickLRU({ maxSize: 1e5 });
|
|
362
|
-
const isObject = (value) => typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Error) && !(value instanceof Date);
|
|
363
|
-
const transform = (input, options = {}) => {
|
|
364
|
-
if (!isObject(input)) {
|
|
365
|
-
return input;
|
|
366
|
-
}
|
|
367
|
-
const {
|
|
368
|
-
exclude,
|
|
369
|
-
pascalCase = false,
|
|
370
|
-
stopPaths,
|
|
371
|
-
deep = false,
|
|
372
|
-
preserveConsecutiveUppercase: preserveConsecutiveUppercase2 = false
|
|
373
|
-
} = options;
|
|
374
|
-
const stopPathsSet = new Set(stopPaths);
|
|
375
|
-
const makeMapper = (parentPath) => (key, value) => {
|
|
376
|
-
if (deep && isObject(value)) {
|
|
377
|
-
const path = parentPath === void 0 ? key : `${parentPath}.${key}`;
|
|
378
|
-
if (!stopPathsSet.has(path)) {
|
|
379
|
-
value = mapObject(value, makeMapper(path));
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
if (!(exclude && has(exclude, key))) {
|
|
383
|
-
const cacheKey = pascalCase ? `${key}_` : key;
|
|
384
|
-
if (cache.has(cacheKey)) {
|
|
385
|
-
key = cache.get(cacheKey);
|
|
386
|
-
} else {
|
|
387
|
-
const returnValue = camelCase(key, { pascalCase, locale: false, preserveConsecutiveUppercase: preserveConsecutiveUppercase2 });
|
|
388
|
-
if (key.length < 100) {
|
|
389
|
-
cache.set(cacheKey, returnValue);
|
|
390
|
-
}
|
|
391
|
-
key = returnValue;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
return [key, value];
|
|
395
|
-
};
|
|
396
|
-
return mapObject(input, makeMapper(void 0));
|
|
397
|
-
};
|
|
398
|
-
function camelcaseKeys(input, options) {
|
|
399
|
-
if (Array.isArray(input)) {
|
|
400
|
-
return Object.keys(input).map((key) => transform(input[key], options));
|
|
401
|
-
}
|
|
402
|
-
return transform(input, options);
|
|
403
|
-
}
|
|
404
|
-
export {
|
|
405
|
-
camelcaseKeys as c
|
|
406
|
-
};
|
|
File without changes
|
|
File without changes
|