Detalhes do pacote

infix-to-postfix

miguelmota2.9kMIT0.0.3

Returns a postfix (Reverse Polish Notation) expression from an infix expression.

postfix, reverse polish notation, rpn, infix

readme (leia-me)

infix-to-postfix

Returns a postfix (Reverse Polish Notation) expression from an infix expression.

Demo

https://lab.miguelmota.com/infix-to-postfix

Install

npm install infix-to-postfix

Usage

const infixToPostfix = require('infix-to-postfix');

console.log(infixToPostfix('1 + 2')); // '1 2 +'
console.log(infixToPostfix('(1 + 2) * (-4)')); // '1 2 + -4 *'
console.log(infixToPostfix('((3 * 4) / (2 + 5)) * (3 + 4)')); // '3 4 * 2 5 + / 3 4 + *'
console.log(infixToPostfix('((57.5 - -34.1) * (6 / 3.2)) + 4.3')); // '57.5 -34.1 - 6 3.2 / * 4.3 +'
console.log(infixToPostfix('a & 5')); // null (invalid expressions return null)

Use the postfix-calculator module for calculating postfix expressions.

Test

npm test

Credit

License

MIT

changelog (log de mudanças)

Change Log

All notable changes to this project will be documented in this file.

This project adheres to Semantic Versioning.