Skip to content

Commit

Permalink
use const, template literals and arrow function
Browse files Browse the repository at this point in the history
[BREAKING] drop support for Node.js < 4
  • Loading branch information
shinnn committed Feb 11, 2017
1 parent 2695f4c commit f7d3c31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
*/
'use strict';

var inspect = require('util').inspect;
const inspect = require('util').inspect;

var fsLstat = require('graceful-fs').lstat;
const fsLstat = require('graceful-fs').lstat;

module.exports = function lstat(path) {
if (typeof path !== 'string') {
return Promise.reject(new TypeError('Expected a file path (string), but got a non-string value ' + inspect(path) + '.'));
return Promise.reject(new TypeError(`Expected a file path (string), but got a non-string value ${inspect(path)}.`));
}

if (path.length === 0) {
return Promise.reject(new Error('Expected a file path, but got \'\' (empty string).'));
}

return new Promise(function(resolve, reject) {
fsLstat(path, function(err, result) {
return new Promise((resolve, reject) => {
fsLstat(path, (err, result) => {
if (err) {
reject(err);
return;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
"graceful-fs": "^4.1.11"
},
"devDependencies": {
"@shinnn/eslint-config-node-legacy": "^3.0.0",
"create-symlink": "^0.1.0",
"@shinnn/eslint-config-node": "^3.0.0",
"create-symlink": "^0.2.0",
"eslint": "^3.15.0",
"nyc": "^10.1.2",
"rmfr": "^1.0.2",
"tape": "^4.6.3"
},
"eslintConfig": {
"extends": "@shinnn/node-legacy"
"extends": "@shinnn/node"
}
}

0 comments on commit f7d3c31

Please sign in to comment.