Determines whether a value is a
URLSearchParamsinstance.
Works cross-realm/iframe and despite Symbol.toStringTag.
Node.js >= 8 is required. To install, type this at the command line:
npm install is-urlsearchparamsconst isURLSearchParams = require('is-urlsearchparams');
isURLSearchParams('param=value'); //-> false
isURLSearchParams(new URLSearchParams('param=value')); //-> trueOptionally, acceptance can be extended to incomplete URLSearchParams implementations that lack entries, sort and values methods (which are common in many modern web browsers):
const params = new URLSearchParams('param=value');
console.log(params.sort); //-> undefined
isURLSearchParams.lenient(params); //-> true