From d40af4b58965559ae8f7fd6e55354f279ed7c9ca Mon Sep 17 00:00:00 2001 From: Drew Harwell Date: Mon, 1 May 2017 12:10:51 -0500 Subject: [PATCH] Update convert.js --- lib/convert.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);