feat: solution for 'Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)'
This commit is contained in:
@@ -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)
|
||||
5Д
|
||||
EN
|
||||
Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
|
||||
Зачёт
|
||||
Версия 6
|
||||
Дедлайн сдачи: 31.08.2026
|
||||
|
||||
- `key`: The dot‑separated 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, top‑level differences, nested differences, and missing keys.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Редактиров
|
||||
Reference in New Issue
Block a user