-
Notifications
You must be signed in to change notification settings - Fork 0
count
Subhajit Sahu edited this page Mar 25, 2021
·
15 revisions
Counts no. of true values. 📦 😺 🏃 📼 🌔 📜 📰 📘
Can be used to implement one-hot / one-cold detector.
count([a], [b], [c], [d], [e], [f], [g], [h])
// a: 1st boolean
// b: 2nd boolean
// c: 3rd boolean
// d: 4th boolean
// e: 5th boolean
// f: 6th boolean
// g: 7th boolean
// h: 8th boolean
const {count} = require("extra-boolean");
count(true, true);
// 2
count(true, false);
// 1
count(true, true, true, false);
// 3 ^ ^ ^
count(false, true, false, false);
// 1 ^