This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Flattens the passed in array. | |
* | |
* @param {Array} array The array to flatten. | |
* @param {boolean} isDeep Specify a deep flatten. | |
* @returns {Array} Returns the new flattened array. | |
*/ | |
function flatten(array, isDeep) { | |
var index = -1, | |
length = array.length, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Checks if there's a pair of numbers in the array which add up to n. | |
* | |
* @param {Array} numbers The array to searched on. | |
* @param {number} n The number to be compared. | |
* @returns {boolean} Returns true if no matches are found. | |
*/ | |
function isSumInArray(numbers, n) { | |
if (isNaN(n) || !numbers || !Array.isArray(numbers)) { | |
return undefined; |