js-draw
Version:
Draw pictures using a pen, touchscreen, or mouse! JS-draw is a drawing library for JavaScript and TypeScript.
18 lines (17 loc) • 497 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Returns true iff all elements in the shorter list equal (===) the elements
* in the longer list.
*/
const listPrefixMatch = (a, b) => {
const shorter = a.length < b.length ? a : b;
const longer = shorter === a ? b : a;
for (let i = 0; i < shorter.length; i++) {
if (shorter[i] !== longer[i]) {
return false;
}
}
return true;
};
exports.default = listPrefixMatch;
;