UNPKG

assertthat

Version:
30 lines (29 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertActualIsNotEmpty = void 0; const assertArrayIsNotEmpty_1 = require("../../forArrays/assertArrayIsNotEmpty"); const assertMapIsNotEmpty_1 = require("../../forMaps/assertMapIsNotEmpty"); const assertObjectIsNotEmpty_1 = require("../../forObjects/assertObjectIsNotEmpty"); const assertSetIsNotEmpty_1 = require("../../forSets/assertSetIsNotEmpty"); const assertStringIsNotEmpty_1 = require("../../forStrings/assertStringIsNotEmpty"); const errors_1 = require("../../../errors"); const typedescriptor_1 = require("typedescriptor"); const assertActualIsNotEmpty = function (actual) { if ((0, typedescriptor_1.isArray)(actual)) { return (0, assertArrayIsNotEmpty_1.assertArrayIsNotEmpty)(actual); } if ((0, typedescriptor_1.isMap)(actual)) { return (0, assertMapIsNotEmpty_1.assertMapIsNotEmpty)(actual); } if ((0, typedescriptor_1.isSet)(actual)) { return (0, assertSetIsNotEmpty_1.assertSetIsNotEmpty)(actual); } if ((0, typedescriptor_1.isString)(actual)) { return (0, assertStringIsNotEmpty_1.assertStringIsNotEmpty)(actual); } if ((0, typedescriptor_1.isObject)(actual)) { return (0, assertObjectIsNotEmpty_1.assertObjectIsNotEmpty)(actual); } throw new errors_1.InvalidOperation(); }; exports.assertActualIsNotEmpty = assertActualIsNotEmpty;