function-tools
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var f = require("../"); | ||
@@ -2,0 +3,0 @@ |
@@ -7,2 +7,6 @@ "use strict"; | ||
@alias f | ||
@example | ||
```js | ||
var f = require("function-tools"); | ||
``` | ||
*/ | ||
@@ -14,5 +18,11 @@ exports.throttle = throttle; | ||
@param {Function} - the function to throttle | ||
@param {Object} - options | ||
@param [options] {Object} - the options | ||
@param [options.restPeriod] {number} - a value in ms | ||
@returns {Function} | ||
@alias module:function-tools.throttle | ||
@example | ||
```js | ||
var throttled = f.throttle(myFunction, { restPeriod: 200 }); | ||
throtted(); // this will only execute if at least 200ms since the last invocation | ||
``` | ||
*/ | ||
@@ -36,3 +46,3 @@ function throttle(f, options){ | ||
} | ||
} | ||
}; | ||
} |
{ | ||
"name": "function-tools", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Useful higher-order functions", | ||
@@ -11,3 +11,5 @@ "repository": "https://github.com/75lb/function-tools.git", | ||
}, | ||
"keywords": [], | ||
"keywords": [ | ||
"throttle" | ||
], | ||
"engines": { | ||
@@ -22,5 +24,5 @@ "node": ">=0.10.0" | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^0.1.9", | ||
"jsdoc-to-markdown": "^0.5", | ||
"tape": "^2.13.3" | ||
} | ||
} |
@@ -6,42 +6,27 @@ [![view on npm](http://img.shields.io/npm/v/function-tools.svg)](https://www.npmjs.org/package/function-tools) | ||
<a name="module_function-tools"></a> | ||
#function-tools | ||
Useful higher-order functions | ||
**Example** | ||
```js | ||
var f = require("function-tools"); | ||
``` | ||
**Contents** | ||
* [throttle(f, options)](#module_function-tools.throttle) | ||
<a name="module_function-tools.throttle"></a> | ||
###f.throttle(f, options) | ||
##f.throttle(f, [options]) | ||
Guarantees a function a specified `restPeriod` in between invocations. | ||
**Params** | ||
- f `function` the function to throttle | ||
- options `Object` options | ||
- f `function` - the function to throttle | ||
- \[options\] `Object` - the options | ||
- \[restPeriod\] `number` - a value in ms | ||
**Returns**: `function` | ||
**Example** | ||
```js | ||
var throttled = f.throttle(myFunction, { restPeriod: 200 }); | ||
throtted(); // this will only execute if at least 200ms since the last invocation | ||
``` | ||
**Returns**: `function` | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4632
73
32