Skip to content

t.like mishandles symbol-keyed and non-enumerable properties #3208

Closed
@gibson042

Description

@gibson042

This is actually two distinct but related issues affecting t.like, which is effectively a concordance deep comparison of a comparable value against a selector value, where the comparable is a filtered view of the actual input with respect to the selector.

  1. Rejection of empty selector objects mistakenly allows objects based on the presence of non-enumerable properties that are ignored by concordance, resulting in inappropriate pass results from e.g. t.like({}, Object.defineProperties({}, {x: {enumerable: false}})).
  2. Use of Object.entries(selector) in selectComparable ignores symbol-keyed properties that are respected by concordance, resulting in inappropriate failure results from e.g. t.like({[Symbol.toStringTag]: 'Custom'}, {[Symbol.toStringTag]: 'Custom'}).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions