Functions

1. Arrays

  • chunk

    : Chunks an array into smaller arrays of a specified size.

  • compact

    : Removes falsy values from an array, If strict is true, also removes empty objects and arrays.

  • insert

    : Inserts elements into an array at a specified index.

  • partition

    : Partitions an array into two arrays based on a given callback ie predicate.

  • remove

    : Removes elements from an array at a specified index.

  • rotate

    : Rotates the elements of an array by a given number of positions.

  • sampleArr

    : Generates an array of random numbers.

  • search

    : Search objects in an array based on provided keys and query string. It only works with string and number values.

  • shuffleArr

    : Shuffles the elements of an array.

  • unique

    : Creates a unique array from the input array.

  • zip

    : Zips arrays together in the form of an array of arrays.

2. Functional

  • callAfter

    : Returns a new function that can be called only after calling a specific number of times.

  • callBefore

    : Returns a new function that can be called only for specific number of times.

  • count

    : returns the result of a function and the number of times that function is invoked.

  • debounce

    : Return a debounced function that delays invoking the passed function until after `given` milliseconds have elapsed since the last time the debounced function was invoked.

  • nTimes

    : Calls a function n times and returns an array of the results.

  • once

    : Returns a new function that can be called only once.

  • retry

    : Retries the given function a specified number of times with a delay between each retry.

  • sleep

    : Sleeps the execution for the specified number of milliseconds.

  • throttle

    : Return a throttled function that invokes the passed function at most once per every `given` milliseconds.

  • timeout

    : The timeout function wraps a function with a timeout. If the function does not complete within the specified time, the promise will be rejected.

3. Gates

  • and

    : Performs a logical AND operation on the given arguments.

  • nand

    : Performs a logical NAND operation on the given arguments.

  • nor

    : Performs a logical NOR operation on the given arguments.

  • or

    : Performs a logical OR operation on the given arguments.

4. Objects

  • mapObj

    : Same as Array.prototype.map, but for objects.

  • omit

    : Returns a new object with the specified keys omitted.

  • pick

    : Picks the specified keys from an object.

  • renameKey

    : Renames a key in an object.

  • sampleObj

    : Returns a sample object with the specified keys and values as random numbers.