Global Utility Functions
Last updated
Last updated
Global functions are the unsung heroes that transcend the boundaries of specific data types, providing a universal toolkit for developers. These functions, residing in the global scope, are the go-to tools when you need versatile and expressive solutions that operate seamlessly across various data structures.
: The maestro orchestrating the symphony of functions, runIt calls a specified function block and presents its harmonious result.
: The chameleon of functions, withIt transforms any object into the star of the show, letting it shine in a function block tailored just for them.
listOf() and setOf(): Assemble an immutable collection of elements effortlessly with listOf or setOf. It's your go-to for creating collections in a concise and readable manner.
mutableListOf() or mutableSetOf(): When you need a dynamic collection that can evolve with your needs, turn to mutableListOf or mutableSetOf to create mutable collection with ease.
: Embrace the power of optionals with optionalOf, a function that lets you gracefully handle scenarios with potentially absent values.
: Time is of the essence, and durationOf allows you to craft time durations with precision, making time manipulation a breeze.
: Transform your data with reducerOf, a function designed for building reducers that streamline complex state transformations in a functional paradigm.
: Define ranges effortlessly with rangeTo, a function simplifying the creation of numeric ranges for iteration or data selection.
: Indicate success with confidence using ok. This function constructs an "ok" result, signalling that a task or operation was completed successfully.
: Handle errors gracefully with error. This function constructs an error result, encapsulating details about the failure and allowing for structured error handling.
These are just a smell of the utility this library brings to the table. Please, check the complete list in the section.