This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/core-js/modules/es.string.raw.js
2020-11-01 22:46:04 +00:00

20 lines
679 B
JavaScript

var $ = require('../internals/export');
var toIndexedObject = require('../internals/to-indexed-object');
var toLength = require('../internals/to-length');
// `String.raw` method
// https://tc39.github.io/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(String(rawTemplate[i++]));
if (i < argumentsLength) elements.push(String(arguments[i]));
} return elements.join('');
}
});