Code coverage report for harmonizer/transform/rest-param.js

Statements: 100% (13 / 13)      Branches: 100% (0 / 0)      Functions: 100% (2 / 2)      Lines: 100% (13 / 13)      Ignored: none     

All files » harmonizer/transform/ » rest-param.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  1 1 1 1 1 10 5 5 5 5 5 5     1
'use strict';
var objectPatternA = require('../util/slice');
var getSliceId = objectPatternA.getSliceId;
var objectPattern = require('../util/string');
var express = objectPattern.express;
function restify(program) {
  program.search('#Function[rest!=null]').forEach(function (node) {
    var block = node.body.body;
    var length = node.params.length;
    var sliceId = getSliceId(program).clone();
    var declaration = express('var ' + node.rest.name + ' = ' + sliceId.name + '.call(arguments, ' + length + ')');
    node.rest = null;
    block.unshift(declaration);
  });
}
exports.transform = restify;