createerror
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -13,8 +13,10 @@ (function (root, factory) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i], | ||
keys = Object.keys(source); | ||
var source = arguments[i]; | ||
if (source && typeof source === 'object') { | ||
var keys = Object.keys(source); | ||
for (var j = 0; j < keys.length; j++) { | ||
var name = keys[j]; | ||
target[name] = source[name]; | ||
for (var j = 0; j < keys.length; j++) { | ||
var name = keys[j]; | ||
target[name] = source[name]; | ||
} | ||
} | ||
@@ -21,0 +23,0 @@ } |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"repository": { | ||
@@ -26,3 +26,3 @@ "type": "git", | ||
"mocha": "2.2.5", | ||
"unexpected": "7.4.2" | ||
"unexpected": "9.2.1" | ||
}, | ||
@@ -29,0 +29,0 @@ "publishConfig": { |
@@ -16,2 +16,7 @@ var expect = require('unexpected'), | ||
it('should result a constructor that produces instances whose constructor property point at it', function () { | ||
var Err = createError({foo: 'bar'}); | ||
expect(new Err().constructor, 'to equal', Err); | ||
}); | ||
it('should return a constructor that prefers a message passed as to first argument to the one provided in the options object', function () { | ||
@@ -123,2 +128,7 @@ var Err = createError({message: 'default message'}); | ||
}); | ||
it('should not break when the constructor options object has a data property with a value of undefined', function () { | ||
var Err = createError(); | ||
new Err({data: undefined}); | ||
}); | ||
}); |
13379
210