Katxupa
  • 👋Welcome to Katxupa Extension Library
  • Why Katxupa?
    • 🍻What makes Katxupa special?
    • ✨Key Features
  • Get a taste of Katxupa
    • 🍲Installation
    • 🍜Usage
      • 🍻Scope Functions
        • Function Selection
        • Distinctions
        • Functions
          • letIt
          • withIt
          • runIt
          • applyIt
          • alsoIt
          • takeIf and takeUnless
      • 😎Null Safety
        • TypeScript Null-Safety
        • Optional Chaining for JavaScript
      • ⏰Duration
      • ➖Reducer
      • 📏Range
      • 🏃‍♂️Result
      • 🤼Either
      • 🟰Compare
      • ⚔️Global Utility Functions
    • 🤌Dip Dive
      • Optional
      • Range
      • Duration
      • Reducer
      • Collections
        • Array
        • Set
  • 🙏Support
    • Source Code
    • ESLint Config
    • TypeScript Docs
    • Manuel Santos Linkedin
Powered by GitBook
On this page
  1. Get a taste of Katxupa
  2. Usage

Global Utility Functions

PreviousCompareNextDip Dive

Last updated 1 year ago

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.

Meet some Ingredients

  • : 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.

🍜
⚔️
runIt()
withIt()
ok()
error()
Global Functions
durationOf()
rangeTo()
reducerOf()
optionalOf()