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

Possible solution to issue #1 #6

Closed
wants to merge 10 commits into from
Closed

Possible solution to issue #1 #6

wants to merge 10 commits into from

Conversation

saomartinho
Copy link

Hello @sindresorhus!

I saw issues #1 , and I tried to solve it. At first I tried to use the prototype to change the toString () method, but after a few hours, I came up with this solution.

I hope this is what you are looking for with #1.

test.js Outdated
@@ -1,3 +1,4 @@
/* eslint new-cap: ["error", { "newIsCap": false }] */
Copy link

Choose a reason for hiding this comment

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

This isn't needed.

index.js Outdated

const aux = toString(to);
to.toString = function () {
const comment = `/* ${aux} */ \n ${from}`;
Copy link

Choose a reason for hiding this comment

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

const comment = `/* ${aux} */\n\t${from}`;

package.json Outdated
@@ -39,5 +39,8 @@
},
"xo": {
"esnext": true
},
"dependencies": {
Copy link

Choose a reason for hiding this comment

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

dependencies should be listed before devDependencies.

@kevva
Copy link

kevva commented Sep 10, 2017

Also, it doesn't seem like it does what's mentioned in #1 (comment).

@saomartinho
Copy link
Author

Hello @kevva,

Thank you for the directions.

I thought the output would be something like this:

/* function wrapper () {
     return foo () {};
} */
function foo () {}

but now I realize that output should be something like this:

/* [wrapped with function foo() {}] */

right?

@sindresorhus
Copy link
Owner

but now I realize that output should be something like this:
/* [wrapped with function foo() {}] */

Almost. It should be: /* [wrapped with foo()] */

@sindresorhus
Copy link
Owner

Actually, let's just make it:

/* Wrapped with foo() */

@sindresorhus
Copy link
Owner

Closing for lack of activity. Open a new PR if you're still interested in finishing this.

@sindresorhus sindresorhus mentioned this pull request Jun 11, 2019
@ehmicky ehmicky mentioned this pull request Jun 12, 2019
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

3 participants