UNPKG

react-url-query

Version:

A library for managing state through query parameters in the URL in React. Works well with or without Redux and React Router.

17 lines (15 loc) 382 B
/** * Helper function to get only parts of a query. Specify * which parameters to omit. */ export default function subqueryOmit(query, ...omitParams) { if (!query) { return query; } return Object.keys(query) .filter(param => !omitParams.includes(param)) .reduce((newQuery, param) => { newQuery[param] = query[param]; return newQuery; }, {}); }