Skip to content

Instantly share code, notes, and snippets.

@nickgrato
Last active January 20, 2022 17:10
Show Gist options
  • Save nickgrato/3696b711227bfb5c8d516b21d69fccab to your computer and use it in GitHub Desktop.
Save nickgrato/3696b711227bfb5c8d516b21d69fccab to your computer and use it in GitHub Desktop.
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