UNPKG

626 BJavaScriptView Raw
1'use strict';
2var uncurryThis = require('../internals/function-uncurry-this');
3var requireObjectCoercible = require('../internals/require-object-coercible');
4var toString = require('../internals/to-string');
5
6var quot = /"/g;
7var replace = uncurryThis(''.replace);
8
9// `CreateHTML` abstract operation
10// https://tc39.es/ecma262/#sec-createhtml
11module.exports = function (string, tag, attribute, value) {
12 var S = toString(requireObjectCoercible(string));
13 var p1 = '<' + tag;
14 if (attribute !== '') p1 += ' ' + attribute + '="' + replace(toString(value), quot, '&quot;') + '"';
15 return p1 + '>' + S + '</' + tag + '>';
16};