npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@arpadroid/tools

v0.0.17

Published

A Javascript utility library

Downloads

72

Readme

Classes

Functions

Interfaces

CropInterface : CropInterface

Kind: global interface
Properties

| Name | Type | Description | | --- | --- | --- | | x | number | The x-coordinate of the crop. | | y | number | The y-coordinate of the crop. | | width | number | The width of the crop. | | height | number | The height of the crop. | | [ratio] | number | The aspect ratio of the crop. | | [type] | string | The type of the crop. | | [url] | string | The URL of the crop. | | [canvas] | HTMLCanvasElement | The canvas element of the crop. |

ObserverTool

A class that provides a means to subscribe to properties of an instance via observer pattern. It acts as a mixin, and should be used as such via the mixin method.

Kind: global class

observerTool.observersInitialized

Kind: instance property of ObserverTool
Properties

| Name | Type | Description | | --- | --- | --- | | subscriptionsInitialized | Record.<string, boolean> | Key value pair of initialized subscription states. |

observerTool.initializeObservers(id, callback) ⇒ this

Initializes subscriptions for a property, used as a means to prevent accidental duplication of subscriptions.

Kind: instance method of ObserverTool

| Param | Type | | --- | --- | | id | string | | callback | function |

ObserverTool.mixin(instance)

Binds the subscribe, callSubscribers, initializeSubscriptions and unsubscribeProperty methods to the instance.

Kind: static method of ObserverTool

| Param | Type | | --- | --- | | instance | unknown |

ObserverTool.listen(property, callback) ⇒ function

Subscribes to a property.

Kind: static method of ObserverTool

| Param | Type | | --- | --- | | property | string | | callback | never |

ObserverTool.unsubscribe(observers, callback) ⇒ function

Unsubscribes from a property.

Kind: static method of ObserverTool

| Param | Type | | --- | --- | | observers | Array.<function()> | | callback | function |

ObserverTool.signal(property, value, event)

Calls all subscribers of a property.

Kind: static method of ObserverTool

| Param | Type | | --- | --- | | property | string | | value | unknown | | event | unknown |

arrayUnique(array) ⇒ Array

Returns a new array with unique values.

Kind: global function
Returns: Array - - The array with unique values.

| Param | Type | Description | | --- | --- | --- | | array | Array | The input array. |

arrayEmpty(array) ⇒ boolean

Checks if an array is empty.

Kind: global function
Returns: boolean - - True if the array is empty, false otherwise.

| Param | Type | Description | | --- | --- | --- | | array | Array | The input array. |

arrayToNumbers(array) ⇒ Array

Converts each element in the array to a number.

Kind: global function
Returns: Array - - The array with each element converted to a number.

| Param | Type | Description | | --- | --- | --- | | array | Array | The input array. |

areArraysEqual(array1, array2) ⇒ boolean

Checks if two arrays are equal.

Kind: global function
Returns: boolean - - True if the arrays are equal, false otherwise.

| Param | Type | Description | | --- | --- | --- | | array1 | Array | The first array. | | array2 | Array | The second array. |

getColorNode() ⇒ HTMLElement

Returns an HTML node used for color validation and other calculations.

Kind: global function

rgbToHex(rgb) ⇒ string

Converts an RGB color value to a hexadecimal color value.

Kind: global function
Returns: string - - The hexadecimal color value.

| Param | Type | Description | | --- | --- | --- | | rgb | string | The RGB color value to convert. |

stringToHex(color) ⇒ string

Converts a color string to a hexadecimal color value.

Kind: global function
Returns: string - - The hexadecimal color value.

| Param | Type | Description | | --- | --- | --- | | color | string | The color string to convert. |

validateColor(value) ⇒ boolean

Validates a style color value.

Kind: global function
Returns: boolean - - True if the color value is valid, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | string | The color value to validate. |

encodeValueCommas(text) ⇒ string

Encodes commas within double quotes in a text.

Kind: global function
Returns: string - - The encoded text.

| Param | Type | Description | | --- | --- | --- | | text | string | The text to encode. |

decodeValueCommas(text) ⇒ string

Decodes encoded commas within double quotes in a text.

Kind: global function
Returns: string - - The decoded text.

| Param | Type | Description | | --- | --- | --- | | text | string | The text to decode. |

csvToJson(csv, map) ⇒ Array

Converts a CSV string to JSON object array.

Kind: global function
Returns: Array - - The JSON object array.

| Param | Type | Description | | --- | --- | --- | | csv | string | The CSV string to convert. | | map | Record.<string, unknown> | An optional mapping object to rename the keys in the resulting JSON objects. |

normalizeTimeZeroes(time) ⇒ string

Adds zero values if missing from seconds/minutes/hours.

Kind: global function
Returns: string - - The normalized time string.

| Param | Type | Description | | --- | --- | --- | | time | number | The time value. |

getTimeString(date, hasSeconds) ⇒ string

Returns a string representation of the current time hh:mm:ss.

Kind: global function
Returns: string - - The formatted time string.

| Param | Type | Description | | --- | --- | --- | | date | Date | The date object. | | hasSeconds | boolean | Whether to include seconds in the time string. |

getTimezoneOffset(date) ⇒ number

Returns the timezone offset in hours.

Kind: global function
Returns: number - - The timezone offset in hours.

| Param | Type | Description | | --- | --- | --- | | date | Date | The date object. |

isFuture(dateTime) ⇒ boolean

Checks if a given date is in the future.

Kind: global function
Returns: boolean - - True if the date is in the future, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isBefore(dateTime, dateTime2) ⇒ boolean

Checks if one date is before another date.

Kind: global function
Returns: boolean - - True if the first date is before the second date, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The first date and time to compare. | | dateTime2 | Date | The second date and time to compare. |

isAfter(dateTime, dateTime2) ⇒ boolean

Checks if one date is after another date.

Kind: global function
Returns: boolean - - True if the first date is after the second date, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The first date and time to compare. | | dateTime2 | Date | The second date and time to compare. |

isPast(dateTime) ⇒ boolean

Checks if a given date is in the past.

Kind: global function
Returns: boolean - - True if the date is in the past, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isToday(dateTime) ⇒ boolean

Checks if a given date is today.

Kind: global function
Returns: boolean - - True if the date is today, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isYesterday(dateTime) ⇒ boolean

Checks if a given date is yesterday.

Kind: global function
Returns: boolean - - True if the date is yesterday, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isTomorrow(dateTime) ⇒ boolean

Checks if a given date is tomorrow.

Kind: global function
Returns: boolean - - True if the date is tomorrow, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isThisWeek(dateTime) ⇒ boolean

Checks if a given date is within the current week.

Kind: global function
Returns: boolean - - True if the date is within the current week, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isThisMonth(dateTime) ⇒ boolean

Checks if a given date is within the current month.

Kind: global function
Returns: boolean - - True if the date is within the current month, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

isThisYear(dateTime) ⇒ boolean

Checks if a given date is within the current year.

Kind: global function
Returns: boolean - - True if the date is within the current year, false otherwise.

| Param | Type | Description | | --- | --- | --- | | dateTime | Date | The date and time to compare. |

addTimezoneOffset(date) ⇒ Date

Adds the timezone offset to a given date.

Kind: global function
Returns: Date - - The date object with the timezone offset added.

| Param | Type | Description | | --- | --- | --- | | date | Date | The date object to modify. |

formatDate(_date, format, addOffset, locale) ⇒ string

Formats a given date into a specified format.

Kind: global function
Returns: string - - The formatted date string.

| Param | Type | Description | | --- | --- | --- | | _date | Date | The date object to format. | | format | string | The format string. | | addOffset | boolean | Whether to add the timezone offset to the date. | | locale | string | The locale to use for formatting. |

getTimeAgo(date, referenceDate, format) ⇒ string

Returns a formatted string representing the time elapsed since the given date.

Kind: global function
Returns: string - - The formatted time elapsed string.

| Param | Type | Description | | --- | --- | --- | | date | Date | The date to compare. | | referenceDate | Date | The reference date to compare against. | | format | string | The format string. |

validateDateFormat(format) ⇒ boolean

Validates a date format string.

Kind: global function
Returns: boolean - - True if the format is valid, false otherwise.

| Param | Type | Description | | --- | --- | --- | | format | string | The format string to validate. |

getDaysInMonth(month, year) ⇒ number

Returns the number of days in a given month.

Kind: global function
Returns: number - - The number of days in the month.

| Param | Type | | --- | --- | | month | number | | year | number |

setDateToMonday(date) ⇒ number

Sets a date to the first day of the week.

Kind: global function
Returns: number - - The number of days in the month.

| Param | Type | Description | | --- | --- | --- | | date | Date | The date object. |

isOperaPhone() ⇒ boolean

Checks if the user agent is Opera Mini.

Kind: global function
Returns: boolean - True if the user agent is Opera Mini, false otherwise.

isIE11() ⇒ boolean

Checks if the user agent is Internet Explorer 11.

Kind: global function
Returns: boolean - True if the user agent is Internet Explorer 11, false otherwise.

isIE() ⇒ boolean

Checks if the user agent is Internet Explorer (any version).

Kind: global function
Returns: boolean - True if the user agent is Internet Explorer, false otherwise.

isEdge() ⇒ boolean

Checks if the user agent is Edge.

Kind: global function
Returns: boolean - True if the user agent is Edge, false otherwise.

isFirefox() ⇒ boolean

Checks if the user agent is Firefox.

Kind: global function
Returns: boolean - True if the user agent is Firefox, false otherwise.

isIOSPhone() ⇒ boolean

Checks if the user agent is iOS (iPhone, iPad, iPod).

Kind: global function
Returns: boolean - True if the user agent is iOS, false otherwise.

isWebkit() ⇒ boolean

Checks if the user agent is WebKit.

Kind: global function
Returns: boolean - True if the user agent is WebKit, false otherwise.

isChrome() ⇒ boolean

Checks if the user agent is Chrome.

Kind: global function
Returns: boolean - True if the user agent is Chrome, false otherwise.

isSafari() ⇒ boolean

Checks if the user agent is Safari.

Kind: global function
Returns: boolean - True if the user agent is Safari, false otherwise.

isIOsSafari() ⇒ boolean

Checks if the user agent is iOS Safari (iPhone, iPad, iPod or Safari browser).

Kind: global function
Returns: boolean - True if the user agent is iOS Safari, false otherwise.

getExtension(file) ⇒ string

Get the extension of a file.

Kind: global function

| Param | Type | | --- | --- | | file | File |

getFileName(file) ⇒ string

Get the name of a file.

Kind: global function

| Param | Type | | --- | --- | | file | File |

getMimeType(file) ⇒ string

Get the MIME type of a file.

Kind: global function

| Param | Type | | --- | --- | | file | File |

getBase64(file) ⇒ Promise.<string>

Convert a file to base64 asynchronously.

Kind: global function

| Param | Type | | --- | --- | | file | File |

getBase64Sync(file) ⇒ string

Convert a file to base64 synchronously.

Kind: global function

| Param | Type | | --- | --- | | file | File |

getBase64FromUrl(url) ⇒ Promise.<string>

Convert a file from a URL to base64.

Kind: global function

| Param | Type | | --- | --- | | url | string |

megaBytesToBytes(megaBytes) ⇒ number

Convert megabytes to bytes.

Kind: global function

| Param | Type | | --- | --- | | megaBytes | number |

formatBytes(bytes, [precision]) ⇒ string

Format bytes to a human-readable string.

Kind: global function

| Param | Type | | --- | --- | | bytes | number | | [precision] | number |

eventContainsFiles(event) ⇒ boolean

Check if an event contains files.

Kind: global function

| Param | Type | | --- | --- | | event | Event |

processFile(file) ⇒ Record.<string, unknown>

Given a file object, returns a new object with processed data.

Kind: global function

| Param | Type | | --- | --- | | file | File |

getDisplaySize(img) ⇒ Array.<number>

Calculates the display size of an image.

Kind: global function
Returns: Array.<number> - - The display size [width, height].

| Param | Type | Description | | --- | --- | --- | | img | HTMLImageElement | The image element. |

upscale(image, opt)

Up-scales an image to the available space in the image HTML container while maintaining the aspect ratio.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | image | HTMLImageElement | The image element. | | opt | CropInterface | The crop options. |

crop(image, opt) ⇒ CropInterface

Crops an image.

Kind: global function
Returns: CropInterface - - The cropped image data.

| Param | Type | Description | | --- | --- | --- | | image | HTMLImageElement | The image element. | | opt | CropInterface | The crop options. |

getMaximumSize([maxSize], [breaks]) ⇒ number

Calculates the maximum size based on the screen dimensions.

Kind: global function
Returns: number - - The maximum size.

| Param | Type | Description | | --- | --- | --- | | [maxSize] | number | The maximum size of the image. | | [breaks] | Array.<number> | The breakpoints. |

attr(node, attributes)

Adds attributes to a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | | attributes | Record.<string, string> |

isInView(node) ⇒ boolean

Checks if a node is in the viewport.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement |

addContent(node, content)

Adds content to a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | | content | * |

setContent(node, content)

Sets content to a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | | content | * |

style(node, css)

Styles a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | | css | Record.<string, string> |

prepend(node, child)

Prepends a child node to a parent node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | | child | HTMLElement |

resolveNode(node) ⇒ HTMLElement | null

Resolves a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | string |

getScrollableParent(node) ⇒ HTMLElement | null

Returns the scrollable parent of a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement |

getOffset(node) ⇒ Array.<number>

Returns the offset of a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement |

onDoubleClick(node, callback, delay)

Adds a double click event listener to a node.

Kind: global function

| Param | Type | | --- | --- | | node | HTMLElement | | callback | function | | delay | number |

isObject(obj) ⇒ boolean

Checks if an object is an object and not an array or HTMLElement.

Kind: global function

| Param | Type | | --- | --- | | obj | unknown |

mergeObjects(obj, obj2, strict) ⇒ Record.<string, unknown>

Merges two objects recursively.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | obj | Record.<string, unknown> | | | obj2 | Record.<string, unknown> | | | strict | boolean | Strict mode will filter out properties that are not in the original object. |

getPropertyValue(path, object, defaultValue) ⇒ unknown

Return the value of a nested object property.

Kind: global function

| Param | Type | | --- | --- | | path | string | | object | Record.<string, unknown> | | defaultValue | unknown |

countProps(obj) ⇒ number

Counts the number of properties in an object.

Kind: global function

| Param | Type | | --- | --- | | obj | Object |

createFormData(obj) ⇒ FormData

Creates a FormData object from an object.

Kind: global function

| Param | Type | | --- | --- | | obj | Object |

initializeResize(callback)

Initializes the resize event listener and sets the flag indicating it has been initialized.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | callback | function | The callback function to be executed on resize. |

removeScrollCallback(callback)

Removes the specified callback function from the scroll event listener.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | callback | function | The callback function to be removed. |

_onResize(event)

Executes resize event listener callbacks.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | event | Event | The resize event handler. |

onResize(callback)

Adds a callback function to the resize event listener.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | callback | function | The callback function to be added. |

initializeOnScroll(callback)

Initializes the scroll event listener and sets the flag indicating it has been initialized.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | callback | function | The callback function to be executed on scroll. |

_onScroll(event)

Executes scroll event listener callbacks.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | event | Event | The resize event. |

onScroll(callback)

Adds a callback function to the scroll event listener.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | callback | function | The callback function to be added. |

removeResizeCallback(callback)

Removes the specified callback function from the resize event listener.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | callback | function | The callback function to be removed. |

dashedToCamel(str) ⇒ string

Converts a dashed string to camel case.

Kind: global function
Returns: string - The camel case string.

| Param | Type | Description | | --- | --- | --- | | str | string | The dashed string. |

ucFirst(str) ⇒ string

Converts the first character of a string to uppercase.

Kind: global function
Returns: string - The string with the first character in uppercase.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

lcFirst(str) ⇒ string

Converts the first character of a string to lowercase.

Kind: global function
Returns: string - The string with the first character in lowercase.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

truncate(str, length) ⇒ string

Truncates a string to a specified length.

Kind: global function
Returns: string - The truncated string.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. | | length | number | The maximum length of the truncated string. |

getSafeID(str) ⇒ string

Removes unsafe characters from a string to create a safe ID.

Kind: global function
Returns: string - The safe ID string.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

parseOutlookEmails(str) ⇒ Array.<string>

Parses email addresses from a string.

Kind: global function
Returns: Array.<string> - An array of parsed email addresses.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

mechanize(str) ⇒ string

Converts a string to a URL-friendly format.

Kind: global function
Returns: string - The URL-friendly string.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

removeWhiteSpace(str) ⇒ string

Removes white spaces from a string.

Kind: global function
Returns: string - The string without white spaces.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

extractCurrency(str) ⇒ string | null

Extracts the currency symbol from a string.

Kind: global function
Returns: string | null - The currency symbol or null if not found.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

sanitizeSearchInput(str) ⇒ string

Sanitizes a search input by removing special characters and limiting the length.

Kind: global function
Returns: string - The sanitized search input.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

getInitials(str) ⇒ string

Retrieves the initials from a string.

Kind: global function
Returns: string - The initials.

| Param | Type | Description | | --- | --- | --- | | str | string | The input string. |

processTemplate(template, props) ⇒ string

Processes a template string and replaces the placeholders with the provided props.

Kind: global function
Returns: string - The processed template.

| Param | Type | Description | | --- | --- | --- | | template | string | The template string. | | props | Record.<string, string> | The props to replace the placeholders with. |

getURLParams(url) ⇒ object

Extracts query string parameters from a string representing a URL and returns them in an object.

Kind: global function
Returns: object - - An object representing the query string parameters.

| Param | Type | Description | | --- | --- | --- | | url | string | A URL string. |

arrayToQueryString(propName, array, encode) ⇒ string

Transforms an array into a URL query string.

Kind: global function
Returns: string - - A URL query string.

| Param | Type | Description | | --- | --- | --- | | propName | string | The name of the property. | | array | Array.<string> | The array to be converted into a query string. | | encode | boolean | Whether or not to encode the query string values. |

decodeURIComponentSafe(value) ⇒ string

Decodes a URI component safely.

Kind: global function
Returns: string - - The decoded value.

| Param | Type | Description | | --- | --- | --- | | value | string | The value to be decoded. |

areUrlsEqual(url1, url2) ⇒ boolean

Checks if two URLs are equal.

Kind: global function
Returns: boolean - - True if the URLs are equal, false otherwise.

| Param | Type | Description | | --- | --- | --- | | url1 | string | The first URL. | | url2 | string | The second URL. |

removeLastSlash(path) ⇒ string

Removes the last slash from a path.

Kind: global function
Returns: string - - The path without the last slash.

| Param | Type | Description | | --- | --- | --- | | path | string | A path string. |

sanitizePath(path) ⇒ string

Sanitizes the path.

Kind: global function
Returns: string - - The sanitized path.

| Param | Type | Description | | --- | --- | --- | | path | string | A path string. |

removeURLOrigin(url) ⇒ string | undefined

Removes the origin from a URL.

Kind: global function
Returns: string | undefined - - The URL without the origin.

| Param | Type | Description | | --- | --- | --- | | url | string | A URL string. |

sanitizeURL(url) ⇒ string

Sanitizes the URL.

Kind: global function
Returns: string - - The sanitized URL.

| Param | Type | Description | | --- | --- | --- | | url | string | A URL string. |

getURLPath(url) ⇒ string

Returns the current path.

Kind: global function
Returns: string - - The current path.

| Param | Type | Description | | --- | --- | --- | | url | string | A URL string. |

getURLParam(name, url) ⇒ string

Gets a specific query string parameter value from a URL.

Kind: global function
Returns: string - - The value of the query string parameter.

| Param | Type | Description | | --- | --- | --- | | name | string | The name of the query string parameter. | | url | string | A URL string. |

matchPath(url, route) ⇒ boolean

Matches a URL against a route.

Kind: global function
Returns: boolean - - True if there is a match, false otherwise.

| Param | Type | Description | | --- | --- | --- | | url | string | Any URL. | | route | Array.<string> | An array of routes to match against. |

matchPaths(url, routes) ⇒ boolean

Matches a URL against multiple routes.

Kind: global function
Returns: boolean - - True if there is a match, false otherwise.

| Param | Type | Description | | --- | --- | --- | | url | string | Any URL. | | routes | Array.<string> | An array of routes to match against. |

getPathParts(url) ⇒ Array.<string>

Returns the parts of the current path.

Kind: global function
Returns: Array.<string> - - The parts of the current path.

| Param | Type | Description | | --- | --- | --- | | url | string | A URL string. |

objectToQueryString(object, encode) ⇒ string

Transforms an object into a URL query string.

Kind: global function
Returns: string - - A URL query string.

| Param | Type | Description | | --- | --- | --- | | object | object | An object with properties to be converted into a query string. | | encode | boolean | Whether or not to encode the query string values. |

editURL(url, params, encode) ⇒ string

Edits the query in a URL. This function is designed to work with any kind of string, not necessarily a valid URL format that includes a protocol, such as the one required by the native JS URL constructor, which does not handle relative URLs. Unlike URLSearchParams constructor, this function accepts a full URL and will not encode the path.

Kind: global function
Returns: string - - A new URL string with query string parameters based on the params object.

| Param | Type | Description | | --- | --- | --- | | url | string | A URL string. | | params | object | A set of parameters representing query string values that must be edited in the URL. | | encode | boolean | Whether or not to encode the query string values. |

removeURLParam(name, url) ⇒ string

Removes a specific query string parameter from a URL.

Kind: global function
Returns: string - - A new URL string without the specified query string parameter.

| Param | Type | Description | | --- | --- | --- | | name | string | The name of the query string parameter to remove. | | url | string | A URL string. |

validateRequired(value) ⇒ boolean

Checks if a value is required.

Kind: global function
Returns: boolean - - True if the value is required, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | unknown | The value to be checked. |

validateMaxLength(value, maxLength) ⇒ boolean | undefined

Checks if a value has a maximum length.

Kind: global function
Returns: boolean | undefined - - True if the value has a maximum length, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | unknown | The value to be checked. | | maxLength | number | The maximum length allowed. |

validateMinLength(value, minLength) ⇒ boolean | undefined

Checks if a value has a minimum length.

Kind: global function
Returns: boolean | undefined - - True if the value has a minimum length, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | unknown | The value to be checked. | | minLength | number | The minimum length allowed. |

validateLength(value, length) ⇒ boolean | undefined

Checks if a value has a specific length.

Kind: global function
Returns: boolean | undefined - - True if the value has the specific length, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | unknown | The value to be checked. | | length | number | The specific length to be checked against. |

validateSize(value, size) ⇒ boolean

Checks if a value has a size within a range.

Kind: global function
Returns: boolean - - True if the value has a size within the range, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | unknown | The value to be checked. | | size | Array.<number> | The range of sizes allowed. |

validateRegex(value, _regex) ⇒ boolean

Checks if a value matches a regular expression.

Kind: global function
Returns: boolean - - True if the value matches the regular expression, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | * | The value to be checked. | | _regex | string | RegExp | The regular expression to be used for matching. |

validateNumber(_value) ⇒ boolean

Checks if a value is a number.

Kind: global function
Returns: boolean - - True if the value is a number, false otherwise.

| Param | Type | Description | | --- | --- | --- | | _value | * | The value to be checked. |

validateColour(value) ⇒ boolean

Checks if a value is a valid color.

Kind: global function
Returns: boolean - - True if the value is a valid color, false otherwise.

| Param | Type | Description | | --- | --- | --- | | value | string | The value to be checked. |