freeze tagged template literal object - fixes #328

This commit is contained in:
Sebastian McKenzie 2014-12-22 21:36:59 +11:00
parent 4ea425ac7b
commit bc914e6f23
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
(function (strings, raw) { (function (strings, raw) {
return Object.defineProperties(strings, { raw: { value: raw } }); return Object.freeze(Object.defineProperties(strings, { raw: { value: raw } }));
}); });

View File

@ -1,11 +1,11 @@
"use strict"; "use strict";
var _taggedTemplateLiteral = function (strings, raw) { var _taggedTemplateLiteral = function (strings, raw) {
return Object.defineProperties(strings, { return Object.freeze(Object.defineProperties(strings, {
raw: { raw: {
value: raw value: raw
} }
}); }));
}; };
var foo = bar(_taggedTemplateLiteral(["wow\na", "b ", ""], ["wow\\na", "b ", ""]), 42, _.foobar()); var foo = bar(_taggedTemplateLiteral(["wow\na", "b ", ""], ["wow\\na", "b ", ""]), 42, _.foobar());