humdrum-js

A Javascript parser for musical data in the Humdrum syntax

The HumdrumBase object is an interface for basic processing of Humdrum data. The class can read Humdrum data from URLs, URIs, elements, selectors, and text strings. Data is first split into lines, which are stored in HumdrumLine objects, and HumdrumLines are futher split into HumdrumToken objects.


Primary functions

clear — Intialize variables for object.
parse — Create obj. from input string, URL, URI, element, selector.
getLineCount — Return the number of line records in data.
getLine — Return a HumdrumLine object.
analyzeReferenceRecords — Create reference record database object.
stringify — Convert object to plain text.


Reference Records

getRefFirst — Get the first reference record matching key in data.
getRefAll — Get array of all keys of the given type.
getRefFirstExact — Get the first reference record that matches key plus qualifiers.
getRefAllExact — Get array of all keys of the given type that matches key plus qualifiers.
getAllRefs — Return a list of all references.
getRefs — Return a list of all references that match key list.
getComposerRefs — Return list of refs related to composers.
getOpusRefs — Return list of refs related to work.
expandAtTemplate — Expand template with ref records.


Variables

lines — Array of HumdrumLine objects for Humdrum data content.
refs — RefRecords object to manage reference records in Humdrum data.
ParseCount — Counter for HumdrumBase::parse() to avoid infinite loop situations.


Private functions

ParseUrl — Download data from URL.
ParseUriHumdrum — Download data from Humdrum URI.
ParseUriGithub — Download data from Github URI.
ParseText — Convert string to object contents.
ParseSelector — Extract data from element matching selector.
ParseElement — Extract data from element.
IsElement — Boolean test for HTML element.