verce-vue-test 0.0.40 → 0.0.42
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/package.json +1 -1
- package/src/router/index.ts +0 -1
- package/src/utils/homeBalance.ts +415 -0
- package/src/views/HomeView.vue +102 -46
- package/mini2.0-main 2/.editorconfig +0 -8
- package/mini2.0-main 2/.env.development +0 -3
- package/mini2.0-main 2/.env.production +0 -3
- package/mini2.0-main 2/.env.test +0 -3
- package/mini2.0-main 2/.gitattributes +0 -1
- package/mini2.0-main 2/.oxlintrc.json +0 -10
- package/mini2.0-main 2/.prettierrc.json +0 -6
- package/mini2.0-main 2/.vscode/extensions.json +0 -9
- package/mini2.0-main 2/README.md +0 -179
- package/mini2.0-main 2/auto-imports.d.ts +0 -629
- package/mini2.0-main 2/components.d.ts +0 -21
- package/mini2.0-main 2/docs/MX_API.md +0 -244
- package/mini2.0-main 2/docs/REQUEST.md +0 -217
- package/mini2.0-main 2/docs/jsapi.js +0 -515
- package/mini2.0-main 2/docs/package-json-guide.md +0 -132
- package/mini2.0-main 2/env.d.ts +0 -13
- package/mini2.0-main 2/eslint.config.ts +0 -26
- package/mini2.0-main 2/index.html +0 -16
- package/mini2.0-main 2/package-lock.json +0 -6442
- package/mini2.0-main 2/package.json +0 -66
- package/mini2.0-main 2/plugins/bump-version.ts +0 -61
- package/mini2.0-main 2/postcss.config.ts +0 -15
- package/mini2.0-main 2/public/favicon.ico +0 -0
- package/mini2.0-main 2/public/images/12a73787-86a9-4891-a65f-66104746f6a8.png +0 -0
- package/mini2.0-main 2/public/images/5798d7aa-ba8b-4605-8079-58b35495ac55.png +0 -0
- package/mini2.0-main 2/public/images/73fef1e4-0fd0-4a1a-9b8b-a70a5b6acbbc.png +0 -0
- package/mini2.0-main 2/public/images/bc685b4c-0cca-4a79-924c-a8ee10e6f8eb.png +0 -0
- package/mini2.0-main 2/public/images/c3dbbd9d-be56-490e-b9f4-6ee17ebefffc.png +0 -0
- package/mini2.0-main 2/public/images/ea745a10-42aa-4f44-8d7f-3ab02cc0adcd.png +0 -0
- package/mini2.0-main 2/public/images/f5876785-b927-4347-ba19-999114240649.png +0 -0
- package/mini2.0-main 2/public/images/img.png +0 -0
- package/mini2.0-main 2/src/App.vue +0 -11
- package/mini2.0-main 2/src/api/user.ts +0 -33
- package/mini2.0-main 2/src/auto-imports.d.ts +0 -639
- package/mini2.0-main 2/src/components.d.ts +0 -23
- package/mini2.0-main 2/src/config/config.properties +0 -3
- package/mini2.0-main 2/src/config/env.ts +0 -6
- package/mini2.0-main 2/src/config/plugin.properties.pro +0 -6
- package/mini2.0-main 2/src/config/plugin.properties.test +0 -6
- package/mini2.0-main 2/src/core/mxApi/index.ts +0 -217
- package/mini2.0-main 2/src/core/request/index.ts +0 -42
- package/mini2.0-main 2/src/main.ts +0 -28
- package/mini2.0-main 2/src/router/index.ts +0 -70
- package/mini2.0-main 2/src/stores/app.ts +0 -24
- package/mini2.0-main 2/src/stores/counter.ts +0 -12
- package/mini2.0-main 2/src/stores/user.ts +0 -52
- package/mini2.0-main 2/src/types/api.d.ts +0 -14
- package/mini2.0-main 2/src/types/nprogress.d.ts +0 -8
- package/mini2.0-main 2/src/utils/query.ts +0 -27
- package/mini2.0-main 2/src/utils/request.ts +0 -159
- package/mini2.0-main 2/src/views/clearing-detail/index.vue +0 -49
- package/mini2.0-main 2/src/views/foreign-position/index.vue +0 -49
- package/mini2.0-main 2/src/views/home/index.vue +0 -201
- package/mini2.0-main 2/src/views/login/index.vue +0 -196
- package/mini2.0-main 2/src/views/net-debit/index.vue +0 -49
- package/mini2.0-main 2/src/views/pbc-position/index.vue +0 -49
- package/mini2.0-main 2/src/views/position-estimate/index.vue +0 -49
- package/mini2.0-main 2/src/views/rmb-position/index.vue +0 -49
- package/mini2.0-main 2/src/views/warning/index.vue +0 -49
- package/mini2.0-main 2/tsconfig.app.json +0 -18
- package/mini2.0-main 2/tsconfig.json +0 -11
- package/mini2.0-main 2/tsconfig.node.json +0 -28
- package/mini2.0-main 2/vite.config.ts +0 -69
package/package.json
CHANGED
package/src/router/index.ts
CHANGED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
export type HomeBalanceFieldConfig = {
|
|
2
|
+
id: string
|
|
3
|
+
title?: string
|
|
4
|
+
unit: string
|
|
5
|
+
keys: string[]
|
|
6
|
+
currencyCodes?: string[]
|
|
7
|
+
amountKeys?: string[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type NormalizedHomeBalance = {
|
|
11
|
+
id: string
|
|
12
|
+
title?: string
|
|
13
|
+
unit: string
|
|
14
|
+
amount: string
|
|
15
|
+
decimal: string
|
|
16
|
+
rawValue?: unknown
|
|
17
|
+
sourceKey?: string
|
|
18
|
+
found: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type HomeBalanceTarget = {
|
|
22
|
+
id: string
|
|
23
|
+
amount: string
|
|
24
|
+
decimal: string
|
|
25
|
+
unit: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type NormalizeHomeBalanceOptions = {
|
|
29
|
+
fields?: HomeBalanceFieldConfig[]
|
|
30
|
+
fractionDigits?: number
|
|
31
|
+
preserveWhenMissing?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DEFAULT_AMOUNT_KEYS = [
|
|
35
|
+
'mainAcctAmt',
|
|
36
|
+
'mainAcctAmount',
|
|
37
|
+
'mainAccountAmt',
|
|
38
|
+
'mainAccountAmount',
|
|
39
|
+
'acctAmt',
|
|
40
|
+
'accountAmt',
|
|
41
|
+
'accountAmount',
|
|
42
|
+
'availableBalance',
|
|
43
|
+
'balanceAmount',
|
|
44
|
+
'availableAmt',
|
|
45
|
+
'availableAmount',
|
|
46
|
+
'amount',
|
|
47
|
+
'amt',
|
|
48
|
+
'balance',
|
|
49
|
+
'value',
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
export const DEFAULT_HOME_BALANCE_FIELDS: HomeBalanceFieldConfig[] = [
|
|
53
|
+
{
|
|
54
|
+
id: 'rmb',
|
|
55
|
+
title: '人民币',
|
|
56
|
+
unit: 'CNY',
|
|
57
|
+
currencyCodes: ['CNY', 'RMB', '人民币'],
|
|
58
|
+
keys: [
|
|
59
|
+
'body.balanceAmount',
|
|
60
|
+
'body.availableBalance',
|
|
61
|
+
'balanceAmount',
|
|
62
|
+
'availableBalance',
|
|
63
|
+
'rmbAmount',
|
|
64
|
+
'rmbBalance',
|
|
65
|
+
'cnyAmount',
|
|
66
|
+
'cnyBalance',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'usd',
|
|
71
|
+
title: '美元',
|
|
72
|
+
unit: 'USD',
|
|
73
|
+
currencyCodes: ['USD', '美元'],
|
|
74
|
+
keys: ['usdAmount', 'usdBalance', 'usdAvailableBalance', 'usdAvailableAmt'],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'clearing',
|
|
78
|
+
title: '城银清',
|
|
79
|
+
unit: 'CNY',
|
|
80
|
+
currencyCodes: ['CLEARING', '城银清'],
|
|
81
|
+
keys: ['clearingAmount', 'clearingBalance', 'settleAmount', 'settleAccount'],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'eur',
|
|
85
|
+
title: '欧元',
|
|
86
|
+
unit: 'EUR',
|
|
87
|
+
currencyCodes: ['EUR', '欧元'],
|
|
88
|
+
keys: ['eurAmount', 'eurBalance', 'eurAvailableBalance', 'eurAvailableAmt'],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'cross-border-rmb',
|
|
92
|
+
title: '跨境人民币',
|
|
93
|
+
unit: 'CNY',
|
|
94
|
+
currencyCodes: ['CROSS_BORDER_RMB', '跨境人民币'],
|
|
95
|
+
keys: [
|
|
96
|
+
'crossBorderRmbAmount',
|
|
97
|
+
'crossBorderRmbBalance',
|
|
98
|
+
'crossBorderAmount',
|
|
99
|
+
'crossBorderBalance',
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'hkd',
|
|
104
|
+
title: '港币',
|
|
105
|
+
unit: 'HKD',
|
|
106
|
+
currencyCodes: ['HKD', '港币'],
|
|
107
|
+
keys: ['hkdAmount', 'hkdBalance', 'hkdAvailableBalance', 'hkdAvailableAmt'],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'digital-currency',
|
|
111
|
+
title: '数字货币',
|
|
112
|
+
unit: 'CNY',
|
|
113
|
+
currencyCodes: ['DCCY', 'DCNY', '数字货币'],
|
|
114
|
+
keys: [
|
|
115
|
+
'dccyAvailableAmt',
|
|
116
|
+
'dccyAvailableAmount',
|
|
117
|
+
'digitalCurrencyAmount',
|
|
118
|
+
'digitalCurrencyBalance',
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'jpy',
|
|
123
|
+
title: '日元',
|
|
124
|
+
unit: 'JPY',
|
|
125
|
+
currencyCodes: ['JPY', '日元'],
|
|
126
|
+
keys: ['jpyAmount', 'jpyBalance', 'jpyAvailableBalance', 'jpyAvailableAmt'],
|
|
127
|
+
},
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
export function normalizeHomeBalanceResponse(
|
|
131
|
+
payload: unknown,
|
|
132
|
+
options: NormalizeHomeBalanceOptions = {},
|
|
133
|
+
): NormalizedHomeBalance[] {
|
|
134
|
+
const fields = options.fields ?? DEFAULT_HOME_BALANCE_FIELDS
|
|
135
|
+
const fractionDigits = options.fractionDigits ?? 2
|
|
136
|
+
const objects = collectObjects(payload)
|
|
137
|
+
|
|
138
|
+
return fields.map((field) => {
|
|
139
|
+
const foundValue =
|
|
140
|
+
findValueByCurrencyRecord(objects, field) ??
|
|
141
|
+
findValueByKeys(payload, objects, field.keys)
|
|
142
|
+
const formatted = formatAmountParts(foundValue?.value, fractionDigits)
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
id: field.id,
|
|
146
|
+
title: field.title,
|
|
147
|
+
unit: field.unit,
|
|
148
|
+
amount: formatted.amount,
|
|
149
|
+
decimal: formatted.decimal,
|
|
150
|
+
rawValue: foundValue?.value,
|
|
151
|
+
sourceKey: foundValue?.sourceKey,
|
|
152
|
+
found: foundValue !== undefined,
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function applyHomeBalancePayload<T extends HomeBalanceTarget>(
|
|
158
|
+
cards: readonly T[],
|
|
159
|
+
payload: unknown,
|
|
160
|
+
options: NormalizeHomeBalanceOptions = {},
|
|
161
|
+
): T[] {
|
|
162
|
+
const preserveWhenMissing = options.preserveWhenMissing ?? true
|
|
163
|
+
const normalized = normalizeHomeBalanceResponse(payload, options)
|
|
164
|
+
const byId = new Map(normalized.map((item) => [normalizeKey(item.id), item]))
|
|
165
|
+
|
|
166
|
+
return cards.map((card) => {
|
|
167
|
+
const normalizedCard = byId.get(normalizeKey(card.id))
|
|
168
|
+
|
|
169
|
+
if (!normalizedCard?.found && preserveWhenMissing) {
|
|
170
|
+
return { ...card }
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!normalizedCard) {
|
|
174
|
+
return { ...card, amount: '0', decimal: '.00' }
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
...card,
|
|
179
|
+
amount: normalizedCard.amount,
|
|
180
|
+
decimal: normalizedCard.decimal,
|
|
181
|
+
unit: normalizedCard.unit || card.unit,
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function formatAmountParts(
|
|
187
|
+
value: unknown,
|
|
188
|
+
fractionDigits = 2,
|
|
189
|
+
): { amount: string; decimal: string } {
|
|
190
|
+
const numericText = normalizeNumericText(value)
|
|
191
|
+
|
|
192
|
+
if (!numericText) {
|
|
193
|
+
return {
|
|
194
|
+
amount: '0',
|
|
195
|
+
decimal: fractionDigits > 0 ? `.${'0'.repeat(fractionDigits)}` : '',
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const unsignedText = numericText.startsWith('-')
|
|
200
|
+
? numericText.slice(1)
|
|
201
|
+
: numericText
|
|
202
|
+
const [integer = '0', ...decimalParts] = unsignedText.split('.')
|
|
203
|
+
const normalizedInteger = integer.replace(/^0+(?=\d)/, '') || '0'
|
|
204
|
+
const decimalText = decimalParts.join('')
|
|
205
|
+
const decimal = fractionDigits > 0
|
|
206
|
+
? `.${decimalText.padEnd(fractionDigits, '0').slice(0, fractionDigits)}`
|
|
207
|
+
: ''
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
amount: `${numericText.startsWith('-') ? '-' : ''}${groupInteger(normalizedInteger)}`,
|
|
211
|
+
decimal,
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function findValueByKeys(
|
|
216
|
+
payload: unknown,
|
|
217
|
+
objects: readonly Record<string, unknown>[],
|
|
218
|
+
keys: readonly string[],
|
|
219
|
+
): { value: unknown; sourceKey: string } | undefined {
|
|
220
|
+
for (const key of keys) {
|
|
221
|
+
if (key.includes('.')) {
|
|
222
|
+
const pathValue = readPath(payload, key)
|
|
223
|
+
|
|
224
|
+
if (isUsableValue(pathValue)) {
|
|
225
|
+
return { value: pathValue, sourceKey: key }
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const normalizedKey = normalizeKey(key)
|
|
230
|
+
|
|
231
|
+
for (const object of objects) {
|
|
232
|
+
const entry = Object.entries(object).find(
|
|
233
|
+
([objectKey]) => normalizeKey(objectKey) === normalizedKey,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
if (entry && isUsableValue(entry[1])) {
|
|
237
|
+
return { value: entry[1], sourceKey: entry[0] }
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return undefined
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function findValueByCurrencyRecord(
|
|
246
|
+
objects: readonly Record<string, unknown>[],
|
|
247
|
+
field: HomeBalanceFieldConfig,
|
|
248
|
+
): { value: unknown; sourceKey: string } | undefined {
|
|
249
|
+
const shouldUseUnitAsAlias = normalizeKey(field.unit) !== 'cny'
|
|
250
|
+
const currencyCodes = new Set(
|
|
251
|
+
[
|
|
252
|
+
field.id,
|
|
253
|
+
field.title,
|
|
254
|
+
...(shouldUseUnitAsAlias ? [field.unit] : []),
|
|
255
|
+
...(field.currencyCodes ?? []),
|
|
256
|
+
]
|
|
257
|
+
.filter((item): item is string => Boolean(item))
|
|
258
|
+
.map(normalizeKey),
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
const matches: Array<{ value: unknown; sourceKey: string }> = []
|
|
262
|
+
|
|
263
|
+
for (const object of objects) {
|
|
264
|
+
const recordCurrency = findRecordCurrency(object)
|
|
265
|
+
|
|
266
|
+
if (!recordCurrency || !currencyCodes.has(normalizeKey(recordCurrency))) {
|
|
267
|
+
continue
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const amountKeys = [...(field.amountKeys ?? []), ...DEFAULT_AMOUNT_KEYS]
|
|
271
|
+
const amountValue = findValueByKeys(object, [object], amountKeys)
|
|
272
|
+
|
|
273
|
+
if (amountValue) {
|
|
274
|
+
matches.push(amountValue)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (!matches.length) {
|
|
279
|
+
return undefined
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (matches.length === 1) {
|
|
283
|
+
return matches[0]
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const numericValues = matches
|
|
287
|
+
.map((match) => parseAmountValue(match.value))
|
|
288
|
+
.filter((value): value is number => Number.isFinite(value))
|
|
289
|
+
|
|
290
|
+
if (!numericValues.length) {
|
|
291
|
+
return matches[0]
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
value: numericValues.reduce((total, value) => total + value, 0),
|
|
296
|
+
sourceKey: Array.from(new Set(matches.map((match) => match.sourceKey))).join('+'),
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function findRecordCurrency(object: Record<string, unknown>) {
|
|
301
|
+
const currencyKeys = [
|
|
302
|
+
'currency',
|
|
303
|
+
'currencyCode',
|
|
304
|
+
'currencyType',
|
|
305
|
+
'currencyName',
|
|
306
|
+
'ccy',
|
|
307
|
+
'ccyCode',
|
|
308
|
+
'curr',
|
|
309
|
+
'currCode',
|
|
310
|
+
'unit',
|
|
311
|
+
]
|
|
312
|
+
|
|
313
|
+
for (const key of currencyKeys) {
|
|
314
|
+
const value = findValueByKeys(object, [object], [key])?.value
|
|
315
|
+
|
|
316
|
+
if (typeof value === 'string' && value.trim()) {
|
|
317
|
+
return value.trim()
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return undefined
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function collectObjects(
|
|
325
|
+
value: unknown,
|
|
326
|
+
depth = 0,
|
|
327
|
+
seen = new Set<object>(),
|
|
328
|
+
): Record<string, unknown>[] {
|
|
329
|
+
if (!isPlainObject(value) && !Array.isArray(value)) {
|
|
330
|
+
return []
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (typeof value === 'object' && value !== null) {
|
|
334
|
+
if (seen.has(value)) {
|
|
335
|
+
return []
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
seen.add(value)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (depth > 8) {
|
|
342
|
+
return []
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (Array.isArray(value)) {
|
|
346
|
+
return value.flatMap((item) => collectObjects(item, depth + 1, seen))
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const object = value as Record<string, unknown>
|
|
350
|
+
const children = Object.entries(object).flatMap(([, child]) =>
|
|
351
|
+
collectObjects(child, depth + 1, seen),
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
return [object, ...children]
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function readPath(value: unknown, path: string) {
|
|
358
|
+
return path.split('.').reduce<unknown>((current, segment) => {
|
|
359
|
+
if (!isPlainObject(current) && !Array.isArray(current)) {
|
|
360
|
+
return undefined
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return (current as Record<string, unknown>)[segment]
|
|
364
|
+
}, value)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function normalizeNumericText(value: unknown) {
|
|
368
|
+
if (value === null || value === undefined) {
|
|
369
|
+
return ''
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const raw = String(value).trim()
|
|
373
|
+
|
|
374
|
+
if (!raw || raw === '-' || raw === '--' || raw === '—') {
|
|
375
|
+
return ''
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const isNegative = raw.startsWith('-') || /^\(.+\)$/.test(raw)
|
|
379
|
+
const text = raw.replace(/,/g, '').replace(/[^\d.]/g, '')
|
|
380
|
+
|
|
381
|
+
if (!/\d/.test(text)) {
|
|
382
|
+
return ''
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const [integer = '0', ...decimalParts] = text.split('.')
|
|
386
|
+
const decimal = decimalParts.length ? `.${decimalParts.join('')}` : ''
|
|
387
|
+
|
|
388
|
+
return `${isNegative ? '-' : ''}${integer || '0'}${decimal}`
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function parseAmountValue(value: unknown) {
|
|
392
|
+
const text = normalizeNumericText(value)
|
|
393
|
+
|
|
394
|
+
if (!text) {
|
|
395
|
+
return Number.NaN
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return Number(text)
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function groupInteger(value: string) {
|
|
402
|
+
return value.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function normalizeKey(value: string) {
|
|
406
|
+
return value.toLowerCase().replace(/[\s_\-./]/g, '')
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function isUsableValue(value: unknown) {
|
|
410
|
+
return value !== null && value !== undefined && value !== ''
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
414
|
+
return Object.prototype.toString.call(value) === '[object Object]'
|
|
415
|
+
}
|