multiples
v1.0.3
Published
Generate a list of integers from i1 to i2 verifying conditions about given multiple(s)
Downloads
16
Readme
multiples
Generate a list of integers from i1 to i2 verifying conditions about given multiple(s)
Install
$ npm install multiples --save
Usage
var multiples = require('multiples');
// Get multiples of 3 from 1 to 9
var numbers = multiples(1, 10).of(3).value();
console.log(numbers); // [3, 6, 9]
// Get multiples of 3 and 5 from 1 to 49
numbers = multiples(1, 50).of(3, 5).value();
console.log(numbers); // [15, 30, 45]
// Get multiples of 3 but not 5 from 1 to 19
numbers = multiples(1, 20).of(3).not.of(5).value();
console.log(numbers); // [3, 6, 9, 12, 18]
// Get multiples of 3 but not 5 and 7 from 1 to 19
numbers = multiples(1, 20).of(3).not.of(2, 5).value();
console.log(numbers); // [3, 9]
License
The MIT License (MIT)