Plato on Github
Report Home
helpers.js
Maintainability
72.06
Lines of code
34
Difficulty
16.30
Estimated Errors
0.17
Function weight
By Complexity
By SLOC
// 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 it's `options`, with `options` taking precedence. Marionette.getOption = function(target, optionName){ if (!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; };