Class: MatchersUtil

MatchersUtil

Utilities for use in implementing matchers.
Note: Do not construct this directly. Jasmine will construct one and pass it to matchers and asymmetric equality testers.

Methods

contains(haystack, needle) → {boolean}

Determines whether haystack contains needle, using the same comparison logic as MatchersUtil#equals.

Parameters:
Name Type Description
haystack *

The collection to search

needle *

The value to search for

Since:
  • 2.0.0
Returns:

True if needle was found in haystack

Type
boolean

equals(a, b) → {boolean}

Determines whether two values are deeply equal to each other.

Parameters:
Name Type Description
a *

The first value to compare

b *

The second value to compare

Since:
  • 2.0.0
Returns:

True if the values are equal

Type
boolean

pp(value) → {string}

Formats a value for use in matcher failure messages and similar contexts, taking into account the current set of custom value formatters.

Parameters:
Name Type Description
value *

The value to pretty-print

Since:
  • 3.6.0
Returns:

The pretty-printed value

Type
string