import { _getPortalDomainTypeKeyword } from "./_get-portal-domain-type-keyword" ; import { includes } from "@esri/hub-common" ; param { String } subdomain param { Array } typeKeywords private export function _ensurePortalDomainKeyword ( subdomain , typeKeywords = [ ] ) { const expectedKeyword = _getPortalDomainTypeKeyword ( subdomain ) ; if ( includes ( typeKeywords , expectedKeyword ) ) { return typeKeywords ; } else { return typeKeywords . reduce ( ( acc , kw ) => { if ( ! /^hubsubdomain/ . test ( kw ) ) { acc . push ( kw ) ; } return acc ; } , [ expectedKeyword ] ) ; } }