_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q7300 | train | function () {
if (!codeViewer.codeActive) {
return;
}
if (window.getSelection().empty) {
window.getSelection().empty();
}
else if (window.getSelection().removeAllRanges) {
window.getSelection().removeAllRanges();
}
} | javascript | {
"resource": ""
} | |
q7301 | train | function () {
$sgCodeContainer // Has class sg-view-container.
.css('bottom', -$document.outerHeight())
.addClass('anim-ready');
// Make sure the close button handles the click.
$('#sg-code-close-btn').click(function (e) {
e.preventDefault();
codeViewer.closeCode();
... | javascript | {
"resource": ""
} | |
q7302 | train | function () {
let encoded = this.responseText;
// We sometimes want markup code to be in an HTML-like template language with tags delimited by stashes.
// In order for js-beautify to indent such code correctly, any space between control characters #, ^, and /, and
// the variable name must be r... | javascript | {
"resource": ""
} | |
q7303 | train | function () {
let encoded = this.responseText;
encoded = window.he.encode(encoded);
codeViewer.mustache = encoded;
if (codeViewer.tabActive === 'm') {
codeViewer.activateDefaultTab('m', encoded);
}
} | javascript | {
"resource": ""
} | |
q7304 | train | function (type) {
if (!codeViewer.codeActive) {
return;
}
let fill = '';
codeViewer.tabActive = type;
$sgCodeTitles.removeClass('sg-code-title-active');
switch (type) {
case 'e':
fill = codeViewer.encoded;
$sgCodeTitleHtml.addClass('sg-code-tit... | javascript | {
"resource": ""
} | |
q7305 | EventJobs | train | function EventJobs (opts) {
debug('EventJobs constructor');
this._publishedEvents = opts.publishedEvents || [];
this._subscribedEvents = opts.subscribedEvents || [];
this._name = opts.name;
if (!this._name) {
debug('error: name required for EventJobs');
throw new Error('name required for EventJobs');... | javascript | {
"resource": ""
} |
q7306 | processFile | train | function processFile(file, filename, callback) {
// Check if it matches the convention.
if (path.extname(filename) === '.metadata') {
// Find the name of the metadata.
const name = path.basename(filename, '.metadata')
// Recursively merge the meta data.
const newMetadata = {... | javascript | {
"resource": ""
} |
q7307 | codify | train | function codify(object) {
if (object === undefined) {
return object;
} else {
let json = JSON.stringify(object, undefined, "\t");
// First substitue embedded double quotes with FFFF
json = json.replace(/\\"/g, "\uFFFF");
// Now replace all property name quotes
jso... | javascript | {
"resource": ""
} |
q7308 | Scope | train | function Scope(data, affix, parent) {
if (data !== undefined) {
this.data = data;
} else {
this.data = {};
}
if (parent) {
this.parent = parent;
this.root = parent.root;
} else {
this.parent = undefined;
this.root = this;
}
this.affix = affix || {};
this.ready = false;
} | javascript | {
"resource": ""
} |
q7309 | selectorValidateAndParse | train | function selectorValidateAndParse(selectorRaw_) {
const selectorRaw = selectorRaw_.trim();
const bracketOpenPos = selectorRaw.indexOf('[');
const bracketClosePos = selectorRaw.indexOf(']');
let indexStr;
let name = selectorRaw;
// Slice selectorRaw to extract name and indexStr if submitted.
... | javascript | {
"resource": ""
} |
q7310 | addThisDotProps | train | function addThisDotProps(path) {
path.replaceWith(
t.memberExpression(
t.memberExpression(t.thisExpression(), t.identifier('props')),
path.node
)
);
} | javascript | {
"resource": ""
} |
q7311 | isDestructuredPropsReference | train | function isDestructuredPropsReference(path) {
const object = path.get('object');
if (!path.scope.hasOwnBinding(object.node.name)) {
return;
}
const bindingValue = path.scope.bindings[object.node.name].path.get('init');
return (
(bindingValue.isMemberExpression() &&
bindingValue.get('object').i... | javascript | {
"resource": ""
} |
q7312 | isObjectMemberProperty | train | function isObjectMemberProperty(path) {
return (
t.isMemberExpression(path.parent) &&
path.parentPath.get('property') === path
);
} | javascript | {
"resource": ""
} |
q7313 | createShadowDOM | train | function createShadowDOM(p_ComponentInstance, p_ComponentTemplate) {
// retrieve the correct template from our map of previously stored templates
const templateInstance = window.webComponentTemplates.get(p_ComponentTemplate);
// if we are using the shadyCSS polyfill, we must initialize that now
if (window.ShadyCSS)... | javascript | {
"resource": ""
} |
q7314 | visibilityFilter | train | function visibilityFilter(state = SHOW_ALL, action = {}) {
const {type, filter} = action;
switch (type) {
case SET_VISIBILITY_FILTER:
return filter;
default:
return state;
}
} | javascript | {
"resource": ""
} |
q7315 | Iterator | train | function Iterator(array) {
// the array and current slot index are private attributes so methods that use them
// are defined in the constructor
var currentSlot = 0; // the slot before the first item
this.toStart = function() {
currentSlot = 0; // the slot before the first item
};
t... | javascript | {
"resource": ""
} |
q7316 | StyleSheet | train | function StyleSheet(el) {
/**
* style/link element or selector
* @cfg {HTMLElement|String} el
*/
/**
* style/link element
* @type {HTMLElement}
* @property el
*/
if (el.el) {
el = el.el;
}
el = this.el = Dom.get(el); // http://msd... | javascript | {
"resource": ""
} |
q7317 | train | function (selectorText) {
var rule, css, selector, cssRules = this.cssRules;
if (selectorText) {
rule = cssRules[selectorText];
return rule ? rule.style.cssText : null;
} else {
css = [];
for (selector in cssRules) {
... | javascript | {
"resource": ""
} | |
q7318 | Probability | train | function Probability(value, parameters) {
abstractions.Element.call(this, utilities.types.PROBABILITY, parameters);
if (value === undefined) value = 0; // default value
if (!isFinite(value) || value < 0 || value > 1) {
throw new utilities.Exception({
$module: '/bali/elements/Probability... | javascript | {
"resource": ""
} |
q7319 | boot | train | function boot() {
if (config === null) {
// TODO [NSTDFRZN] Be sure nested objects are frozen too
config = Object.freeze(gatherConfigFromEnv());
}
ee.emitAsync('booting_backing')
.then(() => {
ee.emit('booting');
ee.emit('booted');
})
.catch((err) => {
ee.emit('error', err);... | javascript | {
"resource": ""
} |
q7320 | train | function (isJson, transformer) {
printHelpOnExit = false;
return function (value) {
if (isJson) {
console.log(JSON.stringify(value, null, 2));
} else if (typeof transformer === 'function') {
console.log(transformer(value));
} else {
console.log(value);
}
if (theUfo) theUfo.disc... | javascript | {
"resource": ""
} | |
q7321 | train | function (obj) {
printHelpOnExit = false;
if (_.isError(obj)) {
console.error(obj);
} else {
console.error(`ERROR: ${obj.toString()}`);
}
if (theUfo) theUfo.disconnect();
process.exitCode = 1;
} | javascript | {
"resource": ""
} | |
q7322 | train | function (...args) {
let value = false;
args.forEach((arg) => {
if (value === false) {
if (arg === true || (typeof arg === 'string' && arg.toLowerCase() === 'true') || arg === 1) {
value = true;
}
}
});
return value;
} | javascript | {
"resource": ""
} | |
q7323 | train | function () {
const options = {};
options.host = cli.ufo || process.env.LUFO_ADDRESS || '';
options.password = cli.password || process.env.LUFO_PASSWORD || undefined;
options.localHost = cli.localHost || process.env.LUFO_LOCALHOST || undefined;
options.localUdpPort = parseInt(cli.localUdpPort || process.env.L... | javascript | {
"resource": ""
} | |
q7324 | train | function (action) {
printHelpOnExit = false;
const cliOptions = getOptions();
if (cliOptions.host) {
if (net.isIPv4(cliOptions.host)) {
theUfo = new Ufo(cliOptions);
theUfo.connect()
.then(action.bind(theUfo))
.catch(quitError);
} else {
quitError(`Invalid UFO IP address ... | javascript | {
"resource": ""
} | |
q7325 | ieInlineBlockHack | train | function ieInlineBlockHack(decl, i) {
if (decl.prop == 'display' && decl.value == 'inline-block') {
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')
insertDecl(decl, i, {
raws: {
before: reBefore
},
prop: '*zoom',
value: 1
})
insertDecl(decl, i, {
raws... | javascript | {
"resource": ""
} |
q7326 | train | function (s2) {
var self = this;
return !!util.reduce(self.keys, function (v, k) {
return v && self[k] === s2[k];
}, 1);
} | javascript | {
"resource": ""
} | |
q7327 | train | function (event, ce) {
var ret, self = this;
ret = self.fn.call(self.context || ce.currentTarget, event, self.data);
if (self.once) {
//noinspection JSUnresolvedFunction
ce.removeObserver(self);
}
return ret;
} | javascript | {
"resource": ""
} | |
q7328 | train | function (event, ce) {
var ret = this.simpleNotify(event, ce); // return false 等价 preventDefault + stopPropagation
// return false 等价 preventDefault + stopPropagation
if (ret === false) {
event.halt();
}
return ret;
} | javascript | {
"resource": ""
} | |
q7329 | train | function (event, ce) {
var self = this, _ksGroups = event._ksGroups; // handler's group does not match specified groups (at fire step)
// handler's group does not match specified groups (at fire step)
if (_ksGroups && (!self.groups || !self.groups.match(_ksGroups))) {
... | javascript | {
"resource": ""
} | |
q7330 | Observable | train | function Observable(cfg) {
var self = this;
self.currentTarget = null;
util.mix(self, cfg);
self.reset(); /**
* current event type
* @cfg {String} type
*/
} | javascript | {
"resource": ""
} |
q7331 | train | function (observer) {
var self = this, i, observers = self.observers, len = observers.length;
for (i = 0; i < len; i++) {
if (observers[i] === observer) {
observers.splice(i, 1);
break;
}
}
self.check... | javascript | {
"resource": ""
} | |
q7332 | train | function (observer) {
var observers = this.observers, i;
for (i = observers.length - 1; i >= 0; --i) {
/*
If multiple identical EventListeners are registered on the same EventTarget
with the same parameters the duplicate instances are discarded.
... | javascript | {
"resource": ""
} | |
q7333 | train | function (str, parseQueryString) {
var m = str.match(URI_SPLIT_REG) || [], ret = {}; // old ie 7: return "" for unmatched regexp ...
// old ie 7: return "" for unmatched regexp ...
for (var part in REG_INFO) {
ret[part] = m[REG_INFO[part]];
... | javascript | {
"resource": ""
} | |
q7334 | train | function (url, serializeArray) {
var host = url.host;
if (host === undef && url.hostname) {
host = encodeURIComponent(url.hostname);
if (url.port) {
host += ':' + url.port;
}
}
... | javascript | {
"resource": ""
} | |
q7335 | character | train | function character(options = {}) {
let chars = options.chars || ['-', '*', '+'];
if (typeof chars === 'string') {
return fill(...chars.split('..'), options);
}
return chars;
} | javascript | {
"resource": ""
} |
q7336 | train | function (index) {
var self = this;
if (typeof index === 'number') {
if (index >= self.length) {
return null;
} else {
return new Node(self[index]);
}
} else {
return new Node(inde... | javascript | {
"resource": ""
} | |
q7337 | train | function (selector, context, index) {
if (typeof context === 'number') {
index = context;
context = undefined;
}
var list = Node.all(selector, context).getDOMNodes(), ret = new Node(this);
if (index === undefined) {
push.app... | javascript | {
"resource": ""
} | |
q7338 | train | function (fn, context) {
var self = this;
util.each(self, function (n, i) {
n = new Node(n);
return fn.call(context || n, n, i, self);
});
return self;
} | javascript | {
"resource": ""
} | |
q7339 | train | function (selector) {
var ret, self = this;
if (self.length > 0) {
ret = Node.all(selector, self);
} else {
ret = new Node();
}
ret.__parent = self;
return ret;
} | javascript | {
"resource": ""
} | |
q7340 | train | function (selector) {
var self = this, all = self.all(selector), ret = all.length ? all.slice(0, 1) : null;
if (ret) {
ret.__parent = self;
}
return ret;
} | javascript | {
"resource": ""
} | |
q7341 | train | function (selector, context) {
// are we dealing with html string ?
// TextNode 仍需要自己 new Node
if (typeof selector === 'string' && (selector = util.trim(selector)) && selector.length >= 3 && util.startsWith(selector, '<') && util.endsWith(selector, '>')) {
var attrs;
... | javascript | {
"resource": ""
} | |
q7342 | train | function (selector, context) {
var all = Node.all(selector, context);
return all.length ? all.slice(0, 1) : null;
} | javascript | {
"resource": ""
} | |
q7343 | train | function () {
var self = this, l = self.length, needClone = self.length > 1, originArgs = util.makeArray(arguments);
var cfg = originArgs[0];
var AnimConstructor = Anim;
if (cfg.to) {
AnimConstructor = cfg.Anim || Anim;
} else {
... | javascript | {
"resource": ""
} | |
q7344 | train | function (end, clearQueue, queue) {
var self = this;
util.each(self, function (elem) {
Anim.stop(elem, end, clearQueue, queue);
});
return self;
} | javascript | {
"resource": ""
} | |
q7345 | train | function (end, queue) {
var self = this;
util.each(self, function (elem) {
Anim.pause(elem, queue);
});
return self;
} | javascript | {
"resource": ""
} | |
q7346 | train | function (end, queue) {
var self = this;
util.each(self, function (elem) {
Anim.resume(elem, queue);
});
return self;
} | javascript | {
"resource": ""
} | |
q7347 | train | function () {
var self = this;
for (var i = 0; i < self.length; i++) {
if (Anim.isRunning(self[i])) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} | |
q7348 | train | function () {
var self = this;
for (var i = 0; i < self.length; i++) {
if (Anim.isPaused(self[i])) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} | |
q7349 | Exception | train | function Exception(attributes, cause) {
this.stack = Error().stack;
if (this.stack) this.stack = 'Exception' + this.stack.slice(5); // replace 'Error' with 'Exception'
this.attributes = this.convert(attributes);
this.message = this.attributes.getValue('$text').getValue();
this.cause = cause;
re... | javascript | {
"resource": ""
} |
q7350 | aggregate | train | function aggregate(transform) {
switch (arguments.length) {
case 1:
return aggregate_seed_transform_selector.apply(this, [undefined, arguments[0]]);
default:
return aggregate_seed_transform_selector.apply(this, arguments);
}
} | javascript | {
"resource": ""
} |
q7351 | any | train | function any(predicate) {
predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;
for (let item of this) {
if (predicate(item)) return true;
}
return false;
} | javascript | {
"resource": ""
} |
q7352 | contains | train | function contains(item, equalityComparer) {
equalityComparer = typeof equalityComparer === 'function' ? equalityComparer : util.defaultEqualityComparer;
for (let i of this) {
if (equalityComparer(i, item)) return true;
}
return false;
} | javascript | {
"resource": ""
} |
q7353 | count | train | function count(predicate) {
predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;
let c = 0;
for (let item of this) {
if (predicate(item)) c++;
}
return c;
} | javascript | {
"resource": ""
} |
q7354 | elementAt | train | function elementAt(index, defaultValue) {
let i = 0;
for (let item of this) {
if (i === index) return item;
i++;
}
return defaultValue;
} | javascript | {
"resource": ""
} |
q7355 | first | train | function first(predicate) {
predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;
let error = new Error('No element satisfies the condition in predicate.');
let firstElement = firstOrDefault.apply(this, [predicate, error]);
if (firstElement === error) throw error;
return firstElem... | javascript | {
"resource": ""
} |
q7356 | firstOrDefault | train | function firstOrDefault(predicate, defaultValue) {
predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;
for (let item of this) {
if (predicate(item)) return item;
}
return defaultValue;
} | javascript | {
"resource": ""
} |
q7357 | last | train | function last(predicate, defaultValue) {
predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;
let lastValue;
let found = false;
for (let item of this.where(predicate)) {
lastValue = item;
found = true;
}
return found ? lastValue : defaultValue;
} | javascript | {
"resource": ""
} |
q7358 | max | train | function max(keySelector, comparer) {
let itComparer = typeof comparer === 'function' ? comparer : util.defaultComparer;
let itKeySelector = typeof keySelector === 'function' ? keySelector : (i) => i;
let maximum = this.firstOrDefault();
for (let item of this) {
maximum = itComparer(itKeySelector(item), i... | javascript | {
"resource": ""
} |
q7359 | min | train | function min(keySelector, comparer) {
let itComparer = typeof comparer === 'function' ? comparer : util.defaultComparer;
let itKeySelector = typeof keySelector === 'function' ? keySelector : (i) => i;
let minimum = this.firstOrDefault();
for (let item of this) {
minimum = itComparer(itKeySelector(item), i... | javascript | {
"resource": ""
} |
q7360 | sequenceEqual | train | function sequenceEqual(otherSequence, equalityComparer) {
equalityComparer = typeof equalityComparer === 'function' ? equalityComparer : util.defaultEqualityComparer;
let selfIterator = this[Symbol.iterator] ? this[Symbol.iterator]() : undefined;
let otherIterator = otherSequence[Symbol.iterator] ? otherSequence[... | javascript | {
"resource": ""
} |
q7361 | single | train | function single(predicate, defaultValue) {
predicate = typeof predicate === 'function' ? predicate : util.defaultPredicate;
let count = 0;
let singleItem = undefined;
for (let item of this) {
if (predicate(item)) {
if (singleItem === undefined) {
singleItem = item;
} else {
thro... | javascript | {
"resource": ""
} |
q7362 | sum | train | function sum(transform) {
let sum = 0;
let seq = typeof transform === 'function' ? this.select(transform) : this;
for (let item of seq) {
sum += Number.parseFloat(item);
}
return sum;
} | javascript | {
"resource": ""
} |
q7363 | toMap | train | function toMap(keySelector, elementSelector) {
if (!keySelector) return new Map(this);
elementSelector = typeof elementSelector === 'function' ? elementSelector : i => i;
let map = new Map();
for (let item of this) {
let key = keySelector(item);
let element = elementSelector(item);
map.set(key, el... | javascript | {
"resource": ""
} |
q7364 | train | function(options) {
if (!options) options = {};
this.initTime = options.initTime || new Date().getTime();
this.time_since_start = options.time_since_start || null;
this.time = options.time || null;
this.version = options.version || '0.45';
this.forcedUk25 = options.uk25 || null;
if (options.... | javascript | {
"resource": ""
} | |
q7365 | train | function (calendar) {
var time = calendar.getTime();
calendar = /**@type {KISSY.Date.Gregorian}
@ignore*/
new GregorianCalendar(this.timezoneOffset, this.locale);
calendar.setTime(time);
var i, ret = [], pattern = this.pattern, len = pattern.length;
... | javascript | {
"resource": ""
} | |
q7366 | train | function (dateStr) {
var calendar = /**@type {KISSY.Date.Gregorian}
@ignore*/
new GregorianCalendar(this.timezoneOffset, this.locale), i, j, tmp = {}, obeyCount = false, dateStrLen = dateStr.length, errorIndex = -1, startIndex = 0, oldStartIndex = 0, pattern = this.pattern, len ... | javascript | {
"resource": ""
} | |
q7367 | train | function (dateStyle, timeStyle, locale, timeZoneOffset) {
locale = locale || defaultLocale;
var datePattern = '';
if (dateStyle !== undefined) {
datePattern = locale.datePatterns[dateStyle];
}
var timePattern = '';
if (timeStyle !==... | javascript | {
"resource": ""
} | |
q7368 | __fireAttrChange | train | function __fireAttrChange(self, when, name, prevVal, newVal, subAttrName, attrName, data) {
attrName = attrName || name;
return self.fire(whenAttrChangeEventName(when, name), util.mix({
attrName: attrName,
subAttrName: subAttrName,
prevVal: prevVal,
newVal... | javascript | {
"resource": ""
} |
q7369 | train | function () {
var self = this, o = {}, a, attrs = self.getAttrs();
for (a in attrs) {
o[a] = self.get(a);
}
return o;
} | javascript | {
"resource": ""
} | |
q7370 | train | function (name, attrConfig, override) {
var self = this, attrs = self.getAttrs(), attr,
// shadow clone
cfg = util.merge(attrConfig);
if (cfg.value && typeof cfg.value === 'object') {
cfg.value = util.clone(cfg.value);
LoggerManger.... | javascript | {
"resource": ""
} | |
q7371 | train | function (attrConfigs, initialValues) {
var self = this;
util.each(attrConfigs, function (attrConfig, name) {
self.addAttr(name, attrConfig);
});
if (initialValues) {
self.set(initialValues);
}
return self;
} | javascript | {
"resource": ""
} | |
q7372 | train | function (name) {
var self = this;
var __attrVals = getAttrVals(self);
var __attrs = self.getAttrs();
if (self.hasAttr(name)) {
delete __attrs[name];
delete __attrVals[name];
}
return self;
} | javascript | {
"resource": ""
} | |
q7373 | train | function (name, value, opts) {
var self = this, e;
if (typeof name !== 'string') {
opts = value;
opts = opts || {};
var all = Object(name), attrs = [], errors = [];
for (name in all) {
// bulk validation
... | javascript | {
"resource": ""
} | |
q7374 | train | function (name, value) {
var self = this, setValue,
// if host does not have meta info corresponding to (name,value)
// then register on demand in order to collect all data meta info
// 一定要注册属性元数据,否则其他模块通过 _attrs 不能枚举到所有有效属性
// 因为属性在声明注册前可以直接设置... | javascript | {
"resource": ""
} | |
q7375 | train | function (name) {
var self = this, dot = '.', path, attrVals = getAttrVals(self), attrConfig, getter, ret;
if (name.indexOf(dot) !== -1) {
path = name.split(dot);
name = path.shift();
}
attrConfig = ensureNonEmpty(self.getAttrs(), name, 1);... | javascript | {
"resource": ""
} | |
q7376 | Text | train | function Text(value, parameters) {
abstractions.Element.call(this, utilities.types.TEXT, parameters);
value = value || ''; // default value
// since this element is immutable the value must be read-only
this.getValue = function() { return value; };
return this;
} | javascript | {
"resource": ""
} |
q7377 | _getEnvSpecificConfig | train | function _getEnvSpecificConfig () {
const prodDefaults = {
env: 'prod',
url: null,
debug: false,
version: 'head',
language: 'en',
redisKey: 'CortinaBlock_',
redisExpire: 600,
redis: null,
blocks: {
title: '1.260060',
megaMenu: '1.855134',
secondaryMenu: '1.865038'... | javascript | {
"resource": ""
} |
q7378 | _getHostEnv | train | function _getHostEnv (hostUrl) {
if (hostUrl) {
if (hostUrl.startsWith('https://www.kth')) {
return 'prod'
} else if (hostUrl.startsWith('https://www-r.referens.sys.kth') || hostUrl.startsWith('https://app-r.referens.sys.kth')) {
return 'ref'
} else if (hostUrl.startsWith('http://localhost')) ... | javascript | {
"resource": ""
} |
q7379 | _buildUrl | train | function _buildUrl (config, type, multi) {
let url = config.url
let language = _getLanguage(config.language)
let block = multi ? config.blocks[type][language] : config.blocks[type]
let version = _getVersion(config.version)
return `${url}${block}?v=${version}&l=${language}`
} | javascript | {
"resource": ""
} |
q7380 | _getBlock | train | function _getBlock (config, type, multi) {
const options = {
uri: _buildUrl(config, type, multi)
}
if (config.headers) {
options['headers'] = config.headers
}
return request.get(options).then(result => { return { blockName: type, result: result } })
} | javascript | {
"resource": ""
} |
q7381 | _getAll | train | function _getAll (config) {
return Promise.all(
handleBlocks(config)
).then(function (results) {
let result = {}
results.forEach(function (block) {
result[block.blockName] = block.result
})
return result
})
.catch(err => {
var blockName = err.options ? err.options.uri : 'NO URI... | javascript | {
"resource": ""
} |
q7382 | handleBlocks | train | function handleBlocks (config) {
let blocks = []
let blocksObj = config.blocks
for (let i in blocksObj) {
if (blocksObj.hasOwnProperty(i)) {
if (isLanguage(blocksObj[i])) {
blocks.push(_getBlock(config, 'language', true))
} else {
blocks.push(_getBlock(config, i))
}
}
}... | javascript | {
"resource": ""
} |
q7383 | _getRedisItem | train | function _getRedisItem (config) {
let key = _buildRedisKey(config.redisKey, config.language)
return config.redis.hgetallAsync(key)
} | javascript | {
"resource": ""
} |
q7384 | _setRedisItem | train | function _setRedisItem (config, blocks) {
let key = _buildRedisKey(config.redisKey, config.language)
return config.redis.hmsetAsync(key, blocks)
.then(function () {
return config.redis.expireAsync(key, config.redisExpire)
})
.then(function () {
return blocks
})
} | javascript | {
"resource": ""
} |
q7385 | _getEnvUrl | train | function _getEnvUrl (currentEnv, config) {
if (currentEnv && config) {
if (currentEnv === 'prod') {
return config.urls.prod
} else if (currentEnv === 'ref') {
return config.urls.ref
} else {
return config.urls.dev
}
}
} | javascript | {
"resource": ""
} |
q7386 | Reserved | train | function Reserved(value, parameters) {
abstractions.Element.call(this, utilities.types.RESERVED, parameters);
if (!value || !/^[a-zA-Z][0-9a-zA-Z]*(-[0-9]+)?$/g.test(value)) {
throw new utilities.Exception({
$module: '/bali/elements/Reserved',
$procedure: '$Reserved',
... | javascript | {
"resource": ""
} |
q7387 | Scope | train | function Scope(parent) {
var map = Object.create(null);
var api = {};
api.markAsUsed = function(k) {
if (typeof k !== "string") {
throw new Error("Scope keys must be strings: " + k);
}
if (api.hasOwnVar(k)) {
map[k].used = true;
return api;
}
if (parent) {
return parent... | javascript | {
"resource": ""
} |
q7388 | train | function (params, userId) {
console.log('ecInterface.paymentmethod.add');
return this.request({
url: this._buildUri(this.uri, null, null, userId),
method: corbel.request.method.POST,
data: params
})
.then(function (res) {
return corbel.Services.getLoc... | javascript | {
"resource": ""
} | |
q7389 | train | function (params) {
console.log('ecInterface.paymentmethod.update');
return this.request({
url: this._buildUri(this.uri),
method: corbel.request.method.PUT,
data: params
})
.then(function (res) {
return corbel.Services.getLocationId(res);
});
... | javascript | {
"resource": ""
} | |
q7390 | matchImmediate | train | function matchImmediate(el, match) {
var matched = 1, startEl = el, relativeOp, startMatch = match;
do {
matched &= singleMatch(el, match);
if (matched) {
// advance
match = match && match.prev;
if (!match) {
ret... | javascript | {
"resource": ""
} |
q7391 | findFixedMatchFromHead | train | function findFixedMatchFromHead(el, head) {
var relativeOp, cur = head;
do {
if (!singleMatch(el, cur)) {
return null;
}
cur = cur.prev;
if (!cur) {
return true;
}
relativeOp = relativeExpr[cur.nextCo... | javascript | {
"resource": ""
} |
q7392 | matchSubInternal | train | function matchSubInternal(el, match) {
var matchImmediateRet = matchImmediate(el, match);
if (matchImmediateRet === true) {
return true;
} else {
el = matchImmediateRet.el;
match = matchImmediateRet.match;
while (el) {
if (matchSub(... | javascript | {
"resource": ""
} |
q7393 | getVendorInfo | train | function getVendorInfo(name) {
if (name.indexOf('-') !== -1) {
name = name.replace(RE_DASH, upperCase);
}
if (name in vendorInfos) {
return vendorInfos[name];
} // if already prefixed or need not to prefix
// if already prefixed or need not to prefix
... | javascript | {
"resource": ""
} |
q7394 | train | function () {
if (isTransform3dSupported !== undefined) {
return isTransform3dSupported;
}
if (!documentElement || !getVendorInfo('transform')) {
isTransform3dSupported = false;
} else {
// https://gist.github.com/lorenzopol... | javascript | {
"resource": ""
} | |
q7395 | JekyllUrl | train | function JekyllUrl (options) {
options = options || {};
this.template = options.template;
this.placeholders = options.placeholders;
this.permalink = options.permalink;
if (!this.template) {
throw new Error('One of template or permalink must be supplied.');
}
} | javascript | {
"resource": ""
} |
q7396 | train | function (item, index) {
var self = this, bar = self.get('bar'), selectedTab, tabItem, panelItem, barChildren = bar.get('children'), body = self.get('body');
if (typeof index === 'undefined') {
index = barChildren.length;
}
tabItem = fr... | javascript | {
"resource": ""
} | |
q7397 | train | function (index, destroy) {
var self = this, bar = /**
@ignore
@type KISSY.Component.Control
*/
self.get('bar'), barCs = bar.get('children'), tab = bar.getChildAt(index), body = /**
@ignore
@type KISSY.Component.Control... | javascript | {
"resource": ""
} | |
q7398 | train | function (tab, destroy) {
var index = util.indexOf(tab, this.get('bar').get('children'));
return this.removeItemAt(index, destroy);
} | javascript | {
"resource": ""
} | |
q7399 | train | function (panel, destroy) {
var index = util.indexOf(panel, this.get('body').get('children'));
return this.removeItemAt(index, destroy);
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.