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

stack-calc

v1.0.5

Published

You can install this package and run it with npx

Downloads

4

Readme

Stack Calculator Cli

Quickstart

You can install this package and run it with npx

~ npm i -g stack-calc
~ npx stack-calc

Basics

Numbers

Each number you type is pushed to the stack from left to right

> 2 2.5 -.5
stack: [2, 2.5, -0.5]

Operations and functions

Operations, Functions etc. take arguments by popping numbers from the stack

Plus '+' will pop two numbers and push their sum

> 2 2 +
stack: [4]

Intrinsics

There are also intrinsics which don't represent any mathematical operations, but just affect the stack

> 2 dup
stack: [2, 2]

Macros

Macros are a set of statements combined in one word. You can define a macro by starting your command with ! symbol.

> !PI 3.1415
> !log2 2 swap log

After that these macros will be saved and you will be able to use them

> 8 log2
stack: [3]

log2 will expand to 2 swap log and as the result the "equation" will look like this: 8 2 swap log

You can preload your macros in json file with -m or --macro flag node cli.js --macro macrostest.json

Additional commands

These are commands which you can type instead of equations

:d or :debug - switches debug mode

:m or :macros - prints out all defined macros

> :macros
Macros:
    PI -> 3.1415
    log2 -> 2 swap log

List of everythin

Operators

+ - sums two numbers 2 2 + -> 4

- - stubtracts numbers 3 2 - -> 1

* - multiplies numbers 3 2 * -> 6

/ - devides numbers 3 2 / -> 1.5

// - devides numbers and floors the result 3 2 // -> 1

% - modulus of numbers 3 2 % -> 1

Intrinsics

dup - duplicates the last number on the stack 2 dup -> 2 2

drop - drops the last number on the stack 2 2 drop -> 2

swap - swaps last two numbers on the stack 1 2 swap -> 2 1

over - duplicates the number before the last one 2 1 over -> 2 1 2

Functions

sqrt - square root 4 sqrt -> 2

sin - sinus 3.1415 2 / sin -> 0.999...

cos - cosinus 3.1415 cos -> -0.999...

tan - tangens 3.1415 4 / tan -> 0.999...

ctan - cotangens 3.1415 4 / ctan -> 1.000...

asin - arcsin 1 asin 2 * -> 3.1415...

acos - arccos 1 acos -> 0

atan - arctan 1 atan -> 0

log - logarithm 2 8 log -> 3

ln - natural logarithm 2.7 ln -> 0.9932...

fact - factorial 5 fact -> 120

pow - power 2 4 pow -> 16

root - root 8 3 root -> 2