New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

garbagebox

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

garbagebox

Typescript in Javascript. Gives you the types and leaves behind the pain.

latest
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

Garbagebox

Type safe Javascript and uhh, Multi-threading

How do I do it

You just do it

npm i garbagebox

Supported types

box.string
box.number
box.boolean
box.object
box.function
box.symbol
box.null
box.undefined

GarbagePacks

const myPack = box.pack(() => {
    console.log('Hello world!');
});

myPack.data(); // Returns () => { console.log('Hello world!'); }
myPack.type(); // Returns 'GarbagePack'
myPack.run(); // Returns {}

const myPack2 = box.pack(() => {
    module.exports = 'Hello world!';
});

myPack.run(); // Returns 'Hello world!'

Multi-Threading

const myPack = box.pack(() => {
    console.log('Running in worker!');
    send('Hello world!');
    receive((message) => {
        console.log('From parent thread: ' + message);
    });
});

const spawner = box.spawn(myPack);
spawner.onMessage((data) => { console.log('From thread: ' + data); });

spawner.send('Hello World!');

Type safety

const x = box.new(box.number, 2);
const y = box.new(box.number, 3);

x.get() + y.get() // Returns 5

x.set(5)
x.get() + y.get() // Returns 8

Keywords

typescript

FAQs

Package last updated on 22 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts