humdrum-js

A Javascript parser for musical data in the Humdrum syntax

The Convert object manages conversions between different datatypes for the humdrum-js library. It is inherited by HumdrumToken, HumdrumLine, and HumdrumBase for internal use in those objects. If you want to use the Convert functions directly, there are two primary methods:

The first method is to call the prototype functions of Convert directly, such as:

Convert.prototype.csvToTsv('a,b,c,d')

The second method is to create a Convert object and then use its prototype functions directly through that object:

var converter = new Convert();
converter.csvToTsv('a,b,c,d')

An alternative third method is to call the prototype functions indirectly through an object that inherits from Convert:

var line = new HumdrumLine();
line.csvToTsv('a,b,c,d')

However, this last way of accessing the functions is dangerous, since it is possible that the objects inheriting from Convert may re-define the function names for their own purposes, thus shadowing the original Convert prototypes.

Functions

csvToTsv — Convert a CSV string into a TSV string.
tsvToCsv — Convert a TSV string into a CSV string.


Private functions

These functions are helper functions for the main set of functions. In general they will not be interesting to use in isolation.

TokenToCsv — Quote-escape a string if necessary for CSV conversion.