1c4568c8b1
## TODO: - [x] display "yearly" or "monthly" wording everywhere it's needed - [ ] Add button with "downgrade" or "upgrade" to save the change of credits price + modal to validate - [x] Add renewal date - [ ] Implement https://docs.stripe.com/billing/subscriptions/subscription-schedules for `switchFromYearlyToMonthly` and decrease number of credits
15 lines
278 B
TypeScript
15 lines
278 B
TypeScript
import { isDefined } from 'twenty-shared/utils';
|
|
|
|
export const findOrThrow = <T>(
|
|
array: T[],
|
|
predicate: (value: T) => boolean,
|
|
): T => {
|
|
const result = array.find(predicate);
|
|
|
|
if (!isDefined(result)) {
|
|
throw new Error('Element not found');
|
|
}
|
|
|
|
return result;
|
|
};
|