Skip to content

Examples

jeff edited this page Jun 11, 2014 · 1 revision
//f1() -> f1(a)
insert.into('example.js', 
  { func: 'f1' }, 
  { param: 'a' }
});

//obj.f1(a) -> obj.f1(a, 'b')
insert.parameter.funcCall('example.js', 
{
  obj: 'obj',
  func: 'f1'
}, {
  parm: 'b',
  type: 'literal'
});

//obj.f1([a]) -> obj.f1([a, b]);
insert.parameter.funcCall('example', 
{  
  obj: 'obj',
  func: 'f1'
}, {
  arr: {
    param: 'b'
  }
});

//obj1.f1(function (a) {}) -> obj1.f1(function (a, 'b') {})
insert.parameter.funcCall('example.js', 
{
  obj: 'obj',
  func: 'f1'
}, {
  func: {
    param: 'b',
    type: 'literal'
  }
});

//obj1.f1({}); -> obj1.f1({a: a});
insert.parameter.funcCall('example.js',
{
  obj: 'obj',
  func: 'f1'
}, {
  obj: {
    key: a,
    value: a
  }
});

//obj1.f1({}); -> obj1.f1({a: 'a'});
insert.parameter.funcCall('example.js',
{
  obj: 'obj',
  func: 'f1'
}, {
  obj: {
    key: a,
    value: a,
    type: 'literal'
  }
});
Clone this wiki locally