Files
bruno/packages/bruno-app/src/utils/common/bulkKeyValueUtils.js
sanjai0py f2b5b6f783 refactor: implementation of bulk edit functionality for query parameters and request headers
refactor: integrate BulkEditCodeEditor for bulk editing of query parameters and request headers

refactor: refactor BulkEditCodeEditor component folder structure nad fix Bulk Edit button styles

refactor: now the queryparams are updated in both the ways

style: fix indentation

reverting the style changes which  fixes the alignment of the bulkedit button

refactor: add onSave prop to BulkEditCodeEditor and update value handling

feat: add onSave prop to BulkEditCodeEditor for improved header management

added onRun prop to BulkEditCodeEditor, QueryParams, and RequestHeaders

refactor: renamed BulkEditCodeEditor to BulkEditor and update the references, and updated names for bulkEdit states
2025-06-27 17:06:29 +05:30

21 lines
606 B
JavaScript

export function parseBulkKeyValue(value) {
return value
.split(/\r?\n/)
.map((pair) => {
const isEnabled = !pair.trim().startsWith('//');
const cleanPair = pair.replace(/^\/\/\s*/, '');
const sep = cleanPair.indexOf(':');
if (sep < 0) return null;
return {
name: cleanPair.slice(0, sep).trim(),
value: cleanPair.slice(sep + 1).trim(),
enabled: isEnabled
};
})
.filter(Boolean);
}
export function serializeBulkKeyValue(items) {
return items.map((item) => `${item.enabled ? '' : '//'}${item.name}:${item.value}`).join('\n');
}