@contentacms/contentajs
Version:
A nodejs server that proxies to Contenta CMS and holds custom code.
12 lines (11 loc) • 343 B
JavaScript
;
/**
* Takes a list of paths in Open API format and makes them into regexps.
*
* @param {string[]} paths
* The Open API paths.
*
* @return {string[]}
* The list of strings ready to feed a RegExp.
*/
module.exports = paths => paths.map(p => p.replace('/', '\\/').replace(/{[^{}/]+}/g, '[^\\/]+')).map(p => `^${p}/?$`);