<commit_before>import { Answerable, Expectation } from '@serenity-js/core';
import { equal } from 'tiny-types/lib/objects';

/**
 * Produces an {@link Expectation|expectation} that is met when the actual array of `Item[]` contains
 * at least one `Item` that is equal to the resolved value of `expected`.
 *
 * Note that the equality check performs comparison **by value**
 * using [TinyTypes `equal`](https://github.com/jan-molak/tiny-types/blob/master/src/objects/equal.ts).
 *
 * ## Ensuring that the array contains the given item
 *
 * ```ts
 * import { actorCalled } from '@serenity-js/core'
 * import { Ensure, and, startsWith, endsWith } from '@serenity-js/assertions'
 *
 * const items = [ { name: 'apples' }, { name: 'bananas' } ]
 *
 * await actorCalled('Ester').attemptsTo(
 *   Ensure.that(items, contain({ name: 'bananas' })),
 * )
 * ```
 *
 * @param expected
 */
export function contain<Item>(expected: Answerable<Item>): Expectation<Item[]> {
    return Expectation.thatActualShould<Item, Item[]>('contain', expected)
        .soThat((actualValue, expectedValue) => !! actualValue.find(item => equal(item, expectedValue)));
}
<commit_msg>style(assertions): applied an ESLint suggestion<commit_after>import { Answerable, Expectation } from '@serenity-js/core';
import { equal } from 'tiny-types/lib/objects';

/**
 * Produces an {@link Expectation|expectation} that is met when the actual array of `Item[]` contains
 * at least one `Item` that is equal to the resolved value of `expected`.
 *
 * Note that the equality check performs comparison **by value**
 * using [TinyTypes `equal`](https://github.com/jan-molak/tiny-types/blob/master/src/objects/equal.ts).
 *
 * ## Ensuring that the array contains the given item
 *
 * ```ts
 * import { actorCalled } from '@serenity-js/core'
 * import { Ensure, and, startsWith, endsWith } from '@serenity-js/assertions'
 *
 * const items = [ { name: 'apples' }, { name: 'bananas' } ]
 *
 * await actorCalled('Ester').attemptsTo(
 *   Ensure.that(items, contain({ name: 'bananas' })),
 * )
 * ```
 *
 * @param expected
 */
export function contain<Item>(expected: Answerable<Item>): Expectation<Item[]> {
    return Expectation.thatActualShould<Item, Item[]>('contain', expected)
        .soThat((actualValue, expectedValue) => actualValue.some(item => equal(item, expectedValue)));
}

{'fraction_non_alphanumeric': 0.15946985891406584, 'fraction_numerical': 0.0, 'mean_word_length': 4.545023696682464, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1683528', 'n_tokens_mistral': 722, 'n_tokens_neox': 729, 'n_words': 196}