Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pajaydev/make-string
:gun: Convert objects/array to string in required format.
https://github.com/pajaydev/make-string
convert-to-string objecttostring qs querystring
Last synced: about 1 month ago
JSON representation
:gun: Convert objects/array to string in required format.
- Host: GitHub
- URL: https://github.com/pajaydev/make-string
- Owner: pajaydev
- Created: 2018-11-12T07:01:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-22T23:41:40.000Z (about 5 years ago)
- Last Synced: 2024-11-07T02:42:41.080Z (about 2 months ago)
- Topics: convert-to-string, objecttostring, qs, querystring
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# make-string [![Build Status](https://travis-ci.org/pajaydev/make-string.svg?branch=master)](https://travis-ci.org/pajaydev/make-string)
make-string converts all data types to string as JSON.toString.
## Installation ##
``` bash
npm install make-string
```
## Usage ##```js
const makeString = require('make-string');
makeString(25); // '25'
```
## Why? ##
I need to convert the object to string in configurable way like removing curly braces, with single quote, etc. So I created this module. If you face any issues with this module, Free feel to create the issues [here](https://github.com/pajaydev/make-string/issues).
## options ##
Options can be passed as optional second param to makeString to configure few things.
```json
quotes: "single" | "double" | "no"(no quotes) - "double"(default)
braces: "true" | "false" - "true"(default)
assignment: "=" (any assignment operator)
```
## How to use ##```js
const makeString = require('make-string');
makeString("make-string"); // "make-string"
makeString("make-string", {quotes: 'single'}); // 'make-string'
makeString("make-string", {quotes: 'no'}); // make-string
makeString({package:"make-string"}); // '{"package":"make-string"}'
makeString({package:"make-string"}, {braces: 'false'}); // '"package":"make-string"'
makeString({package:"make-string"}, {assignment: '='}); // '{"package"="make-string"}'
makeString({package:"make-string"}, {assignment: '=', quotes:'no'}); // '{package=make-string}'
makeString({package:"make-string",author:"Ajay"}, {assignment: '=', quotes:'no', seperator:'&'}); // '{package=make-string&author=ajay}'
```