/**
 * @license
 * Copyright 2019 Red Hat
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var NodeCompat = /** @class */ (function () {
    function NodeCompat() {
    }
    NodeCompat.getProperty = function (node, propertyName) {
        if (propertyName == "default" || propertyName == "enum") {
            propertyName += "_";
        }
        var rval = node[propertyName];
        if (rval === undefined) {
            rval = null;
        }
        return rval;
    };
    NodeCompat.setProperty = function (node, propertyName, newValue) {
        node[propertyName] = newValue;
    };
    NodeCompat.indexOf = function (child, parent, propertyName) {
        var array = parent[propertyName];
        if (array && Array.isArray(array)) {
            for (var idx = 0; idx < array.length; idx++) {
                var node = array[idx];
                if (node === child) {
                    return idx;
                }
            }
        }
        return -1;
    };
    NodeCompat.equals = function (value1, value2) {
        return value1 == value2;
    };
    NodeCompat.join = function (delim, values) {
        return values.join(delim);
    };
    NodeCompat.joinArray = function (delim, values) {
        return NodeCompat.join(delim, values);
    };
    NodeCompat.isNode = function (object) {
        return object !== null && object !== undefined && !Array.isArray(object) && object["_ownerDocument"];
    };
    NodeCompat.isList = function (object) {
        return object !== null && object !== undefined && Array.isArray(object);
    };
    NodeCompat.asArray = function (list) {
        return list;
    };
    NodeCompat.asList = function () {
        var items = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            items[_i] = arguments[_i];
        }
        return items;
    };
    NodeCompat.copyList = function (list) {
        return list.slice(0);
    };
    NodeCompat.isNullOrUndefined = function (value) {
        return value === null || value === undefined;
    };
    return NodeCompat;
}());
export { NodeCompat };
//# sourceMappingURL=NodeCompat.js.map