How to use the query-string.preset_search function in query-string

To help you get started, we’ve selected a few query-string examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github broadinstitute / single_cell_portal_core / app / javascript / providers / StudySearchProvider.js View on Github external
export function buildParamsFromQuery(query, preset) {
  const queryParams = queryString.parse(query)
  return {
    page: queryParams.page ? parseInt(queryParams.page) : 1,
    terms: queryParams.terms ? queryParams.terms : '',
    facets: buildFacetsFromQueryString(queryParams.facets),
    preset: preset ? preset : queryString.preset_search,
    order: queryParams.order
  }
}
github broadinstitute / single_cell_portal_core / app / javascript / components / search_xds / HomePageRouter.js View on Github external
}
  const queryParams = queryString.parse(query)

  const preset = location.pathname.includes('covid19') ? 'covid19' : ''

  PARAM_LIST_ORDER.forEach(param => {
    if (queryParams[param] && queryParams[param].length) {
      homeParams.userSpecified[param] = true
    }
  })
  homeParams.terms = queryParams.terms ? queryParams.terms : '',
  homeParams.genes = queryParams.genes ? queryParams.genes : [],
  homeParams.facets = buildFacetsFromQueryString(queryParams.facets),
  homeParams.type = queryParams.type ? queryParams.type : '',
  homeParams.page = queryParams.page ? parseInt(queryParams.page) : 1,
  homeParams.preset = preset ? preset : queryString.preset_search,
  homeParams.order = queryParams.order

  return homeParams
}
github broadinstitute / single_cell_portal_core / app / javascript / components / search / StudySearchProvider.js View on Github external
export default function StudySearchProvider(props) {
  const location = useLocation()
  const queryParams = queryString.parse(location.search)
  const searchParams = {
    page: queryParams.page ? queryParams.page : 1,
    terms: queryParams.terms ? queryParams.terms : '',
    facets: buildFacetsFromQueryString(queryParams.facets),
    preset: props.preset ? props.preset : queryString.preset_search,
    order: queryParams.order
  }

  return (
    
      {props.children}
    
  )
}
github broadinstitute / single_cell_portal_core / app / javascript / providers / GeneSearchProvider.js View on Github external
export function buildParamsFromQuery(query, preset) {
  const queryParams = queryString.parse(query)
  return {
    page: queryParams.genePage ? parseInt(queryParams.genePage) : 1,
    genes: queryParams.genes ? queryParams.genes : '',
    preset: preset ? preset : queryString.preset_search
  }
}

query-string

Parse and stringify URL query strings

MIT
Latest version published 4 months ago

Package Health Score

87 / 100
Full package analysis