"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Adds an element to an array if the element is not undefined. Creates a new array if it doesn't exist.
 * Returns the resulting array.
 */
function add(container, element) {
    for (let i = 1; i < arguments.length; i++) {
        element = arguments[i];
        if (element !== undefined) {
            if (container == null) {
                container = [];
            }
            if (container.add) {
                container.add(element);
            }
            else {
                container.push(element);
            }
        }
    }
    return container;
}
exports.default = add;
