utility-hand
This module provides utility functions for sorting arrays and manipulating strings. It extends the native JavaScript Array
and String
prototypes with custom methods and includes standalone functions for use in various JavaScript applications.
Features
- Array.prototype.numSort: Sorts an array of numbers in ascending or descending order.
- String.prototype.trimAll: Removes extra whitespace from a string, collapsing multiple spaces into a single space and trimming leading/trailing spaces.
Installation
To use these functions, simply require the module in your JavaScript file:
const { numSort, trimAll } = require('utility-hand');
trimAll(" Hello World! ")
OR
require('utility-hand');
" Hello World! ".trimAll()