UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

19 lines 633 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arrayNormalizeEmptyToUndefined = void 0; /** * @public * Replaces length 0 `ArrayLike` with `undefined`. * @returns `array` if it's an `ArrayLike` of length greater than 0, otherwise `undefined`. * * @remarks * See {@link arrayNormalizeEmptyToUndefined}. */ function arrayNormalizeEmptyToUndefined(array) { if (array == null || array.length === 0) { return undefined; } return array; } exports.arrayNormalizeEmptyToUndefined = arrayNormalizeEmptyToUndefined; //# sourceMappingURL=array-normalize-empty-to-undefined.js.map