From 0611b0c7fc1c94380e420994e97a418317005bad Mon Sep 17 00:00:00 2001 From: Jakob Miland Date: Mon, 17 Jun 2013 11:44:33 +0200 Subject: [PATCH] kStepNumber should contain numbers instead of strings --- src/chord.js | 2 +- src/core.js | 22 +++++++++++----------- src/scale.js | 4 +--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/chord.js b/src/chord.js index 7407ee1..972c6a2 100644 --- a/src/chord.js +++ b/src/chord.js @@ -393,7 +393,7 @@ TeoriaChord.prototype = { interval = kStepNumber[interval]; for (i = 0, length = intervals.length; i < length; i++) { - if (intervals[i].interval === +interval) { + if (intervals[i].interval === interval) { return teoria.interval.from(this.root, intervals[i]); } } diff --git a/src/core.js b/src/core.js index c3aa552..248c0ff 100644 --- a/src/core.js +++ b/src/core.js @@ -219,17 +219,17 @@ }; var kStepNumber = { - 'first': '1', - 'tonic': '1', - 'second': '2', - 'third': '3', - 'fourth': '4', - 'fifth': '5', - 'sixth': '6', - 'seventh': '7', - 'ninth': '9', - 'eleventh': '11', - 'thirteenth': '13' + 'first': 1, + 'tonic': 1, + 'second': 2, + 'third': 3, + 'fourth': 4, + 'fifth': 5, + 'sixth': 6, + 'seventh': 7, + 'ninth': 9, + 'eleventh': 11, + 'thirteenth': 13 }; // Adjusted Shearer syllables - Chromatic solfege system diff --git a/src/scale.js b/src/scale.js index 35c0959..d5896a1 100644 --- a/src/scale.js +++ b/src/scale.js @@ -52,9 +52,7 @@ TeoriaScale.prototype = { }, get: function(i) { - if (typeof i === 'string' && i in kStepNumber) { - i = parseInt(kStepNumber[i], 10); - } + i = (typeof i === 'string' && i in kStepNumber) ? kStepNumber[i] : i; return this.notes[i - 1]; },