packages/extension-map/lib/hashmap_extension.js
/**
 * Invert the value by finding the hash key that matches the value
 * This assumes key/value pairs are unique
 *
 * @param hash hash object whose attributes should be traversed.
 * @param value scalar value to look for
 */
Invert the value by finding the hash key that matches the value
This assumes key/value pairs are unique

@param hash hash object whose attributes should be traversed.
@param value scalar value to look for
Invert the value by finding the hash key that matches the value This assumes key / value pairs are unique @param hash hash object whose attributes should be traversed . @param value scalar value to look for
function invert(hash, value) {
   const key = Object.keys(hash).find(key => value === hash[key])
   if (!key)
       throw Error("Hashmap extension was unable to invert the value " 
                   + value + " with map " + JSON.stringify(hash, {depth: null}) +"!");
   return key;
}
function invert ( hash , value ) { const key = Object . keys ( hash ) . find ( key => value === hash [ key ] ) if ( ! key ) throw Error ( "Hashmap extension was unable to invert the value " + value + " with map " + JSON . stringify ( hash , { depth : null } ) + "!" ) ; return key ; }
Invert the value by finding the hash key that matches the value
 This assumes key/value pairs are unique
Invert the value by finding the hash key that matches the value This assumes key / value pairs are unique