_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q63900 | detectTakeout | test | function detectTakeout(selectors){
var properties = {
takeout: false
};
options.takeout.forEach(function (takeout) {
selectors.forEach(function (selector) {
if (selector.indexOf(takeout.ruleprefix) === 0) {
properties.takeout = true;
properties.filename = takeout.fil... | javascript | {
"resource": ""
} |
q63901 | parseLineByLine | test | function parseLineByLine(text) {
var lines = text.trim().split("\n");
var bookmarks = lines.splice(0, lines.length * 3 / 4);
return {
bookmarks: bookmarks,
lines: lines
};
} | javascript | {
"resource": ""
} |
q63902 | CommonalityInterface | test | function CommonalityInterface(MatrixConstructor, top) {
this.top = top;
this.length = null;
this.matrix = null;
this.MatrixConstructor = MatrixConstructor;
} | javascript | {
"resource": ""
} |
q63903 | CommanalityMatrix | test | function CommanalityMatrix(classlist) {
// space will identify a text node and/or an element node without any classnames
this.rowKeys = {};
this.rowNames = [];
this.collumKeys = {};
this.collumNames = [];
this.nodeMatrix = [];
this.summaryMatrix = [];
this.dim = [0, 0];
this.bestIndex = [-1, -1];
... | javascript | {
"resource": ""
} |
q63904 | arrayVector | test | function arrayVector(size) {
var vec = new Array(size);
for (var i = 0; i < size; i++) vec[i] = [];
return vec;
} | javascript | {
"resource": ""
} |
q63905 | buildAttributeMatcher | test | function buildAttributeMatcher(match) {
var keys = Object.keys(match);
var jskey, i, l;
var transform = '';
var bool = '';
transform = 'transform = {\n';
for (i = 0, l = keys.length; i < l; i++) {
jskey = JSON.stringify(keys[i]);
transform += ' ' + jskey + ': attr.hasOwnProperty(' + jskey + ') ?... | javascript | {
"resource": ""
} |
q63906 | containerOf | test | function containerOf(a, b) {
while (b = b.parent) {
if (a === b) return true;
}
return false;
} | javascript | {
"resource": ""
} |
q63907 | commonParent | test | function commonParent(a, b) {
if (a === b) {
return a;
} else if (containerOf(a, b)) {
return a;
} else if (containerOf(b, a)) {
return b;
} else {
// This will happen at some point, since the root is a container of
// everything
while (b = b.parent) {
if (containerOf(b, a)) return... | javascript | {
"resource": ""
} |
q63908 | styleParser | test | function styleParser(style) {
style = style || '';
var tokens = style.trim().split(/\s*(?:;|:)\s*/);
var output = {};
for (var i = 1, l = tokens.length; i < l; i += 2) {
output[tokens[i - 1]] = tokens[i];
}
return output;
} | javascript | {
"resource": ""
} |
q63909 | treeDistance | test | function treeDistance(a, b) {
if (a === b) return 0;
var parent = commonParent(a, b);
var aParent = a;
var aCount = 0;
var bParent = b;
var bCount = 0;
if (parent !== a) {
while (parent !== aParent.parent) {
aCount += 1;
aParent = aParent.parent;
}
} else {
bCount += 1;
}
... | javascript | {
"resource": ""
} |
q63910 | Lexer | test | function Lexer(file, options) {
this.options = utils.extend({}, options);
this.file = file;
this.regex = new RegexCache();
this.names = [];
this.ast = {
tags: {},
type: 'root',
name: 'root',
nodes: []
};
this.unknown = {tags: [], blocks: []};
this.known = {
tags: ['extends', 'layout... | javascript | {
"resource": ""
} |
q63911 | test | function() {
if (this.isInitialized) return;
this.isInitialized = true;
var lexer = this;
this.lineno = 1;
this.column = 1;
this.lexed = '';
this.file = utils.normalize(this.file);
this.file.orig = this.file.contents;
this.input = this.file.contents.toString();
this.file.ast = ... | javascript | {
"resource": ""
} | |
q63912 | test | function(msg) {
var message = this.file.relative
+ ' line:' + this.lineno
+ ' column:' + this.column
+ ': ' + msg;
var err = new Error(message);
err.reason = msg;
err.line = this.lineno;
err.column = this.column;
err.source = this.input;
err.path = this.file.path;
if ... | javascript | {
"resource": ""
} | |
q63913 | test | function(type) {
var cached = this.regex.createVariable(type);
var file = this.file;
var lexer = this;
var fn = this.lexers[type] = function() {
var pos = lexer.position();
var m = lexer.match(cached.strict);
if (!m) return;
var parent = this.prev();
var node = pos({
... | javascript | {
"resource": ""
} | |
q63914 | test | function(type) {
this.ast.tags[type] = null;
this.names.push(type);
var cached = this.regex.createTag(type);
var file = this.file;
var lexer = this;
var fn = this.lexers[type] = function() {
var pos = lexer.position();
var m = lexer.match(cached.strict);
if (!m) return;
... | javascript | {
"resource": ""
} | |
q63915 | test | function(type, name, m, pos) {
var parent = this.prev();
var val = m[1];
var tok = { type: 'args', val: val };
var node = pos({
type: type,
name: name,
known: utils.has(this.known.tags, type),
val: val.trim(),
nodes: [tok]
});
utils.define(node, 'parent', parent);... | javascript | {
"resource": ""
} | |
q63916 | test | function(type) {
this.names.push(type);
var cached = this.regex.createOpen(type);
var file = this.file;
var lexer = this;
return function() {
var pos = lexer.position();
var m = lexer.match(cached.strict);
if (!m) return;
var name = utils.getName(m[1]);
var action = u... | javascript | {
"resource": ""
} | |
q63917 | test | function(type) {
var cached = this.regex.createClose(type);
var file = this.file;
var lexer = this;
return function() {
var pos = lexer.position();
var m = lexer.match(cached.strict);
if (!m) return;
var block = lexer.tokens.pop();
if (typeof block === 'undefined' || bloc... | javascript | {
"resource": ""
} | |
q63918 | test | function(type) {
this.file.ast.blocks[type] = this.file.ast.blocks[type] || {};
this.addLexer(this.captureOpen(type));
this.addLexer(this.captureClose(type));
return this;
} | javascript | {
"resource": ""
} | |
q63919 | test | function(file, prop) {
return this.createNode(prop, file[prop], `{% ${prop} "${file[prop]}" %}`, this.position());
} | javascript | {
"resource": ""
} | |
q63920 | test | function(str, len) {
var lines = str.match(/\n/g);
if (lines) this.lineno += lines.length;
var i = str.lastIndexOf('\n');
this.column = ~i ? len - i : this.column + len;
this.lexed += str;
this.consume(str, len);
} | javascript | {
"resource": ""
} | |
q63921 | test | function() {
var len = this.fns.length;
var idx = -1;
while (++idx < len) {
this.fns[idx].call(this);
if (!this.input) {
break;
}
}
} | javascript | {
"resource": ""
} | |
q63922 | test | function() {
while (this.input) {
var prev = this.input;
this.advance();
if (this.input && prev === this.input) {
throw new Error(`no lexers registered for: "${this.input.substr(0, 10)}"`);
}
}
} | javascript | {
"resource": ""
} | |
q63923 | test | function(file) {
debug('lexing <%s>', this.file.path);
if (file) this.file = file;
this.init();
while (this.input) this.next();
return this.ast;
} | javascript | {
"resource": ""
} | |
q63924 | notifyHook | test | function notifyHook(e) {
message_count++;
var message;
if (!options.enabled) {
return;
}
if (!e) {
return;
}
if (e && e.length === 1) {
e = e[0];
}
if (/Task .* failed\./.test(e.message)) {
message = e.message;
} else if (e.message && e.stack) {
... | javascript | {
"resource": ""
} |
q63925 | test | function() {
if (this._initialized && this._isPaused) {
return false;
}
this._isPaused = true;
raf.cancel(this._requestID);
this._pauseTime = now();
this._onPause();
return true;
} | javascript | {
"resource": ""
} | |
q63926 | test | function() {
if (this._initialized && !this._isPaused) {
return false;
}
var pauseDuration;
this._isPaused = false;
this._prevTime = now();
pauseDuration = this._prevTime - this._pauseTime;
this._onResume(pauseDuration);
this._requestID = raf.request(this._tick);
return tr... | javascript | {
"resource": ""
} | |
q63927 | mktmpdir | test | function mktmpdir(prefixSuffix, tmpdir, callback, onend) {
if ('function' == typeof prefixSuffix) {
onend = tmpdir;
callback = prefixSuffix;
tmpdir = null;
prefixSuffix = null;
} else if ('function' == typeof tmpdir) {
onend = callback;
callback = tmpdir;
tmpdir = null;
}
prefixSuff... | javascript | {
"resource": ""
} |
q63928 | copyString | test | function copyString(buffer, length, offsetBegin, offsetEnd) {
if (length > 2048) {
return buffer.toString('utf-8', offsetBegin, offsetEnd);
}
var string = '';
while(offsetBegin < offsetEnd) {
string += String.fromCharCode(buffer[offsetBegin++]);
}
return string;
} | javascript | {
"resource": ""
} |
q63929 | parseSimpleString | test | function parseSimpleString(parser) {
var offset = parser.offset;
var length = parser.buffer.length;
var string = '';
while (offset < length) {
var c1 = parser.buffer[offset++];
if (c1 === 13) {
var c2 = parser.buffer[offset++];
if (c2 === 10) {
parser.offset = offset;
return... | javascript | {
"resource": ""
} |
q63930 | getBaseConfig | test | function getBaseConfig(isProd) {
// get library details from JSON config
const libraryEntryPoint = path.join('src', LIBRARY_DESC.entry);
// generate webpack base config
return {
entry: [
// "babel-polyfill",
path.join(__dirname, libraryEntryPoint),
],
output: {
devtoolLineToLine: ... | javascript | {
"resource": ""
} |
q63931 | postNotification | test | function postNotification(options, cb) {
options.title = removeColor(options.title);
options.message = removeColor(options.message);
if (!options.message) {
return cb && cb(!options.message && 'Message is required');
}
if (!notifyPlatform) {
notifyPlatform = choosePlatform();
}
function resetP... | javascript | {
"resource": ""
} |
q63932 | generateUsername | test | function generateUsername(base) {
base = base.toLowerCase();
var entries = [];
var finalName;
return userDB.allDocs({startkey: base, endkey: base + '\uffff', include_docs: false})
.then(function(results){
if(results.rows.length === 0) {
return BPromise.resolve(base);
}
... | javascript | {
"resource": ""
} |
q63933 | linkSuccess | test | function linkSuccess(req, res, next) {
var provider = getProvider(req.path);
var result = {
error: null,
session: null,
link: provider
};
var template;
if(config.getItem('testMode.oauthTest')) {
template = fs.readFileSync(path.join(__dirname, '../templates/oauth/auth-callback... | javascript | {
"resource": ""
} |
q63934 | linkTokenSuccess | test | function linkTokenSuccess(req, res, next) {
var provider = getProviderToken(req.path);
res.status(200).json({
ok: true,
success: util.capitalizeFirstLetter(provider) + ' successfully linked',
provider: provider
});
} | javascript | {
"resource": ""
} |
q63935 | oauthErrorHandler | test | function oauthErrorHandler(err,req,res,next) {
var template;
if(config.getItem('testMode.oauthTest')) {
template = fs.readFileSync(path.join(__dirname, '../templates/oauth/auth-callback-test.ejs'), 'utf8');
} else {
template = fs.readFileSync(path.join(__dirname, '../templates/oauth/auth-callbac... | javascript | {
"resource": ""
} |
q63936 | tokenAuthErrorHandler | test | function tokenAuthErrorHandler(err,req,res,next) {
var status;
if(req.user && req.user._id) {
status = 403;
} else {
status = 401;
}
console.error(err);
if(err.stack) {
console.error(err.stack);
delete err.stack;
}
res.status(status).json(err);
} | javascript | {
"resource": ""
} |
q63937 | registerProvider | test | function registerProvider(provider, configFunction) {
provider = provider.toLowerCase();
var configRef = 'providers.' + provider;
if (config.getItem(configRef + '.credentials')) {
var credentials = config.getItem(configRef + '.credentials');
credentials.passReqToCallback = true;
var option... | javascript | {
"resource": ""
} |
q63938 | registerOAuth2 | test | function registerOAuth2 (providerName, Strategy) {
registerProvider(providerName, function (credentials, passport, authHandler) {
passport.use(new Strategy(credentials,
function (req, accessToken, refreshToken, profile, done) {
authHandler(req, providerName, {accessToken: accessToken, refres... | javascript | {
"resource": ""
} |
q63939 | registerTokenProvider | test | function registerTokenProvider (providerName, Strategy) {
providerName = providerName.toLowerCase();
var configRef = 'providers.' + providerName;
if (config.getItem(configRef + '.credentials')) {
var credentials = config.getItem(configRef + '.credentials');
credentials.passReqToCallback = true;
... | javascript | {
"resource": ""
} |
q63940 | authHandler | test | function authHandler(req, provider, auth, profile) {
if(req.user && req.user._id && req.user.key) {
return user.linkSocial(req.user._id, provider, auth, profile, req);
} else {
return user.socialAuth(provider, auth, profile, req);
}
} | javascript | {
"resource": ""
} |
q63941 | passportCallback | test | function passportCallback(provider, options, operation) {
return function(req, res, next) {
var theOptions = extend({}, options);
if(provider === 'linkedin') {
theOptions.state = true;
}
var accessToken = req.query.bearer_token || req.query.state;
if(accessToken && (stateRequir... | javascript | {
"resource": ""
} |
q63942 | passportTokenCallback | test | function passportTokenCallback(provider, options) {
return function(req, res, next) {
var theOptions = extend({}, options);
theOptions.session = false;
passport.authenticate(provider + '-token', theOptions)(req, res, next);
};
} | javascript | {
"resource": ""
} |
q63943 | getProvider | test | function getProvider(pathname) {
var items = pathname.split('/');
var index = items.indexOf('callback');
if(index > 0) {
return items[index-1];
}
} | javascript | {
"resource": ""
} |
q63944 | getProviderToken | test | function getProviderToken(pathname) {
var items = pathname.split('/');
var index = items.indexOf('token');
if(index > 0) {
return items[index-1];
}
} | javascript | {
"resource": ""
} |
q63945 | requireRole | test | function requireRole(requiredRole) {
return function(req, res, next) {
if(!req.user) {
return next(superloginError);
}
var roles = req.user.roles;
if(!roles || !roles.length || roles.indexOf(requiredRole) === -1) {
res.status(forbiddenError.status);
res.json(forbidden... | javascript | {
"resource": ""
} |
q63946 | test | function() {
var foundLayer = null;
$.each(projectedTiles, function (layerName, layer) {
if (map.hasLayer(layer)) {
foundLayer = layer;
}
});
return foundLayer;
} | javascript | {
"resource": ""
} | |
q63947 | test | function (crs, options) {
switch(crs) {
case "EPSG:3857":
return L.CRS.EPSG3857;
case "EPSG:3395":
return L.CRS.EPSG3395;
case "EPSG:4326":
return L.CRS.EPSG4326;
default:
return this._defineMapCRS(crs, options);
}
} | javascript | {
"resource": ""
} | |
q63948 | test | function (group) {
var map = this;
if (group.eachLayer) {
group.eachLayer(function (layer) {
map._updateAllLayers(layer);
});
} else {
if (group.redraw) {
group.redraw();
} else if (group.update) {
group.update();
} else {
console.log("Don't kno... | javascript | {
"resource": ""
} | |
q63949 | test | function (layersArray) {
var fg = this._featureGroup,
npg = this._nonPointGroup,
chunked = this.options.chunkedLoading,
chunkInterval = this.options.chunkInterval,
chunkProgress = this.options.chunkProgress,
newMarkers, i, l, m;
if (this._map) {
var offset = 0,
start... | javascript | {
"resource": ""
} | |
q63950 | test | function (layersArray) {
var i, l, m,
fg = this._featureGroup,
npg = this._nonPointGroup;
if (!this._map) {
for (i = 0, l = layersArray.length; i < l; i++) {
m = layersArray[i];
this._arraySplice(this._needsClustering, m);
npg.removeLayer(m);
}
return this;... | javascript | {
"resource": ""
} | |
q63951 | test | function () {
var bounds = new L.LatLngBounds();
if (this._topClusterLevel) {
bounds.extend(this._topClusterLevel._bounds);
}
for (var i = this._needsClustering.length - 1; i >= 0; i--) {
bounds.extend(this._needsClustering[i].getLatLng());
}
bounds.extend(this._nonPointGroup.getB... | javascript | {
"resource": ""
} | |
q63952 | test | function (method, context) {
var markers = this._needsClustering.slice(),
i;
if (this._topClusterLevel) {
this._topClusterLevel.getAllChildMarkers(markers);
}
for (i = markers.length - 1; i >= 0; i--) {
method.call(context, markers[i]);
}
this._nonPointGroup.eachLayer(method... | javascript | {
"resource": ""
} | |
q63953 | test | function (layer) {
if (!layer) {
return false;
}
var i, anArray = this._needsClustering;
for (i = anArray.length - 1; i >= 0; i--) {
if (anArray[i] === layer) {
return true;
}
}
anArray = this._needsRemoving;
for (i = anArray.length - 1; i >= 0; i--) {
if (... | javascript | {
"resource": ""
} | |
q63954 | test | function (map) {
this._map = map;
var i, l, layer;
if (!isFinite(this._map.getMaxZoom())) {
throw "Map has no maxZoom specified";
}
this._featureGroup.onAdd(map);
this._nonPointGroup.onAdd(map);
if (!this._gridClusters) {
this._generateInitialClusters();
}
for (i = 0,... | javascript | {
"resource": ""
} | |
q63955 | test | function (map) {
map.off('zoomend', this._zoomEnd, this);
map.off('moveend', this._moveEnd, this);
this._unbindEvents();
//In case we are in a cluster animation
this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
if (this._spiderfierOnRemove) { //... | javascript | {
"resource": ""
} | |
q63956 | test | function (anArray, obj) {
for (var i = anArray.length - 1; i >= 0; i--) {
if (anArray[i] === obj) {
anArray.splice(i, 1);
return true;
}
}
} | javascript | {
"resource": ""
} | |
q63957 | test | function (layer, newCluster) {
if (newCluster === layer) {
this._featureGroup.addLayer(layer);
} else if (newCluster._childCount === 2) {
newCluster._addToMap();
var markers = newCluster.getAllChildMarkers();
this._featureGroup.removeLayer(markers[0]);
this._featureGroup.removeLay... | javascript | {
"resource": ""
} | |
q63958 | test | function (storageArray) {
storageArray = storageArray || [];
for (var i = this._childClusters.length - 1; i >= 0; i--) {
this._childClusters[i].getAllChildMarkers(storageArray);
}
for (var j = this._markers.length - 1; j >= 0; j--) {
storageArray.push(this._markers[j]);
}
return s... | javascript | {
"resource": ""
} | |
q63959 | test | function () {
var childClusters = this._childClusters.slice(),
map = this._group._map,
boundsZoom = map.getBoundsZoom(this._bounds),
zoom = this._zoom + 1,
mapZoom = map.getZoom(),
i;
//calculate how far we need to zoom down to see all of the markers
while (childClusters.lengt... | javascript | {
"resource": ""
} | |
q63960 | test | function (marker) {
var addedCount,
addedLatLng = marker._wLatLng || marker._latlng;
if (marker instanceof L.MarkerCluster) {
this._bounds.extend(marker._bounds);
addedCount = marker._childCount;
} else {
this._bounds.extend(addedLatLng);
addedCount = 1;
}
if (!this... | javascript | {
"resource": ""
} | |
q63961 | test | function () {
if (this._group._spiderfied === this || this._group._inZoomAnimation) {
return;
}
var childMarkers = this.getAllChildMarkers(),
group = this._group,
map = group._map,
center = map.latLngToLayerPoint(this._latlng),
positions;
this._group._unspiderfy();
th... | javascript | {
"resource": ""
} | |
q63962 | test | function (childMarkers, positions) {
var group = this._group,
map = group._map,
fg = group._featureGroup,
i, m, leg, newPos;
for (i = childMarkers.length - 1; i >= 0; i--) {
newPos = map.layerPointToLatLng(positions[i]);
m = childMarkers[i];
m._preSpiderfyLatlng = m._latlng... | javascript | {
"resource": ""
} | |
q63963 | test | function (layer) {
if (layer._spiderLeg) {
this._featureGroup.removeLayer(layer);
layer.setOpacity(1);
//Position will be fixed up immediately in _animationUnspiderfy
layer.setZIndexOffset(0);
this._map.removeLayer(layer._spiderLeg);
delete layer._spiderLeg;
}
} | javascript | {
"resource": ""
} | |
q63964 | addToMap | test | function addToMap(location, map) {
var marker = L.marker(location.coordinates);
marker.addTo(map);
} | javascript | {
"resource": ""
} |
q63965 | interpolate | test | function interpolate (path, data) {
return path.replace(/:(\w+)/g, function (match, param) {
return data[param]
})
} | javascript | {
"resource": ""
} |
q63966 | createPagesUtility | test | function createPagesUtility (pages, index) {
return function getPages (number) {
var offset = Math.floor(number / 2)
var start, end
if (index + offset >= pages.length) {
start = Math.max(0, pages.length - number)
end = pages.length
} else {
start = Math.max(0, index - offset)
... | javascript | {
"resource": ""
} |
q63967 | test | function() {
var templates = { data: {} };
var stringTemplateSource = function(template) {
this.text = function(value) {
if (arguments.length === 0) {
return templates[template];
}
templates[template] = value;
}... | javascript | {
"resource": ""
} | |
q63968 | Job | test | function Job(collection, data) {
this.collection = collection;
if (data) {
// Convert plain object to JobData type
data.__proto__ = JobData.prototype;
this.data = data;
} else {
this.data = new JobData();
}
} | javascript | {
"resource": ""
} |
q63969 | Worker | test | function Worker(queues, options) {
options || (options = {});
this.empty = 0;
this.queues = queues || [];
this.interval = options.interval || 5000;
this.callbacks = options.callbacks || {};
this.strategies = options.strategies || {};
this.universal = options.universal || false;
// Def... | javascript | {
"resource": ""
} |
q63970 | handleDragEvents | test | function handleDragEvents(e) {
e.stopPropagation();
e.preventDefault();
return this.emit(e.type, e);
} | javascript | {
"resource": ""
} |
q63971 | test | function(value) {
if(value != value || value === 0) {
for(var i = this.length; i-- && !is(this[i], value);){}
} else {
i = [].indexOf.call(this, value);
}
return i;
} | javascript | {
"resource": ""
} | |
q63972 | Tor | test | function Tor(child, port, dir) {
this.process = child;
this.port = port;
this.dir = dir;
} | javascript | {
"resource": ""
} |
q63973 | getIncluded | test | function getIncluded() {
var args = config.files().included || getDefaultArgs() ||
getPackageJsonArgs() || getBowerJsonArgs() || [];
return _expandGlobs(args);
} | javascript | {
"resource": ""
} |
q63974 | getDefaultArgs | test | function getDefaultArgs() {
var results = [];
DEFAULT_PATHS.forEach(function(dir) {
if( fs.existsSync(dir) ) results.push(dir);
});
return results.length == 0 ? null : results;
} | javascript | {
"resource": ""
} |
q63975 | getPackageJsonArgs | test | function getPackageJsonArgs() {
var results = [];
var config = _loadJson('package.json');
if( config.main ) results = results.concat(getMainFieldAsArray(config.main));
if( config.files ) results = results.concat(config.files);
return results.length == 0 ? null : results.filter(_uniqfilter);
} | javascript | {
"resource": ""
} |
q63976 | getBowerJsonArgs | test | function getBowerJsonArgs() {
var results = [];
var config = _loadJson('bower.json');
if( config.main ) results = results.concat(getMainFieldAsArray(config.main));
return results.length == 0 ? null : results.filter(_uniqfilter);
} | javascript | {
"resource": ""
} |
q63977 | getMainFieldAsArray | test | function getMainFieldAsArray(main) {
if( main.constructor === Array ) {
return main;
} else {
if( fs.existsSync(main) ) {
return [main];
} else if( fs.existsSync(main+'.js') ) {
return [main+'.js'];
} else {
return [];
}
}
} | javascript | {
"resource": ""
} |
q63978 | TorAgent | test | function TorAgent(opts) {
if (!(this instanceof TorAgent)) {
return new TorAgent();
}
http.Agent.call(this, opts);
this.socksHost = opts.socksHost || 'localhost';
this.socksPort = opts.socksPort || 9050;
this.defaultPort = 80;
// Used when invoking TorAgent.create
this.tor = opts.tor;
// P... | javascript | {
"resource": ""
} |
q63979 | run | test | function run(inch_args, options) {
var callback = function(filename) {
LocalInch.run(inch_args || ['suggest'], filename, noop);
}
if( options.dry_run ) callback = noop;
retriever.run(PathExtractor.extractPaths(inch_args), callback);
} | javascript | {
"resource": ""
} |
q63980 | shutdown | test | function shutdown(addr, b) {
if(addr<0 || addr>=maxDevices)
throw 'address out of range';
if(b)
spiTransfer(addr, OP_SHUTDOWN,0);
else
spiTransfer(addr, OP_SHUTDOWN,1);
} | javascript | {
"resource": ""
} |
q63981 | setScanLimit | test | function setScanLimit(addr, limit) {
if(addr<0 || addr>=maxDevices)
return;
//console.log("OP_SCANLIMIT");
if(limit>=0 && limit<8)
spiTransfer(addr, OP_SCANLIMIT,limit);
} | javascript | {
"resource": ""
} |
q63982 | setBrightness | test | function setBrightness(addr, intensity) {
if(addr<0 || addr>=maxDevices)
return;
if (typeof intensity == 'undefined') return;
intensity = constrain(intensity, 0, 15);
spiTransfer(addr, OP_INTENSITY,intensity);
} | javascript | {
"resource": ""
} |
q63983 | clearDisplay | test | function clearDisplay(addr) {
if(addr<0 || addr>=maxDevices)
throw 'address out of range';
var offset;
offset=addr*8;
for(var i=0;i<8;i++) {
status[offset+i]=0;
spiTransfer(addr, i+1,status[offset+i]);
}
} | javascript | {
"resource": ""
} |
q63984 | showNumber | test | function showNumber(addr, num, decimalplaces, mindigits, leftjustified, pos, dontclear) {
if(addr<0 || addr>=maxDevices)
throw 'address out of range';
num = formatNumber(num, decimalplaces, mindigits);
// internally, pos is 0 on the right, so we set defaults, and convert
if(typeof pos === 'undefin... | javascript | {
"resource": ""
} |
q63985 | getExampleCode | test | function getExampleCode(comment) {
var expectedResult = comment.expectedResult;
var isAsync = comment.isAsync;
var testCase = comment.testCase;
if(isAsync) {
return '\nfunction cb(err, result) {' +
'if(err) return done(err);' +
'result.should.eql(' + expectedResult + ');' +
'done();' +
... | javascript | {
"resource": ""
} |
q63986 | test | function (options) {
"use strict";
if ((options.setter && options.setter.indexOf('.') > -1) || (options.getter && options.getter.indexOf('.') > -1)) {
throw new Error('Getter (' + options.getter + ') and setter (' + options.setter + ') methods cannot be nested, so they cannot contain dot(.)');
}
... | javascript | {
"resource": ""
} | |
q63987 | fileExists | test | function fileExists(path, shouldBeDir) {
"use strict";
try {
var lstat = fs.lstatSync(path);
if (shouldBeDir && lstat.isDirectory()) {
return true;
}
if (!shouldBeDir && lstat.isFile()) {
return true;
}
} catch (err) {
return false;
... | javascript | {
"resource": ""
} |
q63988 | test | async function (server, options) {
try {
var internal = new Internal(options);
} catch (err) {
throw new Boom(err);
}
/**
* @module exposed
* @description
* Exposed functions and attributes are listed under exposed name.
* To a... | javascript | {
"resource": ""
} | |
q63989 | test | function (currDeps, loc) {
loc.deps = loc.deps || [];
var covered = []; // only cover unique paths once to avoid stack overflow
currDeps.forEach(function (obj) {
if (covered.indexOf(obj.path) < 0) {
covered.push(obj.path); // cover unique paths only once per level
var key ... | javascript | {
"resource": ""
} | |
q63990 | test | function (ms, cycles) {
var removed = {};
cycles.forEach(function (c) {
var last = c[c.length-1]; // last id in cycle
//console.log('will try to trim from', last, ms[last]);
// need to find a dependency in the cycle
var depsInCycle = ms[last].filter(function (deps) {
return deps.path && c.in... | javascript | {
"resource": ""
} | |
q63991 | test | function(options) {
// Validate options
assert(options, "options are required");
assert(options.name, "Series must be named");
options = _.defaults({}, options, {
columns: {},
additionalColumns: null
});
// Store options
this._options = options;
} | javascript | {
"resource": ""
} | |
q63992 | whenRead | test | function whenRead (args) {
let value = getValue(args)
if (value && typeof value.then === 'function') {
value.then((val) => whenTest(args, val)).catch((error) => {
console.error(`${action.displayName} caught an error whilst getting a value to test`, error)
})
} else {
whenTest(args,... | javascript | {
"resource": ""
} |
q63993 | findAndDelete | test | function findAndDelete(target, value) {
if (!isIterable(target))
return false;
if (isArray(target)) {
for (let i = 0; i < target.length; i++) {
if (deep_equal_1.default(target[i], value)) {
target.splice(i, 1);
return true;
}
... | javascript | {
"resource": ""
} |
q63994 | findAndDeleteAll | test | function findAndDeleteAll(target, value) {
let flag = false;
while (findAndDelete(target, value)) {
flag = true;
}
return flag;
} | javascript | {
"resource": ""
} |
q63995 | test | function(options) {
assert(options, "options are required");
assert(options.connectionString, "options.connectionString is missing");
assert(url.parse(options.connectionString).protocol === 'https:' ||
options.allowHTTP, "InfluxDB connectionString must use HTTPS!");
options = _.defau... | javascript | {
"resource": ""
} | |
q63996 | test | function(handler, options) {
assert(handler instanceof Function, "A handler must be provided");
assert(options, "options required");
assert(options.drain, "options.drain is required");
assert(options.component, "options.component is required");
// Create a reporter... | javascript | {
"resource": ""
} | |
q63997 | test | function(options) {
// Validate options
assert(options, "Options are required");
assert(options.drain, "A drain for the measurements must be provided!");
assert(options.component, "A component must be specified");
assert(options.process, "A process name must be specified");
// Provide defau... | javascript | {
"resource": ""
} | |
q63998 | test | function(options) {
options = _.defaults({}, options || {}, {
tags: {},
drain: undefined
});
assert(options.drain, "options.drain is required");
assert(typeof options.tags === 'object', "options.tags is required");
assert(_.intersection(
_.keys(options.tags), series.APIClie... | javascript | {
"resource": ""
} | |
q63999 | buildOptions | test | function buildOptions (options) {
var result = [];
var keys = Object.keys(options);
keys.forEach(function (key) {
var props = options[key];
// convert short to long form
if (is.string(props)) {
props = {
type: props
};
}
// all names of an option
// aliases come fir... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.