Comparing version 0.8.5 to 0.9.0
@@ -0,0 +0,0 @@ // Declare internals |
@@ -73,12 +73,12 @@ // Load modules | ||
source.forEach(function (item) { | ||
for (var i = 0, il = source.length; i < il; ++i) { | ||
target.push(source[i]); | ||
} | ||
target.push(item); | ||
}); | ||
return target; | ||
} | ||
Object.keys(source).forEach(function (key) { | ||
var keys = Object.keys(source); | ||
for (var k = 0, kl = keys.length; k < kl; ++k) { | ||
var key = keys[k]; | ||
var value = source[key]; | ||
@@ -105,3 +105,3 @@ if (value && | ||
} | ||
}); | ||
} | ||
@@ -179,3 +179,3 @@ return target; | ||
exports.intersect = function (array1, array2) { | ||
exports.intersect = function (array1, array2, justFirst) { | ||
@@ -191,2 +191,6 @@ if (!array1 || !array2) { | ||
if (hash[array2[i]] && !found[array2[i]]) { | ||
if (justFirst) { | ||
return array2[i]; | ||
} | ||
common.push(array2[i]); | ||
@@ -250,8 +254,7 @@ found[array2[i]] = true; | ||
var ref = obj; | ||
path.forEach(function (level) { | ||
for (var i = 0, il = path.length; i < il; ++i) { | ||
if (ref) { | ||
ref = ref[level]; | ||
ref = ref[path[i]]; | ||
} | ||
}); | ||
} | ||
@@ -299,6 +302,6 @@ return ref; | ||
var trace = []; | ||
stack.forEach(function (item) { | ||
for (var i = 0, il = stack.length; i < il; ++i) { | ||
var item = stack[i]; | ||
trace.push([item.getFileName(), item.getLineNumber(), item.getColumnNumber(), item.getFunctionName(), item.isConstructor()]); | ||
}); | ||
} | ||
@@ -312,6 +315,7 @@ return trace; | ||
var display = []; | ||
trace.forEach(function (row) { | ||
for (var i = 0, il = trace.length; i < il; ++i) { | ||
var row = trace[i]; | ||
display.push((row[4] ? 'new ' : '') + row[3] + ' (' + row[0] + ':' + row[1] + ':' + row[2] + ')'); | ||
}); | ||
} | ||
@@ -396,4 +400,5 @@ return display; | ||
Fs.readdirSync(path).forEach(function (filename) { | ||
var files = Fs.readdirSync(path); | ||
for (i = 0, il = files.length; i < il; ++i) { | ||
var filename = files[i]; | ||
if (/\.js$/.test(filename) && | ||
@@ -412,3 +417,3 @@ !exclude[filename]) { | ||
} | ||
}); | ||
} | ||
}; | ||
@@ -415,0 +420,0 @@ |
{ | ||
"name": "hoek", | ||
"description": "General purpose node utilities", | ||
"version": "0.8.5", | ||
"version": "0.9.0", | ||
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "contributors":[ |
@@ -0,0 +0,0 @@ // Load modules |
@@ -429,2 +429,11 @@ // Load modules | ||
it('should return just the first common object of two arrays', function (done) { | ||
var array1 = [1, 2, 3, 4, 4, 5, 5]; | ||
var array2 = [5, 4, 5, 6, 7]; | ||
var common = Hoek.intersect(array1, array2, true); | ||
expect(common).to.equal(5); | ||
done(); | ||
}); | ||
it('should return an empty array if either input is null', function (done) { | ||
@@ -431,0 +440,0 @@ |
exports.x = 1; |
exports.y = 2; |
exports.z = 3; |
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
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
102284
1321