main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
574 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var identity = require('../nodes/identity.js');
|
---|
4 |
|
---|
5 | function mapIncludes(ctx, items, search) {
|
---|
6 | const { uniqueKeys } = ctx.options;
|
---|
7 | if (uniqueKeys === false)
|
---|
8 | return false;
|
---|
9 | const isEqual = typeof uniqueKeys === 'function'
|
---|
10 | ? uniqueKeys
|
---|
11 | : (a, b) => a === b ||
|
---|
12 | (identity.isScalar(a) &&
|
---|
13 | identity.isScalar(b) &&
|
---|
14 | a.value === b.value &&
|
---|
15 | !(a.value === '<<' && ctx.schema.merge));
|
---|
16 | return items.some(pair => isEqual(pair.key, search));
|
---|
17 | }
|
---|
18 |
|
---|
19 | exports.mapIncludes = mapIncludes;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.