Skip to content

Don't check what's returned from passed function - #24

Merged
shinnn merged 2 commits into
hparra:masterfrom
adam-lynch:patch-1
Mar 11, 2015
Merged

Don't check what's returned from passed function#24
shinnn merged 2 commits into
hparra:masterfrom
adam-lynch:patch-1

Conversation

@adam-lynch

Copy link
Copy Markdown
Contributor
  1. By default, CoffeeScript will return the last line in a function. If you had the following:

    .pipe($.rename (path) =>
            path.extname = '.html'
    )

    Then your gulp task would fail with TypeError: Arguments to path.join must be strings, unless you end the function with return path / return / return a falsy value.

  2. It's kinda ambiguous / confusing. I can't think of a use case where you'd edit the original but return something else (since the original will overridden with what you return anyway).


I didn't check the tests, I just made this change on github.com. If they fail, I'll come back to them later.

@adam-lynch

Copy link
Copy Markdown
Contributor Author

Ok, I almost forgot to come back to this. I'll sort this over the weekend.

@adam-lynch

Copy link
Copy Markdown
Contributor Author

Done, ready for merge. Travis is reporting a build error above as you can see. The tests passed with node 0.10 but on 0.9 it failed due to an npm glitch. Re-run the build or just merge as is, you can see the tests passing here.

@shinnn

shinnn commented Dec 17, 2014

Copy link
Copy Markdown
Collaborator

+1

@shinnn

shinnn commented Mar 11, 2015

Copy link
Copy Markdown
Collaborator

OK, I'll merge this PR since it's more suitable for the bahavior described in README. I regard this change as a bug fix.

However, it's debatable whether using return value is more useful for the users or not.

Thanks, @adam-lynch :)

shinnn added a commit that referenced this pull request Mar 11, 2015
Don't check what's returned from passed function
@shinnn
shinnn merged commit 7cb3edc into hparra:master Mar 11, 2015
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