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

code-stringify

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-stringify - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "code-stringify",
"version": "1.0.0",
"version": "1.0.1",
"description": "Code-this is node.js module that converts JavaScript variables into source codes. Unlike `JSON.stringify`, code-stringify also deals with reference(object) types of variables.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,20 +20,16 @@ [![NPM version](https://badge.fury.io/js/code-stringify.png)](http://badge.fury.io/js/code-stringify)

```js
var code = require('code-stringify');
var a = {a: function(n){return n;}, b: 1, c: 3};
const code = require('code-stringify')
const obj = {
0: 1,
a: function(n){return n;},
b: 1,
'c-d': 3
}
code(a, null, 2); // 1
```
const fs = require('fs')
Expression {1} will return:
```js
'{\n \'a\': function (n){return n;},\n \'b\': 1,\n \'c\': 3\n}'
```
So you can use code-stringify to save your javascript variables into a file:
```js
require('fs').writeFileSync(
// So you can use code-stringify to save your javascript variables into a file:
fs.writeFileSync(
'output.js',
'module.exports = ' + code(a, null, 2) + ';';
'module.exports = ' + code(a, null, 2)
);

@@ -46,6 +42,7 @@ ```

module.exports = {
'a': function (n){return n;},
'b': 1,
'c': 3
};
0: 1,
a: function (n){return n;},
b: 1,
"c-d": 3
}
```

@@ -52,0 +49,0 @@

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