Update analyze.js

This commit is contained in:
Angelos Chalaris
2018-06-23 12:42:22 +03:00
committed by GitHub
parent a6e3fcf287
commit a387a4d6f7

View File

@ -22,15 +22,15 @@ let snippetTokens = {data: snippetsData.data.map(snippet => {
attributes: {
codeLength: snippet.attributes.codeBlocks[0].trim().length,
tokenCount: tokens.length,
functionCount: tokens.filter(t => t.type == 'function').length,
operatorCount: tokens.filter(t => t.type == 'operator').length,
keywordCount: tokens.filter(t => t.type == 'keyword').length,
distinctFunctionCount: [...new Set(tokens.filter(t => t.type == 'function').map(t => t.content))].length
functionCount: tokens.filter(t => t.type === 'function').length,
operatorCount: tokens.filter(t => t.type === 'operator').length,
keywordCount: tokens.filter(t => t.type === 'keyword').length,
distinctFunctionCount: [...new Set(tokens.filter(t => t.type === 'function').map(t => t.content))].length
},
meta: {
hash: snippet.meta.hash
}
}
};
}), meta: { specification: "http://jsonapi.org/format/"}};
let snippetArchiveTokens = {data: snippetsArchiveData.data.map(snippet => {
let tokens = prism.tokenize(snippet.attributes.codeBlocks[0], prism.languages.javascript, 'javascript');