es/ae/aens.js
function classify (s) {
  const keys = {
    ak: 'account_pubkey',
    ok: 'oracle_pubkey'
  }

  if (!s.match(/^[a-z]{2}_.+/)) {
    throw Error('Not a valid hash')
  }

  const klass = s.substr(0, 2)
  if (klass in keys) {
    return keys[klass]
  } else {
    throw Error(`Unknown class ${klass}`)
  }
}
function classify (s) {
  const keys = {
    ak: 'account_pubkey',
    ok: 'oracle_pubkey'
  }

  if (!s.match(/^[a-z]{2}_.+/)) {
    throw Error('Not a valid hash')
  }

  const klass = s.substr(0, 2)
  if (klass in keys) {
    return keys[klass]
  } else {
    throw Error(`Unknown class ${klass}`)
  }
}
function classify ( s ) { const keys = { ak : 'account_pubkey' , ok : 'oracle_pubkey' } if ( ! s . match ( / ^[a-z]{2}_.+ / ) ) { throw Error ( 'Not a valid hash' ) } const klass = s . substr ( 0 , 2 ) if ( klass in keys ) { return keys [ klass ] } else { throw Error ( ` ${ klass } ` ) } }
What kind of a hash is this? If it begins with 'ak_' it is an
account key, if with 'ok_' it's an oracle key.

@param s - the hash.
returns the type, or throws an exception if type not found.
What kind of a hash is this? If it begins with ak_ it is an account key if with ok_ it s an oracle key .