npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

call-stack

v0.0.2

Published

call-stack module (originally by Finley.Z.M.F)

Downloads

9

Readme

call-stack

call-stack module (originally by Finley.Z.M.F) current version: v0.0.1

Installation

npm install call-stack

Example

var stack = require('call-stack')();

stack.push('item0', 'item1');
stack.push('item2');

stack.each(function(val, i) {
  console.log('pointer %d: %s', i, val);
});

stack.pointer = 0;
console.log('set pointer to %d', stack.pointer);

stack.alloc('123'); // output: item0
stack.alloc('123'); // output: item1
stack.alloc('123'); // output: item2
stack.alloc('123'); // output: 123

API

Factory: Callstack([name][, maxLayers][, constructor])

  • name String Default='anonymous'
  • maxLayers Number Default=10
  • constructor Function

The factory function to create a new call-stack object. Returns call-stack, used to chain calls.

Set the call-stack name to name. Use maxLayers to limit the length of the call-stack layers. If you call the stack.alloc, might be executed constructor.

stack.setMaxLayers(n)

  • n Number

Limit the length of the call-stack layers. If n is't a positive number, throws a type error. Returns call-stack, used to chain calls.

stack.previous()

Returns the call-stack previous layer. See Getter: Interface.__previous.

stack.current()

Returns the call-stack current layer. See Getter: Interface.__current.

stack.next()

Returns the call-stack next layer. See Getter: Interface.__next.

stack.end()

Returns the call-stack current layer. See Getter: Interface.__end.

stack.reset(n)

Returns the call-stack current layer. See Setter: Interface.pointer.

stack.push(payer[, ...])

  • layer Mixed

Append the stack layers. Returns call-stack, used to chain calls.

stack.each(iterate[, context])

  • iterate Function
  • context Mixed

By moving the stack pointer to traverse the stack layers. Returns false if the iterator will break through. If we want to continue to walk through, this stack pointer must move one step to the right. If iterate is't a function, throw a type error.

stack.alloc([...])

Allocate stack layers.

When the stack layer assignment is completed, if you configured a constructor for the call-stack the parameters of this method could be used on the stack constructor.

Returns a call-stack layer or a results of ran constructors.

Getter and Setter

See Callstack.Interface.

Interface: Callstack.Interface([name][, functional])

  • name String Default='anonymous'
  • functional Function

This interface function only for the basic properties of a call-stack object.

Set the call-stack name to name. Use functional to extend the properties and methods of the call-stack.

Getter: stack.name

The name of call-stack. It is a string type.

Getter: stack.length

The length of the call-stack. It is a number type.

Getter: stack.pointer

The pointer position of the call-stack. It is a number type.

Setter: stack.pointer = n

  • n Number

Configure the stack pointer. If n is't a positive number or n is invalid for the pointer position, throw a type error.

Getter: stack.isEnd

This value is true, if moved pointer to the end of the call-stack. It is a boolean type.

Getter: stack.isInvalid

This value is true, if the pointer is invalid. It is a boolean type.

Getter: stack.__previous

The previous call-stack layer. The stack pointer is not in the starting position, referencing the property, this stack pointer will move one step to the left.

Getter: stack.__current

The current call-stack layer.

Getter: stack.__next

The next call-stack layer. The stack pointer is not in the starting position, referencing the property, this stack pointer will move one step to the right.

Getter: stack.__end

The last call-stack layer. The stack pointer is not in the starting position, referencing the property, this stack pointer will move to the end.

Setter: stack.__append

Append the call-stack layer. If the call-stack has one or more layers, this call-stack pointer will move one step to the right.

License

Callstack is licensed under the MIT license.

Copyright(c) 2015 Finley.Z.M.F

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.