{"size": 2574, "ext": "js", "max_stars_repo_path": "tealium/tiq_getAssetsFromUTUI.min.js", "max_stars_repo_name": "hitGovernor/public-tools", "max_stars_repo_stars_event_min_datetime": "2022-02-11T21:32:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-11T21:32:09.000Z", "max_issues_repo_path": "tealium/tiq_getAssetsFromUTUI.min.js", "max_issues_repo_name": "hitGovernor/public-tools", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tealium/tiq_getAssetsFromUTUI.min.js", "max_forks_repo_name": "hitGovernor/public-tools", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 2574.0, "max_line_length": 2574, "alphanum_fraction": 0.7754467754}
var tiqHelper={getId:function(type,asset){try{return asset._id||""}catch(err){return""}},getName:function(type,asset){try{var retval;return"datalayer"===type?asset.name:asset.title}catch(err){return""}},getType:function(type,asset){try{var retval="";return"datalayer"===type?retval=asset.type:"tag"===type?retval=asset.tag_name:"extension"===type&&(retval=asset.extType),retval}catch(err){return""}},getStatus:function(type,asset){try{return asset.status||""}catch(err){return""}},getPublishRevisions:function(type,asset){try{return Object.keys(asset.publish_revisions.svr_save_timestamps).sort().join("|")}catch(err){return""}},getLastModified:function(type,asset){try{return asset.publish_revisions.last_modified}catch(err){return""}},getLabels:function(type,asset){try{var retval=[];return asset.labels&&asset.labels.split(",").forEach((function(item){retval.push(utui.data.labels[item].name)})),asset.imported&&retval.push(asset.imported),retval.join("|")}catch(err){return""}},convertToCSV:function(assets){var allBody=[],headers=[];for(var key in assets[0])headers.push(key);for(var item in headers=headers.join(",")+"\n",assets){var tmp=assets[item],tmpArray=[];for(var key in tmp)tmpArray.push(tmp[key]);allBody.push(tmpArray.join(","))}return headers+allBody.join("\n")},getAllAssets:function(){var retval;return this.getAssetsByType("tag","extension","loadrule","datalayer")},getAssetsByType:function(){var tagsToGet=Array.from(arguments),retval=[],assetSources={tag:utui.data.manage,extension:utui.data.customizations,loadrule:utui.data.loadrules,datalayer:utui.data.define};return tagsToGet.forEach((function(item){var assets=assetSources[item];for(var key in assets){var tmp={};tmp.assetType=item,tmp.id=tiqHelper.getId(item,assets[key]),tmp.name=tiqHelper.getName(item,assets[key]),tmp.publishedTargets=tiqHelper.getPublishRevisions(item,assets[key]),tmp.type=tiqHelper.getType(item,assets[key]),tmp.status=tiqHelper.getStatus(item,assets[key]),tmp.labels=tiqHelper.getLabels(item,assets[key]),tmp.lastModified=tiqHelper.getLastModified(item,assets[key]),retval.push(tmp)}})),retval}},myTiQAssets=tiqHelper.getAllAssets(),userInput=prompt("Sepcify your preferred format:\n\n* table: Displays assets using console.table()\n* csv: Displays assets as a comma-delimited string\n\nNote: Make sure you are in TiQ, with the Data Layer tab selected.","table","csv");/^csv$/i.test(userInput)?console.log(tiqHelper.convertToCSV(myTiQAssets)):/^table$/i.test(userInput)?console.table(myTiQAssets):console.log('tiqHelper: Invalid input. Please specify "csv" or "table".');