Fixed Codacy issues
Also added specification link in JSON files
This commit is contained in:
@ -38,8 +38,11 @@ let snippetData = {
|
||||
archived: false,
|
||||
hash: util.hashData(snippets[key])
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}),
|
||||
meta: {
|
||||
specification: 'http://jsonapi.org/format/'
|
||||
}
|
||||
};
|
||||
// Extract archived snippet data
|
||||
let snippetArchiveData = {
|
||||
@ -57,8 +60,11 @@ let snippetArchiveData = {
|
||||
archived: true,
|
||||
hash: util.hashData(archivedSnippets[key])
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}),
|
||||
meta: {
|
||||
specification: 'http://jsonapi.org/format/'
|
||||
}
|
||||
};
|
||||
// Write files
|
||||
fs.writeFileSync(path.join(OUTPUT_PATH, 'snippets.json'), JSON.stringify(snippetData, null, 2));
|
||||
|
||||
@ -89,10 +89,10 @@ const getCodeBlocks = str => {
|
||||
}
|
||||
m.forEach((match, groupIndex) => {
|
||||
results.push(match);
|
||||
})
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
};
|
||||
// Gets the textual content for a snippet file.
|
||||
const getTextualContent = str => {
|
||||
const regex = /###.*\n*([\s\S]*?)```/g;
|
||||
@ -104,8 +104,8 @@ const getTextualContent = str => {
|
||||
}
|
||||
m.forEach((match, groupIndex) => {
|
||||
results.push(match);
|
||||
})
|
||||
});
|
||||
}
|
||||
return results[1];
|
||||
}
|
||||
};
|
||||
module.exports = {readSnippets, readTags, optimizeNodes, capitalize, objectFromPairs, isTravisCI, hashData, shuffle, getCodeBlocks, getTextualContent};
|
||||
|
||||
Reference in New Issue
Block a user