mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-06 06:17:11 -04:00
🔧:build SSR dist and deploy
This commit is contained in:
parent
76c26901d7
commit
c59ad6aedb
465 changed files with 214127 additions and 2 deletions
19
dist/server/chunks/chunk-5f44352e.js
vendored
Normal file
19
dist/server/chunks/chunk-5f44352e.js
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
function convertBase({ value, fromBase, toBase }) {
|
||||
const range = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/".split("");
|
||||
const fromRange = range.slice(0, fromBase);
|
||||
const toRange = range.slice(0, toBase);
|
||||
let decValue = value.split("").reverse().reduce((carry, digit, index) => {
|
||||
if (!fromRange.includes(digit)) {
|
||||
throw new Error(`Invalid digit "${digit}" for base ${fromBase}.`);
|
||||
}
|
||||
return carry += fromRange.indexOf(digit) * fromBase ** index;
|
||||
}, 0);
|
||||
let newValue = "";
|
||||
while (decValue > 0) {
|
||||
newValue = toRange[decValue % toBase] + newValue;
|
||||
decValue = (decValue - decValue % toBase) / toBase;
|
||||
}
|
||||
return newValue || "0";
|
||||
}
|
||||
|
||||
export { convertBase as c };
|
Loading…
Add table
Add a link
Reference in a new issue