import prefixes from './prefixes' ; export function getParts ( prefixed ) { const [ prefix , term ] = prefixed . split ( ':' ) ; if ( ! prefix || ! term ) { return null ; } const baseIRI = prefixes [ prefix ] ; if ( ! baseIRI ) { throw new Error ( `Unavailable prefix '${ prefix }:'` ) ; } return { prefix , term , baseIRI } ; } export function expand ( prefixed ) { const parts = getParts ( prefixed ) ; if ( ! parts ) { return '' ; } return `${ parts . baseIRI }${ parts . term }` ; }