Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function dispAccel() {
var tic = new Date();
var data = IMU.getValueSync();
var toc = new Date();
var str = data.timestamp.toISOString() + " ";
str += print_vector3("Accel", data.accel)
// str += print_vector3("Gyro", data.gyro)
// str += print_vector3("Compass", data.compass)
// str += print_vector3("Fusion", data.fusionPose)
var str2 = "";
if (data.temperature && data.pressure && data.humidity) {
var str2 = util.format(' %s %s %s', data.temperature.toFixed(4), data.pressure.toFixed(4), data.humidity.toFixed(4));
}
console.log(str + str2);
num++;
if (num == numStop) {
console.timeEnd("sync");
} else {
setTimeout(dispAccel, 50 - (toc - tic));
}
}
} else {
let parts = strip(key.split(jsonRegexp));
field = parts.shift();
quotedField = util.format('"%s"', field);
if (parts.length > 1) {
let jsonOp = parts.shift();
let jsonKey = parts.shift();
// treat numeric json keys as array indices, otherwise quote it
if (isNaN(jsonKey) && jsonKey.indexOf("'") == -1) {
jsonKey = util.format("'%s'", jsonKey);
}
quotedField = util.format('%s%s%s', quotedField, jsonOp, jsonKey);
}
}
if (operation.fieldMutator) {
quotedField = operation.fieldMutator(field, quotedField);
}
return {
field: field,
quotedField: quotedField,
operator: (operation.operator || '=').toUpperCase(),
mutator: operation.mutator,
originalOp: userOp
};
}).join(', ');
}
// @review which API is this for?
// (maybe a relic of JSON response, no longer relevant?)
else if (!_.isUndefined(data.errorMessage)) {
errorMessage = flatten(data.errorMessage, -1, requestContext);
if (_.isObject(errorMessage)) errorMessage = util.inspect(errorMessage, true, 3);
// TODO error code and classification in this format?
}
debug('response error', errorClassification, errorSeverityCode, ack, errorMessage);
// fallback
if (errorMessage == null) {
errorMessage = util.format("Bad ack code: ", ack);
errorSeverityCode = 'Error';
}
// more context for programatically interpreting the error
extraErrorProps = {
severityCode: errorSeverityCode,
classification: errorClassification,
errors: errors,
details: _.clone(ack)
};
// still pass back the data! so client can ignore the warning/error if it chooses.
if (errorClassification === 'SystemError') {
error = new EbaySystemError("eBay API system " + errorSeverityCode.toLowerCase() + ": " + errorMessage, extraErrorProps);
}
else {
}
var header = {
magicNumber: buffer['readUInt32' + this.endianness](0, true),
majorVersion: buffer['readUInt16' + this.endianness](4, true),
minorVersion: buffer['readUInt16' + this.endianness](6, true),
gmtOffset: buffer['readInt32' + this.endianness](8, true),
timestampAccuracy: buffer['readUInt32' + this.endianness](12, true),
snapshotLength: buffer['readUInt32' + this.endianness](16, true),
linkLayerType: buffer['readUInt32' + this.endianness](20, true)
};
if (header.majorVersion != 2 && header.minorVersion != 4) {
this.errored = true;
this.stream.pause();
msg = util.format('unsupported version %d.%d. pcap-parser only parses libpcap file format 2.4', header.majorVersion, header.minorVersion);
this.emit('error', new Error(msg));
onEnd.call(this);
} else {
this.emit('globalHeader', header);
this.buffer = buffer.slice(GLOBAL_HEADER_LENGTH);
this.state = parsePacketHeader;
return true;
}
}
return false;
}
}, (err) => {
console.log(util.format('Failed to join peers in organization "%s" to the channel', ORGS.org1.name));
throw new Error('error 1');
})
.catch(function (err) {
}, function(err) {
if (err) {
console.error('Error removing entry in Google GLM MMAP cache database');
return;
} else {
console.log(util.format('Removed %d %d %d %d because already in OpenCellId database', glmRow.mcc, glmRow.mnc, glmRow.lac, glmRow.cellid));
return;
}
});
} else {
users: function validateUsers(manifest) {
var errs = [];
var users = manifest.users;
if (users === undefined) {
errs.push({ field: 'users', code: 'MissingParameter' });
return errs;
}
if (!Array.isArray(users)) {
errs.push({
field: 'users',
code: 'Invalid',
message: format('invalid image "users" (not an array): %j',
users)
});
} else {
users.forEach(function (u) {
if (typeof (u) !== 'object' ||
u.name === undefined ||
Object.keys(u).length !== 1) {
errs.push({
field: 'users',
code: 'Invalid',
message: format('invalid image "users" entry: %j', u)
});
}
});
}
return errs;
function updateMarty() {
var marty = read('../marty.js');
marty = marty.replace(/new Marty\('.*'/, util.format("new Marty('%s'", version));
write('../marty.js', marty);
}
addToRegistry(args, () => {
let kp = format("%s\\command", keyPath)
let pe = format('"%s" "%s"', process.execPath, arg)
args = [kp, "/ve", "/d", pe]
addToRegistry(args, callback)
})
})
get: function () {
return format('install_package %s "%s" jxcore_spidermonkey standard\n', this.packageName, this.downloadUri)
}
}