Skip to content

Instantly share code, notes, and snippets.

@mCzolko
Last active September 7, 2022 23:32
Show Gist options
  • Save mCzolko/81652a0be36286f46f526f4baf8243b9 to your computer and use it in GitHub Desktop.
Save mCzolko/81652a0be36286f46f526f4baf8243b9 to your computer and use it in GitHub Desktop.
Maximum operational depth - Command line app
#!/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)
@mCzolko
Copy link
Author

mCzolko commented Sep 7, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment