checks if part is array

This commit is contained in:
Yotam Mann 2014-09-06 15:37:15 -04:00
parent a01dbb8518
commit 2016778123

View file

@ -132,6 +132,7 @@ define(["Tone/core/Tone", "Tone/core/Transport"], function(Tone){
var notes = [];
for (var inst in score){
var part = score[inst];
if (Array.isArray(part)){
for (var i = 0; i < part.length; i++){
var noteDescription = part[i];
var note;
@ -144,6 +145,9 @@ define(["Tone/core/Tone", "Tone/core/Transport"], function(Tone){
}
notes.push(note);
}
} else {
throw new TypeError("score parts must be Arrays");
}
}
return notes;
};