make-string

1.0.3 • Public • Published

make-string Build Status

make-string converts all data types to string as JSON.toString.

Installation

npm install make-string

Usage

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.

options

Options can be passed as optional second param to makeString to configure few things.

quotes: "single" | "double" | "no"(no quotes)  - "double"(default)
braces: "true" | "false" - "true"(default)
assignment: "=" (any assignment operator)

How to use

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}'

Package Sidebar

Install

npm i make-string

Weekly Downloads

970

Version

1.0.3

License

ISC

Unpacked Size

9.53 kB

Total Files

5

Last publish

Collaborators

  • pajay