{"library":"mri","title":"mri","description":"mri is a compact and high-performance library designed for quickly parsing command-line interface (CLI) flags and arguments in Node.js environments. It serves as a lightweight and significantly faster alternative to more feature-rich parsers like `minimist` and `yargs-parser`, often achieving 5x to 40x speed improvements respectively. The current stable version is 1.2.0. The project maintains an active release cadence, frequently publishing patch and minor versions that focus on performance optimizations, bug fixes, and minor feature additions. A key differentiator is its minimalist API, intentionally omitting complex features found in other parsers for raw speed, while still providing essential functionalities like aliasing, boolean and string type coercions, and default values. As of v1.2.0, TypeScript definitions are included directly within the package.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install mri"],"cli":null},"imports":["import mri from 'mri';","const mri = require('mri');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const mri = require('mri');\n\n// Simulate process.argv for demonstration\nconst argv = ['--foo', '--bar=baz', '-mtv', '--', 'hello', 'world'];\n\nconsole.log('Default parsing:');\nconsole.log(mri(argv));\n// Expected: { _: ['hello', 'world'], foo:true, bar:'baz', m:true, t:true, v:true }\n\nconsole.log('\\nParsing with boolean options:');\nconsole.log(mri(argv, { boolean:['bar'] }));\n// Expected: { _: ['baz', 'hello', 'world'], foo:true, bar:true, m:true, t:true, v:true }\n\nconsole.log('\\nParsing with aliases:');\nconsole.log(mri(argv, {\n  alias: {\n    b: 'bar',\n    foo: ['f', 'fuz']\n  }\n}));\n// Expected: { _: ['hello', 'world'], foo:true, f:true, fuz:true, b:'baz', bar:'baz', m:true, t:true, v:true }","lang":"javascript","description":"Demonstrates basic parsing of CLI arguments, including boolean flags and aliases.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}