Get an/some element from array like target.
npm install -S @jswork/next-sample
import '@jswork/next-sample';
const arr = [1,2,3,4,5,6,7];
nx.sample(arr); // 2
nx.sample(arr); // 5
nx.sample(arr, 1); // [5]
nx.sample(arr, 2); // [1, 2]
nx.sample(arr, 2); // [3, 6]
nx.sample(arr, 2); // [5, 6]
Code released under the MIT license.