diff --git a/lib/formatter.js b/lib/formatter.js index 54620e8..cf23aa9 100644 --- a/lib/formatter.js +++ b/lib/formatter.js @@ -1,19 +1,16 @@ -#!/usr/bin/env node - /** * Manual formatter taken straight from https://github.com/umbrae/jsonlintdotcom -**/ - -/** - * jsl.format - Provide json reformatting in a character-by-character approach, so that even invalid JSON may be reformatted (to the best of its ability). * -**/ + * jsl.format - Provide json reformatting in a character-by-character approach, + * so that even invalid JSON may be reformatted (to the best of its ability). + * + */ var formatter = (function () { function repeat (s, count) { return new Array(count + 1).join(s) } - function formatJson (json, indentChars) { + function format (json, indentChars) { var i = 0 var il = 0 var tab = (typeof indentChars !== 'undefined') ? indentChars : ' ' @@ -79,9 +76,9 @@ var formatter = (function () { return newJson } - return { 'formatJson': formatJson } + return { format: format } }()) if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.formatter = formatter + exports.format = formatter.format }