Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var seedrandom = require("seedrandom");
var OT = require("./frp");
var parametric = require("./parametric");
__export(require("./List"));
exports.DEBUG = false;
var types = require("./types");
__export(require("./types"));
if (exports.DEBUG)
console.log("Parameter: module loading...");
exports.rndGenerator = seedrandom.xor4096(Math.random() + "");
// Parameter is a transformer from (clock signals -> Value)
/**
* convert an Rx.Observable into a Parameter by providing an initial value. The Parameter's value will update its value
* every time and event is received from the Rx source
*/
function updateFrom(initialValue, source) {
if (exports.DEBUG)
console.log("updateFrom: build");
return new OT.SignalFn(function (upstream) {
if (exports.DEBUG)
console.log("updateFrom: init");
var value = initialValue;
source.subscribe(function (x) { return value = x; });
return upstream.map(function (_) { return value; });
});
}
return from(seed).mapValue(function (seed) {
if (exports.DEBUG)
console.log("seedrnd: seeding", seed);
exports.rndGenerator = seedrandom.xor4096(seed);
return;
});
}