npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

moderate-code-interpreter

v0.0.10

Published

Moderate Code Interpreter is a basic interpreter that can run in the browser. It input is designed to be easily comprehensible for end-users, allowing them to understand the intended functionality of the code. Moreover, it is crafted to be straightforward

Downloads

3

Readme

Moderate Code Interpreter

Moderate Code Interpreter is a basic interpreter that can run in the browser. It input is designed to be easily comprehensible for end-users, allowing them to understand the intended functionality of the code. Moreover, it is crafted to be straightforward enough for developer-adjacent roles, such as spreadsheet wizards, to swiftly create their own scripts. The grammar is designed with extensibility in mind, by priortizing essential functionality and having a rudimentary aesthetic to writing statements and expressions. Ideally domain-specific syntax could be layered atop of this core language.

Samples

Array Concat

return Merge(["abc"],["def"]);

function Merge(a, b){
    return [123] .. a .. b;
}

Array Push

var a = [];
a += 1 + 2;
a += 3;

Complex Query

var a = query o in orders 
filter all { 
    o.status == "paid"; 
    o.items[?].id == "0120120";
} or all {
    o.status == "pending";
}
list {
    orderId: o.id,
    status: o.status,
    user: query u in users filter o.userId == u.id and u.id within 2 to 3 first u ,
    itemIds: query i in o.items list i.id,
    sum: query o in o.items aggregate (p, c) => p + c.cost,
    ... query o in o.items
        aggregate { 
            stats: {
                sum: (p = 0, c) => p + c.cost,
                qty: (p, c) => p + c.qty,

                a: match {
                    a < 3: "some";
                    b < 3: "else";
                    default: a;
                }
            },
            sum: (p, c) => p + c.cost,
            qty: (p, c) => p + c.qty
        }
}
cluster (orderId, status, user)
sort o.id
segment 0 to 100;

Filter Array Objects

var items = [
   {k: {i: 1}},
   {k: {i: 2}},
   {k: {i: 3}},
   {k: {i: 4}},
   {k: {i: 5}},
   {k: {i: 6}},
   {k: {i: 7}}
];

return query o in items
filter all { 
    o.k.i > 2;
    o.k.i < 5;
}
list o;

Loop Statement

var i = 100000;
while( i > 0 ){
    i -= 1;
}

Multiple Condition Expression

all {
 1 < 2;
 3 /2 < 3;
 4 + 2 > 5;
}

Reference Assignment

var a ={
    b: 2,
    c: {
        d: 3
    }
};

a.c.d = 7;

Simple Math

var a = 3;
var b = 4; 
return a + b;

Variable Declaration

var a = 2;