Skip to content

Commit

Permalink
fix(utils): use the reducer to build objects from entries (#79)
Browse files Browse the repository at this point in the history
closes #78
  • Loading branch information
derevnjuk committed Aug 28, 2020
1 parent f187ca8 commit 7d89a67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- run: echo :set-env name=VERSION::${GITHUB_REF/refs\/tags\//}
- run: npm ci -q
- run: npm run build
- run: npm version --no-git-tag-version "$VERSION"
- run: npm version --no-git-tag-version $VERSION
- run: npm run pack:win

- uses: actions/upload-artifact@v2
Expand Down
13 changes: 1 addition & 12 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,7 @@
"releasedLabels": false,
"failTitle": false,
"failComment": false,
"successComment": false,
"assets": [
{
"path": "bin/win64/nexploit-cli.exe",
"label": "nexploit-cli-windows-x64.exe"
},
{ "path": "bin/mac/nexploit-cli", "label": "nexploit-cli-mac-x64" },
{
"path": "bin/linux/nexploit-cli",
"label": "nexploit-cli-linux-x64"
}
]
"successComment": false
}
]
],
Expand Down
8 changes: 5 additions & 3 deletions src/Utils/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export class Helpers {
public static parseHeaders(headers: string[] = []): Record<string, string> {
ok(Array.isArray(headers), 'First argument must be an instance of Array.');

return Object.fromEntries(
headers.map((value: string) => this.parseHeader(value))
);
return headers.reduce((acc: Record<string, string>, value: string) => {
const [key, header]: [string, string] = this.parseHeader(value);

return { ...acc, [key]: header };
}, {});
}

private static parseHeader(header: string): [string, string] | undefined {
Expand Down

0 comments on commit 7d89a67

Please sign in to comment.