From 0a1b3289dc42670d2b53371d291bc016eb062c91 Mon Sep 17 00:00:00 2001 From: Bianca Danforth Date: Fri, 3 Aug 2018 14:53:53 -0700 Subject: [PATCH] Rename hasDivWithPriceClass to hasPriceClass and udpate description. --- src/fathom_coefficients.json | 2 +- src/fathom_extraction.js | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/fathom_coefficients.json b/src/fathom_coefficients.json index 46f28f0..83b8f89 100644 --- a/src/fathom_coefficients.json +++ b/src/fathom_coefficients.json @@ -1,3 +1,3 @@ { - "hasDivWithPriceClass": 2 + "hasPriceClass": 2 } diff --git a/src/fathom_extraction.js b/src/fathom_extraction.js index ba4846e..6efad7f 100644 --- a/src/fathom_extraction.js +++ b/src/fathom_extraction.js @@ -13,16 +13,14 @@ import {dom, out, rule, ruleset, score, type} from 'fathom-web'; import fathomCoeffs from 'commerce/fathom_coefficients.json'; -const SCORE_THRESHOLD = fathomCoeffs.hasDivWithPriceClass; +const SCORE_THRESHOLD = fathomCoeffs.hasPriceClass; /** - * Checks to see if an element is a
with a class of "price". - * Returns an integer corresponding to the coefficient to use for - * scoring an element with this rule. + * Scores fnodes with a "price" class */ -function hasDivWithPriceClass(fnode) { +function hasPriceClass(fnode) { if (fnode.element.classList.contains('price')) { - return fathomCoeffs.hasDivWithPriceClass; + return fathomCoeffs.hasPriceClass; } return 1; } @@ -35,7 +33,7 @@ const rules = ruleset( rule(dom('div'), type('priceish')), // check class names to see if they contain 'price' - rule(type('priceish'), score(hasDivWithPriceClass)), + rule(type('priceish'), score(hasPriceClass)), // return price element with max score rule(type('priceish').max(), out('product-price')),