The missing "standard library" for JS, and a foundation for full-stack JS apps.
npm install @mitranim/jsKinda "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.
* #Usage
* #Features
* #Perf
* #License
* #Misc
Uses native JS modules, which can be imported by URL in browsers and Deno. The truly lazy can import many core modules at once:
``js`
import * as a from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.77/all.mjs'
Otherwise, import specific modules you need. See the list below. Example:
`js`
import * as l from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.77/lang.mjs'
import * as s from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.77/str.mjs'
Also available on NPM:
`sh`
npm i -E @mitranim/js
* 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_nativedom_global_native
* : native DOM globals, interchangeable with dom_global_shimdom_reg
* : shortcuts for registering custom DOM elements.prax
* : simple system for rendering DOM elements. React-inspired syntax, better semantics and performance.obs
* : observables and reactivity.http
* : shortcuts for the fetch/Response APIs, URL routing, cookie decoding/encoding.http_bun
* : tools for HTTP servers running in Bun.http_deno
* : tools for HTTP servers running in Deno.http_shared
* : streaming and broadcasting tools for generic HTTP servers.http_live
* : 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.
* 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.)
https://unlicense.org
Contact me by opening an issue or via https://mitranim.com/#contacts.