nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / lodash / test / remove.js
1 #!/usr/bin/env node
2 'use strict';
3
4 var _ = require('../lodash'),
5     fs = require('fs'),
6     path = require('path');
7
8 var args = (args = process.argv)
9   .slice((args[0] === process.execPath || args[0] === 'node') ? 2 : 0);
10
11 var filePath = path.resolve(args[1]),
12     reLine = /.*/gm;
13
14 var pattern = (function() {
15   var result = args[0],
16       delimiter = result.charAt(0),
17       lastIndex = result.lastIndexOf(delimiter);
18
19   return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1));
20 }());
21
22 /*----------------------------------------------------------------------------*/
23
24 fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) {
25   var snippet = _.slice(arguments, -3, -2)[0];
26   return match.replace(snippet, snippet.replace(reLine, ''));
27 }));