Package Exports
- @yetnt/ump
- @yetnt/ump/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@yetnt/ump) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Useless Math Package
I mean.. Do you really need this soon to be multi mathemetically functioning package? (if that even makes sense)
Installation
npm i @yetnt/ump
It's suggested you don't install from github itself as I'm consistently commiting to the project you'll need to update everyday and because some code breaks because i'm editing it so just get it from npm 👍
const Ump = require("@yetnt/ump");
Ump.PrimeFactorize();
or
const { PrimeFactorize } = require("@yetnt/ump");
PrimeFactorize();
Features
So far this package can do a lot
Prime Factorization
const { PrimeFactorize } = require("@yetnt/ump");
PrimeFactorize(50); // [2, 5, 5]
PrimeFactorize(5000); // [2, 2, 2, 5, 5, 5, 5]
PrimeFactorize(93928893); // [3, 17, 103, 17881]
PrimeFactorize(3); // [3]
Ratio(s)
Divide x
in the ratio of y
:z
const { DinRatio } = require("@yetnt/ump");
DinRatio(500, 3, 2); // [300, 200]
DinRatio(456.93, 12, 5); // [ 322.5388235294118, 134.39117647058825 ]
DinRatio(456.93, 12, 5, true); // ['322.54', '134.39']
Direct Proportion (equivalent ratios)
const { PropRatio } = require("@yetnt/ump");
PropRatio(2, 4, 6, true); // 12
/*
x : y
z : ?
in this case:
2 : 4
6 : ?
*/
PropRatio(2, 6, 12); // 4
/*
x : y
? : z
in this case
2 : 6
? : 12
*/
Conversion
Pre-read
Usage of strings for the the shorthand units are soon to be depracated. Use the Unit Enums
instead.
Distance
const { ConvUnit, Distance } = require("@yetnt/ump");
ConvUnit("dist", 12, Distance.Millimeter, Distance.Centimeter); // 1.2
ConvUnit("dist", 1, Distance.Inch, Distance.Centimeter); // 2.54
ConvUnit("dist", 98, Distance.NauticalMile, Distance.Nanometer); // 1852000000000
Area
const { ConvUnit, Area } = require("@yetnt/ump");
ConvUnit("area", 34, Area.SquareCentimetre, Area.SquareInch); // 5.27001054002108
ConvUnit("area", 34, "cm2", "inch2"); // 5.27001054002108
ConvUnit("area", 490, Area.Hectare, Area.SquareFoot); // 52743183.75079384
Volume
const { ConvUnit, Volume } = require("@yetnt/ump");
ConvUnit("vol", 34, Volume.CubicCentimeter, Volume.CubicInch); // 2.0748027411805627
ConvUnit("vol", 34, "cm3", "inch3"); // 2.0748027411805627
ConvUnit("vol", 490, Volume.Quart, Volume.Liter); // 463.71297
Temperatures
const { ConvTemp } = require("@yetnt/ump");
ConvTemp(1, "K", "C"); // 1 Kelvin to Celsius = -272.15
ConvTemp(1, "Fahrenheit", "kelvin"); // 1 Fahrenheit to kelvin = 255.92777777777775
ConvTemp(1, "c", "f"); // 1 Celsius to Fahrenheit = 33.8
Distance/Area/Volume definitons
Releases
Links
Contributors
Main/Owner/Creator of package
others
- 202291
- Improved PrimeFactorize, by removing feature that does not work.
- Removed Imperal V Metric terms in favour of Enums