🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
5
150%
Maintainers
1
Weekly downloads
 
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

string

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