Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sb-util

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sb-util - npm Package Compare versions

Comparing version 0.0.0-prealpha to 0.0.1-prealpha

2

package.json
{
"name": "sb-util",
"version": "0.0.0-prealpha",
"version": "0.0.1-prealpha",
"description": "Scratch blocks utilities: open and query Scratch blocks formats",

@@ -5,0 +5,0 @@ "repository": {

# Purpose
This repo demonstrates a proof of concept for the .sb3 utility for Scratch. It is a naive Javascript implementation to illustrate the different ways a project.json can be queried to get insightful information about a Scratch project.
# Documentation
In depth documentation of the sbutil API can be found on Google Drive: [https://docs.google.com/document/d/1mL5r9CZH3Ru-vfs7T-8c53PO59IT2a7NpiIt3t24fMw](https://docs.google.com/document/d/1mL5r9CZH3Ru-vfs7T-8c53PO59IT2a7NpiIt3t24fMw)
## Running the script

@@ -8,0 +5,0 @@ ```

@@ -142,2 +142,33 @@ const jp = require('jsonpath');

}
text(node = this.get('*')[0]) {
console.log(node.get('opcode'))
const nextAttr = node.get('next')
const substacks = Object.entries(node.get('inputs'))
.filter(([k,v]) => k.includes('SUBSTACK')).map(([k,v]) => [k.replace('SUBSTACK', ''), v]).sort((a,b) => {
return b[0] < a[0];
}).map(([k,v]) => v[1]);
// explore the substack if there
if (substacks) {
let index = 0;
substacks.forEach(s => {
if (index === 0) {
console.log('if');
} else {
console.log('else');
}
const nextNode = this.get('*').filter(b => b.get('id') === s).pop();
this.text(nextNode);
index++;
})
}
if (nextAttr === null) {
return;
}
const nextNode = this.get('*').filter(b => b.get('id') === nextAttr).pop();
this.text(nextNode);
}
}

@@ -205,2 +236,2 @@

let spriteOfBlock = sp.query('sprite block');
console.log(spriteOfBlock);
spriteOfBlock.text();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc