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

Add support of filepath #9

Merged
merged 1 commit into from
Dec 31, 2016
Merged

Conversation

bmeiri
Copy link
Contributor

@bmeiri bmeiri commented Dec 8, 2016

Support of return of the file path within the repository.
Return:

  1. file path in case it's a blob link or raw file content
  2. null any other link

@@ -39,6 +39,10 @@ function parse(str) {
var hasBlob = seg[2] === 'blob';
if (hasBlob && !isChecksum(seg[3])) {
obj.branch = seg[3];
if(seg.length > 4)
Copy link
Owner

Choose a reason for hiding this comment

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

thanks for the pr! would you mind updating code formatting to be consistent with the rest of the code? In particular the braces and whitespace around if statements. thanks!

assert.equal(gh('https://github.com/assemble/verb/tree/dev').filepath, null);
assert.equal(gh('https://raw.githubusercontent.com/assemble/verb/dev/README.md').filepath, 'README.md');
assert.equal(gh('https://raw.githubusercontent.com/assemble/verb/dev/bar/README.md').filepath, 'bar/README.md');
});
Copy link
Owner

Choose a reason for hiding this comment

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

thanks for the unit tests! looks great

@jonschlinkert jonschlinkert changed the title Add suppot of filepath Add support of filepath Dec 8, 2016
@jonschlinkert jonschlinkert merged commit b7ff3c8 into jonschlinkert:master Dec 31, 2016
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.

None yet

2 participants