Skip to content

Commit

Permalink
refactor: use native Array.prototype.some() functionality (gatsbyjs#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
igeligel authored and Jason Lengstorf committed Jun 17, 2019
1 parent 886e668 commit c624739
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/components/Cart/Cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ class Cart extends Component {
render() {
const { status, toggle } = this.props;
const { className } = this.state;
let showFreeBonus = true;
const gatsbyStickerPackID =
'Z2lkOi8vc2hvcGlmeS9DaGVja291dExpbmVJdGVtL2I1ZGY0NjRmMWQxYWQxM2MzMzJjYmQ0MjMyZDczZGE3P2NoZWNrb3V0PTY1NjU3NDMxMjk2MTRiMmRjZjc4MDIzYmRlYzA4MTM2';

Expand Down Expand Up @@ -345,11 +344,9 @@ class Cart extends Component {
0
);

checkout.lineItems.forEach(({ id }) => {
if (id === gatsbyStickerPackID) {
showFreeBonus = false;
}
});
const showFreeBonus = !checkout.lineItems.some(
({ id }) => id === gatsbyStickerPackID
);

return (
<CartRoot
Expand Down

0 comments on commit c624739

Please sign in to comment.