4chan-full
Version:
www.4chan.org non-official read only api. That supports cool things!
19 lines (16 loc) • 491 B
JavaScript
const boards = require("../other/boards");
/**
* @param {String} input
* @returns {{worksafe: Boolean, name: String, code: String}}
*/
function findBoard(input = "") {
return boards.find((i) => {
const lowerName = i.name.toLowerCase();
const lowerInput = input.toLowerCase();
return (
i.code == lowerInput ||
lowerName.replace(/[^a-zA-Z0-9]+/gm, "") == lowerInput.replace(/[^a-zA-Z0-9]+/gm, "")
);
});
}
module.exports = { findBoard };