change '_.extend' to 'Object.assign'

This commit is contained in:
Hongarc 2018-12-01 06:07:06 +07:00
parent 7ae05ce932
commit 052aa1e299
13 changed files with 27 additions and 27 deletions

View file

@ -518,7 +518,7 @@ GitEngine.prototype.getOrMakeRecursive = function(
if (type == 'HEAD') { if (type == 'HEAD') {
var headJSON = tree.HEAD; var headJSON = tree.HEAD;
var HEAD = new Ref(_.extend( var HEAD = new Ref(Object.assign(
tree.HEAD, tree.HEAD,
{ {
target: this.getOrMakeRecursive(tree, createdSoFar, headJSON.target) target: this.getOrMakeRecursive(tree, createdSoFar, headJSON.target)
@ -531,7 +531,7 @@ GitEngine.prototype.getOrMakeRecursive = function(
if (type == 'branch') { if (type == 'branch') {
var branchJSON = tree.branches[objID]; var branchJSON = tree.branches[objID];
var branch = new Branch(_.extend( var branch = new Branch(Object.assign(
tree.branches[objID], tree.branches[objID],
{ {
target: this.getOrMakeRecursive(tree, createdSoFar, branchJSON.target) target: this.getOrMakeRecursive(tree, createdSoFar, branchJSON.target)
@ -544,7 +544,7 @@ GitEngine.prototype.getOrMakeRecursive = function(
if (type == 'tag') { if (type == 'tag') {
var tagJSON = tree.tags[objID]; var tagJSON = tree.tags[objID];
var tag = new Tag(_.extend( var tag = new Tag(Object.assign(
tree.tags[objID], tree.tags[objID],
{ {
target: this.getOrMakeRecursive(tree, createdSoFar, tagJSON.target) target: this.getOrMakeRecursive(tree, createdSoFar, tagJSON.target)
@ -563,7 +563,7 @@ GitEngine.prototype.getOrMakeRecursive = function(
parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID)); parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID));
}, this); }, this);
var commit = new Commit(_.extend( var commit = new Commit(Object.assign(
commitJSON, commitJSON,
{ {
parents: parentObjs, parents: parentObjs,
@ -846,7 +846,7 @@ GitEngine.prototype.makeCommit = function(parents, id, options) {
id = this.getUniqueID(); id = this.getUniqueID();
} }
var commit = new Commit(_.extend({ var commit = new Commit(Object.assign({
parents: parents, parents: parents,
id: id, id: id,
gitVisuals: this.gitVisuals gitVisuals: this.gitVisuals
@ -1284,7 +1284,7 @@ GitEngine.prototype.fetchCore = function(sourceDestPairs, options) {
this.origin, this.origin,
pair.destination, pair.destination,
pair.source, pair.source,
_.extend( Object.assign(
{}, {},
options, options,
{dontThrowOnNoFetch: true} {dontThrowOnNoFetch: true}

View file

@ -44,7 +44,7 @@ var Graph = {
if (type == 'HEAD') { if (type == 'HEAD') {
var headJSON = tree.HEAD; var headJSON = tree.HEAD;
var HEAD = new Ref(_.extend( var HEAD = new Ref(Object.assign(
tree.HEAD, tree.HEAD,
{ {
target: this.getOrMakeRecursive(tree, createdSoFar, headJSON.target) target: this.getOrMakeRecursive(tree, createdSoFar, headJSON.target)
@ -57,7 +57,7 @@ var Graph = {
if (type == 'branch') { if (type == 'branch') {
var branchJSON = tree.branches[objID]; var branchJSON = tree.branches[objID];
var branch = new Branch(_.extend( var branch = new Branch(Object.assign(
tree.branches[objID], tree.branches[objID],
{ {
target: this.getOrMakeRecursive(tree, createdSoFar, branchJSON.target) target: this.getOrMakeRecursive(tree, createdSoFar, branchJSON.target)
@ -70,7 +70,7 @@ var Graph = {
if (type == 'tag') { if (type == 'tag') {
var tagJSON = tree.tags[objID]; var tagJSON = tree.tags[objID];
var tag = new Tag(_.extend( var tag = new Tag(Object.assign(
tree.tags[objID], tree.tags[objID],
{ {
target: this.getOrMakeRecursive(tree, createdSoFar, tagJSON.target) target: this.getOrMakeRecursive(tree, createdSoFar, tagJSON.target)
@ -89,7 +89,7 @@ var Graph = {
parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID)); parentObjs.push(this.getOrMakeRecursive(tree, createdSoFar, parentID));
}, this); }, this);
var commit = new Commit(_.extend( var commit = new Commit(Object.assign(
commitJSON, commitJSON,
{ {
parents: parentObjs, parents: parentObjs,

View file

@ -92,7 +92,7 @@ TreeCompare.compareAllBranchesWithinTrees = function(treeA, treeB) {
treeA = this.convertTreeSafe(treeA); treeA = this.convertTreeSafe(treeA);
treeB = this.convertTreeSafe(treeB); treeB = this.convertTreeSafe(treeB);
var allBranches = _.extend( var allBranches = Object.assign(
{}, {},
treeA.branches, treeA.branches,
treeB.branches treeB.branches
@ -140,7 +140,7 @@ TreeCompare.compareAllBranchesWithinTreesHashAgnostic = function(treeA, treeB) {
treeB = this.convertTreeSafe(treeB); treeB = this.convertTreeSafe(treeB);
this.reduceTreeFields([treeA, treeB]); this.reduceTreeFields([treeA, treeB]);
var allBranches = _.extend( var allBranches = Object.assign(
{}, {},
treeA.branches, treeA.branches,
treeB.branches treeB.branches
@ -270,7 +270,7 @@ TreeCompare.getRecurseCompareHashAgnostic = function(treeA, treeB) {
// some buildup functions // some buildup functions
var getStrippedCommitCopy = function(commit) { var getStrippedCommitCopy = function(commit) {
if (!commit) { return {}; } if (!commit) { return {}; }
return _.extend( return Object.assign(
{}, {},
commit, commit,
{ {

View file

@ -360,7 +360,7 @@ var LevelBuilder = Level.extend({
}, },
getExportObj: function() { getExportObj: function() {
var compiledLevel = _.extend( var compiledLevel = Object.assign(
{}, {},
this.level this.level
); );

View file

@ -70,7 +70,7 @@ var Level = Sandbox.extend({
// if there is a multiview in the beginning, open that // if there is a multiview in the beginning, open that
// and let it resolve our deferred // and let it resolve our deferred
if (this.level.startDialog && !this.testOption('noIntroDialog')) { if (this.level.startDialog && !this.testOption('noIntroDialog')) {
new MultiView(_.extend( new MultiView(Object.assign(
{}, {},
intl.getStartDialog(this.level), intl.getStartDialog(this.level),
{ deferred: deferred } { deferred: deferred }
@ -99,7 +99,7 @@ var Level = Sandbox.extend({
var dialog = $.extend({}, intl.getStartDialog(levelObj)); var dialog = $.extend({}, intl.getStartDialog(levelObj));
// grab the last slide only // grab the last slide only
dialog.childViews = dialog.childViews.slice(-1); dialog.childViews = dialog.childViews.slice(-1);
new MultiView(_.extend( new MultiView(Object.assign(
dialog, dialog,
{ deferred: deferred } { deferred: deferred }
)); ));

View file

@ -134,7 +134,7 @@ var getAllCommands = function() {
'mobileAlert' 'mobileAlert'
]; ];
var allCommands = _.extend( var allCommands = Object.assign(
{}, {},
require('../level').regexMap, require('../level').regexMap,
regexMap regexMap

View file

@ -179,7 +179,7 @@ var DemonstrationBuilder = ContainedBase.extend({
this.deferred = options.deferred || Q.defer(); this.deferred = options.deferred || Q.defer();
if (options.fromObj) { if (options.fromObj) {
var toEdit = options.fromObj.options; var toEdit = options.fromObj.options;
options = _.extend( options = Object.assign(
{}, {},
options, options,
toEdit, toEdit,

View file

@ -25,7 +25,7 @@ var GitDemonstrationView = ContainedBase.extend({
initialize: function(options) { initialize: function(options) {
options = options || {}; options = options || {};
this.options = options; this.options = options;
this.JSON = _.extend( this.JSON = Object.assign(
{ {
beforeMarkdowns: [ beforeMarkdowns: [
'## Git Commits', '## Git Commits',

View file

@ -372,7 +372,7 @@ var ConfirmCancelTerminal = Backbone.View.extend({
options = options || {}; options = options || {};
this.deferred = options.deferred || Q.defer(); this.deferred = options.deferred || Q.defer();
this.modalAlert = new ModalAlert(_.extend( this.modalAlert = new ModalAlert(Object.assign(
{}, {},
{ markdown: '#you sure?' }, { markdown: '#you sure?' },
options options
@ -470,7 +470,7 @@ var NextLevelConfirm = ConfirmCancelTerminal.extend({
'</p>'; '</p>';
} }
options = _.extend( options = Object.assign(
{}, {},
options, options,
{ {

View file

@ -159,7 +159,7 @@ var MultiView = Backbone.View.extend({
if (!this.typeToConstructor[type]) { if (!this.typeToConstructor[type]) {
throw new Error('no constructor for type "' + type + '"'); throw new Error('no constructor for type "' + type + '"');
} }
var view = new this.typeToConstructor[type](_.extend( var view = new this.typeToConstructor[type](Object.assign(
{}, {},
viewJSON.options, viewJSON.options,
{ wait: true } { wait: true }

View file

@ -13,7 +13,7 @@ var VisBase = Backbone.Model.extend({
animateAttrKeys: function(keys, attrObj, speed, easing) { animateAttrKeys: function(keys, attrObj, speed, easing) {
// either we animate a specific subset of keys or all // either we animate a specific subset of keys or all
// possible things we could animate // possible things we could animate
keys = _.extend( keys = Object.assign(
{}, {},
{ {
include: ['circle', 'arrow', 'rect', 'path', 'text'], include: ['circle', 'arrow', 'rect', 'path', 'text'],
@ -26,7 +26,7 @@ var VisBase = Backbone.Model.extend({
// safely insert this attribute into all the keys we want // safely insert this attribute into all the keys we want
_.each(keys.include, function(key) { _.each(keys.include, function(key) {
attr[key] = _.extend( attr[key] = Object.assign(
{}, {},
attr[key], attr[key],
attrObj attrObj

View file

@ -58,7 +58,7 @@ var VisBase = Backbone.Model.extend({
animateAttrKeys: function(keys, attrObj, speed, easing) { animateAttrKeys: function(keys, attrObj, speed, easing) {
// either we animate a specific subset of keys or all // either we animate a specific subset of keys or all
// possible things we could animate // possible things we could animate
keys = _.extend( keys = Object.assign(
{}, {},
{ {
include: ['circle', 'arrow', 'rect', 'path', 'text'], include: ['circle', 'arrow', 'rect', 'path', 'text'],
@ -71,7 +71,7 @@ var VisBase = Backbone.Model.extend({
// safely insert this attribute into all the keys we want // safely insert this attribute into all the keys we want
_.each(keys.include, function(key) { _.each(keys.include, function(key) {
attr[key] = _.extend( attr[key] = Object.assign(
{}, {},
attr[key], attr[key],
attrObj attrObj

View file

@ -104,7 +104,7 @@ var Visualization = Backbone.View.extend({
makeOrigin: function(options) { makeOrigin: function(options) {
// oh god, here we go. We basically do a bizarre form of composition here, // oh god, here we go. We basically do a bizarre form of composition here,
// where this visualization actually contains another one of itself. // where this visualization actually contains another one of itself.
this.originVis = new Visualization(_.extend( this.originVis = new Visualization(Object.assign(
{}, {},
// copy all of our options over, except... // copy all of our options over, except...
this.options, this.options,