How to use the is_js.url function in is_js

To help you get started, we’ve selected a few is_js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DextApp / dext / app / main / plugins / plugins.js View on Github external
items.map(i => {
    const icon = {
      type: i && i.icon && i.icon.type,
      path: '',
    };
    if (i.icon && i.icon.path) {
      icon.path = i.icon.path;
      const isBase64 = /data:image\/.*;base64/.test(i.icon.path);
      if (!is.url(i.icon.path) && !isBase64) {
        icon.path = path.resolve(plugin.path, i.icon.path);
      }
    }
    // if an icon isn't set, fallback to the icon.png file in the plugin's directory
    if (!icon.path) {
      icon.path = path.resolve(plugin.path, 'icon.png');
    }
    const newObject = deepAssign({}, i);
    newObject.plugin = {
      path: plugin.path,
      name: plugin.name,
    };
    if (plugin.keyword) {
      newObject.keyword = plugin.keyword;
    }
    if (plugin.action) {
github finos / cla-bot / cla-bot / contributionVerifier.js View on Github external
const configCopy = Object.assign({}, config);

  // handle the 'legacy' configuration where each type had its own propery
  if (configCopy.contributorListGithubUrl) {
    configCopy.contributors = configCopy.contributorListGithubUrl;
  } else if (config.contributorListUrl) {
    configCopy.contributors = configCopy.contributorListUrl;
  } else if (config.contributorWebhook) {
    configCopy.contributors = configCopy.contributorWebhook;
  }

  if (configCopy.contributors) {
    if (is.array(configCopy.contributors)) {
      console.info('INFO', 'Checking contributors against the list supplied in the .clabot file');
      return contributorArrayVerifier(configCopy.contributors);
    } else if (is.url(configCopy.contributors) && configCopy.contributors.indexOf('api.github.com') !== -1) {
      console.info('INFO', 'Checking contributors against the github URL supplied in the .clabot file');
      return configFileFromGithubUrlVerifier(configCopy.contributors);
    } else if (is.url(configCopy.contributors) && configCopy.contributors.indexOf('?') !== -1) {
      console.info('INFO', 'Checking contributors against the webhook supplied in the .clabot file');
      return webhookVerifier(configCopy.contributors);
    } else if (is.url(configCopy.contributors)) {
      console.info('INFO', 'Checking contributors against the URL supplied in the .clabot file');
      return configFileFromUrlVerifier(configCopy.contributors);
    }
  }
  throw new Error('A mechanism for verifying contributors has not been specified');
};
github OpenBazaar / openbazaar-desktop / js / models / chat / ChatMessage.js View on Github external
wordsToAnchorify.forEach(word => {
    let href = !is.url(word) && !word.startsWith('ob://') ?
      `#ob://${word}` : word;

    if (is.url(word)) {
      const link = document.createElement('a');
      link.setAttribute('href', word);
      if (link.protocol === 'file:') {
        href = `http://${word}`;
      }
    }

    processedMessage = processedMessage
      .split(word)
      .join(`<a class="clrTEm" href="${href}">${word}</a>`);
  });
github finos / cla-bot / cla-bot / contributionVerifier.js View on Github external
configCopy.contributors = configCopy.contributorListUrl;
  } else if (config.contributorWebhook) {
    configCopy.contributors = configCopy.contributorWebhook;
  }

  if (configCopy.contributors) {
    if (is.array(configCopy.contributors)) {
      console.info('INFO', 'Checking contributors against the list supplied in the .clabot file');
      return contributorArrayVerifier(configCopy.contributors);
    } else if (is.url(configCopy.contributors) && configCopy.contributors.indexOf('api.github.com') !== -1) {
      console.info('INFO', 'Checking contributors against the github URL supplied in the .clabot file');
      return configFileFromGithubUrlVerifier(configCopy.contributors);
    } else if (is.url(configCopy.contributors) && configCopy.contributors.indexOf('?') !== -1) {
      console.info('INFO', 'Checking contributors against the webhook supplied in the .clabot file');
      return webhookVerifier(configCopy.contributors);
    } else if (is.url(configCopy.contributors)) {
      console.info('INFO', 'Checking contributors against the URL supplied in the .clabot file');
      return configFileFromUrlVerifier(configCopy.contributors);
    }
  }
  throw new Error('A mechanism for verifying contributors has not been specified');
};
github OpenBazaar / openbazaar-desktop / js / models / order / orderFulfillment / DigitalDelivery.js View on Github external
validate(attrs) {
    const errObj = {};
    const addError = (fieldName, error) => {
      errObj[fieldName] = errObj[fieldName] || [];
      errObj[fieldName].push(error);
    };

    if (!attrs.url || (typeof attrs.url === 'string' && !attrs.url.trim())) {
      addError('url', app.polyglot.t('orderFulfillmentModelErrors.provideUrl'));
    } else if (!is.url(attrs.url)) {
      addError('url', app.polyglot.t('orderFulfillmentModelErrors.invalidUrl'));
    }

    if (Object.keys(errObj).length) return errObj;

    return undefined;
  }
}
github OpenBazaar / openbazaar-desktop / js / views / search / Search.js View on Github external
urlTypes.push('vendors');
      }
      if (is.url(data.links.listings)) {
        update.listings = data.links.listings;
        urlTypes.push('listings');
      }
      if (is.url(data.links.reports)) {
        update.reports = data.links.reports;
        urlTypes.push('reports');
      }
      if (data.links.tor) {
        if (is.url(data.links.tor.listings)) {
          update.torListings = data.links.tor.listings;
          urlTypes.push('torlistings');
        }
        if (is.url(data.links.tor.vendors)) {
          update.torVendors = data.links.tor.vendors;
          urlTypes.push('torVendors');
        }
        if (is.url(data.links.tor.reports)) {
          update.torReports = data.links.tor.reports;
          urlTypes.push('torReports');
        }
      }
    }

    return {
      update,
      urlTypes,
    };
  }
github OpenBazaar / openbazaar-desktop / js / views / search / Search.js View on Github external
if (data.logo && is.url(data.logo)) update.logo = data.logo;
    if (data.links) {
      if (is.url(data.links.vendors)) {
        update.vendors = data.links.vendors;
        urlTypes.push('vendors');
      }
      if (is.url(data.links.listings)) {
        update.listings = data.links.listings;
        urlTypes.push('listings');
      }
      if (is.url(data.links.reports)) {
        update.reports = data.links.reports;
        urlTypes.push('reports');
      }
      if (data.links.tor) {
        if (is.url(data.links.tor.listings)) {
          update.torListings = data.links.tor.listings;
          urlTypes.push('torlistings');
        }
        if (is.url(data.links.tor.vendors)) {
          update.torVendors = data.links.tor.vendors;
          urlTypes.push('torVendors');
        }
        if (is.url(data.links.tor.reports)) {
          update.torReports = data.links.tor.reports;
          urlTypes.push('torReports');
        }
      }
    }

    return {
      update,
github OpenBazaar / openbazaar-desktop / js / views / search / Search.js View on Github external
urlTypes.push('listings');
      }
      if (is.url(data.links.reports)) {
        update.reports = data.links.reports;
        urlTypes.push('reports');
      }
      if (data.links.tor) {
        if (is.url(data.links.tor.listings)) {
          update.torListings = data.links.tor.listings;
          urlTypes.push('torlistings');
        }
        if (is.url(data.links.tor.vendors)) {
          update.torVendors = data.links.tor.vendors;
          urlTypes.push('torVendors');
        }
        if (is.url(data.links.tor.reports)) {
          update.torReports = data.links.tor.reports;
          urlTypes.push('torReports');
        }
      }
    }

    return {
      update,
      urlTypes,
    };
  }
github OpenBazaar / openbazaar-desktop / js / views / search / Search.js View on Github external
buildProviderUpdate(data) {
    const update = {};
    const urlTypes = [];

    if (data.name && is.string(data.name)) update.name = data.name;
    if (data.logo && is.url(data.logo)) update.logo = data.logo;
    if (data.links) {
      if (is.url(data.links.vendors)) {
        update.vendors = data.links.vendors;
        urlTypes.push('vendors');
      }
      if (is.url(data.links.listings)) {
        update.listings = data.links.listings;
        urlTypes.push('listings');
      }
      if (is.url(data.links.reports)) {
        update.reports = data.links.reports;
        urlTypes.push('reports');
      }
      if (data.links.tor) {
        if (is.url(data.links.tor.listings)) {
          update.torListings = data.links.tor.listings;
github ColinEberhardt / applause-button / server / handler.js View on Github external
const isurl = url => url.match(/^http:\/\/localhost:\d*\/?$/) || is.url(url);