Skip to content

Commit c293bcf

Browse files
author
Ovidiu Barabula
committed
feat(util): add plugin prefix helper function
1 parent 027c3c9 commit c293bcf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/util/utility-functions.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import { stdout } from 'test-console';
88
import {
99
ERRORS,
1010
getFnName,
11+
hasAllKeys,
1112
hasNested,
1213
limitFn,
14+
pluginPrefix,
1315
range,
1416
required,
1517
retry,
1618
sleep,
17-
hasAllKeys,
1819
} from './utility-functions';
1920

2021
describe('Utility Functions', () => {
@@ -384,4 +385,11 @@ describe('Utility Functions', () => {
384385
assert.throws(() => hasAllKeys(subject, 'keyA', 1, true), ERRORS.HAS_ALL_KEYS_NEEDS_KEYS_ARRAY);
385386
});
386387
});
388+
389+
390+
describe('pluginPrefix()', () => {
391+
it('returns plugin prefix', () => {
392+
expect(pluginPrefix('myplugin')).to.equal('plugin-myplugin:');
393+
});
394+
});
387395
});

src/util/utility-functions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,11 @@ export function hasAllKeys(
288288

289289
return keys.every(key => hasNested(object, key));
290290
}
291+
292+
293+
/**
294+
* Create plugin namespace prefix
295+
*/
296+
export function pluginPrefix(namespace: string): string {
297+
return `plugin-${namespace}:`;
298+
}

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