graycoreio/daffodil

View on GitHub
libs/geography/src/comparators/address.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { shallowCompare } from '@daffodil/core';

import { DaffAddress } from '../models/address';

/**
 * Compares two addresses and returns true if all of their fields are equal.
 *
 * @param address0 An address.
 * @param address1 An address.
 */
export function daffCompareAddresses(address0: DaffAddress, address1: DaffAddress): boolean {
  return shallowCompare(
    address0,
    address1,
    [
      'street',
      'street2',
      'city',
      'region',
      'country',
      'country_id',
      'postcode',
    ],
  );
}