Socket
Socket
Sign inDemoInstall

mri

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

6

lib/index.js

@@ -87,4 +87,4 @@ 'use strict';

while (args[idx] !== void 0) {
let incr = 1;
const val = args[idx];
let incr = 1;

@@ -107,2 +107,6 @@ if (val === '--') {

if (opts.unknown !== void 0 && aliases[key] === void 0) {
return opts.unknown(segs[0]);
}
if (segs.length > 1) {

@@ -109,0 +113,0 @@ tmp = segs[1];

2

package.json
{
"name": "mri",
"version": "1.0.0",
"version": "1.1.0",
"description": "Quickly scan for CLI flags and arguments",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -96,3 +96,14 @@ # mri [![Build Status](https://travis-ci.org/lukeed/mri.svg?branch=master)](https://travis-ci.org/lukeed/mri)

#### options.unknown
Type: `function`<br>
Default: `undefined`
Callback that is run when a parsed flag has not been defined as a known key or alias. Its only parameter is the unknown flag itself; eg `--foobar` or `-f`.
Once an unknown flag is encountered, parsing will terminate, regardless of your return value.
> **Note:** `mri` _only_ checks for unknown flags if `options.unknown` **and** `options.alias` are populated. Otherwise, everything will be accepted.
## Comparisons

@@ -113,5 +124,6 @@

```
- The `opts.unknown` behaves differently:
- Unlike `minimist`, `mri` will not continue continue parsing after encountering an unknown flag
- Missing `options`:
- `opts.stopEarly`
- `opts.unknown`
- `opts['--']`

@@ -140,2 +152,3 @@ - Ignores newlines (`\n`) within args (see [test](https://github.com/substack/minimist/blob/master/test/parse.js#L69-L80))

- No [additional configuration](https://github.com/yargs/yargs-parser#configuration) object
- Added [`options.unknown`](##optionsunknown) feature

@@ -147,7 +160,7 @@

mri
--> 328,452 ops/sec ±0.28% (92 runs sampled)
--> 329,310 ops/sec ±0.27% (88 runs sampled)
yargs
--> 16,014 ops/sec ±0.69% (94 runs sampled)
--> 16,100 ops/sec ±0.57% (91 runs sampled)
minimist
--> 131,896 ops/sec ±0.92% (90 runs sampled)
--> 129,670 ops/sec ±0.72% (93 runs sampled)
```

@@ -154,0 +167,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc