# count-map-pmb

> Extended version of the `count-map` module, providing range filter and easy conversions.

Latest version **0.1.1** (published 2022-02-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install count-map-pmb
pnpm add count-map-pmb
yarn add count-map-pmb
bun add count-map-pmb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2022-02-26 |
| First published | 2022-02-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | M.K. |
| Maintainers | mk-pmb |
| Keywords | count, filter, map, range, unique |

## Links

- npm: https://www.npmjs.com/package/count-map-pmb
- Repository: https://github.com/mk-pmb/count-map-pmb-js
- Homepage: https://github.com/mk-pmb/count-map-pmb-js/#readme
- Issues: https://github.com/mk-pmb/count-map-pmb-js/issues
- npm.io page: https://npm.io/package/count-map-pmb

## Dependencies (1)

- [count-map](https://npm.io/package/count-map.md) ^1.1.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2022-02-26
- 0.1.0 — 2022-02-26

## README

<!--#echo json="package.json" key="name" underline="=" -->
count-map-pmb
=============
<!--/#echo -->

<!--#echo json="package.json" key="description" -->
Extended version of the `count-map` module, providing range filter and easy
conversions.
<!--/#echo -->



API
---

This module exports one constructor:

### CountMapPmb(...args)

Which works the same as the constructor exported from the original
[`count-map` module](https://github.com/czycha/count-map),
except the objects created have some additional methods:



### .toDict([opt])

Return the entries as a plain object.
Useful for converting the counts to JSON.

`opt` is an optional options object that supports these optional keys:

* `empty`: If set to something other than `undefined`, and the result would
  be empty, instead return this value.



### .filter(decide)

Make a partial copy with only entries for which function `decide`
invoked with arguments `(val, key, map)` returns a true-y value.



### .rangeFilter(min, max)

Return a CountMapPmb with only the entries whose count is at least `min`
and at most `max`.

* If `min` is `null` or `undefined`, it is treated as negative infinity.
* If `max` is `null` or `undefined`, it is treated as positive infinity.

* Example: `.rangeFilter(2)` implies `max = undefined` and thus will report
  all entries that appeared at least twice.



### .rangesFilter(ranges)

Multiple acceptable `ranges` can be given as an array of `[min, max]` pairs.
Reports entries that match at least one range.

* Example: `.rangesFilter([ [null, 1], [3, null] ])` will report
  all entries except those who appeared exactly twice.









Usage
-----

see [test/usage.js](test/usage.js):


<!--#toc stop="scan" -->



Known issues
------------

* Needs more/better tests and docs.




&nbsp;


License
-------
<!--#echo json="package.json" key=".license" -->
ISC
<!--/#echo -->

---
_Source: https://npm.io/package/count-map-pmb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
