$ npm install is-urlsearchparams
Determine whether a value is a
URLSearchParamsinstance.
Works cross-realm/iframe and despite Symbol.toStringTag.
[!NOTE]
If you need to support older versions of Node.js (going back to
8.x), use1.xof this package.
npm install is-urlsearchparams
The standard.
import isURLSearchParams from 'is-urlsearchparams';
isURLSearchParams('param=value'); //-> false
isURLSearchParams(new URLSearchParams('param=value')); //-> true
Acceptance can be extended to incomplete URLSearchParams implementations that lack entries, sort and values methods (which is common with web browsers from 2021):
import isURLSearchParams from 'is-urlsearchparams/lenient';
console.log(params.sort); //-> undefined
isURLSearchParams(params); //-> true
© 2010 - cnpmjs.org x YWFE | Home | YWFE