mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fix snake-case of arrays
This commit is contained in:
@@ -3,8 +3,11 @@ const snakeCase = require('to-snake-case');
|
||||
const isObject = (value) => typeof value === 'object' && value !== null;
|
||||
|
||||
const snakeObject = (obj, excludes) => {
|
||||
const target = {};
|
||||
if (Array.isArray(obj)) return obj.map((o) => {
|
||||
return isObject(o) ? snakeObject(o, excludes) : o;
|
||||
});
|
||||
|
||||
const target = {};
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (excludes.includes(key)) {
|
||||
target[key] = value;
|
||||
|
||||
Reference in New Issue
Block a user