https://github.com/js-sdk/js-sdk-stack
Simple stack type.
https://github.com/js-sdk/js-sdk-stack
javascript library stack
Last synced: about 2 months ago
JSON representation
Simple stack type.
- Host: GitHub
- URL: https://github.com/js-sdk/js-sdk-stack
- Owner: js-sdk
- License: unlicense
- Created: 2017-09-17T15:27:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-17T16:57:55.000Z (over 8 years ago)
- Last Synced: 2025-07-04T16:21:18.946Z (12 months ago)
- Topics: javascript, library, stack
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license.md
Awesome Lists containing this project
README
# js-sdk-stack
[](https://travis-ci.org/js-sdk/js-sdk-stack) [](https://coveralls.io/github/js-sdk/js-sdk-stack?branch=master)
Simple stack type.
## library
```ts
$ Stack(init || []) : Stack
// Create a new stack.
$ Stack.push(item : a) : ()
// Pushes a value to the stack.
$ Stack.pop() : a
// Pops a value from the stack.
$ Stack.length() : Number
// The length of the stack.
$ Stack.map(f (item : a) -> b) : Stack
// Maps each value of the stack returning a new Stack.
$ Stack.filter(f (item : a) -> Boolean) : Stack
// Returns a filtered Stack.
$ Stack.reduce(f (acc : b, item : a) -> b, initial : b) -> b
// If no initial value is passed, it will use Stack.
```
## license
See `license.md` or visit [Unlicense](http://unlicense.org).