Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #9 #10

Merged
merged 1 commit into from Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -61,7 +61,9 @@ module.exports = function (args, opts) {
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
if (aliases[key]) {
flags.strings[aliases[key]] = true;
[].concat(aliases[key]).forEach(function (k) {
nhz-io marked this conversation as resolved.
Show resolved Hide resolved
flags.strings[k] = true;
});
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -20,7 +20,7 @@
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape test/*.js",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production",
"version": "auto-changelog && git add CHANGELOG.md",
Expand Down
11 changes: 11 additions & 0 deletions test/parse.js
Expand Up @@ -142,6 +142,17 @@ test('string and alias', function (t) {
t.equal(typeof y.str, 'string');
t.equal(y.s, '000123');
t.equal(typeof y.s, 'string');

var z = parse(['-s123'], {
alias: { str: ['s', 'S'] },
string: ['str'],
});

t.deepEqual(
z,
{ _: [], s: '123', S: '123', str: '123' },
'opt.string works with multiple aliases'
);
t.end();
});

Expand Down