Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

javascript-stringify

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-stringify - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

39

javascript-stringify.js

@@ -88,3 +88,3 @@ (function (root, stringify) {

*/
var getGlobalVariable = function (value, indent, stringify) {
var toGlobalVariable = function (value, indent, stringify) {
return 'Function(' + stringify('return this;') + ')()';

@@ -102,3 +102,9 @@ };

var values = array.map(function (value) {
return indent + stringify(value).split('\n').join('\n' + indent);
var str = stringify(value);
if (value === undefined) {
return String(str)
}
return indent + str.split('\n').join('\n' + indent);
}).join(indent ? ',\n' : ',');

@@ -144,18 +150,35 @@

},
'[object Date]': function (date, indent, stringify) {
'[object Date]': function (date) {
return 'new Date(' + date.getTime() + ')';
},
'[object String]': function (string, indent, stringify) {
'[object String]': function (string) {
return 'new String(' + stringify(string.toString()) + ')';
},
'[object Number]': function (number, indent, stringify) {
'[object Number]': function (number) {
return 'new Number(' + number + ')';
},
'[object Boolean]': function (boolean, indent, stringify) {
'[object Boolean]': function (boolean) {
return 'new Boolean(' + boolean + ')';
},
'[object Uint8Array]': function (array, indent) {
if (typeof Buffer === 'function' && Buffer.isBuffer(array)) {
return 'new Buffer(' + stringify(array.toString()) + ')';
}
if (indent) {
var str = '';
for (var i = 0; i < array.length; i++) {
str += indent + array[i] + ',\n'
}
return 'new Uint8Array([\n' + str + '\n])'
}
return 'new Uint8Array([' + array.join(indent ? ',\n' : ',') + '])'
},
'[object RegExp]': String,
'[object Function]': String,
'[object global]': getGlobalVariable,
'[object Window]': getGlobalVariable
'[object global]': toGlobalVariable,
'[object Window]': toGlobalVariable
};

@@ -162,0 +185,0 @@

{
"name": "javascript-stringify",
"version": "1.1.0",
"version": "1.1.1",
"description": "Stringify is to `eval` as `JSON.stringify` is to `JSON.parse`",

@@ -5,0 +5,0 @@ "main": "javascript-stringify.js",

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