frum
FRom a nUM make great things.
Inspired by ruby number methods
Extend a number to offer useful functions
// create rangeslet range = // iter loops or create arrayrange // test overlappingsrange // falserange // true // and many more to come... // ...even a ruby '5.times do' equivalent // ?target=undefined, ?step=1// for lazy loops (and happy developper)
Date and other types support is not working, but it's a mid-term goal.
Install
the same routine as always
There are NO dependancies, the code used tries to be non ES6 so that it could run on older browsers. Let me know if I made mistakes.
cross compatibility node/browser thanks to moment.js
- Usable in browser
There is no CDN for now but it might come if you ask for it.
- Usable in node
npm install frum
const frum =
Use (not written yet)
as simple as that
for now there is a trailing decimal problem
when you use decimals you might come across
x.000000000006
numbers that are not what you wanted
This is a known issue from javascript and I will fix that later
const frum = ; //from node // create frum Numbervar n = // create rangesvar range = n // iteratingrange // creating arraysrange //simple range // overlappingsrange // false//// ! NOT implemented yet:range // true // and lazy loopsvar log = consolelog // O, 1, 2, 3, 4 // 5, 4, 3, 2, 1, 0 // 5, 5.2, 5.4, 5.6, 5.8, 6 // !!! with trailing due to floating point !!!