Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/david-fernando/noloopfor

JavaScript library for making functional loops
https://github.com/david-fernando/noloopfor

for-loop for-loop-in-javascripts for-loops function-loop functional functional-js functional-programming javascript javascript-library js-funcional js-lib loop node-js nodejs npm-module npm-package recursive recursive-functions

Last synced: about 2 hours ago
JSON representation

JavaScript library for making functional loops

Awesome Lists containing this project

README

        



No loop for

No loop for



![GitHub top language](https://img.shields.io/github/languages/top/david-fernando/noLoopFor) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/f39ced0748b84cf181d948c33dd510e2)](https://www.codacy.com/manual/david-fernando/noLoopFor?utm_source=github.com&utm_medium=referral&utm_content=david-fernando/noLoopFor&utm_campaign=Badge_Grade) [![GitHub license](https://img.shields.io/github/license/david-fernando/noLoopFor)](https://github.com/david-fernando/noLoopFor/blob/master/LICENSE)

---

### Languages

### About
JavaScript library for making functional loops

### Get Started

-

On the Node JS


To install on the node, just execute the command below on the terminal
```
npm install noloopfor
```
To import the the desired function use destructuring assignment, for example, the bellow code is importing the function loop.
```javascript
const { loop } = require('noloopfor')
```
If using React JS, or some other JS library that allows you to use the ESM syntax, you can use it with destructuring assignment, as in the example below
```javascript
import { loop } from 'noloopfor'
```
-

On the browser


If you're out of Node JS you don't need to install anything, just import the desired function using ESM syntax, for example, the below code is importing the function loop, and then is implementing the same.

```html

import { loop } from 'https://cdn.jsdelivr.net/gh/david-fernando/noForLoop/dist/noforloop.js'

const number = 10

loop(number, 20, (iterations)=>{
console.log(iterations)
})


```

-

With Typscript


To use it with TypeScript, just install the TypeScript declarations with one of the commands below
```javascript
npm install @types/noloopfor

// or

yarn add @types/noloopfor

```
### Reference

### loop
-

Syntax


```javascript
loop(number, numberOfIterations, callback)
```
-

Example


```javascript
const number = 10
loop(number, 20, (iterations)=>{
console.log(iterations)
})
```
### loopStep
-

Syntax


```javascript
loopStep(number, numberOfIterations, numberStep, callback)
```
-

Example


```javascript
const number = 10
loopStep(number, 100, 10, (iterations)=>{
console.log(iterations)
})
```

### decrementLoop
-

Syntax


```javascript
decrementLoop(number, numberTarget, callback)
```
-

Example


```javascript
const number = 10
decrementLoop(number, 1, (iterations)=>{
console.log(iterations)
})
```

### decrementStep
-

Syntax


```javascript
decrementStep(number, numberTarget, numberStep, callback)
```
-

Example


```javascript
const number = 20
decrementStep(number, 10, 1, (iterations)=>{
console.log(iterations)
})
```

### Licence:
MIT