2017-07-14 17:37:24 +02:00
|
|
|
// Copyright (C) 2017 Ecma International. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
description: |
|
|
|
|
Verify that a subArray is contained within an array.
|
|
|
|
---*/
|
|
|
|
|
2017-06-23 17:08:11 +02:00
|
|
|
/**
|
|
|
|
* @param {Array} array
|
2017-06-23 18:07:34 +02:00
|
|
|
* @param {Array} subArray
|
2017-06-23 17:08:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
function arrayContains(array, subArray) {
|
2017-04-13 16:37:32 +02:00
|
|
|
var found;
|
2017-06-23 17:08:11 +02:00
|
|
|
for (var i = 0; i < subArray.length; i++) {
|
2017-04-13 16:37:32 +02:00
|
|
|
found = false;
|
2017-06-23 17:08:11 +02:00
|
|
|
for (var j = 0; j < array.length; j++) {
|
|
|
|
if (subArray[i] === array[j]) {
|
2017-04-13 16:37:32 +02:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
2014-07-19 00:22:37 +02:00
|
|
|
}
|
2017-04-13 16:37:32 +02:00
|
|
|
if (!found) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
2014-07-19 00:22:37 +02:00
|
|
|
}
|