# function-threshold

> Limit the amount of times a function can be called in a specific timeframe and throw an error if the limit is exceeded.

Latest version **0.2.0** (published 2017-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install function-threshold
pnpm add function-threshold
yarn add function-threshold
bun add function-threshold
```

## 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.2.0 |
| Published | 2017-04-04 |
| First published | 2017-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Frédéric Bolvin |
| Maintainers | frebo |
| Keywords | function, threshold, limit |

## Links

- npm: https://www.npmjs.com/package/function-threshold
- Repository: https://github.com/Fensterbank/function-threshold
- Homepage: https://github.com/Fensterbank/function-threshold#readme
- Issues: https://github.com/Fensterbank/function-threshold/issues
- npm.io page: https://npm.io/package/function-threshold

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2017-04-04
- 0.1.0 — 2017-04-03

## README

# function-threshold

[![NPM version][npm-image]][npm-url]

Limit the amount of times a function can be called in a specific timeframe and throw an error if the limit is exceeded.

## Installation

with [npm](https://npmjs.org)

```bash
npm install function-threshold
```

with [yarn](https://yarnpkg.com/)

```bash
yarn add function-threshold
```

## Example

```javascript
var FunctionThreshold = require('function-threshold');

function myFunction(suffix) {
  console.log('hooray, hello ' + suffix + '!');
}

// limit to 5 executions per 10 seconds (10.000 ms)
var threshold = new FunctionThreshold(myFunction, 5, 10000);

// call the function somewhere. It will throw an exception if limit is exceeded
threshold.call('world');

```

[npm-image]: https://img.shields.io/npm/v/function-threshold.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/function-threshold

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