Skip to content

Commit

Permalink
Fixed up some inefficiencies with jsAPI.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yandavid committed Dec 30, 2015
1 parent 91300f3 commit 9abb467
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/svgo/jsAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ JSAPI.prototype.clone = function() {
var nodeData = {};

Object.keys(node).forEach(function(key) {
if (key != 'content') {
if (key !== 'content') {
nodeData[key] = node[key];
}
});
Expand Down Expand Up @@ -72,7 +72,7 @@ JSAPI.prototype.isElem = function(param) {
*/
JSAPI.prototype.renameElem = function(name) {

if (typeof name == 'string' && name != '')
if (name && typeof name === 'string')
this.elem = this.local = name;

return this;
Expand Down Expand Up @@ -198,16 +198,16 @@ JSAPI.prototype.renameElem = function(name) {
/**
* Add attribute.
*
* @param {Object} attr attribute object
* @return {Object} created attribute
* @param {Object} [attr={}] attribute object
* @return {Object|Boolean} created attribute or false if no attr was passed in
*/
JSAPI.prototype.addAttr = function(attr) {
attr = attr || {};

if (!attr ||
(attr && attr.name === undefined) ||
(attr && attr.value === undefined) ||
(attr && attr.prefix === undefined) ||
(attr && attr.local === undefined)
if (attr.name === undefined ||
attr.value === undefined ||
attr.prefix === undefined ||
attr.local === undefined
) return false;

this.attrs = this.attrs || {};
Expand Down

0 comments on commit 9abb467

Please sign in to comment.