Created
July 14, 2022 19:05
-
-
Save evgeniyworkbel/39dc931ed8ce65ac5a61f307018ef23a to your computer and use it in GitHub Desktop.
Курс "JS: Объектно-ориентированный дизайн" (Хекслет)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
В этой задаче необходимо реализовать ленивую коллекцию.https://ru.wikipedia.org/wiki/%D0%9E%D1%82%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%BD%D0%B0%D1%8F_%D0%B8%D0%BD%D0%B8%D1%86%D0%B8%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F | |
enumerable.js | |
Реализуйте и экспортируйте по умолчанию класс, который предназначен для обработки коллекций объектов. Основная особенность работы данного класса заключается в том, что он использует lazy вариант обработки. | |
import Enumerable from './enumerable.js'; | |
const elements = [ | |
{ key: 'value' }, | |
{ key: '' }, | |
]; | |
const coll = Enumerable.wrap(elements); | |
const result = coll.where('key', 'value'); | |
result.all() // [{ key: 'value' }] | |
Подсказки | |
Подробнее способы использования описаны в тестах. | |
Усложнённый вариант: добавьте метод с мемоизацией (https://ru.wikipedia.org/wiki/%D0%9C%D0%B5%D0%BC%D0%BE%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F) и протестируйте его, запуская командой make test-memo в терминале упражнения. | |
Ленивые коллекции (https://ru.hexlet.io/courses/js_collections/lessons/lazy/theory_unit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment