var tokenize = require('./parse').tokenize module.exports.analyze = function analyzeJSON(input, options) { if (options == null) options = {} if (!Array.isArray(input)) { input = tokenize(input, options) } var result = { has_whitespace: false, has_comments: false, has_newlines: false, has_trailing_comma: false, indent: '', newline: '\n', quote: '"', quote_keys: true, } var stats = { indent: {}, newline: {}, quote: {}, } for (var i=0; i stats[k][b] ? a : b }) } } return result }