mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 14:06:34 +00:00
25 lines
458 B
JavaScript
25 lines
458 B
JavaScript
'use strict';
|
|
|
|
var fs = require('fs');
|
|
|
|
function read(filePath, cb) {
|
|
fs.readFile(filePath, 'utf8', cb);
|
|
}
|
|
|
|
function write(filePath, content, cb) {
|
|
fs.writeFile(filePath, content, cb);
|
|
}
|
|
|
|
function injectContentBetween(lines, content, startIndex, endIndex) {
|
|
return [].concat(
|
|
lines.slice(0, startIndex),
|
|
content,
|
|
lines.slice(endIndex)
|
|
);
|
|
}
|
|
|
|
module.exports = {
|
|
read: read,
|
|
write: write,
|
|
injectContentBetween: injectContentBetween
|
|
};
|