Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Convert object to string.
NOTE: did not handle the circular
input
var tostr = require('tostr')
var obj = {
str: "'A' \"string\"\r\n.",
strO: new String("'A' \"string\" \r\nObject."),
num: 0,
numO: new Number(0),
bool: true,
boolO: new Boolean(true),
undef: undefined,
reg: /re/g,
regO: new RegExp("re", "g"),
date: new Date(),
date2: new Date('2014-01-01'),
arr: [1, 2, 3],
arrO: new Array().concat([0,"1",true]),
obj: {
name: "fool2fish", email: "fool2fish@gmail.com"
},
objO: new Object(),
func: function(a, b) {
// some comment
return a + b
},
funcO: new Function("a", "alert(a)")
}
var str = tostr(obj)
console.log(str)
output
{
str: '\'A\' "string"\r\n.',
strO: '\'A\' "string" \r\nObject.',
num: 0,
numO: 0,
bool: true,
boolO: true,
undef: undefined,
reg: /re/g,
regO: /re/g,
date: new Date('Mon Dec 22 2014 16:09:46 GMT+0800 (CST)'),
date2: new Date('Wed Jan 01 2014 08:00:00 GMT+0800 (CST)'),
arr: [
1,
2,
3
],
arrO: [
0,
'1',
true
],
obj: {
name: 'fool2fish',
email: 'fool2fish@gmail.com'
},
objO: {
},
func: function (a, b) {
// some comment
return a + b
},
funcO: function anonymous(a
/**/) {
alert(a)
}
}
FAQs
Convert object to string.
The npm package tostr receives a total of 5,809 weekly downloads. As such, tostr popularity was classified as popular.
We found that tostr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.