import ProtoData from '../models/ProtoData' ; see param obj param createIfNotFound private export default function getProtoData ( obj , createIfNotFound = false ) { const wrapped = obj as { __protoData ? : ProtoData ; } ; if ( ! wrapped . __protoData ) { if ( createIfNotFound ) { wrapped . __protoData = { uris : [ ] , fields : [ ] , rels : [ ] , views : [ ] } ; } else { throw new Error ( `Object ${ wrapped } has no __protoData` ) ; } } return wrapped . __protoData ; }