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

hjson

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hjson - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

all.txt

48

lib/hjson.js

@@ -62,4 +62,6 @@ /*

var hjson_EOL='\n';
var hjson_EOL = '\n';
var hjson_bracesSameLine = false;
var hjson_parse = (function ()

@@ -561,3 +563,4 @@ {

function testWsc(str) { return str && str[str[0] === '\r' ? 1 : 0] !== '\n'; }
function startsWithNL(str) { return str && str[str[0] === '\r' ? 1 : 0] === '\n'; }
function testWsc(str) { return str && !startsWithNL(str); }
function wsc(str)

@@ -575,12 +578,3 @@ {

var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
eolGap,
partial,
kw,
kwl,
value = holder[key];
var value = holder[key];

@@ -615,6 +609,13 @@ // What happens next depends on the value's type.

// Make an array to hold the partial results of stringifying this object value.
var mind = gap;
gap += indent;
eolGap = hjson_EOL + gap;
partial = [];
var eolMind = hjson_EOL + mind;
var eolGap = hjson_EOL + gap;
var prefix = hjson_bracesSameLine ? '' : eolMind;
var partial = [];
var i, length; // loop
var k, v; // key, value
var kw, kwl; // whitespace & comments
// Is the value an array?

@@ -634,3 +635,3 @@

}
if (kw) partial.push(wsc(kw[i]) + hjson_EOL + mind);
if (kw) partial.push(wsc(kw[i]) + eolMind);

@@ -640,5 +641,5 @@ // Join all of the elements together, separated with newline, and wrap them in

if (kw) v = '[' + partial.join('') + ']';
if (kw) v = prefix + '[' + partial.join('') + ']';
else if (partial.length === 0) v = '[]';
else v = '[' + eolGap + partial.join(eolGap) + hjson_EOL + mind + ']';
else v = prefix + '[' + eolGap + partial.join(eolGap) + eolMind + ']';
}

@@ -666,5 +667,5 @@ else

v = str(k, value, testWsc(kwl));
if (v) partial.push(quoteName(k) + ': ' + v);
if (v) partial.push(quoteName(k) + (startsWithNL(v) ? ':' : ': ') + v);
}
partial.push(kwl + hjson_EOL + mind);
partial.push(kwl + eolMind);
}

@@ -678,3 +679,3 @@ else

v = str(k, value);
if (v) partial.push(quoteName(k) + ': ' + v);
if (v) partial.push(quoteName(k) + (startsWithNL(v) ? ':' : ': ') + v);
}

@@ -687,5 +688,5 @@ }

if (kw) v = '{' + partial.join('') + '}';
if (kw) v = prefix + '{' + partial.join('') + '}';
else if (partial.length === 0) v = '{}';
else v = '{' + eolGap + partial.join(eolGap) + hjson_EOL + mind + '}';
else v = prefix + '{' + eolGap + partial.join(eolGap) + eolMind + '}';
}

@@ -749,4 +750,5 @@

endOfLine: function() { return hjson_EOL; },
setEndOfLine: function(eol) { hjson_EOL=eol; }
setEndOfLine: function(eol) { hjson_EOL = eol; },
setBracesSameLine: function(v) { hjson_bracesSameLine = v; }
};
}

@@ -6,3 +6,3 @@ {

"author": "Christian Zangl",
"version": "1.0.0",
"version": "1.0.1",
"tags": [

@@ -9,0 +9,0 @@ "json",

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