nl_tokens: generic looping function
pl_tokens: function iterateEvents ( target , entity , bindings , functionCallback , stringCallback ) { if ( ! entity || ! bindings ) { return ; } // type-check bindings if ( ! _ . isObject ( bindings ) ) { throw new Marionette . Error ( { message : 'Bindings must be an object or function.' , url : 'marionette.functions.html#marionettebindentityevents' } ) ; } // allow the bindings to be a function bindings = Marionette . _getValue ( bindings , target ) ; // iterate the bindings and bind them _ . each ( bindings , function ( methods , evt ) { // allow for a function as the handler, // or a list of event names as a string if ( _ . isFunction ( methods ) ) { functionCallback ( target , entity , evt , methods ) ; } else { stringCallback ( <mask> , entity , evt , methods ) ; } } ) ; }