Skip to content

Kolobok12309/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

10c1352 · Oct 4, 2021

History

20 Commits
Oct 1, 2021
Sep 26, 2021
Oct 4, 2021
Oct 4, 2021
Oct 3, 2021
Oct 1, 2021
Oct 4, 2021
Oct 4, 2021
Sep 27, 2021
Oct 4, 2021
Oct 4, 2021
Oct 2, 2021
Oct 4, 2021

Repository files navigation

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