From 84d3fe797d687247c15a2e8cfd7d25a5f122747b Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Mon, 15 Dec 2014 22:00:24 -0500 Subject: [PATCH] Removing unnecessary binds --- src/js/parser/javascript/base.js | 4 ++-- src/js/parser/javascript/charset.js | 8 ++++---- src/js/parser/javascript/match.js | 12 ++++++------ src/js/parser/javascript/match_fragment.js | 8 ++++---- src/js/parser/javascript/regexp.js | 4 ++-- src/js/parser/javascript/root.js | 4 ++-- src/js/regexper.js | 15 +++++++-------- 7 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/js/parser/javascript/base.js b/src/js/parser/javascript/base.js index 9ff877e..42a557a 100644 --- a/src/js/parser/javascript/base.js +++ b/src/js/parser/javascript/base.js @@ -124,11 +124,11 @@ export default { this.startRender(); return this._render() - .then((() => { + .then(() => { if (this.anchorDebug) { this.renderAnchor(); } - }).bind(this)) + }) .then(this.doneRender.bind(this)) .then(_.constant(this)); }, diff --git a/src/js/parser/javascript/charset.js b/src/js/parser/javascript/charset.js index 7f39174..72c2bcf 100644 --- a/src/js/parser/javascript/charset.js +++ b/src/js/parser/javascript/charset.js @@ -16,10 +16,10 @@ export default _.extend({}, Base, { this.partContainer = this.container.group(); - return Q.all(_.map(elements, (part => { + return Q.all(_.map(elements, part => { return part.render(this.partContainer.group()); - }).bind(this))) - .then((() => { + })) + .then(() => { this.spaceVertically(elements, { padding: 5 }); @@ -27,7 +27,7 @@ export default _.extend({}, Base, { return this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:', this.partContainer, { padding: 5 }); - }).bind(this)); + }); }, _getAnchor() { diff --git a/src/js/parser/javascript/match.js b/src/js/parser/javascript/match.js index d36e2fd..56b5724 100644 --- a/src/js/parser/javascript/match.js +++ b/src/js/parser/javascript/match.js @@ -21,12 +21,12 @@ export default _.extend({}, Base, { } if (start || end || parts.length !== 1) { - partPromises = _.map(parts, (function(part) { + partPromises = _.map(parts, part => { return part.render(this.container.group()); - }).bind(this)); + }); return Q.all(_([start, partPromises, end]).flatten().compact().value()) - .then(((items) => { + .then(items => { var prev, next, paths; this.items = items; @@ -35,7 +35,7 @@ export default _.extend({}, Base, { }); prev = this.normalizeBBox(_.first(items).getBBox()); - paths = _.map(items.slice(1), (item => { + paths = _.map(items.slice(1), item => { var path; next = this.normalizeBBox(item.getBBox()); @@ -43,11 +43,11 @@ export default _.extend({}, Base, { prev = next; return path; - }).bind(this)); + }); this.container.prepend( this.container.path(paths.join(''))); - }).bind(this)); + }); } else { return this.proxy(parts[0]); } diff --git a/src/js/parser/javascript/match_fragment.js b/src/js/parser/javascript/match_fragment.js index ed680ec..70f61a5 100644 --- a/src/js/parser/javascript/match_fragment.js +++ b/src/js/parser/javascript/match_fragment.js @@ -9,7 +9,7 @@ export default _.extend({}, Base, { return this.proxy(this._content); } else { return this._content.render(this.container.group()) - .then((() => { + .then(() => { var box, paths = []; this._content.transform(this._repeat.contentPosition()); @@ -41,8 +41,8 @@ export default _.extend({}, Base, { this.container.prepend( this.container.path(paths.join(''))); } - }).bind(this)) - .then((() => { + }) + .then(() => { var labelStr = this._repeat.label(), label, labelBox, @@ -56,7 +56,7 @@ export default _.extend({}, Base, { label.transform(Snap.matrix() .translate(box.x2 - labelBox.width - labelShift, box.y2 + labelBox.height)); } - }).bind(this)); + }); } }, diff --git a/src/js/parser/javascript/regexp.js b/src/js/parser/javascript/regexp.js index 89c8b11..c27d26f 100644 --- a/src/js/parser/javascript/regexp.js +++ b/src/js/parser/javascript/regexp.js @@ -20,7 +20,7 @@ export default _.extend({}, Base, { return Q.all(_.map(matches, match => { return match.render(matchContainer.group()); })) - .then((() => { + .then(() => { var containerBox, paths; @@ -44,7 +44,7 @@ export default _.extend({}, Base, { return `M0,${box.ay}h${box.ax}M${box.ax2},${box.ay}H${container.width}`; }).join(''))); - }).bind(this)); + }); } }, diff --git a/src/js/parser/javascript/root.js b/src/js/parser/javascript/root.js index 20500d5..edc8580 100644 --- a/src/js/parser/javascript/root.js +++ b/src/js/parser/javascript/root.js @@ -13,7 +13,7 @@ export default _.extend({}, Base, { .attr({ r: 5 }); return this.regexp.render(this.container.group()) - .then((() => { + .then(() => { var box; this.regexp.transform(Snap.matrix() @@ -28,7 +28,7 @@ export default _.extend({}, Base, { this.container.prepend( this.container.path(`M${box.ax},${box.ay}H0M${box.ax2},${box.ay}H${box.x2 + 10}`)); - }).bind(this)); + }); }, flags() { diff --git a/src/js/regexper.js b/src/js/regexper.js index d34092c..3d23ec3 100644 --- a/src/js/regexper.js +++ b/src/js/regexper.js @@ -60,10 +60,10 @@ export default class Regexper { this.setState('is-loading'); this.renderRegexp(expression.replace(/[\r\n]/g, '')) - .then((() => { + .then(() => { this.setState('has-results'); this.updateLinks(); - }).bind(this)) + }) .done(); } } @@ -119,8 +119,7 @@ export default class Regexper { } renderRegexp(expression) { - var snap = Snap(this.svg), - padding = this.padding; + var snap = Snap(this.svg); snap.selectAll('g').remove(); @@ -129,15 +128,15 @@ export default class Regexper { return Q.fcall(parser.parse.bind(parser), expression) .then(null, this.showError.bind(this)) .invoke('render', snap.group()) - .then((result) => { + .then(result => { var box; box = result.getBBox(); result.container.transform(Snap.matrix() - .translate(padding - box.x, padding - box.y)); + .translate(this.padding - box.x, this.padding - box.y)); snap.attr({ - width: box.width + padding * 2, - height: box.height + padding * 2 + width: box.width + this.padding * 2, + height: box.height + this.padding * 2 }); }); }