simplebuild
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -1,2 +0,2 @@ | ||
// Copyright (c) 2013-2015 Titanium I.T. LLC. All rights reserved. See LICENSE.TXT for details. | ||
// Copyright (c) 2013-2016 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file. | ||
(function() { | ||
@@ -103,2 +103,9 @@ "use strict"; | ||
it("provides correct error message when receiving a struct and expecting a primitive", function() { | ||
assert.equal( | ||
check({ id: "something" }, Number), | ||
"argument must be a number, but it was an object" | ||
); | ||
}); | ||
it("provides class names when using class instances", function() { | ||
@@ -105,0 +112,0 @@ function One() {} |
@@ -1,2 +0,2 @@ | ||
// Copyright (c) 2013-2015 Titanium I.T. LLC. All rights reserved. See LICENSE.TXT for details. | ||
// Copyright (c) 2013-2016 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file. | ||
(function() { | ||
@@ -56,3 +56,3 @@ "use strict"; | ||
var articles = { articles: true }; | ||
if (argType === Object) argType = arg; | ||
if (argType === Object && !isStruct(arg)) argType = arg; | ||
return name + " must be " + describe(type, articles) + ", but it was " + describe(argType, articles); | ||
@@ -88,5 +88,4 @@ } | ||
else if (typeof type === "object") { | ||
var prototype = Object.getPrototypeOf(type); | ||
if (!prototype || prototype.constructor === Object) return describeStruct(type, options); | ||
else return describeInstance(prototype.constructor, options); | ||
if (isStruct(type)) return describeStruct(type, options); | ||
else return describeInstance(type, options); | ||
} | ||
@@ -127,3 +126,4 @@ else throw new Error("unrecognized type: " + type); | ||
function describeInstance(prototypeConstructor, options) { | ||
function describeInstance(type, options) { | ||
var prototypeConstructor = Object.getPrototypeOf(type).constructor; | ||
var article = options.articles; | ||
@@ -156,2 +156,7 @@ var name = (article ? "a " : "") + prototypeConstructor.name; | ||
function isStruct(type) { | ||
var prototype = Object.getPrototypeOf(type); | ||
return (!prototype || prototype.constructor === Object); | ||
} | ||
}()); |
{ | ||
"name": "simplebuild", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Universal task automation", | ||
@@ -5,0 +5,0 @@ "main": "lib/simplebuild.js", |
@@ -338,2 +338,3 @@ # Simplebuild - Universal Task Automation for Node.js | ||
* 0.5.2: Bugfix: `normalizeOptions` provides better error message when option is an object literal | ||
* 0.5.1: Bugfix: `normalizeOptions` won't crash when option is an object and expected type includes undefined or null | ||
@@ -340,0 +341,0 @@ * 0.5.0: Added `normalizeOptions` API call |
50636
849
385