helper.js 429 B

1234567891011121314151617181920
  1. function test (){
  2. console.log('test方法');
  3. }
  4. function IsURL(str_url) {
  5. return (/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/gm).test(str_url);
  6. }
  7. function AnalysisURL(url) {
  8. return /^(https?:\/\/)([0-9a-z.]+)(:[0-9]+)?([/0-9a-z.]+)?(\?[0-9a-z&=]+)?(#[0-9-a-z]+)?/i.exec(url);
  9. }
  10. const permission = {
  11. test:test,
  12. IsURL:IsURL,
  13. AnalysisURL:AnalysisURL
  14. }
  15. module.exports = permission