Closed saebekassebil closed 12 years ago
+1. I like this approach alot. It combines two methods into one and takes advantage of falsyness in javascript.
Looks good. I like the dual-functionality. As long as it's documented in the readme, I don't think there should be any problems.
Thanks.
In response to the feature request in Issue #12 I came up with this method which is a mixture of the proposed
TeoriaNote#isScaleDegree
andTeoriaNote#getScaleDegree
.The new method
TeoriaNote#scaleDegree(scale)
returns the scale degree of a note, given a scale. Its syntax is much like the other methods of the framework:The "clever" thing here is that notes that aren't in the scale will return 0, and in JavaScript 0 evaluates to
false
in a Boolean context, so that this method can be used just as aisScaleDegree
method would be, e.g.:I'm not quite sure however if this should be exploited, and I'd like a little feedback on this, and to hear if there's any objections against this.
@LukeHorvat, @GregJ - You guys have been active lately, any thoughts about this?