UNPKG

@daysnap/utils

Version:
18 lines (14 loc) 458 B
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// 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 }; } exports.formatPathParams = formatPathParams;