string-any
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

string-any

Codacy Badge npm GitHub npm bundle size

string-any is a package to convert any object to a string and not [object Object]

Usage

const { toStr } = require('string-any');
 
// objects
toStr(
  {
    name: "name",
    id: 32918,
    randomThing: {
      dwq: "hello"
    },
    func: () => "hello"
  }
);
// => "{
// =>   name: "name",
// =>   id: 32918,
// =>   randomThing: {
// =>      dwq: "hello"
// =>   },
// =>   func: () => "hello"
// => }"
 
// functions
toStr(() => {}) // => "() => {}"
 
// numbers
toStr(10) // => "10"
 
// Strings
toStr("hello") // => '"hello"'
 
// String Objects
toStr(new String("hello")) // => "hello"
 
// Arrays
toStr([1,2,3]) // => "[1, 2, 3]"
 

LICENSE

MIT License

Copyright (c) 2019 AliBasicCoder

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i string-any

      Weekly Downloads

      0

      Version

      1.0.5

      License

      MIT

      Unpacked Size

      4.86 kB

      Total Files

      5

      Last publish

      Collaborators

      • ali_ahmed