Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _gel_session(token, uri, user_type,
nickname, groups, accounts, email){
// token and uri are super critical.
if( ! us.isString(token) ){
throw new Error('bad user token');
}
if( ! us.isString(uri) ){
throw new Error('bad user uri');
}
// Double check user type.
if( ! us.contains(known_user_types, user_type) ){
throw new Error('unknown user type: ' + user_type);
}
// Well, name is unimportant technically if we have the uri.
console.log(nickname);
if( ! us.isString(nickname) ){
nickname = '???';
}
render () {
if (this.isInsideViewport()) {
this._placeHolderElement = false
const typeClass = RundownUtils.getSourceLayerClassName(this.props.layer.type)
return (
<div> 0,
'with-out-transition': !this.props.relative && this.props.piece.transitions && this.props.piece.transitions.outTransition && (this.props.piece.transitions.outTransition.duration || 0) > 0,
'hide-overflow-labels': this.state.leftAnchoredWidth > 0 && this.state.rightAnchoredWidth > 0 && ((this.state.leftAnchoredWidth + this.state.rightAnchoredWidth) > this.state.elementWidth),
'infinite': (this.props.piece.playoutDuration === undefined && this.props.piece.userDuration === undefined && this.props.piece.infiniteMode) as boolean, // 0 is a special value
'next-is-touching': !!(this.props.piece.cropped || (this.props.piece.enable.end && _.isString(this.props.piece.enable.end))),
'source-missing': this.props.piece.status === RundownAPI.PieceStatusCode.SOURCE_MISSING || this.props.piece.status === RundownAPI.PieceStatusCode.SOURCE_NOT_SET,
'source-broken': this.props.piece.status === RundownAPI.PieceStatusCode.SOURCE_BROKEN,
'unknown-state': this.props.piece.status === RundownAPI.PieceStatusCode.UNKNOWN,
'disabled': this.props.piece.disabled
})}
data-obj-id={this.props.piece._id}
ref={this.setRef}
onClick={this.itemClick}
onDoubleClick={this.itemDblClick}
onMouseUp={this.itemMouseUp}
onMouseMove={(e) => this.moveMiniInspector(e)}
onMouseOver={(e) => !this.props.outputGroupCollapsed && this.toggleMiniInspector(e, true)}
onMouseLeave={(e) => this.toggleMiniInspector(e, false)}
style={this.getItemStyle()}>
{this.renderInsideItem(typeClass)}</div>
function addInMissingFields(record) {
// Kind
//------
record.kind = 'Vital Sign';
// Summary
//--------
var summary = '';
if (_.isString(record.typeName)) {
summary = record.typeName;
}
if (_.isString(record.result)) {
summary += ' ' + record.result;
}
if (_.isString(record.interpretationCode)) {
summary += ' ' + record.interpretationCode;
}
if (_.isString(record.units)) {
summary += ' ' + record.units;
}
record.summary = summary;
// Qualified Name
//---------------
record.qualifiedName = record.typeName;
convertToRaw: function (value, defaultRange) {
var format = this.paramFormat;
if (u.isString(value)) {
var strDates = value.split(',');
return {
begin: strDates[0] ? moment(strDates[0], format).toDate() : defaultRange.begin,
end: strDates[1] ? moment(strDates[1], format).toDate() : defaultRange.end
};
}
return {
begin: value.begin ? value.begin : defaultRange.begin,
end: value.end ? value.end : defaultRange.end
};
},
function fs_writeFile( arg_fd_or_name )
{
var param_fd = 0;
var param_buffer = 0;
var param_encoding = "utf-8";
var writedSize = 0;
assert( arguments.length >= 2 , "invalid arguments" );
if ( arguments.length >= 3 )
{
assert( _.isString( arguments[2] ) , "arguments 2 must be string as encoding or nothing" );
param_encoding = arguments[2];
}
if ( _.isNumber( arguments[0] ) )
{
param_fd = arg_fd_or_name;
}
else if ( _.isString( arguments[0] ) )
{
param_fd = fs_open( arguments[0] , "w" , S_IWRITE );
if ( param_fd <= 0 )
{
return 0;
}
export default function smartMemoizeAndClear(obj, methodName, eventName, listenTarget) {
listenTarget = listenTarget || obj;
if(isString(listenTarget)) listenTarget = obj[listenTarget];
if(typeof methodName === 'object') {
return Object.keys(methodName).map((_methodName) => {
smartMemoizeAndClear(listenTarget, _methodName, methodName[_methodName], obj);
});
} else {
if(isFunction(obj[methodName])) {
obj[methodName] = memoize(obj[methodName]);
let callback = () => obj[methodName].clearCache();
if(typeof obj.listenTo !== 'undefined') {
obj.listenTo(listenTarget, eventName, callback);
} else {
listenTarget.on(eventName, callback);
}
function isDodVitals(record) {
return ((_.isString(record.uid)) && (record.uid.indexOf(':DOD:') >= 0));
}
constructor(opts) {
const { tablePrefix, tableName, tableSuffix } = opts;
if(!tableName || !isString(tableName)) throw new Error(`PyropeActions#constructor(): 'tableName' is undefined or not a string.`);
this.tablePrefix = tablePrefix || '';
this.tableName = tableName;
this.tableSuffix = tableSuffix || '';
this.fullTableName = this.tablePrefix + this.tableName + this.tableSuffix;
}
const out = this.options.highlight(code, lang);
if (out != null && out !== code) {
escaped = true;
code = out;
}
}
let text = null;
if (!lang) {
text = `<pre><code class="code-colors hljs">${ escaped ? code : s.escapeHTML(code, true) }</code></pre>`;
} else {
text = `<pre><code class="code-colors hljs ${ escape(lang, true) }">${ escaped ? code : s.escapeHTML(code, true) }</code></pre>`;
}
if (_.isString(msg)) {
return text;
}
const token = `=!=${ Random.id() }=!=`;
msg.tokens.push({
highlight: true,
token,
text,
});
return token;
};
makePromise: function(details) {
if (!_.isString(details.method)) {
throw new Error("Must provide 'method'");
}
if (this.terminateTimeoutHandle) {
clearTimeout(this.terminateTimeoutHandle);
delete this.terminateTimeoutHandle;
}
var self = this;
return this._ensureWorker().then(function (worker) {
var requestId = _.uniqueId('cReq');
var requestDetails = _.extend({}, details, {
requestId: requestId,
objectId: self.objectId