UNPKG

@oap75/utils

Version:
15 lines (14 loc) 630 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asString = exports.nonEmptyStr = exports.isEmptyStr = exports.isStr = void 0; const defined_1 = require("./defined"); const isStr = (x) => typeof x === 'string'; exports.isStr = isStr; const isEmptyStr = (x) => (0, defined_1.notDefined)(x) || ((0, exports.isStr)(x) && x.trim().length === 0); exports.isEmptyStr = isEmptyStr; const nonEmptyStr = (x) => (0, exports.isStr)(x) && x.trim().length > 0; exports.nonEmptyStr = nonEmptyStr; const asString = (x) => { return typeof x === 'string' ? x : x.toString(); }; exports.asString = asString;