Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
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");
}
.filter(({type, normalized}) => type === "string" && isURL(encodeURI(normalized)))
.forEach(({element, entityDelimiter, normalized}) => {
function link2Url({ args }) {
if (args[0] && isUrl(args[0].url)) {
return { args: [args[0].url] };
}
return { args: [] };
}
function isRemoteUri (uri) {
return isUrl(uri) || uri.includes('@') || !fs.existsSync(uri);
}
return async function http(uri: string, ctx: Context): Promise {
if (!isUrl(uri)) {
return null;
}
return new URL(uri).href;
};
}
}
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,
public static isURL(path: string): boolean {
return isURL(path);
}
}
export const isImageUrl = (str = '') => {
if (!isUrl(str)) {
return false
}
return !!imageExtensions.find(ext => str.endsWith(ext))
}