This package has been deprecated

Author message:

URLSearchParams accepts an object in the constructor natively. See https://github.com/whatwg/url/pull/175#issuecomment-271828734

searchparamify

1.0.0 • Public • Published

searchparamify

Create URLSearchParams from a JavaScript object.

Installation

Method 1: CDN

Include the script on your page via UNPKG.

<script src="https://unpkg.com/searchparamify"></script>

Method 2: Download

Download dist/searchparamify.js.

Include it on your page.

<script src="searchparamify.js"></script>

Method 3: ES6 Module using npm and webpack (or similar)

Install via npm.

> npm install searchparamify

Include it in your scripts.

import searchparamify from "searchparamify";

Usage

Create URLSearchParams from a JavaScript object.

const params = searchparamify({
  name: "Jimmy",
  favoriteAnimal: "cat"
});

The result of the code above is identical to...

const params = new URLSearchParams();
params.append("name", "Jimmy");
params.append("favoriteAnimal", "cat");

In both cases, params.toString() would return

"name=Jimmy&favoriteAnimal=cat"

/searchparamify/

    Package Sidebar

    Install

    npm i searchparamify

    Weekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.12 kB

    Total Files

    3

    Last publish

    Collaborators

    • travishorn