install
NPM
Installation via npm
npm i @andresclua/jsutil
Once you have it installed, you can import all the functions from the same path, as the example.
import { u_addClass } from '@andresclua/jsutil';
u_addClass('selector', 'add-new-class');
// examples
u_addClass('.add-class'), 'add-new-class');
u_addClass(document.querySelectorAll('.add-class'), 'add-new-class');
u_addClass(document.querySelector('.add-class'), 'add-new-class');
u_addClass(document.getElementById('my-element-class'), 'add-new-class');
CDN
You have the option to utilize a Content Delivery Network (CDN) or to download and use the resource locally. Utilizing a CDN offers the advantage of receiving all updates directly from the same file.
<script src="https://unpkg.com/@andresclua/jsutil/dist/js_util.umd.js"></script>
Once you have it set up, a global variable named js_util
will be available for use, allowing you to easily utilize its functions.
js_util.u_addClass('selector', 'add-new-class');
js_util.u_addClass('.add-class'), 'add-new-class');
js_util.u_addClass(document.querySelectorAll('.add-class'), 'add-new-class');
js_util.u_addClass(document.querySelector('.add-class'), 'add-new-class');
js_util.u_addClass(document.getElementById('my-element-class'), 'add-new-class');