diff --git a/lib/convert.js b/lib/convert.js index 9855617..dca93ce 100644 --- a/lib/convert.js +++ b/lib/convert.js @@ -4,6 +4,10 @@ var ejs = require('ejs'); var fs = require('fs'); var template = ejs.compile(fs.readFileSync('./lib/template.ejs','utf8')); +function isArray(a){ + return (typeof a.length == 'number' && typeof a.forEach == 'function'); +} + // source the files module.exports = function(stream,opts,callback){ @@ -79,7 +83,7 @@ function buildUp(jsonObj,opts){ if (item["activity:object"] && item["activity:object"].link){ - if (Array.isArrray(item["activity:object"].link) ){ + if (isArrray(item["activity:object"].link) ){ item["activity:object"].link.forEach(parseLink); }else if (typeof item["activity:object"].link == 'object'){ parseLink(item["activity:object"].link);