Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 19, 2018
1 parent 2bb8b2d commit de69fb6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var vfile = require('./core')
exports.read = read
exports.write = write

/* Create a virtual file and read it in, asynchronously. */
// Create a virtual file and read it in, asynchronously.
function read(description, options, callback) {
var file = vfile(description)

Expand Down Expand Up @@ -48,11 +48,11 @@ function read(description, options, callback) {
}
}

/* Create a virtual file and write it out, asynchronously. */
// Create a virtual file and write it out, asynchronously.
function write(description, options, callback) {
var file = vfile(description)

/* Weird, right? Otherwise `fs` doesn’t accept it. */
// Weird, right? Otherwise `fs` doesn’t accept it.
if (!callback && typeof options === 'function') {
callback = options
options = undefined
Expand Down
7 changes: 3 additions & 4 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ var vfile = require('vfile')

module.exports = toVFile

/* Create a virtual file from a description.
* If `options` is a string or a buffer, it’s used as the
* path. In all other cases, the options are passed through
* to `vfile()`. */
// Create a virtual file from a description. If `options` is a string or a
// buffer, it’s used as the path. In all other cases, the options are passed
// through to `vfile()`.
function toVFile(options) {
if (typeof options === 'string' || buffer(options)) {
options = {path: String(options)}
Expand Down
4 changes: 2 additions & 2 deletions lib/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ var vfile = require('./core')
exports.read = readSync
exports.write = writeSync

/* Create a virtual file and read it in, synchronously. */
// Create a virtual file and read it in, synchronously.
function readSync(description, options) {
var file = vfile(description)
file.contents = fs.readFileSync(path.resolve(file.cwd, file.path), options)
return file
}

/* Create a virtual file and write it out, synchronously. */
// Create a virtual file and write it out, synchronously.
function writeSync(description, options) {
var file = vfile(description)
fs.writeFileSync(
Expand Down
1 change: 0 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var test = require('tape')
var buffer = require('is-buffer')
var vfile = require('.')

/* Start of with `readme.md`. */
var fixture = fs.readFileSync('readme.md', 'utf8')

test('toVFile()', function(t) {
Expand Down

0 comments on commit de69fb6

Please sign in to comment.