mirror of
https://github.com/scratchfoundation/scratch-analysis.git
synced 2025-06-10 12:01:06 -04:00
Initial working version
This commit is contained in:
parent
4f28eeef52
commit
590b71a0aa
22 changed files with 1414 additions and 0 deletions
lib
25
lib/index.js
Normal file
25
lib/index.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const parser = require('scratch-parser');
|
||||
|
||||
const sb2 = require('./sb2');
|
||||
const sb3 = require('./sb3');
|
||||
|
||||
module.exports = function (buffer, callback) {
|
||||
parser(buffer, false, (err, project) => {
|
||||
if (err) return callback(err);
|
||||
|
||||
// Flatten array
|
||||
project = project[0];
|
||||
|
||||
// Push project object to the appropriate analysis handler
|
||||
switch (project.projectVersion) {
|
||||
case 2:
|
||||
sb2(project, callback);
|
||||
break;
|
||||
case 3:
|
||||
sb3(project, callback);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unsupported project version');
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue