javascript - How can I extend lodash function? -


it's possible extend underscore/lodash creating mixins, if have function similar existing lodash function. example let's add function compares 2 objects looking property key. function take 2 objects , property key name. sounds easy, right? imagine overload existing _.isequal instead of creating brand new mixin different name. , in function first check if first 2 arguments objects , third argument string, , if not, call original _.isequal function.

i know not idea, wondering if it's doable. tried creating mixin name _.isequal looks this:

function isequal(value, other, customizer, thisarg) {     console.log('my own isequal');      return _.isequal.apply(thisarg || this, arguments); } 

apparently didn't work, because recursively keeps calling itself. guys have ideas?


Comments