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

@mitranim/js

v0.1.61

Published

Something like a missing standard library for JS

Downloads

167

Readme

Overview

Kinda "JS standard library" that doesn't suck. Or sucks less than X, insert some alternative here.

Important non-features:

  • Doesn't require Node or Deno.
  • Doesn't require TypeScript.
  • Doesn't require a transpiler.
  • Doesn't require a bundler.
  • Doesn't require NPM.
  • No external dependencies.
  • No prototype pollution.
  • No globals.
  • No slowness.

Important features:

  • Environment-independent. Runs in browsers, Deno, Node.
    • Approximate browser compatibility: evergreen, Safari 11+.
    • Node compatibility: 18+.
  • Compact and performant.
  • Relatively few source files.
  • Relatively clear source code.
  • Native JS modules. Can be imported by URL.

Alternatives that suck:

  • Using only built-ins.
  • Google Closure.
  • Deno stdlib.
  • Lodash.
  • Various other things.

TOC

Usage

Uses native JS modules, which can be imported by URL in browsers and Deno. The truly lazy can import many core modules at once:

import * as a from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected]/all.mjs'

Otherwise, import specific modules you need. See the list below. Example:

import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected]/lang.mjs'
import * as s from 'https://cdn.jsdelivr.net/npm/@mitranim/[email protected]/str.mjs'

Also available on NPM:

npm i -E @mitranim/js

Features

  • lang: type assertions and other essentials needed by all other code.
  • iter: tools for iteration and functional programming.
  • obj: tools for manipulating JS objects and plain dicts.
  • str: tools for manipulating strings.
  • coll: extended versions of JS data structure classes, with better APIs.
  • url: better URL implementation.
  • time: tools for datetimes and intervals.
  • path: various functions for working with FS paths.
  • dom: shortcuts for working with the DOM.
  • dom_shim: lightweight and performant shim for DOM nodes and elements.
  • dom_global_shim: shimmed DOM globals, interchangeable with dom_global_native
  • dom_global_native: native DOM globals, interchangeable with dom_global_shim
  • dom_reg: shortcuts for registering custom DOM elements.
  • prax: simple system for rendering DOM elements. React-inspired syntax, better semantics and performance.
  • obs: observables via proxies.
  • obs_dom: automatic reactivity for custom DOM elements.
  • http: shortcuts for the fetch/Response APIs, URL routing, cookie decoding/encoding.
  • http_deno: tools for HTTP servers running in Deno.
  • http_srv: streaming and broadcasting tools for generic HTTP servers.
  • live_deno: tools for live-reloading in development.
  • cli: essential tools for CLI apps.
  • test: tools for testing and benchmarking.

Some other extremely useful features are undocumented for now. Docs are in progress.

Perf

  • Written carefully and with benchmarks.
  • Balances optimization and code compactness.
  • Tries to avoid ludicrous inefficiencies.
  • Benchmarked only in V8 for now. (Engine used in Deno / Node / Chrome.)

License

https://unlicense.org

Misc

Contact me by opening an issue or via https://mitranim.com/#contacts.