molstar
Version:
A comprehensive macromolecular library.
26 lines • 975 B
JavaScript
/**
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParamMapping = void 0;
var immer_1 = require("immer");
function ParamMapping(def) {
return function (_a) {
var values = _a.values, update = _a.update, apply = _a.apply;
return ({
params: typeof def.params === 'function' ? def.params : function (ctx) { return def.params; },
getTarget: def.target,
getValues: values,
update: function (s, ctx) {
var t = def.target(ctx);
return (0, immer_1.produce)(t, function (t1) { return update(s, t1, ctx); });
},
apply: apply ? apply : function () { }
});
};
}
exports.ParamMapping = ParamMapping;
//# sourceMappingURL=param-mapping.js.map
;