mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 05:56:29 +00:00
1305a7cd92
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
26 lines
496 B
JavaScript
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
|
|
};
|