JSPM

hodash.remove-one

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q33528F
  • License MIT

Remove first matching element from array.

Package Exports

  • hodash.remove-one

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hodash.remove-one) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Remove first matching element from an array.

Will stop iterating when first match is encountered, and return new array without the matched element.

$ npm install hodash.removeOne

const _removeOne = require('hodash.remove-one');

Remove by matching result of function:

const data = [{name: 'Phil'}, {name: 'Andrea'}, {name: 'Sam'}];

// Remove element with name = Sam
const withoutSam = _removeOne(data, ({name}) => name === 'Sam');

Remove by strict equality check:

const letters = ['a', 'b', 'c', 'd', 'e'];

// Remove 'd'
const withoutE = _removeOne(letters, 'd');