Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→array-pull-all-with-globnext

array-pull-all-with-glob7.2.0

Like _.pullAll but with globs (wildcards)

Downloads per monthChangelogMIT Licenselibera manifesto
  • the top
  • Installation
  • Quick Take
  • Examples
  • PURPOSE
  • API — PULL()
  • API — DEFAULTS
  • API — VERSION
  • Changelog

Installation

Quick Take

Examples

  • Match removal patterns without regard to letter case
  • Remove values that match any of several patterns
  • Remove every value with the catch-all glob
  • Pass one removal pattern as a string

Purpose

This program removes strings from array if they match a glob pattern. It’s like Lodash’s _.pullAllopens in a new tab except with globbyopens in a new tab on top.

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

API — pull()

The main function pull() is imported like this:

It is a function which takes three input arguments: 1. a source from which to remove, 2. what to remove and 3. an optional options object:

Input argumentTypeObligatoryDescription
sourceArray
Type: Array of zero or more strings
Obligatory: yes
sourceArrayArray of zero or more stringsyesSource array of zero or more strings
removeThese
Type: Array of zero or more strings or a string
Obligatory: yes
removeTheseArray of zero or more strings or a stringyesArray of zero or more strings or a single string to be removed from the source array
opts
Type: Plain object
Obligatory: no
optsPlain objectnoAn Optional Options Object. See its API below.

None of the input arguments will be mutated by this program, we have unit tests to prove that.

The optional options object has the following shape:

KeyTypeDefaultDescription
caseSensitive
Type: Boolean
Default: true
caseSensitiveBooleantrueAre comparisons case-sensitive? Default answer is “yes”, but you can override it.

Here are all defaults in one place for copying:

The function returns an array with requested elements removed.

API — defaults

You can import defaults:

It's a plain object:

The main function calculates the options to be used by merging the options you passed with these defaults.

API — version

You can import version:

Changelog

Open Changelog
↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab