1.0.2 • Published 10 months ago

fomautils v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

fomautils

fomautils is a collection of essential utility functions for strings, numbers, arrays, and more. These functions are designed to streamline development tasks, enhance code readability, and boost your productivity.

Installation

Using npm:

npm install fomautils

Usage

import {
  capitalizeFirstLetter,
  mergeArrays,
  removeDuplicatesFromArray,
  generateRandomString,
  // Add more functions here...
} from 'fomautils';

Available Functions

FunctionInputTypeReturn TypeDescription
capitalizeFirstLetterinputString: stringstringstringCapitalizes the first letter of a string.
formatNumberWithCommasnumber: numbernumberstringFormats a number with commas for improved readability.
generateRandomStringlength: numbernumberstringGenerates a random string of the specified length.
isPalindromeinputString: stringstringbooleanChecks if a string is a palindrome (reads the same forwards and backwards).
deepCloneObjectobj: TTTDeep clones an object to prevent reference sharing.
validateEmailAddressemail: stringstringbooleanValidates if a given string is a valid email address.
removeDuplicatesFromArrayarr: T[]T[]T[]Removes duplicates from an array and returns the unique values.
toTitleCaseinputString: stringstringstringConverts a string to title case, capitalizing the first letter of each word.
reverseStringinputString: stringstringstringReverses the characters in a given string.
truncateStringinputString: string, maxLength: numberstring, numberstringTruncates a string to a specified length and appends an ellipsis if needed.
formatWalletAddresswalletAddress: stringstringstringFormats a wallet address for display by showing only the first and last three characters.
toCamelCaseinputString: stringstringstringConverts a string to camelCase (e.g., "hello_world" to "helloWorld").
sumArrayElementsarr: number[]number[]numberCalculates the sum of all elements in an array of numbers.
replaceAllOccurrencesinputString: string, searchValue: string, replaceValue: stringstring, string, stringstringReplaces all occurrences of a substring with another substring in a given string.
calculateAveragearr: number[]number[]numberCalculates the average of all elements in an array of numbers.
generateRandomNumberArraylength: number, minValue: number, maxValue: numbernumber, number, numbernumber[]Generates an array of random numbers within a specified range and length.
mergeArrays...arrays: TT[]T[]Merges multiple arrays into a single array.

Contributing

Contributions to fomautils are welcome! If you find any issues or have additional functions to suggest, please feel free to submit a pull request.

License

fomautils is released under the ISC License.