Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chordsong

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chordsong - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

3

dist/Diagram.d.ts

@@ -15,6 +15,7 @@ export interface FretStrings {

chordVariant?: string;
chordRenderName?: string;
private _stringFrets;
readonly fretStrings: FretStrings;
private _fingersAndBarres;
constructor(parsedDiagram: string, chordName?: string, chordVariant?: string);
constructor(parsedDiagram: string, chordName?: string, chordVariant?: string, chordRenderName?: string);
get stringFrets(): number[];

@@ -21,0 +22,0 @@ set stringFrets(arr: number[]);

@@ -7,3 +7,3 @@ "use strict";

class Diagram {
constructor(parsedDiagram, chordName, chordVariant) {
constructor(parsedDiagram, chordName, chordVariant, chordRenderName) {
this._stringFrets = [];

@@ -14,2 +14,3 @@ this.fretStrings = {};

this.chordVariant = chordVariant;
this.chordRenderName = chordRenderName ?? chordName;
try {

@@ -16,0 +17,0 @@ this.fromStringFrets(parsedDiagram);

@@ -7,4 +7,7 @@ "use strict";

const SvgDiagram_1 = require("./SvgDiagram");
const regexChordName = '([A-G](?:[b#♭♯غ∆()+-]|[2-9]|1[0-3]|[Mm](?:aj)?|add|s(?:us)?|aug|d(?:im)?)*(?:\\/[A-G][b#♭♯]?)?)';
const regexChordShortName = regexChordName;
const regexChordLongName = regexChordName;
const chordsRegExFields = {
pattern: '(?:(?:\\b|^)(?:([A-G](?:[b#♭♯غ∆()+-]|[2-9]|1[0-3]|M(?:aj)?|m(?:aj)?|add|sus|aug|dim)*(?:\\/[A-G][b#♭♯]?)?)(?::(\\w+))?(?:\\[([x:/,\\-0-9]+)\\])?)|(?:\\[([x:/,\\-0-9]+)\\]))([\\t ]*)(\\/\\/.*)?',
pattern: `(?:(?:\\b|^)(?:${regexChordShortName}\\|)?(?:${regexChordLongName}(?::(\\w+))?(?:\\[([x:/,\\-0-9]+)\\])?)|(?:\\[([x:/,\\-0-9]+)\\]))([\\t ]*)(\\/\\/.*)?`,
flags: 'g'

@@ -29,4 +32,4 @@ };

this.parseDirectives();
this.parseLyricsComments();
this.parseChords();
this.parseLyricsComments();
}

@@ -70,7 +73,8 @@ get title() {

const index = lineIndex + (match.index ?? 0);
const width = match[0].length;
const chordName = match[1];
const chordVariant = match[2];
const chordDiagram = match[3];
const diagramOnly = match[4];
const width = match[0].length - (match[7]?.length ?? 0);
const chordName = match[1] ?? match[2];
const chordRenderName = match[2];
const chordVariant = match[3];
const chordDiagram = match[4];
const diagramOnly = match[5];
let replacement;

@@ -85,3 +89,3 @@ if (diagramOnly !== undefined) {

if (chordDiagram !== undefined) {
const diagram = new Diagram_1.Diagram(chordDiagram, chordName, chordVariant);
const diagram = new Diagram_1.Diagram(chordDiagram, chordRenderName, chordVariant);
chord.setDiagram(diagram, chordVariant);

@@ -158,3 +162,3 @@ this.replacements.push({ index, length: match[0].length, replacement: '' });

parseLyricsComments() {
const regEx = /\/\/(.*)$/gm;
const regEx = /\s\/\/(.*)$/gm;
const matches = this.text.matchAll(regEx);

@@ -161,0 +165,0 @@ let commentsFontSize = this.directive('comments-font-size');

{
"name": "chordsong",
"version": "1.0.4",
"version": "1.1.0",
"description": "ChordSong is a simple text format for the notation of lyrics with guitar chords, and an application that renders them to portable HTML pages.",

@@ -33,5 +33,5 @@ "keywords": [

"copyfiles": "^2.4.1",
"rimraf": "^3.0.2",
"ts-standard": "^11.0.0",
"typescript": "^4.6.2"
"rimraf": "^5.0.1",
"ts-standard": "^12.0.2",
"typescript": "^5.1.3"
},

@@ -45,4 +45,4 @@ "ts-standard": {

"@types/node": ">12.0.0",
"commander": "^9.0.0"
"commander": "^10.0.1"
}
}

@@ -132,2 +132,10 @@ # chordsong

If you want to use one name in the source file and to print a (likely greater) name on the diagram, you can add the optional long name after a `|`. For example, you can define the chord as:
```text
CM7|Cmaj7[x32000]
```
And then use the shortest `CM7` as the chord name, although `Cmaj7` will be printed in the diagram
### Lyrics with chord names

@@ -137,3 +145,3 @@

Comments can also be added to the text, and will be printed as comments in the html. Comments cannot be provided inline, and the comments line must start with `//`.
Comments can also be added to the text, and will be printed in the html.

@@ -140,0 +148,0 @@ Example:

@@ -17,2 +17,3 @@ export interface FretStrings {

chordVariant?: string
chordRenderName?: string
private _stringFrets: number[] = [] // array of pressed frets by string, starting by the thickest string.

@@ -22,5 +23,6 @@ readonly fretStrings: FretStrings = {} // list of strings pressed at a given fret.

constructor (parsedDiagram: string, chordName?: string, chordVariant?: string) {
constructor (parsedDiagram: string, chordName?: string, chordVariant?: string, chordRenderName?: string) {
this.chordName = chordName
this.chordVariant = chordVariant
this.chordRenderName = chordRenderName ?? chordName
try {

@@ -27,0 +29,0 @@ this.fromStringFrets(parsedDiagram)

@@ -7,10 +7,15 @@ import { Chord } from './Chord'

* group 0: match
* group 1: chordName
* group 2: chordVariant
* group 3: chordDiagram
* group 4: onlyDiagram
* group 5: right
* group 1: chordShortName
* group 2: chordName
* group 3: chordVariant
* group 4: chordDiagram
* group 5: onlyDiagram
* group 6: space until next diagram/comment/linebreak
* group 7: comment length (if any)
*/
const regexChordName = '([A-G](?:[b#♭♯غ∆()+-]|[2-9]|1[0-3]|[Mm](?:aj)?|add|s(?:us)?|aug|d(?:im)?)*(?:\\/[A-G][b#♭♯]?)?)'
const regexChordShortName = regexChordName
const regexChordLongName = regexChordName
const chordsRegExFields = {
pattern: '(?:(?:\\b|^)(?:([A-G](?:[b#♭♯غ∆()+-]|[2-9]|1[0-3]|M(?:aj)?|m(?:aj)?|add|sus|aug|dim)*(?:\\/[A-G][b#♭♯]?)?)(?::(\\w+))?(?:\\[([x:/,\\-0-9]+)\\])?)|(?:\\[([x:/,\\-0-9]+)\\]))([\\t ]*)(\\/\\/.*)?',
pattern: `(?:(?:\\b|^)(?:${regexChordShortName}\\|)?(?:${regexChordLongName}(?::(\\w+))?(?:\\[([x:/,\\-0-9]+)\\])?)|(?:\\[([x:/,\\-0-9]+)\\]))([\\t ]*)(\\/\\/.*)?`,
flags: 'g'

@@ -62,5 +67,5 @@ }

this.parseLyricsComments()
this.parseChords()
this.parseLyricsComments()
}

@@ -114,7 +119,8 @@

const index: number = lineIndex + (match.index ?? 0)
const width = match[0].length
const chordName = match[1]
const chordVariant = match[2]
const chordDiagram = match[3]
const diagramOnly = match[4]
const width = match[0].length - (match[7]?.length ?? 0) // I remove the comments length (if any comment at the end of the line)
const chordName = match[1] ?? match[2]
const chordRenderName = match[2]
const chordVariant = match[3]
const chordDiagram = match[4]
const diagramOnly = match[5]

@@ -130,3 +136,3 @@ let replacement: string

if (chordDiagram !== undefined) { // It's a chord definition
const diagram = new Diagram(chordDiagram, chordName, chordVariant)
const diagram = new Diagram(chordDiagram, chordRenderName, chordVariant)
chord.setDiagram(diagram, chordVariant)

@@ -204,3 +210,3 @@ this.replacements.push({ index, length: match[0].length, replacement: '' }) // remove it

parseLyricsComments (): void {
const regEx = /\/\/(.*)$/gm
const regEx = /\s\/\/(.*)$/gm
const matches = this.text.matchAll(regEx)

@@ -207,0 +213,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc