_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q9200 | train | function (eventName, argsArray) {
if (RUNTIME_CHECKS) {
if (typeof eventName !== 'string') {
throw '"eventName" argument must be a string';
}
if (arguments.length > 1 && (!argsArray || argsArray.length === undefined)) {
throw '"argsArray" must have a length property';
}
}
if... | javascript | {
"resource": ""
} | |
q9201 | train | function (eventName, callback) {
if (RUNTIME_CHECKS) {
if (typeof eventName !== 'string') {
throw '"eventName" argument must be a string';
}
if (typeof callback !== 'function') {
throw '"callback" argument must be a function';
}
}
this.__private || Object.defineProperty(this... | javascript | {
"resource": ""
} | |
q9202 | train | function (eventName, callback) {
if (RUNTIME_CHECKS) {
if (typeof eventName !== 'string') {
throw '"eventName" argument must be a string';
}
if (arguments.length === 2 && typeof callback !== 'function') {
throw '"callback" argument must be a function'; // Catch a common cause of errors
... | javascript | {
"resource": ""
} | |
q9203 | train | function (collection, callback) {
var index,
iterable = collection,
result = iterable;
if (!iterable) {
return result;
}
if (!sofa.Util.objectTypes[typeof iterable]) {
| javascript | {
"resource": ""
} | |
q9204 | train | function(filepath){
filepath = filepath.replace(pathSepExp,'/'); // Use unix paths regardless. Makes these checks easier
if(filepath &&
(
( // If filepath has the jsIncludeDir, but does not include the node_modules directory under them
filepath.match(expressions.jsIncludeDir)
... | javascript | {
"resource": ""
} | |
q9205 | train | function(config, cb){
// This will tell webpack to create a new chunk
rq.ensure(['INDEX_PATH'],function(rq){
let library = rq('INDEX_PATH');
library = library.default || library; // To preven issues between versions
| javascript | {
"resource": ""
} | |
q9206 | getFormat | train | function getFormat(syntax, options) {
let format = syntaxFormat[syntax];
if (typeof format === 'string') {
format = syntaxFormat[format]; | javascript | {
"resource": ""
} |
q9207 | train | function(newRoutes)
{
for(var key in newRoutes)
{
if(routes.hasOwnProperty(key))
{
if(typeof routes[key] == 'Array')
{
routes[key].push(newRoutes[key]);
}
else
{
| javascript | {
"resource": ""
} | |
q9208 | role_permissions | train | function role_permissions(roles, callback) {
var permissions = [],
fetch = [];
if (roles) {
// TODO: Here we could do with some caching like Drupal does.
roles.forEach(function (name, rid) {
fetch.push(rid);
});
// Get permissions for the rids.
if (fetch) {
db.query("SELECT r... | javascript | {
"resource": ""
} |
q9209 | access | train | function access(permission, account, callback) {
// User #1 has all privileges:
if (account.uid === 1) {
callback(null, true);
return;
}
// If permissions is already loaded, use them.
if (account.permissions) {
callback(null, account.permissions.indexOf(permission) > -1);
return; | javascript | {
"resource": ""
} |
q9210 | session_load | train | function session_load(sid, callback) {
var rows = [];
db.query("SELECT * FROM sessions WHERE sid = $1;", [sid], function (err, rows) {
if (err) {
callback(err, null);
return;
}
if (rows.length > | javascript | {
"resource": ""
} |
q9211 | decode | train | function decode(object) {
var result = {};
// enumerable properties
for (var key in object) {
var value = object[key];
// nested object
if (value && (typeof value === 'object')) {
// instance
if (value.$class && value.$props) {
result[value] = assign(new classes.getDefinition(va... | javascript | {
"resource": ""
} |
q9212 | closestPointnd | train | function closestPointnd(c, positions, x, result) {
var D = numeric.rep([c.length, c.length], 0.0);
var dvec = numeric.rep([c.length], 0.0);
for(var i=0; i<c.length; ++i) {
var pi = positions[c[i]];
dvec[i] = numeric.dot(pi, x);
for(var j=0; j<c.length; ++j) {
var pj = positions[c[j]];
D[i]... | javascript | {
"resource": ""
} |
q9213 | train | function (subscriptions, fn, context) {
for (var id in subscriptions) {
for (var property in subscriptions[id]) {
| javascript | {
"resource": ""
} | |
q9214 | train | function (fn, update, container) {
// Alias passed in variables for later access.
this._fn = fn;
this._update = update;
this._container = container;
// Assign every subscription instance a unique id. This helps with linking
// between parent and child subscription instances.
this.cid ... | javascript | {
"resource": ""
} | |
q9215 | train | function (fn, create, update) {
var subscriber = new Subscription(fn, update, this);
// Immediately alias the starting value.
subscriber.value = subscriber.execute();
| javascript | {
"resource": ""
} | |
q9216 | train | function (fn) {
var container = this;
var program = function () {
var subscriber = new Subscription(fn, | javascript | {
"resource": ""
} | |
q9217 | train | function (fn, create) {
return subscribe.call(this, fn, function (value) {
return | javascript | {
"resource": ""
} | |
q9218 | train | function (fn, cb) {
return subscribe.call(this, fn, function (value) {
return VM.createElement(value);
}, function (value) {
| javascript | {
"resource": ""
} | |
q9219 | train | function (currentEl, nameFn, valueFn) {
var attrName = subscribe.call(this, nameFn, null, function (value) {
VM.removeAttribute(currentEl(), this.value);
VM.setAttribute(currentEl(), this.value = value, attrValue.value);
});
var attrValue = subscribe.call(this, valueFn, null, function (value) | javascript | {
"resource": ""
} | |
q9220 | train | function (fn) {
return subscribe.call(this, fn, function (value) {
| javascript | {
"resource": ""
} | |
q9221 | train | function(objectName)
{
var app = this;
var objectName = objectName.split(".");
var obj = {};
try
{
switch(objectName.length){
case 1:
for(var module in app.modules)
{
if(app.modul... | javascript | {
"resource": ""
} | |
q9222 | train | function(policyName)
{
var app = this;
var objectName = policyName;
var obj = {};
try
{
if(app.policies.hasOwnProperty(policyName)){
obj = app.policies[policyName];
}else{
| javascript | {
"resource": ""
} | |
q9223 | train | function(roleName)
{
var app = this;
var role = {permissions:[]};
try
{
if(app.roles.hasOwnProperty(roleName)){
role = app.roles[roleName];
}else{
throw "not found";
}
}
catch(e)
{
var objFilePath = path.join(app... | javascript | {
"resource": ""
} | |
q9224 | train | function(exceptionName)
{
var app = this;
var exception = {};
try
{
if(app.exceptions.hasOwnProperty(exceptionName)){
exception = app.exceptions[exceptionName];
}else{
throw "not found";
}
}
... | javascript | {
"resource": ""
} | |
q9225 | loadModule | train | function loadModule (actorPath) {
try {
let key = path.resolve(actorPath)
delete require.cache[ key ]
return require(actorPath)
} catch (err) {
| javascript | {
"resource": ""
} |
q9226 | loadActors | train | function loadActors (fount, actors) {
let result
function addActor (acc, instance) {
let factory = isFunction(instance.state)
? instance.state : () => clone(instance.state)
processHandles(instance)
acc[ instance.actor.type ] = {
factory: factory,
metadata: instance
}
return ac... | javascript | {
"resource": ""
} |
q9227 | setContent | train | function setContent( content, options ) {
options = getOptions( options );
return vscode.workspace.openTextDocument( {
language: options.language
} )
.then( doc => vscode.window.showTextDocument( doc ) )
.then( editor => {
let editBuilder = textEdit => {
... | javascript | {
"resource": ""
} |
q9228 | init | train | function init(config) {
Object.keys(config).forEach(function (property) {
| javascript | {
"resource": ""
} |
q9229 | toDot | train | function toDot() {
var dotGraph = [];
dotGraph.push("digraph " + this.name + " {");
this.children.forEach(function (step) {
dotGraph.push(step.name);
step.dependencies.forEach(function (dependencyName) {
| javascript | {
"resource": ""
} |
q9230 | train | function (nodeLikeObject) {
var node = this;
if (nodeLikeObject.hasOwnProperty('data') === true) {
setTimeout(function runFlowNode() {
| javascript | {
"resource": ""
} | |
q9231 | train | function (data) {
this.data = data;
this.isFulfilled = true;
if (this.parent === null) {
return;
| javascript | {
"resource": ""
} | |
q9232 | train | function (error) {
this.error = error;
this.isRejected = true;
if (this.parent === null) {
return;
}
| javascript | {
"resource": ""
} | |
q9233 | tryVerify | train | function tryVerify (rawBytes) {
const {
tbsCertificate,
tbsCertificate: {
validity: {
notBefore: { value: notBefore },
notAfter: { value: notAfter }
}
},
signatureAlgorithm: { algorithm },
signature: { data: signature }
} = Certificate.decode(rawBytes, 'der')
// Re... | javascript | {
"resource": ""
} |
q9234 | parse | train | function parse(source) {
var moduleDefinitions = {},
moduleReferences = [];
estraverse.traverse(esprima.parse(source), {
leave: function (node, parent) {
if(!isAngular(node)) {
return;
}
//console.log('node:', JSON.stringify(node, null, 3));
//console.log('pare... | javascript | {
"resource": ""
} |
q9235 | View | train | function View() {
Object.defineProperty(this, '__private', { writable: true, value: {}, });
this.__private.isRenderRequested = false;
var delegates = this.__private.eventDelegates = {};
this.__private.onDelegatedEvent = function onDelegatedEvent(ev) {
var delegatesForEvent = delegates[ev.type];
va... | javascript | {
"resource": ""
} |
q9236 | train | function (htmlString, returnAll) {
if (RUNTIME_CHECKS) {
if (typeof htmlString !== 'string') {
throw '"htmlString" argument must be a string';
}
if (arguments.length > 1 && typeof returnAll !== 'boolean') {
throw '"returnAll" argument must be a boolean value';
}
}
HTML_PARSE... | javascript | {
"resource": ""
} | |
q9237 | train | function (childView, el) {
if (RUNTIME_CHECKS) {
if (!(childView instanceof View)) {
throw '"childView" argument must be a BFF View';
}
if (arguments.length > 1 && !(el === false || el instanceof HTMLElement)) {
throw '"el" argument must be an HTMLElement or the boolean value false';
... | javascript | {
"resource": ""
} | |
q9238 | train | function () {
// Iterate backwards because the list might shrink while being iterated
for (var i = this.__private.childViews.length | javascript | {
"resource": ""
} | |
q9239 | createCache | train | function createCache(array) {
var index = -1,
length = array.length;
var cache = getObject();
cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
var result = getObject();
result.array = array;
result.cache = cache;
result.push = cachePush;
while | javascript | {
"resource": ""
} |
q9240 | getIndexOf | train | function getIndexOf(array, value, fromIndex) {
var result | javascript | {
"resource": ""
} |
q9241 | train | function () {
return new Promise(function (resolve, reject) {
var rotations = [];
for (var i = 0; i < spotlightRotations.length; i++) {
var now = new Date();
var daysToAdd = 3 * i;
now.setDate(now.getDate() + daysToAdd);
va... | javascript | {
"resource": ""
} | |
q9242 | prune | train | function prune(code) {
var ast = esprima.parse(code);
estraverse.replace(ast, {
leave: function leave(node, parent) {
var ret;
if ('IfStatement' === node.type) {
if ('BinaryExpression' !== node.test.type) return;
if ('self' === node.test.left.argument.name) {
node.altern... | javascript | {
"resource": ""
} |
q9243 | createStream | train | function createStream() {
var firstChunk = true;
var stream = through(function transform(chunk, encoding, next) {
if (!firstChunk) return next(null, chunk);
firstChunk = false;
| javascript | {
"resource": ""
} |
q9244 | deumdify | train | function deumdify(browserify) {
//
// Bail out if there is no UMD wrapper.
//
if (!browserify._options.standalone) | javascript | {
"resource": ""
} |
q9245 | Raven | train | function Raven() {
/**
* Pull from the rs forums...this can easily break if they stop using the version 4 of the thread
* http://services.runescape.com/m=forum/forums.ws?75,76,387,65763383
* @returns {Promise} current viswax
* @example
* rsapi.rs.distraction.viswax.getCurrent().then(functi... | javascript | {
"resource": ""
} |
q9246 | handleFailure | train | function handleFailure (handler) {
return (state, action) => isFailureAction(action) ? handler(state, | javascript | {
"resource": ""
} |
q9247 | hash | train | function hash(password, options) {
options = options || {};
const blocksize = options.blocksize || defaults.blocksize;
const cost = options.cost || defaults.cost;
const parallelism = options.parallelism || defaults.parallelism;
const saltSize = options.saltSize || defaults.saltSize;
// Blocksize Validation... | javascript | {
"resource": ""
} |
q9248 | getName | train | function getName(candidate) {
var proto = getProto(candidate),
isValid = !!proto && !isPlainObject(candidate) && !Array.isArray(candidate);
if (isValid) {
for (var key in require.cache) {
var exports = require.cache[key].exports,
result = isPlainObject(exports) ? Object.keys(exports).re... | javascript | {
"resource": ""
} |
q9249 | getDefinition | train | function getDefinition(name) {
var split = name.split('::'),
path = split[0],
field = split[1],
exported = (path in require.cache) && require.cache[path].exports,
definition = !!exported && | javascript | {
"resource": ""
} |
q9250 | Player | train | function Player(config) {
/**
* Gets a users hiscores and activities (available for `rs` / `osrs`)
* @param username {String} Display name of the user
* @param type {String} [Optional] normal, ironman, hardcore/ultimate
* @returns {Promise} Object of the users hiscores and activities
* @ex... | javascript | {
"resource": ""
} |
q9251 | toAbsolute | train | function toAbsolute(id) {
return id.startsWith("./") | javascript | {
"resource": ""
} |
q9252 | stripNamespace | train | function stripNamespace (requestKey) {
return requestKey.startsWith(LP_API_ACTION_NAMESPACE)
| javascript | {
"resource": ""
} |
q9253 | deepBind | train | function deepBind(target, thisArg, options) {
if (!isObject(target)) {
throw new TypeError('expected an object');
}
options = options || {};
for (var key in target) {
var fn = target[key];
if (typeof fn === 'object') {
target[key] = deepBind(fn, thisArg);
} else if (typeof fn === 'funct... | javascript | {
"resource": ""
} |
q9254 | handleResponse | train | function handleResponse (successHandler, failureHandler) {
if (!(successHandler && failureHandler)) throw new Error('handleResponse requires both a success handler and failure handler.') | javascript | {
"resource": ""
} |
q9255 | buildTable | train | function buildTable(search) {
// Based on https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm#Description_of_pseudocode_for_the_table-building_algorithm
var table = Array(search.length), pos = 2, cnd = 0, searchLen = search.length;
table[0] = -1;
| javascript | {
"resource": ""
} |
q9256 | actionCreator | train | function actionCreator(modelName, actionName) {
return data => (
dispatch({
| javascript | {
"resource": ""
} |
q9257 | train | function (eventEmitters, eventNames, callback, context, useCapture) {
if (RUNTIME_CHECKS) {
if (!eventEmitters || !(eventEmitters.addEventListener || eventEmitters instanceof Array)) {
throw '"eventEmitters" argument must be an event emitter or an array of event emitters';
}
if (typeof eventNam... | javascript | {
"resource": ""
} | |
q9258 | train | function (eventEmitter, eventName) {
if (RUNTIME_CHECKS) {
if (!!eventEmitter && !eventEmitter.addEventListener) {
throw '"eventEmitter" argument must be an event emitter';
}
if (arguments.length > 1 && typeof eventName !== 'string') {
throw '"eventName" argument must be a string';
}... | javascript | {
"resource": ""
} | |
q9259 | train | function (data) {
var items = [];
data.forEach(function (d, i) {
if (d.includes('ITEM:') && d.length > 3) {
var iid = data[i + 1];
var item = {
item: {
id: Number(iid[1].trim()),
name: d[2].re... | javascript | {
"resource": ""
} | |
q9260 | train | function(pagedef, pagedir){
var filenameBase = pagedir + pagedef.uniqueId;
var xmlDef = {ext: '.xml', contents: pd.xml(pagedef.body)};
var metaDef = {
ext: '.json',
contents: JSON.stringify(_.omit(pagedef, 'body'), null, 3)
};
_.each([xmlDef, metaDef], function(item){
var filename = filenameBase | javascript | {
"resource": ""
} | |
q9261 | parseAlternateMappingsCall | train | function parseAlternateMappingsCall(node, output) {
var firstArgument = node.expression.arguments[0];
if (firstArgument && firstArgument.type === 'ObjectExpression') {
firstArgument.properties.forEach(function(prop) {
var aliasClassNames = getPropertyValue(prop); // Could b... | javascript | {
"resource": ""
} |
q9262 | parseLoaderSetPathCall | train | function parseLoaderSetPathCall(node, output) {
// Example: `Ext.Loader.setPath('Ext.ux', 'lib/extjs-ux/src');`
var classPrefixArg = node.expression.arguments[0];
var pathArg = node.expression.arguments[1];
| javascript | {
"resource": ""
} |
q9263 | fontsmith | train | function fontsmith(params, cb) {
// Collect paths
var files = params.src,
retObj = {};
// TODO: Allow specification of engine when we have more
// TODO: By default, use an `auto` engine which falls back through engines until it finds one.
// Load in our engine and assert it exists
var engine = engine... | javascript | {
"resource": ""
} |
q9264 | train | function () {
/**
* Return the current timestamp integer.
*/
var now = Date.now || function () {
return new Date().getTime();
};
// Keep track of the previous "animation frame" manually.
var prev = now();
return function (fn) {
var curr = now();
| javascript | {
"resource": ""
} | |
q9265 | Question | train | function Question(name, message, options) {
debug('initializing from <%s>', __filename);
if (arguments.length === 0) {
throw new TypeError('expected a string or object');
}
if (Question.isQuestion(name)) {
return name;
}
this.type = 'input';
this.options = {};
this.getDefault();
if (Array.i... | javascript | {
"resource": ""
} |
q9266 | addLineHints | train | function addLineHints(name, content) {
var
i = -1,
lines = content.split('\n'),
len = lines.length,
out = []
;
while (++i < len) {
| javascript | {
"resource": ""
} |
q9267 | joinBuffers | train | function joinBuffers(buffers) {
var
i = -1, j = -1,
num = buffers.length,
totalBytes = 0,
bytesWritten = 0,
buff,
superBuff
;
while (++i < num) {
totalBytes += buffers[i].length;
}
superBuff = new Buffer(totalBytes); | javascript | {
"resource": ""
} |
q9268 | wget | train | function wget(fileURL, callback) {
var
chunks = [],
isHTTPS = fileURL.indexOf('https') === 0,
client = isHTTPS ? https : http,
options = fileURL
;
if (isHTTPS) {
options = url.parse(fileURL);
options.rejectUnauthorized = false;
options.agent = new https.Agent(options);
}
| javascript | {
"resource": ""
} |
q9269 | reduce | train | function reduce(map, path) {
var mapNode, prefix, split, splits = getResourcePathSplits(path),
subValue, suffix;
while (splits.length) {
split = splits.shift();
suffix = split[1];
prefix = suffix ? split[0] + '/' : split[0];
mapNode = map[prefix];
if (mapNode) {
if (!suffix || typeof mapNode =... | javascript | {
"resource": ""
} |
q9270 | getResource | train | function getResource(map, base, internal, path, callback, addLineHints) {
var
reduced = reduce(map, path),
reducedMap = reduced.map,
reducedMapType = nodeType(reducedMap),
reducedPrefix = reduced.prefix,
reducedSuffix = reduced.suffix,
firstChar = path.charAt(0),
temporary = firstChar === '~',
... | javascript | {
"resource": ""
} |
q9271 | synchronize | train | function synchronize (items, cb) {
return items.reduce(function (promise, item) | javascript | {
"resource": ""
} |
q9272 | train | function () {
var promptRemove = this._promptRemove.bind(this)
var removeFile = this._removeFile.bind(this)
var ui = this.ui
return this._findConfigFiles()
.then(function (files) {
if (files.length === 0) {
ui.writeLine('No JSHint or ESLint config files found.')
return... | javascript | {
"resource": ""
} | |
q9273 | train | function () {
var projectRoot = this.project.root
var ui = this.ui
ui.startProgress('Searching for JSHint and ESLint config files')
return new RSVP.Promise(function (resolve) {
var files = walkSync(projectRoot, {
globs: ['**/.jshintrc', '**/.eslintrc.js'],
ignore: [
| javascript | {
"resource": ""
} | |
q9274 | train | function (filePath) {
var removeFile = this._removeFile.bind(this)
var message = 'Should I remove `' + filePath + '`?'
var promptPromise = this.ui.prompt({
type: 'confirm',
name: 'answer',
message: message,
choices: [
{ key: 'y', name: 'Yes, remove it', value: 'yes' },
... | javascript | {
"resource": ""
} | |
q9275 | train | function (filePath) {
var projectRoot = this.project.root
| javascript | {
"resource": ""
} | |
q9276 | parseOptions | train | function parseOptions ({
type,
onUnauthorized,
actions,
types,
requestAction,
successAction,
failureAction,
isStub,
stubData,
adapter,
...requestOptions
}) {
return {
configOptions: omitUndefined({
type,
onUnauthorized,
actions,
| javascript | {
"resource": ""
} |
q9277 | dive | train | function dive(name) {
// check if this module has already been
// processed in case of circular dependency
if (dive[name]) {
return;
}
dive[name] = true;
dive.required.push(name);
| javascript | {
"resource": ""
} |
q9278 | getClient | train | function getClient(callback) {
if (!connectionOptions) {
callback('Connection options missing. Please call db.connect before any other database functions to configure the database configuration');
}
if (activeBackend === 'mysql') {
if (activeDb) {
return callback(null, activeDb);
}
| javascript | {
"resource": ""
} |
q9279 | runQuery | train | function runQuery(client, queryString, args, callback) {
if (activeBackend === 'mysql') {
queryString = queryString.replace(/\$\d+/, '?');
}
client.query(queryString, args, function (err, result) {
if (err) {
callback(err, null);
return;
}
if (activeBackend === 'mysql') | javascript | {
"resource": ""
} |
q9280 | errorJSON | train | function errorJSON (err) {
var res = {}
Object.getOwnPropertyNames(err).forEach(function (key) {
| javascript | {
"resource": ""
} |
q9281 | getCLFOffset | train | function getCLFOffset(date) {
const offset = date.getTimezoneOffset().toString();
const op = offset[0] === | javascript | {
"resource": ""
} |
q9282 | traverseBreadthFirst | train | function traverseBreadthFirst(rootNode, options) {
options = extend({
subnodesAccessor: function(node) { return node.subnodes; },
userdataAccessor: function(node, userdata) { return userdata; },
onNode: function(node, callback, userdata) { callback(); },
onComplete: function(rootNode) {},
userdata... | javascript | {
"resource": ""
} |
q9283 | traverseBreadthFirstSync | train | function traverseBreadthFirstSync(rootNode, options) {
options = extend({
subnodesAccessor: function(node) { return node.subnodes; },
userdataAccessor: function(node, userdata) { return userdata; },
onNode: function(node, userdata) {},
userdata: null
}, options);
var queue = [];
queue.push([roo... | javascript | {
"resource": ""
} |
q9284 | traverseDepthFirst | train | function traverseDepthFirst(rootNode, options) {
options = extend({
subnodesAccessor: function(node) { return node.subnodes; },
userdataAccessor: function(node, userdata) { return userdata; },
onNode: function(node, callback, userdata) { callback(); },
onComplete: function(rootNode) {},
userdata: ... | javascript | {
"resource": ""
} |
q9285 | traverseDepthFirstSync | train | function traverseDepthFirstSync(rootNode, options) {
options = extend({
subnodesAccessor: function(node) { return node.subnodes; },
userdataAccessor: function(node, userdata) { return userdata; },
onNode: function(node, userdata) {},
userdata: null
}, options);
var stack = [];
stack.push([rootN... | javascript | {
"resource": ""
} |
q9286 | traverseRecursive | train | function traverseRecursive(rootNode, options) {
options = extend({
subnodesAccessor: function(node) { return node.subnodes; },
onNode: function(node, callback, userdata) {},
onComplete: function(rootNode) {},
userdata: null
}, options);
(function visitNode(node, callback) {
var subnodes = opt... | javascript | {
"resource": ""
} |
q9287 | traverseRecursiveSync | train | function traverseRecursiveSync(rootNode, options) {
options = extend({
subnodesAccessor: function(node) { return node.subnodes; },
onNode: function(node, userdata) {},
userdata: null
}, options);
(function visitNode(node) {
var subnodes = | javascript | {
"resource": ""
} |
q9288 | Reporter | train | function Reporter (opts) {
this.events = opts.events;
this.config = opts.config;
this.testCount = 0;
this.testIdx = -1;
this.variationCount = -1;
this.data = {};
this.data.tests = [];
this.browser = null;
var defaultReportFolder = 'report';
this.dest = this.config.get('junit-reporter') && this.conf... | javascript | {
"resource": ""
} |
q9289 | train | function (name) {
this.testCount = 0;
this.testIdx++;
this.xml[0].children.push({
name: 'testsuite',
children: [],
| javascript | {
"resource": ""
} | |
q9290 | train | function (data) {
if (! data.success) {
//var timestamp = Math.round(new Date().getTime() / 1000);
this.xml[0].children[this.testIdx].children[this.testCount].children.push({
name: 'failure',
attrs: {
name: data.type,
message: (data.message ? data.message : 'Expected... | javascript | {
"resource": ""
} | |
q9291 | train | function (data) {
this.variationCount = -1;
this.xml[0].children[this.testIdx].children.push({
name: 'testcase',
children: [],
attrs: {
| javascript | {
"resource": ""
} | |
q9292 | train | function () {
//var timestamp = Math.round(new Date().getTime() / 1000);
if (this._checkNodeAttributes(this.testIdx, this.testCount)) {
this.xml[0].children[this.testIdx].children[this.testCount].attrs = {};
}
//this.xml[0].children[this.testIdx].children[this.testCount].attrs.end = timestamp;
... | javascript | {
"resource": ""
} | |
q9293 | train | function (data) {
this.data.elapsedTime = data.elapsedTime;
this.data.status = data.status;
this.data.assertions = data.assertions;
this.data.assertionsFailed = data.assertionsFailed;
this.data.assertionsPassed = data.assertionsPassed;
var contents = jsonxml(this.xml, {escape: true, removeIlleg... | javascript | {
"resource": ""
} | |
q9294 | train | function (path) {
var pathSep = require('path').sep;
var dirs = path.split(pathSep);
var root = '';
while (dirs.length > 0) {
var dir = dirs.shift();
if (dir === '') {
root = pathSep;
| javascript | {
"resource": ""
} | |
q9295 | train | function (testIdx, testCount, variationCount) {
if (variationCount === undefined) {
return typeof this.xml[0].children[testIdx].children[testCount].attrs === 'undefined';
}
| javascript | {
"resource": ""
} | |
q9296 | resolveFuture | train | function resolveFuture(reject, resolve) {
state = STARTED
return future.fork( function(error) { state = REJECTED
value = error
invokePending('rejected', error)
return reject(er... | javascript | {
"resource": ""
} |
q9297 | invokePending | train | function invokePending(kind, data) {
var xs = pending
pending.length = 0
for (var i | javascript | {
"resource": ""
} |
q9298 | train | function (val) {
return (!behavior.enableUndefined || typeof val !== 'undefined')
&& (!behavior.enableNull || val !== null)
&& | javascript | {
"resource": ""
} | |
q9299 | train | function (node) {
// Does this node have a body? If so we can replace its contents.
if (node.body && node.body.length) {
node.body =
[].slice.call(node.body, 0)
.reduce(function(body, node) {
if (!~allowedPrepend.indexOf(node.type))
return body.concat(node);
id++;
sourceM... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.