is-urlsearchparams
Determine whether a value is a URLSearchParams instance.
Last updated 3 months ago by stevenvachon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install is-urlsearchparams 
SYNC missed versions from official npm registry.

is-urlsearchparams NPM Version File Size Build Status Coverage Status

Determine whether a value is a URLSearchParams instance.

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

[!NOTE]

If you need to support older versions of Node.js (going back to 8.x), use 1.x of this package.

Install

npm install is-urlsearchparams

Usage

Strict

The standard.

import isURLSearchParams from 'is-urlsearchparams';

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

Lenient

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

Current Tags

  • 2.0.0                                ...           latest (3 months ago)
  • 2.0.0-rc                                ...           rc (3 months ago)

5 Versions

  • 2.0.0                                ...           3 months ago
  • 2.0.0-rc [deprecated]           ...           3 months ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Total 13
Today 0
This Week 0
This Month 12
Last Day 0
Last Week 8
Last Month 0
Dependencies (2)
Dev Dependencies (16)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE