Skip to content

Commit fd0245b

Browse files
committed
1 parent 8fc6461 commit fd0245b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/core/optionsProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function optionsProvider<T = unknown>(
3030
responsiveOptions.forEach(responsiveOption => {
3131
const mql = window.matchMedia(responsiveOption[0]);
3232
if (mql.matches) {
33-
currentOptions = extend(currentOptions, responsiveOption[1]);
33+
currentOptions = extend({}, currentOptions, responsiveOption[1]);
3434
}
3535
});
3636
}

src/utils/extend.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export function extend<T, A, B>(target: T, a: A, b: B): T & A & B;
1111
export function extend(target: any = {}, ...sources: any[]) {
1212
for (let i = 0; i < sources.length; i++) {
1313
const source = sources[i];
14+
const targetProto = Object.getPrototypeOf(target);
1415
for (const prop in source) {
16+
if (targetProto !== null && prop in targetProto) {
17+
continue; // prevent prototype pollution
18+
}
1519
const sourceProp = source[prop];
1620
if (
1721
typeof sourceProp === 'object' &&

0 commit comments

Comments
 (0)