Home

function: dropRightWhile


dropRightWhile(array: Array, predicate: function): Array

Creates a slice of `array` excluding elements dropped from the end. Elements are dropped until `predicate` returns falsey. The predicate is invoked with three arguments: (value, index, array).

Example(s):

const users = [
  { 'user': 'barney',  'active': false },
  { 'user': 'fred',    'active': true },
  { 'user': 'pebbles', 'active': true }
]

dropRightWhile(users, ({ active }) => active)
// => objects for ['barney']

Params:

Name Type Attribute Description
array The array to query.
predicate The function invoked per iteration.

Returns:

Array

  {
    "comment": "/**\r\n * Creates a slice of `array` excluding elements dropped from the end.\r\n * Elements are dropped until `predicate` returns falsey. The predicate is\r\n * invoked with three arguments: (value, index, array).\r\n *\r\n * @since 3.0.0\r\n * @category Array\r\n * @param {Array} array The array to query.\r\n * @param {Function} predicate The function invoked per iteration.\r\n * @returns {Array} Returns the slice of `array`.\r\n * @example\r\n *\r\n * const users = [\r\n *   { 'user': 'barney',  'active': false },\r\n *   { 'user': 'fred',    'active': true },\r\n *   { 'user': 'pebbles', 'active': true }\r\n * ]\r\n *\r\n * dropRightWhile(users, ({ active }) => active)\r\n * // => objects for ['barney']\r\n */",
    "meta": {
        "range": [
            737,
            882
        ],
        "filename": "dropRightWhile.js",
        "lineno": 24,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100002040",
            "name": "dropRightWhile",
            "type": "FunctionDeclaration",
            "paramnames": [
                "array",
                "predicate"
            ]
        }
    },
    "description": "Creates a slice of `array` excluding elements dropped from the end.\rElements are dropped until `predicate` returns falsey. The predicate is\rinvoked with three arguments: (value, index, array).",
    "since": "3.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The array to query.",
            "name": "array"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per iteration.",
            "name": "predicate"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the slice of `array`."
        }
    ],
    "examples": [
        "const users = [\r  { 'user': 'barney',  'active': false },\r  { 'user': 'fred',    'active': true },\r  { 'user': 'pebbles', 'active': true }\r]\r\rdropRightWhile(users, ({ active }) => active)\r// => objects for ['barney']"
    ],
    "name": "dropRightWhile",
    "longname": "dropRightWhile",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000222",
    "___s": true,
    "filepath": "dropRightWhile.js"
}