extend function is adding a method called toObject on the obj object that is passed in, which is immediately invoked (IIFE) and in turn presumably "extends" it by adding a special fabric.util.object. Just a guess...

see here fabricjs.com/fabric-intro-part-3