import gatsbyStrategy from "./gatsby" ; import nextjsStrategy from "./nextjs" ; import reactStrategy from "./react" ; import { CPAStrategy } from "./types" ; const strategies = { nextjs : nextjsStrategy , gatsby : gatsbyStrategy , react : reactStrategy , } ; export const getCPAStrategy = ( platform , errorMsg ? ) : CPAStrategy => { if ( ! Object . keys ( strategies ) . includes ( platform ) ) { const msg = errorMsg || `Unrecognized platform: ${ platform }` ; throw new Error ( msg ) ; } return strategies [ platform ] ; } ;