Code Monkey home page Code Monkey logo

range's Introduction

Ranger

lightweight library for creating arrays of numbers

Installation:

npm install range-create --save

Use in browser

<script src="https://unpkg.com/[email protected]/dist/browser/ranger.js" ></script>

Live example on code pen

https://codepen.io/anon/pen/MRPJmO

Methods:

  • init

create array with simple string

Examples:

const  R  =  require('range-create').default.init
  
// without step (default is 1)
let  arr  =  R("10:20")
console.log(arr)
// [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
  
// with step
arr  =  R("0:20:5")
console.log(arr)
// [ 0, 5, 10, 15, 20 ]
  
// count down
arr  =  R("48:36")
console.log(arr)
// [ 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36 ]
  
// count down with step
arr  =  R("10:-10:5")
console.log(arr)
// [ 10, 5, 0, -5, -10 ]
  
// float numbers
arr  =  R("0:5:0.75")
console.log(arr)
// [ 0, 0.75, 1.5, 2.25, 3, 3.75, 4.5 ]

any question ? Ask It :)

made with ❤️ for you

range's People

Contributors

mrfarhadir avatar

Watchers

James Cloos avatar

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.