main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
783 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
---|
| 4 | exports.__esModule = true;
|
---|
| 5 | exports.default = idFromPathMethod;
|
---|
| 6 | var _replaceSpecialCharsWithUnderscore = _interopRequireDefault(require("../replace-special-chars-with-underscore.js"));
|
---|
| 7 | function idFromPathMethod(pathName, method, {
|
---|
| 8 | v2OperationIdCompatibilityMode
|
---|
| 9 | } = {}) {
|
---|
| 10 | if (v2OperationIdCompatibilityMode) {
|
---|
| 11 | let res = `${method.toLowerCase()}_${pathName}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g, '_');
|
---|
| 12 | res = res || `${pathName.substring(1)}_${method}`;
|
---|
| 13 | return res.replace(/((_){2,})/g, '_').replace(/^(_)*/g, '').replace(/([_])*$/g, '');
|
---|
| 14 | }
|
---|
| 15 | return `${method.toLowerCase()}${(0, _replaceSpecialCharsWithUnderscore.default)(pathName)}`;
|
---|
| 16 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.