1.2.0 • Published 6 months ago

micro-chord-parser v1.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Install

npm i micro-chord-parser

Demonstrations

import {chordParser,
  textParser,
  htmlParser,
  sustainTransposer,
  bemolTransposer,
  weirdTransposer
} from "microChordParser.js"

var songs =
`Bb
Who breaks the power of sin and darkness
Eb
Whose love is mighty and so much stronger
Gm                     F               Eb
The king of glory, the king above all kings`

Testing the sustainTransposer function with textParser

console.log(textParser(sustainTransposer(chordParser(songs), 1)))
B
Who breaks the power of sin and darkness
E
Whose love is mighty and so much stronger
G#m                     F#               E
The king of glory, the king above all kings

Testing the bemolTransposer function with textParser

console.log(textParser(bemolTransposer(chordParser(songs), 1)))
B
Who breaks the power of sin and darkness
E
Whose love is mighty and so much stronger
Abm                     Gb               E
The king of glory, the king above all kings

Testing the sustainTransposer function with htmlParser

console.log(htmlParser(sustainTransposer(chordParser(songs))))
<div class="chord">
A#
<div class="letter">Who breaks the power of sin and darkness</div>
D#
<div class="letter">Whose love is mighty and so much stronger</div>
Gm                     F               D#
<div class="letter">The king of glory, the king above all kings</div>
</div>

Testing the bemolTransposer function with htmlParser

console.log(htmlParser(bemolTransposer(chordParser(songs))))
<div class="chord">
Bb
<div class="letter">Who breaks the power of sin and darkness</div>
Eb
<div class="letter">Whose love is mighty and so much stronger</div>
Gm                     F               Eb
<div class="letter">The king of glory, the king above all kings</div>
</div>

As you can see, I always transpose when parsing, as it is a way to correct the type of notation to be used. However, it is not necessary if no transposition is needed; it's more of a best practice.

1.2.0

6 months ago

1.1.0

7 months ago

1.0.0

7 months ago