Home

function: flip


flip(func: function): function

Creates a function that invokes `func` with arguments reversed.

Example(s):

const flipped = flip((...args) => args)

flipped('a', 'b', 'c', 'd')
// => ['d', 'c', 'b', 'a']

Params:

Name Type Attribute Description
func The function to flip arguments for.

Returns:

function

  {
    "comment": "/**\r\n * Creates a function that invokes `func` with arguments reversed.\r\n *\r\n * @since 4.0.0\r\n * @category Function\r\n * @param {Function} func The function to flip arguments for.\r\n * @returns {Function} Returns the new flipped function.\r\n * @see reverse\r\n * @example\r\n *\r\n * const flipped = flip((...args) => args)\r\n *\r\n * flipped('a', 'b', 'c', 'd')\r\n * // => ['d', 'c', 'b', 'a']\r\n */",
    "meta": {
        "range": [
            388,
            581
        ],
        "filename": "flip.js",
        "lineno": 16,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100002743",
            "name": "flip",
            "type": "FunctionDeclaration",
            "paramnames": [
                "func"
            ]
        },
        "vars": {
            "": null
        }
    },
    "description": "Creates a function that invokes `func` with arguments reversed.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Function",
            "value": "Function"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function to flip arguments for.",
            "name": "func"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "Returns the new flipped function."
        }
    ],
    "see": [
        "reverse"
    ],
    "examples": [
        "const flipped = flip((...args) => args)\r\rflipped('a', 'b', 'c', 'd')\r// => ['d', 'c', 'b', 'a']"
    ],
    "name": "flip",
    "longname": "flip",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000296",
    "___s": true,
    "filepath": "flip.js"
}