var $ = require('../internals/export');
var toIndexedObject = require('../internals/to-indexed-object');
var toLength = require('../internals/to-length');
var toString = require('../internals/to-string');

// `String.raw` method
// https://tc39.es/ecma262/#sec-string.raw
$({ target: 'String', stat: true }, {
  raw: function raw(template) {
    var rawTemplate = toIndexedObject(template.raw);
    var literalSegments = toLength(rawTemplate.length);
    var argumentsLength = arguments.length;
    var elements = [];
    var i = 0;
    while (literalSegments > i) {
      elements.push(toString(rawTemplate[i++]));
      if (i < argumentsLength) elements.push(toString(arguments[i]));
    } return elements.join('');
  }
});

@@ -94,24 +94,74 @@
 d-object');%0A
+var toObject = require('../internals/to-object');%0A
 var toLength
@@ -249,16 +249,119 @@
 ing');%0A%0A
+var ArrayPrototype = Array.prototype;%0Avar push = ArrayPrototype.push;%0Avar join = ArrayPrototype.join;%0A%0A
 // %60Stri
@@ -526,24 +526,33 @@
 dObject(
+toObject(
 template
 .raw);%0A 
@@ -543,16 +543,17 @@
 template
+)
 .raw);%0A 
@@ -729,24 +729,34 @@
 %7B%0A      
+push.call(
 elements
 .push(to
@@ -739,38 +739,34 @@
 sh.call(elements
-.push(
+, 
 toString(rawTemp
@@ -809,24 +809,34 @@
 Length) 
+push.call(
 elements
 .push(to
@@ -831,14 +831,10 @@
 ents
-.push(
+, 
 toSt
@@ -867,24 +867,34 @@
  return 
+join.call(
 elements
 .join(''
@@ -889,14 +889,10 @@
 ents
-.join(
+, 
 '');

make `String.raw` a little safer