title = title.toLowerCase();
if(title.includes('fiveup') || /5\s*up/.test(title)) {
return ['TILRAY', 'Canaca', '5up', '5up'];
} else if(title.includes('tenup') || /10\s*up/.test(title)) {
return ['TILRAY', 'Canaca', '10up', '10up'];
} else {
brand = brand.toLowerCase();
title = title
.replace(inBrackets, '')
.replace(brand, '')
.replace(/twd(\.?)|"|-|−|%|&|:/g, '')
.replace(/\b(liquid|and|oral|drop(s?)|((hard|soft)(-|−| )?)?(capsule|cap)(s?)|pre(-|−| )?roll(s?)|pack(s?)|joint(s?)|oil|flower|spray)\b/g, '')
;
if(type !== 'capsule') {
title = title.replace(specialqty, '');
if(type === 'spray') {
title = title.replace('mist', '');
}
}
//logo is canonical capitalization and spelling
if(brand.includes('edison')) {
producer = 'ORGANIGRAM';
if(title.includes('reserve')) {
title = title.replace('reserve', '');
brand = 'EDISON RESERVE';
} else if(title.includes('bytes')) {
title = title.replace('bytes', '');
brand = 'EDISON BYTES';
} else {
brand = 'EDISON';
}
if(/casa\s*blanca/.test(title)) {
title = 'casablanca';
}
} else if(brand.includes('sundial')) {
producer = 'SUNDIAL';
//interesting behavior with .match and /g but we only use [0] anyways
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match#Return_value
brand = brand.match(/\b(calm|ease|flow|lift|spark)\b/) || title.match(/\b(calm|ease|flow|lift|spark)\b/);
if(brand !== null) {
brand = brand[0].toUpperCase();
}
title = title.replace(/\b(calm|ease|flow|lift|spark)\b/, '');
} else if(/alta\s*vie/.test(brand)) {
producer = 'Aurora';
brand = 'AltaVie';
} else if(brand.startsWith('tw')) {//may be insufficient
producer = 'CANOPY GROWTH';
brand = 'Tweed';
} else if(brand.includes('canaca')) {
producer = 'TILRAY';
if(title.includes('select') || brand.includes('select')) {
brand = 'Canaca Select';
title = title.replace('select', '');
} else {
brand = 'Canaca';
}
} else if(brand.includes('tantalus')) {
producer = 'Tantalus Labs';
brand = null;
title = title.replace(/bc|sungrown/g, '');
} else if(/48\s*north/.test(brand)) {
producer = '48North';
brand = null;
} else if(/7\sacres*/.test(brand)) {
producer = 'Supreme';
brand = '7ACRES';
} else if(/ace\s*valley/.test(brand)) {
producer = 'flowr';
brand = 'Ace Valley';
} else if(/acreage pharms\s*/.test(brand)) {
producer = 'Acreage Pharms';
brand = null;
} else if(brand.includes('aurora')) {
producer = 'Aurora';
if(brand.includes('drift')) {
brand = 'Drift';
title = title.replace('drift', '');
} else {
brand = null;
}
} else if(brand.includes('beleave')) {
producer = 'beleave';
brand = null;
} else if(brand.includes('bhang')) {
producer = 'Bhang';
brand = null;
} else if(brand.includes('blazery')) {
producer = 'Zenabis';
brand = 'Blazery';
} else if(brand.includes('blissed')) {
//producer = ;rely on quicky.licensed_producer or description. fuck trec brands. fuck rebranders!!!!
//producer_in or search description
brand = 'BLISSED';
} else if(/broken\s*coast/.test(brand)) {
producer = 'aphria';
brand = 'BROKEN COAST';
} else if(/canna\s*farms/.test(brand)) {
producer = 'VIVO';
brand = 'CANNA FARMS';
} else if(/chowie\s*wowie/.test(brand)) {
producer = 'TILRAY';
brand = 'ChOWie wOWie';
} else if(/color\s*cannabis/.test(brand)) {
producer = 'weedmd';
brand = 'Color';
} else if(brand.includes('cove')) {
producer = 'CRONOS';
brand = 'COVE';
} else if(/dna\s*genetics/.test(brand)) {
producer = 'CANOPY GROWTH';
brand = 'DNA GENETICS';
} else if(brand.includes('dosecann')) {
producer = 'Auxly';
brand = 'Dosecann';
} else if(brand.includes('dosist')) {
producer = 'dosist';
brand = null;
} else if(brand.includes('emerald')) {
producer = 'emerald';
brand = 'null';
} else if(brand.includes('everie')) {
producer = 'TILRAY';
brand = 'Everie';
} else if(brand.startsWith('eve')) {
producer = 'Natural MedCo';
brand = 'eVe';
} else if(brand.includes('FIGR')) {
producer = "Canada's Island Garden";
brand = 'FIGR';
} else if(brand.includes('fireside')) {
producer = 'VIVO';
brand = 'FIRESIDE';
} else if(brand.includes('flowr')) {
producer = 'flowr';
brand = null;
} else if(brand.includes('foray')) {
producer = 'Auxly';
brand = 'Foray';
} else if(brand.includes('gage')) {
producer = 'RADICAL';
brand = 'GAGE';
} else if(/good\s*supply/.test(brand)) {
producer = 'aphria';
brand = 'GOOD SUPPLY';
} else if(brand.includes('grail')) {
producer = 'TILRAY';
brand = 'GRAIL';
} else if(brand.includes('haven')) {
producer = 'TERRASCEND';
brand = 'Haven Street';
} else if(brand.includes('hexo')) {
producer = 'HEXO';
brand = null;
} else if(/high\s*tide/.test(brand)) {
producer = 'WAYLAND';
brand = 'HIGH TIDE';
} else if(brand.includes('houseplant')) {
producer = 'CANOPY GROWTH';
brand = 'Houseplant';
} else if(brand.includes('indiva')) {
producer = 'INDIVA';
brand = 'INDIVA';
} else if(brand.includes('irisa')) {
producer = 'TILRAY';
brand = 'IRISA';
} else if(brand.includes('kiwi')) {
producer = 'WAYLAND';
brand = 'KIWI';
} else if(brand.includes('kke')) {
producer = 'Supreme';
brand = "KKE";
} else if(/kolab\s*project/.test(brand)) {
producer = 'Auxly';
brand = 'KOLAB PROJECT';
} else if(brand.includes('lbs')) {
producer = 'CANOPY GROWTH';
brand = 'LBS';
} else if(brand.includes('liiv')) {
producer = 'CannTrust';
brand = 'liiv';
} else if(brand.includes('lumina')) {
producer = 'VIVO';
brand = 'LUMINA';
} else if(/marley\s*natural/.test(brand)) {
producer = 'TILRAY';
brand = 'MARLEY NATURAL';
} else if(brand.includes('namaste')) {
producer = 'Zenabis';
brand = 'NAMASTE';
} else if(/northern\s*green\s*canada/.test(brand)) {
producer = 'NORTHERN GREEN CANADA';
brand = null;
} else if(/northern\s*harvest/.test(brand)) {
producer = 'WAYLAND';
brand = 'NORTHERN HARVEST';
} else if(/original\s*stash/.test(brand)) {
producer = 'HEXO';
brand = 'ORIGINAL STASH';
} else if(/plain\s*packaging/.test(brand)) {
producer = 'CANOPY GROWTH';
brand = 'PLAIN PACKAGING';
} else if(/pure\s*sunfarms/.test(brand)) {
producer = 'PURE SUNFARMS';
brand = null;
} else if(brand.includes('qwest')) {//technically wrong, but I don't want to duplicate the brand in the title. fucktards
producer = 'dECIBEL';
brand = 'QWEST';
if(title.includes('ice')) {
brand += ' RESERVE';
title = 'ice';
} else if(title.includes('spirit')) {
brand += ' RESERVE';
title = 'spirit';
} else if(title.includes('wonder')) {
title = 'wonder';
} else if(title.includes('zest')) {
title = 'zest';
} else if(title.includes('vision')) {
title = 'vision';
} else {
console.log('wow qwest made a new product!!11')
}
} else if(brand.includes('redecan')) {
producer = 'REDECAN';
brand = null;
} else if(brand.includes('aqualitas')) {
producer = 'aqualitas';
brand = 'reef';
} else if(brand.includes('riff')) {
producer = 'aphria';
brand = 'RIFF';
} else if(/royal\s*high/.test(brand)) {
producer = 'HARVEST ONE';
brand = 'ROYAL HIGH';
} else if(/san\s*rafael/.test(brand)) {
producer = 'Aurora';
brand = "San Rafael '71";
} else if(brand.includes('saturday')) {
producer = 'weedmd';
brand = 'SATURDAY';
} else if(/(seven|7)\s*oak/.test(brand)) {
producer = 'beleave';
brand = 'SEVEN OAKS';
} else if(brand.includes('solei')) {
producer = 'aphria';
brand = 'Solei';
} else if(brand.includes('spinach')) {
producer = 'CRONOS';
brand = 'Spinach';
} else if(/sugar\s*leaf/.test(brand)) {
producer = 'Supreme';
brand = 'sugar leaf';
} else if(brand.includes('symbl')) {
producer = 'Aleafia';
brand = 'symbl';
} else if(brand.includes('synr')) {
producer = 'CannTrust';
brand = 'SYNR.G';
} else if(/thc\s*biomed/.test(brand)) {
producer = 'THC BioMed';
brand = null;
} else if(/the\s*batch/.test(brand)) {
producer = 'TILRAY';
brand = 'THE BATCH';
} else if(/the\s*green\s*organic\s*dutchman/.test(brand)) {
producer = 'THE GREEN ORGANIC DUTCHMAN';
brand = null;
} else if(/tokyo\s*smoke/.test(brand)) {
producer = 'CANOPY';
brand = 'TOKYO SMOKE';
} else if(/top\s*leaf/.test(brand)) {
producer = 'SUNDIAL';
brand = 'TOPLEAF';
} else if(brand.includes('trailblazer')) {
producer = 'ORGANIGRAM';
brand = 'TRAILBLAZER';
} else if(brand.includes('up')) {
producer = 'HEXO';
brand = 'UP';
} else if(/van\s*der\s*pop/.test(brand)) {
producer = 'CANOPY';
brand = 'Van der Pop';
} else if(brand.includes('vertical')) {
producer = 'AgMEDICA';
brand = 'VERTICAL';
} else if(brand.includes('wayfarer')) {
producer = 'MediPharm Labs';
brand = 'Wayfarer';
} else if(brand.includes('wdbx')) {
producer = 'CANADA HOUSE';
brand = 'WDBX';
} else if(brand.includes('whistler')) {
producer = 'Aurora';
brand = 'Whistler';
} else if(brand.includes('wink')) {
//producer = ;rely on quicky.licensed_producer or description. fuck trec brands. fuck rebranders!!!!
//producer_in or search description
brand = 'WINK';
} else if(brand.includes('woodstock')) {
producer = 'Aurora';
brand = 'WOODSTOCK';
} else if(brand.includes('xscape')) {
producer = 'CannTrust';
brand = 'XSCAPE';
}
join_title = title.split(/\s+/).sort().join('');
return [producer, brand, title, join_title];