Compare commits

...

2 Commits

Author SHA1 Message Date
92f36fdb5b Bump 0.30.7
All checks were successful
Build / Publish Docs (push) Successful in 54s
Build / Build NPM Project (push) Successful in 34s
Build / Tag Version (push) Successful in 9s
2026-08-17 14:56:41 -04:00
721fe2dcf8 Patched prototype pollution
Some checks failed
Build / Tag Version (push) Has been cancelled
Build / Build NPM Project (push) Has been cancelled
Build / Publish Docs (push) Has been cancelled
2026-08-17 14:56:18 -04:00
2 changed files with 357 additions and 355 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ztimson/utils", "name": "@ztimson/utils",
"version": "0.30.6", "version": "0.30.7",
"description": "Utility library", "description": "Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",

View File

@@ -97,8 +97,10 @@ export function deepCopy<T>(value: T): T {
* @return {any} The des * @return {any} The des
*/ */
export function deepMerge<T>(target: any, ...sources: any[]): T { export function deepMerge<T>(target: any, ...sources: any[]): T {
const BLOCKED = new Set(['__proto__', 'constructor', 'prototype']);
sources.forEach(s => { sources.forEach(s => {
for(const key in s) { for(const key in s) {
if(BLOCKED.has(key) || !Object.prototype.hasOwnProperty.call(s, key)) continue;
if(s[key] && typeof s[key] == 'object' && !Array.isArray(s[key])) { if(s[key] && typeof s[key] == 'object' && !Array.isArray(s[key])) {
if(!target[key]) target[key] = {}; if(!target[key]) target[key] = {};
deepMerge(target[key], s[key]); deepMerge(target[key], s[key]);