algebra
Version:
means completeness and balancing, from the Arabic word الجبر
23 lines (16 loc) • 317 B
JavaScript
const no = require('not-defined')
/**
* Extract data attribute, if any, and check it
*
* @param {*} arg
*
* @returns {*} data
*/
function toData (arg) {
let data
if (no(arg.data)) data = arg
else data = arg.data
if (no(data)) throw new TypeError('No data')
return data
}
module.exports = toData