{"id":21578859,"url":"https://github.com/yetnt/ump","last_synced_at":"2026-02-03T17:02:49.097Z","repository":{"id":65700774,"uuid":"597305924","full_name":"yetnt/ump","owner":"yetnt","description":"These utils are useless","archived":false,"fork":false,"pushed_at":"2024-10-17T19:34:29.000Z","size":828,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T15:21:48.451Z","etag":null,"topics":["area","data","distance","factorization","factors","gcd-calculator","javascript","math","mean","median","mode","numbers","pattern","prime","range","rate","ratio","temprature","temprature-converter","volume"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yetnt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-04T05:47:16.000Z","updated_at":"2024-10-17T19:33:49.000Z","dependencies_parsed_at":"2024-10-19T20:35:09.498Z","dependency_job_id":null,"html_url":"https://github.com/yetnt/ump","commit_stats":null,"previous_names":["yetnt/ump","yetity/ump"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetnt%2Fump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetnt%2Fump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetnt%2Fump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetnt%2Fump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yetnt","download_url":"https://codeload.github.com/yetnt/ump/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262192,"owners_count":21074261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["area","data","distance","factorization","factors","gcd-calculator","javascript","math","mean","median","mode","numbers","pattern","prime","range","rate","ratio","temprature","temprature-converter","volume"],"created_at":"2024-11-24T13:11:44.037Z","updated_at":"2026-02-03T17:02:44.065Z","avatar_url":"https://github.com/yetnt.png","language":"TypeScript","readme":"-- TO DO: Update read me\n\n# Useless Math Package\n\nI mean.. Do you really need this?\n\n# Installation\n\n```bash\nnpm i @yetnt/ump\nsudo npm install @yetnt/ump\nyarn add @yetnt/ump\n```\n\n```js\nconst ump = require(\"@yetnt/ump\");\nump.primeFactorize();\n```\n\nor\n\n```js\nconst { primeFactorize } = require(\"@yetnt/ump\");\nprimeFactorize();\n```\n\n# Features\n\n## `primeFactorize`\n\nPrime Factorization\n\n### Parameters\n\n-   `num`: The number to be factorized\n\n```js\nconst { primeFactorize } = require(\"@yetnt/ump\");\n\nprimeFactorize(50); // [2, 5, 5]\nprimeFactorize(5000); // [2, 2, 2, 5, 5, 5, 5]\nprimeFactorize(93928893); // [3, 17, 103, 17881]\nprimeFactorize(3); // [3]\n```\n\n## Ratio(s)\n\n### `dinRatio`\n\nDivide `x` in the ratio of `y`:`z`\n\n#### Parameters\n\n-   `x`: Dividend\n-   `y`: The ratio value for y\n-   `z`: The ratio value for z\n-   `round`**(optional)**: Round off to 2 decimal places\n\n```js\nconst { dinRatio } = require(\"@yetnt/ump\");\n\ndinRatio(500, 3, 2); // [300, 200]\ndinRatio(456.93, 12, 5); // [ 322.5388235294118, 134.39117647058825 ]\ndinRatio(456.93, 12, 5, true); // ['322.54', '134.39']\n```\n\n### `propRatio`\n\nDirect Proportion (equivalent ratios)\nCalculates the proportional value of `x`, `y`, and `z` in a ratio.\n\n#### Parameters\n\n-   `x`: The x value in the ratio\n-   `y`: The y value in the ratio\n-   `z`: The z value in the ratio\n-   `which`**(optional)**: Switch unknown value and z\n\n```js\nconst { propRatio } = require(\"@yetnt/ump\");\n\npropRatio(2, 4, 6, true); // 12\n/* \nx : y\nz : ?\n\nin this case:\n2 : 4\n6 : ?\n*/\n\npropRatio(2, 6, 12); // 4\n/*\nx : y\n? : z\n\nin this case\n2 : 6\n? : 12\n*/\n```\n\n## Conversion\n\n### Parameters\n\nThe parameters stay the same for every function.\n\n-   `n`: The value to be converted\n-   `from`: Current area unit -`to`: Area unit to convert to.\n\nEach function comes with it's own enums for the area unit strings.\n\n### Distance\n\n```js\nconst { Convert, Distance } = require(\"@yetnt/ump\");\n\nConvert.distance(12, Distance.Millimeter, Distance.Centimeter); // 1.2\nConvert.distance(1, Distance.Inch, Distance.Centimeter); // 2.54\nConvert.distance(98, Distance.NauticalMile, Distance.Nanometer); // 1852000000000\n```\n\n### Area\n\n```js\nconst { Convert, Area } = require(\"@yetnt/ump\");\n\nConvert.area(34, Area.SquareCentimetre, Area.SquareInch); // 5.27001054002108\nConvert.area(34, \"cm2\", \"inch2\"); // 5.27001054002108\nConvert.area(490, Area.Hectare, Area.SquareFoot); // 52743183.75079384\n```\n\n### Volume\n\n```js\nconst { Convert, Volume } = require(\"@yetnt/ump\");\n\nConvert.volume(34, Volume.CubicCentimeter, Volume.CubicInch); // 2.0748027411805627\nConvert.volume(34, \"cm3\", \"inch3\"); // 2.0748027411805627\nConvert.volume(490, Volume.Quart, Volume.Liter); // 463.71297\n```\n\n### Temperature\n\n```js\nconst { Convert } = require(\"@yetnt/ump\");\n\nConvert.temp(1, \"K\", \"C\"); // 1 Kelvin to Celsius = -272.15\nConvert.temp(1, \"Fahrenheit\", \"kelvin\"); // 1 Fahrenheit to kelvin = 255.92777777777775\nConvert.temp(1, \"c\", \"f\"); // 1 Celsius to Fahrenheit = 33.8\n```\n\n### Data\n\n```js\nconst { Convert, Data } = require(\"@yetnt/ump\");\n\nConvert.data(15, Data.Kibibyte, Data.Tebibyte); // 1.396983862272e-8\nConvert.data(20, Data.Gigabyte, Data.Kilobyte); // 20000000\nConvert.data(1, Data.Terabyte, Data.Bit); //8000000000000\n```\n\n## Pattterns\n\nThe functions stay mostly the same for all the pattern stuff, just with different parameters depending on the pattern.\n\n### Linear Patterns\n\n#### `findNthTerm`\n\n-   `num1`: The first number in the sequence\n-   `num2`: The second number in the sequence\n-   `num3`: The third number in the sequence\n-   `returnSimplified`**(optional)**: Return the simplified formula of **Tn = dn+c** rather than **Tn = a + (n - 1) \\* d**\n\n#### `findTerm`\n\nFind the a term in the sequence.\n\n-   `n`: The term position in the sequence\n-   `d`: The difference\n-   `a`: First number in sequence. The formula for this is **Tn = a + (n - 1) \\* d**. If you prefer to use **Tn = dn+c**, then `a` is `c`\n\n```js\nconst { LinearPattern } = require(\"@yetnt/ump\");\n\nlet nthTerm = LinearPattern.findNthTerm(10, 20, 30);\nconsole.log(nthTerm); // { a: 10, d: 10, formula: '10 + (n - 1) * 10' }\nLinearPattern.findTerm(90, nthTerm.d, nthTerm.a);\n\n// USING SIMPLIFIED FORMULA\n\nlet nthTerm = LinearPattern.findNthTerm(10, 20, 30, true);\nconsole.log(nthTerm); // { c: 10, d: 10, formula: '10 + (n - 1) * 10' }\nLinearPattern.findTerm(90, nthTerm.d, nthTerm.c);\n```\n\n#### `findTerms`\n\nReturns an array of the pattern starting at term `n` and ending at term `nn`\n\n-   `n`: The term to start at\n-   `nn`: The term to end at\n-   `d`: The difference\n-   `a`: First number in sequence. The formula for this is **Tn = a + (n - 1) \\* d**. If you prefer to use **Tn = dn+c**, then `a` is `c`\n\n```js\nconst { LinearPattern } = require(\"@yetnt/umo\");\n\nconst a = LinearPattern.findTerms(1, 10, 1, 1);\nconsole.log(a); // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n```\n\n### Geometric Patterns\n\n#### `findNthTerm`\n\n-   `num1`: The first number in the sequence\n-   `num2`: The second number in the sequence\n-   `num3`: The third number in the sequence\n\n#### `findTerm`\n\nFind a term in the sequence\n\n-   `n`: The term number\n-   `a`: The first term\n-   `r`: The constant ratio\n\n```js\nconst { GeometricPattern } = require(\"@yetnt/ump\");\n\nlet nthTerm = GeometricPattern.findNthTerm(2, 4, 8);\nconsole.log(nthTerm); // { a: 2, r: 2, formula: '2 * 2^(n - 1)' }\n\nGeometricPattern.findTerm(20, nthTerm.a, nthTerm.r); // 1048576\n```\n\n#### `findTerms`\n\nReturns an array of the pattern starting at term `n` and ending at term `nn`\n\n-   `n`: The term to start at\n-   `nn`: The term to end at\n-   `a`: The first term\n-   `r`: Constant Ratio\n\n```js\nconst { GeometricPattern } = require(\"@yetnt/ump\");\n\nconst a = GeometricPattern.findTerms(1, 10, 1, 2);\nconsole.log(a); // [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]\n```\n\n### Quadratic Patterns\n\n#### `findNthTerm`\n\n-   `num1`: The first number in the sequence\n-   `num2`: The second number in the sequence\n-   `num3`: The third number in the sequence\n\n#### `findTerm`\n\nFind a term in the sequence\n\n-   `n`: The term number\n-   `a`: Quadratic coefficient (_`a`n² + bn + c_)\n-   `b`: Linear coefficient (_an² + `b`n + c_)\n-   `c`: Constant term / y-intercept (_an² + bn + `c`_)\n\n```js\nconst { QuadraticPattern } = require(\"@yetnt/ump\");\n\nlet nthTerm = QuadraticPattern.findNthTerm(139, 184, 235);\nconsole.log(nthTerm); // { a: 3, b: 36, c: 100, formula: '(3n^2) + (36n) + 100' }\n\nQuadraticPattern.findTerm(20, nthTerm.a, nthTerm.b, nthTerm.c); // 2020\n```\n\n#### `findTerms`\n\nReturns an array of the pattern starting at term `n` and ending at term `nn`\n\n-   `n`: The term to start at\n-   `nn`: The term to end at\n-   `a`: Quadratic coefficient (_`a`n² + bn + c_)\n-   `b`: Linear coefficient (_an² + `b`n + c_)\n-   `c`: Constant term / y-intercept (_an² + bn + `c`_)\n\n```js\nconst { QuadraticPattern } = require(\"@yetnt/ump\");\n\nconst a = QuadraticPattern.findTerms(1, 10, 1, 2, 7);\nconsole.log(a); // [10, 15, 22, 31, 42, 55, 70, 87, 106, 127]\n```\n\n## `gcd`\n\nGreatest Common Divisor (Highest Common Factor)\n\n### Parameters\n\n-   `a`: 1dt number\n-   `b`: 2nd number\n\n```js\nconst { gcd } = require(\"@yetnt/ump\");\n\ngcd(56, 24); // 8\n```\n\n## Statistics\n\n### Parameters\n\nThese all take in an array of numbers.\n\n-   `arr`: Array of numbers.\n\n### Mean\n\nAverage\n\n```js\nconst { Stats } = require(\"@yetnt/ump\");\n\nStats.mean([1, 1, 2, 6, 7, 8, 3, 5, 5, 1]); // 3.9\n```\n\n### Median\n\nMiddle number\n\n```js\nconst { Stats } = require(\"@yetnt/ump\");\n\nStats.median([1, 1, 2, 6, 7, 8, 3, 5, 5, 1]); //2.5\n```\n\n### Mode\n\nNumber that occurs the most\n\n```js\nconst { Stats } = require(\"@yetnt/ump\");\n\nStats.mode([1, 1, 2, 6, 7, 8, 3, 5, 5, 1]); // [ 1 ]\n```\n\n### Range\n\nMax - Min\n\n```js\nconst { Stats } = require(\"@yetnt/ump\");\n\nStats.range([1, 1, 2, 6, 7, 8, 3, 5, 5, 1]); // 7\n```\n\n### Sum\n\nSum of all the numbers.\n\n```js\nconst { Stats } = require(\"@yetnt/ump\");\n\nStats.sum([1, 1, 2, 6, 7, 8, 3, 5, 5, 1]); // 39\n```\n\n# Releases\n\n[Github](https://github.com/Yetity/ump/releases) \\\n**[Latest](https://github.com/Yetity/ump/releases/latest)**\n\n# Links\n\n-   [Github](https://github.com/Yetity/ump)\n-   [NPM](https://npmjs.com/package/@yetnt/ump)\n\n# Contributors\n\n## Main/Owner/Creator of package\n\n-   YetNT\n    -   [Discord](https://discordapp.com/users/671549251024584725)\n    -   [Github](https://github.com/Yetity)\n    -   [NPM](https://npmjs.com/~yetnt)\n\n## others\n\n-   202291\n    -   _Improved PrimeFactorize, by removing feature that does not work._\n    -   _Removed Imperal V Metric terms in favour of Enums_\n\n![UMP](./ump-banner.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyetnt%2Fump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyetnt%2Fump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyetnt%2Fump/lists"}