JavaScript Function Snippets

The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.

  • Binary function arity

    Creates a function that accepts up to two arguments, ignoring any additional arguments.

    JavaScript, Function · Oct 18, 2020

  • Logical complement

    Returns a function that is the logical complement of the given function, fn.

    JavaScript, Function · Sep 15, 2020

  • Logical or for functions

    Checks if at least one function returns true for a given set of arguments.

    JavaScript, Function · Oct 19, 2020

  • Negate predicate

    Negates a predicate function.

    JavaScript, Function · Sep 15, 2020

  • Unary function arity

    Creates a function that accepts up to one argument, ignoring any additional arguments.

    JavaScript, Function · Oct 22, 2020