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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -159,7 +159,7 @@ var MultiView = Backbone.View.extend({
if (!this.typeToConstructor[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,
{ wait: true }

View file

@ -13,7 +13,7 @@ var VisBase = Backbone.Model.extend({
animateAttrKeys: function(keys, attrObj, speed, easing) {
// either we animate a specific subset of keys or all
// possible things we could animate
keys = _.extend(
keys = Object.assign(
{},
{
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
_.each(keys.include, function(key) {
attr[key] = _.extend(
attr[key] = Object.assign(
{},
attr[key],
attrObj

View file

@ -58,7 +58,7 @@ var VisBase = Backbone.Model.extend({
animateAttrKeys: function(keys, attrObj, speed, easing) {
// either we animate a specific subset of keys or all
// possible things we could animate
keys = _.extend(
keys = Object.assign(
{},
{
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
_.each(keys.include, function(key) {
attr[key] = _.extend(
attr[key] = Object.assign(
{},
attr[key],
attrObj

View file

@ -104,7 +104,7 @@ var Visualization = Backbone.View.extend({
makeOrigin: function(options) {
// oh god, here we go. We basically do a bizarre form of composition here,
// 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...
this.options,