1.3.0 • Published 6 years ago

obj-to-query-string v1.3.0

Weekly downloads
16
License
ISC
Repository
github
Last release
6 years ago

This dependency-free function will take an object and convert it to a query string.

Installation

In the root of your project, run:

yarn add obj-to-query-string

Usage

The function takes a single parameter, an object. The object must contain only strings, numbers, or an array of numbers/strings as it's properties as I can't think of a sensible way to do deep nesting for objects.

Any null or undefined values on the object or in any arrays on the object will be ignored.

import toQueryString from "obj-to-query-string";

const myObject = {
  a: 1,
  b: "some string",
  anArray: [1, "some other string"]
};

const params = toQueryString(myObject); // 'a=1&b=some%20string&anArray[]=1&anArray[]=some%20other%20string'
1.3.0

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago