ipbcrawler
Version:
Package to mine forum data using the Invision Power Board platform.
26 lines (23 loc) • 777 B
JavaScript
module.exports.accessElementInformation = cb => ($) => element => cb($(element), $)
module.exports.asyncAccessElementInformation = cb => ($) => async element => await cb($(element), $)
module.exports.sendElementToAccessInformation = ({ elements, extractor }) => {
return Array
.from(elements)
.map(element => extractor(element))
}
/**
* [description]
* @param {[type]} options.elements [description]
* @param {[type]} options.extractor [description]
* @return {[type]} [description]
*/
module.exports.asyncSendElementToAccessInformation = async ({ elements, extractor }) => {
try {
return await Promise.all(
elements
.map(async element => await extractor(element))
)
} catch(e) {
console.log(e)
}
}