From dfe3c64e81b1288b82ae094c8614f2cf5dab576c Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Wed, 5 Oct 2016 10:05:46 -0700 Subject: [PATCH] use defaults function --- src/component/shape-component.js | 3 ++- src/component/structure-component.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/component/shape-component.js b/src/component/shape-component.js index 741b7e3fe..dee945b83 100644 --- a/src/component/shape-component.js +++ b/src/component/shape-component.js @@ -5,6 +5,7 @@ */ +import { defaults } from "../utils.js"; import Component from "./component.js"; @@ -19,7 +20,7 @@ import Component from "./component.js"; function ShapeComponent( stage, shape, params ){ var p = params || {}; - p.name = p.name !== undefined ? p.name : shape.name; + p.name = defaults( p.name, shape.name ); Component.call( this, stage, p ); diff --git a/src/component/structure-component.js b/src/component/structure-component.js index 01ded7d8c..a5827f4f3 100644 --- a/src/component/structure-component.js +++ b/src/component/structure-component.js @@ -5,6 +5,7 @@ */ +import { defaults } from "../utils.js"; import Component from "./component.js"; import TrajectoryComponent from "./trajectory-component.js"; import { makeTrajectory } from "../trajectory/trajectory-utils.js"; @@ -33,7 +34,7 @@ import { superpose } from "../align/align-utils.js"; function StructureComponent( stage, structure, params ){ var p = params || {}; - p.name = p.name !== undefined ? p.name : structure.name; + p.name = defaults( p.name, structure.name ); Component.call( this, stage, p ); @@ -239,7 +240,7 @@ StructureComponent.prototype = Object.assign( Object.create( centerView: function( zoom, sele ){ - zoom = zoom !== undefined ? zoom : true; + zoom = defaults( zoom, true ); var center = this.getCenter( sele );