Categories

Drop Items

Drop first N items from array using lodash _.drop

Remove a specified number of elements from the beginning of an array.

Examples:

  • Input: [1, 2, 3, 4, 5], Drop: 2[3, 4, 5]
  • Input: ["a", "b", "c", "d"], Drop: 1["b", "c", "d"]
  • Input: [10, 20, 30, 40, 50], Drop: 3[40, 50]
  • Input: [1, 2, 3], Drop: 0[1, 2, 3] (no items dropped)
  • Input: [1, 2, 3], Drop: 10[] (drops all items)

Use Cases:

  • Skip header rows in data arrays
  • Remove initial configuration items
  • Process arrays starting from a specific position
  • Clean up prefix elements

Enter a valid JSON array

How many items to remove from the beginning (0-10000)

Key Facts

Category
Data Processing
Input Types
textarea, number
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

This tool removes a specified number of elements from the beginning of an array using the lodash _.drop function. It efficiently trims arrays to skip unwanted initial items, such as headers or prefixes.

When to Use

  • When you need to skip header rows or prefix elements in data arrays.
  • To remove initial configuration or setup items from a list before processing.
  • When processing arrays from a specific position without manual slicing.

How It Works

  • Enter a valid JSON array in the input field.
  • Specify the number of items to drop from the beginning (default is 1).
  • The tool applies lodash _.drop to remove the first N items.
  • Output is the modified array with the specified items removed.

Use Cases

Skipping header rows in CSV or data arrays for analysis.
Removing initial setup elements from configuration lists.
Processing time-series data from a specific starting point.

Examples

1. Skip Header Row in Data Array

Background
A data analyst has an array where the first element is a column header that should not be included in calculations.
Problem
Manually removing the header each time is inefficient and prone to errors.
How to Use
Input the array with the header as the first element, and set n to 1 to drop it.
Outcome
The resulting array contains only the data rows, ready for further processing.

2. Remove Initial Configuration Items

Background
An array starts with several configuration parameters that are not needed for the main data processing task.
Problem
These initial items clutter the array and need to be excluded.
How to Use
Provide the full array and specify the number of configuration items to drop from the beginning.
Outcome
The array is trimmed to exclude the configuration, focusing on the relevant data.

Try with Samples

json, video

Related Hubs

FAQ

What happens if I drop more items than the array length?

If n exceeds the array length, all items are dropped, resulting in an empty array.

Can I drop zero items?

Yes, setting n to 0 returns the original array unchanged.

What is the default value for n?

The default value for n is 1, meaning one item is dropped if not specified.

Does this tool work with arrays containing different data types?

Yes, it works with any valid JSON array, including strings, numbers, or objects.

Is the original array modified by this tool?

No, the tool returns a new array, leaving the original input unchanged.

API Documentation

Request Endpoint

POST /en/api/tools/drop-items

Request Parameters

Parameter Name Type Required Description
array textarea Yes Enter a valid JSON array
n number No How many items to remove from the beginning (0-10000)

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-drop-items": {
      "name": "drop-items",
      "description": "Drop first N items from array using lodash _.drop",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=drop-items",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]