array-wrapper

Provides a wrapper with helper functions to assist with callback loops

Usage no npm install needed!

<script type="module">
  import arrayWrapper from 'https://cdn.skypack.dev/array-wrapper';
</script>

README

Array-Wrapper

Description

Simple wrapper around arrays providing a inbuilt interator to assist with callback functions

API Usage

var sampleLinks = ['http://www.google.com', 'http://www.nodejs.org', 'http://www.stackoverflow.com']; `` var Wrapper = require('array-wrapper'); `` var links = new Wrapper(sampleLinks); // builds the wrapper

console.log('get first element', links.get()); //gets the first element or the element the wrapper is currently pointing at `` console.log('shift the pointer to the second link', links.next()); //shifts the pointer `` console.log('get current element (second element)', links.get()); // prints 'http://www.nodejs.org', the next element

`` console.log('move the pointer to the previous link', links.previous());

Pointing the pointer to an out of bounds element returns undefined - it does not differentiate between an array with undefined elements and out of bounds elements