1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2024-11-23 09:17:19 +00:00
action-ansible-playbook/node_modules/yaml/dist/compose/util-map-includes.js

20 lines
574 B
JavaScript
Raw Normal View History

2022-10-21 14:44:44 +00:00
'use strict';
2024-01-17 09:08:10 +00:00
var identity = require('../nodes/identity.js');
2022-10-21 14:44:44 +00:00
function mapIncludes(ctx, items, search) {
const { uniqueKeys } = ctx.options;
if (uniqueKeys === false)
return false;
const isEqual = typeof uniqueKeys === 'function'
? uniqueKeys
: (a, b) => a === b ||
2024-01-17 09:08:10 +00:00
(identity.isScalar(a) &&
identity.isScalar(b) &&
2022-10-21 14:44:44 +00:00
a.value === b.value &&
!(a.value === '<<' && ctx.schema.merge));
return items.some(pair => isEqual(pair.key, search));
}
exports.mapIncludes = mapIncludes;