Skip to content

Commit b31fe9e

Browse files
committed
Simplify option default assignments
Rather than manually assigning object properties in a loop, use the spread operator to combine in a single statement. Signed-off-by: Kevin Locke <[email protected]>
1 parent 20f2b1e commit b31fe9e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,10 @@ gitBranchIs.getBranch = function getBranch(options, callback) {
121121
return undefined;
122122
}
123123

124-
const combinedOpts = {};
125-
Object.keys(GitBranchIsOptions).forEach((prop) => {
126-
combinedOpts[prop] = GitBranchIsOptions[prop];
127-
});
128-
Object.keys(new Object(options)).forEach((prop) => {
129-
combinedOpts[prop] = options[prop];
130-
});
131-
124+
const combinedOpts = {
125+
...GitBranchIsOptions,
126+
...options,
127+
};
132128
const gitArgs = combinedOpts.gitArgs
133129
? Array.prototype.slice.call(combinedOpts.gitArgs, 0)
134130
: [];

0 commit comments

Comments
 (0)