1.2 KiB
1.2 KiB
RPN Virtual Calculator
A browser-friendly RPN calculator built around a small, generic JavaScript API.
Goal
This project defines a reusable RPN calculator engine with:
- a simple stack-based public API
- configurable numeric and UI behavior
- centralized command metadata
- a browser demo that uses the same public API as any consumer code
Package contents
rpn-calculator.js: calculator enginerpn-example.html: example browser interface
Main features
- Single JavaScript class
- Configurable stack size (
maxSize, default:2048) - Configurable numeric base (
base, default:10) - Configurable angle mode (
angleMode, default:deg) - Optional command filtering through
enabledCommands - Generic public API centered on:
pushpop
clearswap(index1, index2)remove(index)edit(index)isValidIndex(index)input(command)command(name, ...args)
inputValueis kept as a string to preserve future input formatsisEditingis exposed as a boolean state- All supported commands are described in one centralized dictionary
- Supported categories are limited to:
StackArithmeticTrigonometry