Blame view

node_modules/bower/lib/util/abbreviations.js 680 Bytes
2dda2e10   Administrator   generator ignore
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  var abbrev = require('abbrev');
  var mout = require('mout');
  
  function expandNames(obj, prefix, stack) {
      prefix = prefix || '';
      stack = stack || [];
  
      mout.object.forOwn(obj, function (value, name) {
          name = prefix + name;
  
          stack.push(name);
  
          if (typeof value === 'object' && !value.line) {
              expandNames(value, name + ' ', stack);
          }
      });
  
      return stack;
  }
  
  module.exports = function (commands) {
      var abbreviations = abbrev(expandNames(commands));
  
      abbreviations.i = 'install';
      abbreviations.rm = 'uninstall';
      abbreviations.unlink = 'uninstall';
      abbreviations.ls = 'list';
  
      return abbreviations;
  };