How to use the intersect function from hoek

Find comprehensive JavaScript hoek.intersect code examples handpicked from public code repositorys.

154
155
156
157
158
159
160
161
162
```javascript

var array1 = [1, 2, 3];
var array2 = [1, 4, 5];

var newArray = Hoek.intersect(array1, array2) // results in [1]
```

### flatten(array, target)
fork icon170
star icon1
watch icon33

223
224
225
226
227
228
229
230
231
```javascript

var array1 = [1, 2, 3];
var array2 = [1, 4, 5];

var newArray = Hoek.intersect(array1, array2); // results in [1]
```

### contain(ref, values, [options])
fork icon170
star icon1
watch icon2

57
58
59
60
61
62
63
64
65
66

  if (scope.length < subset.length) {
    return false
  }

  const common = Hoek.intersect(scope, subset)
  return common.length === subset.length
}

const plugin = Hp(hemeraJwtAuth, {
fork icon71
star icon802
watch icon36

51
52
53
54
55
56
57
58

    if (scope.length < subset.length) {
        return false;
    }

    var common = Hoek.intersect(scope, subset);
    return common.length === subset.length;
};
fork icon60
star icon0
watch icon1

74
75
76
77
78
79
80
81
82
83
    return routingTable
  }

  return _.filter(routingTable, function (route) {
    var routeTags = route.settings ? route.settings.tags : null
    return Hoek.intersect(routeTags, requiredTags).length === requiredTags.length
  })
}

utils.filterRoutesByTagSelection = function (routingTable, includedTags, excludedTags) {
fork icon38
star icon0
watch icon0

+ 3 other calls in file

182
183
184
185
186
187
188
189
190
191
if (handler.filter) {
    if (!criteria.tags) {
        continue;
    }

    const match = Hoek.intersect(criteria.tags, handler.filter.tags, !handler.filter.all);
    if (!match ||
        (handler.filter.all && match.length !== handler.filter.tags.length)) {

        continue;
fork icon25
star icon0
watch icon2

208
209
210
211
212
213
214
215
216
217
    this._logger.push(event);
    this.connection.emit(_internal ? 'request-internal' : 'request', this, event, tagsMap);

    if (this.server._settings.debug &&
        this.server._settings.debug.request &&
        Hoek.intersect(tagsMap, this.server._settings.debug.request, true)) {

        console.error('Debug:', event.tags.join(', '), (data ? '\n    ' + (data.stack || (typeof data === 'object' ? Hoek.stringify(data) : data)) : ''));
    }
};
fork icon0
star icon0
watch icon10