Refactor index.js (#340)
Refactor index.js (#340)

Extracted out parse and attachComments. Moved the options normalization in the exported function.

This way, we have a super clean format function :)

```js
function format(text, opts) {
  const ast = parse(text, opts);
  attachComments(text, ast, opts)
  const doc = printAstToDoc(ast, opts)
  const str = printDocToString(doc, opts.printWidth)
  return str;
}
```
azz/prettier,existentialism/prettier,despairblue/prettier,prettier/prettier,Skywalker13/prettier-space-parenthesis,jlongster/prettier,azz/prettier,arijs/prettier-with-tabs,yamafaktory/prettier,prettier/prettier,azz/prettier,Pajn/prettier,yamafaktory/prettier,lydell/prettier,prettier/prettier,Skywalker13/prettier-space-parenthesis,despairblue/prettier,lydell/prettier,arijs/prettier-miscellaneous,vjeux/prettier,danharper/prettier,Skywalker13/prettier-space-parenthesis,prettier/prettier,arijs/prettier-with-tabs,lydell/prettier,azz/prettier,arijs/prettier-miscellaneous,rattrayalex/prettier,rattrayalex/prettier,Pajn/prettier,arijs/prettier-miscellaneous,existentialism/prettier,rattrayalex/prettier,Skywalker13/prettier-space-parenthesis,existentialism/prettier,existentialism/prettier,lydell/prettier,arijs/prettier-miscellaneous