🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

comb

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comb - npm Package Compare versions

Comparing version

to
0.2.4

.idea/inspectionProfiles/profiles_settings.xml

4

History.md

@@ -0,1 +1,5 @@

# 0.2.4
* Fixed issue with pool ensuring only the max number of objects is created.
# 0.2.3

@@ -2,0 +6,0 @@

2

lib/async.js

@@ -75,3 +75,3 @@ /**

cb = scope = results = index = offset = limit = null;
})
});
return ret;

@@ -78,0 +78,0 @@ }));

var define = require("../define").define,
Collection = require("./Collection"),
Queue = require("./Queue"),
base = require("../base");
Collection = require("./Collection"),
Queue = require("./Queue"),
base = require("../base");

@@ -20,10 +20,10 @@ /**

exports = module.exports = define(null, {
instance : {
instance: {
/**@lends comb.collections.Pool.prototype*/
__minObjects : 0,
__minObjects: 0,
__maxObjects : 1,
__maxObjects: 1,
constructor : function(options) {
constructor: function (options) {
options = options || {};

@@ -43,8 +43,8 @@ this.__freeObjects = new Queue();

*/
getObject : function() {
getObject: function () {
var ret = undefined;
if (this.freeCount > 0) {
if (this.count <= this.__maxObjects && this.freeCount > 0) {
ret = this.__freeObjects.dequeue();
this.__inUseObjects.push(ret);
} else if (this.__maxObjects > this.count) {
} else if (this.count < this.__maxObjects) {
ret = this.createObject();

@@ -61,8 +61,7 @@ this.__inUseObjects.push(ret);

*/
returnObject : function(obj) {
if (this.validate(obj) && this.count <= this.__maxObjects) {
returnObject: function (obj) {
var index;
if (this.validate(obj) && this.count <= this.__maxObjects && (index = this.__inUseObjects.indexOf(obj)) > -1) {
this.__freeObjects.enqueue(obj);
var index;
if ((index = this.__inUseObjects.indexOf(obj)) > -1)
this.__inUseObjects.splice(index, 1);
this.__inUseObjects.splice(index, 1);
} else {

@@ -81,3 +80,3 @@ this.removeObject(obj);

*/
removeObject : function(obj) {
removeObject: function (obj) {
var index;

@@ -100,3 +99,3 @@ if (this.__freeObjects.contains(obj)) {

*/
validate : function(obj) {
validate: function (obj) {
return true;

@@ -112,8 +111,8 @@ },

*/
createObject : function() {
createObject: function () {
return {};
},
setters : {
minObjects : function(l) {
setters: {
minObjects: function (l) {

@@ -132,3 +131,3 @@ if (l <= this.__maxObjects) {

},
maxObjects : function(l) {
maxObjects: function (l) {
if (l >= this.__minObjects) {

@@ -149,10 +148,10 @@ this.__maxObjects = l;

getters : {
freeCount : function() {
getters: {
freeCount: function () {
return this.__freeObjects.count;
},
inUseCount : function() {
inUseCount: function () {
return this.__inUseObjects.length;
},
count : function() {
count: function () {
return this.__freeObjects.count + this.__inUseObjects.length;

@@ -162,6 +161,6 @@

minObjects : function() {
minObjects: function () {
return this.__minObjects;
},
maxObjects : function() {
maxObjects: function () {
return this.__maxObjects;

@@ -171,2 +170,2 @@ }

}
})
});
{
"name": "comb",
"description": "A framework for node",
"version": "0.2.3",
"version": "0.2.4",
"keywords": ["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"],

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet