Categories

Pull Values

Remove specific values from an array using lodash _.pull

Remove all occurrences of specified values from an array.

Highlights:

  • Uses lodash _.pull
  • Accepts values to remove as a JSON array
  • Optional case-insensitive matching for string arrays

Example:

  • Array: [1, 2, 2, 3]
  • Values: [2]
  • Result: [1, 3]

Enter a JSON array

JSON array of values to remove

Uncheck for case-insensitive string matching

Key Facts

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

Overview

This tool removes all occurrences of specified values from an array using the lodash _.pull method. It accepts JSON arrays for both input and values to remove, with an optional case-insensitive matching feature for strings.

When to Use

  • When cleaning data arrays by removing null, duplicate, or erroneous entries.
  • For filtering lists in programming or data processing to exclude specific elements.
  • To manage arrays by deleting unwanted values efficiently in workflows.

How It Works

  • Input your array as a JSON array in the 'Array' field.
  • Specify the values to remove as a JSON array in the 'Values to Remove' field.
  • Optionally uncheck 'Case Sensitive' for case-insensitive string matching.
  • The tool processes the input and returns the modified array with values removed.

Use Cases

Data preprocessing: Remove placeholder or error values from datasets for accurate analysis.
Application development: Filter out banned words or spam entries from user input arrays.
Inventory management: Delete discontinued items from product lists to maintain updated records.

Examples

1. Remove Erroneous Sensor Readings

Data Engineer
Background
An IoT system collects temperature data, but some sensors send invalid readings like -999 that skew results.
Problem
The array contains erroneous values that need removal for reliable analysis.
How to Use
Enter the sensor readings array in the 'Array' field and specify [-999] in the 'Values to Remove' field.
Example Config
Array: [22.5, -999, 23.1, -999, 24.0], Values: [-999]
Outcome
The tool returns [22.5, 23.1, 24.0], with all -999 values removed.

2. Filter Banned Usernames

Community Moderator
Background
A forum maintains a list of usernames, and moderators need to remove banned users' names, ignoring case variations.
Problem
Banned usernames appear in different cases, making manual filtering inefficient.
How to Use
Input the username array and the list of banned names. Uncheck 'Case Sensitive' to catch all variations.
Example Config
Array: ['Alice', 'bob', 'BOB', 'Charlie'], Values: ['bob'], Case Sensitive: false
Outcome
The result is ['Alice', 'Charlie'], with both 'bob' and 'BOB' removed due to case-insensitive matching.

Try with Samples

json, video, text

Related Hubs

FAQ

What does this tool do?

It removes all instances of specified values from an input array using lodash _.pull.

Can it handle non-JSON inputs?

No, both the array and values must be valid JSON arrays.

Is case sensitivity enabled by default?

Yes, string matching is case-sensitive by default; uncheck the option for case-insensitive removal.

What types of values can be removed?

Any JSON-compatible values, such as numbers, strings, or objects.

Does it modify the original array?

No, it returns a new array with the specified values removed, leaving the input unchanged.

API Documentation

Request Endpoint

POST /en/api/tools/pull-values

Request Parameters

Parameter Name Type Required Description
array textarea Yes Enter a JSON array
values textarea Yes JSON array of values to remove
caseSensitive checkbox No Uncheck for case-insensitive string matching

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-pull-values": {
      "name": "pull-values",
      "description": "Remove specific values from an array using lodash _.pull",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=pull-values",
      "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]