_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 27
233k
| 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;
}
| javascript | {
"resource": ""
} |
q65101 | f | test | function f(arr) {
if(arr){
var merged = | 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,
| 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
*/
/**
* @event dropdeactivate
* @param {Ext.util.Droppable} this
* @param {Ext.util.Draggable} draggable
* @param {Ext.event.Event} e
*/
/**
* @event dropenter
* @param {Ext.util.Droppable} this
* @param {Ext.util.Draggable} draggable
* @param {Ext.event.Event} e
*/
/**
* @event dropleave
* @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);
| 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),
| javascript | {
"resource": ""
} |
q65106 | rebase | test | function rebase(root, src, dest) {
let relp = rel(root, src)
| javascript | {
"resource": ""
} |
q65107 | lookupLevel | test | function lookupLevel(level) {
if (typeof level === 'string') {
var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
| 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';
}
| javascript | {
"resource": ""
} |
q65109 | simpleId | test | function simpleId(path) {
return path.parts.length | 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 | javascript | {
"resource": ""
} |
q65111 | acceptRequired | test | function acceptRequired(node, name) {
this.acceptKey(node, 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]) {
| javascript | {
"resource": ""
} |
q65113 | ret | test | function ret(context, execOptions) {
if (!compiled) {
| 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 && (isRemoved || (!isRemoved && !isNext && !isPrev))) {
while (mutationContent.firstChild) {
mutationContent.removeChild(mutationContent.firstChild);
}
forEach(record.addedNodes, function (node) {
mutationContent.appendChild(node);
});
// appendChild
} else if (isAdded && !isRemoved && !isNext && isPrev) { | 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 = options.router || new Router({
logger: this._log,
transport: this._rpc,
validator: this._validateKeyValuePair.bind(this)
})
| javascript | {
"resource": ""
} |
q65116 | test | function() {
var deferred;
deferred = Q.defer();
if (running.length < limit) {
running.push(deferred);
deferred.resolve();
} else {
| javascript | {
"resource": ""
} |
|
q65117 | test | function() {
var next;
running.pop();
if (queue.length > 0 && running.length < limit) {
switch (type) {
case "lifo":
| javascript | {
"resource": ""
} |
|
q65118 | test | function() {
var promise;
while (promise = queue.pop()) {
promise.reject("flush");
}
| javascript | {
"resource": ""
} |
|
q65119 | test | function(record) {
var me = this;
me._record = record;
if (record && record.data) {
| javascript | {
"resource": ""
} |
|
q65120 | test | function() {
var fields = [];
var getFieldsFrom = function(item) {
if (item.isField) {
fields.push(item);
}
if (item.isContainer) {
| javascript | {
"resource": ""
} |
|
q65121 | test | function() {
var fields = this.getFieldsArray(),
ln = fields.length,
field, i;
for (i = 0; i < ln; i++) {
field = fields[i];
| 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,
| 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 errorHandler = function(nextPromise) {
return function(error) {
allResults.push(error);
return nextPromise();
};
};
// start the sequential fullfilment of the | 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 keys of shorthand properties are not renamed while capturing
if (node.type === "Property"
&& refsToReplace.includes(node.key)
&& node.shorthand)
return prop(id(node.key.name), node.value);
// don't replace var refs in expressions such as "export { x }" or "export var x;"
// We make sure that those var references are defined in insertDeclarationsForExports()
if (node.type === "ExportNamedDeclaration") {
var { | 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 | 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 | 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
| 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 timestamp === 'number', | javascript | {
"resource": ""
} |
q65129 | on | test | function on(top) {
top = typeof top === 'string' ? document.querySelector(top) | 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));
if (typeof fn !== 'function') throw new TypeError('`fn` (the function to call when the event is triggered) must be a function, not ' + inspect(fn));
if (capture !== undefined && capture !== false && capture !== true) {
| 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,selection;
if (!color || color == 'transparent' || color == 'none') color = 'white';
if (dim.width < this.boxInit.width) this.boxInit.width = dim.width;
if (dim.height < this.boxInit.height) this.boxInit.height= dim.height;
rect = new JSYG('<rect>').fill(color);
g = new JSYG('<g>').append(rect);
new JSYG(this.pattern)
.attr({id:id,patternUnits:'userSpaceOnUse'})
.append(g).appendTo(svg);
new JSYG(this.mask)
.css('fill-opacity',0.5)
.appendTo(svg);
if (this.keepRatio) this.boxInit.height = dim.height * this.boxInit.width / dim.width;
selection = new JSYG(this.selection) | javascript | {
"resource": ""
} |
|
q65132 | without | test | function without (toRemove) {
return function (prev, curr) {
if (!Array.isArray(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 | javascript | {
"resource": ""
} |
q65134 | test | function(data, track) {
if (track !== false) data = $track(data, track);
this.data | javascript | {
"resource": ""
} |
|
q65135 | test | function() {
var models = [ this ],
model = this;
while (model.parent) {
| javascript | {
"resource": ""
} |
|
q65136 | test | function(index) {
if (!_.isNumber(index) || isNaN(index)) index = 0;
if (index < 0) return this.getAllModels()[~index]; | javascript | {
"resource": ""
} |
|
q65137 | test | function(fn) {
var index = 0,
model = this;
while (model != null) {
if (fn.call(this, model, | 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); | 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;
var val = model.data;
if (_.isFunction(val)) val = val.call(this, null);
return val;
}
return _.reduce(paths, function(result, path, index) {
var model = self,
scope = true,
val;
if (path.type === "root") {
model = self.getRootModel();
} else if (path.type === "parent") {
model = self.getModelAtOffset(path.distance);
scope = false;
} else | javascript | {
"resource": ""
} |
|
q65140 | test | function(done) {
crypto.randomBytes(20, function(err, buffer) {
var 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',
| 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);
}).reverse();
issues.singletons = _.sortBy(issues.singletons, function(issue) {
| 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) {
| javascript | {
"resource": ""
} |
q65145 | extractSuperIssueSubTaskNumbers | test | function extractSuperIssueSubTaskNumbers(superIssue) {
var matches = superIssue.body.match(markdownTasksRegex)
, subTaskIds = [];
_.each(matches, function(line) {
var match | javascript | {
"resource": ""
} |
q65146 | formatIssues | test | function formatIssues(format, issues) {
var formattedIssues
, partition
, superIssues
, singletonIssues
, removedSubtasks = [];
if (format == 'network') {
formattedIssues = {
supers: []
, singletons: []
, all: issues
};
partition = _.partition(issues, function(issue) {
return _.find(issue.labels, function(label) {
return label.name == 'super';
});
});
superIssues = partition.shift();
singletonIssues = partition.shift();
_.each(superIssues, function(superIssue) {
var subTaskNumbers = extractSuperIssueSubTaskNumbers(superIssue);
superIssue.subtasks = _.filter(singletonIssues, function(issue) {
var isSubtask = _.contains(subTaskNumbers, issue.number);
| 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;
});
| 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;
this.password = password;
// Verify required configuration elements.
this.repos = convertSlugsToObjects(repoSlugs);
this.gh = new GitHubApi({
| javascript | {
"resource": ""
} |
q65149 | getFetchByStateCallback | test | function getFetchByStateCallback(callback) {
return function(err, data) {
if (err) {
asyncErrors.push(err);
| javascript | {
"resource": ""
} |
q65150 | listAvailables | test | function listAvailables(forceRefresh) {
forceRefresh && (adaptersCache = []);
if( adaptersCache.length ){
return | javascript | {
"resource": ""
} |
q65151 | readConfig | test | function readConfig(adapterName, path){
var adapter = getAdapterInstance(adapterName);
return | javascript | {
"resource": ""
} |
q65152 | writeConfig | test | function writeConfig(adapterName, path, config){
var adapter = getAdapterInstance(adapterName);
return | 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),
| 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);
| 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 | 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,
);
const output = Handlebars.compile(await fs.readFile(filePath, 'utf-8'))(page);
await fs.ensureDir(outputDir); | javascript | {
"resource": ""
} |
q65157 | isNamedFunction | test | function isNamedFunction(node)
{
if (node.id)
return true;
const { parent } = node;
const { type } = parent;
| 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
(
!node.async ||
| 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);
const text =
sourceCode
.text
.slice(leftToken.range[1], rightToken.range[0])
.replace(/\/\*[^]*?\*\//g, '');
if (astUtils.LINEBREAK_MATCHER.test(text))
return;
const hasSpacing = /\s/.test(text);
if (hasSpacing && functionConfig === 'never')
{
const report =
{
node,
loc: leftToken.loc.end,
message: 'Unexpected space before function parentheses.',
fix: fixer => fixer.removeRange([leftToken.range[1], rightToken.range[0]]),
};
| 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];
| javascript | {
"resource": ""
} |
|
q65161 | bindEventMap | test | function bindEventMap(eventMap, eventEmitter) {
var eventNames = Object.keys(eventMap);
eventNames.map(function (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);
}
if (newScope) {
me.setScope(newScope);
}
if (newScope) {
| 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(response));
} catch(e) {
operation.setException(e.message);
me.fireEvent('exception', me, response, operation);
return;
}
// This could happen if the model was configured using metaData
if (!operation.getModel()) {
operation.setModel(this.getModel());
}
if (operation.process(action, resultSet, request, response) === false) {
me.setException(operation, response);
me.fireEvent('exception', me, response, operation);
}
} else {
me.setException(operation, response);
/**
* @event exception
| javascript | {
"resource": ""
} |
|
q65164 | test | function(operation, response) {
if (Ext.isObject(response)) {
operation.setException({
status: response.status, | 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 | javascript | {
"resource": ""
} |
|
q65166 | test | function(newDateFormat, oldDateFormat) {
var value = this.getValue();
if (newDateFormat != oldDateFormat && | javascript | {
"resource": ""
} |
|
q65167 | test | function(picker, value) {
var me = this,
oldValue = me.getValue();
me.setValue(value);
| javascript | {
"resource": ""
} |
|
q65168 | clone | test | function clone (obj) {
var newObj = {};
// Return a new obj if no `obj` passed in
if (!obj || | 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]' | 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) {
id = currentConfig.id;
}
else {
id = me.getId();
}
me.id = id;
me.setId(id);
Ext.ComponentManager.register(me);
me.initElement();
me.initConfig(me.initialConfig);
me.refreshSizeState = me.doRefreshSizeState;
me.refreshFloating = me.doRefreshFloating;
if (me.refreshSizeStateOnInitialized) {
me.refreshSizeState();
| 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 {
| javascript | {
"resource": ""
} |
|
q65172 | test | function(animation) {
this.setCurrentAlignmentInfo(null);
/*
if(this.activeAnimation) {
this.activeAnimation.on({
animationend: function(){
this.hide(animation);
},
scope: this,
single: true
});
return this;
}
*/
if (!this.getHidden()) {
| javascript | {
"resource": ""
} |
|
q65173 | test | function(animation) {
if(this.activeAnimation) {
this.activeAnimation.on({
animationend: function(){
this.show(animation);
},
scope: this,
single: true
});
return this;
}
var hidden = this.getHidden();
if (hidden || hidden === null) {
if (animation === true) {
animation = 'fadeIn';
}
else if (animation === undefined || (animation && animation.isComponent)) {
| javascript | {
"resource": ""
} |
|
q65174 | test | function(width, height) {
if (width != undefined) {
this.setWidth(width);
}
if | 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',
destroy: 'onShowByErased',
single: true,
| 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,
alignment: alignment,
top: alignToBox.top,
left: alignToBox.left,
alignToWidth: alignToBox.width,
alignToHeight: alignToBox.height,
width: box.width,
height: box.height
},
| javascript | {
"resource": ""
} |
|
q65177 | test | function(alignmentInfo) {
this.$currentAlignmentInfo = Ext.isEmpty(alignmentInfo) ? null : Ext.merge({}, | javascript | {
"resource": ""
} |
|
q65178 | test | function(selector) {
var result = this.parent;
if (selector) {
for (; result; result = result.parent) {
if (Ext.ComponentQuery.is(result, selector)) {
| 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 container if it's currently contained
if (parent) {
parent.remove(this, false);
}
// Destroy all element references
for (i = 0, ln = referenceList.length; i < ln; i++) {
| 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, | javascript | {
"resource": ""
} |
|
q65181 | test | function () {
var me = this,
node = me.getLastNode(),
detailCard = me.getDetailCard(),
detailCardActive = detailCard && me.getActiveItem() == detailCard,
| 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 = me.getLayout(),
animation = (layout) ? layout.getAnimation() : false;
if (card) {
if (container.getItems().indexOf(card) === -1) {
container.add(card);
}
| 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 === 'ExportNamedDeclaration') {
if (!!line.declaration &&
line.declaration.type === 'FunctionDeclaration') {
| javascript | {
"resource": ""
} |
q65184 | parseVehicleID | test | function parseVehicleID($, item) {
let fields = $(item).find('td');
let id | javascript | {
"resource": ""
} |
q65185 | formatDetails | test | function formatDetails(details) {
let result = {
results: details,
count: details.length,
| 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');
let key = $(span).attr('id').replace('ctl00_Application_lbl', '').toLowerCase();
| 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: {
| 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` to work.');
return false;
}
Ext.device.Communicator.send({
command: 'Purchase#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 `failure` callback for `#complete` to work.');
return false;
}
if (this.get('state') != 'charged') {
config.failure.call(config.scope || this, 'purchase is not charged');
| 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;
}
| 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;
| 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', | javascript | {
"resource": ""
} |
|
q65193 | test | function() {
var values = [];
this.getSameGroupFields().forEach(function(field) {
| javascript | {
"resource": ""
} |
|
q65194 | test | function(values) {
this.getSameGroupFields().forEach(function(field) {
| javascript | {
"resource": ""
} |
|
q65195 | test | function() {
var me = this,
container = me.container;
if (!me.getStore()) {
if (!me.hasLoadedStore && !me.getDeferEmptyText()) {
me.showEmptyText();
}
| javascript | {
"resource": ""
} |
|
q65196 | processParams | test | function processParams(paramsString) {
var individualParams = paramsString.split("&"),
resultObject = {};
individualParams.forEach(function(item) {
var itemParts = item.split("="), | 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 {
| 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 (filter !== null && filter !== undefined) {
if (typeof filter === 'object') {
keys = Object.keys(filter);
klen = keys.length;
for (i = 0, ilen = this.items.length; i < ilen; ++i) {
item = this.items[i];
found = true;
for (k = 0; k < klen && found; ++k) {
key = keys[k];
if (filter[key] !== item[key]) {
found = false;
}
}
if (found) {
return item;
}
}
} else if (this.modelType) {
keys = Object.keys(this.modelType.attributes);
klen = keys.length;
for (i = 0, ilen = this.items.length; i < ilen; ++i) {
item = this.items[i];
found = false;
| javascript | {
"resource": ""
} |