_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q65100 | node | test | function node(content, type, name, indent){
this.type = type;
if(name) this.name = name;
this.content = content;
if(indent) {
this.indent = indent;// to use same indentation as source code
if(~eol.indexOf(indent[0])){
delete this.indent;
}
}
var loc ... | javascript | {
"resource": ""
} |
q65101 | f | test | function f(arr) {
if(arr){
var merged = [];
return merged.concat.apply(merged, arr).join("")
}
} | javascript | {
"resource": ""
} |
q65102 | configureStore | test | function configureStore(onComplete) {
// Apply middlewares
var middlewares = [thunk];
events.emit('middlewaresWillApply', middlewares);
if (__DEV__ && !!window.navigator.userAgent) {
middlewares.push(createLogger({
collapsed: true,
duration: true,
}));
}
// Create store
var storeCreat... | javascript | {
"resource": ""
} |
q65103 | test | function(el, config) {
var me = this;
config = config || {};
Ext.apply(me, config);
/**
* @event dropactivate
* @param {Ext.util.Droppable} this
* @param {Ext.util.Draggable} draggable
* @param {Ext.event.Event} e
*/
/**
* ... | javascript | {
"resource": ""
} | |
q65104 | test | function() {
if (!this.mgr) {
this.mgr = Ext.util.Observable.observe(Ext.util.Draggable);
}
this.mgr.on({
dragstart: this.onDragStart,
scope: this
});
this.disabled = false;
} | javascript | {
"resource": ""
} | |
q65105 | rel | test | function rel(root, src, sep) {
if(!root || !_.isString(root) || !src || !_.isString(src)) return
let root_split = root.split(path.sep),
src_split = src.split(path.sep)
return _.join(_.difference(src_split, root_split), sep || '/')
} | javascript | {
"resource": ""
} |
q65106 | rebase | test | function rebase(root, src, dest) {
let relp = rel(root, src)
return relp ? path.join(dest, relp) : ''
} | javascript | {
"resource": ""
} |
q65107 | lookupLevel | test | function lookupLevel(level) {
if (typeof level === 'string') {
var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
if (levelMap >= 0) {
level = levelMap;
} else {
level = parseInt(level, 10);
}
}
return level;
} | javascript | {
"resource": ""
} |
q65108 | log | test | function log(level) {
level = logger.lookupLevel(level);
if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
var method = logger.methodMap[level];
if (!console[method]) {
// eslint-disable-line no-console
method = 'log';
}
for (var... | javascript | {
"resource": ""
} |
q65109 | simpleId | test | function simpleId(path) {
return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
} | javascript | {
"resource": ""
} |
q65110 | acceptKey | test | function acceptKey(node, name) {
var value = this.accept(node[name]);
if (this.mutating) {
// Hacky sanity check: This may have a few false positives for type for the helper
// methods but will generally do the right thing without a lot of overhead.
if (value && !Visitor.prototype[value.t... | javascript | {
"resource": ""
} |
q65111 | acceptRequired | test | function acceptRequired(node, name) {
this.acceptKey(node, name);
if (!node[name]) {
throw new _exception2['default'](node.type + ' requires ' + name);
}
} | javascript | {
"resource": ""
} |
q65112 | acceptArray | test | function acceptArray(array) {
for (var i = 0, l = array.length; i < l; i++) {
this.acceptKey(array, i);
if (!array[i]) {
array.splice(i, 1);
i--;
l--;
}
}
} | javascript | {
"resource": ""
} |
q65113 | ret | test | function ret(context, execOptions) {
if (!compiled) {
compiled = compileInput();
}
return compiled.call(this, context, execOptions);
} | javascript | {
"resource": ""
} |
q65114 | reduceChildListMutation | test | function reduceChildListMutation(mutationContent, record) {
const isAdded = Boolean(record.addedNodes.length);
const isNext = Boolean(record.nextSibling);
const isPrev = Boolean(record.previousSibling);
const isRemoved = Boolean(record.removedNodes.length);
// innerHTML or replace
if (isAdded &... | javascript | {
"resource": ""
} |
q65115 | Node | test | function Node (options) {
if (!(this instanceof Node)) {
return new Node(options)
}
events.EventEmitter.call(this)
this._setStorageAdapter(options.storage)
this._log = options.logger
this._rpc = options.transport
this._self = this._rpc._contact
this._validator = options.validator
this._router =... | javascript | {
"resource": ""
} |
q65116 | test | function() {
var deferred;
deferred = Q.defer();
if (running.length < limit) {
running.push(deferred);
deferred.resolve();
} else {
queue.push(deferred);
}
return deferred.promise;
} | javascript | {
"resource": ""
} | |
q65117 | test | function() {
var next;
running.pop();
if (queue.length > 0 && running.length < limit) {
switch (type) {
case "lifo":
next = queue.pop();
break;
default:
next = queue.shift();
}
r... | javascript | {
"resource": ""
} | |
q65118 | test | function() {
var promise;
while (promise = queue.pop()) {
promise.reject("flush");
}
while (promise = running.pop()) {
promise.reject("flush");
}
} | javascript | {
"resource": ""
} | |
q65119 | test | function(record) {
var me = this;
me._record = record;
if (record && record.data) {
me.setValues(record.data);
}
return this;
} | javascript | {
"resource": ""
} | |
q65120 | test | function() {
var fields = [];
var getFieldsFrom = function(item) {
if (item.isField) {
fields.push(item);
}
if (item.isContainer) {
item.items.each(getFieldsFrom);
}
};
this.items.each(getFieldsFrom);
... | javascript | {
"resource": ""
} | |
q65121 | test | function() {
var fields = this.getFieldsArray(),
ln = fields.length,
field, i;
for (i = 0; i < ln; i++) {
field = fields[i];
if (field.isFocused) {
return field;
}
}
return null;
} | javascript | {
"resource": ""
} | |
q65122 | test | function(point, threshold) {
if (typeof threshold == 'number') {
threshold = {x: threshold};
threshold.y = threshold.x;
}
var x = point.x,
y = point.y,
thresholdX = threshold.x,
thresholdY = threshold.y;
return (this.x <= x + ... | javascript | {
"resource": ""
} | |
q65123 | sshCommandSequence | test | function sshCommandSequence(connection, commands, fnOutput) {
var allResults = [];
var successHandler = function(nextPromise){
return function(result) {
if( result !== true) { // the first result must be ignored
allResults.push(result);
}
return nextPromise();
};
};
var erro... | javascript | {
"resource": ""
} |
q65124 | replaceRefs | test | function replaceRefs(parsed, options) {
var topLevel = topLevelDeclsAndRefs(parsed),
refsToReplace = topLevel.refs.filter(ref => shouldRefBeCaptured(ref, topLevel, options)),
locallyIgnored = [];
const replaced = ReplaceVisitor.run(parsed, (node, path) => {
// cs 2016/06/27, 1a4661
// ensure k... | javascript | {
"resource": ""
} |
q65125 | generateUniqueName | test | function generateUniqueName(declaredNames, hint) {
var unique = hint, n = 1;
while (declaredNames.indexOf(unique) > -1) {
if (n > 1000) throw new Error("Endless loop searching for unique variable " + unique);
unique = unique.replace(/_[0-9]+$|$/, "_" + (++n));
}
return unique;
} | javascript | {
"resource": ""
} |
q65126 | replaceClassDecls | test | function replaceClassDecls(parsed, options) {
if (options.classToFunction)
return classToFunctionTransform(parsed, options.classToFunction);
var topLevel = topLevelDeclsAndRefs(parsed);
if (!topLevel.classDecls.length) return parsed;
for (var i = parsed.body.length - 1; i >= 0; i--) {
var stmt = pars... | javascript | {
"resource": ""
} |
q65127 | varDeclOrAssignment | test | function varDeclOrAssignment(parsed, declarator, kind) {
var topLevel = topLevelDeclsAndRefs(parsed),
name = declarator.id.name
return topLevel.declaredNames.indexOf(name) > -1 ?
// only create a new declaration if necessary
exprStmt(assign(declarator.id, declarator.init)) :
{
declarations: [... | javascript | {
"resource": ""
} |
q65128 | Item | test | function Item (key, value, publisher, timestamp) {
if (!(this instanceof Item)) {
return new Item(key, value, publisher, timestamp)
}
assert(typeof key === 'string', 'Invalid key supplied')
assert(utils.isValidKey(publisher), 'Invalid publisher nodeID supplied')
if (timestamp) {
assert(typeof timest... | javascript | {
"resource": ""
} |
q65129 | on | test | function on(top) {
top = typeof top === 'string' ? document.querySelector(top) : top;
var h = handle.bind(this, top);
h.once = once.bind(this, top);
return h;
} | javascript | {
"resource": ""
} |
q65130 | handleElements | test | function handleElements(elements, type, fn, capture) {
if (!elements || typeof elements.length !== 'number') throw new TypeError('Cannot bind event ' + inspect(type) + ' to ' + inspect(elements));
if (typeof type !== 'string') throw new TypeError('Event type must be a string, e.g. "click", not ' + inspect(type));
... | javascript | {
"resource": ""
} |
q65131 | test | function(opt) {
this.disable();
if (opt) this.set(opt);
var jNode = new JSYG(this.node),
dim = jNode.getDim(),
color = jNode.fill(),
svg = jNode.offsetParent(),
id = 'idpattern'+JSYG.rand(0,5000),
g,rect,selectio... | javascript | {
"resource": ""
} | |
q65132 | without | test | function without (toRemove) {
return function (prev, curr) {
if (!Array.isArray(prev)) {
prev = !testValue(prev, toRemove)
? [ prev ]
: []
}
if (!testValue(curr, toRemove)) prev.push(curr)
return prev
}
} | javascript | {
"resource": ""
} |
q65133 | initDhtmlxToolbar | test | function initDhtmlxToolbar (container) {
var impl = null;
if (Util.isNode(container)) {
impl = new dhtmlXToolbarObject(container, SKIN);
} else if (container.type === OBJECT_TYPE.LAYOUT_CELL
|| container.type === OBJECT_TYPE.ACCORDION_CELL
|| container.type === OBJECT_TYPE.LAYOUT
|| containe... | javascript | {
"resource": ""
} |
q65134 | test | function(data, track) {
if (track !== false) data = $track(data, track);
this.data = data;
this._dep.changed();
return this;
} | javascript | {
"resource": ""
} | |
q65135 | test | function() {
var models = [ this ],
model = this;
while (model.parent) {
models.unshift(model = model.parent);
}
return models
} | javascript | {
"resource": ""
} | |
q65136 | test | function(index) {
if (!_.isNumber(index) || isNaN(index)) index = 0;
if (index < 0) return this.getAllModels()[~index];
var model = this;
while (index && model) {
model = model.parent;
index--;
}
return model;
} | javascript | {
"resource": ""
} | |
q65137 | test | function(fn) {
var index = 0,
model = this;
while (model != null) {
if (fn.call(this, model, index++)) return model;
model = model.parent;
}
} | javascript | {
"resource": ""
} | |
q65138 | test | function(path) {
if (typeof path === "string") path = parse(path, { startRule: "path" });
if (!_.isObject(path)) throw new Error("Expecting string or object for path.");
var self = this;
this._dep.depend();
return _.reduce(path.parts, function(target, part) {
target = self._get(target, part.key);
_.ea... | javascript | {
"resource": ""
} | |
q65139 | test | function(paths) {
var self = this;
if (typeof paths === "string") paths = parse(paths, { startRule: "pathQuery" });
if (!_.isArray(paths)) paths = paths != null ? [ paths ] : [];
if (!paths.length) {
var model = this.findModel(function(m) { return !_.isUndefined(m.data); });
if (model == null) return;... | javascript | {
"resource": ""
} | |
q65140 | test | function(done) {
crypto.randomBytes(20, function(err, buffer) {
var token = buffer.toString('hex');
done(err, token);
});
} | javascript | {
"resource": ""
} | |
q65141 | test | function(token, done) {
if (req.body.username) {
User.findOne({
username: req.body.username
}, '-salt -password', function(err, user) {
if (!user) {
return res.status(400).send({
message: 'No account with that username has been found'
});
} else if (user.provider !== 'local'... | javascript | {
"resource": ""
} | |
q65142 | test | function(emailHTML, user, done) {
var smtpTransport = nodemailer.createTransport(config.mailer.options);
var mailOptions = {
to: user.email,
from: config.mailer.from,
subject: 'Your password has been changed',
html: emailHTML
};
smtpTransport.sendMail(mailOptions, function(err) {
done(e... | javascript | {
"resource": ""
} | |
q65143 | sortIssues | test | function sortIssues(issues) {
var sorted;
// Issues might be pre-arranged by super/sub tasks.
if (Object.keys(issues).indexOf('supers') > -1) {
// Network format issue sort
issues.supers = _.sortBy(issues.supers, function(issue) {
return new Date(issue.updated_at);
}).rev... | javascript | {
"resource": ""
} |
q65144 | deduplicateCollaborators | test | function deduplicateCollaborators(collaborators) {
var foundLogins = [];
return _.filter(collaborators, function (collaborator) {
var duplicate = false
, login = collaborator.login;
if (foundLogins.indexOf(login) > -1) {
duplicate = true;
} else {
foundL... | javascript | {
"resource": ""
} |
q65145 | extractSuperIssueSubTaskNumbers | test | function extractSuperIssueSubTaskNumbers(superIssue) {
var matches = superIssue.body.match(markdownTasksRegex)
, subTaskIds = [];
_.each(matches, function(line) {
var match = line.match(subtaskRegex);
if (match) {
subTaskIds.push(parseInt(match[3]));
}
});
retur... | javascript | {
"resource": ""
} |
q65146 | formatIssues | test | function formatIssues(format, issues) {
var formattedIssues
, partition
, superIssues
, singletonIssues
, removedSubtasks = [];
if (format == 'network') {
formattedIssues = {
supers: []
, singletons: []
, all: issues
};
partition = ... | javascript | {
"resource": ""
} |
q65147 | mergeIssuesAndPrs | test | function mergeIssuesAndPrs(issues, prs) {
_.each(issues, function(issue) {
var targetPr
, targetPrIndex = _.findIndex(prs, function(pr) {
return pr && pr.number == issue.number;
});
if (targetPrIndex > -1) {
targetPr = prs[targetPrIndex];
prs... | javascript | {
"resource": ""
} |
q65148 | Sprinter | test | function Sprinter(username, password, repoSlugs, cache) {
if (! username) {
throw new Error('Missing username.');
}
if (! password) {
throw new Error('Missing password.');
}
if (! repoSlugs) {
throw new Error('Missing repositories.');
}
this.username = username;
t... | javascript | {
"resource": ""
} |
q65149 | getFetchByStateCallback | test | function getFetchByStateCallback(callback) {
return function(err, data) {
if (err) {
asyncErrors.push(err);
}
callback(null, data);
};
} | javascript | {
"resource": ""
} |
q65150 | listAvailables | test | function listAvailables(forceRefresh) {
forceRefresh && (adaptersCache = []);
if( adaptersCache.length ){
return adaptersCache;
}
adaptersCache = fs.readdirSync(__dirname).filter(function(fileOrDirName){
return isDir(__dirname + '/' + fileOrDirName);
});
return adaptersCache;
} | javascript | {
"resource": ""
} |
q65151 | readConfig | test | function readConfig(adapterName, path){
var adapter = getAdapterInstance(adapterName);
return adapter.configLoader(normalizeAdapterConfigPath(adapter, path));
} | javascript | {
"resource": ""
} |
q65152 | writeConfig | test | function writeConfig(adapterName, path, config){
var adapter = getAdapterInstance(adapterName);
return adapter.configWriter(normalizeAdapterConfigPath(adapter, path), config);
} | javascript | {
"resource": ""
} |
q65153 | handleFiles | test | function handleFiles(files) {
files.forEach(function(f) {
f.src.filter(srcExists).map(function(filepath) {
var pathInfo = getPathInfo(filepath, f.dest),
context = getContext(f.context, pathInfo);
renderFile(pathInfo.outfile, filepath, context);
});
});
} | javascript | {
"resource": ""
} |
q65154 | handleI18nFiles | test | function handleI18nFiles(files) {
options.locales.forEach(function(locale) {
grunt.registerTask('swigtemplatesSubtask-' + locale, function() {
var done = this.async();
var translatorFactory = options.translateFunction(locale);
Q.when(translatorFactory, function(translator) { ... | javascript | {
"resource": ""
} |
q65155 | getContext | test | function getContext(context, pathInfo) {
var globalContext,
templateContext;
try {
globalContext = grunt.file.readJSON(path.join(options.templatesDir, "global.json"));
} catch(err) {
globalContext = {};
}
try {
templateContext = grunt.file.readJSON(path.j... | javascript | {
"resource": ""
} |
q65156 | render | test | function render(url) {
return async page => {
try {
const template = `${page.template || 'schedule'}.hbs`;
// Load template and compile
const filePath = path.join(
process.cwd(),
config.theme || 'theme',
config.template || 'templates',
template,
);
con... | javascript | {
"resource": ""
} |
q65157 | isNamedFunction | test | function isNamedFunction(node)
{
if (node.id)
return true;
const { parent } = node;
const { type } = parent;
const namedFunction =
type === 'MethodDefinition' ||
type === 'Property' && (parent.kind === 'get' || parent.kind === 'set' || parent.method);
... | javascript | {
"resource": ""
} |
q65158 | getConfigForFunction | test | function getConfigForFunction(node)
{
if (isNamedFunction(node))
return 'never';
if (node.type === 'ArrowFunctionExpression')
{
// Always ignore non-async functions and arrow functions without parens, e.g.
// `async foo => bar`.
if
... | javascript | {
"resource": ""
} |
q65159 | checkFunction | test | function checkFunction(node)
{
const functionConfig = getConfigForFunction(node);
if (functionConfig === 'ignore')
return;
const rightToken = sourceCode.getFirstToken(node, astUtils.isOpeningParenToken);
const leftToken = sourceCode.getTokenBefore(rightToken);
con... | javascript | {
"resource": ""
} |
q65160 | test | function(config) {
var me = this;
//<debug warn>
for (var configName in config) {
if (me.self.prototype.config && !(configName in me.self.prototype.config)) {
me[configName] = config[configName];
Ext.Logger.warn('Applied config as instance property: "'... | javascript | {
"resource": ""
} | |
q65161 | bindEventMap | test | function bindEventMap(eventMap, eventEmitter) {
var eventNames = Object.keys(eventMap);
eventNames.map(function (eventName) {
eventEmitter.on(eventName, eventMap[eventName]);
});
} | javascript | {
"resource": ""
} |
q65162 | test | function(delay, newFn, newScope, newArgs) {
var me = this;
//cancel any existing queued functions
me.cancel();
//set all the new configurations
if (Ext.isNumber(delay)) {
me.setDelay(delay);
}
if (Ext.isFunction(newFn)) {
me.setFn(newFn... | javascript | {
"resource": ""
} | |
q65163 | test | function(success, operation, request, response, callback, scope) {
var me = this,
action = operation.getAction(),
reader, resultSet;
if (success === true) {
reader = me.getReader();
try {
resultSet = reader.process(me.getResponseResult(re... | javascript | {
"resource": ""
} | |
q65164 | test | function(operation, response) {
if (Ext.isObject(response)) {
operation.setException({
status: response.status,
statusText: response.statusText
});
}
} | javascript | {
"resource": ""
} | |
q65165 | test | function(request) {
var me = this,
url = me.getUrl(request);
//<debug>
if (!url) {
Ext.Logger.error("You are using a ServerProxy but have not supplied it with a url.");
}
//</debug>
if (me.getNoCache()) {
url = Ext.urlAppend(url, Ext.... | javascript | {
"resource": ""
} | |
q65166 | test | function(newDateFormat, oldDateFormat) {
var value = this.getValue();
if (newDateFormat != oldDateFormat && Ext.isDate(value)) {
this.getComponent().setValue(Ext.Date.format(value, newDateFormat || Ext.util.Format.defaultDateFormat));
}
} | javascript | {
"resource": ""
} | |
q65167 | test | function(picker, value) {
var me = this,
oldValue = me.getValue();
me.setValue(value);
me.fireEvent('select', me, value);
me.onChange(me, value, oldValue);
} | javascript | {
"resource": ""
} | |
q65168 | clone | test | function clone (obj) {
var newObj = {};
// Return a new obj if no `obj` passed in
if (!obj || typeof obj !== 'object' || Array.isArray(obj))
return newObj;
for (var prop in obj)
newObj[prop] = obj[prop];
return newObj;
} | javascript | {
"resource": ""
} |
q65169 | ImpulseBin | test | function ImpulseBin() {
this.settings = {
adapter: 'commander',
quietOption: 'quiet',
requiredOptionTmpl: '--%s is required',
verboseOption: 'verbose',
verboseLogName: '[verbose]',
stdoutLogName: '[stdout]',
stderrLogName: '[stderr]'
};
this.console = require('long-con').create();
... | javascript | {
"resource": ""
} |
q65170 | test | function(config) {
var me = this,
currentConfig = me.config,
id;
me.onInitializedListeners = [];
me.initialConfig = config;
if (config !== undefined && 'id' in config) {
id = config.id;
}
else if ('id' in currentConfig) {
... | javascript | {
"resource": ""
} | |
q65171 | test | function(className, /* private */ force) {
var oldCls = this.getCls(),
newCls = (oldCls) ? oldCls.slice() : [];
if (force || newCls.indexOf(className) == -1) {
newCls.push(className);
} else {
Ext.Array.remove(newCls, className);
}
this.setCl... | javascript | {
"resource": ""
} | |
q65172 | test | function(animation) {
this.setCurrentAlignmentInfo(null);
/*
if(this.activeAnimation) {
this.activeAnimation.on({
animationend: function(){
this.hide(animation);
},
scope: this,
single: true
... | javascript | {
"resource": ""
} | |
q65173 | test | function(animation) {
if(this.activeAnimation) {
this.activeAnimation.on({
animationend: function(){
this.show(animation);
},
scope: this,
single: true
});
return this;
}
var ... | javascript | {
"resource": ""
} | |
q65174 | test | function(width, height) {
if (width != undefined) {
this.setWidth(width);
}
if (height != undefined) {
this.setHeight(height);
}
} | javascript | {
"resource": ""
} | |
q65175 | test | function(component, alignment) {
var me = this,
viewport = Ext.Viewport,
parent = me.getParent();
me.setVisibility(false);
if (parent !== viewport) {
viewport.add(me);
}
me.show();
me.on({
hide: 'onShowByErased',
... | javascript | {
"resource": ""
} | |
q65176 | test | function (component, alignment){
var alignToElement = component.isComponent ? component.renderElement : component,
alignToBox = alignToElement.getPageBox(),
element = this.renderElement,
box = element.getPageBox(),
stats = {
alignToBox: alignToBox,... | javascript | {
"resource": ""
} | |
q65177 | test | function(alignmentInfo) {
this.$currentAlignmentInfo = Ext.isEmpty(alignmentInfo) ? null : Ext.merge({}, alignmentInfo.stats ? alignmentInfo.stats : alignmentInfo);
} | javascript | {
"resource": ""
} | |
q65178 | test | function(selector) {
var result = this.parent;
if (selector) {
for (; result; result = result.parent) {
if (Ext.ComponentQuery.is(result, selector)) {
return result;
}
}
}
return result;
} | javascript | {
"resource": ""
} | |
q65179 | test | function() {
this.destroy = Ext.emptyFn;
var parent = this.getParent(),
referenceList = this.referenceList,
i, ln, reference;
this.isDestroying = true;
Ext.destroy(this.getTranslatable(), this.getPlugins());
// Remove this component itself from the cont... | javascript | {
"resource": ""
} | |
q65180 | test | function (list, index, target, record, e) {
var me = this,
store = list.getStore(),
node = store.getAt(index);
me.fireEvent('itemtap', this, list, index, target, record, e);
if (node.isLeaf()) {
me.fireEvent('leafitemtap', this, list, index, target, record, e... | javascript | {
"resource": ""
} | |
q65181 | test | function () {
var me = this,
node = me.getLastNode(),
detailCard = me.getDetailCard(),
detailCardActive = detailCard && me.getActiveItem() == detailCard,
lastActiveList = me.getLastActiveList();
this.fireAction('back', [this, node, lastActiveList, detailC... | javascript | {
"resource": ""
} | |
q65182 | test | function (node) {
if (!node.isLeaf()) {
throw new Error('goToLeaf: passed a node which is not a leaf.');
}
var me = this,
card = me.getDetailCard(node),
container = me.getDetailContainer(),
sharedContainer = container == this,
layout =... | javascript | {
"resource": ""
} | |
q65183 | hoistFunctions | test | function hoistFunctions(program) {
var functions = [];
var body = [];
for (let line of program.body) {
if (line.type === 'ExportDefaultDeclaration') {
if (line.declaration.type === 'FunctionDeclaration') {
functions.push(line);
} else {
body.push(line);
}
continue;
}
if (line.type === 'Ex... | javascript | {
"resource": ""
} |
q65184 | parseVehicleID | test | function parseVehicleID($, item) {
let fields = $(item).find('td');
let id = $(fields[1]).find('a').attr('href').replace('Detail.aspx?id=', '');
return id;
} | javascript | {
"resource": ""
} |
q65185 | formatDetails | test | function formatDetails(details) {
let result = {
results: details,
count: details.length,
time: new Date().toISOString()
};
return result;
} | javascript | {
"resource": ""
} |
q65186 | getByID | test | function getByID(id) {
var url = `${APP_BASE_URL}Detail.aspx?id=${id}`;
return request(url)
.then(function(body) {
let $ = cheerio.load(body);
let info = {
url: url,
id: id
};
$('table#searchTableResults tr').each((i, item) => {
let span = $(item).find('span');
... | javascript | {
"resource": ""
} |
q65187 | test | function(config) {
if (!config.callback) {
Ext.Logger.error('You must specify a `callback` for `#canMakePayments` to work.');
return false;
}
Ext.device.Communicator.send({
command: 'Purchase#canMakePayments',
callbacks: {
callback... | javascript | {
"resource": ""
} | |
q65188 | test | function(config) {
if (!config.success) {
Ext.Logger.error('You must specify a `success` callback for `#purchase` to work.');
return false;
}
if (!config.failure) {
Ext.Logger.error('You must specify a `failure` callback for `#purchase... | javascript | {
"resource": ""
} | |
q65189 | test | function(config) {
var me = this;
if (!config.success) {
Ext.Logger.error('You must specify a `success` callback for `#complete` to work.');
return false;
}
if (!config.failure) {
Ext.Logger.error('You must specify a `fail... | javascript | {
"resource": ""
} | |
q65190 | test | function (key) {
this.key = key;
this.keyType = key.split(" ")[0];
this.rawkey = key.split(" ")[1];
try{
this.keyComment = key.split(" ")[2];
} catch(err){
this.keyComment = null;
}
this.byteArray = this._stringToBytes(atob(this.rawkey));
this.slicedArray = [];
this.wordLength =... | javascript | {
"resource": ""
} | |
q65191 | test | function(sourceFunc, boundFunc, context, callingContext, args) {
if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
Ctor.prototype = sourceFunc.prototype;
var self = new Ctor;
Ctor.prototype = null;
var result = sourceFunc.apply(self, args);
if (_.isObject(result... | javascript | {
"resource": ""
} | |
q65192 | test | function(e) {
var me = this,
oldChecked = me._checked,
newChecked = me.getChecked();
// only fire the event when the value changes
if (oldChecked != newChecked) {
if (newChecked) {
me.fireEvent('check', me, e);
} else {
... | javascript | {
"resource": ""
} | |
q65193 | test | function() {
var values = [];
this.getSameGroupFields().forEach(function(field) {
if (field.getChecked()) {
values.push(field.getValue());
}
});
return values;
} | javascript | {
"resource": ""
} | |
q65194 | test | function(values) {
this.getSameGroupFields().forEach(function(field) {
field.setChecked((values.indexOf(field.getValue()) !== -1));
});
return this;
} | javascript | {
"resource": ""
} | |
q65195 | test | function() {
var me = this,
container = me.container;
if (!me.getStore()) {
if (!me.hasLoadedStore && !me.getDeferEmptyText()) {
me.showEmptyText();
}
return;
}
if (container) {
me.fireAction('refresh', [me], 'd... | javascript | {
"resource": ""
} | |
q65196 | processParams | test | function processParams(paramsString) {
var individualParams = paramsString.split("&"),
resultObject = {};
individualParams.forEach(function(item) {
var itemParts = item.split("="),
paramName = itemParts[0],
paramValue = decodeURIComponent(itemParts[1] || "");
var paramObject = {};
... | javascript | {
"resource": ""
} |
q65197 | test | function(config) {
if (!this._store) {
this._store = [
{
first: 'Robert',
last: 'Dougan',
emails: {
work: 'rob@sencha.com'
}
},
{
... | javascript | {
"resource": ""
} | |
q65198 | Collection | test | function Collection(options) {
if (!(this instanceof Collection)){
return new Collection(options);
}
options = options || {};
if (options instanceof Array) {
this.modelType = undefined;
this.items = options;
} else {
this.modelType = options.modelType;
this.items = options.items || [];
... | javascript | {
"resource": ""
} |
q65199 | find | test | function find(filter) {
var item;
var i;
var ilen;
var keys;
var key;
var k;
var klen;
var found;
if (filter instanceof Function) {
for (i = 0, ilen = this.items.length; i < ilen; ++i) {
item = this.items[i];
if (filter(item, i)) {
return item;
}
}
} else if (filte... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.