Livshitz / libx.js

๐Ÿ›  libx.js is a powerful toolbelt full of useful modules and helpers for node & web apps

Home Page:https://www.npmjs.com/package/libx.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Libx.js

MIT license codecov MIT license npm npm Known Vulnerabilities

๐Ÿ›  libx.js is a carefully crafted toolbelt full of useful modules and helpers for node & web apps

Description:

Different projects usually have a shared portion of infrastructural or helpers code. Libx.js is intended to bring a broad of useful tools, shaped and sharpened to be easily used, hiding the complex or troublesome routines usually needed.

Features:

  • Heavily modular and flexible
  • Support javascript and Typescript
  • Browserify & bundler friendly
  • Shared support:
    • Modules:
      • Dependency Injection
      • Log
      • Network
      • Callbacks (pub/sub)
      • Firebase wrapper
      • Linked nodes and lists
      • BinrayHeap (min and max)
      • Queue
      • General QueueWorker
      • Datastore for clientside caching
    • Promise and deferred wrappers
    • General helpers & extensions
    • Datastore and cache mechanism
    • Crypto related helpers
    • Many general helpers
  • Browser-only support:
    • General helpers & extensions
    • Require (for browser)
    • User management (firebase)
  • Node-only support:
    • CLI helpers
    • QuickServer (ExpressJS wrapper)
    • Bundler - Watcher, bundler, transformer, and more (moved to pax.libx.js)

Use Cases:

  1. General:
    • Essential string, array, date, extensions:
      • format date into strings
      • string ellipsis, capitalize, padding, hashcode
      • array manipulation
    • Simplified promise wrapper for easily wrapping callbacks into promises
    • Use same API for networking (HTTP get/post/etc) in both browser and node
    • Create dynamic linked-lists and trees to track, traverse nodes and also be able to serialise/deserialize easily
    • Use QueueWorker for handle one or multiple workers and split work into async concurrent handlers
    • Log code flow and events and filter by log level (debug/verbose/info/warning/error), including formatted date and time, stacktrace, etc
    • Use simplified callbacks for easy pub/sub
    • Firebase wrapper for handling read/write access and polyfill some missing functionality (reverse key ordering, entity version, etc.)
    • Helpers for object manipulation, handy types and checks, chain functions, deep clone and extend objects, guid generation, regexp wrappers, and many more
  2. Node:
    • Allow modules to be able to detect and work in both CLI or import modes
    • Quickly access command line arguments
    • Bump package.json version
    • Execute complex shell commands and capture outputs
    • Parse and encrypt/decrypt project.json files
    • Encrypt/decrypt files
    • Globally catch errors and unhandled promises
  3. Browser:
    • Browserify and make all the helpers and modules available to be used (share same codebase for both Node and browser).
    • Support progressive script loading, just like require but in the browser and on demand
    • Events and Messages managers
    • Helpers for download, upload, inject and many more helpers

** See unit-tests and example folder for practical uses and examples. ** Live playground

Related packages:

  1. concurrency.libx.js -
    Module that provides handy helpers for Async and concurrent work, for example Deferred utility, Debounce/Throttle, Chain, measurements and more.
    Was initially part of libx and departed to be independent package.
  2. di.libx.js -
    Light weight Dependency-Injection module.
    Was initially part of libx and departed to be independent package.
  3. pax.libx.js -
    Custom made bundler, based on gulp that supports Browserifying, TS, LESS, SCSS, Vue and more. Used here to bundle libx.js for browser use.

Usage

$ yarn add libx.js
or
$ npm install --save libx.js   

Play with it in browser playground: https://npm.runkit.com/libx.js

For browser:
Create a dedicated file, include (e.g: require) the needed modules into global (window) scope and browserify it. See pax.libx.js for more details how to efficiently browserify and bundle files for browser use.

Grab from CDN:

https://cdn.jsdelivr.net/npm/libx.js@latest/dist/libx.min.js

Contributing

Fork into your own repo, run locally, make changes and submit PullRequests to the main repository.

Tests Coverage:

Code Coverage

License

All projects and packages in this repository are MIT licensed.

About

๐Ÿ›  libx.js is a powerful toolbelt full of useful modules and helpers for node & web apps

https://www.npmjs.com/package/libx.js

License:MIT License


Languages

Language:TypeScript 99.7%Language:JavaScript 0.2%Language:Shell 0.1%