Javascript: Lazy collections

JS: Object oriented design
Last update: 09 Jan 23:20
0
Students

Here you need to build a lazy collection.

enumerable.js

Implement and export as default a class handling collections of objects. The main feature of this class is that it uses lazy processing.

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' }]

Tips

  • The usage examples are given in more detail in the tests
  • Advanced challenge: add the allWithMemoization() method implementing memoization and test it by running the make test-memo command in the exercise terminal <!-- * Ленивые коллекции -->

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests