ramda#startsWith TypeScript Examples
The following examples show how to use
ramda#startsWith.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: vaccinationQRHelper.ts From back-home-safe with GNU General Public License v3.0 | 6 votes |
parseData = (input: string[]) => {
if (input[1] === "EVT" && input.length === 12) {
return parseQRCode1(schemaVersionType.EVT1, input);
} else if (input[1] === "EVT" && input.length === 13) {
return parseQRCode1(schemaVersionType.EVT1_1, input);
} else if (input[1] === "VAC" && startsWith("2", input[2])) {
return parseQRCode2(schemaVersionType.VAC2, input);
} else if (input[1] === "VAC" && startsWith("3", input[2])) {
return parseQRCode2(schemaVersionType.VAC3, input);
} else if (input[1] !== "VAC" || !startsWith("4", input[2])) {
// Invalid QR Code prefix2
return null;
} else {
return parseQRCode2(schemaVersionType.VAC4, input);
}
}
Example #2
Source File: HashGenerator.ts From react-js-tutorial with MIT License | 6 votes |
findHash = (str: string, startFrom = "0"): string => {
let nonce = 0;
let hash = generateHash(nonce, str);
while (!startsWith(startFrom, hash)) {
nonce = inc(nonce);
hash = generateHash(nonce, str);
}
console.warn(`str: ${str}`);
console.warn(`nonce counter: ${nonce}`);
return hash;
}