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

Leading zeros #3

Merged
merged 4 commits into from
Oct 11, 2018
Merged

Leading zeros #3

merged 4 commits into from
Oct 11, 2018

Conversation

Deseteral
Copy link
Contributor

This PR adds support for leadingZeros option flag. It might be useful formatting option.

Example:

format(1000 * 60 - 1) // '0:59'
format(1000 * 60 - 1, { leadingZeros: true }) // '00:59'

Let me know what you think 😄

@ungoldman
Copy link
Owner

Hi @Deseteral, thanks for the PR! Looks okay to me, please remove the package-lock.json file though :)

@ungoldman
Copy link
Owner

also might want to shorten the option to just leading

@Deseteral
Copy link
Contributor Author

Why should I remove package-lock.json? It's intended to be commited.

@ungoldman
Copy link
Owner

ungoldman commented Oct 11, 2018

@Deseteral no, it isn't :)

package-lock.json makes sense for some projects where you want to lock the versions of top-level and transitive dependencies. But not for modules.

Importantly, when npm is resolving dependencies, it does NOT respect the package-lock.json of modules it installs.

From the documentation:

One key detail about package-lock.json is that it cannot be published, and it will be ignored if found in any place other than the toplevel package.

https://docs.npmjs.com/files/package-lock.json

So generally a lot of module authors avoid committing package-lock.json to their repositories because (a) it can often provide false data for bug tracking, and (b) it introduces a lot of noise into git history through changes in transitive dependencies.

For example, a bug might be undetectable because modules in package-lock.json are locked at the repo level, but when the module is in use, one of its dependencies has introduced a breaking change that breaks the module for users.

So, for these many reasons, please remove package-lock.json. Thank you!

I will also add package-lock.json to .gitignore for this project so this issue is less confusing for contributors in the future.

@Deseteral
Copy link
Contributor Author

Interesting. I didn't know that. Thanks for the explanation 😄
package-lock.json is now removed and I've changed the name of leadingZeros option to just leading.

Let me know what do you think about it now 😃

Copy link
Owner

@ungoldman ungoldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@ungoldman ungoldman merged commit 86f3a24 into ungoldman:master Oct 11, 2018
@ungoldman
Copy link
Owner

Released in 1.3.0 🚀

@ungoldman
Copy link
Owner

One final note -- just transferred ownership of this project to https://github.com/hypermodules to share maintenance.

@Deseteral Deseteral deleted the leading-zeros branch October 11, 2018 18:20
@Deseteral
Copy link
Contributor Author

Great! Thank you for the review and your patience in explaining the package-lock.json thing 😃
Cheers!

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

Successfully merging this pull request may close these issues.

2 participants