mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-24 15:08:37 +02:00
change '_.clone(..args)' to 'Object.assign({}, ..args)'
This commit is contained in:
parent
052aa1e299
commit
489a4b9095
8 changed files with 14 additions and 17 deletions
|
@ -726,7 +726,7 @@ GitEngine.prototype.makeTag = function(id, target) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.getHead = function() {
|
||||
return _.clone(this.HEAD);
|
||||
return Object.assign({}, this.HEAD);
|
||||
};
|
||||
|
||||
GitEngine.prototype.getTags = function() {
|
||||
|
|
|
@ -165,8 +165,8 @@ TreeCompare.compareBranchesWithinTreesHashAgnostic = function(treeA, treeB, bran
|
|||
}
|
||||
|
||||
// don't mess up the rest of comparison
|
||||
branchA = _.clone(branchA);
|
||||
branchB = _.clone(branchB);
|
||||
branchA = Object.assign({}, branchA);
|
||||
branchB = Object.assign({}, branchB);
|
||||
branchA.target = this.getBaseRef(branchA.target);
|
||||
branchB.target = this.getBaseRef(branchB.target);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ var fallbackMap = {
|
|||
|
||||
// lets change underscores template settings so it interpolates
|
||||
// things like "{branchName} does not exist".
|
||||
var templateSettings = _.clone(_.templateSettings);
|
||||
var templateSettings = Object.assign({}, _.templateSettings);
|
||||
templateSettings.interpolate = /\{(.+?)\}/g;
|
||||
var template = exports.template = function(str, params) {
|
||||
return _.template(str, params, templateSettings);
|
||||
|
@ -106,7 +106,8 @@ exports.getStartDialog = function(level) {
|
|||
markdown: str('error-untranslated')
|
||||
}
|
||||
};
|
||||
var startCopy = _.clone(
|
||||
var startCopy = Object.assign(
|
||||
{},
|
||||
level.startDialog[getDefaultLocale()] || level.startDialog
|
||||
);
|
||||
startCopy.childViews.unshift(errorAlert);
|
||||
|
|
|
@ -55,7 +55,7 @@ var GitDemonstrationView = ContainedBase.extend({
|
|||
this.render();
|
||||
this.checkScroll();
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents = Object.assign({}, Backbone.Events);
|
||||
this.navEvents.on('positive', this.positive, this);
|
||||
this.navEvents.on('negative', this.negative, this);
|
||||
this.keyboardListener = new KeyboardListener({
|
||||
|
@ -244,4 +244,3 @@ var GitDemonstrationView = ContainedBase.extend({
|
|||
});
|
||||
|
||||
exports.GitDemonstrationView = GitDemonstrationView;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ var GeneralButton = ContainedBase.extend({
|
|||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.navEvents = options.navEvents || _.clone(Backbone.Events);
|
||||
this.navEvents = options.navEvents || Object.assign({}, Backbone.Events);
|
||||
this.destination = options.destination;
|
||||
if (!this.destination) {
|
||||
this.container = new ModalTerminal();
|
||||
|
@ -160,7 +160,7 @@ var LeftRightView = PositiveNegativeBase.extend({
|
|||
// events system to add support for git demonstration view taking control of the
|
||||
// click events
|
||||
this.pipeEvents = options.events;
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents = Object.assign({}, Backbone.Events);
|
||||
|
||||
this.JSON = {
|
||||
showLeft: (options.showLeft === undefined) ? true : options.showLeft,
|
||||
|
@ -305,7 +305,7 @@ var ModalTerminal = ContainedBase.extend({
|
|||
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.navEvents = options.events || _.clone(Backbone.Events);
|
||||
this.navEvents = options.events || Object.assign({}, Backbone.Events);
|
||||
|
||||
this.container = new ModalView();
|
||||
this.JSON = {
|
||||
|
@ -395,7 +395,7 @@ var ConfirmCancelTerminal = Backbone.View.extend({
|
|||
}.bind(this));
|
||||
|
||||
// also setup keyboard
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents = Object.assign({}, Backbone.Events);
|
||||
this.navEvents.on('positive', this.positive, this);
|
||||
this.navEvents.on('negative', this.negative, this);
|
||||
this.keyboardListener = new KeyboardListener({
|
||||
|
|
|
@ -40,7 +40,7 @@ var LevelDropdownView = ContainedBase.extend({
|
|||
}]
|
||||
};
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents = Object.assign({}, Backbone.Events);
|
||||
this.navEvents.on('clickedID', _.debounce(
|
||||
this.loadLevelID.bind(this),
|
||||
300,
|
||||
|
@ -444,4 +444,3 @@ var SeriesView = BaseView.extend({
|
|||
});
|
||||
|
||||
exports.LevelDropdownView = LevelDropdownView;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ var MultiView = Backbone.View.extend({
|
|||
this.childViews = [];
|
||||
this.currentIndex = 0;
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents = Object.assign({}, Backbone.Events);
|
||||
this.navEvents.on('negative', this.getNegFunc(), this);
|
||||
this.navEvents.on('positive', this.getPosFunc(), this);
|
||||
this.navEvents.on('quit', this.finish, this);
|
||||
|
@ -192,4 +192,3 @@ var MultiView = Backbone.View.extend({
|
|||
});
|
||||
|
||||
exports.MultiView = MultiView;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
|
||||
var Collections = require('../models/collections');
|
||||
|
@ -13,7 +12,7 @@ var Visualization = Backbone.View.extend({
|
|||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
this.customEvents = _.clone(Backbone.Events);
|
||||
this.customEvents = Object.assign({}, Backbone.Events);
|
||||
this.containerElement = options.containerElement;
|
||||
|
||||
var _this = this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue