guessformat

1.0.1 • Public • Published

guessformat

NPM

Makes a guess at the format of a string of JS code and gives formatting options found.

Right now it supports:

  • semicolons
  • indent style
  • quote style

The output is meant to be used for tools such as escodegen

Example

var guess = require("guessformat")
 
var fs = require("fs")
var code = fs.readFileSync("./node_modules/guessformat/guessformat.js").toString()
 
console.log(guess(code))
/*
  { indent: '  ', semicolons: false, quotes: 'double' }
*/

API

guess(jsString[, maxLines])

Scan up to the first maxLines (default=100) lines of the jsString to observe the formatting options used.

Right now it supports:

  • semicolons
  • indent style
  • quote style

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i guessformat

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • bryce