Commit 072cdc6c authored by Milan Wikarski's avatar Milan Wikarski
Browse files

Divided is into is and force

parent b33b349a
......@@ -92,4 +92,9 @@ is.emptyString = _is.emptyString;
is.instance = _is.instance;
module.exports = is;
module.exports = {
is,
force: {
array: require('./src/force-array')
}
};
/**
* Returns val if val is array; [val] otherwise
*
* @param {*} val
* @returns {any[]}
*/
function forceArray(val) {
if (!Array.isArray(val)) {
return [val];
}
return val;
}
module.exports = forceArray;
const is = require('../index');
const { is, force } = require('../index');
// console.log([
// is.array(['foo', 'bar']),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment