Skip to content

Commit

Permalink
comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivanshu-07 committed Feb 14, 2025
1 parent b5314ce commit 370d572
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/config/src/utils/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const CAMELCASE_MAP = new Map([
// Regular expression that matches words from boundaries or consecutive casing
const WORD_REG = /[a-z]{2,}|[A-Z]{2,}|[0-9]{2,}|[^-_\s]+?(?=[A-Z0-9-_\s]|$)/g;

// Unsafe keys list
const unsafeKeys = ['__proto__', 'constructor', 'prototype', 'toString', 'valueOf',
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__'];

// Converts kebab-cased and snake_cased strings to camelCase.
export function camelcase(str) {
if (typeof str !== 'string') return str;
Expand Down Expand Up @@ -70,8 +74,6 @@ export function normalize(object, options) {

// Utility function to prevent prototype pollution
export function isSafeKey(key) {
const unsafeKeys = ['__proto__', 'constructor', 'prototype', 'toString', 'valueOf',
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__'];
return !unsafeKeys.includes(key);
}

Expand Down

0 comments on commit 370d572

Please # to comment.