lodash-listfindandremove

1.0.2 • Public • Published

Lodash listFindAndRemove

Build Status Known Vulnerabilities NPM version

Extends Lodash to search a delimited string and remove any occurrences of a specified value.
Returns a new string with the specified values removed, the original string is unchanged.

_.listFindAndRemove(list, target, [delimiter=','])

Arguments
list (string): The string containing the delimited list to be search. Required.
target (string): The value to remove from the list. Matching is case-sensitive. Required.
[delimiter] (string): The optional character used to delimit items in the list. When none is supplied a comma (,) is used.

Returns
(string): Returns a string containing the delimited list with all occurrences of the target removed.

Examples

var _ = require('lodash')
require('lodash-listfindandremove')

_.listFindAndRemove(d,a,b,c,d,e,d,f,d', 'd') // 'a,b,c,e,f'  
_.listFindAndRemove('d,a,b,c,D,e,d,f,d', 'd') // 'a,b,c,D,e,f'  
_.listFindAndRemove('d~a~b~c~d~e~d~f~d', 'd', '~') // 'a~b~c~e~f'  
_.listFindAndRemove('a,b,c,d,e,f', 'z') // 'a,b,c,d,e,f'  
_.listFindAndRemove('a|b|c|d|e|f|xyz', 'z', '|') // 'a|b|c|d|e|f|xyz'  
_.listFindAndRemove('', 'a') // ''   
_.listFindAndRemove('1,2,3,100,4,1,5', '1') // '2,3,100,4,5'  

Version History

Version Release Date Details
1.0.2 25th February, 2018 An extra character had snuck into one of the links meaning the badge was correct but clicking on it didn't give the expected result. No functionality changes.
1.0.1 25th February, 2018 Added 2 new badges to the README (Known Vulnerabilities & NPM Version) and this Version History. No functionality changes.
1.0.0 24th February, 2018 Initial release.

Readme

Keywords

none

Package Sidebar

Install

npm i lodash-listfindandremove

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

6.3 kB

Total Files

7

Last publish

Collaborators

  • davidwaterston