What is Nostr?
Kyva :veenk_logo: /
npub16rs…y98g
2024-12-18 19:31:35

Kyva :veenk_logo: on Nostr: Recursividad, antes la evitaba, ahora la busco 👉👈 const propIsTrue = (obj, ...

Recursividad, antes la evitaba, ahora la busco 👉👈


const propIsTrue = (obj, prop) => {
const [head, ...tail] = prop.split(".");
if (tail.length === 0) return obj[head] === true || obj[head] === 1;
if (!obj[head]) return false;
return propIsTrue(obj[head], tail.join("."));
};

const test = propIsTrue(
{
finances: {
customDonation: {
bankTransfer: true,
},
},
},
"finances.customDonation.bankTransfer"
);#dev
Author Public Key
npub16rsfm2undrvnfeuy38rvmfj3urpgmr6dzl2s79yhncdkr9c9kqasqfy98g