Quick Take

import { strict as assert } from "assert";
import { pull } from "array-pull-all-with-glob";



This program removes strings from array if they match a glob pattern. It's like Lodash's _.pullAll opens in a new tab except with globby opens in a new tab on top.

For example, we use it in email-comb to whitelist CSS class/id names.



In other words, it's a function which takes three input arguments, third-one being optional (marked by square brackets).

API - Input

Input argument Type Obligatory? Description
sourceArray Array of zero or more strings yes Source array of zero or more strings
removeThese Array of zero or more strings or a string yes Array of zero or more strings or a single string to be removed from the source array
otps Plain object no An Optional Options Object. See its API below.

By the way, none of the input arguments are mutated. That's checked by unit tests from group 4.x

An Optional Options Object

Type: object - an Optional Options Object.

options object's key Type Default Description
caseSensitive Boolean true Are comparisons case-sensitive? Default answer is yes, but you can override it to no using this.

Here are all defaults in one place for copying:

caseSensitive: true,

When unused, Optional Options Object can be also passed as a null or undefined value.

API - Output

Type Description
Array Array of strings with elements removed


See it in the monorepo opens in a new tab, on GitHub.


To report bugs or request features or assistance, raise an issue on GitHub opens in a new tab.

Any code contributions welcome! All Pull Requests will be dealt promptly.


MIT opens in a new tab

Copyright © 2010–2021 Roy Revelt and other contributors

Related packages:

📦 lodash.pullall opens in a new tab
The lodash method `_.pullAll` exported as a module
📦 globby opens in a new tab
User-friendly glob matching
📦 array-group-str-omit-num-char 5.0.1
Groups array of strings by omitting number characters
📦 arrayiffy-if-string 4.0.1
Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else
📦 array-of-arrays-into-ast 3.0.1
Turns an array of arrays of data into a nested tree of plain objects
📦 array-includes-with-glob 4.0.1
Like _.includes but with wildcards
📦 array-of-arrays-sort-by-col 4.0.1
Sort array of arrays by column, rippling the sorting outwards from that column