Use lodash in test/remove.js.

This commit is contained in:
John-David Dalton
2016-02-21 18:51:42 -08:00
parent 9f7e626b9a
commit 4a0fe2c17b

View File

@@ -1,15 +1,15 @@
#!/usr/bin/env node #!/usr/bin/env node
'use strict'; 'use strict';
var fs = require('fs'), var _ = require('../lodash'),
fs = require('fs'),
path = require('path'); path = require('path');
var args = (args = process.argv) var args = (args = process.argv)
.slice((args[0] === process.execPath || args[0] === 'node') ? 2 : 0); .slice((args[0] === process.execPath || args[0] === 'node') ? 2 : 0);
var filePath = path.resolve(args[1]), var filePath = path.resolve(args[1]),
reLine = /.*/gm, reLine = /.*/gm;
slice = Array.prototype.slice;
var pattern = (function() { var pattern = (function() {
var result = args[0], var result = args[0],
@@ -22,6 +22,6 @@ var pattern = (function() {
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) { fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) {
var snippet = slice.call(arguments, -3, -1)[0]; var snippet = _.slice(arguments, -3, -2)[0];
return match.replace(snippet, snippet.replace(reLine, '')); return match.replace(snippet, snippet.replace(reLine, ''));
})); }));