Nodejs Utililty Methods Array Find by Name

List of utility methods to do Array Find by Name

Description

The list of methods to do Array Find by Name are organized into topic(s).

Method

findByName(name)
Array.prototype.findByName = function(name) {
    name = String(name);
    return this.find(i => i.name === name);
};
findByName(name)
Array.prototype.findByName = function(name) {
    for(var i = 0; i< this.length; ++i) {
        if( this[i].name == name)
            return this[i];
};