KeyValueCollection

KeyValueCollection

KeyValueCollection represents keys and values parsed from manifests and tag files. Manifest data should use the file path as the key and the checksum as the value. There should be only one entry for each file in a manifest.

Tag file data should use the tag name as the key and the tag value as the value. Each tag may appear multiple times in a tag file, so tag names may have multiple values. This collection preserves the order of those values.

Constructor

new KeyValueCollection()

Source:

Methods

add(key, value)

Adds a key with the specified value to the collection. You may add a key multiple times, and all values will be stored in the order they were added.

Parameters:
Name Type Description
key string
value string
Source:

all(key) → {Array}

all returns all values for a key as an array of strings, or null, which indicates the key is not present at all. Use this when reading data parsed from tag files, where tags may appear multiple times and have multiple values.

Parameters:
Name Type Description
key string
Source:

first(key) → {*}

first returns the first value for the key, or null if the key is not found. Use this to when reading data parsed from manifests.

Parameters:
Name Type Description
key string
Source:

keys() → {Array}

keys returns all keys in the collection

Source:

sortedKeys() → {Array}

Returns all the keys in sorted order.

Source: