How to use is-url - 9 common examples

To help you get started, we’ve selected a few is-url 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 code-kotis / qr-code-scanner / app / js / main.js View on Github external
QRReader.scan(result => {
      copiedText = result;
      textBoxEle.value = result;
      textBoxEle.select();
      scanningEle.style.display = 'none';
      if (isURL(result)) {
        dialogOpenBtnElement.style.display = 'inline-block';
      }
      dialogElement.classList.remove('app__dialog--hide');
      dialogOverlayElement.classList.remove('app__dialog--hide');
      const frame = document.querySelector('#frame');
      // if (forSelectedPhotos && frame) frame.remove();
    }, forSelectedPhotos);
  }
github kiangkuang / WhoPick / src / poll.js View on Github external
function markdownFormat(msg, format) {
    const lines = msg.split("\n");
    for (let i = 0; i < lines.length; i++) {
        const words = lines[i].split(" ");
        for (let j = 0; j < words.length; j++) {
            if (!isUrl(words[j])) {
                words[j] = format + words[j] + format;
            }
        }
        lines[i] = words.join(" ");
    }
    return lines.join("\n");
}
github cloudflare / InstantPlugin / app / components / attribute-picker / index.js View on Github external
      .filter(({type, normalized}) => type === "string" && isURL(encodeURI(normalized)))
      .forEach(({element, entityDelimiter, normalized}) => {
github kumabook / bebop / src / actions.js View on Github external
function link2Url({ args }) {
  if (args[0] && isUrl(args[0].url)) {
    return { args: [args[0].url] };
  }
  return { args: [] };
}
github alitajs / alita / packages / umi-plugin-cordova / src / create-cordova.ts View on Github external
function isRemoteUri (uri) {
    return isUrl(uri) || uri.includes('@') || !fs.existsSync(uri);
}
github Crypto-Punkers / resolver-engine / packages / core / src / resolvers / uriresolver.ts View on Github external
return async function http(uri: string, ctx: Context): Promise {
    if (!isUrl(uri)) {
      return null;
    }
    return new URL(uri).href;
  };
}
github FactomProject / factom-harmony-connect-js-sdk / lib / resources / Entries.js View on Github external
}
      if (params.signerPrivateKey && CommonUtil.isEmptyString(params.signerChainId)) {
        throw new Error('signerChainId is required when passing a signerPrivateKey.');
      }
      if (params.signerPrivateKey
        && !KeyCommon.validateCheckSum({ signerKey: params.signerPrivateKey })) {
        throw new Error('signerPrivateKey is invalid.');
      }
      if (params.signerChainId && CommonUtil.isEmptyString(params.signerPrivateKey)) {
        throw new Error('signerPrivateKey is required when passing a signerChainId.');
      }
    }
    if (CommonUtil.isEmptyString(params.content)) {
      throw new Error('content is required.');
    }
    if (!CommonUtil.isEmptyString(params.callbackUrl) && !isUrl(params.callbackUrl)) {
      throw new Error('callbackUrl is an invalid url format.');
    }
    if (params.callbackStages && !Array.isArray(params.callbackStages)) {
      throw new Error('callbackStages must be an array.');
    }

    const idsBase64 = [];
    if (autoSign) {
      const timeStamp = (new Date()).toISOString();
      const message = `${params.signerChainId}${params.content}${timeStamp}`;
      const signature = KeyCommon.signContent({
        signerPrivateKey: params.signerPrivateKey,
        message: message,
      });
      const signerPublicKey = KeyCommon.getPublicKeyFromPrivateKey({
        signerPrivateKey: params.signerPrivateKey,
github edsilv / biiif / Utils.ts View on Github external
public static isURL(path: string): boolean {
        return isURL(path);
    }
}
github blocks / blocks / packages / mdx / editor / src / lib / util.js View on Github external
export const isImageUrl = (str = '') => {
  if (!isUrl(str)) {
    return false
  }

  return !!imageExtensions.find(ext => str.endsWith(ext))
}

is-url

Check whether a string is a URL.

MIT
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis

Popular is-url functions