Skip to content

Instantly share code, notes, and snippets.

View geekyakshay's full-sized avatar
🎯
EA Hackathon

Akshay Poddar geekyakshay

🎯
EA Hackathon
View GitHub Profile
@geekyakshay
geekyakshay / isValidSfId.js
Created March 14, 2023 07:10 — forked from step307/isValidSfId.js
Javascript check salesforce id validity
function isValidSfId(str) {
// https://stackoverflow.com/a/29299786/1333724
if (typeof str !== 'string' || str.length !== 18) {
return false;
}
let upperCaseToBit = (char) => char.match(/[A-Z]/) ? '1' : '0';
let binaryToSymbol = (digit) => digit <= 25 ? String.fromCharCode(digit + 65) : String.fromCharCode(digit - 26 + 48);
let parts = [