UNPKG

node-vitals

Version:

Do more with less. A simple, high-performing, functional JavaScript library.

44 lines (36 loc) 1.12 kB
/** * ----------------------------------------------------------------------------- * VITALS HELPER: inArr * ----------------------------------------------------------------------------- * @version 4.1.3 * @see [vitals]{@link https://github.com/imaginate/vitals} * * @author Adam Smith <adam@imaginate.life> (https://github.com/imaginate) * @copyright 2017 Adam A Smith <adam@imaginate.life> (https://github.com/imaginate) * * Annotations: * @see [JSDoc3](http://usejsdoc.org) * @see [Closure Compiler JSDoc Syntax](https://developers.google.com/closure/compiler/docs/js-for-compiler) */ 'use strict'; module.exports = inArr; //////////////////////////////////////////////////////////////////////////////// // VITALS HELPER: inArr //////////////////////////////////////////////////////////////////////////////// /** * @param {!Object} source * @param {*} val * @return {boolean} */ function inArr(source, val) { /** @type {number} */ var len; /** @type {number} */ var i; len = source.length; i = -1; while (++i < len) { if (source[i] === val) return true; } return false; }