Skip to content

Determines whether a value is a URLSearchParams instance.

License

Notifications You must be signed in to change notification settings

stevenvachon/is-urlsearchparams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is-urlsearchparams NPM Version File Size Build Status Dependency Monitor

Determines whether a value is a URLSearchParams instance.

Works cross-realm/iframe and despite Symbol.toStringTag.

Installation

Node.js >= 8 is required. To install, type this at the command line:

npm install is-urlsearchparams

Usage

const isURLSearchParams = require('is-urlsearchparams');

isURLSearchParams('param=value');  //-> false
isURLSearchParams(new URLSearchParams('param=value'));  //-> true

Optionally, 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

About

Determines whether a value is a URLSearchParams instance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published