Skip to content

Commit

Permalink
Make things better
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethkufluk committed Jun 13, 2012
1 parent ad6f0f6 commit 893749b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/loadbuilder/analyzer.js
@@ -1,12 +1,13 @@
var parser = require('esprima');

function match(fragment, tree) {
// console.log(fragment, tree);
var matches = [];
if (Object.keys(fragment).every(function(fragmentKey, i) {
if (fragment && tree && Object.keys(fragment).every(function(fragmentKey, i) {
var item = fragment[fragmentKey],
subMatches;

if (!tree[fragmentKey]) {
if ((typeof tree[fragmentKey] == 'undefined') || (tree[fragmentKey] === null)) {
return false;
}

Expand Down Expand Up @@ -58,7 +59,7 @@ function analyze(matcher, source) {
var tree;
if (source.ast) {
tree = source.ast;
} else if (Array.isArray(source)) {
} else if (typeof source == 'object') {
tree = source;
} else {
tree = parser.parse(source);
Expand Down

0 comments on commit 893749b

Please sign in to comment.