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

virsh

v1.1.0

Published

VIR Scripting Shell

Downloads

5

Readme

VIR Shell

An experiment, slow, everything might change, never use this

Try It

npx virsh

Goals

  1. Scriptable and Bash-like for simple executions
  2. Composable
  3. Interoperable with JavaScript Promises
  4. Optimized for small programs

TODOs

  1. Error handling is terrible. Good luck. It's a combination of uncacught parser-errors, and my own errors thrown with very little context.
  2. The grammar is overly-permissive. Some allowable stuff might be disallowed in future.
  3. I want to add automatic semicolon insertion (ASI) as a pre-processing step.
  4. Add currying, and auto-invocation e.g. ls = func { 12 }; ls #12

Simple Expressions

Numbers

10
12.0

Strings

"Hello"
'Hello'

Boolean

true
false

Lists

Lists are created implicly whenever a comma is used to separate values:

1, 2, 3

To create a 1-item list, use a trailing comma in parentheses (1,).

Grab a single item with [...] e.g.

l = 1, 2, 3;
l[0] == 1

Objects/Maps/Dicts

{
    name: "Foo",
    age: 19
}

Assignments

You do not need to declare variables. You just use them.

x = 10
y = "Hello"

Templates

Templates can use values from the current scope:

```
name = "Amber"
"Hello {name}"
```

Functions

Currently, you cannot define functions. You can call functions injected into your scope.

  1. Call with a single arg.

    $ range 10
    [1, 2, 3, ..., 10]
  2. You cannot invoke a function with zero args. You should instead return a calculated value.

  3. Multiple args

    $ range 10 11
    [10, 11]

Generators

Iterations

For loops are not first-class constructs. They're just an remix of two primitives:

  1. function evaluation
  2. lazy/unbound function arguments
for i <- 1..10 {
    i
}

The { i } block is not bound, nor evaluated when it's passed as an argument to for. The invoked function is responsible for both binding the block to a Scope, and evaluating the body.

Conditionals

Lazy evaluation gives you branching without special constructs or callbacks. If statements will evaluate one, or another arguments depending on the conditional.

  • Everything looks normal

    cond = true
    
    if cond {
        "True"
    } else {
        "False"
    }
  • You can omit the else block:

    cond = true
    
    if cond {
        "True"
    } {
        "False"
    }
  • You can omit the brackets too:

    cond = true
    
    if cond "True" "False"

User Defined Functions

Define user-defined functions with func

z = 1
y = func { x + z }

Call them with

y {x:2}
# 3

Under the hood, this is also a "hack". The defined function body is unbound and unevalated when the function is created. The body is evaluated when invoked later, but with a new scope.

The new scope is of a mix of the lexical scope when defined, and the dynamic scope when invoked. Calling y {x:1} causes any lexically bound x values to be shadowed by the dynamically bound x at call time. Since z is not shadowed, it resolves to 1.

Horrors

  • with statements

    sc = {name: 'jay'};
    with sc {
        name
    }