This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class PriceSpecification { | |
/** | |
* @param {min: Number, max: Number} price | |
*/ | |
constructor(price) { | |
this.min = price.min | |
this.max = price.max | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ColorSpecification { | |
/** | |
* @param color: String | |
*/ | |
constructor(color) { | |
this.color = color | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const filterByColor = color => { | |
this.products.filter( product => { | |
let colorFound | |
// [0] index in this case is the 'color' options | |
const colors = product.options[0].values | |
if(colors.indexOf(color) != -1) colorFound = true |