
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
var catalytic = require('catalytic')
var converter = catalytic.converter({
baseUnitName: 'lb',
types: [
{id: 'id1', name: 'case (50lb)', qty: 50},
{id: 'id2', name: 'porterhouse (1.5lb)', qty: 1.5},
{id: 'id3', name: 'porterhouse (2lb)', qty: 2}
]
})
converter.convertTo(100, 'id1') // => 2
converter.convertTo(90, 'id1') // => 1.8
converter.strConvertTo(100, 'id1') // => "2 x case (50lb)"
converter.convertFrom(2, 'id1') // => 100
converter.strConvertFrom(5, 'id1') // "250 x lb"
If you're converting from/to undefined
or null
, we assume you're converting
from/to the base unit (i.e., not changing anything):
converter.convertTo(100) // => 100
converter.strConvertTo(100) // => "100 x lb"
converter.convertFrom(10) // => 10
converter.strConvertFrom(10) // => "10 x lb"
There's also some basic methods for easy conversion without an object:
catalytic.convertToUnitQty({count: 5, unitQty: 10}) // => 50
catalytic.convertFromUnitQty({count: 50, unitQty: 10}) // => 5
This module is written in ES2015 and converted to node-friendly CommonJS via Babel. Tests are run with mocha.
If you're going to add a PR, please write a test too. They live in the test
directory. To run all tests:
npm test
To compile the src
directory to lib
:
npm run build
FAQs
Convert between arbitrary units with BigNumber math
The npm package catalytic receives a total of 2 weekly downloads. As such, catalytic popularity was classified as not popular.
We found that catalytic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.