chordsheetjs 7.3.1 → 7.6.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/README.md CHANGED
@@ -639,9 +639,9 @@ If not, it returns [INDETERMINATE](#INDETERMINATE)</p>
639
639
  * [.clone()](#Song+clone) ⇒ [<code>Song</code>](#Song)
640
640
  * [.setKey(key)](#Song+setKey) ⇒ [<code>Song</code>](#Song)
641
641
  * [.setCapo(capo)](#Song+setCapo) ⇒ [<code>Song</code>](#Song)
642
- * [.transpose(delta)](#Song+transpose) ⇒ [<code>Song</code>](#Song)
643
- * [.transposeUp()](#Song+transposeUp) ⇒ [<code>Song</code>](#Song)
644
- * [.transposeDown()](#Song+transposeDown) ⇒ [<code>Song</code>](#Song)
642
+ * [.transpose(delta, [options])](#Song+transpose) ⇒ [<code>Song</code>](#Song)
643
+ * [.transposeUp([options])](#Song+transposeUp) ⇒ [<code>Song</code>](#Song)
644
+ * [.transposeDown([options])](#Song+transposeDown) ⇒ [<code>Song</code>](#Song)
645
645
  * [.changeKey(newKey)](#Song+changeKey) ⇒ [<code>Song</code>](#Song)
646
646
  * [.changeMetadata(name, value)](#Song+changeMetadata)
647
647
  * [.mapItems(func)](#Song+mapItems) ⇒ [<code>Song</code>](#Song)
@@ -729,7 +729,7 @@ if you want to skip the &quot;header lines&quot;: the lines that only contain me
729
729
 
730
730
  <a name="Song+transpose"></a>
731
731
 
732
- ### song.transpose(delta) ⇒ [<code>Song</code>](#Song)
732
+ ### song.transpose(delta, [options]) ⇒ [<code>Song</code>](#Song)
733
733
  <p>Transposes the song by the specified delta. It will:</p>
734
734
  <ul>
735
735
  <li>transpose all chords, see: [transpose](#Chord+transpose)</li>
@@ -740,13 +740,15 @@ if you want to skip the &quot;header lines&quot;: the lines that only contain me
740
740
  **Kind**: instance method of [<code>Song</code>](#Song)
741
741
  **Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
742
742
 
743
- | Param | Type | Description |
744
- | --- | --- | --- |
745
- | delta | <code>number</code> | <p>The number of semitones (positive or negative) to transpose with</p> |
743
+ | Param | Type | Default | Description |
744
+ | --- | --- | --- | --- |
745
+ | delta | <code>number</code> | | <p>The number of semitones (positive or negative) to transpose with</p> |
746
+ | [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
747
+ | [options.normalizeChordSuffix] | <code>boolean</code> | <code>false</code> | <p>whether to normalize the chord suffixes after transposing</p> |
746
748
 
747
749
  <a name="Song+transposeUp"></a>
748
750
 
749
- ### song.transposeUp() ⇒ [<code>Song</code>](#Song)
751
+ ### song.transposeUp([options]) ⇒ [<code>Song</code>](#Song)
750
752
  <p>Transposes the song up by one semitone. It will:</p>
751
753
  <ul>
752
754
  <li>transpose all chords, see: [transpose](#Chord+transpose)</li>
@@ -756,9 +758,15 @@ if you want to skip the &quot;header lines&quot;: the lines that only contain me
756
758
 
757
759
  **Kind**: instance method of [<code>Song</code>](#Song)
758
760
  **Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
761
+
762
+ | Param | Type | Default | Description |
763
+ | --- | --- | --- | --- |
764
+ | [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
765
+ | [options.normalizeChordSuffix] | <code>boolean</code> | <code>false</code> | <p>whether to normalize the chord suffixes after transposing</p> |
766
+
759
767
  <a name="Song+transposeDown"></a>
760
768
 
761
- ### song.transposeDown() ⇒ [<code>Song</code>](#Song)
769
+ ### song.transposeDown([options]) ⇒ [<code>Song</code>](#Song)
762
770
  <p>Transposes the song down by one semitone. It will:</p>
763
771
  <ul>
764
772
  <li>transpose all chords, see: [transpose](#Chord+transpose)</li>
@@ -768,6 +776,12 @@ if you want to skip the &quot;header lines&quot;: the lines that only contain me
768
776
 
769
777
  **Kind**: instance method of [<code>Song</code>](#Song)
770
778
  **Returns**: [<code>Song</code>](#Song) - <p>The transposed song</p>
779
+
780
+ | Param | Type | Default | Description |
781
+ | --- | --- | --- | --- |
782
+ | [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
783
+ | [options.normalizeChordSuffix] | <code>boolean</code> | <code>false</code> | <p>whether to normalize the chord suffixes after transposing</p> |
784
+
771
785
  <a name="Song+changeKey"></a>
772
786
 
773
787
  ### song.changeKey(newKey) ⇒ [<code>Song</code>](#Song)
@@ -1188,7 +1202,7 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p>
1188
1202
  * [.toNumericString([key])](#Chord+toNumericString) ⇒ <code>string</code>
1189
1203
  * [.isNumeral()](#Chord+isNumeral) ⇒ <code>boolean</code>
1190
1204
  * [.toString()](#Chord+toString) ⇒ <code>string</code>
1191
- * [.normalize()](#Chord+normalize) ⇒ [<code>Chord</code>](#Chord)
1205
+ * [.normalize([key], [options])](#Chord+normalize) ⇒ [<code>Chord</code>](#Chord)
1192
1206
  * [.useModifier(newModifier)](#Chord+useModifier) ⇒ [<code>Chord</code>](#Chord)
1193
1207
  * [.transposeUp()](#Chord+transposeUp) ⇒ [<code>Chord</code>](#Chord)
1194
1208
  * [.transposeDown()](#Chord+transposeDown) ⇒ [<code>Chord</code>](#Chord)
@@ -1312,7 +1326,7 @@ For example, a chord symbol A# with reference key E will return the numeric chor
1312
1326
  **Returns**: <code>string</code> - <p>the chord string</p>
1313
1327
  <a name="Chord+normalize"></a>
1314
1328
 
1315
- ### chord.normalize() ⇒ [<code>Chord</code>](#Chord)
1329
+ ### chord.normalize([key], [options]) ⇒ [<code>Chord</code>](#Chord)
1316
1330
  <p>Normalizes the chord root and bass notes:</p>
1317
1331
  <ul>
1318
1332
  <li>Fb becomes E</li>
@@ -1324,11 +1338,19 @@ For example, a chord symbol A# with reference key E will return the numeric chor
1324
1338
  <li>7# becomes 1</li>
1325
1339
  <li>3# becomes 4</li>
1326
1340
  </ul>
1327
- <p>Besides that it normalizes the suffix. For example, <code>sus2</code> becomes <code>2</code>, <code>sus4</code> becomes <code>sus</code>.
1341
+ <p>Besides that it normalizes the suffix if <code>normalizeSuffix</code> is <code>true</code>.
1342
+ For example, <code>sus2</code> becomes <code>2</code>, <code>sus4</code> becomes <code>sus</code>.
1328
1343
  All suffix normalizations can be found in <code>src/normalize_mappings/suffix-mapping.txt</code>.</p>
1329
1344
 
1330
1345
  **Kind**: instance method of [<code>Chord</code>](#Chord)
1331
1346
  **Returns**: [<code>Chord</code>](#Chord) - <p>the normalized chord</p>
1347
+
1348
+ | Param | Type | Default | Description |
1349
+ | --- | --- | --- | --- |
1350
+ | [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the key to normalize to</p> |
1351
+ | [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
1352
+ | [options.normalizeSuffix] | <code>boolean</code> | <code>true</code> | <p>whether to normalize the chord suffix after transposing</p> |
1353
+
1332
1354
  <a name="Chord+useModifier"></a>
1333
1355
 
1334
1356
  ### chord.useModifier(newModifier) ⇒ [<code>Chord</code>](#Chord)
package/lib/bundle.js CHANGED
@@ -42,10 +42,6 @@ $parcel$export(module.exports, "NONE", () => $af8d31735c159a26$export$c53d0f541b
42
42
  $parcel$export(module.exports, "TAB", () => $af8d31735c159a26$export$f1c9dd0f5207dd5e);
43
43
  $parcel$export(module.exports, "SYMBOL", () => $af8d31735c159a26$export$27c95a7104c1f7aa);
44
44
  $parcel$export(module.exports, "NUMERIC", () => $af8d31735c159a26$export$4d318981b5a83836);
45
- // Generated by peggy v. 1.2.0 (ts-pegjs plugin v. 1.2.2 )
46
- //
47
- // https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
48
- "use strict";
49
45
  function $1a506a341538d943$var$peg$padEnd(str, targetLength, padString) {
50
46
  padString = padString || " ";
51
47
  if (str.length > targetLength) return str;
@@ -144,9 +140,7 @@ function $1a506a341538d943$var$peg$parse(input, options) {
144
140
  options = options !== undefined ? options : {};
145
141
  const peg$FAILED = {};
146
142
  const peg$source = options.grammarSource;
147
- const peg$startRuleFunctions = {
148
- ChordSheet: peg$parseChordSheet
149
- };
143
+ const peg$startRuleFunctions = {};
150
144
  let peg$startRuleFunction = peg$parseChordSheet;
151
145
  const peg$c0 = function(lines, line) {
152
146
  return {
@@ -1800,7 +1794,12 @@ class $8fcf445ea0999053$var$Note {
1800
1794
  return this._note;
1801
1795
  }
1802
1796
  toString() {
1803
- return `${this.note}`;
1797
+ switch(this.type){
1798
+ case 0, $af8d31735c159a26$export$1321df9b16c30c6a:
1799
+ return `${this.minor ? this.note.toLowerCase() : this.note.toUpperCase()}`;
1800
+ default:
1801
+ return `${this.note}`;
1802
+ }
1804
1803
  }
1805
1804
  set(attributes) {
1806
1805
  return new $8fcf445ea0999053$var$Note({
@@ -2029,6 +2028,7 @@ class $bff5407e03fdc8ee$var$Key {
2029
2028
  this.note = note instanceof (0, $8fcf445ea0999053$export$2e2bcd8739ae039) ? note : (0, $8fcf445ea0999053$export$2e2bcd8739ae039).parse(note);
2030
2029
  this.modifier = modifier || null;
2031
2030
  this.minor = !!minor || false;
2031
+ if (this.minor) this.note.minor = true;
2032
2032
  }
2033
2033
  isMinor() {
2034
2034
  return this.minor || this.note.isMinor();
@@ -2079,8 +2079,25 @@ class $bff5407e03fdc8ee$var$Key {
2079
2079
  toNumeralString(key = null) {
2080
2080
  return this.toNumeral(key).toString();
2081
2081
  }
2082
- toString() {
2083
- if (this.isChordSymbol()) return `${this.note}${this.modifier || ""}`;
2082
+ toString({ showMinor: showMinor = true } = {}) {
2083
+ switch(this.note.type){
2084
+ case 0, $af8d31735c159a26$export$27c95a7104c1f7aa:
2085
+ return this.formatChordSymbolString(showMinor);
2086
+ case 0, $af8d31735c159a26$export$4d318981b5a83836:
2087
+ return this.formatNumericString(showMinor);
2088
+ case 0, $af8d31735c159a26$export$1321df9b16c30c6a:
2089
+ return this.formatNumeralString();
2090
+ default:
2091
+ throw new Error(`Unexpected note type ${this.note.type}`);
2092
+ }
2093
+ }
2094
+ formatChordSymbolString(showMinor) {
2095
+ return `${this.note}${this.modifier || ""}${this.minor && showMinor ? "m" : ""}`;
2096
+ }
2097
+ formatNumericString(showMinor) {
2098
+ return `${this.modifier || ""}${this.note}${this.minor && showMinor ? "m" : ""}`;
2099
+ }
2100
+ formatNumeralString() {
2084
2101
  return `${this.modifier || ""}${this.note}`;
2085
2102
  }
2086
2103
  transpose(delta) {
@@ -2145,9 +2162,13 @@ class $bff5407e03fdc8ee$var$Key {
2145
2162
  }
2146
2163
  normalizeEnharmonics(key) {
2147
2164
  if (key) {
2148
- const rootKeyString = key.minor ? `${key}m` : key.toString();
2165
+ const rootKeyString = $bff5407e03fdc8ee$var$Key.wrap(key).toString({
2166
+ showMinor: true
2167
+ });
2149
2168
  const enharmonics = (0, $6ebb068142750218$export$2e2bcd8739ae039)[rootKeyString];
2150
- const thisKeyString = this.toString();
2169
+ const thisKeyString = this.toString({
2170
+ showMinor: false
2171
+ });
2151
2172
  if (enharmonics && enharmonics[thisKeyString]) return $bff5407e03fdc8ee$var$Key.parse(enharmonics[thisKeyString]);
2152
2173
  }
2153
2174
  return this.clone();
@@ -3088,7 +3109,7 @@ var $e12151f977ef7bf6$export$2e2bcd8739ae039 = $e12151f977ef7bf6$var$mapping;
3088
3109
 
3089
3110
 
3090
3111
 
3091
- function $26f57998457eb2d4$var$normalizeSuffix(suffix) {
3112
+ function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
3092
3113
  if ((0, $e12151f977ef7bf6$export$2e2bcd8739ae039)[suffix] === "[blank]") return null;
3093
3114
  return (0, $e12151f977ef7bf6$export$2e2bcd8739ae039)[suffix] || suffix;
3094
3115
  }
@@ -3135,7 +3156,7 @@ const $26f57998457eb2d4$var$regexes = [
3135
3156
  const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
3136
3157
  const rootKey = this.root.toChordSymbol(keyObj).normalizeEnharmonics(keyObj);
3137
3158
  let chordSymbolChord = new $26f57998457eb2d4$var$Chord({
3138
- suffix: $26f57998457eb2d4$var$normalizeSuffix(this.suffix),
3159
+ suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
3139
3160
  root: rootKey,
3140
3161
  bass: this.bass?.toChordSymbol(keyObj).normalizeEnharmonics(rootKey)
3141
3162
  });
@@ -3171,7 +3192,7 @@ const $26f57998457eb2d4$var$regexes = [
3171
3192
  });
3172
3193
  const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
3173
3194
  return new $26f57998457eb2d4$var$Chord({
3174
- suffix: $26f57998457eb2d4$var$normalizeSuffix(this.suffix),
3195
+ suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
3175
3196
  root: this.root.toNumeric(keyObj),
3176
3197
  bass: this.bass?.toNumeric(keyObj)
3177
3198
  });
@@ -3189,7 +3210,7 @@ const $26f57998457eb2d4$var$regexes = [
3189
3210
  });
3190
3211
  const keyObj = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(key);
3191
3212
  return new $26f57998457eb2d4$var$Chord({
3192
- suffix: $26f57998457eb2d4$var$normalizeSuffix(this.suffix),
3213
+ suffix: $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix),
3193
3214
  root: this.root.toNumeral(keyObj),
3194
3215
  bass: this.bass?.toNumeral(keyObj)
3195
3216
  });
@@ -3228,7 +3249,9 @@ const $26f57998457eb2d4$var$regexes = [
3228
3249
  * Converts the chord to a string, eg `Esus4/G#` or `1sus4/#3`
3229
3250
  * @returns {string} the chord string
3230
3251
  */ toString() {
3231
- const chordString = this.root.toString() + (this.suffix || "");
3252
+ const chordString = this.root.toString({
3253
+ showMinor: false
3254
+ }) + (this.suffix || "");
3232
3255
  if (this.bass) return `${chordString}/${this.bass.toString()}`;
3233
3256
  return chordString;
3234
3257
  }
@@ -3243,17 +3266,21 @@ const $26f57998457eb2d4$var$regexes = [
3243
3266
  * - 7# becomes 1
3244
3267
  * - 3# becomes 4
3245
3268
  *
3246
- * Besides that it normalizes the suffix. For example, `sus2` becomes `2`, `sus4` becomes `sus`.
3269
+ * Besides that it normalizes the suffix if `normalizeSuffix` is `true`.
3270
+ * For example, `sus2` becomes `2`, `sus4` becomes `sus`.
3247
3271
  * All suffix normalizations can be found in `src/normalize_mappings/suffix-mapping.txt`.
3248
- *
3272
+ * @param {Key|string} [key=null] the key to normalize to
3273
+ * @param {Object} [options={}] options
3274
+ * @param {boolean} [options.normalizeSuffix=true] whether to normalize the chord suffix after transposing
3249
3275
  * @returns {Chord} the normalized chord
3250
- */ normalize(key = null) {
3276
+ */ normalize(key = null, { normalizeSuffix: normalizeSuffix = true } = {}) {
3277
+ const suffix = normalizeSuffix ? $26f57998457eb2d4$var$normalizeChordSuffix(this.suffix) : this.suffix;
3251
3278
  if ((0, $21a34a464e7bc609$export$7ee701e290d9865)(key)) return this.process("normalize").set({
3252
- suffix: (0, $21a34a464e7bc609$export$ed9b06b5ee264ad3)($26f57998457eb2d4$var$normalizeSuffix(this.suffix))
3279
+ suffix: suffix
3253
3280
  });
3254
3281
  return this.set({
3282
+ suffix: suffix,
3255
3283
  root: this.root.normalizeEnharmonics(key),
3256
- suffix: (0, $21a34a464e7bc609$export$ed9b06b5ee264ad3)($26f57998457eb2d4$var$normalizeSuffix(this.suffix)),
3257
3284
  bass: this.bass ? this.bass.normalizeEnharmonics(this.root.toString()) : null
3258
3285
  });
3259
3286
  }
@@ -3285,16 +3312,17 @@ const $26f57998457eb2d4$var$regexes = [
3285
3312
  }
3286
3313
  constructor({ base: base = null , modifier: modifier = null , suffix: suffix = null , bassBase: bassBase = null , bassModifier: bassModifier = null , root: root = null , bass: bass = null , }){
3287
3314
  this.suffix = (0, $21a34a464e7bc609$export$ed9b06b5ee264ad3)(suffix);
3315
+ const isMinor = suffix && suffix[0] === "m" && suffix.substring(0, 3).toLowerCase() !== "maj";
3288
3316
  this.root = root || new (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039)({
3289
3317
  note: base,
3290
3318
  modifier: modifier,
3291
- minor: suffix === "m"
3319
+ minor: isMinor
3292
3320
  });
3293
3321
  if (bass) this.bass = bass;
3294
3322
  else if (bassBase) this.bass = new (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039)({
3295
3323
  note: bassBase,
3296
3324
  modifier: bassModifier,
3297
- minor: suffix === "m"
3325
+ minor: isMinor
3298
3326
  });
3299
3327
  else this.bass = null;
3300
3328
  }
@@ -3374,11 +3402,13 @@ var $26f57998457eb2d4$export$2e2bcd8739ae039 = $26f57998457eb2d4$var$Chord;
3374
3402
  lyrics: lyrics
3375
3403
  });
3376
3404
  }
3377
- transpose(delta, key = null) {
3405
+ transpose(delta, key = null, { normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
3378
3406
  const chordObj = (0, $26f57998457eb2d4$export$2e2bcd8739ae039).parse(this.chords);
3379
3407
  if (chordObj) {
3380
3408
  let transposedChord = chordObj.transpose(delta);
3381
- if (key) transposedChord = transposedChord.normalize(key);
3409
+ if (key) transposedChord = transposedChord.normalize(key, {
3410
+ normalizeSuffix: normalizeChordSuffix
3411
+ });
3382
3412
  return this.set({
3383
3413
  chords: transposedChord.toString()
3384
3414
  });
@@ -3466,7 +3496,6 @@ const $5e9ede69210ec54a$var$ALIASES = {
3466
3496
  [$5e9ede69210ec54a$var$END_OF_TAB_SHORT]: $5e9ede69210ec54a$export$66a0ef3ffeab32b7,
3467
3497
  [$5e9ede69210ec54a$var$NEW_KEY_SHORT]: $5e9ede69210ec54a$export$b7627374a6424f68
3468
3498
  };
3469
- const $5e9ede69210ec54a$var$META_TAG_REGEX = /^meta:\s*([^:\s]+)(\s*(.+))?$/;
3470
3499
  const $5e9ede69210ec54a$var$TAG_REGEX = /^([^:\s]+)(:?\s*(.+))?$/;
3471
3500
  const $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX = /^x_(.+)$/;
3472
3501
  function $5e9ede69210ec54a$export$3ef04055cb4a269a(tagName) {
@@ -3481,14 +3510,25 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
3481
3510
  /**
3482
3511
  * Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/
3483
3512
  */ class $5e9ede69210ec54a$var$Tag extends (0, $cf00b4d3af89fa07$export$2e2bcd8739ae039) {
3513
+ _isMetaTag = false;
3484
3514
  constructor(name, value = "", traceInfo = null){
3485
3515
  super(traceInfo);
3486
- this.name = name;
3487
- this.value = value || "";
3516
+ this.parseNameValue(name, value);
3517
+ }
3518
+ parseNameValue(name, value) {
3519
+ if (name === "meta") {
3520
+ const [metaName, metaValue] = value.split(/\s(.+)/);
3521
+ this.name = metaName;
3522
+ this.value = metaValue || "";
3523
+ this._isMetaTag = true;
3524
+ } else {
3525
+ this.name = name;
3526
+ this.value = value || "";
3527
+ }
3488
3528
  }
3489
3529
  static parse(tag) {
3490
3530
  if (tag instanceof $5e9ede69210ec54a$var$Tag) return tag;
3491
- return this.parseWithRegex(tag, $5e9ede69210ec54a$var$META_TAG_REGEX) || this.parseWithRegex(tag, $5e9ede69210ec54a$var$TAG_REGEX);
3531
+ return this.parseWithRegex(tag, $5e9ede69210ec54a$var$TAG_REGEX);
3492
3532
  }
3493
3533
  static parseWithRegex(tag, regex) {
3494
3534
  const matches = tag.match(regex);
@@ -3540,7 +3580,7 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
3540
3580
  * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`)
3541
3581
  * @returns {boolean}
3542
3582
  */ isMetaTag() {
3543
- return $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $5e9ede69210ec54a$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
3583
+ return this._isMetaTag || $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $5e9ede69210ec54a$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
3544
3584
  }
3545
3585
  /**
3546
3586
  * Returns a clone of the tag.
@@ -4141,8 +4181,10 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
4141
4181
  * - transpose the song key in {@link metadata}
4142
4182
  * - update any existing `key` directive
4143
4183
  * @param {number} delta The number of semitones (positive or negative) to transpose with
4184
+ * @param {Object} [options={}] options
4185
+ * @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
4144
4186
  * @returns {Song} The transposed song
4145
- */ transpose(delta) {
4187
+ */ transpose(delta, { normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
4146
4188
  const wrappedKey = (0, $bff5407e03fdc8ee$export$2e2bcd8739ae039).wrap(this.key);
4147
4189
  let transposedKey = null;
4148
4190
  let song = this;
@@ -4151,7 +4193,9 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
4151
4193
  song = song.setKey(transposedKey);
4152
4194
  }
4153
4195
  return song.mapItems((item)=>{
4154
- if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return item.transpose(delta, transposedKey);
4196
+ if (item instanceof (0, $d454f4215ba01af2$export$2e2bcd8739ae039)) return item.transpose(delta, transposedKey, {
4197
+ normalizeChordSuffix: normalizeChordSuffix
4198
+ });
4155
4199
  return item;
4156
4200
  });
4157
4201
  }
@@ -4160,18 +4204,26 @@ var $ce1dd7d0f2cd2369$export$2e2bcd8739ae039 = $ce1dd7d0f2cd2369$var$ParserWarni
4160
4204
  * - transpose all chords, see: {@link Chord#transpose}
4161
4205
  * - transpose the song key in {@link metadata}
4162
4206
  * - update any existing `key` directive
4207
+ * @param {Object} [options={}] options
4208
+ * @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
4163
4209
  * @returns {Song} The transposed song
4164
- */ transposeUp() {
4165
- return this.transpose(1);
4210
+ */ transposeUp({ normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
4211
+ return this.transpose(1, {
4212
+ normalizeChordSuffix: normalizeChordSuffix
4213
+ });
4166
4214
  }
4167
4215
  /**
4168
4216
  * Transposes the song down by one semitone. It will:
4169
4217
  * - transpose all chords, see: {@link Chord#transpose}
4170
4218
  * - transpose the song key in {@link metadata}
4171
4219
  * - update any existing `key` directive
4220
+ * @param {Object} [options={}] options
4221
+ * @param {boolean} [options.normalizeChordSuffix=false] whether to normalize the chord suffixes after transposing
4172
4222
  * @returns {Song} The transposed song
4173
- */ transposeDown() {
4174
- return this.transpose(-1);
4223
+ */ transposeDown({ normalizeChordSuffix: normalizeChordSuffix = false } = {}) {
4224
+ return this.transpose(-1, {
4225
+ normalizeChordSuffix: normalizeChordSuffix
4226
+ });
4175
4227
  }
4176
4228
  /**
4177
4229
  * Returns a copy of the song with the key set to the specified key. It changes: