From 63469d30e4514136651ae0bbe08e2d3046b02024 Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Thu, 2 Apr 2020 02:47:12 -0500 Subject: [PATCH] Use `Object.setPrototypeOf` as `__proto__` could potentially be disabled (#387) --- source/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.js b/source/index.js index 53fcc16..4ab1271 100644 --- a/source/index.js +++ b/source/index.js @@ -139,9 +139,9 @@ const createBuilder = (self, _styler, _isEmpty) => { return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); }; - // `__proto__` is used because we must return a function, but there is + // We alter the prototype because we must return a function, but there is // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto + Object.setPrototypeOf(builder, proto); builder._generator = self; builder._styler = _styler;