@mikezimm/fps-core-v7
Version:
Library of reusable core interfaces, types and constants migrated from fps-library-v2
25 lines • 1.16 kB
JavaScript
import { ItemIsAKeys, ItemIsAValues } from "../../AnyContent/IsA/IFPSItemIsA";
export function addItemIsA(item, ItemIsAThis) {
let { searchTextLC, } = item.FPSItem.Search;
const { meta } = item.FPSItem.Search;
const itemIsAIdx = ItemIsAValues.indexOf(ItemIsAThis);
if (itemIsAIdx < 0) {
console.log('WARNING: addItemIsA is invalid!', ItemIsAThis);
return item;
}
else {
const itemIsAKey = ItemIsAKeys[itemIsAIdx];
if (meta.indexOf(ItemIsAThis) < 0) {
meta.push(ItemIsAThis);
searchTextLC = `${ItemIsAThis.toLocaleLowerCase()} || ${searchTextLC}`;
item.FPSItem.IsA[`${itemIsAKey}`] = true;
if (item.FPSItem.IsA.allIsAKeys.indexOf(ItemIsAThis) < 0) {
item.FPSItem.IsA.allIsAKeys.push(ItemIsAThis);
// Added to be able to leverage in the reactListView render to add highglighted icons https://github.com/mikezimm/pivottiles7/issues/440
item.FPSItem.IsA.allIsAKeysStr += `${ItemIsAThis} `;
}
}
return item;
}
}
//# sourceMappingURL=addItemIsA.js.map