Nodejs Array Find by Name findByName(name)

Here you can find the source of findByName(name)

Method Source Code

Array.prototype.findByName = function(name) {
    for(var i = 0; i< this.length; ++i) {
        if( this[i].name == name)
        {/*from  w w w .  ja  v  a 2  s .co m*/
            return this[i];
        }
    }
};

Related

  1. findByName(name)
    Array.prototype.findByName = function(name) {
        name = String(name);
        return this.find(i => i.name === name);
    };