npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vdel

v1.1.0

Published

Deletes one or more values from an Array, Map, Object, Set, or other collection.

Downloads

19

Readme

vdel

Deletes one or more values from an Array, Map, Object, Set, or other collection.

Installation

Requires Node.js 8.3.0 or above.

npm i vdel

API

The module exports a del() function that has one other function attached to it as a method: del.all().

del()

Parameters

  1. Bindable: collection (Array, Map, Object, Set, or WeakSet): The collection from which to possibly remove a value.
  2. valueToDelete (any): The value to be removed (if found).
  3. Optional: Object argument:
    • arrays / maps / sets / weakSets (arrays of classes/strings): Arrays of classes and/or string names of classes that should be treated as equivalent to Array/Map/Set/WeakSet (respectively).
    • compareAs (function): A callback that accepts a single existing value from the collection and transforms it before it is compared.
    • compareBy (any): If set, each existing value in the collection is assumed to be a subcollection, and the value in each subcollection corresponding to the compareBy key will be compared to valueToDelete. Only applies if compareAs is not set. If compareBy is an array, it is assumed to be a chain of nested keys.
    • compareByOptions (object): An options argument for the kget module, which is used when compareBy is set.
    • loose (boolean): Whether or not to identify values loosely (as defined by looselyEquals). Defaults to false.
    • looselyEquals (function): A callback that accepts two values and returns true if they are to be considered equivalent or false otherwise. This argument is only used if loose is true. If omitted, the default behavior will, among other things, consider arrays/objects to be equal if they have the same entries.

Return Value

The number of items deleted.

Example

const del = require('vdel')

const arr = [0, 1, 0, 1]
del(arr, 0) // 2
arr // [1, 1]

const obj = {str: 'test', arr: []}
del(obj, [], {loose: true}) // 1
obj // {str: 'test'}

del.all()

Use this function if you want to remove multiple values from a collection all at once. The signature is the same as the main function except that the second parameter is called valuesToDelete and takes an iterable (such as an array). The return value is the total number of items deleted.

Example

const del = require('vdel')

const set = new Set([1, 2, 3])
del.all(set, [1, 2]) // 2
Array.from(set) // [3]

Related

The “k” family of modules works on keyed/indexed collections.

The “v” family of modules works on any collection of values.