UNPKG

@daysnap/utils

Version:
18 lines (16 loc) 369 B
// src/formatPathParams.ts function formatPathParams(path, params = {}) { const rest = { ...params }; if (path.includes("{")) { Object.keys(rest).forEach((key) => { if (path.includes(`{${key}}`)) { path = path.replace(`{${key}}`, rest[key]); delete rest[key]; } }); } return { path, rest }; } export { formatPathParams };