_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q55600 | byday | train | function byday(rules, dt, after) {
if(!rules || !rules.length) return dt;
// Generate a list of candiDATES. (HA!)
var candidates = rules.map(function(rule) {
// Align on the correct day of the week...
var days = rule[1]-wkday(dt);
if(days < 0) days += 7;
var newdt = add_d(ne... | javascript | {
"resource": ""
} |
q55601 | toStr | train | function toStr(next) {
var stream = new Writable();
var str = "";
stream.write = function(chunk) {
str += (chunk);
};
stream.end = function() {
next(str);
};
return stream;
} | javascript | {
"resource": ""
} |
q55602 | updateYear | train | function updateYear(context) {
return context.dateRange
? utils.updateYear(context.dateRange, String(utils.year()))
: utils.year();
} | javascript | {
"resource": ""
} |
q55603 | updateCopyright | train | function updateCopyright(str, context, options) {
if (typeof str !== 'string') {
options = context;
context = str;
str = null;
}
var opts = utils.merge({template: template, copyright: ''}, options);
var pkg = opts.pkg || utils.loadPkg.sync(process.cwd());
var engine = new utils.Engine(opts);
/... | javascript | {
"resource": ""
} |
q55604 | _exec | train | function _exec(command, args = [], options = {}) {
return new Promise((fulfill, reject) => spawn(normalize(command), args, {shell: true, stdio: 'inherit', ...options})
.on('close', code => code ? reject(new Error(`${command}: ${code}`)) : fulfill())
);
} | javascript | {
"resource": ""
} |
q55605 | create | train | function create(store, url, data, headers, options) {
return exports.config.storeFetch({
data: data,
method: 'POST',
options: __assign({}, options, { headers: headers }),
store: store,
url: url,
});
} | javascript | {
"resource": ""
} |
q55606 | remove | train | function remove(store, url, headers, options) {
return exports.config.storeFetch({
data: null,
method: 'DELETE',
options: __assign({}, options, { headers: headers }),
store: store,
url: url,
});
} | javascript | {
"resource": ""
} |
q55607 | fetchLink | train | function fetchLink(link, store, requestHeaders, options) {
if (link) {
var href = typeof link === 'object' ? link.href : link;
/* istanbul ignore else */
if (href) {
return read(store, href, requestHeaders, options);
}
}
return Promise.resolve(new Response_1.Respo... | javascript | {
"resource": ""
} |
q55608 | mapItems | train | function mapItems(data, fn) {
return data instanceof Array ? data.map(function (item) { return fn(item); }) : fn(data);
} | javascript | {
"resource": ""
} |
q55609 | flattenRecord | train | function flattenRecord(record) {
var data = {
__internal: {
id: record.id,
type: record.type,
},
};
objectForEach(record.attributes, function (key) {
data[key] = record.attributes[key];
});
objectForEach(record.relationships, function (key) {
v... | javascript | {
"resource": ""
} |
q55610 | keys | train | function keys(obj) {
var keyList = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
keyList.push(key);
}
}
return keyList;
} | javascript | {
"resource": ""
} |
q55611 | wrap | train | function wrap(superagent, Promise) {
/**
* Request object similar to superagent.Request, but with end() returning
* a promise.
*/
function PromiseRequest() {
superagent.Request.apply(this, arguments);
}
// Inherit form superagent.Request
PromiseRequest.prototype = Object.create(superagent.Reques... | javascript | {
"resource": ""
} |
q55612 | encode | train | function encode (samples, durations, cb) {
var agent = samples.length > 0 ? samples[0]._agent : null
var transactions = groupTransactions(samples, durations)
var traces = [].concat.apply([], samples.map(function (trans) {
return trans.traces
}))
var groups = groupTraces(traces)
var raw = rawTransactions... | javascript | {
"resource": ""
} |
q55613 | wrapInitPromise | train | function wrapInitPromise (original) {
return function wrappedInitPromise () {
var command = this
var cb = this.callback
if (typeof cb === 'function') {
this.callback = agent._instrumentation.bindFunction(function wrappedCallback () {
var trace = command.__obTrace
if (t... | javascript | {
"resource": ""
} |
q55614 | promisify | train | function promisify(repl) {
var _eval = repl.eval;
repl.eval = function(cmd, context, filename, callback) {
_eval.call(repl, cmd, context, filename, function(err, res) {
if (isPromiseLike(res)) {
res.then(function(ret) {
callback(null, ret);
}, function(err) {
callback(e... | javascript | {
"resource": ""
} |
q55615 | defineBuiltinVars | train | function defineBuiltinVars(context) {
// define salesforce package root objects
for (var key in sf) {
if (sf.hasOwnProperty(key) && !global[key]) {
context[key] = sf[key];
}
}
// expose salesforce package root as "$sf" in context.
context.$sf = sf;
// create default connection object
var co... | javascript | {
"resource": ""
} |
q55616 | train | function(conn) {
this._conn = conn;
this._logger = conn._logger;
var delegates = [
"query",
"queryMore",
"create",
"insert",
"retrieve",
"update",
"upsert",
"del",
"delete",
"destroy",
"describe",
"describeGlobal",
"sobject"
];
delegates.forEach(function(met... | javascript | {
"resource": ""
} | |
q55617 | train | function() {
source.removeListener('record', onRecord);
dest.removeListener('drain', onDrain);
source.removeListener('end', onEnd);
source.removeListener('close', onClose);
source.removeListener('error', onError);
dest.removeListener('error', onError);
source.removeListener('end', cleanup... | javascript | {
"resource": ""
} | |
q55618 | promisedRequest | train | function promisedRequest(params, callback) {
var deferred = Promise.defer();
var req;
var createRequest = function() {
if (!req) {
req = request(params, function(err, response) {
if (err) {
deferred.reject(err);
} else {
deferred.resolve(response);
}
});... | javascript | {
"resource": ""
} |
q55619 | setCulprit | train | function setCulprit (payload) {
if (payload.culprit) return // skip if user provided a custom culprit
var frames = payload.stacktrace.frames
var filename = frames[0].filename
var fnName = frames[0].function
for (var n = 0; n < frames.length; n++) {
if (frames[n].in_app) {
filename = frames[n].filena... | javascript | {
"resource": ""
} |
q55620 | capturePayload | train | function capturePayload (endpoint, payload) {
var dumpfile = path.join(os.tmpdir(), 'opbeat-' + endpoint + '-' + Date.now() + '.json')
fs.writeFile(dumpfile, JSON.stringify(payload), function (err) {
if (err) console.log('could not capture intake payload: %s', err.message)
else console.log('intake payload c... | javascript | {
"resource": ""
} |
q55621 | tryRead | train | function tryRead(fd, buff, offset, length) {
return new Promise((resolve, reject) => {
fs.read(fd, buff, offset, length, null, (err, bytesRead, buffer) => {
if (err) return reject(err);
const buffLen = buffer.length;
offset += bytesRead;
if (offset >= buffLen) return resolve(buff);
i... | javascript | {
"resource": ""
} |
q55622 | Modal | train | function Modal(config) {
this.config = config;
this.timers_ = [];
this.scrollY = 0;
this.initDom_();
var closeAttribute = 'data-' + this.config.className + '-x';
var closeClass = this.config.className + '-x';
var data = 'data-' + this.config.className + '-id';
var func = function(targetEl, e) {
va... | javascript | {
"resource": ""
} |
q55623 | init | train | function init(opt_config) {
if (modalInstance) {
return;
}
var config = objects.clone(defaultConfig);
if (opt_config) {
objects.merge(config, opt_config);
}
modalInstance = new Modal(config);
} | javascript | {
"resource": ""
} |
q55624 | start | train | function start() {
if (isStarted()) {
return;
}
// Debounce the scroll event by executing the onScroll callback using a timed
// interval.
window.addEventListener('scroll', onScroll_, {'passive': true});
interval = window.setInterval(function() {
if (scrolled) {
for (var i = 0, delegate; dele... | javascript | {
"resource": ""
} |
q55625 | getParameterValue | train | function getParameterValue(key, opt_uri) {
var uri = opt_uri || window.location.href;
key = key.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
var regex = new RegExp('[\\?&]' + key + '=([^&#]*)');
var results = regex.exec(uri);
var result = results === null ? null : results[1];
return result ? urlDecode_(... | javascript | {
"resource": ""
} |
q55626 | updateParamsFromUrl | train | function updateParamsFromUrl(config) {
// If there is no query string in the URL, then there's nothing to do in this
// function, so break early.
if (!location.search) {
return;
}
var c = objects.clone(UpdateParamsFromUrlDefaultConfig);
objects.merge(c, config);
var selector = c.selector;
var attr ... | javascript | {
"resource": ""
} |
q55627 | parseQueryString | train | function parseQueryString(query, callback) {
// Break early for empty string.
if (!query) {
return;
}
// Remove leading `?` so that callers can pass `location.search` directly to
// this function.
if (query.startsWith('?')) {
query = query.slice(1);
}
var pairs = query.split('&');
for (var i ... | javascript | {
"resource": ""
} |
q55628 | parseQueryMap | train | function parseQueryMap(query) {
var map = {};
parseQueryString(query, function(key, value) {
map[key] = value;
});
return map;
} | javascript | {
"resource": ""
} |
q55629 | encodeQueryMap | train | function encodeQueryMap(map) {
var params = [];
for (var key in map) {
var value = map[key];
params.push(key + '=' + urlEncode_(value));
}
return params.join('&');
} | javascript | {
"resource": ""
} |
q55630 | initStyle | train | function initStyle(opt_config) {
var config = objects.clone(defaultConfig);
if (opt_config) {
objects.merge(config, opt_config);
}
var attrName = config.attributeName;
var selector = '[' + attrName + ']';
var rules = {};
rules[selector] = {'display': 'none !important'};
ui.createStyle(rules);
} | javascript | {
"resource": ""
} |
q55631 | getDelegateFunction_ | train | function getDelegateFunction_(listener) {
if (!delegateFunctionMap.has(listener)) {
var delegateFunction =
function(e) {
e = e || window.event;
var target = e.target || e.srcElement;
target = target.nodeType === 3 ? target.parentNode : target;
do {
listener(target, ... | javascript | {
"resource": ""
} |
q55632 | addDelegatedListener | train | function addDelegatedListener(el, type, listener) {
incrementListenerCount(listener);
return el.addEventListener(type, getDelegateFunction_(listener));
} | javascript | {
"resource": ""
} |
q55633 | removeDelegatedListener | train | function removeDelegatedListener(el, type, listener) {
var delegate = getDelegateFunction_(listener);
decrementListenerCount(listener);
if (getListenerCount(listener) <= 0) {
delegateFunctionMap.delete(listener);
}
return el.removeEventListener(type, delegate);
} | javascript | {
"resource": ""
} |
q55634 | train | function(selector, opt_offset, opt_delay) {
this.selector = selector;
this.offset = opt_offset || null;
this.delay = opt_delay || 0;
// Ensure all videos are loaded.
var els = document.querySelectorAll(this.selector);
[].forEach.call(els, function(el) {
el.load();
});
} | javascript | {
"resource": ""
} | |
q55635 | Variable | train | function Variable(name, scope) {
/**
* The variable name, as given in the source code.
* @member {String} Variable#name
*/
this.name = name;
/**
* List of defining occurrences of this variable (like in 'var ...'
* statements or as parameter), as AS... | javascript | {
"resource": ""
} |
q55636 | YouTubeModal | train | function YouTubeModal(config) {
this.config = config;
this.parentElement = document.querySelector(this.config.parentSelector);
this.closeEventListener_ = this.setActive_.bind(this, false);
this.popstateListener_ = this.onHistoryChange_.bind(this);
this.el_ = null;
this.closeEl_ = null;
this.attributionEl_... | javascript | {
"resource": ""
} |
q55637 | init | train | function init(opt_config) {
if (singleton) {
return;
}
var config = objects.clone(defaultConfig);
if (opt_config) {
objects.merge(config, opt_config);
}
singleton = new YouTubeModal(config);
} | javascript | {
"resource": ""
} |
q55638 | init | train | function init(opt_config) {
var config = objects.clone(defaultConfig);
if (opt_config) {
objects.merge(config, opt_config);
}
initVariations(config);
} | javascript | {
"resource": ""
} |
q55639 | processStagingResp | train | function processStagingResp(resp, now, evergreen) {
var keysToData = {};
for (var key in resp) {
[].forEach.call(resp[key], function(datedRow) {
var start = datedRow['start_date'] ? new Date(datedRow['start_date']) : null;
var end = datedRow['end_date'] ? new Date(datedRow['end_date']) : null;
... | javascript | {
"resource": ""
} |
q55640 | compilejs | train | function compilejs(sources, outdir, outfile, opt_options) {
var bundler = browserify({
entries: sources,
debug: false
});
return rebundle_(bundler, outdir, outfile, opt_options);
} | javascript | {
"resource": ""
} |
q55641 | watchjs | train | function watchjs(sources, outdir, outfile, opt_options) {
var bundler = watchify(browserify({
entries: sources,
debug: false,
// Watchify options:
cache: {},
packageCache: {},
fullPaths: true
}));
bundler.on('update', function() {
gutil.log('recompiling js...');
rebundle_(bundler,... | javascript | {
"resource": ""
} |
q55642 | createDom | train | function createDom(tagName, opt_className) {
var element = document.createElement(tagName);
if (opt_className) {
element.className = opt_className;
}
return element;
} | javascript | {
"resource": ""
} |
q55643 | ScrollToggle | train | function ScrollToggle(el, config) {
this.el_ = el;
this.config_ = objects.clone(config);
if (this.el_.hasAttribute('data-ak-scrolltoggle')) {
var elConfig = JSON.parse(this.el_.getAttribute('data-ak-scrolltoggle'));
if (elConfig && typeof elConfig === 'object') {
objects.merge(this.config_, elConfi... | javascript | {
"resource": ""
} |
q55644 | GoogleOAuth2Strategy | train | function GoogleOAuth2Strategy(options, verify) {
var self = this;
if (typeof options === 'function') {
verify = options;
options = {};
}
if (!verify) {
throw new Error('GoogleOAuth2Strategy requires a verify callback');
}
requiredArgs... | javascript | {
"resource": ""
} |
q55645 | initVideoFallback | train | function initVideoFallback(opt_config) {
var videoSelector = (opt_config && opt_config.videoSelector)
|| defaultConfig.fallbackVideoSelector;
var imageSelector = (opt_config && opt_config.imageSelector)
|| defaultConfig.fallbackImageSelector;
var breakpoint = (opt_config && opt_config.breakpoint)
... | javascript | {
"resource": ""
} |
q55646 | adjustRect | train | function adjustRect(rect, adjustX, adjustY, ev) {
// if pageX or pageY is defined we need to lock the popover to the given
// x and y position.
// clone the rect, so we can manipulate its properties.
var localRect = {
bottom: rect.bottom,
... | javascript | {
"resource": ""
} |
q55647 | loadTemplate | train | function loadTemplate(template, plain) {
if (!template) {
return '';
}
if (angular.isString(template) && plain) {
return template;
}
return $templateCache.get(template) || $http.get(template, { cache : true });
... | javascript | {
"resource": ""
} |
q55648 | move | train | function move(popover, placement, align, rect, triangle) {
var containerRect;
var popoverRect = getBoundingClientRect(popover[0]);
var popoverRight;
var top, left;
var positionX = function() {
if (align === 'center') {
re... | javascript | {
"resource": ""
} |
q55649 | train | function(delay, e) {
// Disable popover if ns-popover value is false
if ($parse(attrs.nsPopover)(scope) === false) {
return;
}
$timeout.cancel(displayer_.id_);
if (!isDef(delay)) {
delay = 0;
... | javascript | {
"resource": ""
} | |
q55650 | train | function(delay) {
$timeout.cancel(hider_.id_);
// do not hide if -1 is passed in.
if(delay !== "-1") {
// delay the hiding operation for 1.5s by default.
if (!isDef(delay)) {
delay = 1.5;
}
... | javascript | {
"resource": ""
} | |
q55651 | extract | train | function extract(
pattern /* : string */,
babelPlugins /* : Array<string> */ = []
) /* : string */ {
const srcPaths = glob.sync(pattern, { absolute: true });
const relativeSrcPaths = glob.sync(pattern);
const contents = srcPaths.map(p => fs.readFileSync(p, 'utf-8'));
const reqBabelPlugins = babelPlugins.map... | javascript | {
"resource": ""
} |
q55652 | trackBackgroundProc | train | function trackBackgroundProc() {
runningProcs.push(proc);
proc.on('close', function () {
remove(runningProcs, proc);
clearPid(name);
grunt.log.debug('Process ' + name + ' closed.');
});
} | javascript | {
"resource": ""
} |
q55653 | waitForReadyOutput | train | function waitForReadyOutput() {
function onCloseBeforeReady(exitCode) {
done(exitCode && new Error('non-zero exit code ' + exitCode));
}
let outputBuffer = '';
function checkChunkForReady(chunk) {
outputBuffer += chunk.toString('utf8');
// ensure the buffer doesn't gro... | javascript | {
"resource": ""
} |
q55654 | Lexer | train | function Lexer(str, options) {
options = options || {};
if (typeof str !== 'string') {
throw new Error('Expected source code to be a string but got "' + (typeof str) + '"')
}
if (typeof options !== 'object') {
throw new Error('Expected "options" to be an object but got "' + (typeof options) + '"')
}
... | javascript | {
"resource": ""
} |
q55655 | train | function(type, val){
var res = {type: type, line: this.lineno, col: this.colno};
if (val !== undefined) res.val = val;
return res;
} | javascript | {
"resource": ""
} | |
q55656 | train | function(regexp, type){
var captures;
if (captures = regexp.exec(this.input)) {
var len = captures[0].length;
var val = captures[1];
var diff = len - (val ? val.length : 0);
var tok = this.tok(type, val);
this.consume(len);
this.incrementColumn(diff);
return tok;
}
... | javascript | {
"resource": ""
} | |
q55657 | train | function() {
if (this.input.length) return;
if (this.interpolated) {
this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.');
}
for (var i = 0; this.indentStack[i]; i++) {
this.tokens.push(this.tok('outdent'));
}
this.tokens.push(this.tok('e... | javascript | {
"resource": ""
} | |
q55658 | train | function() {
if (/^#\{/.test(this.input)) {
var match = this.bracketExpression(1);
this.consume(match.end + 1);
var tok = this.tok('interpolation', match.src);
this.tokens.push(tok);
this.incrementColumn(2); // '#{'
this.assertExpression(match.src);
var splitted = match.sr... | javascript | {
"resource": ""
} | |
q55659 | train | function() {
var captures;
if (captures = /^(?:block +)?prepend +([^\n]+)/.exec(this.input)) {
var name = captures[1].trim();
var comment = '';
if (name.indexOf('//') !== -1) {
comment = '//' + name.split('//').slice(1).join('//');
name = name.split('//')[0].trim();
}
... | javascript | {
"resource": ""
} | |
q55660 | train | function(){
var tok, captures, increment;
if (captures = /^\+(\s*)(([-\w]+)|(#\{))/.exec(this.input)) {
// try to consume simple or interpolated call
if (captures[3]) {
// simple call
increment = captures[0].length;
this.consume(increment);
tok = this.tok('call', cap... | javascript | {
"resource": ""
} | |
q55661 | train | function() {
var tok
if (tok = this.scanEndOfLine(/^-/, 'blockcode')) {
this.tokens.push(tok);
this.interpolationAllowed = false;
this.callLexerFunction('pipelessText');
return true;
}
} | javascript | {
"resource": ""
} | |
q55662 | train | function() {
var captures = this.scanIndentation();
if (captures) {
var indents = captures[1].length;
this.incrementLine(1);
this.consume(indents + 1);
if (' ' == this.input[0] || '\t' == this.input[0]) {
this.error('INVALID_INDENTATION', 'Invalid indentation, you can use tabs... | javascript | {
"resource": ""
} | |
q55663 | AerospikeStore | train | function AerospikeStore (options) {
if (!(this instanceof AerospikeStore)) {
throw new TypeError('Cannot call AerospikeStore constructor as a function')
}
options = options || {}
Store.call(this, options)
this.as_namespace = options.namespace || 'test'
this.as_set = options.set || 'expre... | javascript | {
"resource": ""
} |
q55664 | train | function(json, name, type) {
if (json && json.widget) {
var nodes = json.widget[type];
if (!!nodes && isArray(nodes)) {
for (var i = 0; i < nodes.length; i++) {
if (nameIsMatch(nodes[i], name)) {
return true;
}
}
}
}
return false;
} | javascript | {
"resource": ""
} | |
q55665 | isCollationValid | train | function isCollationValid(collation) {
let isValid = true;
_.forIn(collation, function(value, key) {
const itemIndex = _.findIndex(COLLATION_OPTIONS, key);
if (itemIndex === -1) {
debug('Collation "%s" is invalid bc of its keys', collation);
isValid = false;
}
if (COLLATION_OPTIONS[itemI... | javascript | {
"resource": ""
} |
q55666 | normalizeIdentifier | train | function normalizeIdentifier(identifier) {
if (identifier === ".") {
// '.' might be referencing either the root or a locally scoped variable
// called '.'. So try for the locally scoped variable first and then
// default to the root
return "(data['.'] || data)";
}
return "data" + i... | javascript | {
"resource": ""
} |
q55667 | Compiler | train | function Compiler(tree) {
this.tree = tree;
this.string = "";
// Optimization pass will flatten large templates to result in faster
// rendering.
var nodes = this.optimize(this.tree.nodes);
var compiledSource = this.process(nodes);
// The compiled function body.
var body = [];
// ... | javascript | {
"resource": ""
} |
q55668 | parseProperty | train | function parseProperty(value) {
var retVal = {
type: "Property",
value: value
};
if (value === "false" || value === "true") {
retVal.type = "Literal";
}
// Easy way to determine if the value is NaN or not.
else if (Number(value) === Number(value)) {
retVal.type = "Litera... | javascript | {
"resource": ""
} |
q55669 | Combyne | train | function Combyne(template, data) {
// Allow this method to run standalone.
if (!(this instanceof Combyne)) {
return new Combyne(template, data);
}
// Expose the template for easier accessing and mutation.
this.template = template;
// Default the data to an empty object.
this.data = d... | javascript | {
"resource": ""
} |
q55670 | getFilter | train | function getFilter(name) {
if (name in this._filters) {
return this._filters[name];
}
else if (this._parent) {
return this._parent.getFilter(name);
}
throw new Error("Missing filter " + name);
} | javascript | {
"resource": ""
} |
q55671 | encode | train | function encode(raw) {
if (type(raw) !== "string") {
return raw;
}
// Identifies all characters in the unicode range: 00A0-9999, ampersands,
// greater & less than) with their respective html entity.
return raw.replace(/["&'<>`]/g, function(match) {
return "&#" + match.charCodeAt(0) + ... | javascript | {
"resource": ""
} |
q55672 | Grammar | train | function Grammar(delimiters) {
this.delimiters = delimiters;
this.internal = [
makeEntry("START_IF", "if"),
makeEntry("ELSE", "else"),
makeEntry("ELSIF", "elsif"),
makeEntry("END_IF", "endif"),
makeEntry("NOT", "not"),
makeEntry("EQUALITY", "=="),
makeEntry("NOT_EQUALI... | javascript | {
"resource": ""
} |
q55673 | makeEntry | train | function makeEntry(name, value) {
var escaped = escapeDelimiter(value);
return {
name: name,
escaped: escaped,
test: new RegExp("^" + escaped)
};
} | javascript | {
"resource": ""
} |
q55674 | getPartial | train | function getPartial(name) {
if (name in this._partials) {
return this._partials[name];
}
else if (this._parent) {
return this._parent.getPartial(name);
}
throw new Error("Missing partial " + name);
} | javascript | {
"resource": ""
} |
q55675 | parseNextToken | train | function parseNextToken(template, grammar, stack) {
grammar.some(function(token) {
var capture = token.test.exec(template);
// Ignore empty captures.
if (capture && capture[0]) {
template = template.replace(token.test, "");
stack.push({ name: token.name, capture: capture });
... | javascript | {
"resource": ""
} |
q55676 | randomBytesSync | train | function randomBytesSync (size) {
var err = null
for (var i = 0; i < GENERATE_ATTEMPTS; i++) {
try {
return crypto.randomBytes(size)
} catch (e) {
err = e
}
}
throw err
} | javascript | {
"resource": ""
} |
q55677 | train | function (div) {
var visWidget = vis.views[vis.activeView].widgets[barsIntern.wid];
if (visWidget === undefined) {
for (var view in vis.views) {
if (view === '___settings') continue;
if (vis.views[view].widgets[barsIntern.wid]) {
visW... | javascript | {
"resource": ""
} | |
q55678 | checkForIdAndData | train | function checkForIdAndData(object, callback) {
var id = object[options.idProperty]
, foundObject
if (id === undefined || id === null) {
return callback(new Error('Object has no \''
+ options.idProperty + '\' property'))
}
foundObject = findById(id)
if (foundObject === null) {
... | javascript | {
"resource": ""
} |
q55679 | create | train | function create(object, callback) {
self.emit('create', object)
callback = callback || emptyFn
// clone the object
var extendedObject = extend({}, object)
if (!extendedObject[options.idProperty]) {
idSeq += 1
extendedObject[options.idProperty] = '' + idSeq
} else {
if (findByI... | javascript | {
"resource": ""
} |
q55680 | createOrUpdate | train | function createOrUpdate(object, callback) {
if (typeof object[options.idProperty] === 'undefined') {
// Create a new object
self.create(object, callback)
} else {
// Try and find the object first to update
var query = {}
query[options.idProperty] = object[options.idProperty]
... | javascript | {
"resource": ""
} |
q55681 | read | train | function read(id, callback) {
var query = {}
self.emit('read', id)
callback = callback || emptyFn
query[options.idProperty] = '' + id
findByQuery(query, {}, function (error, objects) {
if (objects[0] !== undefined) {
var cloned = extend({}, objects[0])
self.emit('received', cl... | javascript | {
"resource": ""
} |
q55682 | update | train | function update(object, overwrite, callback) {
if (typeof overwrite === 'function') {
callback = overwrite
overwrite = false
}
self.emit('update', object, overwrite)
callback = callback || emptyFn
var id = '' + object[options.idProperty]
, updatedObject
checkForIdAndData(objec... | javascript | {
"resource": ""
} |
q55683 | deleteMany | train | function deleteMany(query, callback) {
callback = callback || emptyFn
self.emit('deleteMany', query)
data = Mingo.remove(data, query)
self.emit('afterDeleteMany', query)
callback()
} | javascript | {
"resource": ""
} |
q55684 | del | train | function del(id, callback) {
callback = callback || emptyFn
if (typeof callback !== 'function') {
throw new TypeError('callback must be a function or empty')
}
self.emit('delete', id)
var query = {}
query[ options.idProperty ] = id
deleteMany(query, function() {
self.emit('aft... | javascript | {
"resource": ""
} |
q55685 | findByQuery | train | function findByQuery(query, options, callback) {
if (typeof options === 'function') {
callback = options
options = {}
}
var cursor = Mingo.find(data, query, options && options.fields)
if (options && options.sort) cursor = cursor.sort(options.sort)
if (options && options.limit) cursor =... | javascript | {
"resource": ""
} |
q55686 | find | train | function find(query, options, callback) {
if (typeof options === 'function') {
callback = options
options = {}
}
self.emit('find', query, options)
if (callback !== undefined) {
findByQuery(query, options, function(error, data) {
if (error) return callback(error)
self.e... | javascript | {
"resource": ""
} |
q55687 | findOne | train | function findOne(query, options, callback) {
if (typeof options === 'function') {
callback = options
options = {}
}
self.emit('findOne', query, options)
findByQuery(query, options, function (error, objects) {
self.emit('received', objects[0])
callback(undefined, objects[0])
}... | javascript | {
"resource": ""
} |
q55688 | count | train | function count(query, callback) {
self.emit('count', query)
findByQuery(query, options, function (error, objects) {
self.emit('received', objects.length)
callback(undefined, objects.length)
})
} | javascript | {
"resource": ""
} |
q55689 | getTeamCityOutput | train | function getTeamCityOutput(results, propNames) {
const config = getUserConfig(propNames || {});
if (process.env.ESLINT_TEAMCITY_DISPLAY_CONFIG) {
console.info(`Running ESLint Teamcity with config: ${JSON.stringify(config, null, 4)}`);
}
let outputMessages = [];
switch (config.reporter.toLowerCase()) {
... | javascript | {
"resource": ""
} |
q55690 | processNodeContentWithPosthtml | train | function processNodeContentWithPosthtml(node, options) {
return function (content) {
return processWithPostHtml(options.plugins, path.join(path.dirname(options.from), node.attrs.href), content, [function (tree) {
// remove <content> tags and replace them with node's content
return tree.match(match('content'), ... | javascript | {
"resource": ""
} |
q55691 | handleMouseDown | train | function handleMouseDown (e) {
if(enabled){
for (var i= 0; i<excludedClasses.length; i++) {
if (angular.element(e.target).hasClass(excludedClasses[i])) {
return false;
}
... | javascript | {
"resource": ""
} |
q55692 | handleMouseUp | train | function handleMouseUp (e) {
if(enabled){
var selectable = (e.target.attributes && 'drag-scroll-text' in e.target.attributes);
var withinXConstraints = (e.clientX >= (startClientX - allowedClickOffset) && e.clientX <= (startClientX + allowedClickOffset... | javascript | {
"resource": ""
} |
q55693 | handleMouseMove | train | function handleMouseMove (e) {
if(enabled){
if (pushed) {
if(!axis || axis === 'x') {
$element[0].scrollLeft -= (-lastClientX + (lastClientX = e.clientX));
}
if... | javascript | {
"resource": ""
} |
q55694 | destroy | train | function destroy () {
$element.off('mousedown', handleMouseDown);
angular.element($window).off('mouseup', handleMouseUp);
angular.element($window).off('mousemove', handleMouseMove);
} | javascript | {
"resource": ""
} |
q55695 | selectText | train | function selectText (element) {
var range;
if ($window.document.selection) {
range = $window.document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if ($... | javascript | {
"resource": ""
} |
q55696 | clearSelection | train | function clearSelection () {
if ($window.getSelection) {
if ($window.getSelection().empty) { // Chrome
$window.getSelection().empty();
} else if ($window.getSelection().removeAllRanges) { // Firefox
... | javascript | {
"resource": ""
} |
q55697 | deepExtend | train | function deepExtend(destination) {
angular.forEach(arguments, function (obj) {
if (obj !== destination) {
angular.forEach(obj, function (value, key) {
if (destination[key] && destination[key].constructor && destination[key].constructor === Object) {
deepExtend... | javascript | {
"resource": ""
} |
q55698 | checkUrl | train | function checkUrl(url, resourceName, hrefKey) {
if (url == undefined || !url) {
throw new Error("The provided resource name '" + resourceName + "' has no valid URL in the '" +
hrefKey + "' property.");
}
return url
} | javascript | {
"resource": ""
} |
q55699 | getFontFeatureSettingsPrevTo | train | function getFontFeatureSettingsPrevTo(decl) {
var fontFeatureSettings = null;
decl.parent.walkDecls(function(decl) {
if (decl.prop === "font-feature-settings") {
fontFeatureSettings = decl;
}
})
if (fontFeatureSettings === null) {
fontFeatureSettings = decl.clone()
fontFeatureSettings.pro... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.