Tweakr
    Preparing search index...

    Tweakr

    Tweakr v1.2 – Latest Release 🚀 Release Date: 2025-10-08

    A modern, lightweight utility library for JavaScript/TypeScript. Provides functional, async, array, number, object, browser, and string helpers, fully typed, tree-shakable, and thoroughly tested.

    npm install tweakr
    
    yarn add tweakr
    
    pnpm add tweakr
    
    import { flatten, unique } from 'tweakr';

    console.log(flatten([1,[2,3]])); // [1,2,3]
    console.log(unique([1,2,2,3])); // [1,2,3]
    const { flatten, debounce } = require('tweakr');
    console.log(flatten([1,[2,3]])); // [1,2,3]
    <script src="https://cdn.jsdelivr.net/npm/tweakr/dist/tweakr.min.js"></script>
    <script>
    console.log(Tweakr.flatten([1,[2,3]]));
    </script>

    v1.2.0 – 2025-10-08

    • Added 50 new functions across Array, Object, String, Number, and Function/Misc utilities
      • Array: union, unionBy, intersectionBy, differenceBy, compactBy, zip, zipWith, unzip, flattenDepth, chunkWhile, removeIndex, take, takeRight, dropWhile, takeWhile
      • Object: pickBy, omitBy, mapKeysDeep, mapValuesDeep, invertBy, has, unset, mergeAll, assignDeep, pickDeep, omitDeep, getOrDefault
      • String: removeNumbers, truncateWords, replaceVowels, reverseWordsAdvanced, snakeToCamel, camelToKebab
      • Number: randomInt, randomFloat, clampBigInt, factorialBigInt, isEvenBigInt
      • Function / Misc: tap, wrapDeep, afterAsync, beforeAsync, curryN, composeN, pipeN, memoizeN, onceNAsync, noopAsync, identityAsync, retryAsync
    • Improvements to existing v1.1 functions for performance, type safety, and edge cases (flattenDeep, unique, groupBy, debounceAsync, queue, parallelLimit, waitFor, memoizeAsync, tryCatch, curry, partial, once, after, before, fibonacci, factorial, deepEqual, scrollToTop, scrollToBottom, focusElement, clipboard & cookie helpers, string utilities, deepFreeze, isEmpty, identityAsync, noopAsync)

    v1.1.0 – 2025-10-06

    • Added groupBy to Array utilities
    • Added new string helpers: replaceAll, startsWith, endsWith, padLeft, padRight
    • Optimized flattenDeep for large arrays

    v1.0.0 – 2025-10-06

    • Initial release with 153 functions across array, async, function, number, object, browser, and string modules

    chunk, compact, concat, difference, differenceBy, drop, dropRight, fill, flatten, flattenDeep, flattenDepth, head, initial, intersection, intersectionBy, join, shuffle, unique, union, unionBy, zip, zipWith, unzip, chunkWhile, removeIndex, take, takeRight, dropWhile, takeWhile, groupBy

    debounceAsync, filterAsync, mapAsync, memoizeAsync, onceAsync, parallelLimit, queue, raceAll, reduceAsync, retry, retryBackoff, retryUntil, series, sleep, throttleAsync, timeout, waitFor, waterfall, withCancel, withTimeout, asyncCompose, asyncPipe

    after, before, compose, curry, debounce, defer, delay, memoize, noop, once, partial, pipe, promisify, rateLimit, throttle, times, tryCatch, unary, wrap, yieldToNext, tap, wrapDeep, afterAsync, beforeAsync, curryN, composeN, pipeN, memoizeN, onceNAsync, noopAsync, identityAsync, retryAsync

    camelCase, capitalize, containsIgnoreCase, endsWithIgnoreCase, escapeHtml, interpolate, isPalindrome, padLeft, padRight, pluralize, randomString, repeat, reverseString, reverseWordsAdvanced, singularize, startsWithIgnoreCase, stripAccents, stripHtml, stripWhitespace, slugify, titleCase, truncate, unescapeHtml, wordCount, endsWith, honorific, includes, removePrefix, removeSuffix, replaceAll, startsWith, trimAll, collapseWhitespace, ordinalSuffix, removeNumbers, truncateWords, replaceVowels, snakeToCamel, camelToKebab

    clamp, decimalPlaces, factorial, fibonacci, isEven, isFiniteNumber, isInteger, isNegative, isOdd, isPositive, isPrime, lerp, max, min, random, round, sum, toDegrees, toFixedNumber, toPercentage, toRadians, randomInt, randomFloat, clampBigInt, factorialBigInt, isEvenBigInt

    cloneDeep, deepEqual, deepMerge, entries, filterKeys, filterValues, get, invert, keys, mapValues, mapValuesDeep, mapKeysDeep, merge, mergeAll, omit, omitBy, omitDeep, pick, pickBy, pickDeep, set, unset, values, assignDeep, getOrDefault, has, invertBy

    copyToClipboard, deleteCookie, downloadFile, focusElement, getCookie, getDeviceType, getQueryParam, getScrollPosition, getThemePreference, getUserLanguage, isInViewport, isOnline, onVisibilityChange, readFromClipboard, removeQueryParam, scrollToBottom, scrollToTop, setCookie, setFavicon, setQueryParam

    debouncePromise, deepFreeze, identity, isEmpty, noopAsync, pipeAsync, uniqueId

    Methods

    Interfaces

    CookieOptions
    RetryBackoffOptions
    WaitForOptions

    Functions

    resetUniqueId

    Array

    chunk
    chunkWhile
    compact
    compactBy
    concat
    difference
    differenceBy
    drop
    dropRight
    dropWhile
    fill
    flatten
    flattenDeep
    flattenDepth
    groupBy
    initial
    intersection
    intersectionBy
    join
    last
    pull
    pullAll
    removeIndex
    reverse
    slice
    take
    takeRight
    takeWhile
    union
    unionBy
    uniq
    uniqBy
    unzip
    zip
    zipWith

    Async

    AsyncFn
    asyncCompose
    debounceAsync
    filterAsync
    mapAsync
    memoizeAsync
    onceAsync
    parallelLimit
    queue
    raceAll
    reduceAsync
    retry
    retryBackoff
    retryUntil
    series
    sleep
    throttleAsync
    timeout
    waitFor
    waterfall
    withCancel
    withTimeout

    Browser

    copyToClipboard
    deleteCookie
    downloadFile
    focusElement
    getCookie
    getDeviceType
    getQueryParam
    getScrollPosition
    getThemePreference
    getUserLanguage
    isInViewport
    isOnline
    onVisibilityChange
    readFromClipboard
    removeQueryParam
    scrollToBottom
    scrollToTop
    setCookie
    setFavicon
    setQueryParam

    Function

    after
    afterAsync
    before
    beforeAsync
    compose
    composeN
    curry
    curryN
    debounce
    defer
    delay
    identityAsync
    memoize
    memoizeN
    noop
    once
    onceNAsync
    partial
    pipe
    pipeN
    promisify
    rateLimit
    retryAsync
    tap
    throttle
    times
    tryCatch
    unary
    wrap
    wrapDeep
    yieldToNext

    Number

    clamp
    clampBigInt
    decimalPlaces
    factorial
    factorialBigInt
    fibonacci
    isEven
    isEvenBigInt
    isFiniteNumber
    isInteger
    isNegative
    isOdd
    isPositive
    isPrime
    lerp
    max
    min
    random
    randomFloat
    randomInt
    round
    sum
    toDegrees
    toFixedNumber
    toPercentage
    toRadians

    Object

    assignDeep
    cloneDeep
    deepEqual
    deepMerge
    entries
    filterKeys
    filterValues
    get
    getOrDefault
    has
    invert
    invertBy
    keys
    mapKeysDeep
    mapValues
    mapValuesDeep
    merge
    mergeAll
    omit
    omitBy
    omitDeep
    pick
    pickBy
    pickDeep
    set
    unset
    values

    String

    camelCase
    camelToKebab
    capitalize
    collapseWhitespace
    containsIgnoreCase
    endsWith
    endsWithIgnoreCase
    escapeHtml
    getHonorificSuffix
    includes
    interpolate
    isPalindrome
    ordinalSuffix
    padLeft
    padRight
    pluralize
    randomString
    removeHonorificSuffix
    removeNumbers
    removePrefix
    removeSuffix
    repeat
    replaceAll
    replaceVowels
    reverseString
    reverseWordsAdvanced
    singularize
    slugify
    snakeToCamel
    startsWith
    startsWithIgnoreCase
    stripAccents
    stripHtml
    stripWhitespace
    titleCase
    trimAll
    truncate
    truncateWords
    unescapeHtml
    wordCount

    Util

    debouncePromise
    deepFreeze
    identity
    isEmpty
    noopAsync
    pipeAsync
    uniqueId