Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve/create "API" #2

Open
2 tasks
towerofnix opened this issue May 11, 2017 · 2 comments
Open
2 tasks

Improve/create "API" #2

towerofnix opened this issue May 11, 2017 · 2 comments

Comments

@towerofnix
Copy link
Owner

towerofnix commented May 11, 2017

  • Be able to call fixWhitespace with input lines, in addition to the ability of using it as a template tag. (This would likely involve having a new, separate, function.)
  • Have a way of controlling what fixWhitespace does (e.g., don't remove trailing newlines).

I've seen a few libraries/demos do something like this:

const createWhitespaceFixer = require('fix-whitespace')
const fixWS = createWhitespaceFixer({ /* ..opts.. */ })

console.log(fixWS`
  Lorem ipsum! Magic!
  Additional lines!
  ${"Embeds!\n".repeat(5)}
  ..And other general usage of fixWS, blah, blah.
`)

edit: This would, of course, be a major version bump.

@towerofnix
Copy link
Owner Author

Very, very relevant:

A tiny library that fixes whitespace in JavaScript template strings.

I'd rather not go overboard. This is still a nice idea for some future time, though.

@towerofnix
Copy link
Owner Author

fixWhitespace is a tag function; it can technically be called with arbitrary input like this:

fixWS([input])

so, yay?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant