Нет описания

WebViewShared.js 451B

1234567891011121314151617
  1. 'use strict';
  2. const escapeStringRegexp = require('escape-string-regexp');
  3. const WebViewShared = {
  4. defaultOriginWhitelist: ['http://*', 'https://*'],
  5. extractOrigin: (url) => {
  6. const result = /^[A-Za-z0-9]+:(\/\/)?[^/]*/.exec(url);
  7. return result === null ? null : result[0];
  8. },
  9. originWhitelistToRegex: (originWhitelist) => {
  10. return escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*');
  11. },
  12. };
  13. export default WebViewShared;