Socket
Socket
Sign inDemoInstall

protoblast

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protoblast - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.5.4 (2018-03-14)
* Add `overflow` task to `Function.regulate` which will receive extra calls
* `Object.first` will return `undefined` if it is given an empty object
* Fix benchmark coverage tests
## 0.5.3 (2018-03-11)

@@ -2,0 +8,0 @@

18

lib/benchmark.js

@@ -95,3 +95,3 @@ module.exports = function BlastBenchmark(Blast, Collection, Bound) {

* @since 0.1.2
* @version 0.4.0
* @version 0.5.4
*

@@ -102,3 +102,4 @@ * @param {Number} runs

var dummy,
var result,
dummy,
start,

@@ -109,5 +110,3 @@ i;

// or it'll get insanely optimized
dummy = function() {
return 1;
};
dummy = Function('return 1');

@@ -123,3 +122,10 @@ // Call dummy now to get it jitted

return Blast.performanceNow() - start;
result = Blast.performanceNow() - start;
// When doing coverage this can increase a lot, giving weird results
if (result > 1) {
result = 0.5;
}
return result;
}

@@ -126,0 +132,0 @@

@@ -1027,9 +1027,11 @@ module.exports = function BlastFunctionFlow(Blast, Collection, Bound) {

* @since 0.1.6
* @version 0.5.1
* @version 0.5.4
*
* @param {Function} fnc
* @param {Function} fnc Function to regulate
* @param {Number} amount Maximum amount of times it can be called
* @param {Function} overflow Function that will receive extra calls
*
* @return {Function}
*/
Blast.defineStatic('Function', 'regulate', function regulate(fnc, amount) {
Blast.defineStatic('Function', 'regulate', function regulate(fnc, amount, overflow) {

@@ -1039,5 +1041,10 @@ var count = 0;

if (typeof fnc != 'function') {
throw new Error('Function.regulate requires a valid function');
throw new TypeError('Function.regulate requires a valid function');
}
if (typeof amount == 'function') {
overflow = amount;
amount = null;
}
if (!amount) {

@@ -1049,9 +1056,14 @@ amount = 1;

var args = Bound.Array.cast(arguments);
count++;
if (count > amount) {
if (overflow) {
overflow.call(this, count - amount, args);
}
return;
}
return fnc.apply(this, arguments);
return fnc.apply(this, args);
};

@@ -1058,0 +1070,0 @@ });

@@ -1464,3 +1464,3 @@ module.exports = function BlastObject(Blast, Collection, Bound, Obj) {

* @since 0.1.11
* @version 0.1.11
* @version 0.5.4
*

@@ -1479,2 +1479,4 @@ * @param {Object} obj

}
return;
}

@@ -1481,0 +1483,0 @@

{
"name": "protoblast",
"description": "Native object expansion library",
"version": "0.5.3",
"version": "0.5.4",
"author": "Jelle De Loecker <jelle@develry.be>",

@@ -39,2 +39,2 @@ "keywords": [

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