@dennisdigital/injection-rules-helpers
v1.0.0
Published
These are ad rule functions that can be imported and used by the webapps. They should be generic enough to be used in different projects/ rule files.
Downloads
3
Keywords
Readme
adRules
These are ad rule functions that can be imported and used by the webapps. They should be generic enough to be used in different projects/ rule files.
They take configurations coming from graphQL (usually controlled by the portal) and use that configuration along with variables provided by the rules using those functions (these variables are coming options exposed by the inject function) to return either a value.
The current adRules used are:
{
isBetweenTwoTextBlocks,
isLastIndexOfArray,
shouldInjectFirstSideAd
isRightNumberOfWordsForTeads
getWordCountFromLastIndexOfTypeToEndOfArray
getWordCountFromCurrentIdxToEnd
shouldInjectLastAd
}
These functions are exported as an object by @dennisdigital/injection-rules-helpers and can by used in the webapps like this:
import { injectionRules } from '@dennisdigital/injection-rules-helpers';
const wordCountFromCurrIdxToEnd = getWordCountFromCurrentIdxToEnd({ ...options });
All rules accept objects and de-constructing that object to get the values they need.
Please look at the inline docs for what each function does.