all-contributors-cli/lib/util/markdown.js

27 lines
496 B
JavaScript
Raw Normal View History

'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);
}
2016-03-21 22:53:02 +00:00
function injectContentBetween(lines, content, startIndex, endIndex) {
return [].concat(
lines.slice(0, startIndex),
content,
lines.slice(endIndex)
);
}
module.exports = {
read: read,
2016-03-21 22:53:02 +00:00
write: write,
injectContentBetween: injectContentBetween
2016-03-06 23:20:24 +00:00
};