Skip to content

Commit

Permalink
Merge pull request #1570 from bhldev/feature-options-keys
Browse files Browse the repository at this point in the history
FEATURE - Expose Grunt Option Keys for Ease of Use
  • Loading branch information
vladikoff committed Jul 3, 2020
2 parents ee70306 + 85e5246 commit 0d23eff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/grunt/option.js
Expand Up @@ -31,3 +31,8 @@ option.flags = function() {
(typeof val === 'boolean' ? '' : '=' + val);
});
};

// Get all option keys
option.keys = function() {
return Object.keys(data);
};
11 changes: 11 additions & 0 deletions test/grunt/option_test.js
Expand Up @@ -38,4 +38,15 @@ exports.option = {
test.deepEqual(grunt.option.flags(), ['--foo=bar', '--there', '--obj=[object Object]']);
test.done();
},
'option.keys': function(test) {
test.expect(1);
grunt.option.init({
foo: 'bar',
there: true,
obj: {foo: 'bar'},
arr: []
});
test.deepEqual(grunt.option.keys(), ['foo', 'there', 'obj', 'arr']);
test.done();
}
};

0 comments on commit 0d23eff

Please sign in to comment.