UNPKG

faker-api

Version:

A fully customizible rest api faking package that allows you to mock , clone and fake Rest API with fake yet realistic data

36 lines 1.14 kB
declare type ParamsType = { [key: string]: any; }; /** * Performs an comparison of the current path to the path format * Basically it will extract dynamic parameters from the currentPath that has thesame position with a /:param/ in the pathFormat * * Example * * ```javascript * console.log(isMatch("/:id/info", "/5/info")) * ``` * * This will return * * >```json * >{ * >"id" : 5 * >} * >``` * * @param {string} pathFormat The path format to compare the currentPath to * * @param {string} currentPath The actual path which will be compared to the format and data will be extracted * * @param {boolean} stripEnd If ending trailing forward slashes would be omitted * * @returns {undefined | ParamsType} Undefined if currentPath does not match pathFormat, else an Object that contains all exracted params with key as the param name and the value as the extacted data * . */ declare function isMatch(pathFormat: string, currentPath: string, stripEnd?: boolean): undefined | ParamsType; declare const Path: { isMatch: typeof isMatch; }; export { Path as PathUtil, ParamsType }; //# sourceMappingURL=path.d.ts.map