qs#IStringifyOptions TypeScript Examples

The following examples show how to use qs#IStringifyOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts    From urlcat with MIT License 6 votes vote down vote up
/**
 * Creates a query string from the specified object.
 *
 * @param {Object} params an object to convert into a query string.
 * @param {Object} config configuration to stringify the query params.
 *
 * @returns {String} Query string.
 *
 * @example
 * ```ts
 * query({ id: 42, search: 'foo' })
 * // -> 'id=42&search=foo'
 * ```
 */
export function query(params: ParamMap, config?: UrlCatConfiguration): string {
  const qsConfiguration: IStringifyOptions = {
    format: config?.objectFormat?.format ?? 'RFC1738', // RDC1738 is urlcat's current default. Breaking change if default is changed
    arrayFormat: config?.arrayFormat
  }

  return qs.stringify(params, qsConfiguration);
}
Example #2
Source File: TicketCardList.tsx    From condo with MIT License 5 votes vote down vote up
TICKET_QUERY_STRINGIFY_OPTIONS: IStringifyOptions = { arrayFormat: 'comma', skipNulls: true, addQueryPrefix: true }