Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

407 B
Raw Blame
/**
 * Get the index of the item in the list of item names.
 * If the item name is not found, return 0.
 * If no item name is provided, return 0.
 */
export const getItemIndex = (targetItemId: string | undefined | null, itemIds: string[]) => {
  if (!targetItemId || itemIds.length === 0) {
    return 0;
  }
  const index = itemIds.findIndex((n) => n === targetItemId);
  return index >= 0 ? index : 0;
};