Skip to content

hacksoft-net/iterador

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Iterador (Alpha)

An object-oriented way to iterate using I loops.

Install

npm install iterador

First Try

This is your first program in Iterador:

const Iterador = require("iterador");
const Iterator = Iterador.Iterator;
const iterator = new Iterator();
iterator.skip(4);
iterator.loopBackward(9000, 3, function(index) {
    console.log(index + " days before Christmas");
});

Let's Break it Down

The first thing you need to know about is the Iterator class. It contains siz publicly accessible methods, skip(), loopForward(), and loopBackward(). This is an iterator function, so first, we'll talk about the skip function, which is maybe easiest to understand.

skip(indexes: number | number[])

Removes a skip index or multiple indexes from the Index Blacklist.

removeSkip(indexes: number | number[])

In advance, puts a specific index on a blacklist, so when iterator reaches that point, ignores the function entirely and moves on till it finds an index that isn't blacklisted.

loopForward(iteratorStart: number, iteratorGoal: number, iterationFunction: Function)

Creates a normal I loop and runs iterationFunction() every loop. Every function beginning with loop will give parameter (i) as in current index.

loopBackward(iteratorGoal: number, iteratorStart: number, iterationFunction: Function)

Creates a backwards-running I loop and runs iterationFunction() every loop. Every function beginning with loop will give parameter (i) as in current index.

setIndexMemory(i: number, data: any)

Sets persistent index memory.

getIndexMemory(i: number)

Gets persistent index memory.

You can also use this.generalMemory to set persistent memory through an object.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published