jsboost
A tiny library that extends the capability of javascript
JS Boost
This library is a toolset that contains many different individual tools for developers to handle their project easier! However, since that the tools within the library are independent to each other, developers must select the tools they need and import them on their own! Their will be no central export mechanism that will collect everything together.
Use in native browser environment
All the tools can be accessed via JSDeliver. Developers can import the library on their own. Let's take Base64 for example! Base64 lib is locate at [root]/base64.esm.js. Developers can use following line to import this lib.
;
Note that the whole module registered in npm is browser compatible. So you can use following line if you want to install and control the version via npm.
;
Use in NodeJS environment
Since that this library is completely written using es module syntax, using this library in NodeJS environment is a little bit tricky. Please follow the following steps to install and use this library!
- Install the package via following line.npm install jsboost
- Download the following loader script from here and name it as loader.mjs
- You can use this lineor this line;in your code to import the tool you want ( Let's still take Base64 for example ).;
- Run the script using following commandnode --experimental-modules --loader ./loader.mjs [PATH_TO_YOUR_BOOT_SCRIPT]
The loader script is used to tell the NodeJS environment to load the scripts ended with .esm.js as es modules not CommonJS modules. The reason why I'm not using .mjs is that I want to make the scripts to be directly identified by web browsers without the need to add additional configuration to make the server respond correct content-type header. 'cause it will be difficult to do that if you're not hosting your own web server!
Tool List
-
/version.esm.js
A library that can parse semver compatible strings and compare the priorities among them. -
/throttled-queue.esm.js
A library that help developers to solve the rancing conditions among the asynchronous operations. -
/base64.esm.js
The library that can generate and parse strings encoded as base64 or base64url format -
/base32.esm.js
The library that can generate and parse strings encoded as base32hex format -
/dom-event-emitter.esm.js
An event emitter that provides interface that is similar to DOM Event object -
/event-emitter.esm.js
An implementation of NodeJS styled EventEmitter -
/http-cookies.esm.js
A library that allows developers to generate and parse raw cookies -
/utf8string.esm.js
A library that provides conversion between utf16 string (js string) and utf8 string -
/web/load-module.esm.js
A tiny function that provides a polyfill of Dynamic Import -
/web/load-resource.esm.js
A tiny function that allows developers to load batches of resources asynchronously.