Use your browser console
to test FRUM's
simple features.
You already have a log
shortcut for console.log
Remember there is the trailing decimals (5.000000000002) problem.
This should be fixed soon
const frum = require('frum'); //from node
// create frum Number
var n = frum(3)
// create ranges
var range = n.to(7.4)
// iterating
range.by(2, console.log )
// creating arrays
range.by(2) //simple
range.by(2, function (i) {
return 'I said ' + i + ' ! ' // mapping
})
// overlappings
range.contains(8) // false
//
// ! NOT implemented yet:
range.intersects( frum(1).to(4) ) // true
// and lazy loops
var log = console.log
frum(5).count(log) // O, 1, 2, 3, 4
frum(5).count(log, 0) // 5, 4, 3, 2, 1, 0
frum(5).count(log, 6, 0.2) // 5, 5.2, 5.4, 5.6, 5.8, 6
// !!! with trailing due to floating point !!!