- Notifications
You must be signed in to change notification settings - Fork 123
Open
Labels
Description
Node.js: v14.15.2
yargs-parser: v20.2.7
const yargsParser = require('yargs-parser'); const opts = { string: ['asd'], configuration: { 'boolean-negation': false, 'camel-case-expansion': false, 'unknown-options-as-args': true, }, }; console.log(yargsParser('--no-asd2 123', opts)); // { _: [ '--no-asd2', 123 ] } console.log(yargsParser('--no-asd 123', opts)); // { _: [], 'no-asd': 123 }
Is it correct behaviour? Because of 'boolean-negation': false
I was expecting similar output { _: [ '--no-asd', 123 ] }
.
Fixed that by adding 'negation-prefix': Math.random().toString(36).slice(2)
to configuration. But that would be better to fix it under the hood :) Thanks!
UPD: even 'negation-prefix': ''
works fine.