npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

basic-calc-task1

v1.0.3

Published

Day 1 Training at syscloiyd

Downloads

3

Readme

Intern Assignment for Quality Control Mechanisms

This project is an assignment for interns to learn the best practices of writing codes by building a simple Calculator in TypeScript

Pre-Requisites

  1. Node
  2. Npm
  3. CLI Tool

Installation

Make sure you have node/npm installed and it's path is added Use the commands below to set up the project

Commands

Migrate to the root directory using command line.

  1. Install the packages and dependencies using npm
npm install
  1. Build the typescript files (Compile typescript to js)
npm run build
  1. Now, generate documentations to know about the functionalities
npm run doc
  1. You can use the following command to generate unit testing and coverage reports
npm run test

Project Hierarchy

coverage

This directory is auto-generated when "npm run test" is executed. It contains all the coverage reports 
of unit test cases. 

dist

This directory is auto-generated when "npm run build" is executed. It contains all the js compiled files from typescript

documentation

This directory is auto-genearted when "npm run doc" is executed. It contains the documentations of the usage of calulator functions

node_modules

This directory is auto-generated when "npm install" is executed. It contains the packages and dependencies over which the project is built

src

Here all the source codes are kept which are written in typescipt. Any modifications in code is done here.
Note: Remember to compile everytime any changes are done within this directory

test

This directory contains all the test suites written in js using jest packages. The unit tests are done on the basis of these files only

Documentations

Once you follow the above steps, a new folder named "documentation" will be generated in root folder. Go to documentation->index.html to know about the basic uses of calculator

Usage

This project has 4 functions of a basic calculator:

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

This functions takes two parameters and returns their sum
```js
    let sum = add(43, 23)
    console.log(sum) //prints 66
```

2. subtract(a:number, b:number):number

This function takes two parameters and returns their subtraction result
```js
    let diff = subtract(11, 2)
    console.log(diff) //prints 9
```

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

This function takes two parameters and returns product
```js
    let product = multiply(23, 4)
    console.log(product) //prints 92
```

4. divide(a:number, b:number):number

This function take two parameters and returns the quotient when a is divided by b
Note: if b = 0 : Throws "Cannot divide by zero exeception"
```js
    let quo = divide(10/2);
    console.log(quo) //prints 5
    let errQuo = divide(2/0) // throws "Cannot divide by zero" exception
```

Author

Shivam Singh