all files / src/widgetApp/ widgetHelper.ts

88.24% Statements 15/17
66.67% Branches 4/6
66.67% Functions 2/3
88.24% Lines 15/17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28        14× 14× 14×                  
"use strict";
var WidgetHelper = (function () {
    function WidgetHelper() {
    }
    WidgetHelper.propertyByString = function (obj, path) {
        Iif (!path) {
            return obj;
        }
        path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
        path = path.replace(/^\./, ''); // strip a leading dot
        var tokens = path.split('.');
        for (var i = 0, n = tokens.length; i < n; ++i) {
            var tok = tokens[i];
            Eif (obj != null && tok in obj) {
                obj = obj[tok];
            }
            else {
                return;
            }
        }
        return obj;
    };
    return WidgetHelper;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = WidgetHelper;