_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q54400 | hasPipeDataListeners | train | function hasPipeDataListeners (stream) {
var listeners = stream.listeners('data')
for (var i = 0; i < listeners.length; i++) {
if (listeners[i].name === 'ondata') {
return true
}
}
return false
} | javascript | {
"resource": ""
} |
q54401 | unpipe | train | function unpipe (stream) {
if (!stream) {
throw new TypeError('argument stream is required')
}
if (typeof stream.unpipe === 'function') {
// new-style
stream.unpipe()
return
}
// Node.js 0.8 hack
if (!hasPipeDataListeners(stream)) {
return
}
var listener
var listeners = stream.l... | javascript | {
"resource": ""
} |
q54402 | makeStatsD | train | function makeStatsD(options, logger) {
let statsd;
const srvName = options._prefix ? options._prefix : normalizeName(options.name);
const statsdOptions = {
host: options.host,
port: options.port,
prefix: `${srvName}.`,
suffix: '',
globalize: false,
cacheDns: f... | javascript | {
"resource": ""
} |
q54403 | promisedSpawn | train | function promisedSpawn(args, options) {
options = options || {};
let promise = new P((resolve, reject) => {
const argOpts = options.capture ? undefined : { stdio: 'inherit' };
let ret = '';
let err = '';
if (opts.verbose) {
console.log(`# RUNNING: ${args.join(' ')}\... | javascript | {
"resource": ""
} |
q54404 | startContainer | train | function startContainer(args, hidePorts) {
const cmd = ['docker', 'run', '--name', name, '--rm'];
// add the extra args as well
if (args && Array.isArray(args)) {
Array.prototype.push.apply(cmd, args);
}
if (!hidePorts) {
// list all of the ports defined in the config file
... | javascript | {
"resource": ""
} |
q54405 | getUid | train | function getUid() {
if (opts.deploy) {
// get the deploy repo location
return promisedSpawn(
['git', 'config', 'deploy.dir'],
{
capture: true,
errMessage: 'You must set the location of the deploy repo!\n' +
'Use git config ... | javascript | {
"resource": ""
} |
q54406 | setLocalStorage | train | function setLocalStorage(optOutState) {
if (!(localStorage && localStorage.setItem)) {
return null;
}
if (typeof optOutState !== 'boolean') {
console.warn('setCookie for outOut invalid param optOutState. Param must be boolean');
return null;
}
try {
localStorage.setItem(disableStr, optOutSta... | javascript | {
"resource": ""
} |
q54407 | getLocalStorage | train | function getLocalStorage() {
if (!(localStorage && localStorage.getItem)) {
return null;
}
let state = localStorage.getItem(disableStr);
if (state === 'false') {
state = false;
} else if (state === 'true') {
state = true;
}
return state;
} | javascript | {
"resource": ""
} |
q54408 | setCookie | train | function setCookie(optOutState) {
switch (optOutState) {
case true:
document.cookie = `${disableStr}=true; expires=Thu, 18 Jan 2038 03:13:59 UTC; path=/`;
window[disableStr] = true;
break;
case false:
document.cookie = `${disableStr}=false; expires=Thu, 01 Jan 1970 00:00:01 UTC; path=... | javascript | {
"resource": ""
} |
q54409 | setOptOut | train | function setOptOut(optOutParam) {
window[disableStr] = optOutParam;
setCookie(optOutParam);
setLocalStorage(optOutParam);
return optOutParam;
} | javascript | {
"resource": ""
} |
q54410 | getCookie | train | function getCookie() {
if (document.cookie.indexOf(`${disableStr}=true`) > -1) {
return true;
} else if (document.cookie.indexOf(`${disableStr}=false`) > -1) {
return false;
}
return null;
} | javascript | {
"resource": ""
} |
q54411 | isOptOut | train | function isOptOut() {
// Check cookie first
let optOutState = getCookie();
// No cookie info, check localStorage
if (optOutState === null) {
optOutState = getLocalStorage();
}
// No localStorage, we get default value
if (optOutState === null || typeof optOutState === 'undefined') {
optOutState =... | javascript | {
"resource": ""
} |
q54412 | getInitialState | train | function getInitialState() {
if (!window.localStorage) {
return undefined;
}
const storedState = window.localStorage.getItem(storeKey);
if (!storedState) {
return undefined;
}
const normalisedState = storedState.replace(new RegExp('"isFetching":true', 'g'), '"isFetching":false');
return JSON.pa... | javascript | {
"resource": ""
} |
q54413 | parseVersion | train | function parseVersion(v) {
const [
, // Full match of no interest.
major = null,
sub = null,
minor = null,
] = /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-.*)?$/.exec(v);
if (major === null || sub === null || minor === null) {
const err = new Error(`Invalid version string (${v})!`);... | javascript | {
"resource": ""
} |
q54414 | run | train | async function run() {
try {
// Find last release: Get tags, filter out wrong tags and pre-releases, then take last one.
const { stdout } = // get last filtered tag, sorted by version numbers in ascending order
await exec(`git tag | grep '${tagFrom}' | grep -Ev '-' | sort -V | tail -1`);
const prevT... | javascript | {
"resource": ""
} |
q54415 | synchRepo | train | async function synchRepo(remote, pathname) {
const cmd = `git subtree push --prefix=${pathname} ${remote} master`;
try {
await exec(cmd);
logger.log(`Synched master of ${pathname}`);
} catch (error) {
throw error;
}
} | javascript | {
"resource": ""
} |
q54416 | product | train | function product(subscribe) {
const processProduct$ = productReceived$.merge(cachedProductReceived$);
subscribe(productWillEnter$, ({ action, dispatch }) => {
const { productId } = action.route.params;
const { productId: variantId } = action.route.state;
const id = variantId || hex2bin(productId);
... | javascript | {
"resource": ""
} |
q54417 | sgTrackingUrlMapper | train | function sgTrackingUrlMapper(url, data) {
// In our development system urls start with /php/shopgate/ always
const developmentPath = '/php/shopgate/';
const appRegex = /sg_app_resources\/[0-9]*\//;
// Build regex that will remove all blacklisted paramters
let regex = '';
urlParameterBlacklist.forEach((entr... | javascript | {
"resource": ""
} |
q54418 | get | train | function get(object, path, defaultValue) {
// Initialize the parameters
const data = object || {};
const dataPath = path || '';
const defaultReturnValue = defaultValue;
// Get the segments of the path
const pathSegments = dataPath.split('.');
if (!dataPath || !pathSegments.length) {
// No path or pa... | javascript | {
"resource": ""
} |
q54419 | checkPathSegment | train | function checkPathSegment(currentData, currentPathSegmentIndex) {
// Get the current segment within the path
const currentPathSegment = pathSegments[currentPathSegmentIndex];
const nextPathSegmentIndex = currentPathSegmentIndex + 1;
/**
* Prepare the default value as return value for the case that... | javascript | {
"resource": ""
} |
q54420 | sanitizeTitle | train | function sanitizeTitle(title, shopName) {
// Take care that the parameters don't contain leading or trailing spaces
let trimmedTitle = title.trim();
const trimmedShopName = shopName.trim();
if (!trimmedShopName) {
/**
* If no shop name is available, it doesn't make sense to replace it.
* So we re... | javascript | {
"resource": ""
} |
q54421 | formatSgDataProduct | train | function formatSgDataProduct(product) {
return {
id: getProductIdentifier(product),
type: 'product',
name: get(product, 'name'),
priceNet: getUnifiedNumber(get(product, 'amount.net')),
priceGross: getUnifiedNumber(get(product, 'amount.gross')),
quantity: getUnifiedNumber(get(product, 'quantity... | javascript | {
"resource": ""
} |
q54422 | formatFavouriteListItems | train | function formatFavouriteListItems(products) {
if (!products || !Array.isArray(products)) {
return [];
}
return products.map(product => ({
id: get(product, 'product_number_public') || get(product, 'product_number') || get(product, 'uid'),
type: 'product',
name: get(product, 'name'),
priceNet: ... | javascript | {
"resource": ""
} |
q54423 | executeCommand | train | function executeCommand(name = '', params = {}) {
const command = new AppCommand();
command
.setCommandName(name)
.dispatch(params);
} | javascript | {
"resource": ""
} |
q54424 | widgetCell | train | function widgetCell({
col,
row,
width,
height,
}) {
return css({
gridColumnStart: col + 1,
gridColumnEnd: col + width + 1,
gridRowStart: row + 1,
gridRowEnd: row + height + 1,
}).toString();
} | javascript | {
"resource": ""
} |
q54425 | fetchClientInformation | train | function fetchClientInformation() {
return (dispatch) => {
dispatch(requestClientInformation());
if (!hasSGJavaScriptBridge()) {
dispatch(receiveClientInformation(defaultClientInformation));
return;
}
getWebStorageEntry({ name: 'clientInformation' })
.then(response => dispatch(rece... | javascript | {
"resource": ""
} |
q54426 | shouldShowWidget | train | function shouldShowWidget(settings = {}) {
const nowDate = new Date();
// Show widget if flag does not exist (old widgets)
if (!settings.hasOwnProperty('published')) {
return true;
}
if (settings.published === false) {
return false;
}
// Defensive here since this data comes from the pipeline, it... | javascript | {
"resource": ""
} |
q54427 | hasAnyTerms | train | function hasAnyTerms(file) {
var pathname = file.path;
var hasTerms = false;
var hasSrcInclusiveTerms = false;
hasTerms = matchTerms(file, forbiddenTerms);
if (!isTestFile(file)) {
hasSrcInclusiveTerms = matchTerms(file, forbiddenTermsSrcInclusive);
}
return hasTerms || hasSrcInclusiveTerms;
} | javascript | {
"resource": ""
} |
q54428 | isMissingTerms | train | function isMissingTerms(file) {
var contents = file.contents.toString();
return Object.keys(requiredTerms).map(function(term) {
var filter = requiredTerms[term];
if (!filter.test(file.path)) {
return false;
}
var matches = contents.match(new RegExp(term));
if (!matches) {
util.log(u... | javascript | {
"resource": ""
} |
q54429 | checkForbiddenAndRequiredTerms | train | function checkForbiddenAndRequiredTerms() {
var forbiddenFound = false;
var missingRequirements = false;
return gulp.src(srcGlobs)
.pipe(through2.obj(function(file, enc, cb) {
forbiddenFound = hasAnyTerms(file) || forbiddenFound;
missingRequirements = isMissingTerms(file) || missingRequirements;
... | javascript | {
"resource": ""
} |
q54430 | parseQueryString | train | function parseQueryString(query) {
if (!query) {
return {};
}
return (/^[?#]/.test(query) ? query.slice(1) : query)
.split('&')
.reduce((params, param) => {
const item = param.split('=');
const key = decodeURIComponent(item[0] || '');
const value = decodeURIComponent(item[1... | javascript | {
"resource": ""
} |
q54431 | addFragmentParam | train | function addFragmentParam(url, param, value) {
return url +
(url.indexOf('#') == -1 ? '#' : '&') +
encodeURIComponent(param) + '=' + encodeURIComponent(value);
} | javascript | {
"resource": ""
} |
q54432 | train | function (str) {
return str.split(';').map(function (e, i) {
return plugs[i].parse(e)
})
} | javascript | {
"resource": ""
} | |
q54433 | lint | train | function lint() {
var errorsFound = false;
var stream = gulp.src(config.lintGlobs);
if (isWatching) {
stream = stream.pipe(watcher());
}
if (argv.fix) {
options.fix = true;
}
return stream.pipe(eslint(options))
.pipe(eslint.formatEach('stylish', function(msg) {
errorsFound = true;
... | javascript | {
"resource": ""
} |
q54434 | compileJs | train | function compileJs(srcDir, srcFilename, destDir, options) {
options = options || {};
if (options.minify) {
const startTime = Date.now();
return closureCompile(
srcDir + srcFilename + '.js', destDir, options.minifiedName, options)
.then(function() {
fs.writeFileSync(destDir + '/ver... | javascript | {
"resource": ""
} |
q54435 | endBuildStep | train | function endBuildStep(stepName, targetName, startTime) {
const endTime = Date.now();
const executionTime = new Date(endTime - startTime);
const secs = executionTime.getSeconds();
const ms = executionTime.getMilliseconds().toString();
var timeString = '(';
if (secs === 0) {
timeString += ms + ' ms)';
}... | javascript | {
"resource": ""
} |
q54436 | serve | train | function serve() {
util.log(util.colors.green('Serving unminified js'));
nodemon({
script: require.resolve('../server/server.js'),
watch: [
require.resolve('../server/server.js')
],
env: {
'NODE_ENV': 'development',
'SERVE_PORT': port,
'SERVE_HOST': host,
'SERVE_USEHTT... | javascript | {
"resource": ""
} |
q54437 | dist | train | function dist() {
process.env.NODE_ENV = 'production';
return clean().then(() => {
return Promise.all([
compile({minify: true, checkTypes: false, isProdBuild: true}),
]).then(() => {
// Push main "min" files to root to make them available to npm package.
fs.copySync('./dist/activities.min.... | javascript | {
"resource": ""
} |
q54438 | buildBinaryString | train | function buildBinaryString (arrayBuffer) {
var binaryString = "";
const utf8Array = new Uint8Array(arrayBuffer);
const blockSize = 16384;
for (var i = 0; i < utf8Array.length; i = i + blockSize) {
const binarySubString = String.fromCharCode.apply(null, utf... | javascript | {
"resource": ""
} |
q54439 | getEntryIconHtml | train | function getEntryIconHtml(shape) {
var html = '',
name = shape.name,
x = shape.xPos,
y = shape.yPos,
fill = shape.fillColor,
stroke = shape.strokeColor,
width = shape.strokeWidth;
switch (name) {
case 'circle':
... | javascript | {
"resource": ""
} |
q54440 | getLegendEntries | train | function getLegendEntries(series, labelFormatter, sorted) {
var lf = labelFormatter,
legendEntries = series.map(function(s, i) {
return {
label: (lf ? lf(s.label, s) : s.label) || 'Plot ' + (i + 1),
color: s.color,
options: ... | javascript | {
"resource": ""
} |
q54441 | checkOptions | train | function checkOptions(opts1, opts2) {
for (var prop in opts1) {
if (opts1.hasOwnProperty(prop)) {
if (opts1[prop] !== opts2[prop]) {
return true;
}
}
}
return false;
} | javascript | {
"resource": ""
} |
q54442 | shouldRedraw | train | function shouldRedraw(oldEntries, newEntries) {
if (!oldEntries || !newEntries) {
return true;
}
if (oldEntries.length !== newEntries.length) {
return true;
}
var i, newEntry, oldEntry, newOpts, oldOpts;
for (i = 0; i < newEntries.length; i++) {
... | javascript | {
"resource": ""
} |
q54443 | train | function (value) {
var bw = options.grid.borderWidth;
return (((typeof bw === "object" && bw[axis.position] > 0) || bw > 0) && (value === axis.min || value === axis.max));
} | javascript | {
"resource": ""
} | |
q54444 | train | function( data ){
data = $.extend({
distance: drag.distance,
which: drag.which,
not: drag.not,
drop: drag.drop
}, data || {});
data.distance = squared( data.distance ); // x² + y² = distance²
$event.add( this, "mousedown", handler, data );
if ( this.attachEvent ) this.attachEvent("ondragstart", ... | javascript | {
"resource": ""
} | |
q54445 | hijack | train | function hijack ( event, type, elem ){
event.type = type; // force the event type
var result = ($.event.dispatch || $.event.handle).call( elem, event );
return result===false ? false : result || event.result;
} | javascript | {
"resource": ""
} |
q54446 | selectable | train | function selectable ( elem, bool ){
if ( !elem ) return; // maybe element was removed ?
elem = elem.ownerDocument ? elem.ownerDocument : elem;
elem.unselectable = bool ? "off" : "on"; // IE
if ( elem.style ) elem.style.MozUserSelect = bool ? "" : "none"; // FF
$.event[ bool ? "remove" : "add" ]( elem, "selectstart... | javascript | {
"resource": ""
} |
q54447 | train | function() {
// *** https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
// Safari 3.0+ "[object HTMLElementConstructor]"
return /constructor/i.test(window.top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemot... | javascript | {
"resource": ""
} | |
q54448 | isExtJsReady | train | function isExtJsReady() {
return !(typeof Ext === 'undefined' || !Ext.isReady || typeof Ext.onReady === 'undefined' ||
typeof Ext.Ajax === 'undefined' || typeof Ext.Ajax.on === 'undefined');
} | javascript | {
"resource": ""
} |
q54449 | getStoreData | train | function getStoreData(storeId, field) {
var arr = Ext.StoreManager.get(storeId).getRange();
var res = arr.map(function (elem) {
return elem[field];
});
return res;
} | javascript | {
"resource": ""
} |
q54450 | replaceLocKeys | train | function replaceLocKeys(str) {
var reExtra = /el"(.*?)"/g;
var result = str.replace(reExtra, function (m, key) {
return '"' + tiaEJ.getLocaleValue(key, true) + '"';
});
var re = /l"(.*?)"/g;
result = result.replace(re, function (m, key) {
return '"' + tiaEJ.getLocaleValue(k... | javascript | {
"resource": ""
} |
q54451 | handleDirConfig | train | function handleDirConfig(dir, files, parentDirConfig) {
let config;
if (files.includes(gT.engineConsts.dirConfigName)) {
config = nodeUtils.requireEx(path.join(dir, gT.engineConsts.dirConfigName), true).result;
} else {
config = {};
}
// TODO: some error when suite configs or root configs is met in w... | javascript | {
"resource": ""
} |
q54452 | getSmtpTransporter | train | function getSmtpTransporter() {
return nodemailer.createTransport(
smtpTransport({
// service: 'tia',
host: gT.suiteConfig.mailSmtpHost,
secure: true,
// secure : false,
// port: 25,
auth: {
user: gT.suiteConfig.mailUser,
pass: gT.suiteConfig.mailPassword,
... | javascript | {
"resource": ""
} |
q54453 | trackEOL | train | function trackEOL(msg) {
if (msg === true || Boolean(msg.match(/(\n|\r)$/))) {
gIn.tracePrefix = '';
} else {
gIn.tracePrefix = '\n';
}
} | javascript | {
"resource": ""
} |
q54454 | failWrapper | train | function failWrapper(msg, mode) {
gT.l.fail(msg);
if (mode && mode.accName) {
mode.accName = false; // eslint-disable-line no-param-reassign
}
} | javascript | {
"resource": ""
} |
q54455 | doesStoreContainField | train | function doesStoreContainField(store, fieldName) {
var model = store.first();
if (typeof model.get(fieldName) !== 'undefined') {
return true;
}
return model.getField(fieldName) != null;
} | javascript | {
"resource": ""
} |
q54456 | getCols | train | function getCols(table) {
var panel = tiaEJ.search.parentPanel(table);
var columns = panel.getVisibleColumns();
return columns;
} | javascript | {
"resource": ""
} |
q54457 | getColSelectors | train | function getColSelectors(table) {
var cols = this.getCols(table);
var selectors = cols.map(function (col) {
return table.getCellSelector(col);
});
return selectors;
} | javascript | {
"resource": ""
} |
q54458 | getColHeaderInfos | train | function getColHeaderInfos(table) {
var cols = this.getCols(table);
var arr = cols.map(function (col) {
// col.textEl.dom.textContent // slower but more honest.
// TODO: getConfig().tooltip - проверить.
var text = tiaEJ.convertTextToFirstLocKey(col.text);
if (text === col.emp... | javascript | {
"resource": ""
} |
q54459 | getCB | train | function getCB(cb) {
var str = '';
// str += this.getIdItemIdReference(cb) + '\n';
str += this.getCompDispIdProps(cb) + '\n';
str += 'Selected vals: \'' + this.getCBSelectedVals(cb) + '\'\n';
var displayField = this.safeGetConfig(cb, 'displayField');
// str += 'displayField: ' + di... | javascript | {
"resource": ""
} |
q54460 | getFormSubmitValues | train | function getFormSubmitValues(form) {
var fields = form.getValues(false, false, false, false);
return fields; // O
} | javascript | {
"resource": ""
} |
q54461 | getTree | train | function getTree(table, options) {
if (table.isPanel) {
table = table.getView();
}
function getDefOpts() {
return {
throwIfInvisible: false,
allFields: false
};
}
var isVisible = table.isVisible(true);
options = tiaEJ.ctMisc.checkVisibil... | javascript | {
"resource": ""
} |
q54462 | getControllerInfo | train | function getControllerInfo(controller, msg) {
var res = ['++++++++++',
'CONTROLLER INFO (' + msg + '):',
];
if (!controller) {
res.push('N/A');
return res;
}
var modelStr = '';
var refsObj = controller.getReferences();
var refsStr = Ext.Object.getKeys(r... | javascript | {
"resource": ""
} |
q54463 | getFormFieldInfo | train | function getFormFieldInfo(field) {
var formFieldArr = [
this.consts.avgSep,
'Form Field Info: ',
];
var name = field.getName() || '';
if (!Boolean(autoGenRE.test(name))) {
formFieldArr.push('getName(): ' + this.boldIf(name, name, 'darkgreen'));
}
tia.cU.du... | javascript | {
"resource": ""
} |
q54464 | parseSearchString | train | function parseSearchString(str) {
str = tia.cU.replaceXTypesInTeq(str);
var re = /&(\w|\d|_|-)+/g;
var searchData = [];
var prevLastIndex = 0;
var query;
while (true) {
var reResult = re.exec(str);
if (reResult === null) {
// Only query string.
query = str.slice(... | javascript | {
"resource": ""
} |
q54465 | byIdRef | train | function byIdRef(id, ref) {
var cmp = this.byId(id).lookupReferenceHolder(false).lookupReference(ref);
if (!cmp) {
throw new Error('Component not found for container id: ' + id + ', reference: ' + ref);
}
return cmp;
} | javascript | {
"resource": ""
} |
q54466 | byIdRefKey | train | function byIdRefKey(id, ref, key, extra) {
var text = tiaEJ.getTextByLocKey(key, extra);
var cmp = this.search.byIdRef(id, ref);
var resItem = this.search.byText(cmp, text, 'container id: ' + id + ', reference: ' + ref);
return resItem;
} | javascript | {
"resource": ""
} |
q54467 | stopTimer | train | function stopTimer(startTime) {
if (gT.config.enableTimings) {
const dif = process.hrtime(startTime);
return ` (${dif[0] * 1000 + dif[1] / 1e6} ms)`;
}
return '';
} | javascript | {
"resource": ""
} |
q54468 | pause | train | async function pause() {
if (gT.cLParams.selActsDelay) {
await gT.u.promise.delayed(gT.cLParams.selActsDelay);
}
} | javascript | {
"resource": ""
} |
q54469 | handleErrorWhenDriverExistsAndRecCountZero | train | async function handleErrorWhenDriverExistsAndRecCountZero() {
gIn.errRecursionCount = 1; // To prevent recursive error report on error report.
/* Here we use selenium GUI stuff when there was gT.s.driver.init call */
gIn.tracer.msg1('A.W.: Error report: printSelDriverLogs');
await gT.s.driver.printSelDriverLog... | javascript | {
"resource": ""
} |
q54470 | getTableItemByIndex | train | function getTableItemByIndex(table, index) {
if (table.isPanel) {
table = table.getView();
}
var el = table.getRow(index);
return el;
} | javascript | {
"resource": ""
} |
q54471 | findRecordIds | train | function findRecordIds(store, rowData) {
var internalIds = [];
store.each(function (m) {
for (var i = 0; i < rowData.length; i++) {
var item = rowData[i];
var dataIndex = item[0];
var value = item[1];
var fieldValue = m.get(dataIndex);
if (fieldVal... | javascript | {
"resource": ""
} |
q54472 | findRecord | train | function findRecord(store, fieldName, text) {
var index = store.find(fieldName, text);
if (index === -1) {
throw new Error('Text: ' + text + ' not found for fieldName: ' + fieldName);
}
return index;
} | javascript | {
"resource": ""
} |
q54473 | findRecords | train | function findRecords(store, fieldName, texts) {
var records = [];
texts.forEach(function (text) {
var index = store.find(fieldName, text);
if (index === -1) {
throw new Error('Text: ' + text + ' not found for fieldName: ' + fieldName);
}
records.push(index);
}... | javascript | {
"resource": ""
} |
q54474 | setTableSelection | train | function setTableSelection(table, rowData) {
if (table.isPanel) {
table = table.getView();
}
var model = this.findRecord(table.getStore(), rowData);
table.setSelection(model);
} | javascript | {
"resource": ""
} |
q54475 | getRowDomId | train | function getRowDomId(table, internalId) {
if (table.isPanel) {
table = table.getView();
}
var tableId = table.getId();
var gridRowid = tableId + '-record-' + internalId;
return gridRowid;
} | javascript | {
"resource": ""
} |
q54476 | getTableCellByColumnTexts | train | function getTableCellByColumnTexts(table, cellData) {
if (table.isPanel) {
table = table.getView();
}
if (typeof cellData.one === 'undefined') {
cellData.one = true;
}
if (typeof cellData.index === 'undefined') {
cellData.index = 0;
}
var panel = tabl... | javascript | {
"resource": ""
} |
q54477 | parseMwsResponse | train | function parseMwsResponse(method, headers, response, callback) {
// if it's XML, then we an parse correctly
if (headers && headers['content-type'] == 'text/xml') {
xml2js.parseString(response, {explicitArray: false}, function(err, result) {
if (err) {
return callback(err);
}
if (resul... | javascript | {
"resource": ""
} |
q54478 | write | train | function write(arr, str, range) {
const offset = range[0];
arr[offset] = str;
for (let i = offset + 1; i < range[1]; i++) {
arr[i] = undefined;
}
} | javascript | {
"resource": ""
} |
q54479 | replaceRequireAndDefine | train | function replaceRequireAndDefine(code, amdPackages, amdModules) {
// Parse the code as an AST
const ast = esprima.parseScript(code, {
range: true
});
// Split the code into an array for easier substitutions
const buffer = code.split('');
// Walk thru the tree, find and replace our targets
eswalk(ast... | javascript | {
"resource": ""
} |
q54480 | getStartEnvOptions | train | function getStartEnvOptions() {
var options = {};
for (var k in args) {
switch (k) {
case 'daemon':
case 'robust':
options[k] = args[k] === true ? '1' : '0';
break;
case 'cluster':
options[k] = args[k] ? args[k] : os.cp... | javascript | {
"resource": ""
} |
q54481 | train | function(value, field) {
if(field.parser) {
var parser = (isFunction(field.parser)) ?
field.parser : null;//Y.Parsers[field.parser+''];
if(parser) {
value = parser.call(this, value);
}
else {
... | javascript | {
"resource": ""
} | |
q54482 | train | function (path, data) {
var i = 0,
len = path.length;
for (;i<len;i++) {
if (isObject(data) && (path[i] in data)) {
data = data[path[i]];
} else {
data = undefined;
break;
}
}
return data;
... | javascript | {
"resource": ""
} | |
q54483 | train | function(schema, data) {
var data_in = data,
data_out = { results: [], meta: {} };
// Convert incoming JSON strings
if (!isObject(data)) {
try {
data_in = JSON.parse(data);
}
catch(e) {
data_out.error = e;
... | javascript | {
"resource": ""
} | |
q54484 | train | function(schema, json_in, data_out) {
var getPath = SchemaJSON.getPath,
getValue = SchemaJSON.getLocationValue,
path = getPath(schema.resultListLocator),
results = path ?
(getValue(path, json_in) ||
// Fall back to treat resultListLoc... | javascript | {
"resource": ""
} | |
q54485 | train | function(metaFields, json_in, data_out) {
if (isObject(metaFields)) {
var key, path;
for(key in metaFields) {
if (metaFields.hasOwnProperty(key)) {
path = SchemaJSON.getPath(metaFields[key]);
if (path && json_in) {
... | javascript | {
"resource": ""
} | |
q54486 | train | function (rootNode, viewKey) {
var views = this.getList('view', rootNode);
var self = this;
_.each(views, function (view) {
view.remove();
});
return this;
} | javascript | {
"resource": ""
} | |
q54487 | onLinksDone | train | function onLinksDone(loaded) {
if (loaded === 2) {
if (hasLayoutChanged) {
$target.find('[lazo-cmp-name]').remove();
$target.append(html);
... | javascript | {
"resource": ""
} |
q54488 | train | function(attrs, options) {
// begin lazo specific overrides
var modelName = null;
if (this.modelName) {
if (_.isFunction(this.modelName)) {
modelName = this.modelName(attrs, options);
}
else {
mo... | javascript | {
"resource": ""
} | |
q54489 | train | function (svc, attributes, options) {
options = options || {};
if (!options.success) {
throw new Error('Success callback undefined for service call svc: ' + svc);
}
var error = options.error;
options.error = function (err) {
if... | javascript | {
"resource": ""
} | |
q54490 | setTags | train | function setTags(routeDefs) {
for (var k in routeDefs) {
if (_.isObject(routeDefs[k])) {
if (!_.isArray(routeDefs[k].servers)) {
routeDefs[k].servers = ['primary'];
}
} else {
... | javascript | {
"resource": ""
} |
q54491 | train | function (component) {
var pathParts = component === 'app' ? ['app'] : ['components'];
if (component !== 'app') {
pathParts.push(component);
}
pathParts.push('assets');
return path.resolve(LAZO.FILE_REPO_PATH + path.sep + path.join.apply(this,... | javascript | {
"resource": ""
} | |
q54492 | train | function (map, ctx) {
for (var k in map) {
map[k] = this.resolveAssets(map[k], ctx);
}
return map;
} | javascript | {
"resource": ""
} | |
q54493 | train | function (key, options) {
var ret;
if (this.data && key in this.data) {
ret = this.data[key];
try {
ret = JSON.parse(ret);
} catch (e) {} // ignore JSON parse errors since we only want to parse it if it is JSON
}
... | javascript | {
"resource": ""
} | |
q54494 | train | function(elem, listener) {
var normalizedListener = function(e) {
listener(normalizeWheelEvent(e));
};
EVENT_NAMES.forEach(function(name) {
elem.addEventListener(name, normalizedListener);
});
return function() {
EVENT_NAMES.forEach(function(... | javascript | {
"resource": ""
} | |
q54495 | train | function(r1, c1, r2, c2) {
var range = {};
if (r1 < r2) {
range.top = r1;
range.height = r2 - r1 + 1;
} else {
range.top = r2;
range.height = r1 - r2 + 1;
}
if (c1 < c2) {
range.left = c1;
range.width = c2 -... | javascript | {
"resource": ""
} | |
q54496 | handleRowColSelectionChange | train | function handleRowColSelectionChange(rowOrCol) {
var decoratorsField = ('_' + rowOrCol + 'SelectionClasses');
model[decoratorsField].forEach(function (selectionDecorator) {
grid.cellClasses.remove(selectionDecorator);
});
model[decoratorsField] = [];
if (grid[rowOrCo... | javascript | {
"resource": ""
} |
q54497 | createCategorizer | train | async function createCategorizer() {
const classifierOptions = { tokenizer }
// We can't initialize the model in parallel using `Promise.all` because with
// it is not possible to manage errors separately
let globalModel, localModel
try {
globalModel = await createGlobalModel(classifierOptions)
} catc... | javascript | {
"resource": ""
} |
q54498 | onRegistered | train | function onRegistered(client, url) {
let server
return new Promise(resolve => {
server = http.createServer((request, response) => {
if (request.url.indexOf('/do_access') === 0) {
log('debug', request.url, 'url received')
resolve(request.url)
response.end(
'Authorization r... | javascript | {
"resource": ""
} |
q54499 | log | train | function log(type, message, label, namespace) {
if (filterOut(level, type, message, label, namespace)) {
return
}
// eslint-disable-next-line no-console
console.log(format(type, message, label, namespace))
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.