@saroamirkhanyan/ranges
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Ranges

Ranges is a JavaScript library for working with ranges and iterators using beauty of Functional Programming

Example

This code prints all even numbers between 0 and 100 which are also root of integer

import { flow } from 'fp-ts/function'
import { range, filter } from '@saroamirkhanyan/ranges' 

const isEven = (a: number) => a % 2 === 0;
const evens = flow(
	() => range(0, 100),
	filter(isEven)
);

const isRoot = flow(Math.sqrt, Number.isInteger);
const evenRoots = flow(
	evens,
	filter(isRoot)
);

for(const a of evenRoots()) {
	console.log(a);
}

Readme

Keywords

none

Package Sidebar

Install

npm i @saroamirkhanyan/ranges

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

13.2 kB

Total Files

15

Last publish

Collaborators

  • saroamirkhanyan