mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-23 20:55:41 +00:00
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
21 lines
606 B
JavaScript
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');
|
|
}
|