Skip to content

Commit bea24aa

Browse files
author
Ovidiu Barabula
committed
fix(core): remove prefix from object keys fetched with config manager proxy
1 parent f742d36 commit bea24aa

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/config-manager/config-manager-proxy.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ describe('ConfigManagerProxy', () => {
129129
await configManager.set(`${pluginPrefix('myplugin')}option3`, 'value3');
130130

131131
return expect(configProxy.get()).to.eventually.deep.equal({
132-
'plugin-myplugin:option1': 'value1',
133-
'plugin-myplugin:option2': 'value2',
134-
'plugin-myplugin:option3': 'value3',
132+
option1: 'value1',
133+
option2: 'value2',
134+
option3: 'value3',
135135
});
136136
});
137137

src/config-manager/config-manager-proxy.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ export default function ConfigManagerProxy(
4949
// Filter option keys and get all that begin with the prefix
5050
const filteredKeys = Object.keys(config).filter(item => item.match(RegExp(`^${prefix}`)));
5151
// Create new config object with the filtered key/value pairs
52-
return filteredKeys.reduce((prefixedConfig, item) =>
53-
({
54-
...prefixedConfig,
55-
...{ [item]: config[item],
56-
}}), {});
52+
return prefixer.remove(
53+
filteredKeys.reduce((prefixedConfig, item) =>
54+
({
55+
...prefixedConfig,
56+
...{ [item]: config[item],
57+
}}), {}),
58+
);
5759
}
5860

5961
if (typeof key === 'string') {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy