author Jeremy Daly <jeremy@jeremydaly.com>
 *  license import { error } from './utils' ; export default ( attr , attrs ) : string => { const path = attr . split ( '.' ) ; const list = path [ 0 ] . split ( '[' ) ; if ( list [ 0 ] in attrs ) { path [ 0 ] = ( attrs [ list [ 0 ] ] . map ? attrs [ list [ 0 ] ] . map : list [ 0 ] ) + ( list . length > 1 ? `[${ list . slice ( 1 ) . join ( '[' ) }` : '' ) ; return path . join ( '.' ) ; } else { return error ( `'${ attr }' is not a valid attribute.` ) ; } } ;