_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q65000 | test | function (expected, expectedIndex, value) {
var i = expectedIndex - 1;
var matchingRequires = 0
while (i >= 0) {
if (!isOptionalType(expected[i]) && isOfType(value, expected[i])) {
matchingRequires++;
}
i--;
}
return matchingRequires;
} | javascript | {
"resource": ""
} | |
q65001 | test | function (expected, actual) {
var argNames = [];
var expectedNames = [];
for (var i = 0; i < actual.length; i++) {
argNames.push(getNameForValue(actual[i]));
};
for (var i = 0; i < expected.length; i++) {
expectedNames.push(getNameForType(expected[i]));
};
return 'Expected arguments to ... | javascript | {
"resource": ""
} | |
q65002 | test | function (value, type) {
if (!isValidType(type)) {
throw Error('Invalid type supplied.');
}
if (!isOfType(value, type)) {
argName = getNameForValue(value);
typeName = getNameForType(type);
throw Error('Expected ' + argName + ' to be an instance of ' + typeName + '.');
}
} | javascript | {
"resource": ""
} | |
q65003 | test | function (type) {
if (type === null) return true;
if (type === undefined) return true;
if (type instanceof AnyType) return true;
if (type instanceof Array) {
// An array is only valid if it contains one or more valid types.
if (!type.length) return false;
for (var i = 0; i < type.length; i... | javascript | {
"resource": ""
} | |
q65004 | test | function (value) {
if (value === undefined) return 'undefined';
if (value === null) return 'null';
// Look inside the array to determine the inner type.
if (value instanceof Array) {
if (!value.length) return 'Array(empty)';
var innerType = undefined;
for (var i = 0; i < value.length; i++... | javascript | {
"resource": ""
} | |
q65005 | test | function (type) {
if (type === undefined) return 'undefined';
if (type === null) return 'null';
// Create a list of all the possible types.
if (type instanceof Array) {
if (!type.length) return 'None';
var possibleTypes = [];
for (var i = 0; i < type.length; i++) {
possibleTypes.... | javascript | {
"resource": ""
} | |
q65006 | test | function(request) {
var me = this,
url = me.callParent(arguments),
params = Ext.apply({}, request.getParams()),
filters = params.filters,
filter, i, value;
delete params.filters;
if (me.getAutoAppendParams()) {
url = Ext.url... | javascript | {
"resource": ""
} | |
q65007 | getStateFromOptions | test | function getStateFromOptions (options, propertyName) {
propertyName = propertyName || 'state';
const stateName = options[propertyName] || options.resource.defaultState;
let stateObj = options.resource.states[stateName] || {validate: false};
stateObj.name = stateName;
return stateObj;
} | javascript | {
"resource": ""
} |
q65008 | validate | test | function validate (resource, doc, doValidate) {
return new Promise((resolve, reject) => {
if (doValidate !== true) {
return resolve();
}
if (resource.validate(doc)) {
return resolve();
} else {
debug('model have %d error(s)', resource.validate.errors.length);
return reject(reso... | javascript | {
"resource": ""
} |
q65009 | prune | test | function prune(str, max, nice, suf) {
max = max || 140
nice = _.isBoolean(nice) ? nice : false
if (!str || max <= 0 || str.length <= max) return str
suf = suf || "..."
str = str.substr(0, max)
return nice ? str.substr(0, Math.min(str.length, str.lastIndexOf(" "))) + suf : str
} | javascript | {
"resource": ""
} |
q65010 | attemptRender | test | function attemptRender(reporter, filename, src, resolve, reject, globals) {
globals = globals || {};
less.render(src, {
// Specify search paths for @import directives
paths : [
"public/static/less"
],
// Specify a filename, for better error messages
filename : filename,
modifyVars : globals,
compress... | javascript | {
"resource": ""
} |
q65011 | validateArray | test | function validateArray(indexes) {
var valid = false;
if (typeof indexes === 'string') {
if (indexes.match(TYPE_ARRAY_REGEX)) {
valid = true;
}
}
return valid;
} | javascript | {
"resource": ""
} |
q65012 | addRoutes | test | function addRoutes( pies, pie, routes, app ) {
// Add the GET routes
if ( 'get' in routes ) {
routes.get.forEach( function( route ) {
Object.keys( route ).forEach( function( r ) {
var middlewares = true;
if ( typeof route[ r ] === 'string' ) {
... | javascript | {
"resource": ""
} |
q65013 | generateUUID | test | function generateUUID() {
let dat = new Date().getTime();
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (cha) => {
const ran = (dat + (Math.random() * 16)) % 16 | 0;
dat = Math.floor(dat / 16);
return (cha === 'x' ? ran : ran & 0x3 | 0x8).toString(16);
});
} | javascript | {
"resource": ""
} |
q65014 | randomString | test | function randomString(length, charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
let str = '',
isAllNumeric = false,
isNegative = false,
useCharSet = charSet;
if (+length) {
if (!isString(charSet)) {
if (isNumber(charSet)) {
... | javascript | {
"resource": ""
} |
q65015 | toUint | test | function toUint(str) {
const string = window.btoa(unescape(encodeURIComponent(str))),
chars = string.split(''),
len = chars.length,
uintArray = [];
Array(len).fill().forEach((val, i) => uintArray.push(chars[i].charCodeAt(0)));
return new Uint8Array(uintArray);
} | javascript | {
"resource": ""
} |
q65016 | toArrayBuffer | test | function toArrayBuffer(str) {
/* eslint no-bitwise: "off" */
const len = isString(str) ? str.length : 0,
buf = new ArrayBuffer(len),
view = new Uint8Array(buf);
Array(len).fill().forEach((val, i) => (view[i] = str.charCodeAt(i) & 0xFF));
return view;
} | javascript | {
"resource": ""
} |
q65017 | test | function() {
if (!this.$backButtonContainer) {
return;
}
var i = 0,
backButtonContainer = this.$backButtonContainer,
items = backButtonContainer.items,
item;
for(;i < items.length; i++) {
item = items.get(i);
if(!it... | javascript | {
"resource": ""
} | |
q65018 | test | function(message, priority, callerId) {
if (!this.getEnabled()) {
return this;
}
var statics = Logger,
priorities = statics.priorities,
priorityValue = priorities[priority],
caller = this.log.caller,
callerDisplayName = '',
... | javascript | {
"resource": ""
} | |
q65019 | copyFileSync | test | function copyFileSync(source, destination) {
if (validateFileSync(source)) {
fs.writeFileSync(destination, fs.readFileSync(source));
}
} | javascript | {
"resource": ""
} |
q65020 | copyFilesMatchSync | test | function copyFilesMatchSync(match, source, destination) {
fs.readdirSync(source).forEach(function eachTemplate(filename) {
var sourceFile = path.join(source, filename);
var destinationFile = path.join(destination, filename);
if (match.test(path.basename(filename))) {
fs.writeFileSync(destinationFile... | javascript | {
"resource": ""
} |
q65021 | replaceMatchFilesSync | test | function replaceMatchFilesSync(match, source, destination) {
unlinkFilesMatchSync(match, destination);
copyFilesMatchSync(match, source, destination);
} | javascript | {
"resource": ""
} |
q65022 | unlinkFilesMatchSync | test | function unlinkFilesMatchSync(match, location) {
fs.readdirSync(location).forEach(function eachTemplate(filename) {
if (match.test(path.basename(filename))) {
var filePath = path.join(location, filename);
if (validateFileSync(filePath)) {
fs.unlinkSync(filePath);
}
}
});
} | javascript | {
"resource": ""
} |
q65023 | validateDirectorySync | test | function validateDirectorySync(path, errorMessage) {
errorMessage = errorMessage || 'Error validateDirectorySync() the directory path is not valid ' + path;
var isValid = existsDirectorySync(path);
if (!isValid) {
console.error(errorMessage);
}
return isValid;
} | javascript | {
"resource": ""
} |
q65024 | validateFileSync | test | function validateFileSync(path, errorMessage) {
errorMessage = errorMessage || 'Error validateFileSync() the file path is not valid ' + path;
var isValid = existsFileSync(path);
if (!isValid) {
console.error(errorMessage);
}
return isValid;
} | javascript | {
"resource": ""
} |
q65025 | subDirectoriesWithFile | test | function subDirectoriesWithFile(base, filename) {
var result = [];
if (fs.existsSync(base) && fs.statSync(base).isDirectory()) {
if (fs.existsSync(path.join(base, filename))) {
result.push(base);
}
fs.readdirSync(base)
.forEach(function (subdir) {
result.push.apply(result, subDirecto... | javascript | {
"resource": ""
} |
q65026 | maximisePath | test | function maximisePath() {
// Ensure each element in the path exists,
// where it is a regex, match it and replace the element with a string
var elements = Array.prototype.slice.call(arguments);
for (var i = 1; i < elements.length; i++) {
// the directory is elements 0 .. i-1 joined
var directory = path... | javascript | {
"resource": ""
} |
q65027 | resolveDirMatches | test | function resolveDirMatches(directory, match) {
if (validateDirectorySync(directory)) {
return fs.readdirSync(directory)
.filter(function eachDirectoryItem(item) {
var resolved = path.resolve(path.join(directory, item));
return match.test(item) && fs.statSync(resolved).isDirectory();
})... | javascript | {
"resource": ""
} |
q65028 | compareHigher | test | function compareHigher(a, b) {
var numA = parseFloat(/[\d\.]+$/.exec(a)[0]);
var numB = parseFloat(/[\d\.]+$/.exec(b)[0]);
if (isNaN(numA) || (numB > numA)) {
return +1;
} else if (isNaN(numB) || (numA > numB)) {
return -1;
} else {
return 0;
}
} | javascript | {
"resource": ""
} |
q65029 | reduceDirectories | test | function reduceDirectories() {
return Array.prototype.slice.call(arguments)
.map(function (candidate) {
return path.normalize(candidate);
})
.filter(function (candidate) {
return fs.existsSync(candidate) && fs.statSync(candidate).isDirectory();
})
.shift();
} | javascript | {
"resource": ""
} |
q65030 | test | function(side) {
var menus = this.getMenus() || {},
menu = menus[side];
if(menu) this.hideMenu(side);
delete menus[side];
this.setMenus(menus);
} | javascript | {
"resource": ""
} | |
q65031 | test | function(side) {
var menus = this.getMenus(),
menu = menus[side],
before, after,
viewportBefore, viewportAfter;
if (!menu || menu.isAnimating) {
return;
}
this.hideOtherMenus(side);
before = {
translateX: 0,
... | javascript | {
"resource": ""
} | |
q65032 | test | function(side, animate) {
var menus = this.getMenus(),
menu = menus[side],
after, viewportAfter,
size;
animate = (animate === false) ? false : true;
if (!menu || (menu.isHidden() || menu.isAnimating)) {
return;
}
after = {
... | javascript | {
"resource": ""
} | |
q65033 | test | function(side, animation){
var menus = this.getMenus();
for (var menu in menus) {
if (side != menu) {
this.hideMenu(menu, animation);
}
}
} | javascript | {
"resource": ""
} | |
q65034 | test | function(side) {
var menus = this.getMenus(), menu;
if (menus[side]) {
menu = menus[side];
if (menu.isHidden()) {
this.showMenu(side);
} else {
this.hideMenu(side);
}
}
} | javascript | {
"resource": ""
} | |
q65035 | init | test | function init(adapter, config) {
if (!fs) {
var Adapter = require('./adapters/' + adapter);
fs = new Adapter(config);
}
} | javascript | {
"resource": ""
} |
q65036 | getHierarchy | test | function getHierarchy(cb) {
getConfig(function (err, config) {
if (err) {
cb(err);
return;
}
cb(null, config[':hierarchy']);
});
} | javascript | {
"resource": ""
} |
q65037 | getBackends | test | function getBackends(cb) {
getConfig(function (err, config) {
if (err) {
cb(err);
return;
}
cb(null, config[':backends']);
});
} | javascript | {
"resource": ""
} |
q65038 | getBackendConfig | test | function getBackendConfig(backend, cb) {
getConfig(function (err, config) {
if (err) {
cb(err);
return;
}
cb(null, config[':' + backend]);
});
} | javascript | {
"resource": ""
} |
q65039 | getFile | test | function getFile(backend, file, cb) {
getBackendConfig(backend, function (err, config) {
file = [ config[':datadir'], '/', file ].join('');
fs.readFile(file, cb);
});
} | javascript | {
"resource": ""
} |
q65040 | saveFile | test | function saveFile(backend, file, data, cb) {
cb = typeof(cb) === 'function' ? cb : function () {};
getBackendConfig(backend, function (err, config) {
var datadir = config[':datadir'];
file = path.join(datadir, file);
fs.writeFile(file, data, cb);
});
} | javascript | {
"resource": ""
} |
q65041 | getOverrides | test | function getOverrides(backend, file, cb) {
async.parallel([
function hierarchy(cb) {
getHierarchy(cb);
},
function backendConfig(cb) {
getBackendConfig(backend, cb);
}
], function (err, results) {
var hierarchy, datadir, filename, tasks,
pos, searchHierarchy, tasks;
hie... | javascript | {
"resource": ""
} |
q65042 | done | test | function done(result, callback) {
if (!_.isFunction(callback)) return
process.nextTick(function () { callback(null, result) })
} | javascript | {
"resource": ""
} |
q65043 | fail | test | function fail(err, callback) {
if (!_.isFunction(callback)) return
let uError = new Error('Unknown Error')
err = err ? _.isError(err) ? err : _.isString(err) ? new Error(err) : uError : uError
process.nextTick(function () { callback(err) })
} | javascript | {
"resource": ""
} |
q65044 | test | function(data) {
var fieldsCollection = this.getModel().getFields();
/*
* We check here whether the fields are dirty since the last read.
* This works around an issue when a Model is used for both a Tree and another
* source, because the tree decorates the model with extra fi... | javascript | {
"resource": ""
} | |
q65045 | arrIncludes | test | function arrIncludes (arr, values) {
if (!Array.isArray(values)) { return inArray(arr, values) }
var len = values.length;
var i = -1;
while (i++ < len) {
var j = inArray(arr, values[i]);
if (j) {
return j
}
}
return false
} | javascript | {
"resource": ""
} |
q65046 | clean | test | function clean(src) {
let pidx = src.indexOf('http')
if(pidx > 0) src = src.substr(pidx)
return src ? pidx >= 0 || src.indexOf('//') >= 0 ? src : '/' + src : ''
} | javascript | {
"resource": ""
} |
q65047 | jquery | test | function jquery(src) {
src = clean(src);
let params = {}
let match = null
if (!url || !_.isString(src)) return params
while (match = REGX_QUERY_OBJECT.exec(src)) { params[match[1]] = match[2] }
return params
} | javascript | {
"resource": ""
} |
q65048 | test | function (el, options) {
events.EventEmitter.call(this);
this.el = el;
this.options = extend({}, this.options);
extend(this.options, options);
this.showTab = this._show;
this._init();
} | javascript | {
"resource": ""
} | |
q65049 | toParam | test | function toParam(obj, dontEncode) {
const arr = [];
let vals;
if (isObject(obj) && !isArray(obj)) {
Object.keys(obj).forEach((val) => {
if (isArray(obj[val])) {
vals = `[${
obj[val].map(v => (isNaN(v) ? `"${v}"` : v)).join(',')
}]`;
... | javascript | {
"resource": ""
} |
q65050 | test | function(anchor, local, size) {
//<debug warn>
Ext.Logger.deprecate("getAnchorXY() is no longer available for Ext.Element. Please see Ext.Component#showBy() " +
"to do anchoring at Component level instead", this);
//</debug>
//Passing a different size is useful for pre-calcu... | javascript | {
"resource": ""
} | |
q65051 | test | function(fn, scope){
var items = [].concat(this.items), // each safe for removal
i = 0,
len = items.length,
item;
for (; i < len; i++) {
item = items[i];
if (fn.call(scope || item, item, i, len) === false) {
break;
... | javascript | {
"resource": ""
} | |
q65052 | test | function(config) {
if (config.path == null) {
Ext.Logger.error('Ext.device.filesystem.DirectoryEntry#getFile: You must specify a `path` of the file.');
return null;
}
if (config.options == null) {
config.options... | javascript | {
"resource": ""
} | |
q65053 | toHaveText | test | function toHaveText() {
return {
compare: function compare(element, text) {
var regexp = text instanceof RegExp ? text : new RegExp(text, 'ig');
var pass = element.getDOMNode().textContent.match(regexp);
var message = pass ? 'Text "' + text + '" is found within an element' : ... | javascript | {
"resource": ""
} |
q65054 | test | function() {
var me = this,
container = me.container,
baseCls = me.getBaseCls(),
scrollable, scrollViewElement, pinnedHeader;
Ext.apply(me, {
listItems: [],
headerItems: [],
updatedItems: [],
headerMap: [],
... | javascript | {
"resource": ""
} | |
q65055 | test | function() {
var me = this,
container = me.container,
scrollViewElement = me.scrollViewElement,
indexBar = me.getIndexBar(),
triggerEvent = me.getTriggerEvent(),
triggerCtEvent = me.getTriggerCtEvent();
if (indexBar) {
scrollViewEl... | javascript | {
"resource": ""
} | |
q65056 | test | function(index) {
var listItems = this.listItems,
ln = listItems.length,
i, listItem;
for (i = 0; i < ln; i++) {
listItem = listItems[i];
if (listItem.$dataIndex == index) {
return listItem;
}
}
} | javascript | {
"resource": ""
} | |
q65057 | test | function(url, onLoad, onError, scope, charset) {
var script = document.createElement('script'),
me = this,
onLoadFn = function() {
me.cleanupScriptElement(script);
onLoad.call(scope);
},
onErrorFn = funct... | javascript | {
"resource": ""
} | |
q65058 | test | function(url, onLoad, onError, scope, synchronous) {
var me = this,
isFileLoaded = this.isFileLoaded,
scriptElements = this.scriptElements,
noCacheUrl = url + (this.getConfig('disableCaching') ? ('?' + this.getConfig('disableCachingParam') + '=' + Ext.Date.now... | javascript | {
"resource": ""
} | |
q65059 | test | async function (fname, attrs) {
let partialDirs;
if (typeof module.exports.configuration.partialDirs === 'undefined'
|| !module.exports.configuration.partialDirs
|| module.exports.configuration.partialDirs.length <= 0) {
partialDirs = [ __dirname ];
} els... | javascript | {
"resource": ""
} | |
q65060 | test | function (record) {
var me = this,
fields = record.getFields(),
idProperty = record.getIdProperty(),
uniqueIdStrategy = me.getUniqueIdStrategy(),
data = {},
name, value;
fields.each(function (field) {
if (field.getPersist()) {
... | javascript | {
"resource": ""
} | |
q65061 | test | function(provider) {
var me = this,
args = Ext.toArray(arguments),
i = 0, ln;
if (args.length > 1) {
for (ln = args.length; i < ln; ++i) {
me.addProvider(args[i]);
}
return;
}
// if provider has not already bee... | javascript | {
"resource": ""
} | |
q65062 | test | function(provider) {
var me = this,
providers = me.providers;
provider = provider.isProvider ? provider : providers.get(provider);
if (provider) {
provider.un('data', me.onProviderData, me);
providers.remove(provider);
return provider;
}
... | javascript | {
"resource": ""
} | |
q65063 | test | function(config) {
config = config || {};
Ext.applyIf(config, {
application: this
});
this.initConfig(config);
//it's common to pass in functions to an application but because they are not predictable config names they
//aren't ordinarily placed onto this s... | javascript | {
"resource": ""
} | |
q65064 | test | function(name, profileName) {
var instances = this.getControllerInstances(),
appName = this.getName(),
format = Ext.String.format,
topLevelName;
if (name instanceof Ext.app.Controller) {
return name;
}
if (instances[name]) {
... | javascript | {
"resource": ""
} | |
q65065 | test | function() {
delete this.onItemAdd;
if (this.innerHtmlElement && !this.getHtml()) {
this.innerHtmlElement.destroy();
delete this.innerHtmlElement;
}
this.on('innerstatechange', 'onItemInnerStateChange', this, {
delegate: '> component'
});
... | javascript | {
"resource": ""
} | |
q65066 | test | function(item, destroy) {
var me = this,
index = me.indexOf(item),
innerItems = me.getInnerItems();
if (destroy === undefined) {
destroy = me.getAutoDestroy();
}
if (index !== -1) {
if (!me.removingAll && innerItems.length > 1 && item ===... | javascript | {
"resource": ""
} | |
q65067 | test | function(destroy, everything) {
var items = this.items,
ln = items.length,
i = 0,
item;
if (typeof destroy != 'boolean') {
destroy = this.getAutoDestroy();
}
everything = Boolean(everything);
// removingAll flag is used so we don... | javascript | {
"resource": ""
} | |
q65068 | test | function(activeItem, animation) {
var layout = this.getLayout(),
defaultAnimation;
if (this.activeItemAnimation) {
this.activeItemAnimation.destroy();
}
this.activeItemAnimation = animation = new Ext.fx.layout.Card(animation);
if (animation && layout.isCa... | javascript | {
"resource": ""
} | |
q65069 | test | function(deep) {
var items = this.getItems().items.slice(),
ln = items.length,
i, item;
if (deep) {
for (i = 0; i < ln; i++) {
item = items[i];
if (item.getRefItems) {
items = items.concat(item.getRefItems(true));
... | javascript | {
"resource": ""
} | |
q65070 | test | function(e) {
var srcElement = e.srcElement.nodeName.toUpperCase(),
selectableElements = ['INPUT', 'TEXTAREA'];
if (selectableElements.indexOf(srcElement) == -1) {
return false;
}
} | javascript | {
"resource": ""
} | |
q65071 | test | function(number, min, max) {
number = parseFloat(number);
if (!isNaN(min)) {
number = Math.max(number, min);
}
if (!isNaN(max)) {
number = Math.min(number, max);
}
return number;
} | javascript | {
"resource": ""
} | |
q65072 | test | function(value, increment, minValue, maxValue) {
var newValue = value,
m;
if (!(increment && value)) {
return value;
}
m = value % increment;
if (m !== 0) {
newValue -= m;
if (m * 2 >= increment) {
newValue += incre... | javascript | {
"resource": ""
} | |
q65073 | test | function(value, precision) {
if (isToFixedBroken) {
precision = precision || 0;
var pow = Math.pow(10, precision);
return (Math.round(value * pow) / pow).toFixed(precision);
}
return value.toFixed(precision);
} | javascript | {
"resource": ""
} | |
q65074 | logger | test | function logger(req, res, next) {
if (req.url.substr(0, 2) === "/r") {
console.log(req.method, decodeURIComponent(req.url), req.body ? JSON.stringify(req.body) : "");
}
next();
} | javascript | {
"resource": ""
} |
q65075 | typeConvert | test | function typeConvert(obj, onlyDate) {
var i, res;
if (typeof obj === "object") {
for (i in obj) {
if (obj.hasOwnProperty(i)) {
obj[i] = typeConvert(obj[i], onlyDate);
}
}
} else if (typeof obj === "string") {
if (!onlyDate && obj.match(/^([0-9.]+|true|false|undefined|null)$/)) {
... | javascript | {
"resource": ""
} |
q65076 | typeConvertMiddleware | test | function typeConvertMiddleware(req, res, next) {
typeConvert(req.params);
typeConvert(req.body, true);
next();
} | javascript | {
"resource": ""
} |
q65077 | defineRoute | test | function defineRoute(method, route, handler) {
server[method](route, function (req, res) {
var store = stores.get(req.params.resource);
delete req.params.resource;
handler(req, store, function (error, docs) {
if (error) {
res.status(500);
res.end(error);
} else ... | javascript | {
"resource": ""
} |
q65078 | routeURL | test | function routeURL() {
var prefix = options.prefix || "",
args = ["/" + prefix, ":resource"].concat(Array.prototype.slice.call(arguments));
return path.join.apply(path, args);
} | javascript | {
"resource": ""
} |
q65079 | createPasswordHash | test | function createPasswordHash(object) {
if (!object) return object;
var password = object.password;
if (password) {
delete object.password;
object.passwordSalt = sha1(Math.random().toString());
object.passwordHash = sha1("restify-magic" + object.passwordSalt + password);
}
return obj... | javascript | {
"resource": ""
} |
q65080 | test | function( json, typeSpecification, array ) {
var keys,
current = json,
nested = [],
nestedKeys = [],
levels = [],
query = 'COLUMN_CREATE(',
root = true,
curNest = '',
curItem,
item = 0,
level = 0;
while( curr... | javascript | {
"resource": ""
} | |
q65081 | test | function(node) {
if (Ext.isObject(node) && !node.isModel) {
node = Ext.data.ModelManager.create(node, this.modelName);
}
// Make sure the node implements the node interface
return Ext.data.NodeInterface.decorate(node... | javascript | {
"resource": ""
} | |
q65082 | test | function(silent) {
var me = this,
parentNode = me.parentNode,
isFirst = (!parentNode ? true : parentNode.firstChild == me),
isLast = (!parentNode ? true : parentNode.lastChild == me),
depth = 0,
... | javascript | {
"resource": ""
} | |
q65083 | test | function(node, destroy, suppressEvents, suppressNodeUpdate) {
var me = this,
index = me.indexOf(node);
if (index == -1 || (suppressEvents !== true && me.fireEvent("beforeremove", me, node) === false)) {
return false;
... | javascript | {
"resource": ""
} | |
q65084 | test | function(destroy) {
var me = this;
// clear any references from the node
me.parentNode = me.previousSibling = me.nextSibling = null;
if (destroy) {
me.firstChild = me.lastChild = null;
}
... | javascript | {
"resource": ""
} | |
q65085 | test | function(silent) {
/*
* Silent is to be used in a number of cases
* 1) When setRoot is called.
* 2) When destroy on the tree is called
* 3) For destroying child nodes on a node
*/
... | javascript | {
"resource": ""
} | |
q65086 | test | function(node, refNode, suppressEvents) {
var me = this,
index = me.indexOf(refNode),
oldParent = node.parentNode,
refIndex = index,
ps;
if (!refNode) { // like standard Dom, ref... | javascript | {
"resource": ""
} | |
q65087 | test | function(destroy, suppressEvents) {
var parentNode = this.parentNode;
if (parentNode) {
parentNode.removeChild(this, destroy, suppressEvents, true);
}
return this;
} | javascript | {
"resource": ""
} | |
q65088 | test | function(destroy, suppressEvents) {
var cn = this.childNodes,
n;
while ((n = cn[0])) {
this.removeChild(n, destroy, suppressEvents);
}
return this;
} | javascript | {
"resource": ""
} | |
q65089 | test | function(sortFn, recursive, suppressEvent) {
var cs = this.childNodes,
ln = cs.length,
i, n;
if (ln > 0) {
Ext.Array.sort(cs, sortFn);
for (i = 0; i < ln; i++) {
... | javascript | {
"resource": ""
} | |
q65090 | test | function(recursive, callback, scope) {
var me = this;
if (!me.isLeaf()) {
if (me.isLoading()) {
me.on('expand', function() {
me.expand(recursive, callback, scope);
}, ... | javascript | {
"resource": ""
} | |
q65091 | test | function(recursive, callback, scope) {
var me = this;
// First we start by checking if this node is a parent
if (!me.isLeaf() && me.isExpanded()) {
this.fireAction('collapse', [me], function() {
me.set('expa... | javascript | {
"resource": ""
} | |
q65092 | test | function (nextTargetFn, fnOpt) {
tail.next = {
fns: [nextTargetFn],
opts: [fnOpt]
};
tail = tail.next;
dispatch();
return controller;
} | javascript | {
"resource": ""
} | |
q65093 | test | function() {
var mask = Ext.getBody().createChild({
cls: Ext.baseCSSPrefix + 'mask ' + Ext.baseCSSPrefix + 'mask-transparent'
});
setTimeout(function() {
mask.destroy();
}, 0);
} | javascript | {
"resource": ""
} | |
q65094 | test | function(el, prefix) {
if (el && el.id) {
return el.id;
}
el = Ext.getDom(el) || {};
if (el === document || el === document.documentElement) {
el.id = 'ext-app';
}
else if (el === document.body) {
el.id = 'ext-body';
}
... | javascript | {
"resource": ""
} | |
q65095 | test | function(dest, source, names, usePrototypeKeys) {
if (typeof names == 'string') {
names = names.split(/[,;\s]/);
}
Ext.each (names, function(name) {
if (usePrototypeKeys || source.hasOwnProperty(name)) {
dest[name] = source[name];
}
}, ... | javascript | {
"resource": ""
} | |
q65096 | test | function(node) {
if (node && node.parentNode && node.tagName != 'BODY') {
Ext.get(node).clearListeners();
node.parentNode.removeChild(node);
delete Ext.cache[node.id];
}
} | javascript | {
"resource": ""
} | |
q65097 | addAction | test | function addAction(name, fn) {
if (typeof name === "object" && fn == null) {
_.each(name, function(fn, n) { this.addAction(n, fn); }, this);
return this;
}
if (typeof name !== "string" || name === "") throw new Error("Expecting non-empty string for action name.");
if (typeof fn !== "function") throw new Error(... | javascript | {
"resource": ""
} |
q65098 | test | function(property, obj, newProperty) {
if (config.hasOwnProperty(property)) {
if (obj) {
config[obj] = config[obj] || {};
config[obj][(newProperty) ? newProperty : property] = config[obj][(newProperty) ? newProperty : property] || confi... | javascript | {
"resource": ""
} | |
q65099 | Store | test | function Store(name, items) {
if (!name) {
throw new Error('Please give the store a name!');
}
this.name = name;
this.items = items || {};
this.type = 'object';
this.setType();
return this;
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.