actionhero
Version:
The reusable, scalable, and quick node.js API server for stateless and stateful applications
24 lines (23 loc) • 524 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayStartingMatch = arrayStartingMatch;
/**
Compare the first n elements of an array with another, longer array
*/
function arrayStartingMatch(a, b) {
if (a.length === 0) {
return false;
}
if (b.length === 0) {
return false;
}
let matching = true;
let i = 0;
while (i < a.length) {
if (a[i] !== b[i]) {
matching = false;
}
i++;
}
return matching;
}