angular-basic-calculator
v0.0.2
Published
An Angular 6 package that performs basic mathematical operations
Downloads
3
Readme
1. Intro
Performs basic mathematical operations:
- summation
+
- subtraction
-
- multiplication
*
- division
/
- exponentiation
^
- parentheses
(...)
API:
isExpressionValid(string)
booleanparseAndEvaluate(string)
number
2. Usage
- import
AngularBasicCalculatorModule
into a Single Page App
/*
src/app/app.module.ts
*/
import { AngularBasicCalculatorModule } from 'angular-basic-calculator';
@NgModule({
imports: [
...,
AngularBasicCalculatorModule
],
...
})
export class AppModule { }
- inject
AngularBasicCalculatorService
into a component/service/pipe
constructor(private _angularBasicCalculatorService: AngularBasicCalculatorService) {
this._angularBasicCalculatorService.parseAndEvaluate('1 + 1'); // = 2
}