_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q12200 | train | function (req, res) {
var query = req.query;
if (this.omit.length) {
query = _.omit(query, this.omit);
}
query = this.model.find(query);
if (this.lean) {
query.lean();
}
if (this.select.length) {
query.select(this.select.join(' '));
}
this.populateQuery(query, ... | javascript | {
"resource": ""
} | |
q12201 | train | function (req, res) {
var self = this;
var populations = self.filterPopulations('create');
this.model.populate(req.body, populations, function (err, populated) {
if (err) {
return res.handleError(err);
}
self.model.create(populated, function (err, document) {
if (err) {
... | javascript | {
"resource": ""
} | |
q12202 | setResponseErrors | train | function setResponseErrors(err, obj) {
/* jshint validthis: true */
var self = this;
obj = obj || {};
if (err.data && err.data.errors) {
err = err.data.errors;
}
if (err.errors) {
err = err.errors;
}
angular.forEach(err, function (error, field) {
... | javascript | {
"resource": ""
} |
q12203 | CustomHtml | train | function CustomHtml(options) {
this.button = document.createElement('button');
this.button.className = 'medium-editor-action';
if (this.button.innerText) {
this.button.innerText = options.buttonText || "</>";
} else {
this.button.textContent = options.buttonText |... | javascript | {
"resource": ""
} |
q12204 | registerClientModelDocSockets | train | function registerClientModelDocSockets(socket) {
ClientModelDoc.schema.post('save', function (doc) {
onSave(socket, doc);
});
ClientModelDoc.schema.post('remove', function (doc) {
onRemove(socket, doc);
});
} | javascript | {
"resource": ""
} |
q12205 | update | train | function update(form) {
// refuse to work with invalid data
if (!vm.clientModelDoc._id || form && !form.$valid) {
return;
}
ClientModelDocService.update(vm.clientModelDoc)
.then(updateClientModelDocSuccess)
.catch(updateClientModelDocCatch);
function updateClientM... | javascript | {
"resource": ""
} |
q12206 | remove | train | function remove(form, ev) {
var confirm = $mdDialog.confirm()
.title('Delete clientModelDoc ' + vm.displayName + '?')
.content('Do you really want to delete clientModelDoc ' + vm.displayName + '?')
.ariaLabel('Delete clientModelDoc')
.ok('Delete clientModelDoc')
.cancel('Ca... | javascript | {
"resource": ""
} |
q12207 | performRemove | train | function performRemove() {
ClientModelDocService.remove(vm.clientModelDoc)
.then(deleteClientModelDocSuccess)
.catch(deleteClientModelDocCatch);
function deleteClientModelDocSuccess() {
Toast.show({type: 'success', text: 'ClientModelDoc ' + vm.displayName + ' deleted'});
... | javascript | {
"resource": ""
} |
q12208 | ParamController | train | function ParamController(model, idName, paramName, router) {
var modelName = model.modelName.toLowerCase();
// make idName and paramName arguments optional (v0.1.1)
if (typeof idName === 'function') {
router = idName;
idName = modelName + 'Id';
}
if (typeof paramName === 'function') {
router = p... | javascript | {
"resource": ""
} |
q12209 | train | function (req, res, next, id) {
var self = this;
// check if a custom id is used, when not only process a valid object id
if (this.mongoId && !ObjectID.isValid(id)) {
res.badRequest();
return next();
}
// attach the document as this.paramName to the request
this.model.findOne({'_id... | javascript | {
"resource": ""
} | |
q12210 | ToggleComponentService | train | function ToggleComponentService($mdComponentRegistry, $log, $q) {
return function (contentHandle) {
var errorMsg = "ToggleComponent '" + contentHandle + "' is not available!";
var instance = $mdComponentRegistry.get(contentHandle);
if (!instance) {
$log.error('No content-switch found for ... | javascript | {
"resource": ""
} |
q12211 | isAuthenticated | train | function isAuthenticated() {
return compose()
// Validate jwt
.use(function (req, res, next) {
// allow access_token to be passed through query parameter as well
if (req.query && req.query.hasOwnProperty('access_token')) {
req.headers.authorization = 'Bearer ' + req.query.access_token;
... | javascript | {
"resource": ""
} |
q12212 | hasRole | train | function hasRole(roleRequired) {
if (!roleRequired) {
throw new Error('Required role needs to be set');
}
return compose()
.use(isAuthenticated())
.use(function meetsRequirements(req, res, next) {
if (roles.hasRole(req.userInfo.role, roleRequired)) {
next();
} else {
res.f... | javascript | {
"resource": ""
} |
q12213 | signToken | train | function signToken(id, role) {
return jwt.sign({_id: id, role: role}, config.secrets.session, {expiresInMinutes: 60 * 5});
} | javascript | {
"resource": ""
} |
q12214 | addAuthContext | train | function addAuthContext(namespace) {
if (!namespace) {
throw new Error('No context namespace specified!');
}
return function addAuthContextMiddleWare(req, res, next) {
contextService.setContext(namespace, req.userInfo);
next();
};
} | javascript | {
"resource": ""
} |
q12215 | request | train | function request(config) {
config.headers = config.headers || {};
if ($cookieStore.get('token')) {
config.headers.Authorization = 'Bearer ' + $cookieStore.get('token');
}
return config;
} | javascript | {
"resource": ""
} |
q12216 | responseError | train | function responseError(response) {
if (response.status === 401) {
// remove any stale tokens
$cookieStore.remove('token');
// use timeout to perform location change
// in the next digest cycle
$timeout(function () {
$location.path('/login');
}, 0);
... | javascript | {
"resource": ""
} |
q12217 | initExpress | train | function initExpress(app) {
var env = app.get('env');
var publicDir = path.join(config.root, config.publicDir);
app.set('ip', config.ip);
app.set('port', config.port);
app.set('views', config.root + '/server/views');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
app.u... | javascript | {
"resource": ""
} |
q12218 | syncUpdates | train | function syncUpdates(modelName, array, cb) {
cb = cb || angular.noop;
/**
* Syncs item creation/updates on 'model:save'
*/
socket.on(modelName + ':save', function (item) {
var index = _.findIndex(array, {_id: item._id});
var event = 'created';
// replace oldItem... | javascript | {
"resource": ""
} |
q12219 | registerUserSockets | train | function registerUserSockets(socket) {
User.schema.post('save', function (doc) {
onSave(socket, doc);
});
User.schema.post('remove', function (doc) {
onRemove(socket, doc);
});
} | javascript | {
"resource": ""
} |
q12220 | update | train | function update(form) {
// refuse to work with invalid data
if (!vm.user._id || form && !form.$valid) {
return;
}
UserService.update(vm.user)
.then(updateUserSuccess)
.catch(updateUserCatch);
function updateUserSuccess(updatedUser) {
// update the display ... | javascript | {
"resource": ""
} |
q12221 | remove | train | function remove(form, ev) {
var confirm = $mdDialog.confirm()
.title('Delete user ' + vm.displayName + '?')
.content('Do you really want to delete user ' + vm.displayName + '?')
.ariaLabel('Delete user')
.ok('Delete user')
.cancel('Cancel')
.targetEvent(ev);
... | javascript | {
"resource": ""
} |
q12222 | performRemove | train | function performRemove() {
UserService.remove(vm.user)
.then(deleteUserSuccess)
.catch(deleteUserCatch);
function deleteUserSuccess() {
Toast.show({type: 'success', text: 'User ' + vm.displayName + ' deleted'});
vm.showList();
}
function deleteUs... | javascript | {
"resource": ""
} |
q12223 | showChangePasswordDialog | train | function showChangePasswordDialog(event) {
$mdDialog.show({
controller: 'EditPasswordController',
controllerAs: 'password',
templateUrl: 'app/admin/user/list/edit/edit-password/edit-password.html',
targetEvent: event,
locals: {user: vm.user},
bindToController: true,... | javascript | {
"resource": ""
} |
q12224 | sendData | train | function sendData(data, options) {
// jshint validthis: true
var req = this.req;
var res = this.res;
// headers already sent, nothing to do here
if (res.headersSent) {
return;
}
// If appropriate, serve data as JSON
if (req.xhr || req.accepts('application/json')) {
return res.json(data);
}
... | javascript | {
"resource": ""
} |
q12225 | toggleOpen | train | function toggleOpen(isOpen) {
if (scope.isOpen === isOpen) {
return $q.when(true);
}
var deferred = $q.defer();
// Toggle value to force an async `updateIsOpen()` to run
scope.isOpen = isOpen;
$timeout(setElementFocus, 0, false);
return deferred.promise... | javascript | {
"resource": ""
} |
q12226 | ClientModelDocService | train | function ClientModelDocService(ClientModelDoc) {
return {
create: create,
update: update,
remove: remove
};
/**
* Save a new clientModelDoc
*
* @param {Object} clientModelDoc - clientModelDocData
* @param {Function} callback - optional
* @return {Promise}
... | javascript | {
"resource": ""
} |
q12227 | create | train | function create(clientModelDoc, callback) {
var cb = callback || angular.noop;
return ClientModelDoc.create(clientModelDoc,
function (clientModelDoc) {
return cb(clientModelDoc);
},
function (err) {
return cb(err);
}).$promise;
} | javascript | {
"resource": ""
} |
q12228 | remove | train | function remove(clientModelDoc, callback) {
var cb = callback || angular.noop;
return ClientModelDoc.remove({id: clientModelDoc._id},
function (clientModelDoc) {
return cb(clientModelDoc);
},
function (err) {
return cb(err);
}).$promise;
} | javascript | {
"resource": ""
} |
q12229 | update | train | function update(clientModelDoc, callback) {
var cb = callback || angular.noop;
return ClientModelDoc.update(clientModelDoc,
function (clientModelDoc) {
return cb(clientModelDoc);
},
function (err) {
return cb(err);
}).$promise;
} | javascript | {
"resource": ""
} |
q12230 | startServer | train | function startServer() {
var server = require('http').createServer(app);
var socket = socketio(server, {
serveClient: true,
path: '/socket.io-client'
});
// Setup SocketIO
socketConfig(socket);
return server;
} | javascript | {
"resource": ""
} |
q12231 | passphraseToKey | train | function passphraseToKey(type, passphrase, salt)
{
debug('passphraseToKey', type, passphrase, salt);
var nkey = keyBytes[type];
if (!nkey)
{
var allowed = Object.keys(keyBytes);
throw new TypeError('Unsupported type. Allowed: ' + allowed);
}
var niv = salt.length;
var saltLen = 8;
if (sa... | javascript | {
"resource": ""
} |
q12232 | verifyToken | train | function verifyToken(token) {
var decodedToken = jwt.decode(token)
return userdb.users.filter(user => user.name == decodedToken).length > 0;
} | javascript | {
"resource": ""
} |
q12233 | convertImports | train | function convertImports(imports) {
for (var file in imports) {
if (imports.hasOwnProperty(file)) {
postCssInputs[file] = new Input(imports[file], file !== "input" ? { from: file } : undefined);
}
}
} | javascript | {
"resource": ""
} |
q12234 | train | function(directive) {
var filename = directive.path
? directive.path.currentFileInfo.filename
: directive.currentFileInfo.filename;
var val, node, nodeTmp = buildNodeObject(filename, directive.index);
if(!directive.path) {
if(directive.features) {
val = ge... | javascript | {
"resource": ""
} | |
q12235 | train | function( methodStr ){
var parts = methodStr.split('['),
definition = {
name: parts[0],
args: []
},
args
;
if( parts.length > 1 ){
args = parts[1];
if( args[ args.length - 1 ] == ']' )
args = args.slice(0, args.length - 1);
... | javascript | {
"resource": ""
} | |
q12236 | train | function( field ){
var tagName = field.tagName.toLowerCase();
if( tagName == 'input' && field.type == 'checkbox' ){
return field.checked;
}
if( tagName == 'select' ){
return field.options[field.selectedIndex].value;
}
return field.value;
} | javascript | {
"resource": ""
} | |
q12237 | train | function( key ){
var fields = this.state.fields;
if( fields[ key ] && fields[ key ].settings.focus === true ){
fields = assign({}, fields);
fields[key].settings.focus = false;
this.setState( {fields: fields} );
}
} | javascript | {
"resource": ""
} | |
q12238 | train | function(kgraph) {
if (kgraph) {
zoomToFit(kgraph);
// assign coordinates to nodes
kgraph.children.forEach(function(n) {
var d3node = nodes[parseInt(n.id)];
copyProps(n, d3node);
(n.ports || []).forEach(function(p, i) {
copyProps(p,... | javascript | {
"resource": ""
} | |
q12239 | train | function(kgraph) {
zoomToFit(kgraph);
var nodeMap = {};
// convert to absolute positions
toAbsolutePositions(kgraph, {x: 0, y:0}, nodeMap);
toAbsolutePositionsEdges(kgraph, nodeMap);
// invoke the 'finish' event
dispatch.finish({graph: kgraph});
} | javascript | {
"resource": ""
} | |
q12240 | zoomToFit | train | function zoomToFit(kgraph) {
// scale everything so that it fits the specified size
var scale = width / kgraph.width || 1;
var sh = height / kgraph.height || 1;
if (sh < scale) {
scale = sh;
}
// if a transformation group was specified we
// perform a 'zoomToFit'
... | javascript | {
"resource": ""
} |
q12241 | RegExpStringIterator | train | function RegExpStringIterator(R, S, global, fullUnicode) {
if (ES.Type(S) !== 'String') {
throw new TypeError('S must be a string');
}
if (ES.Type(global) !== 'Boolean') {
throw new TypeError('global must be a boolean');
}
if (ES.Type(fullUnicode) !== 'Boolean') {
throw new TypeError('fullUnicode must be a b... | javascript | {
"resource": ""
} |
q12242 | buildChunksSort | train | function buildChunksSort( order ) {
return (a, b) => order.indexOf(a.names[0]) - order.indexOf(b.names[0]);
} | javascript | {
"resource": ""
} |
q12243 | minValueNode | train | function minValueNode(root) {
var current = root;
while (current.left) {
current = current.left;
}
return current;
} | javascript | {
"resource": ""
} |
q12244 | maxValueNode | train | function maxValueNode(root) {
var current = root;
while (current.right) {
current = current.right;
}
return current;
} | javascript | {
"resource": ""
} |
q12245 | getBalanceState | train | function getBalanceState(node) {
var heightDifference = node.leftHeight() - node.rightHeight();
switch (heightDifference) {
case -2: return BalanceState.UNBALANCED_RIGHT;
case -1: return BalanceState.SLIGHTLY_UNBALANCED_RIGHT;
case 1: return BalanceState.SLIGHTLY_UNBALANCED_LEFT;
case 2: return Bala... | javascript | {
"resource": ""
} |
q12246 | UrlNode | train | function UrlNode(data){
this.append = function(next){
this.next = next;
};
this.getData = function(){
return this.data;
};
this.setData = function(data){
this.data = data;
}
this.getNext = function(){
return this.next;
};
this.setParams = function(para... | javascript | {
"resource": ""
} |
q12247 | train | function (key, value) {
this.left = null;
this.right = null;
this.height = null;
this.key = key;
this.value = value;
} | javascript | {
"resource": ""
} | |
q12248 | train | function (event, method) {
if (methods.indexOf(method.toUpperCase()) !== -1) {
showLoader = (event.name === 'loaderShow');
} else if (methods.length === 0) {
showLoader = (event.name === 'loaderShow');
}
if (ttl <= 0 || (!timeoutId && !showLoa... | javascript | {
"resource": ""
} | |
q12249 | train | function (url) {
if (url.substring(0, 2) !== '//' &&
url.indexOf('://') === -1 &&
whitelistLocalRequests) {
return true;
}
for (var i = domains.length; i--;) {
if (url.indexOf(domains[i]) !== -1) {
return true;
}
... | javascript | {
"resource": ""
} | |
q12250 | train | function (config) {
if (isUrlOnWhitelist(config.url)) {
numLoadings++;
$rootScope.$emit('loaderShow', config.method);
}
return config || $q.when(config);
} | javascript | {
"resource": ""
} | |
q12251 | outputPath | train | function outputPath(options, source) {
var DEBUG = false;
if (DEBUG)
console.log('sourceFolder: ' + options.sourceFolder);
var globBase = options.sourceFolder.replace(/\*.*/, '');
if (globBase.endsWith('.sol')) // single file
globBase = path.join(globBase, '../');
if (DEBUG)
... | javascript | {
"resource": ""
} |
q12252 | generateOutput | train | function generateOutput(source) {
return __awaiter(this, void 0, void 0, function () {
var isCached, artifact, compiled, artifact, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, caching.has(source.codeHash)];
... | javascript | {
"resource": ""
} |
q12253 | getSourceCode | train | function getSourceCode(fileName) {
return __awaiter(this, void 0, void 0, function () {
var code, codeCommentsRegex, importsRegex, imports;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, readFile(fileNam... | javascript | {
"resource": ""
} |
q12254 | Manager | train | function Manager(options) {
this.roleGetters_ = {};
this.entityGetters_ = {};
this.actionDefs_ = {};
this.options = {
pauseStream: true
};
if (options) {
for (var option in this.options) {
if (options.hasOwnProperty(option)) {
this.options[option] = options[option];
}
}
}
} | javascript | {
"resource": ""
} |
q12255 | triggerResize | train | function triggerResize(callback) {
const { animateContent, checked } = callback.getState()
if ((animateContent === 'height' && checked) || (animateContent === 'marginTop' && !checked)) {
callback()
}
} | javascript | {
"resource": ""
} |
q12256 | train | function () {
if(this.data.debug){
console.log('Initialized preloader');
}
if(this.data.type === 'bootstrap' && typeof $ === 'undefined'){
console.error('jQuery is not present, cannot instantiate Bootstrap modal for preloader!');
}
document.querySelecto... | javascript | {
"resource": ""
} | |
q12257 | getHandlersFromArgs | train | function getHandlersFromArgs(args, start) {
assert.ok(args);
args = Array.prototype.slice.call(args, start);
function process(handlers, acc) {
if (handlers.length === 0) {
return acc;
}
var head = handlers.shift();
if (Array.isArray(head)) {
return process(head.concat(handlers), acc... | javascript | {
"resource": ""
} |
q12258 | Router | train | function Router() {
// Routes with all verbs
var routes = {};
methods.forEach(function (method) {
routes[method] = [];
});
this.routes = routes;
this.commonHandlers = [];
this.routers = [];
} | javascript | {
"resource": ""
} |
q12259 | tasks | train | function tasks(options) {
options = options || {};
var fp = path.resolve(options.template);
var tmpl = new utils.File({path: fp, contents: fs.readFileSync(fp)});
var data = {tasks: []};
return utils.through.obj(function(file, enc, next) {
var description = options.description || file.stem;
if (typeo... | javascript | {
"resource": ""
} |
q12260 | train | function (evt) {
let state = this.data.holdState
// api change in A-Frame v0.8.0
if (evt.detail === state || evt.detail.state === state) {
this.el.body.allowSleep = false
}
} | javascript | {
"resource": ""
} | |
q12261 | dispatch | train | function dispatch(context, event, args) {
var date = new Date()
for (var i = 0; i < listeners.length; i++)
listeners[i](context, event, date, args)
} | javascript | {
"resource": ""
} |
q12262 | train | function (successCallback, errorCallback, options) {
argscheck.checkArgs('fFO', 'GPSLocation.getCurrentPosition', arguments);
options = parseParameters(options);
var id = utils.createUUID();
// Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPositi... | javascript | {
"resource": ""
} | |
q12263 | base64toBlob | train | function base64toBlob(base64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
var byteCharacters = atob(base64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var sli... | javascript | {
"resource": ""
} |
q12264 | train | function(file, $canvas, callback) {
this.newImage();
if (!file)
return;
var reader = new FileReader();
reader.onload = function (fileReaderEvent) {
image.onload = function () { readImageToCanvasOnLoad(this, $canvas, callback); };
... | javascript | {
"resource": ""
} | |
q12265 | encryptAndSeal | train | function encryptAndSeal(plainText, AAD, nonce, key) {
const cipherText =
Sodium
.crypto_stream_chacha20_xor_ic(plainText, nonce, 1, key);
const hmac =
computePoly1305(cipherText, AAD, nonce, key);
return [ cipherText, hmac ];
} | javascript | {
"resource": ""
} |
q12266 | train | function (param1, param2, param3) {
var pc = new OriginalRTCPeerConnection(param1, param2, param3);
window.webdriverRTCPeerConnectionBucket = pc;
return pc;
} | javascript | {
"resource": ""
} | |
q12267 | getVariables | train | function getVariables(configName, variableNames) {
return Promise.all(variableNames.map(function(variableName) {
return getVariable(configName, variableName);
}));
} | javascript | {
"resource": ""
} |
q12268 | getVariable | train | function getVariable(configName, variableName) {
return new Promise(function(resolve, reject) {
auth().then(function(authClient) {
const projectId = process.env.GCLOUD_PROJECT;
const fullyQualifiedName = 'projects/' + projectId
+ '/configs/' + configName
... | javascript | {
"resource": ""
} |
q12269 | train | function() {
// choose from the sub-protocols
if (typeof self.options.handleProtocols == 'function') {
var protList = (protocols || '').split(/, */);
var callbackCalled = false;
self.options.handleProtocols(protList, function(result, protocol) {
callbackCalled = true;
if (!resu... | javascript | {
"resource": ""
} | |
q12270 | internalAssert | train | function internalAssert(condition, message) {
if (!condition) {
throw new AssertionError({
message,
actual: false,
expected: true,
operator: '=='
});
}
} | javascript | {
"resource": ""
} |
q12271 | isStackOverflowError | train | function isStackOverflowError(err) {
if (maxStack_ErrorMessage === undefined) {
try {
function overflowStack() { overflowStack(); }
overflowStack();
} catch (err) {
maxStack_ErrorMessage = err.message;
maxStack_ErrorName = err.name;
}
}
return err.name === maxStack_ErrorName &... | javascript | {
"resource": ""
} |
q12272 | train | function (config) {
winston.Transport.call(this, config);
/** @property {string} name - the name of the transport */
this.name = 'SplunkStreamEvent';
/** @property {string} level - the minimum level to log */
this.level = config.level || 'info';
// Verify that we actually have a splunk object and a token... | javascript | {
"resource": ""
} | |
q12273 | regexize | train | function regexize (rulesToRemove) {
var rulesRegexes = []
for (var i = 0, l = rulesToRemove.length; i < l; i++) {
if (typeof rulesToRemove[i] === 'string') {
rulesRegexes.push(new RegExp('^\\s*' + escapeRegExp(rulesToRemove[i]) + '\\s*$'))
} else {
rulesRegexes.push(rulesToRemove[i])
}
}
... | javascript | {
"resource": ""
} |
q12274 | concatRegexes | train | function concatRegexes (regexes) {
var rconcat = ''
if (Array.isArray(regexes)) {
for (var i = 0, l = regexes.length; i < l; i++) {
rconcat += regexes[i].source + '|'
}
rconcat = rconcat.substr(0, rconcat.length - 1)
return new RegExp(rconcat)
}
} | javascript | {
"resource": ""
} |
q12275 | train | function (ctx, next) {
var filter;
if (ctx.args && ctx.args.filter) {
filter = ctx.args.filter.where;
}
if (!ctx.res._headerSent) {
this.count(filter, function (err, count) {
ctx.res.set('X-Total-Count', count);
next();
});
} else {
next();
}
} | javascript | {
"resource": ""
} | |
q12276 | configureFilters | train | function configureFilters(config){
if (typeof config.minPeakHeight !== 'number' || isNaN(config.minPeakHeight)){
throw new TypeError('config.minPeakHeight should be a numeric value. Was: ' + String(config.minPeakHeight));
}
this.filters.push(function minHeightFilter(item){
return item >= config... | javascript | {
"resource": ""
} |
q12277 | filterDataItem | train | function filterDataItem(item){
return this.filters.some(function(filter){
return filter.call(null, item);
}) ? item : null;
} | javascript | {
"resource": ""
} |
q12278 | WebpackLaravelMixManifest | train | function WebpackLaravelMixManifest({ filename = null, transform = null } = {}) {
this.filename = filename ? filename : 'mix-manifest.json';
this.transform = transform instanceof Function ? transform : require('./transform');
} | javascript | {
"resource": ""
} |
q12279 | objectMapper | train | function objectMapper(originalData, y, i){
return this.getItem({
x: this.getValueX(originalData[i], i),
y: y
}, originalData[i], i);
} | javascript | {
"resource": ""
} |
q12280 | train | function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child com... | javascript | {
"resource": ""
} | |
q12281 | train | function (transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
} else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
this.updateComponent(transaction, this._currentElement, this._currentE... | javascript | {
"resource": ""
} | |
q12282 | train | function (inst, registrationName) {
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(inst, registrationName);
}
var bankForRegistrationName = listenerBank[registrationName]... | javascript | {
"resource": ""
} | |
q12283 | train | function (inst) {
var key = getDictionaryKey(inst);
for (var registrationName in listenerBank) {
if (!listenerBank.hasOwnProperty(registrationName)) {
continue;
}
if (!listenerBank[registrationName][key]) {
continue;
}
var PluginModule = EventPluginRegist... | javascript | {
"resource": ""
} | |
q12284 | batchedMountComponentIntoNode | train | function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* useCreateElement */
!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
transaction.perform(mountComponentIntoNode, null, compon... | javascript | {
"resource": ""
} |
q12285 | hasNonRootReactChild | train | function hasNonRootReactChild(container) {
var rootEl = getReactRootElementInContainer(container);
if (rootEl) {
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
return !!(inst && inst._hostParent);
}
} | javascript | {
"resource": ""
} |
q12286 | train | function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.c... | javascript | {
"resource": ""
} | |
q12287 | findDOMNode | train | function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should ... | javascript | {
"resource": ""
} |
q12288 | train | function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(a, b, c, d, e);
} e... | javascript | {
"resource": ""
} | |
q12289 | hasArrayNature | train | function hasArrayNature(obj) {
return (
// not null/false
!!obj && (
// arrays are objects, NodeLists are functions in Safari
typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
'length' in obj &&
// not window
!('setInterval' in obj) &&
// no D... | javascript | {
"resource": ""
} |
q12290 | getParentInstance | train | function getParentInstance(inst) {
!('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
return inst._hostParent;
} | javascript | {
"resource": ""
} |
q12291 | makeMove | train | function makeMove(child, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
content: null,
fromIndex: child._mountIndex,
fromNode: ReactReconciler.getHostNode(child),
toIndex: toIndex,
afterNode: afterNode
};
... | javascript | {
"resource": ""
} |
q12292 | train | function (child, mountImage, afterNode, index, transaction, context) {
child._mountIndex = index;
return this.createChild(child, afterNode, mountImage);
} | javascript | {
"resource": ""
} | |
q12293 | train | function (child, node) {
var update = this.removeChild(child, node);
child._mountIndex = null;
return update;
} | javascript | {
"resource": ""
} | |
q12294 | train | function (parentInst, updates) {
var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
DOMChildrenOperations.processUpdates(node, updates);
} | javascript | {
"resource": ""
} | |
q12295 | train | function(msg) {
if (window.console && window.console.error) {
window.console.error(msg);
} else {
log(msg);
}
} | javascript | {
"resource": ""
} | |
q12296 | makeFunctionWrapper | train | function makeFunctionWrapper(original, functionName) {
//log("wrap fn: " + functionName);
var f = original[functionName];
return function() {
//log("call: " + functionName);
var result = f.apply(original, arguments);
return result;
};
} | javascript | {
"resource": ""
} |
q12297 | makeLostContextFunctionWrapper | train | function makeLostContextFunctionWrapper(ctx, functionName) {
var f = ctx[functionName];
return function() {
// log("calling:" + functionName);
// Only call the functions if the context is not lost.
loseContextIfTime();
if (!contextLost_) {
//if (!checkResources(arguments)) {
... | javascript | {
"resource": ""
} |
q12298 | train | function (config) {
// at this stage, the `db` variable should not exist. expecting fresh setup or post teardown setup.
if (Transaction.databases[config.identity]) {
// @todo - emit wrror event instead of console.log
console.log('Warn: duplicate setup of connection found in Trans... | javascript | {
"resource": ""
} | |
q12299 | train | function () {
// just to be sure! clear all items in the connections object. they should be cleared by now
util.each(this.connections, function (value, prop, conns) {
try {
value.release();
}
catch (e) { } // nothing to do with error
delete... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.