all-contributors-cli/lib/util/markdown.js
Jeroen Engels 1305a7cd92 fix: Bump inquirer to v3 and promisify everything (#34)
BREAKING CHANGE: Drop support for Node < v4. This uses native Promises available from Node v4.

* fix: Bump inquirer to v3.0.1. Fixes #33 to improve Windows support.

* refactor: Promisify everything as inquirer uses Promises from 1.0.0 onwards
2017-02-15 22:25:32 +01:00

26 lines
496 B
JavaScript

'use strict';
var fs = require('fs');
var pify = require('pify');
function read(filePath) {
return pify(fs.readFile)(filePath, 'utf8');
}
function write(filePath, content) {
return pify(fs.writeFile)(filePath, content);
}
function injectContentBetween(lines, content, startIndex, endIndex) {
return [].concat(
lines.slice(0, startIndex),
content,
lines.slice(endIndex)
);
}
module.exports = {
read: read,
write: write,
injectContentBetween: injectContentBetween
};