Socket
Socket
Sign inDemoInstall

@magloo/utility-functions

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @magloo/utility-functions

@magloo/utility-functions is a collection of JavaScript utility functions designed to simplify common programming tasks. It provides a set of functions for string manipulation, array operations, number handling, date/time formatting, and data validation.


Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
1
Install size
9.58 kB
Created
Weekly downloads
 

Readme

Source

@magloo/utility-functions

@magloo/utility-functions is a collection of JavaScript utility functions designed to simplify common programming tasks. It provides a set of functions for string manipulation, array operations, number handling, date/time formatting, and data validation.

Installation

You can install @magloo/utility-functions via npm:

npm install @magloo/utility-functions

Usage

To use @magloo/utility-functions in your JavaScript project, simply import the desired functions:

Copy code

// Import the isInteger function
const { isInteger } = require("@magloo/utility-functions");

// Check if a value is an integer
console.log(isInteger(5)); // Output: true
console.log(isInteger(-10)); // Output: true
console.log(isInteger(3.14)); // Output: false

Available Functions

  • capitalize(string): Capitalizes the first letter of a string.
  • truncate(string, maxLength): Truncates a string to a specified maximum length.
  • isEmpty(string): Checks if a string is empty or contains only whitespace.
  • shuffle(array): Shuffles the elements of an array.
  • chunk(array, size): Splits an array into smaller chunks of a specified size.
  • unique(array): Removes duplicate elements from an array.
  • clamp(number, min, max): Restricts a number to be within a specified range.
  • isPrime(number): Checks if a number is prime.
  • formatDate(date, format): Formats a Date object into a string according to a specified format.
  • calculateAge(birthDate): Calculates the age based on a given birth date.
  • isValidEmail(email): Validates an email address.
  • isValidURL(url): Validates a URL.
  • isInteger(value): Checks if a value is an integer.

Contributing

Contributions are welcome! If you have suggestions for new features or improvements, feel free to open an issue or submit a pull request on GitHub: https://github.com/yashprasad234/utility-functions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Last updated on 03 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc