@netanelh2/playwright-framework
Version:
A robust Playwright TypeScript testing framework with Page Object Model, smart locators, and utilities
8 lines • 434 B
JavaScript
export const findItemByProperty = (array, propertyName, expectedValue) => {
const foundItem = array.find((item) => item[propertyName] === expectedValue);
if (!foundItem) {
throw new Error(`Failed to find item in array: No item found with property '${String(propertyName)}' matching value '${expectedValue}'. Array contains ${array.length} items.`);
}
return foundItem;
};
//# sourceMappingURL=arrayUtils.js.map