UNPKG

typescript-algorithms-and-datastructures

Version:
26 lines 874 B
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function linearSearch(array, value) { let index = null; let counter = 0; const arraySize = array.length; while (counter < arraySize && index === null) { if (value === array[counter]) { index = counter; } counter++; } return index; } exports.default = linearSearch; }); //# sourceMappingURL=linearSearch.js.map