Comparing version 0.1.8 to 0.1.9
@@ -6,3 +6,3 @@ { | ||
"description": "A data structure that combines a hash and an array for CRUD operations by object keys or index.", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"main": "index.js", | ||
@@ -9,0 +9,0 @@ "url": "https://github.com/joshjung/hash-array", |
@@ -214,4 +214,5 @@ var JClass = require('jclass'); | ||
sum: function(keys, key, weightKey) { | ||
var ret = 0; | ||
this.forEachDeep(keys, key, function (value) { | ||
var self = this, | ||
ret = 0; | ||
this.forEachDeep(keys, key, function (value, item) { | ||
if (weightKey !== undefined) | ||
@@ -218,0 +219,0 @@ value *= self.find(item, weightKey); |
@@ -499,2 +499,6 @@ var assert = require('assert'), | ||
}); | ||
it('should work with weighted sums.', function() { | ||
assert.equal(ha.sum('boat', ['data', 'speed'], ['data', 'weight']), (10 * 100000) + (5 * 200000)); | ||
}); | ||
}); | ||
@@ -501,0 +505,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
28361
692