2017-10-26 33 views

答えて

0

ワイルドカードや正規表現へのパスにあなたのプレースホルダを変換します

mock.onGet(route('/api/colleges/:collegeId/branches/:branchesId')).reply(200); 

function route (path = '') { 
    return typeof path === 'string' 
    ? new RegExp(path.replace(/:\w+/g, '[^/]+')) 
    : path 
} 

は次のように使用します

関連する問題