README
mathrix-ts
Requirements
- @angular/common and @angular/core 5 or higher.
Installing
$ npm i @actjs.on/mathrix-ts --save
Usage
Import '@actjs.on/mathrix-ts/extensions/number'
as a Promise
in your component to use the extended methods of number, so inside an async function
wait the Promise
resolution with await
method, like follow.
import { Component } from '@angular/core';
const numberExtensionPromise = import('@actjs.on/mathrix-ts/extensions/number');
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.styl']
})
export class AppComponent {
private number1: number;
private number2: number;
constructor() {
this.number1 = 9000;
this.number2 = 9001;
this.isEvenOrOddMessage();
}
private async isEvenOrOddMessage() {
await numberExtensionPromise;
console.log(`${this.number1} is ${this.number1.isOdd() ? `odd` : `even`}`);
console.log(`${this.number2} is ${this.number2.isOdd() ? `odd` : `even`}`);
}
}