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

node-stringify

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-stringify - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

28

node-stringify.js
var _ = require('underscore')
var stringify = function (obj) {
if (_.isNull(obj)) { return 'null' }
if (_.isUndefined(obj)) { return 'undefined' }
if (_.isRegExp(obj) || _.isNumber(obj) || _.isBoolean(obj)) {
if (_.isNull(obj)) return 'null'
if (_.isUndefined(obj)) return 'undefined'
if (_.isRegExp(obj) || _.isNumber(obj) || _.isBoolean(obj))
return obj.toString()
}
if (_.isFunction(obj)) {
if (_.isFunction(obj))
return '(' + obj.toString() + ')'
}
if (_.isString(obj)) {
if (_.isString(obj))
return "'" + obj.replace(/'/g, "\\'").replace(/\n/g, '\\n') + "'"
}
if (_.isDate(obj)) { return 'new Date(' + obj.getTime() + ')' }
if (_.isDate(obj)) return 'new Date(' + obj.getTime() + ')'
if (_.isArguments(obj)) {
if (_.isArguments(obj))
obj = _.toArray(obj)
}
if (_.isArray(obj)) {
if (_.isArray(obj))
return '[' + _.map(obj, stringify).join(',') + ']'
}
if (_.isObject(obj)) {
return '({' + _.map(obj, function (v, k) { return k + ':' + stringify(v) }).join(',') + '})'
}
if (_.isObject(obj))
return '({' + _.map(obj, function (v, k) {
return k + ':' + stringify(v)
}).join(',') + '})'
}
module.exports = stringify
{
"name": "node-stringify",
"version": "0.0.15",
"version": "0.0.16",
"author": {

@@ -18,3 +18,3 @@ "name": "Chiang Fu",

"devDependencies": {
"jasmine-node": "^1.14.3"
"jasmine-node": "1.14.2"
},

@@ -21,0 +21,0 @@ "scripts": {

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