_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q40600 | convertTrees | train | function convertTrees() {
setDefault("treeClass","mktree");
setDefault("nodeClosedClass","liClosed");
setDefault("nodeOpenClass","liOpen");
setDefault("nodeBulletClass","liBullet");
setDefault("nodeLinkClass","bullet");
setDefault("preProcessTrees",true);
if (preProcessTrees) {
if (!document.createElement) { r... | javascript | {
"resource": ""
} |
q40601 | processList | train | function processList(ul) {
if ( ul.getAttribute( "data-xdh-mktree" ) == "handled" )
return;
if (!ul.childNodes || ul.childNodes.length==0) { return; }
// Iterate LIs
var childNodesLength = ul.childNodes.length;
for (var itemi=0;itemi<childNodesLength;itemi++) {
var item = ul.childNodes[itemi];
if (item.nod... | javascript | {
"resource": ""
} |
q40602 | gitDateOf | train | function gitDateOf(val) {
let date = null;
try {
date = exec(`git log -1 --format=%cI ${val}`).toString();
} catch (err) {
return new Error(err);
}
return date.substring(0, date.indexOf('T'));
} | javascript | {
"resource": ""
} |
q40603 | train | function(text){
var deferred = Q.defer();
r.question(text, function(answer) {
deferred.resolve(answer);
});
return deferred.promise;
} | javascript | {
"resource": ""
} | |
q40604 | castType | train | function castType(val, type, def) {
function cast() {
if (!is_1.isValue(val))
return to_1.toDefault(null, def);
// If no type specified try to get automatically.
type = type || getType(val);
if (is_1.isArray(type)) {
return to_1.toArray(val)
.m... | javascript | {
"resource": ""
} |
q40605 | getType | train | function getType(val, strict, def) {
if (is_1.isString(strict)) {
def = strict;
strict = undefined;
}
var type = typeof val;
var parse = !is_1.isValue(strict) ? true : false;
function isKnown() {
return (type === 'undefined' ||
(type !== 'object' &&
... | javascript | {
"resource": ""
} |
q40606 | ensureLoader | train | function ensureLoader (lang) {
return lang.split('!').map(function (loader) {
return loader.replace(/^([\w-]+)(\?.*)?/, function (_, name, query) {
return (/-loader$/.test(name) ? name : (name + '-loader')) + (query || '')
})
}).join('!')
} | javascript | {
"resource": ""
} |
q40607 | train | function (opt) {
if (typeof opt !== "object" || opt === null) {
opt = {};
}
if (typeof opt.tag !== "string") {
opt.tag = null;
}
if (typeof opt.encoding !== "string") {
opt.encoding = "utf8";
}
//Extends the readable stream
stream.Readable.call(this, {encoding: o... | javascript | {
"resource": ""
} | |
q40608 | is | train | function is(type, input) {
if (type === 'Object') return Object(input) === input;
return toString.call(input) === '[object ' + type + ']';
} | javascript | {
"resource": ""
} |
q40609 | str | train | function str(input) {
if (!is('String', input)) return;
return root[input] || (root.require || require)(input);
} | javascript | {
"resource": ""
} |
q40610 | removeClass | train | function removeClass(element, className) {
if (!hasClassNameProperty(element)) {
return;
}
element.className = element.className
.replace(className, '')
.replace(/^\s+|\s+$/g, '')
.replace(/\s\s/g, ' ');
} | javascript | {
"resource": ""
} |
q40611 | normalizeOptions | train | function normalizeOptions(obj) {
for (var key in obj) {
if (utils.optsKeys.indexOf(key) > -1) {
obj.options = obj.options || {};
obj.options[key] = obj[key];
delete obj[key];
}
}
return obj;
} | javascript | {
"resource": ""
} |
q40612 | toObject | train | function toObject(src, dest, options) {
if (!utils.isObject(options)) {
options = {};
}
var config = {};
if (utils.isObject(dest)) {
options = extend({}, options, dest);
dest = null;
}
if (utils.isObject(src)) {
config = src;
}
if (isValidSrc(src)) {
config.src = src;
} else if ... | javascript | {
"resource": ""
} |
q40613 | normalizeSrc | train | function normalizeSrc(val) {
if (!val.src) return val;
val.src = utils.arrayify(val.src);
return val;
} | javascript | {
"resource": ""
} |
q40614 | reduceFiles | train | function reduceFiles(files, orig) {
var config = {files: []};
var len = files.length;
var idx = -1;
while (++idx < len) {
var val = normalize(files[idx]);
config.files = config.files.concat(val.files);
}
return copyNonfiles(config, orig);
} | javascript | {
"resource": ""
} |
q40615 | copyNonfiles | train | function copyNonfiles(config, provider) {
if (!provider) return config;
for (var key in provider) {
if (!isFilesKey(key)) {
config[key] = provider[key];
}
}
return config;
} | javascript | {
"resource": ""
} |
q40616 | filesObjects | train | function filesObjects(val) {
var res = {};
if (val.options) res.options = val.options;
res.files = [];
for (var key in val) {
if (key !== 'options') {
var file = {};
if (val.options) file.options = val.options;
file.src = utils.arrayify(val[key]);
file.dest = key;
res.files.pu... | javascript | {
"resource": ""
} |
q40617 | formatObject | train | function formatObject(val) {
if (val.options && val.options.format === false) {
return val;
}
var res = { options: val.options };
res.files = val.files;
for (var key in val) {
if (key === 'files' || key === 'options') {
continue;
}
res[key] = val[key];
}
var len = res.files.length;... | javascript | {
"resource": ""
} |
q40618 | train | function (app) {
//Provide angularLivi18nService
app.get('/livi18n/ngLivi18n.js', function (req, res) {
var filepath = path.join(__dirname, 'client', 'ngLivi18n.js');
res.sendfile(filepath);
});
//Check if socket is enabled
if (config.socket) {
//Provide SocketManager
app.get('/livi18n/livi18n... | javascript | {
"resource": ""
} | |
q40619 | train | function (language) {
for (var i in config.languages) {
if (config.languages[i] === language) {return true;}
}
//
return false;
} | javascript | {
"resource": ""
} | |
q40620 | GetValues | train | function GetValues(mydata, keys, index)
{
//Output
var values = [];
//Loop
for(var j = 0; j < keys.length; j++)
{
//Save data value
var value = mydata[keys[j]];
//Check if value exists
if(!value)
{
//Show warning
console.log('WARNING: value "' + keys[j] + '" is not defined on el... | javascript | {
"resource": ""
} |
q40621 | zadd | train | function zadd(key /* score-1, member-1, score-N, member-N, req */) {
var args = slice.call(arguments, 1)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null
, val = this.getKey(key, req);
if(val === undefined) {
val = new SortedSet();
this.setKey(key, val, undefined, undefined, unde... | javascript | {
"resource": ""
} |
q40622 | zrank | train | function zrank(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zrank(member);
} | javascript | {
"resource": ""
} |
q40623 | zrevrank | train | function zrevrank(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zrevrank(member);
} | javascript | {
"resource": ""
} |
q40624 | zscore | train | function zscore(key, member, req) {
var zset = this.getKey(key, req);
if(zset === undefined) return null;
return zset.zscore(member);
} | javascript | {
"resource": ""
} |
q40625 | zrem | train | function zrem(key /* member-1, member-N, req */) {
var args = slice.call(arguments, 1)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null
, val = this.getKey(key, req);
if(val === undefined) return 0;
var deleted = val.zrem(args);
if(val.zcard() === 0) {
this.delKey(key, req);
}
... | javascript | {
"resource": ""
} |
q40626 | zincrby | train | function zincrby(key, increment, member, req) {
var val = this.getKey(key, req);
if(val === undefined) {
val = new SortedSet();
this.setKey(key, val, undefined, undefined, undefined, req);
}
return val.zincrby(increment, member);
} | javascript | {
"resource": ""
} |
q40627 | train | function (arr, val) {
if (!arr || arr.length === 0) return {}
let o = {}
let v = val || null
if (arr.length > 1)
v = this.fromArray(arr.slice(1), v)
o[arr[0]] = v
return o
} | javascript | {
"resource": ""
} | |
q40628 | train | function (str, sep, val) {
if (!str || str.length === 0) return {}
const parts = str.split(sep).filter((s) => s)
return this.fromArray(parts, val)
} | javascript | {
"resource": ""
} | |
q40629 | mergeObjects | train | function mergeObjects (o1, o2) {
let m = Object.assign({}, o1)
for (let attr in o2) {
let v = o2[attr]
if (attr in m && isPlainObject(v) && isPlainObject(m[attr]))
m[attr] = mergeObjects(m[attr], v)
else
m[attr] = v
}
return m
} | javascript | {
"resource": ""
} |
q40630 | parser | train | function parser (defaults, validators, mappers) {
return function (opts) {
const merged = mergeObjects(defaults, opts)
Object.keys(merged).forEach((key) => {
if (validators[key] && ! validators[key](merged[key]))
throw new Error('Failed to validate ' + key)
if (mappers && mappers[key])
... | javascript | {
"resource": ""
} |
q40631 | combine | train | function combine () {
const c = Array.prototype.concat.apply([], arguments)
.map((expression) => '(' + expression.source + ')')
.join('|')
return new RegExp(c)
} | javascript | {
"resource": ""
} |
q40632 | _executeCommands | train | function _executeCommands (showDetails, cmds) {
if (cmds.length) {
const cmd = cmds.shift();
execute(showDetails, cmd.cmd, cmd.options).then((...data) => {
if (data.length && undefined !== data[0]) {
if (1 === data.length && "boolean" === typeof data[0]) {
if (showDetails) {
(... | javascript | {
"resource": ""
} |
q40633 | _getDefaultSessionSchema | train | function _getDefaultSessionSchema() {
return new MongooseSchema({
sid: {type : String, index: true },
session: {
type: MongooseSchema.Types.Mixed
},
dateLoggedIn : {
type : Date,
default : new Date()
},
lastAccessTime: {
type : Date,
default : new Date()
... | javascript | {
"resource": ""
} |
q40634 | _pasreCookies | train | function _pasreCookies(sessionToStore) {
if (sessionToStore && sessionToStore.cookie && (typeof sessionToStore.cookie.toJSON === "function")) {
sessionToStore.cookie = sessionToStore.cookie.toJSON();
}
return sessionToStore;
} | javascript | {
"resource": ""
} |
q40635 | initLunr | train | function initLunr() {
if (!endsWith(baseurl,"/")){
baseurl = baseurl+'/'
};
// First retrieve the index file
$.getJSON(baseurl +"index.json")
.done(function(index) {
pagesIndex = index;
// Set up lunrjs by declaring the fields we use
// Also provide... | javascript | {
"resource": ""
} |
q40636 | search | train | function search(query) {
// Find the item in our index corresponding to the lunr one to have more info
return lunrIndex.search(query).map(function(result) {
return pagesIndex.filter(function(page) {
return page.uri === result.ref;
})[0];
});
} | javascript | {
"resource": ""
} |
q40637 | init | train | function init(ctx) {
_.each(resources, function (resource) {
_.each(resource.tasks, function (taskInfo, taskName) {
taskInfo.name = taskName;
taskInfo.service = pancakes.getService(resource.name);
taskHandlers[taskName] = taskInfo;
});
... | javascript | {
"resource": ""
} |
q40638 | isTaskHandled | train | function isTaskHandled(request, reply) {
var taskName = request.query.task;
// if no task or task handler, don't do anything
if (!taskName && !taskHandlers[taskName]) { return false; }
// if task info doesn't have service or method, don't do anything
var taskInfo = taskHandlers... | javascript | {
"resource": ""
} |
q40639 | transformReact | train | function transformReact(source, options) {
// TODO: just use react-tools
options = options || {};
var visitorList;
if (options.harmony) {
visitorList = visitors.getAllVisitors();
} else {
visitorList = visitors.transformVisitors.react;
}
if (options.stripTypes) {
// Stripping types needs to h... | javascript | {
"resource": ""
} |
q40640 | createSourceCodeErrorMessage | train | function createSourceCodeErrorMessage(code, e) {
var sourceLines = code.split('\n');
var erroneousLine = sourceLines[e.lineNumber - 1];
// Removes any leading indenting spaces and gets the number of
// chars indenting the `erroneousLine`
var indentation = 0;
erroneousLine = erroneousLine.replace(/^\s+/, fu... | javascript | {
"resource": ""
} |
q40641 | verifyTasks | train | function verifyTasks() {
if ( options.tasks.build ) {
if ( isTypeString(options.tasks.build) ) {
options.tasks.build = [options.tasks.build];
}
if ( util.isArray(options.tasks.build) ) {
options.tasks.build.forEach(function( item ) {
if ( !isTypeString(item)... | javascript | {
"resource": ""
} |
q40642 | verifyOthers | train | function verifyOthers() {
if ( !isTypeString(options.commit) ) {
errorOption('commit', options.commit);
}
if ( !isTypeString(options.tag) ) {
errorOption('tag', options.tag);
}
} | javascript | {
"resource": ""
} |
q40643 | isCurrentBranch | train | function isCurrentBranch( branch ) {
return function() {
var deferred = Q.defer();
Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
.then(function( data ) {
//console.log('data=',data);
if ( data && data.trim() === branch ) {
... | javascript | {
"resource": ""
} |
q40644 | runBuildTasks | train | function runBuildTasks() {
return (function() {
if ( options.tasks.build.length > 0 ) {
var aToRun = [];
options.tasks.build.forEach(function( item ) {
aToRun.push(command('grunt ' + item, 'Task:' + item));
});
return aToRun.reduce(function( accum, cur... | javascript | {
"resource": ""
} |
q40645 | gitTag | train | function gitTag() {
return function() {
var deferred = Q.defer();
if (!grunt.option('version')) {
throw new Error('Error in step [Git tag]. Version is not defined.');
}
Q.fcall(command(format('git tag -a v%s -m \'%s\'', grunt.option('version'), options.tag.replace('%v', ... | javascript | {
"resource": ""
} |
q40646 | gitRemote | train | function gitRemote() {
return function() {
var deferred = Q.defer();
Q.fcall(command('git remote', 'Git remote'))
.then(function( data ) {
if ( !data || !data.trim() ) {
deferred.reject(new Error('Error in step [Git remote]. No remotes founds.'));
}
... | javascript | {
"resource": ""
} |
q40647 | train | function ( range, root ) {
var container = range.startContainer,
block;
// If inline, get the containing block.
if ( isInline( container ) ) {
block = getPreviousBlock( container, root );
} else if ( container !== root && isBlock( container ) ) {
block = container;
} else {
... | javascript | {
"resource": ""
} | |
q40648 | train | function ( event ) {
var types = event.dataTransfer.types;
var l = types.length;
var hasPlain = false;
var hasHTML = false;
while ( l-- ) {
switch ( types[l] ) {
case 'text/plain':
hasPlain = true;
break;
case 'text/html':
hasHTML = true;
break;
... | javascript | {
"resource": ""
} | |
q40649 | updateHead | train | function updateHead(title, description) {
updateTitle(title);
description = (description || '').replace(/"/g, '');
var metaDesc = angular.element($rootElement.find('meta[name=description]')[0]);
metaDesc.attr('content', description);
} | javascript | {
"resource": ""
} |
q40650 | updatePageStyle | train | function updatePageStyle(pageName) {
var pageCssId = 'gh-' + pageName.replace('.', '-');
var elem = $rootElement.find('.maincontent');
if (elem && elem.length) {
elem = angular.element(elem[0]);
elem.attr('id', pageCssId);
}
} | javascript | {
"resource": ""
} |
q40651 | canvasFilters | train | function canvasFilters(canvas, settings) {
settings = Object.assign({}, {
smoothing : false, // Smoothing [true|fale]
brightness : 0, // Image brightness [-255 to +255]
contrast : 0, // Image contrast [-255 to +255]
gamma : 0, // Image gamma correction [0.... | javascript | {
"resource": ""
} |
q40652 | getHandler | train | function getHandler (method, trans, version) {
return function (req, res, next) {
res.setHeader('Allow', Object.values(allowedMethods).join(','));
let service = req.params.__service;
let id = req.params.__id;
let action = req.params.__action;
let path = '/' + service +
(id? '/' + id : '') +... | javascript | {
"resource": ""
} |
q40653 | Chain | train | function Chain(val, name) {
if (!(this instanceof Chain)) return new Chain(val, name);
this._val = val;
this._name = name;
this.clear();
return this;
} | javascript | {
"resource": ""
} |
q40654 | train | function (id, width)
{
ModalDialog.id = id;
ModalDialog.width = width;
ModalDialog.ShowBackground();
ModalDialog.ShowDialog();
// Install the event handlers
window.onresize = ModalDialog.Resize;
//... | javascript | {
"resource": ""
} | |
q40655 | train | function ()
{
// Create the background if neccessary
ModalDialog.background = document.createElement('DIV');
ModalDialog.background.className = 'ModalDialog_background';
ModalDialog.background.style.position = 'fixed';
ModalDialog.background.style... | javascript | {
"resource": ""
} | |
q40656 | train | function ()
{
if (ModalDialog.dialog) {
ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
}
ModalDialog.background.style.width = '2500px';
ModalDialog.background.style.height = '250... | javascript | {
"resource": ""
} | |
q40657 | train | function (name, func)
{
if (typeof(ModalDialog.events) == 'undefined') {
ModalDialog.events = [];
}
ModalDialog.events.push([name, func]);
} | javascript | {
"resource": ""
} | |
q40658 | train | function (name)
{
for (var i=0; i<ModalDialog.events.length; ++i) {
if (typeof(ModalDialog.events[i][0]) == 'string' && ModalDialog.events[i][0] == name && typeof(ModalDialog.events[i][1]) == 'function') {
ModalDialog.events[i][1]();
}
... | javascript | {
"resource": ""
} | |
q40659 | median | train | function median(array) {
var length = array.length;
if (length === 0) {
throw new RangeError("Error");
}
array.sort(function(a, b) {
return a - b;
});
var middle = Math.floor(length / 2);
return length % 2 ? array[middle] : (array[middle] + array[middle - 1]) / 2;
} | javascript | {
"resource": ""
} |
q40660 | Connection | train | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
self._connect = Q.nfbind(self._connection.connect.bind(self._connection));
self._query = Q.nfbind(self._connec... | javascript | {
"resource": ""
} |
q40661 | mapFalseInputs | train | function mapFalseInputs(suite, input, p) {
if (p === undefined) {
p = 0;
}
for (p; p < input.length; p++) {
if (input[p] === false) {
var i, newInput = [];
for (i in suite[map[p]]) {
var mapped, cloned = input.slice(0);
cloned[p] = i;
if ((mapped = mapFalseInputs(suit... | javascript | {
"resource": ""
} |
q40662 | presignRequest | train | function presignRequest (presignUrl, token) {
return new Promise((resolve, reject) => {
request
.post(presignUrl)
.set({
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-CSRF-Token': token
})
.end((err, res) => {
// throw a custom error m... | javascript | {
"resource": ""
} |
q40663 | presign | train | function presign (presignUrl, token, fn = presignRequest) {
return new Promise((resolve, reject) => {
fn(presignUrl, token)
.then(responseStatus)
.then(parseJSON)
.then((res) => {
resolve(res)
})
.catch((err) => {
reject(err)
})
})
} | javascript | {
"resource": ""
} |
q40664 | Prompt | train | function Prompt () {
Base.apply(this, arguments);
if (!this.opt.basePath) {
this.throwParamError('basePath');
}
this.pathIndexHash = {};
this.originalBaseDir = this.currentPath =
path.normalize(path.isAbsolute(this.opt.basePath) ?
path.resolve(this.opt.basePath) : path.resolve(process.cwd(), t... | javascript | {
"resource": ""
} |
q40665 | createAndFlush | train | function createAndFlush(size) {
if (self._stream) {
self._stream.end();
self._stream.destroySoon();
}
self._size = size;
self.filename = target;
self._stream = fs.createWriteStream(fullname, self.options);
//
... | javascript | {
"resource": ""
} |
q40666 | train | function (title) {
Suite.super_.call(this)
this.title = title
this.suites = []
this.exclusivity = Suite.EXCLUSIVITY.NONE
this.testExclusivity = undefined
this.parent = undefined
this.nextTests = []
this.globalTests = []
this.testContainer = false
this.testDependencies = []
... | javascript | {
"resource": ""
} | |
q40667 | isArray | train | function isArray(val) {
/* istanbul ignore if */
if (!Array.isArray)
return constant_1.toStr.call(val) === '[object Array]';
return Array.isArray(val);
} | javascript | {
"resource": ""
} |
q40668 | isBrowser | train | function isBrowser(override) {
// Enables checking a process.env key while
// in Node.
if (override)
return typeof process !== 'undefined' &&
function_1.tryWrap(to_1.toBoolean, process.env &&
process.env[override])(false) === true;
// Otherwise just return NOT Node.
... | javascript | {
"resource": ""
} |
q40669 | isDebug | train | function isDebug(debugging) {
// If manually passed just return.
if (isValue(debugging))
return debugging;
var eargv = process && process.execArgv;
function chkDebug() {
return (eargv.filter(function (v) { return /^(--debug|--inspect)/.test(v); }).length ||
isValue(v8debug));... | javascript | {
"resource": ""
} |
q40670 | isEmpty | train | function isEmpty(val) {
return (isUndefined(val) ||
isNull(val) ||
(isString(val) && val.length === 0) ||
(isNumber(val) && isNaN(val)) ||
(isPlainObject(val) && !array_1.keys(val).length) ||
(isArray(val) && !val.length));
} | javascript | {
"resource": ""
} |
q40671 | isEqual | train | function isEqual(val, comp, loose) {
if (isDate(val) && isDate(comp))
return to_1.toEpoch(val) === to_1.toEpoch(comp);
if (loose)
return val == comp;
return val === comp;
} | javascript | {
"resource": ""
} |
q40672 | isError | train | function isError(val, prop) {
if (!isValue(val) || !isObject(val))
return false;
var type = constant_1.toStr.call(val).toLowerCase();
return type === '[object error]' || type === '[object domexception]' || !isEmpty(val[prop]);
} | javascript | {
"resource": ""
} |
q40673 | isDocker | train | function isDocker() {
if (!isNode())
return false;
var hasEnv = function_1.tryWrap(function () {
statSync('/.dockerenv');
return true;
})(false);
var hasGroup = function_1.tryWrap(function () {
return ~readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker');
})(fa... | javascript | {
"resource": ""
} |
q40674 | isObject | train | function isObject(val) {
return (!isUndefined(val) &&
!isNull(val) &&
((val && val.constructor === Object) || typeof val === 'function' || typeof val === 'object'));
} | javascript | {
"resource": ""
} |
q40675 | isPromise | train | function isPromise(val, name) {
name = name || 'Promise';
return (!isEmpty(val) &&
val.constructor &&
val.constructor.name === name);
} | javascript | {
"resource": ""
} |
q40676 | renderTmpl | train | function renderTmpl (path, vars, callback) {
fs.readFile(path, 'utf8', function (err, file) {
if (err) {
return callback(err);
}
var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
return vars[name];
});
callback(null, out);
});
} | javascript | {
"resource": ""
} |
q40677 | train | function(db) {
var methods_uuid = uuid();
debug.assert(methods_uuid).is('uuid');
return db.query('CREATE SEQUENCE methods_seq')
.query(['CREATE TABLE IF NOT EXISTS methods (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+methods_uuid+"', nextval('methods_seq'::regclass)::text),",
' typ... | javascript | {
"resource": ""
} | |
q40678 | isInstance | train | function isInstance(node) {
if (node.type === 'Identifier') {
if (currentOptions.angular) {
if (instanceVarsRegExp.angular.test(node.name)) {
return true;
}
} else {
if (instanceVarsRegExp.noangular.test(node.name)) {
return true;
}
}
}
if (node.type === 'CallEx... | javascript | {
"resource": ""
} |
q40679 | DecisionPoller | train | function DecisionPoller(name, domain, options) {
if (!(this instanceof DecisionPoller)) {
return new DecisionPoller(name, domain, options);
}
if (!_.isString(name)) {
throw new Error('A `name` is required');
}
if (!_.isString(domain)) {
throw new Error('A `domain` is required');
}
this.name... | javascript | {
"resource": ""
} |
q40680 | getInfo | train | function getInfo(d) {
var p = path.join(d, 'package.json')
return exists(p) ? require(p) : false
} | javascript | {
"resource": ""
} |
q40681 | getPath | train | function getPath() {
var p = info && info.config ? info.config : './config'
if (p.charAt(0) === '/') return p
return path.join(base, p)
} | javascript | {
"resource": ""
} |
q40682 | pathExtend | train | function pathExtend(p) {
if (!exists(p)) return false
loaded.push(p)
return extend(config, require(p))
} | javascript | {
"resource": ""
} |
q40683 | train | function(options, methods){
options = options || {};
// Wrap yes/no methods with a success method
options['success'] = function(result){
if ( methods['isValidResult'](result) ){
if (typeof methods['yes'] === "function") methods['yes'](result);
} else {
if (typeof m... | javascript | {
"resource": ""
} | |
q40684 | train | function(username, options) {
if ( this._containsCallbacks(options, ['yes', 'no']) ){
options = this._generateCallbacks(options, {
'isValidResult': function(result) {
return result == username;
},
'yes': options['yes'],
'no': options['no'],
'er... | javascript | {
"resource": ""
} | |
q40685 | train | function() {
if( StackMob['useRelativePathForAjax'] ){
// Build "relative path" (also used for OAuth signing)
return StackMob.apiDomain ? StackMob.apiDomain : (this.getHostname() + (this.getPort() ? ':' + this.getPort() : '')) + '/';
} else {
// Use absolute path and operate through ... | javascript | {
"resource": ""
} | |
q40686 | train | function(options) {
options = options || {};
//If we aren't running in OAuth 2.0 mode, then kick out early.
if(!this.isOAuth2Mode()){
if (options && options['error'])
options['error']();
return false;
}
//Check to see if we have all the necessary OAuth 2.0 crede... | javascript | {
"resource": ""
} | |
q40687 | train | function() {
var oauth_accessToken = StackMob.Storage.retrieve('oauth2.accessToken');
var oauth_macKey = StackMob.Storage.retrieve('oauth2.macKey');
var oauth_expires = StackMob.Storage.retrieve('oauth2.expires');
var oauth_refreshToken = StackMob.Storage.retrieve(StackMob.REFRESH_TOKEN_KEY);
... | javascript | {
"resource": ""
} | |
q40688 | train | function(options) {
options = options || {};
// Run stuff before StackMob is initialized.
this.initStart(options);
/* DEPRECATED METHODS BELOW */
this.userSchema = options['userSchema']; // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
this.login... | javascript | {
"resource": ""
} | |
q40689 | train | function(facebookAccessToken, options) {
options = options || {};
options['data'] = options['data'] || {};
_.extend(options['data'], {
"fb_at" : facebookAccessToken,
"token_type" : "mac"
});
(this.sync || Backbone.sync).call(this, "linkUserWithFacebook", this... | javascript | {
"resource": ""
} | |
q40690 | train | function(b){
/*
* Naming convention: A.or(B)
*/
if (typeof this.orId == "undefined"){
/*
* If A is a normal AND query:
* Clone A into newQuery
* Clear newQuery's params
* Assign OR Group# (1)
* Prefix A params with and[#... | javascript | {
"resource": ""
} | |
q40691 | train | function(b){
/*
* Naming convention: A.or(B)
*
* Combine all params of a and b into one object
*/
var a = this;
var newQuery = this.clone();
for (var key in b['params']){
newQuery['params'][key] = b['params'][key];
}
return... | javascript | {
"resource": ""
} | |
q40692 | build | train | function build(
projectOptions, buildOptions, outDirsAsync, cssRenamingFileAsync) {
var inputFilesAsync = resolveInputsAsync(projectOptions);
return outDirsAsync.then(function(outDirs) {
var transitiveClosureDepsAsync =
closureDepCalculator.calcDeps(projectOptions, buildOptions, outDirs);
retur... | javascript | {
"resource": ""
} |
q40693 | getNodesMetaData | train | function getNodesMetaData(rootEl) {
let elMeta = [];
let toVisit = [rootEl];
let current = {el: rootEl, path: [], isPre: $.tag(rootEl) === 'PRE'};
//generate paths for comment and text nodes. There's no way to quickly retrieve them
//need to deeply traverse the DOM tree
while (current) {
... | javascript | {
"resource": ""
} |
q40694 | getParserConfiguration | train | function getParserConfiguration(target, config) {
target = target || this;
config = config || {alias: {}, flags: [], options: []};
var k, arg, key
, conf = this.configure();
var no = /^\[?no\]?/, nor = /(\[no-?\]-?)/;
for(k in target._options) {
arg = target._options[k];
// misconfigured option,... | javascript | {
"resource": ""
} |
q40695 | next | train | function next(actionData) {
index++;
if(index === store.middlewares.length) {
done(actionData);
} else {
store.middlewares[index](store, actionName, actionData, next);
}
} | javascript | {
"resource": ""
} |
q40696 | checkArgumentType | train | function checkArgumentType(argument, position, type) {
let wrongTypeOf = typeof argument !== type;
let isCheckObject = type === 'object';
let n = isCheckObject ? 'n' : '';
if (isCheckObject && (wrongTypeOf || argument.constructor !== Object) || wrongTypeOf) {
throw new TypeError('A ' + position ... | javascript | {
"resource": ""
} |
q40697 | onResponseFinished | train | function onResponseFinished() {
// Resolve the payload from the 'request' and 'response' objects,
// and send it to the Jarmo server, catching any errors.
var payload = config.resolve(req, res, Date.now() - start);
if(!payload) {
// If the payload is falsy we don't send the data. This allows
// for... | javascript | {
"resource": ""
} |
q40698 | removeListeners | train | function removeListeners() {
res.removeListener('error', removeListeners);
res.removeListener('close', removeListeners);
res.removeListener('finish', onResponseFinished);
} | javascript | {
"resource": ""
} |
q40699 | send | train | function send(host, port, payload, callback) {
// Create a Buffer of the JSON stringified payload, so we can send it.
var data = new Buffer(JSON.stringify(payload));
// Resolve or reject the promise once the we have at least attempted to
// send the payload. Should we add some sort of a retry on error?
return cli... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.