Giter Site home page Giter Site logo

calculator-typescript-alanch8's Introduction

Calculator Library

For educational use

Link to npm library


Instalation

  • Use the following command to install the library in your project
npm i calculator-typescript-alanch8
  • Import the library into your project like this
import {Calculator} from 'calculator-typescript-alanch8';

Methods

add(a:number,b:number):number

addition of a and b variables (muest be numbers). returns a + b.

subs(a:number,b:number):number

substraction of a and b variables (muest be numbers). returns a - b.

multiply(a:number,b:number):number

multiplication of a and b variables (muest be numbers). returns a * b.

div(a:number,b:number):number

division of a and b variables (muest be numbers). returns a / b.

If the b variable is a zero (0) number the program will throw a math error.

How this library was built

In order to create and upload this library to Npm, we have used C-J Kihl's tutorial from Medium.

Important things to keep in mind;

  • Start the project
  • Configure it.
  • Create a build (transpile it with tsc).
  • format it and paint it with Prettier and Tlint.
  • Test it with Jest in the best case.

Once the library is finished, we create a commit and upload it to github using git push in order to continue with the steps to upload it to npm.

Let's publish the lib to npm with:

npm publish

And that's all ๐ŸŽ‰. It's interstingt to know we can make diferent versions with:

npm version patch

Thanks for reading!


Aitor Lancharro "Alanch8" โ˜•

calculator-typescript-alanch8's People

Contributors

alanch8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.