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

@l8js/l8

v0.12.1

Published

Lightweight core library for JavaScript projects

Downloads

661

Readme

@l8js/l8 MIT npm version build

l8.js (Read: light js)

Site | Twitter

Lightweight JavaScript library. Skipping bold abstraction layers for the sake of a more lean approach towards functional programming.

l8js is released under the MIT license & supports modern environments.

Why l8.js?

l8.js provides functionality, wrappers and thin(!) abstraction layers to ease the process of accessing and manipulating data in JavaScript. It also provides syntactical sugar for convenient access to language specific functions.

    
    // create object based on null object
    let obj = l8.obj();
    obj.key = "value";
    obj instanceof Object; // false

    // l8.chain
    let obj = {};
    l8.chain("a.b.c.d", obj, "foo"); // obj is { a : { b : {c : { d : "foo"}}}}
    
    
    // l8.visit
    let visitor = (value, path) => {
        return `${path.join(".")}=${value}`;
    };
    let tree = {
        node : {
            node_1 : "a"
        }
    };
    tree = l8.visit(tree, visitor);
    expect(tree.node.node_1).toBe("node.node_1=a");


    // l8.replace
    let str = l8.replace(["foo", "bar"], ["oof", "rab"], "this foo is bar"); // this oof is rab
    str = l8.replace(["A", "B"], ["B", "D"], "A"); // D
    str = l8.replace(["A", "C"], "B", "AC"); // BB
    str = l8.replace(["A", "C"], ["B"], "AC"); // B
    str = l8.replace("A", "B", "A"); // B    
    
    
    // l8.unify
    let str = l8.unify("https:///HOST///api/endpoint//", "/", "://");
    console.log(str); // https://HOST/api/endpoint/"
    
    
    // l8.groupIndices
    var list   = ['4', 5, '1', '3', 6, '8'];
    l8.groupIndices(list); // [[1], [3, 4, 5, 6], [8]]
    
    
    // l8.liquify - fluent async interfaces with the liquify proxy  
    const source = {
        foo : async function () { return this; },
        bar : async function () { return this; },
        snafu : async function () { return "snafu"; }
    };
    await l8.liquify(source).foo().bar().snafu();
    
    
    // l8.load
    const text = await l8.load("./README.md");
    console.log(res); // response text


    // l8.ping - sends HEAD to resource
    const exists = await l8.ping("./README.md");
    console.log(exists); // true or false
    

    // l8.text.toHyperlink - l8.text provides parser-/transformation-utilities 
    const html = l8.text.toHyperlink("This is an url https://www.conjoon.org and it is not clickable");
    console.log(html); // This is an url <a href="https://www.conjoon.org">https://www.conjoon.org</a> and it is not clickable

    
    // l8.template.esix.StringTemplate - Template Engine supporting ES6 Templates-Strings.
    let tpl = l8.template.esix.make("This is a ${templated} string ${that.supports} JavaScript TemplateStrings");
    console.log(tpl.render({templated : "parsed", that : {supports : "that supports"}}));
    // This is a parsed string that supports JavaScript TemplateStrings

    // l8.md5() - create MD5-Hash from String
    let hashed = l8.md5("[email protected]")
    
    let name = l8.text.nameToOrdinal("New Folder", ["New Folder (1)", "users", "randomName"]);
    console.log(name); // "New Folder (2)"
    
    // ... and many more

Installation

Using npm:

$ npm i @l8js/l8

Running Tests and using Build Scripts

$ npm run build:dev

for installing dev-dependencies. This allows for running tests and build-scripts. The script will also install necessary git hooks.

Usage

Builds can be found in ./dist/. API docs are available in ./docs. Note: Minimized and none-minimized builds are available. None-minimized can be identified by ".debug." in their file-name (e.g. sourcefile.debug.js vs sourcefile.js).

Module Formats

Default JS Module export

Provides default JS-Module export for the whole l8.js-library.

import l8 from "./dist/l8.runtime.esm.js";

Named JS module exports

Provides named JS-Module exports for the main-packages of l8.js-library.

import {core, template, text} from "./dist/l8.packages.esm.js";

Universal Module Definition (UMD)

Provides a Universal Module Definition for the whole l8.js-library.

<script type="text/javascript" src="./dist/l8.runtime.umd.js" />

3rd-party Acknowledgements

l8.js uses crypto-js for l8.md5().