yac-math
TypeScript icon, indicating that this package has built-in type declarations

3.1.5 • Public • Published

yac-math

what is this ?

helper functions math library

DISCLAIMER

PLEASE DO NOT USE ANY VERSION PRIOR TO 3.1.5 AS THEY ARE NOT STABLE (I WAS MESSING AROUND TRYING TO FIND A GOOD WORKFLOW FOR CI/CD) !

pre requisites

basic usage

  • npm install yac-math

available methods

returns array

  • getAllFactorizations(nb) => returns a list of all factorizations for the given input value as unique pairs of factors
  • getUniquePrimeFactors(nb) => returns a list of unique prime factors for the given input value
  • getPrimeFactorization(nb) => returns a list of prime factors for the given input value, their product is equal to the input value

returns boolean

  • isFactor(nb1, nb2) => checks if input nb1 is a factor of input nb2
  • isEven(nb)
  • isNaturalNumber(nb)
  • isPrime(nb)

returns number

  • factorial(nb) => returns the factorial of the given input nb
  • getPercentageRepresentation(nb1, nb2) => gets what percentage of nb2 represents nb1

returns object

  • getDecimalToHoursAndMinutes => converts a decimal number to an object representation of hours and minutes

returns string

  • getUnitRatioOfNb1ToNb2(nb1, nb2) => gets a string representation of the ratio of one unit of nb1 to nb2

importing and using

// you can use the default export
const yacMath = require("yac-math");
yacMath.isPrime(5); // => true

// OR you can pick the functions you want
const { isEven, isNaturalNumber, isPrime } = require("yac-math");
isPrime(5); // => true
getPercentageRepresentation(2, 4); // => 50

CI/CD

testing with jest, building with tsc, and publishing to NPM are all automated using Github Actions

Contributors

a big thanks goes to the contributors of this project:

yactouat
Yactouat

petropok
petropok

av-feaster
av-feaster

Notkirito18
Notkirito18

dejanko25
dejanko25

Package Sidebar

Install

npm i yac-math

Weekly Downloads

2

Version

3.1.5

License

MIT

Unpacked Size

61.6 kB

Total Files

12

Last publish

Collaborators

  • yactouat