INNER CODE UNIT · TypeScript

j

mifi/instauto · src/index.ts:202

    const j = Math.floor(Math.random() * (i + 1));
    const temp = array[i];
    if (temp === undefined || array[j] === undefined) {
      throw new Error('Invalid shuffle index');
    }
    array[i] = array[j]; // eslint-disable-line no-param-reassign
    array[j] = temp; // eslint-disable-line no-param-reassign
  }
  return array;
}

// https://stackoverflow.com/questions/14822153/escape-single-quote-in-xpath-with-nokogiri
// example str: "That's mine", he said.
function escapeXpathStr(str: string): string {
  const parts = str.split("'").map((token: string) => `'${token}'`);
  if (parts.length === 1) return `${parts[0]}`;
  const str2 = parts.join(', "\'", ');
  return `concat(${str2})`;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…