Last active
September 7, 2022 23:32
-
-
Save mCzolko/81652a0be36286f46f526f4baf8243b9 to your computer and use it in GitHub Desktop.
Maximum operational depth - Command line app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/node | |
const calculate = (arg) => { | |
const o2percentage = Number(arg) | |
const fO2 = o2percentage / 100 | |
const mod = (ppO2) => Number((((ppO2 / fO2) - 1) * 10).toFixed(2)) | |
console.log(`EAN${o2percentage} (content ${o2percentage}% oxygen)`) | |
console.table({ | |
'': { ppO2: 1.4, m: mod(1.4) }, | |
deco: { ppO2: 1.6, m: mod(1.6) }, | |
}, ['ppO2', 'm']) | |
if (process.argv.indexOf(arg) != process.argv.length - 1) { | |
console.log('') | |
} | |
} | |
const [ runner, command, ...o2percentages ] = process.argv | |
o2percentages.forEach(calculate) |
Author
mCzolko
commented
Sep 7, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment