Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

functional-lite

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functional-lite - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

timing.js

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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc