-
Notifications
You must be signed in to change notification settings - Fork 1
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
Promisify #2
Conversation
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 | ||
}); |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
=> const
return; | ||
} | ||
return Promise.all([ | ||
pify(mountPoint, Promise)(userHome), |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xdgBaseDir
=> xdgBasedir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch :)
Should we remove Node 0.10 tests out of travis? |
@SamVerschueren, yup, I did it in the same commit. Thank you :D! |
Nice! Thanks for merging! |
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.