1.28.0 • Published 2 years ago

@biorate/collection v1.28.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Collection

What:

This package implements two base classes List and Item, as well as their extensions. The List extensions is intended for solving problems associated with fast O(1) search for objects by given keys and fast iteration of a collection of objects, multi-index and objects-factory supported. The Item extensions is designed to form the structure of the object, solve the problem of application architecture, dependency injection and inversion of control.

Example:

import * as collection from '@biorate/collection';
const { embed } = collection;

class Item extends collection.Item {
  @embed(Item.Int) public id: number = null;
  @embed(Item.String) public title: string = null;
}

class List extends collection.List<Item> {
  protected get _keys() {
    return [['id']];
  }
  protected get _Item() {
    return Item;
  }
}

const list = new List([
  { id: 1, title: 'one' },
  { id: 2, title: 'two' },
]);

list.set({ id: 3, title: 'three' }, { id: 4, title: 'four' });

console.log(list.find(1)); // Item { id: 1, title: 'one' }
console.log(list.find(2)); // Item { id: 2, title: 'two' }
console.log(list.find(3)); // Item { id: 3, title: 'three' }
console.log(list.find(4)); // Item { id: 4, title: 'four' }

Learn

  • Learn more from documentation that can be found here - docs.

Release History

See the CHANGELOG

License

MIT

Copyright (c) 2021-present Leonid Levkin (llevkin)

1.28.0

2 years ago

1.27.2

2 years ago

1.24.0

2 years ago

1.11.2

3 years ago

1.2.0

3 years ago

1.0.0

3 years ago

1.4.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

0.30.7

3 years ago

0.30.6

3 years ago

0.30.3

3 years ago

0.30.2

3 years ago

0.30.1

3 years ago

0.30.0

3 years ago

0.29.1

3 years ago

1.1.0

3 years ago

1.3.0

3 years ago

0.30.18

3 years ago

0.30.19

3 years ago

0.28.0

3 years ago

0.27.0

3 years ago

0.26.0

3 years ago

0.25.0

3 years ago

0.21.0

3 years ago

0.20.0

3 years ago

0.19.0

3 years ago

0.23.0

3 years ago

0.22.0

3 years ago

0.13.0

4 years ago

0.12.1

4 years ago

0.14.0

4 years ago

0.12.2

4 years ago

0.15.0

3 years ago

0.12.3

4 years ago

0.12.4

4 years ago

0.17.0

3 years ago

0.16.1

3 years ago

0.18.0

3 years ago

0.11.2

4 years ago

0.11.0

4 years ago

0.11.1

4 years ago

0.10.1

4 years ago

0.10.2

4 years ago

0.10.4

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.3

4 years ago

0.9.1

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago