New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

string-mangle

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-mangle

How to stringify an object or array

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Install

$ npm install --save string-mangle

Usage

const Smangle = require('string-mangle');
const obj ={name:'liangklfangl',sex:'male'};
console.log(Smangle.stringify(obj));

Then you will get something bellow(A valid json):

{
  "name": "liangklfangl",
  "sex": "male",
  "school": {
    "location": "DLUT",
    "age": 68
  }
}

API

(1)stringify:func(obj):

This method will stringify an object as above

(2)stringifyTree:func(fileTree)

This method will stringify an file tree object.

Input is:

const filetree = { filelists:
   { hello: 'filelists/hello.md',
     index: 'filelists/index.md',
     md:
      { fol: { 
        index: 'filelists/md/fol/index.md'
         },
        index: 'filelists/md/index.md' 
     }
 }
}

Then you get something bellow returned:

{
  'filelists': {
    'hello': require('C:/Users/Administrator/Desktop/string-mangle/filelists/hello.md')
    'index': require('C:/Users/Administrator/Desktop/string-mangle/filelists/index.md')
    'md': {
      'fol': {
        'index': require('C:/Users/Administrator/Desktop/string-mangle/filelists/md/fol/index.md')
      }
      'index': require('C:/Users/Administrator/Desktop/string-mangle/filelists/md/index.md')
    }
  }
}

If you just want to return an string object without required call, please use stringify instead!

Keywords

FAQs

Package last updated on 06 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc