calculator Svelte Themes

Calculator

Simple svelte calculator-app

Svelte-calculator

Design

Icon design figma.

Calculator design figma.

Design authored by Vatani Design under CC BY 4.0 license.


Logic

Code of main logic in src/logic.

Calculator parse String for numbers([-+])?\\d+(?:[,.]\\d+)?), brackets([()]) and operator tokens(based on operators of calculator).

Brackets add priority to operators in this brackets.

During parsing can be added Mul operators or set sign of numbers.


Try it

Demo

window.calc is instance of Calculator with default options.

window.Calculator is Calculator.


Tests

For test math logic, tests written in jest.

Local app

To start local app run:

yarn
yarn dev

Top categories

Loading Svelte Themes