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

@easylibs/utils

v1.2.21

Published

The `Utils` class is a comprehensive JavaScript utility library that provides a wide range of functions to enhance the development of web applications. This library offers a variety of features, including audio element creation, HTML element manipulation,

Downloads

6

Readme

Utils: A Comprehensive JavaScript Utility Library

The Utils class is a comprehensive JavaScript utility library that provides a wide range of functions to enhance the development of web applications. This library offers a variety of features, including audio element creation, HTML element manipulation, regular expression generation, path resolution, and more.

GitHub stars GitHub issues npm version License jsDelivr downloads

Installation

To use the Utils library in your project, you can either directly include the Utils cdn in your HTML document or install it as a module using a package manager like npm.

Direct Inclusion

To include the Utils library directly in your HTML document, simply add the following script tag to the <head> section of your document:

<!--MINIFIED-->
<script src="https://cdn.jsdelivr.net/npm/@easylibs/utils@latest/dist/utils.min.js"></script>
<script src="https://unpkg.com/@easylibs/utils@latest/dist/utils.min.js"></script>
<!-- OR UNMINIFIED-->
<script src="https://cdn.jsdelivr.net/npm/@easylibs/utils@latest/dist/utils.js"></script>
<script src="https://unpkg.com/@easylibs/utils@latest/dist/utils.js"></script>

npm, yarn or pnpm Installation

To install the Utils library as a module using npm, run the following command in your terminal:

npm install @easylibs/utils
# Or
yarn add @easylibs/utils
# Or
pnpm add @easylibs/utils

Once installed, you can import the library into your JavaScript files using the following syntax:

import Utils from '@easylibs/utils';

Usage

The Utils library provides a wide range of methods that can be used in various scenarios. Here are some examples of how you can use the library:

Creating Audio Elements

The setAudio() function allows you to create audio elements with a specified audio path and optional CSS class. Here's an example of how to use it:

const audio = Utils.setAudio('path/to/audio.mp3', 'my-audio-class');
document.body.appendChild(audio);

Manipulating HTML Elements

The textToHTMLElement() function converts a string of HTML code into an HTML element. It also provides options to return the first child element or all children elements of the created element. Here's an example of how to use it:

const divElement = Utils.textToHTMLElement('<div>Hello World!</div>');
document.body.appendChild(divElement);

Generating Regular Expressions

The getRegexp() function generates regular expressions based on a specified type. It supports various types of regular expressions, including email, phone number, strong password, and more. Here's an example of how to use it:

let's test a password which must contain at least one capital letter, a number, a special character and at least 8 characters.

const strongPasswordRegex = Utils.getRegexp('strong-password');
strongPasswordRegex.test('1234') // return false
strongPasswordRegex.test('Azerty@1234') // return true