File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ function isValidKey ( key ) {
4
+ return [ '__proto__' , 'prototype' , 'constructor' ] . indexOf ( key ) === - 1 ;
5
+ }
6
+
3
7
/**
4
8
* @namespace Chart.helpers
5
9
*/
@@ -196,7 +200,7 @@ var helpers = {
196
200
* @private
197
201
*/
198
202
_merger : function ( key , target , source , options ) {
199
- if ( [ '__proto__' , 'prototype' , 'constructor' ] . indexOf ( key ) !== - 1 ) {
203
+ if ( ! isValidKey ( key ) ) {
200
204
// We want to ensure we do not copy prototypes over
201
205
// as this can pollute global namespaces
202
206
return ;
@@ -217,6 +221,12 @@ var helpers = {
217
221
* @private
218
222
*/
219
223
_mergerIf : function ( key , target , source ) {
224
+ if ( ! isValidKey ( key ) ) {
225
+ // We want to ensure we do not copy prototypes over
226
+ // as this can pollute global namespaces
227
+ return ;
228
+ }
229
+
220
230
var tval = target [ key ] ;
221
231
var sval = source [ key ] ;
222
232
You can’t perform that action at this time.
0 commit comments