functional-lite
Advanced tools
Comparing version 0.2.8 to 0.2.9
63
index.js
/* | ||
* @version 0.2.8 | ||
* @date 2014-08-24 | ||
* @stability 2 - Unstable | ||
* @author Lauri Rooden <lauri@rooden.ee> | ||
* @license MIT License | ||
*/ | ||
/** | ||
* @version 0.2.8 | ||
* @date 2014-08-24 | ||
* @stability 2 - Unstable | ||
* @author Lauri Rooden <lauri@rooden.ee> | ||
* @license MIT License | ||
*/ | ||
!function(root) { | ||
!function(exports) { | ||
var P = "prototype" | ||
@@ -47,5 +47,5 @@ , A = Array[P], F = Function[P], S = String[P] | ||
/* | ||
* **argi** - index of argument, which will be split | ||
* **re** - optional RegExp for matching words | ||
*/ | ||
* **argi** - index of argument, which will be split | ||
* **re** - optional RegExp for matching words | ||
*/ | ||
@@ -116,42 +116,3 @@ F.byWords = function(argi, re) { | ||
// Time to live - Run *onTimeout* if Function not called on time | ||
F.ttl = function(ms, onTimeout) { | ||
var self = this | ||
, tick = setTimeout(function(){ms=0;onTimeout&&onTimeout()}, ms) | ||
return function() { | ||
clearTimeout(tick) | ||
ms && self.apply(null, arguments) | ||
} | ||
} | ||
// Run Function one time after last call | ||
F.once = function(ms) { | ||
var tick, args | ||
, self = this | ||
return function() { | ||
clearTimeout(tick) | ||
args = arguments | ||
tick = setTimeout(function(){self.apply(null, args)}, ms) | ||
} | ||
} | ||
// Maximum call rate for Function | ||
F.rate = function(ms, last_call) { | ||
var tick, args | ||
, self = this, next = 0 | ||
return function() { | ||
var now = +new Date() | ||
clearTimeout(tick) | ||
if (now > next) { | ||
next = now + ms | ||
self.apply(null, arguments) | ||
} else if (last_call) { | ||
args = arguments | ||
tick = setTimeout(function(){self.apply(null, args)}, next-now) | ||
} | ||
} | ||
} | ||
// Non-standard | ||
@@ -275,3 +236,3 @@ O.each = function(obj, fn, scope, key) { | ||
root.Fn = Fn.cache() | ||
exports.Fn = Fn.cache() | ||
@@ -278,0 +239,0 @@ }(this) |
{ | ||
"name": "functional-lite", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"stability": 2, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -8,2 +8,3 @@ | ||
require("../timing.js") | ||
@@ -10,0 +11,0 @@ |
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
22074
13
616