Code coverage report for src/marionette.helpers.js

Statements: 93.75% (15 / 16)      Branches: 90.91% (10 / 11)      Functions: 100% (3 / 3)      Lines: 100% (15 / 15)     

All files » src/ » marionette.helpers.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39        1 1 849     1 3 3 3             1             1 2962 2962   2962 168   2794     2962    
// Helpers
// -------
 
// For slicing `arguments` in functions
var protoSlice = Array.prototype.slice;
function slice(args) {
  return protoSlice.call(args);
}
 
function throwError(message, name) {
  var error = new Error(message);
  error.name = name || 'Error';
  throw error;
}
 
// Marionette.extend
// -----------------
 
// Borrow the Backbone `extend` method so we can use it as needed
Marionette.extend = Backbone.Model.extend;
 
// Marionette.getOption
// --------------------
 
// Retrieve an object, function or other value from a target
// object or its `options`, with `options` taking precedence.
Marionette.getOption = function(target, optionName){
  Iif (!target || !optionName){ return; }
  var value;
 
  if (target.options && (optionName in target.options) && (target.options[optionName] !== undefined)){
    value = target.options[optionName];
  } else {
    value = target[optionName];
  }
 
  return value;
};