@dsebastien/music-notation 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tab/index.js CHANGED
@@ -191,6 +191,21 @@ function parseTuning(text) {
191
191
  }
192
192
  return midis;
193
193
  }
194
+ function tuningNames(text) {
195
+ const trimmed = text.trim();
196
+ const named = NAMED.get(trimmed.toLowerCase().replace(/\s*\(.*\)$/, ""));
197
+ if (named)
198
+ return tuningNames(named);
199
+ if (!parseTuning(trimmed))
200
+ return null;
201
+ const spaced = trimmed.split(/[\s,]+/).filter(Boolean);
202
+ const names = spaced.length > 1 ? spaced : trimmed.match(/[A-G][#♯b♭]?|[a-g][#♯♭]?/g) ?? [];
203
+ return names.map((n) => {
204
+ const letter = n.charAt(0).toUpperCase();
205
+ const accidental = n.slice(1).replace(/-?\d+$/, "").replace("♯", "#").replace("♭", "b");
206
+ return letter + accidental;
207
+ });
208
+ }
194
209
 
195
210
  // src/convert/text-tab.ts
196
211
  var STRING_PREFIX = /^\s*([A-Ga-g][#b]?|[1-8](?=\s*[|:]))?\s*[|:]?/;
@@ -2090,5 +2105,5 @@ export {
2090
2105
  textTabToAlphaTex
2091
2106
  };
2092
2107
 
2093
- //# debugId=2EE54AC69188D00D64756E2164756E21
2108
+ //# debugId=E85AD092947E6FCA64756E2164756E21
2094
2109
  //# sourceMappingURL=index.js.map