_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q64100
test
function(user, identifier, containerIdentifier, revision, target, out, cb) { var containerDef; var systemId; systemId = _sr.findSystem(identifier); if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); } var systemRoot = _sr.repoPath(systemId); out.initProgres...
javascript
{ "resource": "" }
q64101
test
function(user, systemName, revision, target, out, cb) { var systemId = _sr.findSystem(systemName); if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); } logger.info({ systemId: systemId, revision: revision }, 'building all containers'); fetchTarget(systemId, target...
javascript
{ "resource": "" }
q64102
test
function(systemId, target, revision, cb) { if (target === 'alltargets') { cb(null, target); } else { _sr.getDeployedRevisionId(systemId, target, function(err, deployedRevId) { if (typeof revision === 'function') { cb = revision; if (!err) { revision = depl...
javascript
{ "resource": "" }
q64103
test
function(user, identifier, revisionIdentifier, target, mode, out, cb) { var systemId = _sr.findSystem(identifier); if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); } fetchTarget(systemId, target, revisionIdentifier, function(err, target) { if (err) { return cb(err); } ...
javascript
{ "resource": "" }
q64104
test
function(user, identifier, revisionIdentifier, target, out, cb) { logger.info('preview revision: ' + identifier + ', ' + revisionIdentifier + ' ' + target); deployRevision(user, identifier, revisionIdentifier, target, 'preview', out, function(err) { cb(err, {plan: out.getPlan(), ops: out.operations()}); ...
javascript
{ "resource": "" }
q64105
test
function(identifier, cb) { logger.info('list revisions: ' + identifier); if (!identifier) { return cb(new Error('no identifier')); } var systemId = _sr.findSystem(identifier); if (!systemId) { return cb(new Error('system not found')); } _sr.listRevisions(systemId, function(err,...
javascript
{ "resource": "" }
q64106
test
function(identifier, revisionIdentifier, target, cb) { logger.info('get revision: ' + identifier + ', ' + revisionIdentifier); var systemId = _sr.findSystem(identifier); if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); } fetchTarget(systemId, target, revisionIdentifier, fun...
javascript
{ "resource": "" }
q64107
test
function(user, identifier, comment, out, cb) { logger.info('compile system: ' + identifier); var systemId = _sr.findSystem(identifier); var system; if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); } var repoPath = _sr.repoPath(systemId); _compiler.compile(systemId...
javascript
{ "resource": "" }
q64108
test
function(user, identifier, comment, out, cb) { logger.info('commit system: ' + identifier); var systemId = _sr.findSystem(identifier); _sr.commitRevision(user, systemId, comment, function(err, revisionId) { _sr.getDeployedTargets(systemId, function(err, targets) { if (targets) { asy...
javascript
{ "resource": "" }
q64109
finalizeBuild
test
function finalizeBuild(sourceReport){ // Something went wrong. Fail the build. if(errorCount > 0) { grunt.fail.warn("Coffeeification failed."); // The build succeeded. Call done to // finish the grunt task. } else { done("Coffeified " + sourceReport.count + "...
javascript
{ "resource": "" }
q64110
injectCode
test
function injectCode() { var fullpath = path.join(rootpath, "app.js"); var source = fs.readFileSync(fullpath, 'utf8'); var test = /\/\/ALLOY-RESOLVER/.test(source); logger.trace("CODE INJECTED ALREADY: " + test); if(!test) { source = source.replace(/(var\s+Alloy[^;]+;)/g, "$1\n//ALLOY-RESOLVER\nvar process...
javascript
{ "resource": "" }
q64111
fixFiles
test
function fixFiles() { logger.trace("inside fixFiles()"); _.each(registry.files, function(file) { var fullpath = path.join(rootpath, file); var basepath = path.posix.dirname(file); var basefile = path.posix.resolve(file); var source = fs.readFileSync(fullpath, 'utf8'); logger.trace("fixing file: " + f...
javascript
{ "resource": "" }
q64112
findFiles
test
function findFiles(rootpath, patterns) { logger.trace("inside findFiles()"); var patterns = patterns || ['**']; if(_.isString(patterns)) { patterns = [patterns]; } var files = _.map(wrench.readdirSyncRecursive(rootpath), function(filename) { return path.posix.sep + replaceBackSlashes(filename); }); ...
javascript
{ "resource": "" }
q64113
loadFiles
test
function loadFiles() { logger.trace("inside loadFiles()"); var allfiles = findFiles(rootpath, includes); var filepaths = _.filter(allfiles, function(filepath) { return !/.+(package\.json)/.test(filepath); }); _.forEach(filepaths, function(filepath) { registry.files.push(filepath); }); var packagepa...
javascript
{ "resource": "" }
q64114
writeRegistry
test
function writeRegistry() { logger.trace("inside writeRegistry()"); var filepath = path.join(rootpath, "resolver.js"); var content = fs.readFileSync(filepath, 'utf8'); var regex = /(var\s+registry\s+=\s+)[^;]*(;)/g; var modified = content.replace(regex, "$1" + JSON.stringify(registry) + "$2"); fs.writeFileSy...
javascript
{ "resource": "" }
q64115
build
test
function build(mode, system, cdef, out, cb) { _containers.getHandler(system, cdef.type, function(err, container) { if (err) { return cb(err); } if (!container) { err = new Error('no matching container available for type: ' + cdef.type); logger.error(err.message); return cb(err); ...
javascript
{ "resource": "" }
q64116
findContainer
test
function findContainer(systemId, revision, targets, containerIdentifier, cb) { var cdefId; var types = []; async.filter(_.keys(targets), function(key, next) { _sr.findContainer(systemId, revision, containerIdentifier, key, function(err, containerDefId, cdef) { var def; if (!err && cont...
javascript
{ "resource": "" }
q64117
setAppConsts
test
function setAppConsts() { var mergedConstants = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _seamlessImmutable2.default)(appConsts); // set node app consts if (typeof self === 'undefined' && typeof global !== 'undefined') { global.appConsts = global.appConsts ? _seamlessImmutable2...
javascript
{ "resource": "" }
q64118
test
function(cb) { fse.readFile(systemsJsonPath, 'utf8', function(err, data) { if (err) { if (err.code !== 'ENOENT') { return cb(err); } fse.mkdirpSync(sysRepoPath); fse.writeFileSync(systemsJsonPath, JSON.stringify(blank, null, 2), 'utf8'); return git.createRepository(sysRepoPath...
javascript
{ "resource": "" }
q64119
test
function(user, namespace, name, repoName, repoPath, systemId, cb) { if (!_systems[systemId]) { _systems[systemId] = { name: name, namespace: namespace, repoName: repoName, repoPath: repoPath }; fse.writeFileSync(systemsJsonPath, JSON.stringify(_systems, null, 2), 'utf8'); git.commit(sysRepoPath, '...
javascript
{ "resource": "" }
q64120
test
function(user, systemId, cb) { if (!_systems[systemId]) { return cb(); } var newSystems = _.clone(_systems); delete newSystems[systemId]; fse.writeFileSync(systemsJsonPath, JSON.stringify(newSystems, null, 2), 'utf8'); _systems = newSystems; git.commit(sysRepoPath, 'unregistered system: ' + syst...
javascript
{ "resource": "" }
q64121
test
function() { var domWrapper; this._children = []; this._createRootHtml(); domWrapper = utils.html.parseHTML(this.html); if (domWrapper.childNodes.length > 1) { throw new Error("Component should have only one root element"); } this.root = domW...
javascript
{ "resource": "" }
q64122
test
function() { var i, elements, element, value; if (this._root) { (this.$meta.domProcessors || []).forEach(function(processor) { elements = this._root.querySelectorAll("[" + processor.attribute + "]"); for (i = 0; i < elements.length; i++) { ...
javascript
{ "resource": "" }
q64123
test
function(child) { this._validateChild(child); if (child.parent) { child.parent.remove(child); } child.parent = this; this._children.push(child); this.root.appendChild(child.root); if (this.__fastinject__) { this.__fastinject__(child); ...
javascript
{ "resource": "" }
q64124
test
function(child) { var index = this._children.indexOf(child); if (index !== -1) { this._children.splice(index, 1); child.root.parentNode.removeChild(child.root); child.destroy(); } }
javascript
{ "resource": "" }
q64125
test
function(child, element, root) { this._children.push(child); (root || this.root).insertBefore(child.root, element); (root || this.root).removeChild(element); }
javascript
{ "resource": "" }
q64126
test
function(repoPath, doc, done) { generify(path.join(__dirname, 'template'), repoPath, { name: doc.name, namespace: doc.namespace, id: doc.id }, done); }
javascript
{ "resource": "" }
q64127
test
function(repoPath) { var sys; if (fse.existsSync(path.join(repoPath, 'system.js'))) { // TODO extract in its own module sys = require(repoPath + '/system.js'); delete require.cache[repoPath + '/system.js']; } if (!sys) { return new Error('missing system.js, is this an nscale re...
javascript
{ "resource": "" }
q64128
test
function(user, namespace, name, cwd, cb) { var repoName = name; var doc = _.extend({}, blank); var repoPath = path.join(cwd, repoName); doc.name = name; doc.namespace = namespace; doc.id = uuid.v4(); if (!fse.existsSync(repoPath)) { fse.mkdirpSync(repoPath); initNscaleFiles(rep...
javascript
{ "resource": "" }
q64129
test
function(user, path_, cwd, cb) { var repoPath = path.resolve(cwd, path_); var sys; var validationError = validateSystem(repoPath); if (validationError) { return cb(validationError); } sys = require(repoPath + '/system.js'); delete require.cache[repoPath + '/system.js']; _meta.register(user...
javascript
{ "resource": "" }
q64130
test
function(user, systemId, cb) { writeTimeline(user, systemId, 'system unlinked', function() { // swallow any errors here _meta.unregister(user, systemId, function(err) { cb(err); }); }); }
javascript
{ "resource": "" }
q64131
test
function(systemId, fileName, contents, cb) { var repoPath = _meta.repoPath(systemId); fse.writeFile(path.join(repoPath, fileName), contents, 'utf8', cb); }
javascript
{ "resource": "" }
q64132
test
function(systemId, target, cb) { listRevisions(systemId, function(err, revs) { if (err) { return cb(err); } getRevision(systemId, revs[0].id, target, cb); }); }
javascript
{ "resource": "" }
q64133
test
function(systemId, revisionId, target, cb) { var repoPath = _meta.repoPath(systemId); git.getFileRevision(repoPath, revisionId, target + '.json', function(err, rev) { if (err) { return cb(err); } var s; try { s = JSON.parse(rev); } catch (e) { return cb(new Error('...
javascript
{ "resource": "" }
q64134
test
function(systemId, revisionId, target, cb) { if (revisionId === EDITS) { _getOnDiskVersion(systemId, revisionId, target, cb); } else { findRevision(systemId, revisionId, function(err, rev) { if (err) { return cb(err); } if (rev === EDITS) { _getOnDiskVersion(systemId, r...
javascript
{ "resource": "" }
q64135
test
function(systemId, env, cb) { var repoPath = _meta.repoPath(systemId); var tagName = baseTag + env; var editsTagName = editsTag + env; ngit.Repository.open(repoPath, function(err, repo) { if (err) { return cb(err); } ngit.Reference.nameToId(repo, tagName, function(err, head) { if (...
javascript
{ "resource": "" }
q64136
test
function(systemId, cb) { var repoPath = _meta.repoPath(systemId); getDeployedTargets(systemId, function(err, targets) { if (err) { return cb(err); } git.listRevisions(repoPath, function(err, revisions) { revisions.forEach(function(revision) { var deployedTo = _.find(targets, functi...
javascript
{ "resource": "" }
q64137
test
function(systemId, identifier, cb) { var re = new RegExp('^' + identifier + '.*', ['i']); var revision; if (identifier !== 'head' && identifier !== 'latest') { listRevisions(systemId, function(err, revisions) { revision = _.find(revisions, function(revision) { return re.test(revision.id); });...
javascript
{ "resource": "" }
q64138
test
function (environment, baseConfig) { if ('emoji' in baseConfig) { if (!baseConfig.emoji) { _emojiConfig = false; } else { Object.keys(_defaultEmojiConfig).forEach(function (key) { _emojiConfig[key] = baseConfig.emoji.hasOwnProperty(key) ? baseConfig.emoji[key] : _defaultEmojiCo...
javascript
{ "resource": "" }
q64139
test
function(analyzed) { var containers = analyzed.topology.containers; var targets = []; _.each(containers, function(c) { if (c.containerDefinitionId.indexOf('__proxy') === 0) { var cdef = _.find(analyzed.containerDefinitions, function(cdef) { return cdef.id === c.containerDefinitionId; }); ...
javascript
{ "resource": "" }
q64140
test
function( model, relation, options ) { var type = !_.isString( relation.type ) ? relation.type : Backbone[ relation.type ] || this.getObjectByName( relation.type ); if ( type && type.prototype instanceof Backbone.Relation ) { new type( model, relation, options ); // Also pushes the new Relation into `model._r...
javascript
{ "resource": "" }
q64141
test
function( modelType ) { _.find( this._subModels, function( subModelDef ) { return _.find( subModelDef.subModels || [], function( subModelTypeName, typeValue ) { var subModelType = this.getObjectByName( subModelTypeName ); if ( modelType === subModelType ) { // Set 'modelType' as a child of the f...
javascript
{ "resource": "" }
q64142
test
function( relation ) { var exists = _.any( this._reverseRelations, function( rel ) { return _.all( relation || [], function( val, key ) { return val === rel[ key ]; }); }); if ( !exists && relation.model && relation.type ) { this._reverseRelations.push( relation ); this._addRelation( rela...
javascript
{ "resource": "" }
q64143
test
function( relation ) { var exists = _.any( this._orphanRelations, function( rel ) { return _.all( relation || [], function( val, key ) { return val === rel[ key ]; }); }); if ( !exists && relation.model && relation.type ) { this._orphanRelations.push( relation ); } }
javascript
{ "resource": "" }
q64144
test
function() { // Make sure to operate on a copy since we're removing while iterating _.each( this._orphanRelations.slice( 0 ), function( rel ) { var relatedModel = Backbone.Relational.store.getObjectByName( rel.relatedModel ); if ( relatedModel ) { this.initializeRelation( null, rel ); this._orph...
javascript
{ "resource": "" }
q64145
test
function( relation ) { var coll = this.getCollection( relation.model, false ); coll && coll.each( function( model ) { if ( !( model instanceof relation.model ) ) { return; } new relation.type( model, relation ); }, this ); }
javascript
{ "resource": "" }
q64146
test
function( type, create ) { if ( type instanceof Backbone.RelationalModel ) { type = type.constructor; } var rootModel = type; while ( rootModel._superModel ) { rootModel = rootModel._superModel; } var coll = _.find( this._collections, function(item) { return item.model === rootModel; ...
javascript
{ "resource": "" }
q64147
test
function( name ) { var parts = name.split( '.' ), type = null; _.find( this._modelScopes, function( scope ) { type = _.reduce( parts || [], function( memo, val ) { return memo ? memo[ val ] : undefined; }, scope ); if ( type && type !== scope ) { return true; } }, this ); re...
javascript
{ "resource": "" }
q64148
test
function( type, item ) { var id = _.isString( item ) || _.isNumber( item ) ? item : null; if ( id === null ) { if ( item instanceof Backbone.RelationalModel ) { id = item.id; } else if ( _.isObject( item ) ) { id = item[ type.prototype.idAttribute ]; } } // Make all falsy values ...
javascript
{ "resource": "" }
q64149
test
function( type, item ) { var id = this.resolveIdForItem( type, item ); var coll = this.getCollection( type ); // Because the found object could be of any of the type's superModel // types, only return it if it's actually of the type asked for. if ( coll ) { var obj = coll.get( id ); if ( obj in...
javascript
{ "resource": "" }
q64150
test
function( model ) { var coll = this.getCollection( model ); if ( coll ) { var modelColl = model.collection; coll.add( model ); this.listenTo( model, 'destroy', this.unregister, this ); this.listenTo( model, 'relational:unregister', this.unregister, this ); model.collection = modelColl; } ...
javascript
{ "resource": "" }
q64151
test
function( model, id ) { var coll = this.getCollection( model ), duplicate = coll && coll.get( id ); if ( duplicate && model !== duplicate ) { if ( Backbone.Relational.showWarnings && typeof console !== 'undefined' ) { console.warn( 'Duplicate id! Old RelationalModel=%o, new RelationalModel=%o', dupl...
javascript
{ "resource": "" }
q64152
test
function( model, collection, options ) { this.stopListening( model ); var coll = this.getCollection( model ); coll && coll.remove( model, options ); }
javascript
{ "resource": "" }
q64153
test
function() { var i = this.instance, k = this.key, m = this.model, rm = this.relatedModel, warn = Backbone.Relational.showWarnings && typeof console !== 'undefined'; if ( !m || !k || !rm ) { warn && console.warn( 'Relation=%o: missing model, key or relatedModel (%o, %o, %o).', this, m, k, rm )...
javascript
{ "resource": "" }
q64154
test
function() { this.stopListening(); if ( this instanceof Backbone.HasOne ) { this.setRelated( null ); } else if ( this instanceof Backbone.HasMany ) { this.setRelated( this._prepareCollection() ); } _.each( this.getReverseRelations(), function( relation ) { relation.removeRelated( this.in...
javascript
{ "resource": "" }
q64155
test
function( keyContents ) { this.keyContents = keyContents; this.keyId = Backbone.Relational.store.resolveIdForItem( this.relatedModel, this.keyContents ); }
javascript
{ "resource": "" }
q64156
test
function( model, coll, options ) { if ( ( this.keyId || this.keyId === 0 ) && model.id === this.keyId ) { // since 0 can be a valid `id` as well this.addRelated( model, options ); this.keyId = null; } }
javascript
{ "resource": "" }
q64157
test
function( collection ) { if ( this.related ) { this.stopListening( this.related ); } if ( !collection || !( collection instanceof Backbone.Collection ) ) { var options = _.isFunction( this.options.collectionOptions ) ? this.options.collectionOptions( this.instance ) : this.options.collectionOptio...
javascript
{ "resource": "" }
q64158
test
function( keyContents ) { this.keyContents = keyContents instanceof Backbone.Collection ? keyContents : null; this.keyIds = []; if ( !this.keyContents && ( keyContents || keyContents === 0 ) ) { // since 0 can be a valid `id` as well // Handle cases the an API/user supplies just an Object/id instead of an...
javascript
{ "resource": "" }
q64159
test
function( key, options, refresh ) { // Set default `options` for fetch options = _.extend( { update: true, remove: false }, options ); var setUrl, requests = [], rel = this.getRelation( key ), idsToFetch = rel && ( ( rel.keyIds && rel.keyIds.slice( 0 ) ) || ( ( rel.keyId || rel.keyId === 0 ) ? [ r...
javascript
{ "resource": "" }
q64160
test
function( options ) { // If this Model has already been fully serialized in this branch once, return to avoid loops if ( this.isLocked() ) { return this.id; } this.acquire(); var json = Backbone.Model.prototype.toJSON.call( this, options ); if ( this.constructor._superModel && !( this.constructo...
javascript
{ "resource": "" }
q64161
test
function( attributes, options ) { options || ( options = {} ); options.create = false; return this.findOrCreate( attributes, options ); }
javascript
{ "resource": "" }
q64162
XtallatX
test
function XtallatX(superClass) { return class extends superClass { constructor() { super(...arguments); this._evCount = {}; } static get observedAttributes() { return [disabled]; } /** * Any component that emits events should not do...
javascript
{ "resource": "" }
q64163
Bitmap
test
function Bitmap(imageOrUri) { this.DisplayObject_constructor(); // public properties: /** * The source image to display. This can be a CanvasImageSource * (image, video, canvas), an object with a `getImage` method that returns a CanvasImageSource, or a string URL to an image. * If the latter, a new ...
javascript
{ "resource": "" }
q64164
canonicalize
test
function canonicalize(value, stack) { var canonicalizedObj; /* eslint-disable no-unused-vars */ var prop; /* eslint-enable no-unused-vars */ var type = getType(value); function withStack(value, fn) { stack.push(value); fn(); stack.pop(); } stack = stack || []; if (stack.indexOf(value) !=...
javascript
{ "resource": "" }
q64165
emptyRepresentation
test
function emptyRepresentation(value, type) { type = type || getType(value); switch (type) { case 'function': return '[Function]'; case 'object': return '{}'; case 'array': return '[]'; default: return value.toString(); } }
javascript
{ "resource": "" }
q64166
test
function(doc, first, last) { var f = doc.WordPos[first]; var l; if (last==doc.WordPos.length-1) // l = doc.DocLength; else l = doc.WordPos[last+1]; return l-f; }
javascript
{ "resource": "" }
q64167
compile
test
function compile() { var buf = ''; buf += '(function() {\n'; buf += '\n// CommonJS require()\n\n'; buf += browser.require + '\n\n'; buf += 'require.modules = {};\n\n'; buf += 'require.resolve = ' + browser.resolve + ';\n\n'; buf += 'require.register = ' + browser.register + ';\n\n'; buf += 'require.rela...
javascript
{ "resource": "" }
q64168
fp
test
function fp() { var args = Array.prototype.slice.call(arguments, 0); if (args.length) { if (!args.every(isStringOrFunction)) { var signature = args.map(humanizeArgument).join('\n\t'); throw new Error('Invalid arguments to functional pipeline - not a string or function\n\t' + ...
javascript
{ "resource": "" }
q64169
test
function(tickRate){ events.EventEmitter.call(this); // Initialize private properties this._milliseconds = 0; this._setState('stopped'); this._timer = new NanoTimer(); tickRate = tickRate || 100; Object.defineProperty(this, 'tickRate', { enumerable: true, configurable: false...
javascript
{ "resource": "" }
q64170
onProcessed
test
function onProcessed(err, processed) { if(err) return callback(err); _this._tokenize(processed, onTokenized); }
javascript
{ "resource": "" }
q64171
Template
test
function Template(str, options) { // Handle the case where the only argument passed is the `options` object if(_.isObject(str) && !options){ options = str; str = null; } // Create options if not provided options = options ? _.clone(options) : {}; // Set default cache behavior // if node if(!_...
javascript
{ "resource": "" }
q64172
test
function (fn, rate) { var allowed = true; return function () { if (allowed) { allowed = false; fn.apply(null, [].slice.call(arguments, 0)); setTimeout(function () { allowed = true; }, rate); } } }
javascript
{ "resource": "" }
q64173
get_data
test
function get_data (callback) { var data; try { data = program.data ? JSON.parse(program.data) : {}; callback(data); } catch (err) { fs.readFile(program.data, function (err, str) { str = '' + str; if (!err) { try { data = JSON.parse(str); callback(data); ...
javascript
{ "resource": "" }
q64174
secureWebhookEndpoints
test
function secureWebhookEndpoints() { var authenticationMiddleware = require(__dirname + '/middleware/slack_authentication.js'); // convert a variable argument list to an array, drop the webserver argument var tokens = Array.prototype.slice.call(arguments); var webserver = tokens.shift(); slack_botki...
javascript
{ "resource": "" }
q64175
postForm
test
function postForm(url, formData, cb, multipart) { cb = cb || noop; bot.logger.info('** API CALL: ' + url); var params = { url: url, headers: { 'User-Agent': bot.userAgent(), } }; if (multipart === true) { params.fo...
javascript
{ "resource": "" }
q64176
verifyRequest
test
function verifyRequest(req, res, buf, encoding) { var expected = req.headers['x-hub-signature']; var calculated = getSignature(buf); if (expected !== calculated) { throw new Error('Invalid signature on incoming request'); } else { // facebook_botkit.logger.debug('** X-Hub Verification succes...
javascript
{ "resource": "" }
q64177
test
function() { if ( !this.selfUpdating ) { this.deferred = true; } var i = this.refs.length; while ( i-- ) { this.refs[ i ].update(); } if ( this.deferred ) { this.update(); this.deferred = false; } }
javascript
{ "resource": "" }
q64178
DockerCmdManager
test
function DockerCmdManager(dockerdescPath) { dockerdescPath = dockerdescPath || './dockerdesc.json'; if (!fs.existsSync(dockerdescPath)) { throw new Error(util.format('The path "%s" does not exists.', dockerdescPath)); } /** @type {string} */ this.dockerdescDir = path.dirname(dockerdescPath)...
javascript
{ "resource": "" }
q64179
dd
test
function dd(object, _context, _key, _root, _rootPath) { _root = _root || object; _rootPath = _rootPath || []; var drill = function(key) { var nextObject = ( object && object.hasOwnProperty(key) && object[key] || undefined ); return dd(n...
javascript
{ "resource": "" }
q64180
printTasks
test
function printTasks(tasks, verbose) { tasks = tasks .filterHidden(verbose) .sort(); var results = [ 'Usage: gulp [task] [task2] ...', '', 'Tasks: ' ]; var fieldTaskLen = tasks.getLongestNameLength(); tasks.forEach(function(task) { var comment = task.comment || {}; var lines = c...
javascript
{ "resource": "" }
q64181
formatColumn
test
function formatColumn(text, width, offsetLeft, offsetRight) { offsetLeft = undefined !== offsetLeft ? offsetLeft : 3; offsetRight = undefined !== offsetRight ? offsetRight : 3; return new Array(offsetLeft + 1).join(' ') + text + new Array(Math.max(width - text.length, 0) + 1).join(' ') + new Array...
javascript
{ "resource": "" }
q64182
inheritGulp
test
function inheritGulp() { function TaskDoc() { this.taskList = new TaskList(); gulp.Gulp.call(this); } TaskDoc.prototype = gulp; return new TaskDoc(); }
javascript
{ "resource": "" }
q64183
_log
test
function _log(level) { return function() { var meta = null; var args = arguments; if (arguments.length === 0) { // we only check here current level, but we also should more but restify uses it only for trace checks return this._winston.level === level; } else if (arguments[0] instanceof E...
javascript
{ "resource": "" }
q64184
isPromise
test
function isPromise(item) { if (!item) return false; return ( (util.types && util.types.isPromise && util.types.isPromise(item)) || (item.constructor && item.constructor.name == 'Promise') || (!item instanceof objectInstance && item.then && typeof item.then == 'function') ); }
javascript
{ "resource": "" }
q64185
hasCallback
test
function hasCallback(fn) { var fnString = fn.toString(); // console.log('---'); // console.log('GIVEN', '>>> ' + fnString + ' <<<'); var bits, fnArgs; if (/^async /.test(fnString)) { // console.log('IS ASYNC'); return false; // Its an async function and should only ever return a promise } else if (bits = /^f...
javascript
{ "resource": "" }
q64186
race
test
function race() { var self = this; argy(arguments) .ifForm('', function() {}) .ifForm('array', function(tasks) { self._struct.push({ type: 'race', payload: tasks }); }) .ifForm('string array', function(id, tasks) { self._struct.push({ type: 'race', id: arguments[0], payload: arguments[1] }); }) .if...
javascript
{ "resource": "" }
q64187
deferAdd
test
function deferAdd(id, task, parentChain) { var self = this; parentChain.waitingOn = (parentChain.waitingOn || 0) + 1; if (! parentChain.waitingOnIds) parentChain.waitingOnIds = []; parentChain.waitingOnIds.push(id); self._deferred.push({ id: id || null, prereq: parentChain.prereq || [], payload: function...
javascript
{ "resource": "" }
q64188
await
test
function await() { var payload = []; // Slurp all args into payload argy(arguments) .getForm() .split(',') .forEach(function(type, offset) { switch (type) { case '': // Blank arguments - do nothing // Pass break; case 'string': payload.push(args[offset]); break; case 'array'...
javascript
{ "resource": "" }
q64189
timeout
test
function timeout(newTimeout) { var self = this; argy(arguments) .ifForm('', function() { self._struct.push({ type: 'timeout', delay: false }); }) .ifForm('boolean', function(setTimeout) { if (setTimeout) throw new Error('When calling .timeout(Boolean) only False is accepted to disable the timeout'); se...
javascript
{ "resource": "" }
q64190
_timeoutHandler
test
function _timeoutHandler() { var currentTaskIndex = this._struct.findIndex(function(task) { return ! task.completed }); if (!currentTaskIndex < 0) { console.log('Async-Chainable timeout on unknown task'); console.log('Full structure:', this._struct); } else { console.log('Async-Chainable timeout: Task #', cur...
javascript
{ "resource": "" }
q64191
run
test
function run(context, fn, finish, args) { // Argument mangling {{{ if (typeof context == 'function') { // called as run(fn, finish, args); args = finish; finish = fn; fn = context; context = this; } // }}} if (isPromise(fn)) { // Given a promise that has already resolved? fn .then(function(value) { ...
javascript
{ "resource": "" }
q64192
runWhile
test
function runWhile(iter, limit, callback) { var index = 0; var hasExited = false; var err; var running = 0; if (!Number.isFinite(limit)) limit = 10; var invoke = function() { iter.call(this._context, function(taskErr, taskResult) { if (taskErr) err = taskErr; if (taskErr || !taskResult) hasExited = true; ...
javascript
{ "resource": "" }
q64193
reset
test
function reset() { this._struct = []; this._structPointer = 0; var reAttachContext = (this._options.context == this._context); // Reattach the context pointer after reset? this._context = { _struct: this._struct, _structPointer: this._structPointer, _options: this._options, _deferredRunning: this._deferred...
javascript
{ "resource": "" }
q64194
hook
test
function hook() { var self = this; argy(arguments) .ifForm('', function() {}) .ifForm('string function', function(hook, callback) { // Attach to one hook if (!self._hooks[hook]) self._hooks[hook] = []; self._hooks[hook].push({cb: callback}); }) .ifForm('string string function', function(hook, id, callba...
javascript
{ "resource": "" }
q64195
tag
test
function tag(name) { if (!this.comment || !this.comment.tags) { return null; } for (var i = 0; i < this.comment.tags.length; i++) { var tagObj = this.comment.tags[i]; if (tagObj.name === name) { return tagObj.value; } } return null; }
javascript
{ "resource": "" }
q64196
checkPattern
test
function checkPattern(file, blackList, whiteList){ if (util.isRegExp(blackList) && blackList.test(file)) { return false; } if (util.isRegExp(whiteList)) { if (whiteList.test(file)) { return true; } return false; } return true; }
javascript
{ "resource": "" }
q64197
Seven
test
function Seven(_a) { var _b = _a === void 0 ? {} : _a, height = _b.height, width = _b.width, _c = _b.angle, angle = _c === void 0 ? 10 : _c, _d = _b.ratioLtoW, ratioLtoW = _d === void 0 ? 4 : _d, _e = _b.ratioLtoS, ratioLtoS = _e === void 0 ? 32 : _e, _f = _b.digit, digit = _f === void 0 ? Digit.BLA...
javascript
{ "resource": "" }
q64198
onChange
test
function onChange(event) { try { if (remove()) { return; } resolve(Array.from(input.files)); // actually got file(s) } catch (error) { reject(error); } }
javascript
{ "resource": "" }
q64199
RemoveObserver_init
test
function RemoveObserver_init(ref, node) { let self = Self.get(node); if (!self) { self = new RemoveObserverPrivate(node); Self.set(node, self); } Self.set(ref, self); }
javascript
{ "resource": "" }