Git Product home page Git Product logo

david-fernando / noloopfor Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 2.31 MB

JavaScript library for making functional loops

Home Page: https://www.npmjs.com/package/noloopfor

License: MIT License

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

noloopfor's Introduction

No loop for

No loop for

GitHub top language Codacy Badge GitHub 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.

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

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.

<script type="module">
import { loop } from 'https://cdn.jsdelivr.net/gh/david-fernando/noForLoop/dist/noforloop.js'

const number = 10

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

</script>
  • With Typscript

To use it with TypeScript, just install the TypeScript declarations with one of the commands below

npm install @types/noloopfor

// or

yarn add @types/noloopfor

Reference

loop

  • Syntax

loop(number, numberOfIterations, callback)
  • Example

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

loopStep

  • Syntax

loopStep(number, numberOfIterations, numberStep, callback)
  • Example

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

decrementLoop

  • Syntax

decrementLoop(number, numberTarget, callback)
  • Example

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

decrementStep

  • Syntax

decrementStep(number, numberTarget, numberStep, callback)
  • Example

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

Licence:

MIT

noloopfor's People

Contributors

david-fernando avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

noloopfor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.