Helpers

areSame.mjs

@mr_ozio/scraper-utils · v2.5.0 · Generated April 21, 2026

Target Style

Target Style

1 exports

const

matchFields

Target Style
export const matchFields = ({ fields, left, right }) => {

Compares objects by a selected list of fields using named arguments.

Special cases for areaTitle and cityTitle also look into nested connectOrCreate.create.title values.

Target style API. Preferred for new code.

Parameters

  • options{ fields: string[], left: Record<string, any>, right: Record<string, any> }

Returns

boolean

Example

const matches = matchFields({
  fields: ['title', 'cityTitle'],
  left,
  right,
})

Legacy Style

Legacy Style

1 exports

const

areSame

Legacy Style
export const areSame = (fields, left, right) => matchFields({ fields, left, right })

Compares objects by a selected list of fields.

Special cases for areaTitle and cityTitle also look into nested connectOrCreate.create.title values.

Legacy API. Kept for older code and not the preferred choice for new code.

Parameters

  • fieldsstring[]
  • leftRecord<string, any>
  • rightRecord<string, any>

Returns

boolean