source: node_modules/swagger-client/lib/helpers/id-from-path-method/index.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 783 bytes
Line 
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4exports.__esModule = true;
5exports.default = idFromPathMethod;
6var _replaceSpecialCharsWithUnderscore = _interopRequireDefault(require("../replace-special-chars-with-underscore.js"));
7function 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.