https://github.com/eperedo/object-to-query
an small library to convert js objects to querystrings
https://github.com/eperedo/object-to-query
Last synced: about 2 months ago
JSON representation
an small library to convert js objects to querystrings
- Host: GitHub
- URL: https://github.com/eperedo/object-to-query
- Owner: eperedo
- License: mit
- Created: 2017-07-19T02:00:46.000Z (almost 8 years ago)
- Default Branch: dev
- Last Pushed: 2017-07-19T20:12:09.000Z (almost 8 years ago)
- Last Synced: 2025-03-23T22:53:21.915Z (2 months ago)
- Language: JavaScript
- Size: 86.9 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# object-to-query [](https://travis-ci.org/eperedo/object-to-query) [](https://github.com/semantic-release/semantic-release)
an small library to convert js objects to querystrings
### Usage
- Install with npm
npm install object-to-query --save
- Start using is as simple as:
```javascript
const transform = require('object-to-query')
const result = transform({ id: 1, name: 'Eduardo' });
console.log(result);
// output &id=1&name=Eduardo
```
- You can exclude the properties you want
```javascript
const transform = require('object-to-query')
const result = transform({ id: 1, name: 'Eduardo', notThisOne: 'i am a bad property', age: 30 }, ['notThisOne']);
console.log(result);
// output &id=1&name=Eduardo&age=30
```
- I want the question mark as the first symbol in my string!!11UNO
```javascript
const transform = require('object-to-query')
const result = transform({ id: 1, name: 'Eduardo' }, [], true);
console.log(result);
// output ?id=1&name=Eduardo
```
### Development
1. Install dependencies
npm install
2. Write your code! Yep that's it!
### Testing
1. We are using [tape](https://github.com/substack/tape) because is small and awesome, only run the default test command
npm test
2. If everything looks green you are fine.
### Code Coverage
1. [Istanbul](https://github.com/gotwarlost/istanbul)