stringify-object-values

Stringify object values

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
stringify-object-values
0.1.08 years ago8 years agoMinified + gzip package size for stringify-object-values in KB

Readme

stringify-object-values

npm i stringify-object-values
Stringifies each value of an object. This is useful when paired with Webpack's DefinePlugin.
// Before
{
  hello: 'world',
  favorite: 1,
  equation: '1+1',
  random: {},
  arr: []  
}

// After
{
  hello: "'world'",
  favorite: 1,
  equation: "'1+1'",
  random: "{}",
  arr: "[]"
}

Usage

var stringify = require('stringify-object-values');
stringify(obj);

With webpack.DefinePlugin

var webpack = require('webpack');
var stringify = require('stringify-object-values');

module.exports = {
  plugins: [
    new webpack.DefinePlugin({ 'process.env': stringify(process.env) });
  ]
}