🥞
@datastructures/stack
🦄
A minimal functional typed implementation of a stack. An ordered structure of data inputs obeying the principle of last in, first out.
Install
yarn add @datastructures/stack -D
Usage
import { stack } from '@datastructures/stack'
const pancake = stack()
pancake.add('one pancaka')
pancake.add('two pancaka')
// I'm so hungry
pancake.remove() // yum, pancaka remove
pancake.print() // one pancaka
API
Methods
add(item)
adds an item to the queue
ex:
queue.add('foo')
remove()
removes the last item from the queue ex:queue.remove()
length()
returns the length of the queueprint()
prints all items in the queue
🦄
Data Structures Basic. Functional. Typed. Data Structures.
Functional typed data structures offering structure clarity and simplicity.