Update convert.js

This commit is contained in:
Drew Harwell 2017-05-01 12:10:51 -05:00 committed by GitHub
parent 2bcec3c2d1
commit d40af4b589

View file

@ -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);