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

@catcoderboii/maths

v1.0.0

Published

- ### Using Nodejs require syntax ```js const Math = require("@catcoderboii/maths.js"); const math = new Math();

Downloads

4

Readme

@catcoderboii/maths.js

Installation

$ npm install catcoderboii/maths.js

How to import the class

  • Using Nodejs require syntax

const Math = require("@catcoderboii/maths.js");
const math = new Math();

//rest of the code...
  • Using ES6 import syntax

import Math from '@catcoderboii/maths.js';
const math = new Math();

//rest of the code...

We also have the individual functions to import, lets see how

  • Using Nodejs require syntax

// using add in this example 
const { add } = require('@catcoderboii/maths.js');

//now use the add function as normal
add(1,2,3)

//rest of code...
  • Using ES6 import syntax

//Using add as an example
import { add } from '@catcoderboii/maths.js';

//Using the add function as normal
add(1,2,3)

//rest of code...

List of functions

  • add
  • division
  • multiply
  • sign
  • subtract

What each function does

I am using only ES6 imports though they work with Nodejs require

All of these work with the class method too! It's just Math#Function instead of just Function.

  • Add Function

/**
 * @param {number[]} numbers
 * @emmits number
*/
//importing the functions (add namely)
import {add} from '@catcoderboii/maths.js';

//Using the function with the numbers 1,2, and 3.
add(1,2,3)
  • Subtraction

/**
 * @param {number[]} numbers
 * @emmits number
*/
//Importing the function (namely subtract)
import {subtract} from '@catcoderboii/maths.js';

//Using the function with numbers 1,2,3 (does it like 1-2-3)
subtract(1,2,3)

Others are same and i'll make docs about them later

  • Sign

This one is different

/** 
 * Sign is different from all others. this returns true if positive, false if negative, and undefined if anything else.
 * 
 * @param {Number} number
 * @param {Object} config
 * Options for this command are "sign" which can have a value of "positive" or "negative".
 * 
*/
//Importing the function  (namely sign)
import {sign} from "catcoderboii/maths.js";

//using the function with the config
sign(10, {sign: "positive"})
//returns true

//If there is no config, it will return the sign (in development)

Other quirks

  • you can import the "signAbs" interface, just head over to the index.ts (of the module) and un-comment line 44.