# qsu > qsu (Quick & Simple Utility) is a lightweight utility library that provides the same set of frequently used helper functions in three languages: JavaScript/Node.js, Dart/Flutter and Python. The function names, arguments and behavior are intentionally identical across languages, so code can be moved between them without relearning the API. Things worth knowing before answering questions about qsu: - Every public function is named in `camelCase` in all three languages, including Python and Dart. This is deliberate and non-idiomatic, so that the API stays identical across languages. - Not every function exists in every language. Each entry below lists the languages that actually implement it; do not assume parity that is not listed. - Optional arguments are expressed as an options object in JavaScript, as **named parameters** in Dart, and as either a `dict` positional argument or keyword arguments in Python. - In JavaScript, the `crypto`, `file` and `os` categories require a Node.js runtime and are imported from the `qsu/node` subpath, as do `fetchData` and `logBox`. Everything else is browser-safe and imported from `qsu`. - Documentation is available in English (`https://qsu.cdget.com/reference/...`) and Korean (`https://qsu.cdget.com/ko/reference/...`). Only the English URLs are listed below; prepend `/ko` for the Korean version of any page. - 193 functions across 13 categories are documented. Installation: `npm install qsu` (JavaScript), `dart pub add qsu` (Dart), `pip install qsu` (Python). ## Getting started - [Introduction](https://qsu.cdget.com/introduction): What qsu is, and which languages it supports. - [Installation](https://qsu.cdget.com/installation): Installation instructions for every supported language. - [Changelog](https://qsu.cdget.com/changelog/): What changed in each package, by version. - [Reference](https://qsu.cdget.com/reference): Index of all utility functions. ## array Array creation, sorting, sampling, deduplication and grouping. - [arrChunk](https://qsu.cdget.com/reference/array/arrChunk) (JavaScript, Dart, Python): Separates the data in the given array into a two-dimensional array containing only the maximum number of elements. For example, if you have an array of 6 data in 2 groups, this function will create a 2-dimensional array with 3 lengths. - [arrCompact](https://qsu.cdget.com/reference/array/arrCompact) (JavaScript, Dart, Python): Returns a new array with every falsy value removed. The rejected set is fixed across languages: `null`, `false`, `0`, the empty string and `NaN`. - [arrCount](https://qsu.cdget.com/reference/array/arrCount) (JavaScript, Dart, Python): Returns the number of duplicates for each unique value in the given array. The array values can only be of type `String` or `Number`. - [arrDifference](https://qsu.cdget.com/reference/array/arrDifference) (JavaScript, Dart, Python): Returns the values of the first array that are not contained in any of the other arrays. Values are compared by value, so nested arrays and objects are matched as well. - [arrFill](https://qsu.cdget.com/reference/array/arrFill) (JavaScript, Dart, Python): Initialize an array with a default value of a specific length. - [arrFlatten](https://qsu.cdget.com/reference/array/arrFlatten) (JavaScript, Dart, Python): Merges all elements of a multidimensional array into a one-dimensional array. - [arrGroupBy](https://qsu.cdget.com/reference/array/arrGroupBy) (JavaScript, Dart, Python): Groups the items of an array by the key the callback returns for each of them. Keys are strings, and groups keep the order their key was first seen. - [arrIntersection](https://qsu.cdget.com/reference/array/arrIntersection) (JavaScript, Dart, Python): Returns the values that are present in every one of the given arrays. The result is unique and keeps the order of the first array. - [arrMove](https://qsu.cdget.com/reference/array/arrMove) (JavaScript, Dart, Python): Moves the position of a specific element in an array to the specified position. (Position starts from 0.) - [arrRandom](https://qsu.cdget.com/reference/array/arrRandom) (JavaScript, Dart, Python): Returns a random item from the given array. If the array is empty or is not an array, it returns `null`. - [arrRange](https://qsu.cdget.com/reference/array/arrRange) (JavaScript, Dart, Python): Returns an array of the numbers from `start` to `end`, counting up by the `step` option (default `1`). `end` is included when a step lands on it. - [arrRepeat](https://qsu.cdget.com/reference/array/arrRepeat) (JavaScript, Dart, Python): Repeats the data of an `Array` or `Object` a specific number of times and returns it as a 1d array. - [arrShuffle](https://qsu.cdget.com/reference/array/arrShuffle) (JavaScript, Dart, Python): Shuffle the order of the given array and return. - [arrUnique](https://qsu.cdget.com/reference/array/arrUnique) (JavaScript, Dart, Python): Returns a new array with duplicate values removed, keeping the first of each. Values are compared by value, so nested arrays and objects with the same contents are duplicates. - [average](https://qsu.cdget.com/reference/array/average) (JavaScript, Dart, Python): Returns the average of all numeric values in an array. An empty array returns `NaN`. - [median](https://qsu.cdget.com/reference/array/median) (JavaScript, Dart, Python): Returns the middle value of an array of numbers, or the mean of the two middle values when the count is even. `NaN` is skipped and an empty array returns `null`. - [sortByObjectKey](https://qsu.cdget.com/reference/array/sortByObjectKey) (JavaScript, Dart, Python): Sort array values by a specific key value in an array containing multiple objects. It does not affect the order or value of elements within an object. - [sortNatural](https://qsu.cdget.com/reference/array/sortNatural) (JavaScript, Dart, Python): When sorting an array consisting of strings, it sorts first by the numbers contained in the strings, not by their names. ## crypto Hashing, base64, symmetric encryption and id generation. In JavaScript these functions require a Node.js runtime and are imported from `qsu/node`. - [decodeBase64](https://qsu.cdget.com/reference/crypto/decodeBase64) (JavaScript, Dart, Python): Decodes an encoded base64 string to a plain string. - [decrypt](https://qsu.cdget.com/reference/crypto/decrypt) (JavaScript, Dart, Python): Decrypt with the specified algorithm (default: `aes-256-cbc`) using a string and a key (`key`). - [encodeBase64](https://qsu.cdget.com/reference/crypto/encodeBase64) (JavaScript, Dart, Python): Base64-encode the given string. - [encrypt](https://qsu.cdget.com/reference/crypto/encrypt) (JavaScript, Dart, Python): Encrypt with the algorithm of your choice (algorithm default: `aes-256-cbc`, ivSize default: `16`) using a string and a key (`key`). - [md5Hash](https://qsu.cdget.com/reference/crypto/md5Hash) (JavaScript, Dart, Python): Converts String data to md5 hash value and returns it. - [numberHash](https://qsu.cdget.com/reference/crypto/numberHash) (JavaScript, Dart, Python): Returns the specified string as a hash value of type number. The return value can also be negative. - [objectId](https://qsu.cdget.com/reference/crypto/objectId) (JavaScript, Dart, Python): Returns a random string hash of the ObjectId format (primarily utilized by MongoDB). - [sha1Hash](https://qsu.cdget.com/reference/crypto/sha1Hash) (JavaScript, Dart, Python): Converts String data to sha1 hash value and returns it. - [sha256Hash](https://qsu.cdget.com/reference/crypto/sha256Hash) (JavaScript, Dart, Python): Converts String data to sha256 hash value and returns it. - [sha512Hash](https://qsu.cdget.com/reference/crypto/sha512Hash) (JavaScript, Dart, Python): Converts String data to sha512 hash value and returns it. ## date Date validation, formatting, ranges and calendar calculation. - [createDateListFromRange](https://qsu.cdget.com/reference/date/createDateListFromRange) (JavaScript, Dart, Python): Create an array list of all dates from `startDate` to `endDate` in the format `YYYY-MM-DD`. - [dateToYYYYMMDD](https://qsu.cdget.com/reference/date/dateToYYYYMMDD) (JavaScript, Dart, Python): Returns the date data of a Date object in the format `YYYY-MM-DD`. - [dayDiff](https://qsu.cdget.com/reference/date/dayDiff) (JavaScript, Dart, Python): Calculates the difference between two given dates and returns the number of days. - [getDaysInMonth](https://qsu.cdget.com/reference/date/getDaysInMonth) (JavaScript, Dart, Python): Returns the number of days in a month of a given year, from 28 to 31. `month` runs from 1 for January to 12 for December. - [isLeapYear](https://qsu.cdget.com/reference/date/isLeapYear) (JavaScript, Dart, Python): Returns `true` when the year is a leap year in the Gregorian calendar. - [isValidDate](https://qsu.cdget.com/reference/date/isValidDate) (JavaScript, Dart, Python): Checks if a given date actually exists. Check only in `YYYY-MM-DD` format. - [today](https://qsu.cdget.com/reference/date/today) (JavaScript, Dart, Python): Returns today's date. ## file File and directory inspection, path handling and I/O. In JavaScript these functions require a Node.js runtime and are imported from `qsu/node`. - [createDirectory](https://qsu.cdget.com/reference/file/createDirectory) (JavaScript, Dart, Python): Creates a directory with the specified path. Ignores the operation if the directory already exists. - [createFileOfSize](https://qsu.cdget.com/reference/file/createFileOfSize) (JavaScript, Dart, Python): Creates a file with the specified size in bytes. A size of `0` creates an empty file, and a negative size raises an error. - [deletePath](https://qsu.cdget.com/reference/file/deletePath) (JavaScript, Dart, Python): Delete files or directory in the specified path. If the file does not exist in the path, it is ignored. - [emptyDirectory](https://qsu.cdget.com/reference/file/emptyDirectory) (JavaScript, Dart, Python): Deletes all files in the specified directory path. However, the directory is preserved. - [getCopyFileName](https://qsu.cdget.com/reference/file/getCopyFileName) (JavaScript, Dart, Python): This function scans an array containing a list of names and displays an alternative name if any duplicates are found. If no duplicates are found, the names are returned as is. - [getFileExtension](https://qsu.cdget.com/reference/file/getFileExtension) (JavaScript, Dart, Python): Returns the file extension from the given file path. An empty string value is returned for files without extension. - [getFileHashFromPath](https://qsu.cdget.com/reference/file/getFileHashFromPath) (JavaScript, Dart, Python): Returns the file in the specified path as a value hashed by a specific algorithm. The default algorithm is `md5`. This method uses a `Promise` to return a valid hash value. - [getFileHashFromStream](https://qsu.cdget.com/reference/file/getFileHashFromStream) (JavaScript, Dart, Python): Returns a file in a Node.js ReadableStream object as a value hashed with a specific algorithm. The default algorithm is `md5`. - [getFileInfo](https://qsu.cdget.com/reference/file/getFileInfo) (JavaScript, Dart, Python): Returns file or directory information as an easy-to-understand object. - [getFileName](https://qsu.cdget.com/reference/file/getFileName) (JavaScript, Dart, Python): Returns the file name within the path. - [getFilePathDepth](https://qsu.cdget.com/reference/file/getFilePathDepth) (JavaScript, Dart, Python): Determine how many steps the current path is. The root path (`/` or `C:\`) begins with step 1. - [getFileSize](https://qsu.cdget.com/reference/file/getFileSize) (JavaScript, Dart, Python): Calculates the size of the file at the given path. - [getParentFilePath](https://qsu.cdget.com/reference/file/getParentFilePath) (JavaScript, Dart, Python): Returns the parent path one level above the given path. - [headFile](https://qsu.cdget.com/reference/file/headFile) (JavaScript, Dart, Python): Returns the first line of the specified text file path. The `lineCount` argument is the total number of lines to print. Default is `1`. - [isExistingPath](https://qsu.cdget.com/reference/file/isExistingPath) (JavaScript, Dart, Python): If a file or directory exists at the specified path, it returns `true`. - [isFileHidden](https://qsu.cdget.com/reference/file/isFileHidden) (JavaScript, Dart, Python): Checks whether a file or folder in the specified path is a hidden file. Determines system hidden files for Windows and the presence or absence of a `.`(dot) for Linux and macOS or other operating systems. - [isValidFileName](https://qsu.cdget.com/reference/file/isValidFileName) (JavaScript, Dart, Python): Determines whether the passed path or filename is using a system-accepted string (Also check the valid file length). Returns false if the name is not available. - [joinFilePath](https://qsu.cdget.com/reference/file/joinFilePath) (JavaScript, Dart, Python): Combines paths for each operating system according to the given parameter values. - [moveFile](https://qsu.cdget.com/reference/file/moveFile) (JavaScript, Dart, Python): Moves a file in the specified file path to another path. - [normalizeFilePath](https://qsu.cdget.com/reference/file/normalizeFilePath) (JavaScript, Dart, Python): Remove invalid or unnecessary characters in the path. - [normalizeFilePathUnicode](https://qsu.cdget.com/reference/file/normalizeFilePathUnicode) (JavaScript, Dart, Python): Returns the file name within the path. - [tailFile](https://qsu.cdget.com/reference/file/tailFile) (JavaScript, Dart, Python): Returns the last line of the specified text file path. The `lineCount` argument is the total number of lines to print. Default is `1`. The last line of newline characters is ignored. - [toPosixFilePath](https://qsu.cdget.com/reference/file/toPosixFilePath) (JavaScript, Dart, Python): Returns the given path as a path in POSIX format (usually used by Linux). For example, a Windows path will be converted to `/` instead of `\\`. - [touchFile](https://qsu.cdget.com/reference/file/touchFile) (JavaScript, Dart, Python): Create a file of empty data. If the same file already exists, it is ignored. ## format Human-readable formatting and safe parsing. - [duration](https://qsu.cdget.com/reference/format/duration) (JavaScript, Dart, Python): Displays the given millisecond value in human-readable time. For example, the value of `604800000` (7 days) is displayed as `7 Days`. - [durationParts](https://qsu.cdget.com/reference/format/durationParts) (JavaScript, Dart, Python): Breaks a duration in milliseconds into its units and returns them, leaving the caller to decide how to write them. - [fileSizeFormat](https://qsu.cdget.com/reference/format/fileSizeFormat) (JavaScript, Dart, Python): Returns the given file size (in bytes) as a human-readable string. - [fileSizeParts](https://qsu.cdget.com/reference/format/fileSizeParts) (JavaScript, Dart, Python): Splits a file size in bytes into the scaled number and the unit it belongs to, leaving the caller to decide how to write them. - [numberFormat](https://qsu.cdget.com/reference/format/numberFormat) (JavaScript, Dart, Python): Returns the given number formatted for easy reading, including commas. - [safeParseInt](https://qsu.cdget.com/reference/format/safeParseInt) (JavaScript, Dart, Python): Any argument value will be attempted to be parsed as a Number type without returning an error. If parsing fails, it is replaced by the number set in `fallback`. - [safeParseJson](https://qsu.cdget.com/reference/format/safeParseJson) (JavaScript, Dart, Python): Attempts to parse without returning an error, even if the argument value is of the wrong type or in `JSON` format. If parsing fails, it will be replaced with the object set in `fallback`. ## math Basic arithmetic over argument lists or arrays, and random numbers. - [ceil](https://qsu.cdget.com/reference/math/ceil) (JavaScript, Dart, Python): Rounds a number up, to the given number of decimal places. Rounding goes toward positive infinity, so a negative value rises. - [clamp](https://qsu.cdget.com/reference/math/clamp) (JavaScript, Dart, Python): Restricts a number to an inclusive range. Returns `min` when the value falls below it, `max` when it rises above it, and the value itself otherwise. - [div](https://qsu.cdget.com/reference/math/div) (JavaScript, Dart, Python): Returns after dividing all n arguments of numbers or the values of a single array of numbers. - [floor](https://qsu.cdget.com/reference/math/floor) (JavaScript, Dart, Python): Rounds a number down, to the given number of decimal places. Rounding goes toward negative infinity, so a negative value falls. - [mul](https://qsu.cdget.com/reference/math/mul) (JavaScript, Dart, Python): Returns after multiplying all n arguments of numbers or the values of a single array of numbers. - [numMax](https://qsu.cdget.com/reference/math/numMax) (JavaScript, Dart, Python): Returns the largest of the given numbers, accepting either n arguments or a single array. Non-numbers and `NaN` are skipped, and an empty input returns `null`. - [numMin](https://qsu.cdget.com/reference/math/numMin) (JavaScript, Dart, Python): Returns the smallest of the given numbers, accepting either n arguments or a single array. Non-numbers and `NaN` are skipped, and an empty input returns `null`. - [numRandom](https://qsu.cdget.com/reference/math/numRandom) (JavaScript, Dart, Python): Returns a randomly selected number between the min and max values. - [numRound](https://qsu.cdget.com/reference/math/numRound) (JavaScript, Dart, Python): Rounds a number to the given number of decimal places, with ties going away from zero in every language. A negative precision rounds to tens, hundreds and so on. - [numSum](https://qsu.cdget.com/reference/math/numSum) (JavaScript, Dart, Python): Returns after adding up all the n arguments of numbers or the values of a single array of numbers. - [numUniqueId](https://qsu.cdget.com/reference/math/numUniqueId) (JavaScript, Dart, Python): Returns a unique number based on the current timestamp. - [sub](https://qsu.cdget.com/reference/math/sub) (JavaScript, Dart, Python): Returns after subtracting all n arguments of numbers or the values of a single array of numbers. ## misc Function-level helpers that do not belong to another category. - [debounce](https://qsu.cdget.com/reference/misc/debounce) (JavaScript, Dart, Python): When the given function is executed repeatedly, the function is called if it has not been called again within the specified timeout. - [logBox](https://qsu.cdget.com/reference/misc/logBox) (JavaScript, Dart, Python): Prints the given values to the console as a bordered table, one row per argument, so that long or structured values stay readable. - [printFull](https://qsu.cdget.com/reference/misc/printFull) (Dart): Ensure that text is displayed in full without being truncated in Dart's `print`. - [retry](https://qsu.cdget.com/reference/misc/retry) (JavaScript, Dart, Python): Runs the given function and, if it fails, runs it again until it succeeds or the attempts run out, with `attempts`, `delay` and `backoff` options. - [sleep](https://qsu.cdget.com/reference/misc/sleep) (JavaScript, Dart, Python): Sleep function using Promise. - [throttle](https://qsu.cdget.com/reference/misc/throttle) (JavaScript, Dart, Python): Limits how often a function may run: however many times the returned wrapper is called, the function itself runs at most once per `wait` window. The counterpart of `debounce`. - [times](https://qsu.cdget.com/reference/misc/times) (JavaScript, Dart, Python): Repeat iteratee `count` times. After the return result of each function is stored in the array in order, the final array is returned. ## net Network requests and address parsing. In JavaScript `fetchData` requires a Node.js runtime and is imported from `qsu/node`, while `parseAddress` is browser-safe and imported from `qsu`. - [fetchData](https://qsu.cdget.com/reference/net/fetchData) (JavaScript, Dart, Python): This function is used to make `node:fetch` easier to use while ensuring data is returned regardless of the response status. - [parseAddress](https://qsu.cdget.com/reference/net/parseAddress) (JavaScript, Dart, Python): Parses an address string into its parts and returns them as an object. It handles ordinary web URLs as well as host-only addresses, IPv4, IPv6 (bare or wrapped in `[]`), and SSH-style connection strings that carry user information such as `ssh://user:pass@host:port`. ## object Object traversal, merging, flattening and conversion. - [objClone](https://qsu.cdget.com/reference/object/objClone) (JavaScript, Dart, Python): Copies an object, deeply by default and top level only with `deep: false`. Cycles are rebuilt with the same shape, and values that cannot be rebuilt are handed back as they are. - [objFindInTree](https://qsu.cdget.com/reference/object/objFindInTree) (JavaScript, Dart, Python): Returns the object if the key of a specific piece of data in the object's dataset corresponds to a specific value. This function returns only one result, so it is used to search for unique IDs, including all of their children. - [objFlatten](https://qsu.cdget.com/reference/object/objFlatten) (JavaScript, Dart, Python): Merges objects from the given object to the top level of the child items and displays the key names in steps, using a delimiter (`.` by default) instead of the existing keys. - [objGet](https://qsu.cdget.com/reference/object/objGet) (JavaScript, Dart, Python): Reads a nested value out of an object by dot and/or bracket path, returning a `fallback` when the path is not there. A stored `null` counts as a value, not a missing path. - [objInvert](https://qsu.cdget.com/reference/object/objInvert) (JavaScript, Dart, Python): Returns a new object with the keys and values swapped. Values are converted to text because keys are always strings, and the later entry wins when two share a value. - [objMapKeys](https://qsu.cdget.com/reference/object/objMapKeys) (JavaScript, Dart, Python): Returns a new object whose keys are the values returned by the callback. The callback receives `(value, key)` and the values are carried over untouched. - [objMerge](https://qsu.cdget.com/reference/object/objMerge) (JavaScript, Dart, Python): Merges any number of objects into one new object, going down through nested objects, with the later source winning. Arrays are replaced whole rather than merged index by index as Lodash does. - [objMergeWithArrays](https://qsu.cdget.com/reference/object/objMergeWithArrays) (JavaScript, Dart, Python): Merge two object data into one object. The key to this method is to compare the two objects and add the newly added key data, if any. - [objOmit](https://qsu.cdget.com/reference/object/objOmit) (JavaScript, Dart, Python): Returns a new object without the listed keys, accepting a single key or an array of keys. The opposite of `objPick`; only the top level is inspected. - [objOmitByValue](https://qsu.cdget.com/reference/object/objOmitByValue) (JavaScript, Dart, Python): Deletes keys equal to the given value from the object data. If the `recursive` option is `true`, also deletes all keys corresponding to the same value in the child items. - [objPick](https://qsu.cdget.com/reference/object/objPick) (JavaScript, Dart, Python): Returns a new object containing only the listed keys, accepting a single key or an array of keys. Only the top level is inspected and a missing key is skipped. - [objPickBy](https://qsu.cdget.com/reference/object/objPickBy) (JavaScript, Dart, Python): Returns a new object containing only the entries for which the callback returns `true`. The callback receives `(value, key)` and only the top level is inspected. - [objSet](https://qsu.cdget.com/reference/object/objSet) (JavaScript, Dart, Python): Returns a copy of an object with a value written at a dot and/or bracket path, creating missing levels as objects. The source is not modified. - [objToEntries](https://qsu.cdget.com/reference/object/objToEntries) (JavaScript, Dart, Python): Converts the given object to array format. The resulting array is a two-dimensional array with one key value stored as follows: `[key, value]`. - [objToPrettyJson](https://qsu.cdget.com/reference/object/objToPrettyJson) (JavaScript, Dart, Python): Recursively output all the steps of the JSON object (`JSON.stringify`) and then output the JSON object with newlines and tab characters to make it easier to read in a `console` function, for example. - [objToQueryString](https://qsu.cdget.com/reference/object/objToQueryString) (JavaScript, Dart, Python): Converts the given object data to a URL query string. - [objUpdate](https://qsu.cdget.com/reference/object/objUpdate) (JavaScript, Dart, Python): Changes the value matching a specific key name in the given object. If the `recursive` option is `true`, it will also search in child object items. ## os Information about the machine the process runs on. In JavaScript these functions require a Node.js runtime and are imported from `qsu/node`. In Dart they work on Windows, macOS, Linux, Android and iOS, and throw an `UnsupportedError` on the web; each page states per platform what the function can and cannot answer there. - [getArch](https://qsu.cdget.com/reference/os/getArch) (JavaScript, Dart, Python): Returns the processor architecture the running program was built for, such as `x64` or `arm64`. A name the system spells its own way, such as `aarch64` or `AMD64`, is translated so both packages report the same value. - [getBootTime](https://qsu.cdget.com/reference/os/getBootTime) (JavaScript, Dart, Python): Returns the moment the machine last booted, as the current time less the system uptime. - [getComputerName](https://qsu.cdget.com/reference/os/getComputerName) (JavaScript, Dart, Python): Retrieves the host name of the current device. This is usually the name of the system that was automatically set on the desktop or changed by the user. - [getCpuCount](https://qsu.cdget.com/reference/os/getCpuCount) (JavaScript, Dart, Python): Returns the number of processor cores this process may use, which a CPU affinity mask can narrow below the number the machine has. - [getCpuModel](https://qsu.cdget.com/reference/os/getCpuModel) (JavaScript, Dart, Python): This function returns the name of the CPU currently used by the system. Depending on the OS, the name may be incorrect or may not be retrievable. - [getCpuSpeed](https://qsu.cdget.com/reference/os/getCpuSpeed) (JavaScript, Dart, Python): Returns the rated clock speed of the first processor core in megahertz. Apple Silicon reports a placeholder of 2400 because Apple does not publish the real figure, and a machine with no cpufreq driver reports 0. - [getCpuUsage](https://qsu.cdget.com/reference/os/getCpuUsage) (JavaScript, Dart, Python): Returns the share of processor time spent working rather than idle, sampled over an interval given in milliseconds. - [getDiskSize](https://qsu.cdget.com/reference/os/getDiskSize) (JavaScript, Dart, Python): Returns the total size of the filesystem holding the given path, as readable text with its unit. Defaults to the current working directory. - [getDiskUsage](https://qsu.cdget.com/reference/os/getDiskUsage) (JavaScript, Dart, Python): Returns the share of the filesystem holding the given path that is in use, as a percentage between 0 and 100. - [getEndianness](https://qsu.cdget.com/reference/os/getEndianness) (JavaScript, Dart, Python): Returns the byte order of the processor: `LE` for little-endian and `BE` for big-endian. - [getFonts](https://qsu.cdget.com/reference/os/getFonts) (JavaScript, Dart, Python): Returns the fonts installed on the machine, one entry per face, sorted by family. Each entry carries the names the font gives itself, its weight, width and slant, whether it is monospace, and the file it was read from. - [getFreeDiskSize](https://qsu.cdget.com/reference/os/getFreeDiskSize) (JavaScript, Dart, Python): Returns the space still writable on the filesystem holding the given path. On Linux and macOS the blocks reserved for the superuser are not counted. - [getFreeRamSize](https://qsu.cdget.com/reference/os/getFreeRamSize) (JavaScript, Dart, Python): Returns the physical memory still available, as readable text with its unit. What counts as available differs between Windows, macOS and Linux, and the page sets out how. - [getHomeDir](https://qsu.cdget.com/reference/os/getHomeDir) (JavaScript, Dart, Python): Returns the current user's home directory, taken from the environment first and from the account record otherwise. - [getKernelVersion](https://qsu.cdget.com/reference/os/getKernelVersion) (JavaScript, Dart, Python): Returns the version of the operating system kernel, which is not the version a user would name: macOS 26 reports the Darwin version `25.6.0`. - [getLocalIp](https://qsu.cdget.com/reference/os/getLocalIp) (JavaScript, Dart, Python): Returns the IPv4 address this machine is reachable at behind its default route. No packet is sent to find it. - [getMacAddress](https://qsu.cdget.com/reference/os/getMacAddress) (JavaScript): Returns the hardware address of the first network interface that is not loopback. Not available in Dart or Python, whose standard libraries reach for a different interface than the JavaScript runtime does. - [getMachineId](https://qsu.cdget.com/reference/os/getMachineId) (JavaScript, Dart, Python): Gets the unique UUID of the current device. Throws an error if the value is not retrieved. Returns a `Promise` object, so use `await` or `.then()` to wait for the operation to complete and get the correct value. - [getOsName](https://qsu.cdget.com/reference/os/getOsName) (JavaScript, Dart, Python): Returns the name of the operating system as a person would say it, such as `macOS 26.6.2`, `Windows 11` or `Ubuntu 24.04.2 LTS`. - [getPlatform](https://qsu.cdget.com/reference/os/getPlatform) (JavaScript, Dart, Python): Returns the operating system the process is running on, as one of `windows`, `macos`, `linux` and `freebsd`. Anything else is `unknown`. - [getProcessRamSize](https://qsu.cdget.com/reference/os/getProcessRamSize) (JavaScript, Dart, Python): Returns the physical memory this process currently occupies, as readable text with its unit. - [getProcessUptime](https://qsu.cdget.com/reference/os/getProcessUptime) (JavaScript, Dart, Python): Returns the number of seconds the current process has been running. `floor` drops the fraction and `format` groups the digits in thousands. - [getRamSize](https://qsu.cdget.com/reference/os/getRamSize) (JavaScript, Dart, Python): Retrieves the total RAM size of the current device. Returns it as readable text including the unit. Decimal places are rounded up. - [getRamUsage](https://qsu.cdget.com/reference/os/getRamUsage) (JavaScript, Dart, Python): Returns the share of physical memory in use, as a percentage between 0 and 100, with the number of decimal places to keep as its argument. - [getShell](https://qsu.cdget.com/reference/os/getShell) (JavaScript, Dart, Python): Returns the path to the shell recorded for the current account, which is the one a login starts rather than the one the caller is typing into. Windows reports the command interpreter instead. - [getSid](https://qsu.cdget.com/reference/os/getSid) (JavaScript, Dart, Python): Gets the Security Identifier (SID) value for the current user on the device. Throws an error if the value is not obtained. - [getSystemUptime](https://qsu.cdget.com/reference/os/getSystemUptime) (JavaScript, Dart, Python): Returns the number of seconds the machine has been running since it last booted, with the same `floor` and `format` options `getProcessUptime` takes. - [getTempDir](https://qsu.cdget.com/reference/os/getTempDir) (JavaScript, Dart, Python): Returns the directory the system puts temporary files in, without a trailing separator. On macOS this is a per-session folder rather than `/tmp`. - [getTimezone](https://qsu.cdget.com/reference/os/getTimezone) (JavaScript): Returns the IANA name of the system time zone, such as `Asia/Seoul`. Not available in Dart or Python, whose standard libraries have no way to resolve the name. - [getUsedRamSize](https://qsu.cdget.com/reference/os/getUsedRamSize) (JavaScript, Dart, Python): Returns the physical memory in use, as readable text with its unit. - [getUsername](https://qsu.cdget.com/reference/os/getUsername) (JavaScript, Dart, Python): Returns the name the system has on record for the account the process runs as, or `Unknown` when the account cannot be named. - [runCommand](https://qsu.cdget.com/reference/os/runCommand) (JavaScript, Dart, Python): It returns the result that is output after entering and executing the command prompt command. ## string String transformation, capitalization, trimming and truncation. - [capitalizeEachSentence](https://qsu.cdget.com/reference/string/capitalizeEachSentence) (JavaScript, Dart, Python): Capitalize the first letter of every sentence. Typically, the `.` characters to separate sentences, but this can be customized via the value of the `separator` argument. - [capitalizeEachWord](https://qsu.cdget.com/reference/string/capitalizeEachWord) (JavaScript, Dart, Python): Converts every word with spaces to uppercase. If the naturally argument is true, only some special cases (such as prepositions) are kept lowercase. - [capitalizeFirst](https://qsu.cdget.com/reference/string/capitalizeFirst) (JavaScript, Dart, Python): Converts the first letter of the entire string to uppercase and returns. - [collapseWhitespace](https://qsu.cdget.com/reference/string/collapseWhitespace) (JavaScript, Dart, Python): Removes all whitespace before and after a string. Unlike JavaScript's `trim` function, it converts two or more spaces between sentences into a single space. - [deburr](https://qsu.cdget.com/reference/string/deburr) (JavaScript, Dart, Python): Replaces accented Latin letters with their unaccented equivalents, so `déjà vu` becomes `deja vu`. Covers the Latin-1 Supplement and Latin Extended-A blocks plus combining marks. - [detectLanguages](https://qsu.cdget.com/reference/string/detectLanguages) (JavaScript, Dart, Python): Detects the languages a string is written in and returns them from the most used to the least, each with its share of the letters. A language is named by its ISO 639-1 code, such as `en`, `ko` or `ja`. - [escapeRegExp](https://qsu.cdget.com/reference/string/escapeRegExp) (JavaScript, Dart, Python): Escapes every regular expression metacharacter in the given string, so the value can be dropped into a pattern and matched literally. - [getPlaceholderKeys](https://qsu.cdget.com/reference/string/getPlaceholderKeys) (JavaScript, Dart, Python): Returns a text key enclosed between the start and end characters in the given string. This can be useful for identifying template string keys in strings that follow i18n syntax. - [joinUrl](https://qsu.cdget.com/reference/string/joinUrl) (JavaScript, Dart, Python): Merges the given string argument with the first argument (the beginning of the URL), joining it so that the slash (`/`) symbol is correctly included. - [pad](https://qsu.cdget.com/reference/string/pad) (JavaScript, Dart, Python): Pads a string until it reaches the given length. One `position` option covers `start`, `end` and `both`, replacing Lodash's `pad`, `padStart` and `padEnd`. - [removeNewlines](https://qsu.cdget.com/reference/string/removeNewlines) (JavaScript, Dart, Python): Removes `\n`, `\r` characters or replaces them with specified characters. - [removeSpecialChars](https://qsu.cdget.com/reference/string/removeSpecialChars) (JavaScript, Dart, Python): Returns after removing all special characters, including spaces. If you want to allow any special characters as exceptions, list them in the second argument value without delimiters. - [replaceEnclosed](https://qsu.cdget.com/reference/string/replaceEnclosed) (JavaScript, Dart, Python): Replaces text within a range starting and ending with a specific character in a given string with another string. For example, given the string `abcghi`, to change `` to `def`, use `replaceEnclosed('abcghi', '<', '>', 'def')`. - [split](https://qsu.cdget.com/reference/string/split) (JavaScript, Dart, Python): Splits a string based on the specified character and returns it as an Array. Unlike the existing split, it splits the values provided as multiple parameters (array or multiple arguments) at once. - [strByteLength](https://qsu.cdget.com/reference/string/strByteLength) (JavaScript, Dart, Python): Returns the number of bytes in the given string. - [strCount](https://qsu.cdget.com/reference/string/strCount) (JavaScript, Dart, Python): Returns the number of times the second String argument is contained in the first String argument. - [strMaskRandom](https://qsu.cdget.com/reference/string/strMaskRandom) (JavaScript, Dart, Python): Replace strings at random locations with a specified number of characters (default 1) with characters (default \*). - [strRandom](https://qsu.cdget.com/reference/string/strRandom) (JavaScript, Dart, Python): Returns a random String containing numbers or uppercase and lowercase letters of the given length. A non-positive `length` returns an empty string. - [strShuffle](https://qsu.cdget.com/reference/string/strShuffle) (JavaScript, Dart, Python): Randomly shuffles the received string and returns it. - [strToCamelCase](https://qsu.cdget.com/reference/string/strToCamelCase) (JavaScript, Dart, Python): Converts a string to `camelCase`: the first word is lowercased and every word after it gets an uppercase first letter, with all separators removed. - [strToCharCodes](https://qsu.cdget.com/reference/string/strToCharCodes) (JavaScript, Dart, Python): Converts the given string to ascii code and returns it as an array. - [strToConstantCase](https://qsu.cdget.com/reference/string/strToConstantCase) (JavaScript, Dart, Python): Converts a string to `CONSTANT_CASE`: every word is uppercased and joined with an underscore. Dart uses the simple Unicode case mapping, so `ß` stays `ß` there where JavaScript and Python give `SS`. - [strToKebabCase](https://qsu.cdget.com/reference/string/strToKebabCase) (JavaScript, Dart, Python): Converts a string to `kebab-case`: every word is lowercased and joined with a hyphen. For a URL slug use `getSlug` instead. - [strToPascalCase](https://qsu.cdget.com/reference/string/strToPascalCase) (JavaScript, Dart, Python): Converts a string to `PascalCase`: every word gets an uppercase first letter and a lowercase rest, with all separators removed. - [strToSnakeCase](https://qsu.cdget.com/reference/string/strToSnakeCase) (JavaScript, Dart, Python): Converts a string to `snake_case`: every word is lowercased and joined with an underscore. - [strUnique](https://qsu.cdget.com/reference/string/strUnique) (JavaScript, Dart, Python): Remove duplicate characters from a given string and output only one. - [truncate](https://qsu.cdget.com/reference/string/truncate) (JavaScript, Dart, Python): Truncates a long string to a specified length, optionally appending an ellipsis after the string. - [truncateSentence](https://qsu.cdget.com/reference/string/truncateSentence) (JavaScript, Dart, Python): The string ignores truncation until the ending character (`sentenceEnds`). If the expected length is reached, return the truncated string until after the ending character. Several ending characters may be given as an array, and the default covers the full stop as each script writes it (`.`, `。`, `.`, `。`). - [uncapitalizeFirst](https://qsu.cdget.com/reference/string/uncapitalizeFirst) (JavaScript, Dart, Python): Converts the first letter of the entire string to lowercase and returns. The inverse of `capitalizeFirst`. - [words](https://qsu.cdget.com/reference/string/words) (JavaScript, Dart, Python): Splits a string into the words it is made of and returns them as an array. Anything that is neither a letter nor a digit separates words, and camelCase boundaries, runs of capitals and runs of digits are split as well. ## verify Type, equality, range and format validation. - [between](https://qsu.cdget.com/reference/verify/between) (JavaScript, Dart, Python): Returns `true` if the first argument is in the range of the second argument (`[min, max]`). To allow the minimum and maximum values to be in the range, pass `true` for the third argument. - [contains](https://qsu.cdget.com/reference/verify/contains) (JavaScript, Dart, Python): Returns `true` if the first string argument contains the second argument "string" or "one or more of the strings listed in the array". - [hasBadWords](https://qsu.cdget.com/reference/verify/hasBadWords) (JavaScript, Dart, Python): Returns `true` when the given text contains one of the banned words. The word list comes entirely from the caller; this function does not ship one. - [isEmail](https://qsu.cdget.com/reference/verify/isEmail) (JavaScript, Dart, Python): Checks if the given argument value is a valid email. - [isEmpty](https://qsu.cdget.com/reference/verify/isEmpty) (JavaScript, Dart, Python): Returns true if the passed data is empty or has a length of 0. - [isEqualDeep](https://qsu.cdget.com/reference/verify/isEqualDeep) (JavaScript, Dart, Python): Compares two values by their contents: arrays item by item, objects key by key in any order, dates by the moment. No type coercion, and `NaN` equals `NaN`. - [isEqualLoose](https://qsu.cdget.com/reference/verify/isEqualLoose) (JavaScript, Dart, Python): It compares the first argument value as the left operand and the argument values given thereafter as the right operand, and returns `true` if the values are all the same. - [isEqualStrict](https://qsu.cdget.com/reference/verify/isEqualStrict) (JavaScript, Dart, Python): It compares the first argument value as the left operand and the argument values given thereafter as the right operand, and returns `true` if the values are all the same. - [isNestedArray](https://qsu.cdget.com/reference/verify/isNestedArray) (JavaScript, Dart, Python): Returns `true` if the given array is a two-dimensional array. - [isPlainObject](https://qsu.cdget.com/reference/verify/isPlainObject) (JavaScript, Dart, Python): Check whether the given data is of type `Object`. Returns `false` for other data types including `Array`. - [isTrueAtLeast](https://qsu.cdget.com/reference/verify/isTrueAtLeast) (JavaScript, Dart, Python): Returns `true` if the values given in the `conditions` array are true at least `count` times. - [isUrl](https://qsu.cdget.com/reference/verify/isUrl) (JavaScript, Dart, Python): Returns `true` if the given data is in the correct URL format. If allowMissingProtocol is `true`, it is automatically appended to the URL when the protocol does not exist. - [len](https://qsu.cdget.com/reference/verify/len) (JavaScript, Dart, Python): Returns the length of any type of data. If the argument value is `null` or `undefined`, `0` is returned. ## web URLs, slugs, user agents and other web-oriented helpers. - [escapeHtml](https://qsu.cdget.com/reference/web/escapeHtml) (JavaScript, Dart, Python): Escapes the five characters that carry meaning in HTML (`&`, `<`, `>`, `"`, `'`), so a value can be dropped into a page as text rather than read as markup. - [generateLicense](https://qsu.cdget.com/reference/web/generateLicense) (JavaScript, Dart, Python): Returns the text of a software license (MIT, ISC, BSD 2- and 3-clause, Apache 2.0, MPL 2.0, GPL, LGPL or AGPL 3.0) with the copyright line filled in from the author and the years you give. - [getSlug](https://qsu.cdget.com/reference/web/getSlug) (JavaScript, Dart, Python): Converts a string into a URL-friendly slug. The input is trimmed, split into words on whitespace and any existing `-`/`_` characters, and joined back together with the chosen separator. - [isAiAgentBot](https://qsu.cdget.com/reference/web/isAiAgentBot) (JavaScript, Dart, Python): Returns `true` if a string names a fetcher that visits a page only because a person asked an AI assistant or agent to, such as ChatGPT-User, Claude-User and Perplexity-User. - [isAiSearchBot](https://qsu.cdget.com/reference/web/isAiSearchBot) (JavaScript, Dart, Python): Returns `true` if a string names a crawler that indexes pages so an AI product can cite them in its answers, and whose operator says the pages are not used for training, such as OAI-SearchBot, Claude-SearchBot and PerplexityBot. - [isAiTrainingBot](https://qsu.cdget.com/reference/web/isAiTrainingBot) (JavaScript, Dart, Python): Returns `true` if a string names a crawler that collects pages to train AI models, or to build datasets for that, such as GPTBot, ClaudeBot, CCBot and Bytespider, or a robots.txt token such as Google-Extended. - [isBot](https://qsu.cdget.com/reference/web/isBot) (JavaScript, Dart, Python): Returns `true` if a string is, or comes from, an automated client: a search engine crawler, an AI crawler or agent, an SEO tool, a link preview fetcher, an uptime monitor, an HTTP library and the like. Takes a whole `User-Agent` header or just a bot name. - [isDesktopDeviceFromUa](https://qsu.cdget.com/reference/web/isDesktopDeviceFromUa) (JavaScript, Dart, Python): Reads a User-Agent string and returns `true` if it comes from a desktop or laptop computer running Windows, macOS, Linux, ChromeOS or a BSD. - [isMobileDeviceFromUa](https://qsu.cdget.com/reference/web/isMobileDeviceFromUa) (JavaScript, Dart, Python): Reads a User-Agent string and returns `true` if it comes from a phone. A tablet is not a phone, so an iPad or an Android tablet returns `false`. - [isPathnameMatch](https://qsu.cdget.com/reference/web/isPathnameMatch) (JavaScript, Dart, Python): You can check if the URL path in the first argument value is matched against the second set of rules. The matching rules can take a string or an array of strings, where both arguments are paths that start with `/`. - [isSearchBot](https://qsu.cdget.com/reference/web/isSearchBot) (JavaScript, Dart, Python): Returns `true` if a string names a crawler that indexes pages for a search engine, such as Googlebot, Bingbot, YandexBot, Baiduspider, Naver's Yeti or Daum's crawler. - [isTabletDeviceFromUa](https://qsu.cdget.com/reference/web/isTabletDeviceFromUa) (JavaScript, Dart, Python): Reads a User-Agent string and returns `true` if it comes from a tablet: an iPad, an Android tablet, a Kindle or Fire tablet, or a BlackBerry PlayBook. - [removeLocalePrefix](https://qsu.cdget.com/reference/web/removeLocalePrefix) (JavaScript, Dart, Python): Removes the first-level path from a URL or pathname. Use this when you need a locale-free path in special cases in a URL that normally uses locale prefixes. - [unescapeHtml](https://qsu.cdget.com/reference/web/unescapeHtml) (JavaScript, Dart, Python): Turns the five HTML entities that `escapeHtml` produces back into the characters they stand for, in a single pass so `&lt;` comes back as the literal text `<`. ## Discover More How qsu compares with other utility libraries, and how to move a project from one of them. These pages are prose rather than function reference. - [Discover More](https://qsu.cdget.com/discover-more): Index of the comparison and the migration guides. - [Comparison](https://qsu.cdget.com/discover-more/comparison): qsu next to Lodash, Underscore.js, quiver, basic_utils, pydash and boltons. Carries a feature sheet of around 90 capabilities marked supported, partial or unsupported per library, then covers API shape, runtime and packaging, and when another library is the better answer. - [Migration](https://qsu.cdget.com/discover-more/migration): Index of the migration guides, grouped by language. - [Migrating from Lodash](https://qsu.cdget.com/discover-more/migration/lodash) (JavaScript): Lodash functions mapped to their qsu counterparts, the pairs that behave differently, and what has no counterpart. - [Migrating from Underscore.js](https://qsu.cdget.com/discover-more/migration/underscore) (JavaScript): The same for Underscore.js, whose overlap with qsu is smaller. - [Migrating from quiver](https://qsu.cdget.com/discover-more/migration/quiver) (Dart): What moves from quiver to qsu, and what quiver keeps doing that qsu has no answer for. - [Migrating from basic_utils](https://qsu.cdget.com/discover-more/migration/basic-utils) (Dart): basic_utils classes mapped to qsu functions, including the certificate half that does not move. - [Migrating from pydash](https://qsu.cdget.com/discover-more/migration/pydash) (Python): pydash functions mapped to their qsu counterparts, and the naming differences that come with them. - [Migrating from boltons](https://qsu.cdget.com/discover-more/migration/boltons) (Python): What moves from boltons to qsu, and where boltons remains the better tool. ## Optional - [Changelog](https://qsu.cdget.com/changelog/): Release history of each package, per language. - [Source repository](https://github.com/jooy2/qsu): Monorepo containing all three packages and this documentation. - [npm package](https://npmjs.com/package/qsu): JavaScript/Node.js distribution. - [pub.dev package](https://pub.dev/packages/qsu): Dart/Flutter distribution. - [PyPI package](https://pypi.org/project/qsu): Python distribution.