all files / built/src/ box.js

88.89% Statements 8/9
100% Branches 5/5
100% Functions 2/2
88.89% Lines 8/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                   
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var boxm_1 = require("boxm");
var mobx_1 = require("mobx");
function getAtom(obj, key) {
    try {
        return (mobx_1.isObservable(obj, key) || mobx_1.isComputed(obj, key))
            && mobx_1.extras.getAtom(obj, key);
    }
    catch (x) {
        // If ordinary property, isComputed seems to throw!
        return undefined;
    }
}
exports.box = boxm_1.boxer(function (obj, key) {
    return getAtom(obj, key) || boxm_1.makeBoxedValue(obj, key);
});
//# sourceMappingURL=box.js.map