chordsheetjs
    Preparing search index...

    Class Metadata

    Stores song metadata. Properties can be accessed using the get() method:

    const metadata = new Metadata({ author: 'John' }); metadata.get('author') // => 'John'

    See Metadata#get

    Hierarchy

    • MetadataAccessors
      • Metadata
    Index

    Methods

    Methods

    • Reads a metadata value by key. This method supports simple value lookup, as well as fetching single array values.

      This method deprecates direct property access, eg: metadata['author']

      Parameters

      • prop: string

        the property name

      Returns null | string | string[]

      the metadata value(s). If there is only one value, it will return a String, else it returns an array of strings.

      const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] });
      metadata.get('lyricist') // => 'Pete'
      metadata.get('author') // => ['John', 'Mary']
      metadata.get('author.1') // => 'John'
      metadata.get('author.2') // => 'Mary'

      Using a negative index will start counting at the end of the list:

      const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] });
      metadata.get('author.-1') // => 'Mary'
      metadata.get('author.-2') // => 'John'