@breedr/animals-filter

To install the latest version run:

Usage no npm install needed!

<script type="module">
  import breedrAnimalsFilter from 'https://cdn.skypack.dev/@breedr/animals-filter';
</script>

README

Animals Filter

Installation

To install the latest version run:

yarn add @breedr/animals-filter

Usage

Package has function animalsFilter which has 2 params: animals and filterOptions. Animal should have:

type Animal = {
  passportNumber: string;
  isRegulatorySynced: boolean;
  isWithdrawal?: boolean;
  isMale: boolean;
  group: {
    id: string;
  };
  field: {
    id: string;
  };
  animalBreeds: {
    id: string;
  }[];
  lastWeight: {
    value: string;
    date: string;
  } | null;
  currentWeight: string | null;
  deliveryDate: string | null;
  dob: string | null;
  estimatedWeightOn: string | null;
  estimatedAgeOn: string | null;
  growthRate: number | null;
  lastRegulatorySyncedDate: string | null;
};

filterOptions has:

type FilterOptions = {
  isSynced: boolean; // Mobile
  sex: "" | "M" | "F";
  groups: string[];
  fields: string[];
  breeds: string[];
  minWeight: string;
  maxWeight: string;
  search?: string;
  deliveryDateTo: string;
  deliveryDateFrom: string;
  minAge: string;
  maxAge: string;
  isMale: boolean;
  isRegulatorySynced?: string; // Web
  isWithdrawal?: string;
  minDeliveryWeight: string;
  maxDeliveryWeight: string;
  maxDeliveryAge: string;
  minDeliveryAge: string;
  minCurrentEstWeight?: string;
  maxCurrentEstWeight?: string;
  daysSinceLastWeightFrom?: string;
  daysSinceLastWeightTo?: string;
  growthRateFrom?: string;
  growthRateTo?: string;
  lastSyncedDateFrom?: string;
  lastSyncedDateTo?: string;
};