main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
576 bytes
|
Line | |
---|
1 | import replaceSpecialCharsWithUnderscore from '../replace-special-chars-with-underscore.js';
|
---|
2 | export default function idFromPathMethod(pathName, method, {
|
---|
3 | v2OperationIdCompatibilityMode
|
---|
4 | } = {}) {
|
---|
5 | if (v2OperationIdCompatibilityMode) {
|
---|
6 | let res = `${method.toLowerCase()}_${pathName}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g, '_');
|
---|
7 | res = res || `${pathName.substring(1)}_${method}`;
|
---|
8 | return res.replace(/((_){2,})/g, '_').replace(/^(_)*/g, '').replace(/([_])*$/g, '');
|
---|
9 | }
|
---|
10 | return `${method.toLowerCase()}${replaceSpecialCharsWithUnderscore(pathName)}`;
|
---|
11 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.