1.0.2 • Published 6 years ago

lodash-listfindandremove v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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: 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

VersionRelease DateDetails
1.0.225th February, 2018An 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.125th February, 2018Added 2 new badges to the README (Known Vulnerabilities & NPM Version) and this Version History. No functionality changes.
1.0.024th February, 2018Initial release.