feat: solution for 'Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)'

This commit is contained in:
2026-06-29 17:03:15 +03:00
parent 29f9717e89
commit 520acee860
5 changed files with 245 additions and 67 deletions
+14 -49
View File
@@ -1,54 +1,19 @@
# Compare Three Entities
# Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
A small utility library that compares three JavaScript objects and reports the differences between them.
The comparison is deep, meaning nested objects are compared recursively. The result is an array of difference objects, each containing:
Главная
Мои задания
Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
EN
Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
Зачёт
Версия 6
Дедлайн сдачи: 31.08.2026
- `key`: The dotseparated path to the differing property.
- `values`: An array of the values from the three objects in the order `[a, b, c]`.
В работе
## Installation
Требуется доработка
```bash
npm install compare-three-entities
```
В вашем решении отсутствует упоминание и использование Qdrant, хотя это требование явно указано в задании. Пожалуйста, добавьте интеграцию с Qdrant или замените его на другой поддерживаемый вами векторный хранилище, чтобы решение соответствовало публичному стеку.
## Usage
```js
const compare = require('compare-three-entities');
const a = { name: 'Alice', age: 30, address: { city: 'NY' } };
const b = { name: 'Alice', age: 31, address: { city: 'NY' } };
const c = { name: 'Alice', age: 30, address: { city: 'LA' } };
const differences = compare(a, b, c);
console.log(differences);
// [
// { key: 'age', values: [30, 31, 30] },
// { key: 'address.city', values: ['NY', 'NY', 'LA'] }
// ]
```
## API
### `compare(a, b, c)`
- **Parameters**:
- `a` First object.
- `b` Second object.
- `c` Third object.
- **Returns**: `Array` Sorted array of difference objects.
## Testing
Run the test suite with:
```bash
npm test
```
The tests cover basic equality, toplevel differences, nested differences, and missing keys.
## License
MIT
Редактиров