Skip to content

Commit

Permalink
Filter repeat work positions
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Mar 12, 2021
1 parent cf02f6c commit bbff7ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/components/work.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="container work-container">
{{> title value="Experience"}}

{{#each resume.work}}
{{#each (filterRepeatKey resume.work "company")}}
<section class="item">
{{> section-header name=this.company }}

Expand Down
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ handlebars.registerHelper({

formatDate: function (date) {
return moment(date).format('MM/YYYY');
},

filterRepeatKey: function(list, key) {
return list.map((curr, i, array) => {
if (curr[key] == array[i-1]?.[key]) {
curr[key] = undefined
}
return curr
})
}
});

Expand Down

0 comments on commit bbff7ab

Please sign in to comment.