fabricator
Advanced tools
Comparing version 0.4.4 to 0.5.0
'use strict'; | ||
var path = require('path') | ||
var empty = require('is-empty') | ||
, path = require('path') | ||
, fs = require('fs'); | ||
@@ -23,2 +24,7 @@ | ||
// | ||
// Empty strings, arrays or objects should not be processed, return early. | ||
// | ||
if (empty(stack)) return []; | ||
switch (is(stack)) { | ||
@@ -25,0 +31,0 @@ case 'string': |
{ | ||
"name": "fabricator", | ||
"version": "0.4.4", | ||
"version": "0.5.0", | ||
"description": "Discover collections of constructible instances from strings (filepaths), arrays or objects", | ||
@@ -34,3 +34,6 @@ "main": "index.js", | ||
"pre-commit": "1.0.x" | ||
}, | ||
"dependencies": { | ||
"is-empty": "0.0.1" | ||
} | ||
} |
@@ -10,3 +10,3 @@ 'use strict'; | ||
function fn() { | ||
function Y() { /* nope */ } | ||
function Y(x, y) { x = y; } | ||
Y.prototype.name = ''; | ||
@@ -13,0 +13,0 @@ |
@@ -23,2 +23,9 @@ describe('Fabricator', function () { | ||
it('returns early if the stack is empty or falsy', function () { | ||
var result = fabricator([false]); | ||
assume(result).to.be.an('array'); | ||
assume(result.length).to.equal(0); | ||
}); | ||
it('can init constructors from file paths', function () { | ||
@@ -71,3 +78,3 @@ var result = fabricator(fixtures.string); | ||
it('throws an error when we receive an invalid type', function (next) { | ||
try { fabricator(new Date()); } | ||
try { fabricator(Date.now()); } | ||
catch (e) { next(); } | ||
@@ -74,0 +81,0 @@ }); |
16602
379
1
+ Addedis-empty@0.0.1
+ Addedis-empty@0.0.1(transitive)