raptor-util
Advanced tools
Comparing version 0.2.4-beta to 0.2.5-beta
module.exports = function(message, cause) { | ||
var error, | ||
argsLen = arguments.length, | ||
E = Error; | ||
var error; | ||
var argsLen = arguments.length; | ||
var E = Error; | ||
@@ -10,14 +10,9 @@ if (argsLen == 2) { | ||
error.stack += '\nCaused by: ' + (cause.stack || cause); | ||
} | ||
else { | ||
} else { | ||
error._cause = cause; | ||
} | ||
} | ||
else if (argsLen == 1) { | ||
if (message instanceof E) | ||
{ | ||
} else if (argsLen == 1) { | ||
if (message instanceof E) { | ||
error = message; | ||
} | ||
else | ||
{ | ||
} else { | ||
error = new E(message); | ||
@@ -24,0 +19,0 @@ } |
@@ -0,1 +1,18 @@ | ||
/** | ||
* Utility method to iterate over elements in an Array that | ||
* internally uses the "forEach" property of the array. | ||
* | ||
* <p> | ||
* If the input Array is null/undefined then nothing is done. | ||
* | ||
* <p> | ||
* If the input object does not have a "forEach" method then | ||
* it is converted to a single element Array and iterated over. | ||
* | ||
* | ||
* @param {Array|Object} a An Array or an Object | ||
* @param {Function} fun The callback function for each property | ||
* @param {Object} thisp The "this" object to use for the callback function | ||
* @return {void} | ||
*/ | ||
module.exports = function(a, func, thisp) { | ||
@@ -2,0 +19,0 @@ if (a != null) { |
@@ -0,1 +1,27 @@ | ||
/** | ||
* Invokes a provided callback for each name/value pair | ||
* in a JavaScript object. | ||
* | ||
* <p> | ||
* <h2>Usage</h2> | ||
* <js> | ||
* raptor.forEachEntry( | ||
* { | ||
* firstName: "John", | ||
* lastName: "Doe" | ||
* }, | ||
* function(name, value) { | ||
* console.log(name + '=' + value); | ||
* }, | ||
* this); | ||
* ) | ||
* // Output: | ||
* // firstName=John | ||
* // lastName=Doe | ||
* </js> | ||
* @param {Object} o A JavaScript object that contains properties to iterate over | ||
* @param {Function} fun The callback function for each property | ||
* @param {Object} thisp The "this" object to use for the callback function | ||
* @return {void} | ||
*/ | ||
module.exports = function(o, fun, thisp) { | ||
@@ -2,0 +28,0 @@ for (var k in o) |
@@ -25,3 +25,3 @@ { | ||
}, | ||
"version": "0.2.4-beta" | ||
"version": "0.2.5-beta" | ||
} |
18391
468