shim.js 457 B

123456789101112131415
  1. 'use strict';
  2. var toPosInt = require('../../number/to-pos-integer')
  3. , validValue = require('../../object/valid-value')
  4. , reduce = Array.prototype.reduce;
  5. module.exports = function (callSite/*, …substitutions*/) {
  6. var args, rawValue = Object(validValue(Object(validValue(callSite)).raw));
  7. if (!toPosInt(rawValue.length)) return '';
  8. args = arguments;
  9. return reduce.call(rawValue, function (a, b, i) {
  10. return a + String(args[i]) + b;
  11. });
  12. };