Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/globalwebindex/quantify

Allows you to quantify List, Set, Dict or a single value according to a predicate
https://github.com/globalwebindex/quantify

Last synced: about 2 months ago
JSON representation

Allows you to quantify List, Set, Dict or a single value according to a predicate

Awesome Lists containing this project

README

        

# Quantify

[![Build Status](https://travis-ci.org/GlobalWebIndex/quantify.svg?branch=master)](https://travis-ci.org/GlobalWebIndex/quantify)

Allows you to quantify List, Set, Dict or a single value according to a predicate, by returning a `Quantifier`:

```elm
type Quantifier
= None
| Some
| All
```

## Example usage

```elm
isEven : Int -> Bool
isEven number =
modBy 2 number == 0

Quantify.list isEven [1,3,5,7]
--> None

Quantify.list isEven [1,2,3,4]
--> Some

Quantify.list isEven [2,4,6,8]
--> All
```

Feedback and contributions to both code and documentation are very welcome.

## Installation

```
$ elm install GlobalWebIndex/quantify
```