A short list of tips and recommendations, for those who use OSS and/or want to contribute to it.
- Give feedback
Before I get into the wrong ways to give feedback, let me be clear: the worst thing you can do is give no feedback at all.
| /* | |
| Now a real module used in production! | |
| https://github.com/ungoldman/choo-store | |
| */ | |
| class Store { | |
| constructor (opts) { | |
| opts = opts || {} |
| "use strict" | |
| function progress(strs, current, total) { | |
| let str = `${strs[0]}${current}${strs[1]}${total}${strs[2]}` | |
| let ratio = Math.min(Math.max(current / total, 0), 1) | |
| let length = Math.floor(ratio * str.length) | |
| let pattern = new RegExp(`^.{${length}}`) | |
| return str.replace(pattern, "\x1b[4m$&\x1b[0m") | |
| } |