![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
basic-utility-belt
Advanced tools
Basic Utility Belt is a versatile collection of essential utility functions designed to simplify a wide range of common programming tasks. Whether you need to manipulate dates, perform arithmetic operations, or process strings, this toolkit has you covere
Basic Utility Belt is a versatile collection of essential utility functions designed to simplify a wide range of common programming tasks. Whether you need to manipulate dates, perform arithmetic operations, or process strings, this toolkit has you covered. Enhance your development workflow with these reliable and easy-to-use functions, all in one convenient package.
You can install Basic Utility Belt via npm:
npm install basic-utility-belt
Generate a UUID (Universally Unique Identifier).
Parse a URL query string into an object.
queryString
: The URL query string to parse.Perform a deep comparison between two values to determine if they are equivalent.
value1
: The first value to compare.value2
: The second value to compare.true
if the values are equivalent, false
otherwise.Convert a HEX color code to RGB.
hex
: The HEX color code to convert.opacity
: The opacity of the color (optional, default is 1).Generate a random number within a specified range.
min
: The minimum value.max
: The maximum value.Clamp a number within a specified range.
num
: The number to clamp.min
: The minimum value.max
: The maximum value.Round a number to a specified number of decimal places.
num
: The number to round.decimalPlaces
: The number of decimal places.Calculate the average of a variable number of numbers.
...numbers
: The numbers.Calculate the sum of a variable number of numbers.
...numbers
: The numbers.Calculate the factorial of a number.
num
: The number to calculate the factorial of.Generate a Fibonacci sequence up to a specified number of terms.
numTerms
: The number of terms in the Fibonacci sequence.Check if a number is a prime number.
num
: The number to check.Calculate the greatest common divisor of multiple numbers.
...numbers
: Numbers for which to calculate the greatest common divisor.Calculate the least common multiple of multiple numbers.
...numbers
: Numbers for which to calculate the least common multiple.Convert between numbers and Roman numerals.
Convert a number to a Roman numeral.
num
: The number to convert.Convert a Roman numeral to a number.
roman
: The Roman numeral to convert.Get the day of the year from a date.
date
: The date object from which to get the day of the year.Get the week of the year from a date.
date
: The date object from which to get the week of the year.Parse a date string into a JavaScript Date object.
dateString
: The date string to parse.Note: Dates are returned in UTC time.
Format a date object into a string.
date
: The date object to format.Note: Dates are formatted in UTC time.
Calculate the number of days between two dates, inclusive of both the start and end dates.
startDate
: The start date.endDate
: The end date.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.Add a specified number of days to a date.
date
: The date to add days to.days
: The number of days to add.Subtract a specified number of days from a date.
date
: The date to subtract days from.days
: The number of days to subtract.Add a specified number of months to a date.
date
: The date object to which to add months.months
: The number of months to add. Positive values add months in the future, negative values subtract months.Subtract a specified number of months from a date.
date
: The date object from which to subtract months.months
: The number of months to subtract. Positive values subtract months, negative values add months.Add a specified number of years to a date.
date
: The date object to which to add years.years
: The number of years to add. Positive values add years in the future, negative values subtract years.Subtract a specified number of years from a date.
date
: The date object from which to subtract years.years
: The number of years to subtract. Positive values subtract years, negative values add years.Get the day of the week from a date.
date
: The date to get the day of the week from.Check if a date falls on a weekend (Saturday or Sunday).
date
: The date object to check.Check if a date falls on a weekday (Monday to Friday).
date
: The date object to check.Check if a year is a leap year.
year
: The year to check.true
if the year is a leap year, false
otherwise.Capitalize the first letter of a string.
str
: The input string.Convert a string to camel case.
str
: The input string.Convert a string to snake_case.
str
: The string to convert.Convert a string to kebab-case.
str
: The string to convert.Convert a string to PascalCase.
str
: The string to convert.Capitalize the first letter of each word in a string.
str
: The string to capitalize.Reverse a given string.
str
: The input string.Escape HTML special characters in a string.
str
: The input string.Escape special characters in a string for use in a regular expression.
str
: The string to escape.Truncate a string to a specified length and add ellipsis if necessary.
str
: The string to truncate.length
: The maximum length of the truncated string including the ellipsis.Repeat a string a specified number of times.
str
: The string to repeat.count
: The number of times to repeat the string. Default is 10.Check if a string starts with a given substring.
str
: The string to check.searchString
: The substring to search for at the beginning of the string.Check if a string ends with a given substring.
str
: The string to check.searchString
: The substring to search for at the end of the string.Check if a string includes a given substring.
str
: The string to check.searchString
: The substring to search for within the string.Count the occurrences of a substring in a string.
str
: The string to search in.subString
: The substring to count occurrences of.Remove leading and trailing whitespace from a string.
str
: The string to trim.Pad a string with a specified character to a given length.
str
: The string to pad.length
: The desired length of the padded string.char
: The character to use for padding. Default is space.Remove non-ASCII characters from a string.
str
: The string to remove non-ASCII characters from.Reverse the words in a string.
str
: The string whose words to reverse.Calculate the median of an array of numbers.
array
: The array of numbers.Find the minimum value in an array.
array
: The array in which to find the minimum value.Find the maximum value in an array.
array
: The array in which to find the maximum value.Remove duplicate elements from an array, leaving only non-duplicated values.
array
: The array from which to remove duplicates.Remove all falsy values from an array.
array
: The array from which to remove falsy values.Get the symmetric difference of two arrays.
array1
: The first array.array2
: The second array.Get the union of two arrays.
array1
: The first array.array2
: The second array.Get the intersection of two arrays.
array1
: The first array.array2
: The second array.Get the difference between two arrays.
array1
: The first array.array2
: The second array.Randomly shuffle the elements of an array.
array
: The array to shuffle.Remove duplicates from an array.
array
: The array to remove duplicates from.Flatten a nested array.
array
: The nested array to flatten.Split an array into chunks of a specified size.
array
: The array to chunk.size
: The size of each chunk.Validate an email address format.
email
: The email address to validate.true
if the email address is valid, false
otherwise.Validate a URL format.
url
: The URL to validate.true
if the URL is valid, false
otherwise.Validate a credit card number format.
cardNumber
: The credit card number to validate.true
if the credit card number is valid, false
otherwise.Validate an IPv4 address format.
ipv4Address
: The IPv4 address to validate.true
if the IPv4 address is valid, false
otherwise.Validate an IPv6 address format.
ipv6Address
: The IPv6 address to validate.true
if the IPv6 address is valid, false
otherwise.Validate a date string format.
dateString
: The date string to validate.true
if the date string is valid, false
otherwise. Note: This function supports many common date formats but may not cover all edge cases.This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Basic Utility Belt is a versatile collection of essential utility functions designed to simplify a wide range of common programming tasks. Whether you need to manipulate dates, perform arithmetic operations, or process strings, this toolkit has you covere
The npm package basic-utility-belt receives a total of 1 weekly downloads. As such, basic-utility-belt popularity was classified as not popular.
We found that basic-utility-belt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.