@humanwhocodes/momoa
Advanced tools
Comparing version 3.0.1 to 3.0.2
{ | ||
"name": "@humanwhocodes/momoa", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "JSON AST parser, tokenizer, printer, traverser.", | ||
@@ -5,0 +5,0 @@ "author": "Nicholas C. Zakas", |
@@ -122,6 +122,10 @@ # Momoa JSON | ||
const { tokenize } = require("@humanwhocodes/momoa"); | ||
const json = "{\"foo\":\"bar\"}"; | ||
for (const token of tokenize(some_json_string)) { | ||
console.log(token.type); | ||
console.log(token.value); | ||
for (const token of tokenize(json)) { | ||
console.log("Token type is", token.type); | ||
const start = token.loc.start.offset; | ||
const end = token.loc.end.offset; | ||
console.log("Token value is", json.slice(start, end)); | ||
} | ||
@@ -128,0 +132,0 @@ ``` |
105139
284