A JavaScript Package for finding the smallest element of an array.
npm install --save smallest-element
<script src="https://rawgit.com/Prosen-Ghosh/smallest-element/master/smallest.js"></script>
<script src="https://cdn.rawgit.com/Prosen-Ghosh/smallest-element/9406abf2/smallest.js"></script>
const small = require('smallest-element');
small([1,2,3,-10]);
//=> -10
small([1,2,3,-10,{}]);
//=> -10
small([1,2,3,-10,-100,[]]);
//=> -100
small([]);
//=> null
small(); //withour parameter this function will throw a type error
//=> TypeError: smallest() expects an array parameter
Prosen Ghosh prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
- MIT