Skip to content

Commit

Permalink
Adjust all files according to the eslint-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed May 3, 2018
1 parent 2438996 commit 10205de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions lib/actions/copy-tpl.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
'use strict';

var path = require('path');
var extend = require('deep-extend');
var ejs = require('ejs');
var isBinaryFile = require("isbinaryfile");
var isBinaryFile = require('isbinaryfile');

function render(contents, filename, context, tplSettings) {
let result;

if (isBinaryFile.sync(filename)) {
return contents.toString();
result = contents.toString();
} else {
return ejs.render(
result = ejs.render(
contents.toString(),
context,
// Setting filename by default allow including partials.
extend({filename: filename}, tplSettings)
);
}

return result;
}

module.exports = function (from, to, context, tplSettings, options) {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var util = require('../util');

function applyProcessingFunc(process, contents, filename) {
var output = process(contents, filename);
return output instanceof Buffer ? output : new Buffer(output);
return output instanceof Buffer ? output : Buffer.from(output);
}

exports.copy = function (from, to, options) {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function (filepath, contents, stat) {
var file = this.store.get(filepath);
file.isNew = file.contents === null;
file.state = 'modified';
file.contents = typeof contents === 'string' ? new Buffer(contents) : contents;
file.contents = typeof contents === 'string' ? Buffer.from(contents) : contents;
file.stat = stat;
this.store.add(file);

Expand Down

0 comments on commit 10205de

Please sign in to comment.