-
Notifications
You must be signed in to change notification settings - Fork 49
Further size optimization #31
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
Changes from 1 commit
da1ea1e
873b46d
7f2e07b
055f351
68c5a18
ae5732a
ee496e7
d9e59b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,16 +13,17 @@ let formatter = | |
| (input) => { | ||
| let string = "" + input | ||
| let index = string.indexOf(close, open.length) | ||
| return !~index | ||
| ? open + string + close | ||
| : open + replaceClose(string, close, replace, index) + close | ||
| return open + (~index ? replaceClose(string, close, replace, index) : string) + close | ||
|
||
| } | ||
|
|
||
| let replaceClose = (string, close, replace, index) => { | ||
| let start = string.substring(0, index) + replace | ||
| let end = string.substring(index + close.length) | ||
| let nextIndex = end.indexOf(close) | ||
| return !~nextIndex ? start + end : start + replaceClose(end, close, replace, nextIndex) | ||
| return ( | ||
| string.substring(0, index) + | ||
| replace + | ||
| (~nextIndex ? replaceClose(end, close, replace, nextIndex) : end) | ||
| ) | ||
| } | ||
|
|
||
| let createColors = (enabled = isColorSupported) => ({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going this way, should we change Prettier settings to reduce
(and)for single argument function?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense if we're all-in on squeezing every byte out of it: ed55367.