pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
14 lines (13 loc) • 424 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.count = void 0;
const main_1 = require("./main");
function count(coll) {
const theColl = (0, main_1.getValueOr)("", coll);
return theColl instanceof Array || typeof theColl === "string"
? theColl.length
: theColl instanceof Object
? Object.keys(theColl).length
: 0;
}
exports.count = count;