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.2.0 to 1.3.0

.travis.yml

35

lib/hjson.js

@@ -116,2 +116,7 @@ /*

var move = function (pos) {
at = pos - 1;
return next();
};
var number = function () {

@@ -121,2 +126,3 @@ // Parse a number value.

var number, string = '';
var pos = at;

@@ -148,4 +154,13 @@ if (ch === '-') {

}
number = +string;
if (!isFinite(number)) error("Bad number");
// skip white/to (newline)
while (ch && ch <= ' ' && ch !== '\n') next();
if (ch === '\n' || ch === ',' || ch === '}' || ch ===']') number = +string;
if (!isFinite(number)) {
// treat as a string
move(pos);
return wordOrString();
}
else return number;

@@ -207,3 +222,3 @@ };

// When parsing for string values, we must look for " and \ characters.
// When parsing multiline string values, we must look for ' characters.
while (true) {

@@ -272,9 +287,11 @@ if (!ch) error("Bad multiline string");

if (value.length === 3 && value === "'''") return mlString();
else if (value.length === 4) {
if (value === "true") return true;
else if (value === "null") return null;
if (ch === '\r' || ch === '\n' || ch === ',' || ch === '}' || ch ===']') {
switch (value[0]) {
case 'f': if (value.trim() === "false") return false; break;
case 'n': if (value.trim() === "null") return null; break;
case 't': if (value.trim() === "true") return true; break;
}
if (ch === '\r' || ch === '\n') return value;
}
else if (value.length === 5 && value === "false") return false;
if (ch === '\r' || ch === '\n') return value;
value += ch;

@@ -281,0 +298,0 @@ }

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

"author": "Christian Zangl",
"version": "1.2.0",
"version": "1.3.0",
"tags": [

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

# hjson-js
Hjson, the Human JSON. A data format that caters to humans and helps reduce the errors they make.
[![Build Status](https://img.shields.io/travis/laktak/hjson-js.svg?style=flat-square)](http://travis-ci.org/laktak/hjson-js)
[![NPM version](https://img.shields.io/npm/v/hjson.svg?style=flat-square)](http://www.npmjs.com/package/hjson)
Hjson, the Human JSON. A configuration file format that caters to humans and helps reduce the errors they make.
It supports `#`, `//` and `/**/` style comments as well as avoiding trailing/missing comma and other mistakes. For details and syntax see http://laktak.github.io/hjson.

@@ -22,3 +25,3 @@

To keep comments intact see [Editing](#editing-hjson).
To keep comments intact see [API](#modify--keep-comments).

@@ -25,0 +28,0 @@ ## From the Commandline

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