Comparing version 0.1.1 to 0.1.2
@@ -13,6 +13,6 @@ /* | ||
This method parses HJSON text to produce an object or array. | ||
This method parses Hjson text to produce an object or array. | ||
It can throw a SyntaxError exception. | ||
Code was adopted from the JSON version by Douglas Crockford: | ||
The code is based on the the JSON version by Douglas Crockford: | ||
https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js | ||
@@ -36,3 +36,3 @@ | ||
This method produces a HJSON text from a JavaScript value. | ||
This method produces a Hjson text from a JavaScript value. | ||
@@ -73,3 +73,3 @@ You can provide an optional replacer method. It will be passed the | ||
Code was adopted from the JSON version by Douglas Crockford: | ||
The code is based on the the JSON version by Douglas Crockford: | ||
https://github.com/douglascrockford/JSON-js/blob/master/json2.js | ||
@@ -88,3 +88,3 @@ | ||
// This is a function that can parse a HJSON text, producing a JavaScript | ||
// This is a function that can parse a Hjson text, producing a JavaScript | ||
// data structure. It is a simple, recursive descent parser. It does not use | ||
@@ -216,3 +216,3 @@ // eval or regular expressions, so it can be used as a model for implementing | ||
{ | ||
// quotes for keys that consist only of letters and digits are optional in HJSON | ||
// quotes for keys that consist only of letters and digits are optional in Hjson | ||
@@ -238,3 +238,3 @@ if (ch === '"') return string(); | ||
while (ch && ch <= ' ') next(); | ||
// HJSON allows comments | ||
// Hjson allows comments | ||
if (ch === "#") | ||
@@ -250,3 +250,3 @@ { | ||
{ | ||
// HJSON strings can be quoteless | ||
// Hjson strings can be quoteless | ||
// returns string, true, false, or null. | ||
@@ -288,3 +288,3 @@ var value = ch; | ||
white(); | ||
// in HJSON the comma is optional and trailing commas are allowed | ||
// in Hjson the comma is optional and trailing commas are allowed | ||
if (ch === ',') { next(); white(); } | ||
@@ -327,3 +327,3 @@ if (ch === ']') | ||
white(); | ||
// in HJSON the comma is optional and trailing commas are allowed | ||
// in Hjson the comma is optional and trailing commas are allowed | ||
if (ch === ',') { next(); white(); } | ||
@@ -343,3 +343,3 @@ if (ch === '}') | ||
{ | ||
// Parse a HJSON value. It could be an object, an array, a string, a number or a word. | ||
// Parse a Hjson value. It could be an object, an array, a string, a number or a word. | ||
@@ -589,3 +589,3 @@ white(); | ||
// The stringify method takes a value and an optional replacer, and an optional | ||
// space parameter, and returns a HJSON text. The replacer can be a function | ||
// space parameter, and returns a Hjson text. The replacer can be a function | ||
// that can replace values, or an array of strings that will select the keys. | ||
@@ -592,0 +592,0 @@ // A default replacer method can be provided. Use of the space parameter can |
{ | ||
"name": "hjson", | ||
"description": "JSON for Humans", | ||
"description": "JSON - commas + comments for Humans", | ||
"main": "./lib/hjson.js", | ||
"author": "Christian Zangl", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"tags": [ | ||
@@ -8,0 +8,0 @@ "json", |
# hjson-js | ||
HJSON reference parser implementation. | ||
Hjson reference implementation. | ||
HJSON is JSON for humans. | ||
Hjson is JSON - commas + comments for Humans. | ||
It should be used for configuration files, for debug output or where it is likely that JSON data is read or will be edited by a human. | ||
That means that you can write: | ||
@@ -12,3 +14,3 @@ ``` | ||
foo: Hello World! | ||
bar: Hello HJSON! | ||
bar: Hello Hjson! | ||
} | ||
@@ -21,3 +23,3 @@ ``` | ||
"foo": "Hello World!", | ||
"bar": "Hello HJSON!" | ||
"bar": "Hello Hjson!" | ||
} | ||
@@ -38,6 +40,6 @@ ``` | ||
``` | ||
var HJSON = require('hjson'); | ||
var Hjson = require('hjson'); | ||
var obj = HJSON.parse(hjsonText); | ||
var text2 = HJSON.stringify(obj); | ||
var obj = Hjson.parse(hjsonText); | ||
var text2 = Hjson.stringify(obj); | ||
@@ -53,6 +55,6 @@ ``` | ||
hjson can be used to convert JSON from/to HJSON. | ||
hjson can be used to convert JSON from/to Hjson. | ||
hjson will read the given JSON/HJSON input file or read from stdin. | ||
- without options: will output as HJSON. | ||
hjson will read the given JSON/Hjson input file or read from stdin. | ||
- without options: will output as Hjson. | ||
- with -json: will output as formatted JSON. | ||
@@ -63,3 +65,3 @@ - with -json=compact: will output as JSON. | ||
Sample: | ||
- run `hjson test.json > test.hjson` to convert to HJSON | ||
- run `hjson test.json > test.hjson` to convert to Hjson | ||
- run `hjson -json test.hjson > test.json` to convert to JSON |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20264
63