Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Preact = require('preact');
var h = require('preact').h;
var findDOMNode = require('preact-compat').findDOMNode;
var createClass = require('preact-compat').createClass;
var Bacon = require('baconjs').Bacon;
var SearchBar = createClass({
// polyfill of sorts for string refs
linkRef: function(component, name) {
var cache = component._linkedRefs || (component._linkedRefs = {});
if (!component.refs) component.refs = {};
return cache[name] || (cache[name] = function(c) {
component.refs[name] = c;
});
},
getInitialState: function() {
return { textValue: this.props.initialValue }
},
'use strict';
var Bacon = require('baconjs').Bacon;
module.exports = {
// A state transformation function which determines the player's actions
// given an input event.
transformState: function(state, event) {
// Apply the state transformation to the current state and event value.
var result = this.actions(state, event.value());
// Extract the result.
var nextState = result[0],
actions = result[1];
// Map actions to Bacon events.
var events = actions.map(function(action) {
return new Bacon.Next(action);
});
// TODO: This won't scale across multiple processes, as it assumes
// that it's the only one writing to back-end storage.
var Bacon = require('baconjs').Bacon;
var starterMinicade = require('./starter-minicade.json');
var storages = require('../storages');
var Ops = require('./ops');
var Client = require('./client');
var binStreams = {};
var storage;
function BinStream(bin) {
this.bin = bin;
this.stream = new Bacon.Bus();
this.connections = [];
this.games = [];
this.stream.flatMapConcat(function(fn) {
var Bacon = require("baconjs").Bacon;
var nmeasource = require('./nmeasource.js');
var jsonsource = require('./jsonsource.js');
var n2ksource = require('./n2ksource.js');
function StreamBundle(extractTypeFunction) {
this.all = new Bacon.Bus();
this.extractTypeFunction = extractTypeFunction;
};
StreamBundle.prototype = {
constructor: function StreamBundle(extractTypeFunction) {
this.extractTypeFunction = extractTypeFunction;
},
getTypeStream: function (type) {
if (this[type] === undefined) {
this[type] = new Bacon.Bus();
/** @jsx React.DOM */
'use strict';
var Bacon = require('baconjs').Bacon,
CountryComponent = require('./country_component.jsx'),
PathsComponent = require('./paths_component.jsx'),
React = require('react'),
_ = require('lodash'),
core = require('../core');
module.exports = React.createClass({
displayName: 'WorldComponent',
propTypes: {
currentPlayer: React.PropTypes.object,
selectedCountry: React.PropTypes.object,
stream: React.PropTypes.instanceOf(Bacon.Observable).isRequired,
game: React.PropTypes.object.isRequired,
world: React.PropTypes.object.isRequired
},
#!/usr/bin/env node
'use strict';
var utils = require('./utils.js');
var udp = require('./udp.js');
var sources = require('./sources.js');
var jsonsource = require('./jsonsource.js');
var winston = require('winston');
var Bacon = require("baconjs").Bacon;
exports.startApp = function () {
var optimist = sources.usages()
.usage('$0: Http server and router for navigational data (NMEA 0183 & NMEA 2000)')
.describe('u', 'Broadcast nmea 0183 via udp on port 7777')
.describe('b', 'Broadcast address for udp broadcast')
.describe('writejson', 'Write the internal json stream to [filename]')
.describe('p', 'http port')
.demand('boat')
.describe('boat', 'boat configuration, loaded from lib/boats/ directory')
.options('p', {default: 8080})
.wrap(70);
'use strict';
var Bacon = require('baconjs').Bacon;
function dispatch(fn) {
if (fn) {
return [new Bacon.Next(function() { return fn; })];
} else {
return [];
}
}
module.exports = {
handleEvent: function(previousCountry, event) {
var result = this.nextAction(previousCountry, event.value()),
country = result[0],
action = result[1];
return [country, dispatch(action)];
var Bacon = require("baconjs").Bacon;
var defaultStreams = [
'navigation.courseOverGround',
'navigation.depth',
'navigation.speedOverGround',
'environmental.apparentWindDirection',
'environmental.position'
]
exports.createFromBundle = function(bundle) {
var compositeStream = new Bacon.Bus();
defaultStreams.forEach(function(id) {
compositeStream.plug(bundle.getTypeStream(id).throttle(1000));
})
return compositeStream;
};
var SLACK_BOT_NAME = process.env.SLACK_BOT_NAME || 'Tesla Model S';
var env = process.env.NODE_ENV || 'dev';
if (env === 'production') {
require('newrelic');
}
var express = require('express'),
tesla = require('./tesla'),
Bacon = require('baconjs').Bacon,
bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(require('logfmt').requestLogger());
function sendJson(res) {
return function (message) {
res.json(message);
};
}
function toSlackMessage(text) {
return {
text: text,
username: SLACK_BOT_NAME
/*eslint new-cap:0 */
'use strict';
var path = require('path');
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var Bacon = require('baconjs').Bacon;
var accessToken = process.env.GITHUB_TOKEN;
var pollInterval = process.env.POLL_INTERVAL || 1000;
var port = process.env.VCAP_APP_PORT || 3000;
var types = ['pushevent', 'issuecommentevent', 'createevent', 'watchevent',
'pullrequestevent', 'issuesevent', 'pullrequestreviewcommentevent',
'deleteevent', 'forkevent', 'commitcommentevent', 'followevent',
'gollumevent', 'memberevent', 'downloadevent', 'pagebuildevent',
'publicevent', 'forkapplyevent', 'gistevent', 'releaseevent',
'deploymentevent', 'deploymentstatusevent', 'statusevent',
'teamaddevent'];
var deduplicator = require('./deduplicator');
var client = require('./github')(accessToken);
var ioStats = io.of('/statistics');