nl_tokens: Check several pre - conditions .
pl_tokens: function ( ) { var i = this . <mask> , k = this . key , m = this . model , rm = this . relatedModel , warn = Backbone . Relational . showWarnings && typeof console !== 'undefined' ; if ( ! m || ! k || ! rm ) { warn && console . warn ( 'Relation=%o: missing model, key or relatedModel (%o, %o, %o).' , this , m , k , rm ) ; return false ; } // Check if the type in 'model' inherits from Backbone.RelationalModel if ( ! ( m . prototype instanceof Backbone . RelationalModel ) ) { warn && console . warn ( 'Relation=%o: model does not inherit from Backbone.RelationalModel (%o).' , this , i ) ; return false ; } // Check if the type in 'relatedModel' inherits from Backbone.RelationalModel if ( ! ( rm . prototype instanceof Backbone . RelationalModel ) ) { warn && console . warn ( 'Relation=%o: relatedModel does not inherit from Backbone.RelationalModel (%o).' , this , rm ) ; return false ; } // Check if this is not a HasMany, and the reverse relation is HasMany as well if ( this instanceof Backbone . HasMany && this . reverseRelation . type === Backbone . HasMany ) { warn && console . warn ( 'Relation=%o: relation is a HasMany, and the reverseRelation is HasMany as well.' , this ) ; return false ; } // Check if we're not attempting to create a relationship on a `key` that's already used. if ( i && _ . keys ( i . _relations ) . length ) { var existing = _ . find ( i . _relations , function ( rel ) { return rel . key === k ; } , this ) ; if ( existing ) { warn && console . warn ( 'Cannot create relation=%o on %o for model=%o: already taken by relation=%o.' , this , k , i , existing ) ; return false ; } } return true ; }