Skip to content

samirsilwal/structures

Repository files navigation

Structures

Structure is yet another fun custom collection adding some interesting features to existing js arrays features. Consists bunch of other structures like Stack, Queue as well.

Currently available collection structures are :-

  • LinkedList
  • Stack
  • Queue

New Features!

  1. LinkedList
  • + operator : Add two collection together of same type
  • flatten : flattens the 2D collection in single
  • flatmap : A monadic feature of collection, analogous to map followed by flatten
  • lhead & ltail : extract first element and rest list of items repectively.
  • ltop & lbottom : extract n - 1 element from the list and get last element of list respectively.

NOTE : These helpful methods conveniently help in implementing recursive logic in the collection.

  1. Stack
  • pile and unpile: Append another stack on top of other or remove a pile of stack

Todos

  • Write MORE Tests
  • Conitnue to add more interesting functions.

License

MIT