| 487 | |
| 488 | const filterProtocol = { |
| 489 | normalizeValue(value) { |
| 490 | if (value === null || value === undefined) return null; |
| 491 | if (typeof value === 'string') { |
| 492 | const trimmed = value.trim(); |
| 493 | return trimmed ? trimmed : null; |
| 494 | } |
| 495 | if (typeof value === 'number') { |
| 496 | return Number.isFinite(value) ? value : null; |
| 497 | } |
| 498 | if (typeof value === 'boolean') { |
| 499 | return value; |
| 500 | } |
| 501 | if (Array.isArray(value)) { |
| 502 | const normalized = value |
| 503 | .map((item) => this.normalizeValue(item)) |
| 504 | .filter((item) => item !== null); |
| 505 | return normalized.length ? normalized : null; |
| 506 | } |
| 507 | return value; |
| 508 | }, |
| 509 | |
| 510 | normalize(filters = {}) { |
| 511 | const result = {}; |