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

sle

v1.1.3

Published

node.js based sle runner

Downloads

12

Readme

sle

The sle (Simple Language Experiments) is a Node.js package that supports the building of applications offering the following features:

  • Using the mrequire function it provides the ability to refer to packages that are stored in a github repository. This has the benefit of not needing an external file to indicate what are the exact version numbers of dependent packages.
  • Allows intrinsic tests, called assumptions, to be include in source files thereby reducing the need to export the internal implementation of a package in order to support extrinsic unit testing.

mrequire

Dependencies to external packages is achieved by introducing the function

  mrequire

which takes a single string parameter describing the package that is to be included. The format of this parameter is

  handler:package:version
  • handler

    Within sle there are support for two different handlers: core and github. The core handler will refer to a package that is stored in

    https://github.com/sle-js

    whilst the github handler will refer to the package that is referenced by the entire package component.

  • package

    The name of the package that the handler will reference.

  • version

    The labelled name which is used as a version indicator for the required package.

Core Example

Given the following piece of code:

  const Array = mrequire("core:Native.Data.Array:1.0.0");

This will download the following project out of github located at

https://github.com/sle-js/lib-Native.Data.Array

This source code will be placed into the directory

~/.sle/core/Native.Data.Array/1.0.0

off of the user's home directory. Note that only the code against the label 1.0.0 will be placed into this directory.

Finally the file index.js is then returned as a require to the caller.

Github Example

Given the following piece of code:

  const Array = mrequire("github:graeme-lockley/mn-Native.Data.Array:1.0.0");

This will download the following project out of github located at

https://github.com/graeme-lockley/mn-Native.Data.Array

This source code will be placed into the directory

~/.sle/github/graeme-lockley/mn-Native.Data.Array/1.0.0

off of the user's home directory. Note that only the code against the label 1.0.0 will be placed into this directory.

Finally the file index.js is then returned as a require to the caller.

Assumptions

Any function that is defined within a source file can have any number of assumptions to be included in the file. These assumptions are then executed when the source file is loaded and, in the event of an assumption failing, will cause the loading of the source file to be aborted.

The following are illustrative examples of using assumption and assumptionEqual:

//- Get the number of elements within an array.
//= length :: Array a -> Int
const length = a =>
    a.length;
assumption(length([]) === 0);
assumption(length([1, 2, 3]) === 3);


//= indexOf :: String -> String -> Maybe Int
const indexOf = pattern => s => {
    const index = s.indexOf(pattern);

    return index === -1
        ? Maybe.Nothing
        : Maybe.Just(index);
};
assumptionEqual(indexOf("world")("hello"), Maybe.Nothing);
assumptionEqual(indexOf("hello")("hello"), Maybe.Just(0));
assumptionEqual(indexOf("ll")("hello"), Maybe.Just(2));