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

Promisify #2

Closed
wants to merge 4 commits into from
Closed

Promisify #2

wants to merge 4 commits into from

Conversation

SamVerschueren
Copy link
Collaborator

I promisified the library and converted the tests to use ES2015.

I don't have a linux computer so I couldn't tested the script.

@kevva
Copy link
Owner

kevva commented Oct 5, 2015

Thanks, I'll check it out :).

console.log(dir);
//=> /home/johndoe/.local/share/Trash
});

xdgTrashdir('foo.zip', function (err, dir) {
xdgTrashdir('foo.zip').then(function (dir) {
console.log(dir);
//=> /media/johndoe/UUI/.Trash-1000
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sindre always wants it to be this way on his modules:

const xdgTrashdir = require('xdg-trashdir');

xdgTrashdir().then(dir => {
    console.log(dir);
    //=> /home/johndoe/.local/share/Trash
});

xdgTrashdir('foo.zip').then(dir => {
    console.log(dir);
    //=> /media/johndoe/UUI/.Trash-1000
});

Let me know what you prefer :)

Copy link
Owner

Choose a reason for hiding this comment

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

Oh, I didn't see this comment, but yeah, that's what I prefer too :).

t.assert(dir === path.join(xdgBasedir.data, 'Trash'), dir);
});
test('get the trash path', async t => {
var dir = await trashdir();
Copy link
Owner

Choose a reason for hiding this comment

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

var => const

@sindresorhus sindresorhus changed the title Promisified the library Promisify Oct 5, 2015
return;
}
return Promise.all([
pify(mountPoint, Promise)(userHome),
Copy link
Contributor

Choose a reason for hiding this comment

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

pify it once at the top of the file and reuse it here

import {execFile} from 'child_process';
import path from 'path';
import test from 'ava';
import xdgBaseDir from 'xdg-basedir';
Copy link
Owner

Choose a reason for hiding this comment

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

xdgBaseDir => xdgBasedir

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch :)

@SamVerschueren
Copy link
Collaborator Author

Should we remove Node 0.10 tests out of travis?

@kevva kevva closed this in 0d18133 Oct 5, 2015
@kevva
Copy link
Owner

kevva commented Oct 5, 2015

@SamVerschueren, yup, I did it in the same commit. Thank you :D!

@SamVerschueren
Copy link
Collaborator Author

Nice! Thanks for merging!

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