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

uniqueFilename #82

Merged
merged 6 commits into from Sep 25, 2014
Merged

uniqueFilename #82

merged 6 commits into from Sep 25, 2014

Conversation

@arb
Copy link
Contributor

arb commented Sep 21, 2014

Many of our tests end up needed a unique file or filename. I moved that logic into Hoek so we can stop copy and pasting this code around.

@arb arb force-pushed the arb:random branch 3 times, most recently from 312ddfc to df1a64a Sep 21, 2014
@arb arb force-pushed the arb:random branch from a2861c1 to 6b50b3b Sep 21, 2014
@hueniverse

This comment has been minimized.

Copy link
Member

hueniverse commented Sep 21, 2014

I rather make it more specific. cryptiles has methods for random strings. What you are doing is specific to filenames to the function name should be more like uniqueFilename() and it should take a path as prefix to remove the need to specify one.

@hueniverse hueniverse added the feature label Sep 21, 2014
@arb arb changed the title Random uniqueFilename Sep 22, 2014
@arb

This comment has been minimized.

Copy link
Contributor Author

arb commented Sep 22, 2014

Changed to uniqueFilename also removed the AUTHORS file.

exports.uniqueFilename = function (path, extension) {

extension = extension || '';
extension = extension.length ? '.' + extension : '';

This comment has been minimized.

Copy link
@nlf

nlf Sep 25, 2014

Member

extension = extension && extension.length ? '.' + extension : '';
Would replace both of the above lines. Also, should we check that the first character isn't already a dot?

@nlf nlf self-assigned this Sep 25, 2014
@nlf nlf added this to the 2.4.2 milestone Sep 25, 2014
nlf added a commit that referenced this pull request Sep 25, 2014
uniqueFilename
@nlf nlf merged commit 63db0b6 into hapijs:master Sep 25, 2014
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.