New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

basic-utility-belt

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-utility-belt

basic toolkit for everyday use

  • 1.0.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Basic Utility Belt

Basic Utility Belt is a comprehensive collection of fundamental utility functions designed to simplify common programming tasks. From arithmetic to date handling, streamline your workflow with our versatile collection of essential tools.

Navigation

  • Installation
  • Features
  • Docs
  • License

Installation

You can install Basic Utility Belt via npm:

npm install basic-utility-belt

Features

  • Arithmetic operations
  • Date and time manipulation
  • String processing
  • File utilities
  • and more...

Docs

numbers.js

getRandomNumber(min, max)

Generate a random number within a specified range.

  • min: The minimum value.
  • max: The maximum value.
  • Returns: A random number between min and max (inclusive).
clamp(num, min, max)

Clamp a number within a specified range.

  • num: The number to clamp.
  • min: The minimum value.
  • max: The maximum value.
  • Returns: The clamped number.
round(num, decimalPlaces)

Round a number to a specified number of decimal places.

  • num: The number to round.
  • decimalPlaces: The number of decimal places.
  • Returns: The rounded number.
average(numbers)

Calculate the average of an array of numbers.

  • numbers: The array of numbers.
  • Returns: The average of the numbers.
sum(numbers)

Calculate the sum of an array of numbers.

  • numbers: The array of numbers.
  • Returns: The sum of the numbers.
factorial(num)

Calculate the factorial of a number.

  • num: The number to calculate the factorial of.
  • Returns: The factorial of the number.
fibonacci(numTerms)

Generate a Fibonacci sequence up to a specified number of terms.

  • numTerms: The number of terms in the Fibonacci sequence.
  • Returns: The Fibonacci sequence.
isPrime(num)

Check if a number is a prime number.

  • num: The number to check.
  • Returns: True if the number is prime, false otherwise.
gcd(...numbers)

Calculate the greatest common divisor of multiple numbers.

  • ...numbers: Numbers for which to calculate the greatest common divisor.
  • Returns: The greatest common divisor.
lcm(...numbers)

Calculate the least common multiple of multiple numbers.

  • ...numbers: Numbers for which to calculate the least common multiple.
  • Returns: The least common multiple.

dates.js

getCalendarDays(startDate, endDate)

Calculate the number of days between two dates, inclusive of both the start and end dates.

  • startDate: The start date.
  • endDate: The end date.
  • Returns: The number of days between the two dates.
getWorkingDays(startDate, endDate)

Calculate the number of working days (Monday to Friday) between two dates, inclusive of both the start and end dates.

  • startDate: The start date.
  • endDate: The end date.
  • Returns: The number of working days between the two dates.
addDays(date, days)

Add a specified number of days to a date.

  • date: The date to add days to.
  • days: The number of days to add.
  • Returns: The new date after adding days.
subtractDays(date, days)

Subtract a specified number of days from a date.

  • date: The date to subtract days from.
  • days: The number of days to subtract.
  • Returns: The new date after subtracting days.
getDayOfWeek(date)

Get the day of the week from a date.

  • date: The date to get the day of the week from.
  • Returns: The day of the week as a string.
isLeapYear(year)

Check if a year is a leap year.

  • year: The year to check.
  • Returns: true if the year is a leap year, false otherwise.

License

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

Keywords

FAQs

Package last updated on 23 May 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc