summaryrefslogtreecommitdiff
path: root/MistyCore/node_modules/yaml/browser/dist/compose/util-map-includes.js
blob: de74ddf9fddab0aa948e626f0ed7dd976b5c1c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { isScalar } from '../nodes/Node.js';

function mapIncludes(ctx, items, search) {
    const { uniqueKeys } = ctx.options;
    if (uniqueKeys === false)
        return false;
    const isEqual = typeof uniqueKeys === 'function'
        ? uniqueKeys
        : (a, b) => a === b ||
            (isScalar(a) &&
                isScalar(b) &&
                a.value === b.value &&
                !(a.value === '<<' && ctx.schema.merge));
    return items.some(pair => isEqual(pair.key, search));
}

export { mapIncludes };