import { IModel , cloneObject , includes } from "@esri/hub-common" ; import { getSiteItemType } from "./get-site-item-type" ; param { Object } model param { Object } currentUser param { Boolean } isPortal private export function _ensureTypeAndTags ( model , isPortal ) { model = cloneObject ( model ) ; model . item . type = getSiteItemType ( isPortal ) ; if ( ! Array . isArray ( model . item . typeKeywords ) ) { model . item . typeKeywords = [ ] ; } if ( ! includes ( model . item . typeKeywords , "hubSite" ) ) { model . item . typeKeywords . push ( "hubSite" ) ; } return model ; }