2.0.2 • Published 3 years ago

@strong-roots-capital/finite-stack v2.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

finite-stack Build status npm version codecov

Append-only LIFO stack with finite history

Install

npm install @strong-roots-capital/finite-stack

Use

import * as Stack from '@strong-roots-capital/finite-stack'

const emptyStack: Stack.EmptyStack<number> = Stack.stack<number>(2)

let nonEmptyStack: Stack.NonEmptyStack<number> = Stack.push(0)(emptyStack)
console.log(Stack.toArray(nonEmptyStack))
//=>[ 0 ]

nonEmptyStack = Stack.push(1)(nonEmptyStack)
console.log(Stack.toArray(nonEmptyStack))
//=>[ 1, 0 ]

nonEmptyStack = Stack.push(2)(nonEmptyStack)
console.log(Stack.toArray(nonEmptyStack))
//=>[ 2, 1 ]

Related

Acknowledgments

2.0.2

3 years ago

2.0.1

3 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago