Last active
January 20, 2022 17:10
-
-
Save nickgrato/3696b711227bfb5c8d516b21d69fccab to your computer and use it in GitHub Desktop.
This file contains 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 | |
} | |
/** | |
* Spec Description | |
* @param {Product} product | |
*/ | |
isSatisfied(product) { | |
// check is product have color here.. | |
let colorFound = false | |
// Color is index "0" | |
const colors = product.options[0].values | |
if(colors.indexOf(this.color) !== -1) colorFound = true | |
return colorFound | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment