repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
hex7c0/logger-request-cli
lib/in.js
cc
function cc(line, params) { var event = params[0]; var what = params[1]; try { ++event[line[what]].counter; } catch (TypeError) { event[line[what]] = { counter: 1 }; } return event; }
javascript
function cc(line, params) { var event = params[0]; var what = params[1]; try { ++event[line[what]].counter; } catch (TypeError) { event[line[what]] = { counter: 1 }; } return event; }
[ "function", "cc", "(", "line", ",", "params", ")", "{", "var", "event", "=", "params", "[", "0", "]", ";", "var", "what", "=", "params", "[", "1", "]", ";", "try", "{", "++", "event", "[", "line", "[", "what", "]", "]", ".", "counter", ";", "...
input for counter @function cc @param {String} line - line read @param {Array} output - object stored @return {Object}
[ "input", "for", "counter" ]
b1110592dd62e673561a1a4e1c4e122a2a93890a
https://github.com/hex7c0/logger-request-cli/blob/b1110592dd62e673561a1a4e1c4e122a2a93890a/lib/in.js#L53-L65
train
hex7c0/logger-request-cli
lib/in.js
avg
function avg(line, params) { var event = params[0]; var what = params[1]; var r = Number(line[what]); event.what += r; ++event.total; if (r > event.max) { event.max = r; } if (r < event.min) { event.min = r; } return event; }
javascript
function avg(line, params) { var event = params[0]; var what = params[1]; var r = Number(line[what]); event.what += r; ++event.total; if (r > event.max) { event.max = r; } if (r < event.min) { event.min = r; } return event; }
[ "function", "avg", "(", "line", ",", "params", ")", "{", "var", "event", "=", "params", "[", "0", "]", ";", "var", "what", "=", "params", "[", "1", "]", ";", "var", "r", "=", "Number", "(", "line", "[", "what", "]", ")", ";", "event", ".", "w...
input for average @function avg @param {String} line - line read @param {Array} output - object stored @return {Object}
[ "input", "for", "average" ]
b1110592dd62e673561a1a4e1c4e122a2a93890a
https://github.com/hex7c0/logger-request-cli/blob/b1110592dd62e673561a1a4e1c4e122a2a93890a/lib/in.js#L75-L89
train
influx6/ToolStack
lib/stack.utility.js
function(a,b,beStrict){ if(this.isArray(a) && this.isArray(b)){ var alen = a.length, i = 0; if(beStrict){ if(alen !== (b).length){ return false; } } for(; i < alen; i++){ if(a[i] === undefined || b[i] === undefined) break; ...
javascript
function(a,b,beStrict){ if(this.isArray(a) && this.isArray(b)){ var alen = a.length, i = 0; if(beStrict){ if(alen !== (b).length){ return false; } } for(; i < alen; i++){ if(a[i] === undefined || b[i] === undefined) break; ...
[ "function", "(", "a", ",", "b", ",", "beStrict", ")", "{", "if", "(", "this", ".", "isArray", "(", "a", ")", "&&", "this", ".", "isArray", "(", "b", ")", ")", "{", "var", "alen", "=", "a", ".", "length", ",", "i", "=", "0", ";", "if", "(", ...
use to match arrays to arrays to ensure values are equal to each other, useStrict when set to true,ensures the size of properties of both arrays are the same
[ "use", "to", "match", "arrays", "to", "arrays", "to", "ensure", "values", "are", "equal", "to", "each", "other", "useStrict", "when", "set", "to", "true", "ensures", "the", "size", "of", "properties", "of", "both", "arrays", "are", "the", "same" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L135-L151
train
influx6/ToolStack
lib/stack.utility.js
function(a,b,beStrict){ if(this.isObject(a) && this.isObject(b)){ var alen = this.keys(a).length, i; for(i in a){ if(beStrict){ if(!(i in b)){ return false; break; } } if((i in b)){ ...
javascript
function(a,b,beStrict){ if(this.isObject(a) && this.isObject(b)){ var alen = this.keys(a).length, i; for(i in a){ if(beStrict){ if(!(i in b)){ return false; break; } } if((i in b)){ ...
[ "function", "(", "a", ",", "b", ",", "beStrict", ")", "{", "if", "(", "this", ".", "isObject", "(", "a", ")", "&&", "this", ".", "isObject", "(", "b", ")", ")", "{", "var", "alen", "=", "this", ".", "keys", "(", "a", ")", ".", "length", ",", ...
alternative when matching objects to objects,beStrict criteria here is to check if the object to be matched and the object to use to match have the same properties
[ "alternative", "when", "matching", "objects", "to", "objects", "beStrict", "criteria", "here", "is", "to", "check", "if", "the", "object", "to", "be", "matched", "and", "the", "object", "to", "use", "to", "match", "have", "the", "same", "properties" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L156-L176
train
influx6/ToolStack
lib/stack.utility.js
function(args){ if(this.isObject(args)){ return [this.keys(args),this.values(args)]; } if(this.isArgument(args)){ return [].splice.call(args,0); } if(!this.isArray(args) && !this.isObject(args)){ return [args]; } }
javascript
function(args){ if(this.isObject(args)){ return [this.keys(args),this.values(args)]; } if(this.isArgument(args)){ return [].splice.call(args,0); } if(!this.isArray(args) && !this.isObject(args)){ return [args]; } }
[ "function", "(", "args", ")", "{", "if", "(", "this", ".", "isObject", "(", "args", ")", ")", "{", "return", "[", "this", ".", "keys", "(", "args", ")", ",", "this", ".", "values", "(", "args", ")", "]", ";", "}", "if", "(", "this", ".", "isA...
takes a single supplied value and turns it into an array,if its an object returns an array containing two subarrays of keys and values in the return array,if a single variable,simple wraps it in an array,
[ "takes", "a", "single", "supplied", "value", "and", "turns", "it", "into", "an", "array", "if", "its", "an", "object", "returns", "an", "array", "containing", "two", "subarrays", "of", "keys", "and", "values", "in", "the", "return", "array", "if", "a", "...
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L212-L222
train
influx6/ToolStack
lib/stack.utility.js
function () { var val = (1 + (Math.random() * (30000)) | 3); if(!(val >= 10000)){ val += (10000 * Math.floor(Math.random * 9)); } return val; }
javascript
function () { var val = (1 + (Math.random() * (30000)) | 3); if(!(val >= 10000)){ val += (10000 * Math.floor(Math.random * 9)); } return val; }
[ "function", "(", ")", "{", "var", "val", "=", "(", "1", "+", "(", "Math", ".", "random", "(", ")", "*", "(", "30000", ")", ")", "|", "3", ")", ";", "if", "(", "!", "(", "val", ">=", "10000", ")", ")", "{", "val", "+=", "(", "10000", "*", ...
simple function to generate random numbers of 4 lengths
[ "simple", "function", "to", "generate", "random", "numbers", "of", "4", "lengths" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L225-L231
train
influx6/ToolStack
lib/stack.utility.js
function(i,value){ if(!value) return; var i = i || 1,message = ""; while(true){ message += value; if((--i) <= 0) break; } return message; }
javascript
function(i,value){ if(!value) return; var i = i || 1,message = ""; while(true){ message += value; if((--i) <= 0) break; } return message; }
[ "function", "(", "i", ",", "value", ")", "{", "if", "(", "!", "value", ")", "return", ";", "var", "i", "=", "i", "||", "1", ",", "message", "=", "\"\"", ";", "while", "(", "true", ")", "{", "message", "+=", "value", ";", "if", "(", "(", "--",...
for string just iterates a single as specificed in the first arguments
[ "for", "string", "just", "iterates", "a", "single", "as", "specificed", "in", "the", "first", "arguments" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L242-L251
train
influx6/ToolStack
lib/stack.utility.js
function(o,value,fn){ if(this.isArray(o)){ return this._anyArray(o,value,fn); } if(this.isObject(o)){ return this._anyObject(o,value,fn); } }
javascript
function(o,value,fn){ if(this.isArray(o)){ return this._anyArray(o,value,fn); } if(this.isObject(o)){ return this._anyObject(o,value,fn); } }
[ "function", "(", "o", ",", "value", ",", "fn", ")", "{", "if", "(", "this", ".", "isArray", "(", "o", ")", ")", "{", "return", "this", ".", "_anyArray", "(", "o", ",", "value", ",", "fn", ")", ";", "}", "if", "(", "this", ".", "isObject", "("...
returns the position of the first item that meets the value in an array
[ "returns", "the", "position", "of", "the", "first", "item", "that", "meets", "the", "value", "in", "an", "array" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L352-L359
train
influx6/ToolStack
lib/stack.utility.js
function(arrays,result){ var self = this,flat = result || []; this.forEach(arrays,function(a){ if(self.isArray(a)){ self.flatten(a,flat); }else{ flat.push(a); } },self); return flat; }
javascript
function(arrays,result){ var self = this,flat = result || []; this.forEach(arrays,function(a){ if(self.isArray(a)){ self.flatten(a,flat); }else{ flat.push(a); } },self); return flat; }
[ "function", "(", "arrays", ",", "result", ")", "{", "var", "self", "=", "this", ",", "flat", "=", "result", "||", "[", "]", ";", "this", ".", "forEach", "(", "arrays", ",", "function", "(", "a", ")", "{", "if", "(", "self", ".", "isArray", "(", ...
mainly works wth arrays only flattens an array that contains multiple arrays into a single array
[ "mainly", "works", "wth", "arrays", "only", "flattens", "an", "array", "that", "contains", "multiple", "arrays", "into", "a", "single", "array" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L455-L468
train
influx6/ToolStack
lib/stack.utility.js
function(o,value){ var occurence = []; this.forEach(o,function occurmover(e,i,b){ if(e === value){ occurence.push(i); } },this); return occurence; }
javascript
function(o,value){ var occurence = []; this.forEach(o,function occurmover(e,i,b){ if(e === value){ occurence.push(i); } },this); return occurence; }
[ "function", "(", "o", ",", "value", ")", "{", "var", "occurence", "=", "[", "]", ";", "this", ".", "forEach", "(", "o", ",", "function", "occurmover", "(", "e", ",", "i", ",", "b", ")", "{", "if", "(", "e", "===", "value", ")", "{", "occurence"...
returns an array of occurences index of a particular value
[ "returns", "an", "array", "of", "occurences", "index", "of", "a", "particular", "value" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L482-L488
train
influx6/ToolStack
lib/stack.utility.js
function(o,value,fn){ this.forEach(o,function everymover(e,i,b){ if(e === value){ if(fn) fn.call(this,e,i,b); } },this); return; }
javascript
function(o,value,fn){ this.forEach(o,function everymover(e,i,b){ if(e === value){ if(fn) fn.call(this,e,i,b); } },this); return; }
[ "function", "(", "o", ",", "value", ",", "fn", ")", "{", "this", ".", "forEach", "(", "o", ",", "function", "everymover", "(", "e", ",", "i", ",", "b", ")", "{", "if", "(", "e", "===", "value", ")", "{", "if", "(", "fn", ")", "fn", ".", "ca...
performs an operation on every item that has a particular value in the object
[ "performs", "an", "operation", "on", "every", "item", "that", "has", "a", "particular", "value", "in", "the", "object" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L491-L498
train
influx6/ToolStack
lib/stack.utility.js
function(o,start,end){ var i = 0,len = o.length; if(!len || len <= 0) return false; start = Math.abs(start); end = Math.abs(end); if(end > (len - start)){ end = (len - start); } for(; i < len; i++){ o[i] = o[start]; start +=1; if(i >= end) break; ...
javascript
function(o,start,end){ var i = 0,len = o.length; if(!len || len <= 0) return false; start = Math.abs(start); end = Math.abs(end); if(end > (len - start)){ end = (len - start); } for(; i < len; i++){ o[i] = o[start]; start +=1; if(i >= end) break; ...
[ "function", "(", "o", ",", "start", ",", "end", ")", "{", "var", "i", "=", "0", ",", "len", "=", "o", ".", "length", ";", "if", "(", "!", "len", "||", "len", "<=", "0", ")", "return", "false", ";", "start", "=", "Math", ".", "abs", "(", "st...
destructive splice,changes the giving array instead of returning a new one writing to only work with positive numbers only
[ "destructive", "splice", "changes", "the", "giving", "array", "instead", "of", "returning", "a", "new", "one", "writing", "to", "only", "work", "with", "positive", "numbers", "only" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L516-L533
train
influx6/ToolStack
lib/stack.utility.js
function(a){ if(!a || !this.isArray(a)) return; var i = 0,start = 0,len = a.length; for(;i < len; i++){ if(!this.isUndefined(a[i]) && !this.isNull(a[i]) && !(this.isEmpty(a[i]))){ a[start]=a[i]; start += 1; } } ...
javascript
function(a){ if(!a || !this.isArray(a)) return; var i = 0,start = 0,len = a.length; for(;i < len; i++){ if(!this.isUndefined(a[i]) && !this.isNull(a[i]) && !(this.isEmpty(a[i]))){ a[start]=a[i]; start += 1; } } ...
[ "function", "(", "a", ")", "{", "if", "(", "!", "a", "||", "!", "this", ".", "isArray", "(", "a", ")", ")", "return", ";", "var", "i", "=", "0", ",", "start", "=", "0", ",", "len", "=", "a", ".", "length", ";", "for", "(", ";", "i", "<", ...
normalizes an array,ensures theres no undefined or empty spaces between arrays
[ "normalizes", "an", "array", "ensures", "theres", "no", "undefined", "or", "empty", "spaces", "between", "arrays" ]
d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db
https://github.com/influx6/ToolStack/blob/d0c7b1acc1546f5e7ff9d04ca6c9222b2577e0db/lib/stack.utility.js#L944-L958
train
atd-schubert/node-stream-lib
lib/random.js
Random
function Random(opts) { Readable.apply(this, arguments); if (opts && opts.objectMode) { this.objectMode = true; } this.dictionary = ['1', '0']; }
javascript
function Random(opts) { Readable.apply(this, arguments); if (opts && opts.objectMode) { this.objectMode = true; } this.dictionary = ['1', '0']; }
[ "function", "Random", "(", "opts", ")", "{", "Readable", ".", "apply", "(", "this", ",", "arguments", ")", ";", "if", "(", "opts", "&&", "opts", ".", "objectMode", ")", "{", "this", ".", "objectMode", "=", "true", ";", "}", "this", ".", "dictionary",...
Create a stream of random values from dictionary @author Arne Schubert <atd.schubert@gmail.com> @constructor @memberOf streamLib @augments {stream.Readable}
[ "Create", "a", "stream", "of", "random", "values", "from", "dictionary" ]
90f27042fae84d2fbdbf9d28149b0673997f151a
https://github.com/atd-schubert/node-stream-lib/blob/90f27042fae84d2fbdbf9d28149b0673997f151a/lib/random.js#L18-L26
train
gethuman/pancakes-recipe
services/adapters/redis/redis.adapter.js
createLocalCache
function createLocalCache() { var localCache = lruCache({ max: 100, maxAge: 60000 }); return { get: function (key) { return new Q(localCache.get(key)); }, set: function (key, value) { localCache.set(key, value); }, del: function (key) { ...
javascript
function createLocalCache() { var localCache = lruCache({ max: 100, maxAge: 60000 }); return { get: function (key) { return new Q(localCache.get(key)); }, set: function (key, value) { localCache.set(key, value); }, del: function (key) { ...
[ "function", "createLocalCache", "(", ")", "{", "var", "localCache", "=", "lruCache", "(", "{", "max", ":", "100", ",", "maxAge", ":", "60000", "}", ")", ";", "return", "{", "get", ":", "function", "(", "key", ")", "{", "return", "new", "Q", "(", "l...
Create local cache with same interface as remote @returns {{get: Function, set: *}}
[ "Create", "local", "cache", "with", "same", "interface", "as", "remote" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L68-L81
train
gethuman/pancakes-recipe
services/adapters/redis/redis.adapter.js
connectToRedis
function connectToRedis(db, opts) { // get the redis client var client = redis.createClient(opts.port, opts.host); // log any errors client.on('error', function (err) { redisOffline = true; console.log('connectToRedis error: ' + err); }); client.on('ready', function () { ...
javascript
function connectToRedis(db, opts) { // get the redis client var client = redis.createClient(opts.port, opts.host); // log any errors client.on('error', function (err) { redisOffline = true; console.log('connectToRedis error: ' + err); }); client.on('ready', function () { ...
[ "function", "connectToRedis", "(", "db", ",", "opts", ")", "{", "// get the redis client", "var", "client", "=", "redis", ".", "createClient", "(", "opts", ".", "port", ",", "opts", ".", "host", ")", ";", "// log any errors", "client", ".", "on", "(", "'er...
Create a connection to redis and select the appropriate database @param db @param opts @returns {*}
[ "Create", "a", "connection", "to", "redis", "and", "select", "the", "appropriate", "database" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L89-L125
train
gethuman/pancakes-recipe
services/adapters/redis/redis.adapter.js
init
function init(config) { var promises = []; if (config.redis) { _.each(config.redis.dbs, function (idx, name) { promises.push( connectToRedis(idx, config.redis) .then(function (remoteCache) { caches[name] = wrapRemoteCache(remoteCac...
javascript
function init(config) { var promises = []; if (config.redis) { _.each(config.redis.dbs, function (idx, name) { promises.push( connectToRedis(idx, config.redis) .then(function (remoteCache) { caches[name] = wrapRemoteCache(remoteCac...
[ "function", "init", "(", "config", ")", "{", "var", "promises", "=", "[", "]", ";", "if", "(", "config", ".", "redis", ")", "{", "_", ".", "each", "(", "config", ".", "redis", ".", "dbs", ",", "function", "(", "idx", ",", "name", ")", "{", "pro...
During the initialization of a pancakes app, this will be called and all the redis connections will be established. @param config @returns {*}
[ "During", "the", "initialization", "of", "a", "pancakes", "app", "this", "will", "be", "called", "and", "all", "the", "redis", "connections", "will", "be", "established", "." ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L134-L154
train
gethuman/pancakes-recipe
services/adapters/redis/redis.adapter.js
get
function get(req) { var cache = caches[this.name]; var returnVal = null; if (cache && !redisOffline) { try { returnVal = cache.get(req.key); } catch (err) { console.log('redis get err: ' + err); } } ...
javascript
function get(req) { var cache = caches[this.name]; var returnVal = null; if (cache && !redisOffline) { try { returnVal = cache.get(req.key); } catch (err) { console.log('redis get err: ' + err); } } ...
[ "function", "get", "(", "req", ")", "{", "var", "cache", "=", "caches", "[", "this", ".", "name", "]", ";", "var", "returnVal", "=", "null", ";", "if", "(", "cache", "&&", "!", "redisOffline", ")", "{", "try", "{", "returnVal", "=", "cache", ".", ...
Get a value from cache @param req
[ "Get", "a", "value", "from", "cache" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L179-L193
train
gethuman/pancakes-recipe
services/adapters/redis/redis.adapter.js
set
function set(req) { var cache = caches[this.name]; if (!cache) { cache = caches[this.name] = createLocalCache(); } if (!redisOffline) { try { (req.value || !cache.del) ? cache.set(req.key, req.value) : cache...
javascript
function set(req) { var cache = caches[this.name]; if (!cache) { cache = caches[this.name] = createLocalCache(); } if (!redisOffline) { try { (req.value || !cache.del) ? cache.set(req.key, req.value) : cache...
[ "function", "set", "(", "req", ")", "{", "var", "cache", "=", "caches", "[", "this", ".", "name", "]", ";", "if", "(", "!", "cache", ")", "{", "cache", "=", "caches", "[", "this", ".", "name", "]", "=", "createLocalCache", "(", ")", ";", "}", "...
Set a value in the cache @param req
[ "Set", "a", "value", "in", "the", "cache" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L199-L215
train
gethuman/pancakes-recipe
services/adapters/redis/redis.adapter.js
clear
function clear() { var cache = caches[this.name]; if (cache && cache.flush && !redisOffline) { cache.flush(); } }
javascript
function clear() { var cache = caches[this.name]; if (cache && cache.flush && !redisOffline) { cache.flush(); } }
[ "function", "clear", "(", ")", "{", "var", "cache", "=", "caches", "[", "this", ".", "name", "]", ";", "if", "(", "cache", "&&", "cache", ".", "flush", "&&", "!", "redisOffline", ")", "{", "cache", ".", "flush", "(", ")", ";", "}", "}" ]
Remove all items from this cache
[ "Remove", "all", "items", "from", "this", "cache" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/redis/redis.adapter.js#L220-L225
train
warelab/gramene-taxonomy-with-genomes
index.js
addCounts
function addCounts(o1, o2) { var result; if (o1 && o2) { result = _.merge(o1, o2, function (a, b) { return a + b; }); } else if (o1) { result = o1; } else { result = o2; } return result; }
javascript
function addCounts(o1, o2) { var result; if (o1 && o2) { result = _.merge(o1, o2, function (a, b) { return a + b; }); } else if (o1) { result = o1; } else { result = o2; } return result; }
[ "function", "addCounts", "(", "o1", ",", "o2", ")", "{", "var", "result", ";", "if", "(", "o1", "&&", "o2", ")", "{", "result", "=", "_", ".", "merge", "(", "o1", ",", "o2", ",", "function", "(", "a", ",", "b", ")", "{", "return", "a", "+", ...
given two objects that have the same keys and whose values are all integers return a new object that sums them together. If either object is null, return the other one.
[ "given", "two", "objects", "that", "have", "the", "same", "keys", "and", "whose", "values", "are", "all", "integers", "return", "a", "new", "object", "that", "sums", "them", "together", ".", "If", "either", "object", "is", "null", "return", "the", "other",...
347a7c8af49d0130941964944b4adfcde65c23c1
https://github.com/warelab/gramene-taxonomy-with-genomes/blob/347a7c8af49d0130941964944b4adfcde65c23c1/index.js#L11-L25
train
cmcampione/thingshub.org
server/src/bl/thingsMngr.js
getThingUserRights
function getThingUserRights(userId, username, thing) { if (!userId && !username) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "userId or usernane must be not empty", 28); if (!thing) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 27); let thingUs...
javascript
function getThingUserRights(userId, username, thing) { if (!userId && !username) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "userId or usernane must be not empty", 28); if (!thing) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 27); let thingUs...
[ "function", "getThingUserRights", "(", "userId", ",", "username", ",", "thing", ")", "{", "if", "(", "!", "userId", "&&", "!", "username", ")", "throw", "new", "utils", ".", "ErrorCustom", "(", "httpStatusCodes", ".", "INTERNAL_SERVER_ERROR", ",", "\"userId or...
First search is by userId after it searchs by username Can return null
[ "First", "search", "is", "by", "userId", "after", "it", "searchs", "by", "username", "Can", "return", "null" ]
b9a2e74bddebb80ff473001be93e19ef1578892a
https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L19-L34
train
cmcampione/thingshub.org
server/src/bl/thingsMngr.js
getThingUserClaims
function getThingUserClaims(user, thing, isSuperAdministrator) { if (!thing) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 26); let thingUserClaimsAndRights = { read : thing.publicReadClaims, change : thing.publicChangeClaims }; if (user) { thingUserClaimsA...
javascript
function getThingUserClaims(user, thing, isSuperAdministrator) { if (!thing) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Thing can't be null", 26); let thingUserClaimsAndRights = { read : thing.publicReadClaims, change : thing.publicChangeClaims }; if (user) { thingUserClaimsA...
[ "function", "getThingUserClaims", "(", "user", ",", "thing", ",", "isSuperAdministrator", ")", "{", "if", "(", "!", "thing", ")", "throw", "new", "utils", ".", "ErrorCustom", "(", "httpStatusCodes", ".", "INTERNAL_SERVER_ERROR", ",", "\"Thing can't be null\"", ","...
All paths return to something. It never returns null except for exceptions The User may be null as anonymous. If User is anonymous returns Thing's PublicClaims
[ "All", "paths", "return", "to", "something", ".", "It", "never", "returns", "null", "except", "for", "exceptions", "The", "User", "may", "be", "null", "as", "anonymous", ".", "If", "User", "is", "anonymous", "returns", "Thing", "s", "PublicClaims" ]
b9a2e74bddebb80ff473001be93e19ef1578892a
https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L38-L67
train
cmcampione/thingshub.org
server/src/bl/thingsMngr.js
getThing
async function getThing(user, thingId, deletedStatus, userRole, userStatus, userVisibility) { if (!thingId) throw new utils.ErrorCustom(httpStatusCodes.BAD_REQUEST, "Thing's Id not valid", 37); let thing = await findThingById(thingId); if (!thing) { // Returns httpStatusCodes.UNAUTHORIZED to Reset Some Malici...
javascript
async function getThing(user, thingId, deletedStatus, userRole, userStatus, userVisibility) { if (!thingId) throw new utils.ErrorCustom(httpStatusCodes.BAD_REQUEST, "Thing's Id not valid", 37); let thing = await findThingById(thingId); if (!thing) { // Returns httpStatusCodes.UNAUTHORIZED to Reset Some Malici...
[ "async", "function", "getThing", "(", "user", ",", "thingId", ",", "deletedStatus", ",", "userRole", ",", "userStatus", ",", "userVisibility", ")", "{", "if", "(", "!", "thingId", ")", "throw", "new", "utils", ".", "ErrorCustom", "(", "httpStatusCodes", ".",...
Not optimized using the CheckThingAccess function. It does not get optimized because staying so you have a capillary control of where it eventually snaps the error
[ "Not", "optimized", "using", "the", "CheckThingAccess", "function", ".", "It", "does", "not", "get", "optimized", "because", "staying", "so", "you", "have", "a", "capillary", "control", "of", "where", "it", "eventually", "snaps", "the", "error" ]
b9a2e74bddebb80ff473001be93e19ef1578892a
https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L127-L181
train
cmcampione/thingshub.org
server/src/bl/thingsMngr.js
getThingPosition
function getThingPosition(user, parentThing, childThing) { if (!childThing) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Child Thing can't be null", 29); // If User is equal to null as it may be anonymous or is a SuperAdministrator who has no relationship with Thing if (!user) return nul...
javascript
function getThingPosition(user, parentThing, childThing) { if (!childThing) throw new utils.ErrorCustom(httpStatusCodes.INTERNAL_SERVER_ERROR, "Child Thing can't be null", 29); // If User is equal to null as it may be anonymous or is a SuperAdministrator who has no relationship with Thing if (!user) return nul...
[ "function", "getThingPosition", "(", "user", ",", "parentThing", ",", "childThing", ")", "{", "if", "(", "!", "childThing", ")", "throw", "new", "utils", ".", "ErrorCustom", "(", "httpStatusCodes", ".", "INTERNAL_SERVER_ERROR", ",", "\"Child Thing can't be null\"", ...
User may be null as it may be anonymous or is a SuperAdministrator who has no relationship with Thing It may return null for old Thing created before Position Management
[ "User", "may", "be", "null", "as", "it", "may", "be", "anonymous", "or", "is", "a", "SuperAdministrator", "who", "has", "no", "relationship", "with", "Thing", "It", "may", "return", "null", "for", "old", "Thing", "created", "before", "Position", "Management"...
b9a2e74bddebb80ff473001be93e19ef1578892a
https://github.com/cmcampione/thingshub.org/blob/b9a2e74bddebb80ff473001be93e19ef1578892a/server/src/bl/thingsMngr.js#L277-L290
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function(signal, arg, emitter) { var widget = this, slot; if (typeof emitter === 'undefined') emitter = this; console.log("fire(" + signal + ")", arg); if (signal.charAt(0) == '@') { // This is a global signal. slot = $$.statics...
javascript
function(signal, arg, emitter) { var widget = this, slot; if (typeof emitter === 'undefined') emitter = this; console.log("fire(" + signal + ")", arg); if (signal.charAt(0) == '@') { // This is a global signal. slot = $$.statics...
[ "function", "(", "signal", ",", "arg", ",", "emitter", ")", "{", "var", "widget", "=", "this", ",", "slot", ";", "if", "(", "typeof", "emitter", "===", "'undefined'", ")", "emitter", "=", "this", ";", "console", ".", "log", "(", "\"fire(\"", "+", "si...
Fire a "signal" up to the parents widgets. If a slot returns false, the event is fired up to the parents. @param signal Name of the signal to trigger. @param arg Optional argument to sent with this signal. @param emitter Optional reference to the signal's emitter. @memberof WTag
[ "Fire", "a", "signal", "up", "to", "the", "parents", "widgets", ".", "If", "a", "slot", "returns", "false", "the", "event", "is", "fired", "up", "to", "the", "parents", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L89-L125
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function(signal, arg) { var slot = this._slots[signal]; if (slot) { slot.call(this, arg, signal); return true; } return false; }
javascript
function(signal, arg) { var slot = this._slots[signal]; if (slot) { slot.call(this, arg, signal); return true; } return false; }
[ "function", "(", "signal", ",", "arg", ")", "{", "var", "slot", "=", "this", ".", "_slots", "[", "signal", "]", ";", "if", "(", "slot", ")", "{", "slot", ".", "call", "(", "this", ",", "arg", ",", "signal", ")", ";", "return", "true", ";", "}",...
Call the slot mapped to the "signal". @param signal : name of the signal on which this object may be registred. @param arg : argument to pass to the registred slot. @memberof WTag
[ "Call", "the", "slot", "mapped", "to", "the", "signal", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L161-L168
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function() { var element = this._element; while (element.parentNode) { element = element.parentNode; if (element.$widget) { return element.$widget; } } return null; }
javascript
function() { var element = this._element; while (element.parentNode) { element = element.parentNode; if (element.$widget) { return element.$widget; } } return null; }
[ "function", "(", ")", "{", "var", "element", "=", "this", ".", "_element", ";", "while", "(", "element", ".", "parentNode", ")", "{", "element", "=", "element", ".", "parentNode", ";", "if", "(", "element", ".", "$widget", ")", "{", "return", "element"...
Get the parent widget. @memberof WTag
[ "Get", "the", "parent", "widget", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L182-L191
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function(id) { if (!$$.App) $$.App = this; if (!$$.App._languages) { // Initialise localization. var languages = [], langStyle = document.createElement("style"), children = document.querySelectorAll("[lang]"); docume...
javascript
function(id) { if (!$$.App) $$.App = this; if (!$$.App._languages) { // Initialise localization. var languages = [], langStyle = document.createElement("style"), children = document.querySelectorAll("[lang]"); docume...
[ "function", "(", "id", ")", "{", "if", "(", "!", "$$", ".", "App", ")", "$$", ".", "App", "=", "this", ";", "if", "(", "!", "$$", ".", "App", ".", "_languages", ")", "{", "// Initialise localization.", "var", "languages", "=", "[", "]", ",", "lan...
Return or set the current language. @memberof WTag
[ "Return", "or", "set", "the", "current", "language", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L197-L264
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function(name) { if (typeof name === 'undefined') return this._element; var e = this._element.querySelector("[name='" + name + "']"); if (!e) { throw new Error( "[WTag.get] Can't find child [name=\"" + name + "\"] in element...
javascript
function(name) { if (typeof name === 'undefined') return this._element; var e = this._element.querySelector("[name='" + name + "']"); if (!e) { throw new Error( "[WTag.get] Can't find child [name=\"" + name + "\"] in element...
[ "function", "(", "name", ")", "{", "if", "(", "typeof", "name", "===", "'undefined'", ")", "return", "this", ".", "_element", ";", "var", "e", "=", "this", ".", "_element", ".", "querySelector", "(", "\"[name='\"", "+", "name", "+", "\"']\"", ")", ";",...
Get an element with this `name` among this element's children. @memberof WTag
[ "Get", "an", "element", "with", "this", "name", "among", "this", "element", "s", "children", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L271-L281
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function(vars, slot, getter) { if (!Array.isArray(vars)) { vars = [vars]; } if (vars.length == 0) return null; if (typeof slot === 'string') { slot = this[slot]; } if (typeof getter === 'undefined') { ...
javascript
function(vars, slot, getter) { if (!Array.isArray(vars)) { vars = [vars]; } if (vars.length == 0) return null; if (typeof slot === 'string') { slot = this[slot]; } if (typeof getter === 'undefined') { ...
[ "function", "(", "vars", ",", "slot", ",", "getter", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "vars", ")", ")", "{", "vars", "=", "[", "vars", "]", ";", "}", "if", "(", "vars", ".", "length", "==", "0", ")", "return", "null", "...
Bind to data updates. When the data changed, the `slot` is call with `this` object and the data's value as unique argument. @param {array} vars array of names of data to watch. @param {function} slot function to call when data changed. @param {string} slot name of the method to call when data changed. @param {function...
[ "Bind", "to", "data", "updates", ".", "When", "the", "data", "changed", "the", "slot", "is", "call", "with", "this", "object", "and", "the", "data", "s", "value", "as", "unique", "argument", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L398-L423
train
tolokoban/ToloFrameWork
ker/cls/WTag.js
function(vars, listener) { if (!Array.isArray(vars)) { vars = [vars]; } if (vars.length == 0) return null; var found = false; vars.forEach( function(name) { var data = this.findDataBinding(name); ...
javascript
function(vars, listener) { if (!Array.isArray(vars)) { vars = [vars]; } if (vars.length == 0) return null; var found = false; vars.forEach( function(name) { var data = this.findDataBinding(name); ...
[ "function", "(", "vars", ",", "listener", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "vars", ")", ")", "{", "vars", "=", "[", "vars", "]", ";", "}", "if", "(", "vars", ".", "length", "==", "0", ")", "return", "null", ";", "var", ...
Detach this object from data binding. @param {array} vars array of names of data to watch. @param {object} listner the listener to remove. @memberof WTag
[ "Detach", "this", "object", "from", "data", "binding", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/WTag.js#L432-L453
train
jmjuanes/minsql
lib/query/where.js
QueryWhere
function QueryWhere(data) { //Initialize the string var sql = ''; //Check the type if(typeof data === 'string') { //Return the where return data; } //Get all data for(var key in data) { //Save data value var value = data[key]; //Check the data type if(typeof value === 'string'...
javascript
function QueryWhere(data) { //Initialize the string var sql = ''; //Check the type if(typeof data === 'string') { //Return the where return data; } //Get all data for(var key in data) { //Save data value var value = data[key]; //Check the data type if(typeof value === 'string'...
[ "function", "QueryWhere", "(", "data", ")", "{", "//Initialize the string\r", "var", "sql", "=", "''", ";", "//Check the type\r", "if", "(", "typeof", "data", "===", "'string'", ")", "{", "//Return the where\r", "return", "data", ";", "}", "//Get all data\r", "f...
Query String Where function
[ "Query", "String", "Where", "function" ]
80eddd97e858545997b30e3c9bc067d5fc2df5a0
https://github.com/jmjuanes/minsql/blob/80eddd97e858545997b30e3c9bc067d5fc2df5a0/lib/query/where.js#L2-L40
train
Nazariglez/perenquen
lib/pixi/src/filters/rgb/RGBSplitFilter.js
RGBSplitFilter
function RGBSplitFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader fs.readFileSync(__dirname + '/rgbSplit.frag', 'utf8'), // custom uniforms { red: { type: 'v2', value: { x: 20, y: 20 } }, green: { ...
javascript
function RGBSplitFilter() { core.AbstractFilter.call(this, // vertex shader null, // fragment shader fs.readFileSync(__dirname + '/rgbSplit.frag', 'utf8'), // custom uniforms { red: { type: 'v2', value: { x: 20, y: 20 } }, green: { ...
[ "function", "RGBSplitFilter", "(", ")", "{", "core", ".", "AbstractFilter", ".", "call", "(", "this", ",", "// vertex shader", "null", ",", "// fragment shader", "fs", ".", "readFileSync", "(", "__dirname", "+", "'/rgbSplit.frag'", ",", "'utf8'", ")", ",", "//...
An RGB Split Filter. @class @extends AbstractFilter @namespace PIXI
[ "An", "RGB", "Split", "Filter", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/rgb/RGBSplitFilter.js#L12-L27
train
Tennu/tennu-plugins
lib/errors.js
NoSuchPlugin
function NoSuchPlugin (message, name, paths) { UnmetDependency.call(this, message); this.name = name; this.paths = paths; }
javascript
function NoSuchPlugin (message, name, paths) { UnmetDependency.call(this, message); this.name = name; this.paths = paths; }
[ "function", "NoSuchPlugin", "(", "message", ",", "name", ",", "paths", ")", "{", "UnmetDependency", ".", "call", "(", "this", ",", "message", ")", ";", "this", ".", "name", "=", "name", ";", "this", ".", "paths", "=", "paths", ";", "}" ]
Thrown when a module cannot be found.
[ "Thrown", "when", "a", "module", "cannot", "be", "found", "." ]
4d93df08514e9ccabf71a907e785d67cebfc9755
https://github.com/Tennu/tennu-plugins/blob/4d93df08514e9ccabf71a907e785d67cebfc9755/lib/errors.js#L11-L15
train
Tennu/tennu-plugins
lib/errors.js
PluginInitializationError
function PluginInitializationError (message, module) { this.message = message; this.stack = new Error().stack; this.module = module; }
javascript
function PluginInitializationError (message, module) { this.message = message; this.stack = new Error().stack; this.module = module; }
[ "function", "PluginInitializationError", "(", "message", ",", "module", ")", "{", "this", ".", "message", "=", "message", ";", "this", ".", "stack", "=", "new", "Error", "(", ")", ".", "stack", ";", "this", ".", "module", "=", "module", ";", "}" ]
Thrown when a module cannot be initialized.
[ "Thrown", "when", "a", "module", "cannot", "be", "initialized", "." ]
4d93df08514e9ccabf71a907e785d67cebfc9755
https://github.com/Tennu/tennu-plugins/blob/4d93df08514e9ccabf71a907e785d67cebfc9755/lib/errors.js#L39-L43
train
chanoch/simple-react-router
src/Configuration.js
instantiateDrivers
function instantiateDrivers(config, defaultDriverInstance) { config.actionConfigs.forEach(action => { action.driverInstance=action.driver?action.driver():defaultDriverInstance; }); return config; }
javascript
function instantiateDrivers(config, defaultDriverInstance) { config.actionConfigs.forEach(action => { action.driverInstance=action.driver?action.driver():defaultDriverInstance; }); return config; }
[ "function", "instantiateDrivers", "(", "config", ",", "defaultDriverInstance", ")", "{", "config", ".", "actionConfigs", ".", "forEach", "(", "action", "=>", "{", "action", ".", "driverInstance", "=", "action", ".", "driver", "?", "action", ".", "driver", "(",...
Instantiate the driver for each configuration. If no driver has been specified, this will provide the config with a default driver. The default driver is usually a null driver - which has no impact.
[ "Instantiate", "the", "driver", "for", "each", "configuration", ".", "If", "no", "driver", "has", "been", "specified", "this", "will", "provide", "the", "config", "with", "a", "default", "driver", "." ]
3c71feeeb039111f33c934257732e2ea6ddde9ff
https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/Configuration.js#L109-L114
train
chanoch/simple-react-router
src/Configuration.js
initEnhancers
function initEnhancers(routes) { invariant(routes.filter(actionConfig => !actionConfig.driverInstance).length===0, 'Routes must have instantiated drivers'); return routes .filter(actionConfig => actionConfig.driverInstance.middleware) .map(actionConfig => actionConfig.driverInstance.middleware(...
javascript
function initEnhancers(routes) { invariant(routes.filter(actionConfig => !actionConfig.driverInstance).length===0, 'Routes must have instantiated drivers'); return routes .filter(actionConfig => actionConfig.driverInstance.middleware) .map(actionConfig => actionConfig.driverInstance.middleware(...
[ "function", "initEnhancers", "(", "routes", ")", "{", "invariant", "(", "routes", ".", "filter", "(", "actionConfig", "=>", "!", "actionConfig", ".", "driverInstance", ")", ".", "length", "===", "0", ",", "'Routes must have instantiated drivers'", ")", ";", "ret...
Get a list of action configurations which have a middleware defined and return an array of those redux state enhancers functions @param {ActionConfig} actionConfigs
[ "Get", "a", "list", "of", "action", "configurations", "which", "have", "a", "middleware", "defined", "and", "return", "an", "array", "of", "those", "redux", "state", "enhancers", "functions" ]
3c71feeeb039111f33c934257732e2ea6ddde9ff
https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/Configuration.js#L142-L148
train
jtanx/ctagz
ctagz.js
findCTagsFile
function findCTagsFile(searchPath, tagFilePattern = '{.,}tags') { const ctagsFinder = function ctagsFinder(tagPath) { console.error(`ctagz: Searching ${tagPath}`) return fs.readdirAsync(tagPath).then(files => { const matched = files.filter(minimatch.filter(tagFilePattern)).sort() ...
javascript
function findCTagsFile(searchPath, tagFilePattern = '{.,}tags') { const ctagsFinder = function ctagsFinder(tagPath) { console.error(`ctagz: Searching ${tagPath}`) return fs.readdirAsync(tagPath).then(files => { const matched = files.filter(minimatch.filter(tagFilePattern)).sort() ...
[ "function", "findCTagsFile", "(", "searchPath", ",", "tagFilePattern", "=", "'{.,}tags'", ")", "{", "const", "ctagsFinder", "=", "function", "ctagsFinder", "(", "tagPath", ")", "{", "console", ".", "error", "(", "`", "${", "tagPath", "}", "`", ")", "return",...
Finds the CTags file from the specified search path and pattern @param {string} searchPath The path to search. This may either be a file or directory. If a file is passed, its directory is searched. If the tag file is not found, its parent directories are then searched. @param {string} tagFilePattern The search pattern...
[ "Finds", "the", "CTags", "file", "from", "the", "specified", "search", "path", "and", "pattern" ]
9f9da9c578c78ba2b3b869ea3cfe465d50681740
https://github.com/jtanx/ctagz/blob/9f9da9c578c78ba2b3b869ea3cfe465d50681740/ctagz.js#L444-L482
train
jtanx/ctagz
ctagz.js
findCTagsBSearch
function findCTagsBSearch(searchPath, tag, ignoreCase = false, tagFilePattern = '{.,}tags') { const ctags = findCTagsFile(searchPath, tagFilePattern) .disposer(tags => { if (tags) { tags.destroy() } }) return Promise.using(ctags, tags => { if (tag...
javascript
function findCTagsBSearch(searchPath, tag, ignoreCase = false, tagFilePattern = '{.,}tags') { const ctags = findCTagsFile(searchPath, tagFilePattern) .disposer(tags => { if (tags) { tags.destroy() } }) return Promise.using(ctags, tags => { if (tag...
[ "function", "findCTagsBSearch", "(", "searchPath", ",", "tag", ",", "ignoreCase", "=", "false", ",", "tagFilePattern", "=", "'{.,}tags'", ")", "{", "const", "ctags", "=", "findCTagsFile", "(", "searchPath", ",", "tagFilePattern", ")", ".", "disposer", "(", "ta...
Finds the CTags file from the specified search pattern and searches it for the specified tag @param {string} searchPath The path to search for the tags file @param {string} tag The tag to search for in the tags file @param {bool} ignoreCase Whether or not to ignore case when searching @param {string} tagFilePattern T...
[ "Finds", "the", "CTags", "file", "from", "the", "specified", "search", "pattern", "and", "searches", "it", "for", "the", "specified", "tag" ]
9f9da9c578c78ba2b3b869ea3cfe465d50681740
https://github.com/jtanx/ctagz/blob/9f9da9c578c78ba2b3b869ea3cfe465d50681740/ctagz.js#L495-L511
train
novadiscovery/nway
lib/parsers/css/injector.js
injector
function injector(css, module, makeModule, options) { output_css = join(options.output, options.css_folder || 'css'); location_css = options.client + '/' + (options.css_folder || 'css'); output_links = join(options.output, options.links_folder || 'links'); location_links = options.client + '/' + ...
javascript
function injector(css, module, makeModule, options) { output_css = join(options.output, options.css_folder || 'css'); location_css = options.client + '/' + (options.css_folder || 'css'); output_links = join(options.output, options.links_folder || 'links'); location_links = options.client + '/' + ...
[ "function", "injector", "(", "css", ",", "module", ",", "makeModule", ",", "options", ")", "{", "output_css", "=", "join", "(", "options", ".", "output", ",", "options", ".", "css_folder", "||", "'css'", ")", ";", "location_css", "=", "options", ".", "cl...
Injector module for css source A nway parser function who create a nway javascript module that offer a css injector for the css source. The module exports: - inject([media]): Inject css in the page (with a loaded promise) may be called with a media attribute (default:all) - eject(): remove css off the page - injecte...
[ "Injector", "module", "for", "css", "source" ]
fa31c6fe56f2305721e581ac25e8ac9a87e15dda
https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/parsers/css/injector.js#L54-L77
train
xsolon/spexplorerjs
webapi/src/components/sp/widgets/treelight.js
function () { if (!enumer.moveNext()) { cb(groups); return; } var li = enumer.get_current(); var name = li.get_item("Name"); if (name.search(" ") > 0) { doNext(); } else { var id = li.get_item("ID"); var user = web.ensureUser(name...
javascript
function () { if (!enumer.moveNext()) { cb(groups); return; } var li = enumer.get_current(); var name = li.get_item("Name"); if (name.search(" ") > 0) { doNext(); } else { var id = li.get_item("ID"); var user = web.ensureUser(name...
[ "function", "(", ")", "{", "if", "(", "!", "enumer", ".", "moveNext", "(", ")", ")", "{", "cb", "(", "groups", ")", ";", "return", ";", "}", "var", "li", "=", "enumer", ".", "get_current", "(", ")", ";", "var", "name", "=", "li", ".", "get_item...
var count = 0;
[ "var", "count", "=", "0", ";" ]
4e9b410864afb731f88e84414984fa18ac5705f1
https://github.com/xsolon/spexplorerjs/blob/4e9b410864afb731f88e84414984fa18ac5705f1/webapi/src/components/sp/widgets/treelight.js#L121-L146
train
BuZZ-dEE/fussball-de-matchplan-grabber
index.js
parseMatchplan
function parseMatchplan(team, callback) { /** @type {String[]} */ var matchPlanArr = [], /** @type {Matchplan} */ matchPlan, /** @type {String[]} */ matchDetails = [], /** @type {Encounter[]} */ encounters = []; jsdom.env({ url: team, scripts: ["http://code.jquery.com/jque...
javascript
function parseMatchplan(team, callback) { /** @type {String[]} */ var matchPlanArr = [], /** @type {Matchplan} */ matchPlan, /** @type {String[]} */ matchDetails = [], /** @type {Encounter[]} */ encounters = []; jsdom.env({ url: team, scripts: ["http://code.jquery.com/jque...
[ "function", "parseMatchplan", "(", "team", ",", "callback", ")", "{", "/** @type {String[]} */", "var", "matchPlanArr", "=", "[", "]", ",", "/** @type {Matchplan} */", "matchPlan", ",", "/** @type {String[]} */", "matchDetails", "=", "[", "]", ",", "/** @type {Encount...
Parse the match plan. @param {String} team - The next matches team URL. @param {function} callback - The function to call back with the match plan.
[ "Parse", "the", "match", "plan", "." ]
01b4766b7cc1ea42e9acb885ca132b5fc0598cd9
https://github.com/BuZZ-dEE/fussball-de-matchplan-grabber/blob/01b4766b7cc1ea42e9acb885ca132b5fc0598cd9/index.js#L12-L50
train
BuZZ-dEE/fussball-de-matchplan-grabber
index.js
parseMatchTime
function parseMatchTime(matchTime) { /** @type String[] */ var matchTimeArr = matchTime.split(' '); matchTimeArr = [matchTimeArr[1], matchTimeArr[3]]; var dayMonthYear = matchTimeArr[0].split('.'); var hourMinutes = matchTimeArr[1].split(':'); var date = new Date(dayMonthYear[2], parseInt(dayMo...
javascript
function parseMatchTime(matchTime) { /** @type String[] */ var matchTimeArr = matchTime.split(' '); matchTimeArr = [matchTimeArr[1], matchTimeArr[3]]; var dayMonthYear = matchTimeArr[0].split('.'); var hourMinutes = matchTimeArr[1].split(':'); var date = new Date(dayMonthYear[2], parseInt(dayMo...
[ "function", "parseMatchTime", "(", "matchTime", ")", "{", "/** @type String[] */", "var", "matchTimeArr", "=", "matchTime", ".", "split", "(", "' '", ")", ";", "matchTimeArr", "=", "[", "matchTimeArr", "[", "1", "]", ",", "matchTimeArr", "[", "3", "]", "]", ...
Parse the match time. @param {String} matchTime @returns {Date} The match date time.
[ "Parse", "the", "match", "time", "." ]
01b4766b7cc1ea42e9acb885ca132b5fc0598cd9
https://github.com/BuZZ-dEE/fussball-de-matchplan-grabber/blob/01b4766b7cc1ea42e9acb885ca132b5fc0598cd9/index.js#L58-L68
train
BuZZ-dEE/fussball-de-matchplan-grabber
index.js
createMatchplan
function createMatchplan(matchPlanArr, encounters, matchDetails) { var matchPlan = new Matchplan(); matchPlanArr.forEach(function(currentValue, index, array) { matchplanEntry = new MatchplanEntry(currentValue, null, encounters[index], null, matchDetails[index]); matchPlan.addEntry(matchplanEntry...
javascript
function createMatchplan(matchPlanArr, encounters, matchDetails) { var matchPlan = new Matchplan(); matchPlanArr.forEach(function(currentValue, index, array) { matchplanEntry = new MatchplanEntry(currentValue, null, encounters[index], null, matchDetails[index]); matchPlan.addEntry(matchplanEntry...
[ "function", "createMatchplan", "(", "matchPlanArr", ",", "encounters", ",", "matchDetails", ")", "{", "var", "matchPlan", "=", "new", "Matchplan", "(", ")", ";", "matchPlanArr", ".", "forEach", "(", "function", "(", "currentValue", ",", "index", ",", "array", ...
Create the match plan. @param {String[]} matchPlanArr @param {Encounter[]} encounters @param {URL[]} matchDetails @returns {Matchplan}
[ "Create", "the", "match", "plan", "." ]
01b4766b7cc1ea42e9acb885ca132b5fc0598cd9
https://github.com/BuZZ-dEE/fussball-de-matchplan-grabber/blob/01b4766b7cc1ea42e9acb885ca132b5fc0598cd9/index.js#L78-L85
train
bigpipe/bigpipe-watch
index.js
refresh
function refresh(file, event, full) { views.forEach(function loopViews(path) { if (path !== full) return; tempers.forEach(function eachTemper(temper) { delete temper.file[path]; delete temper.compiled[path]; temper.prefetch(path); }); }); assets...
javascript
function refresh(file, event, full) { views.forEach(function loopViews(path) { if (path !== full) return; tempers.forEach(function eachTemper(temper) { delete temper.file[path]; delete temper.compiled[path]; temper.prefetch(path); }); }); assets...
[ "function", "refresh", "(", "file", ",", "event", ",", "full", ")", "{", "views", ".", "forEach", "(", "function", "loopViews", "(", "path", ")", "{", "if", "(", "path", "!==", "full", ")", "return", ";", "tempers", ".", "forEach", "(", "function", "...
Check cache and prefetch if the file is part of the compiler. @param {String} file name @api private
[ "Check", "cache", "and", "prefetch", "if", "the", "file", "is", "part", "of", "the", "compiler", "." ]
337ef162a4c5c4533a2120437e5fbb8a300e0bc2
https://github.com/bigpipe/bigpipe-watch/blob/337ef162a4c5c4533a2120437e5fbb8a300e0bc2/index.js#L78-L102
train
thirdcoder/tritwise
tritwise.js
dyadic_pref_op
function dyadic_pref_op(pref, input1, input2, input_width) { if (pref < -13 || pref > 13) throw new Error('dyadic_pref_op('+pref+'): out of range iii-111'); var bt_pref = pad(3, n2bts(pref), '0'); if (bt_pref.indexOf('i') === -1 || bt_pref.indexOf('0') === -1 || bt_pref.indexOf('1') === -1) throw new Error('d...
javascript
function dyadic_pref_op(pref, input1, input2, input_width) { if (pref < -13 || pref > 13) throw new Error('dyadic_pref_op('+pref+'): out of range iii-111'); var bt_pref = pad(3, n2bts(pref), '0'); if (bt_pref.indexOf('i') === -1 || bt_pref.indexOf('0') === -1 || bt_pref.indexOf('1') === -1) throw new Error('d...
[ "function", "dyadic_pref_op", "(", "pref", ",", "input1", ",", "input2", ",", "input_width", ")", "{", "if", "(", "pref", "<", "-", "13", "||", "pref", ">", "13", ")", "throw", "new", "Error", "(", "'dyadic_pref_op('", "+", "pref", "+", "'): out of range...
Dyadic preference functions
[ "Dyadic", "preference", "functions" ]
d947fa07e88a9e516279c6ac5e9eda6e8228ecf2
https://github.com/thirdcoder/tritwise/blob/d947fa07e88a9e516279c6ac5e9eda6e8228ecf2/tritwise.js#L46-L73
train
glebmachine/node-localcache
index.js
ejectionHandler
function ejectionHandler() { process.stdin.resume(); log(chalk.yellow('Ejection, swooooooooo-oooopphhhf!')); _this.fileSynceInstantly(function ejectionComplete() { log(chalk.green('Everything saved, for god sake')); log('shittung down, see you next life'); process.exit(); }); }
javascript
function ejectionHandler() { process.stdin.resume(); log(chalk.yellow('Ejection, swooooooooo-oooopphhhf!')); _this.fileSynceInstantly(function ejectionComplete() { log(chalk.green('Everything saved, for god sake')); log('shittung down, see you next life'); process.exit(); }); }
[ "function", "ejectionHandler", "(", ")", "{", "process", ".", "stdin", ".", "resume", "(", ")", ";", "log", "(", "chalk", ".", "yellow", "(", "'Ejection, swooooooooo-oooopphhhf!'", ")", ")", ";", "_this", ".", "fileSynceInstantly", "(", "function", "ejectionCo...
handler for exit fo nodejs process
[ "handler", "for", "exit", "fo", "nodejs", "process" ]
a8ecf248c16e11871faa581d61453bd8f81b6d9c
https://github.com/glebmachine/node-localcache/blob/a8ecf248c16e11871faa581d61453bd8f81b6d9c/index.js#L41-L49
train
redisjs/jsr-server
lib/command/server/shutdown.js
execute
function execute(req, res) { var save = undefined; if(req.args[0] !== undefined) { save = req.args[0] === true; } this.shutdown({save: save, code: 0}, process.exit); }
javascript
function execute(req, res) { var save = undefined; if(req.args[0] !== undefined) { save = req.args[0] === true; } this.shutdown({save: save, code: 0}, process.exit); }
[ "function", "execute", "(", "req", ",", "res", ")", "{", "var", "save", "=", "undefined", ";", "if", "(", "req", ".", "args", "[", "0", "]", "!==", "undefined", ")", "{", "save", "=", "req", ".", "args", "[", "0", "]", "===", "true", ";", "}", ...
Respond to the SHUTDOWN command.
[ "Respond", "to", "the", "SHUTDOWN", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/shutdown.js#L19-L25
train
redisjs/jsr-server
lib/command/server/shutdown.js
validate
function validate(cmd, args, info) { AbstractCommand.prototype.validate.apply(this, arguments); if(args[0]) { var arg = ('' + args[0]).toLowerCase(); if(arg !== Constants.SHUTDOWN.SAVE && arg !== Constants.SHUTDOWN.NOSAVE) { throw CommandSyntax; } // rewrite with boolean args[0] = (arg ==...
javascript
function validate(cmd, args, info) { AbstractCommand.prototype.validate.apply(this, arguments); if(args[0]) { var arg = ('' + args[0]).toLowerCase(); if(arg !== Constants.SHUTDOWN.SAVE && arg !== Constants.SHUTDOWN.NOSAVE) { throw CommandSyntax; } // rewrite with boolean args[0] = (arg ==...
[ "function", "validate", "(", "cmd", ",", "args", ",", "info", ")", "{", "AbstractCommand", ".", "prototype", ".", "validate", ".", "apply", "(", "this", ",", "arguments", ")", ";", "if", "(", "args", "[", "0", "]", ")", "{", "var", "arg", "=", "(",...
Validate the SHUTDOWN command.
[ "Validate", "the", "SHUTDOWN", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/shutdown.js#L30-L41
train
Xrew/bobril-chartjs
docs/a.js
function() { var me = this; var barCount = 0; helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { var meta = me.chart.getDatasetMeta(datasetIndex); if (meta.bar && me.chart.isDatasetVisible(datasetIndex)) { ++barCount; } }, me); return barCount; }
javascript
function() { var me = this; var barCount = 0; helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { var meta = me.chart.getDatasetMeta(datasetIndex); if (meta.bar && me.chart.isDatasetVisible(datasetIndex)) { ++barCount; } }, me); return barCount; }
[ "function", "(", ")", "{", "var", "me", "=", "this", ";", "var", "barCount", "=", "0", ";", "helpers", ".", "each", "(", "me", ".", "chart", ".", "data", ".", "datasets", ",", "function", "(", "dataset", ",", "datasetIndex", ")", "{", "var", "meta"...
Get the number of datasets that display bars. We use this to correctly calculate the bar width
[ "Get", "the", "number", "of", "datasets", "that", "display", "bars", ".", "We", "use", "this", "to", "correctly", "calculate", "the", "bar", "width" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L6184-L6194
train
Xrew/bobril-chartjs
docs/a.js
function(datasetIndex) { var barIndex = 0; var meta, j; for (j = 0; j < datasetIndex; ++j) { meta = this.chart.getDatasetMeta(j); if (meta.bar && this.chart.isDatasetVisible(j)) { ++barIndex; } } return barIndex; }
javascript
function(datasetIndex) { var barIndex = 0; var meta, j; for (j = 0; j < datasetIndex; ++j) { meta = this.chart.getDatasetMeta(j); if (meta.bar && this.chart.isDatasetVisible(j)) { ++barIndex; } } return barIndex; }
[ "function", "(", "datasetIndex", ")", "{", "var", "barIndex", "=", "0", ";", "var", "meta", ",", "j", ";", "for", "(", "j", "=", "0", ";", "j", "<", "datasetIndex", ";", "++", "j", ")", "{", "meta", "=", "this", ".", "chart", ".", "getDatasetMeta...
Get bar index from the given dataset index accounting for the fact that not all bars are visible
[ "Get", "bar", "index", "from", "the", "given", "dataset", "index", "accounting", "for", "the", "fact", "that", "not", "all", "bars", "are", "visible" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L6311-L6323
train
Xrew/bobril-chartjs
docs/a.js
function() { var me = this; var options = me.options; var scales = me.scales = {}; var items = []; if (options.scales) { items = items.concat( (options.scales.xAxes || []).map(function(xAxisOptions) { return {options: xAxisOptions, dtype: 'category'}; }), (options.scales.yAxes |...
javascript
function() { var me = this; var options = me.options; var scales = me.scales = {}; var items = []; if (options.scales) { items = items.concat( (options.scales.xAxes || []).map(function(xAxisOptions) { return {options: xAxisOptions, dtype: 'category'}; }), (options.scales.yAxes |...
[ "function", "(", ")", "{", "var", "me", "=", "this", ";", "var", "options", "=", "me", ".", "options", ";", "var", "scales", "=", "me", ".", "scales", "=", "{", "}", ";", "var", "items", "=", "[", "]", ";", "if", "(", "options", ".", "scales", ...
Builds a map of scale ID to scale object for future lookup.
[ "Builds", "a", "map", "of", "scale", "ID", "to", "scale", "object", "for", "future", "lookup", "." ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L8439-L8486
train
Xrew/bobril-chartjs
docs/a.js
function() { if (!stub.ticking) { stub.ticking = true; helpers.requestAnimFrame.call(window, function() { if (stub.resizer) { stub.ticking = false; return callback(); } }); } }
javascript
function() { if (!stub.ticking) { stub.ticking = true; helpers.requestAnimFrame.call(window, function() { if (stub.resizer) { stub.ticking = false; return callback(); } }); } }
[ "function", "(", ")", "{", "if", "(", "!", "stub", ".", "ticking", ")", "{", "stub", ".", "ticking", "=", "true", ";", "helpers", ".", "requestAnimFrame", ".", "call", "(", "window", ",", "function", "(", ")", "{", "if", "(", "stub", ".", "resizer"...
Throttle the callback notification until the next animation frame.
[ "Throttle", "the", "callback", "notification", "until", "the", "next", "animation", "frame", "." ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L10298-L10308
train
Xrew/bobril-chartjs
docs/a.js
function(chart, e) { var position = helpers.getRelativePosition(e, chart.chart); return getIntersectItems(chart, position); }
javascript
function(chart, e) { var position = helpers.getRelativePosition(e, chart.chart); return getIntersectItems(chart, position); }
[ "function", "(", "chart", ",", "e", ")", "{", "var", "position", "=", "helpers", ".", "getRelativePosition", "(", "e", ",", "chart", ".", "chart", ")", ";", "return", "getIntersectItems", "(", "chart", ",", "position", ")", ";", "}" ]
Point mode returns all elements that hit test based on the event position of the event @function Chart.Interaction.modes.intersect @param chart {chart} the chart we are returning items from @param e {Event} the event we are find things at @return {Chart.Element[]} Array of elements that are under the point. If none are...
[ "Point", "mode", "returns", "all", "elements", "that", "hit", "test", "based", "on", "the", "event", "position", "of", "the", "event" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L10575-L10578
train
Xrew/bobril-chartjs
docs/a.js
function(chartInstance, box) { if (!chartInstance.boxes) { chartInstance.boxes = []; } chartInstance.boxes.push(box); }
javascript
function(chartInstance, box) { if (!chartInstance.boxes) { chartInstance.boxes = []; } chartInstance.boxes.push(box); }
[ "function", "(", "chartInstance", ",", "box", ")", "{", "if", "(", "!", "chartInstance", ".", "boxes", ")", "{", "chartInstance", ".", "boxes", "=", "[", "]", ";", "}", "chartInstance", ".", "boxes", ".", "push", "(", "box", ")", ";", "}" ]
Register a box to a chartInstance. A box is simply a reference to an object that requires layout. eg. Scales, Legend, Plugins.
[ "Register", "a", "box", "to", "a", "chartInstance", ".", "A", "box", "is", "simply", "a", "reference", "to", "an", "object", "that", "requires", "layout", ".", "eg", ".", "Scales", "Legend", "Plugins", "." ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L10749-L10754
train
Xrew/bobril-chartjs
docs/a.js
function(extension, args) { var plugins = this._plugins; var ilen = plugins.length; var i, plugin; for (i=0; i<ilen; ++i) { plugin = plugins[i]; if (typeof plugin[extension] === 'function') { if (plugin[extension].apply(plugin, args || []) === false) { return false; } } } ...
javascript
function(extension, args) { var plugins = this._plugins; var ilen = plugins.length; var i, plugin; for (i=0; i<ilen; ++i) { plugin = plugins[i]; if (typeof plugin[extension] === 'function') { if (plugin[extension].apply(plugin, args || []) === false) { return false; } } } ...
[ "function", "(", "extension", ",", "args", ")", "{", "var", "plugins", "=", "this", ".", "_plugins", ";", "var", "ilen", "=", "plugins", ".", "length", ";", "var", "i", ",", "plugin", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ilen", ";", ...
Calls registered plugins on the specified extension, with the given args. This method immediately returns as soon as a plugin explicitly returns false. The returned value can be used, for instance, to interrupt the current action. @param {String} extension the name of the plugin method to call (e.g. 'beforeUpdate'). @p...
[ "Calls", "registered", "plugins", "on", "the", "specified", "extension", "with", "the", "given", "args", ".", "This", "method", "immediately", "returns", "as", "soon", "as", "a", "plugin", "explicitly", "returns", "false", ".", "The", "returned", "value", "can...
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L11653-L11668
train
Xrew/bobril-chartjs
docs/a.js
function(rawValue) { // Null and undefined values first if (rawValue === null || typeof(rawValue) === 'undefined') { return NaN; } // isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values if (typeof(rawValue) === 'number' && !isFinite(rawValue)) { return N...
javascript
function(rawValue) { // Null and undefined values first if (rawValue === null || typeof(rawValue) === 'undefined') { return NaN; } // isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values if (typeof(rawValue) === 'number' && !isFinite(rawValue)) { return N...
[ "function", "(", "rawValue", ")", "{", "// Null and undefined values first", "if", "(", "rawValue", "===", "null", "||", "typeof", "(", "rawValue", ")", "===", "'undefined'", ")", "{", "return", "NaN", ";", "}", "// isNaN(object) returns true, so make sure NaN is chec...
Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
[ "Get", "the", "correct", "value", ".", "NaN", "bad", "inputs", "If", "the", "value", "type", "is", "object", "get", "the", "x", "or", "y", "based", "on", "whether", "we", "are", "horizontal", "or", "not" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12097-L12116
train
Xrew/bobril-chartjs
docs/a.js
function(index, includeOffset) { var me = this; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); var tickWidth = innerWidth / Math.max((me.ticks.length - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1); var pixel = (tickWidth * index) + me.paddingLeft; ...
javascript
function(index, includeOffset) { var me = this; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); var tickWidth = innerWidth / Math.max((me.ticks.length - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1); var pixel = (tickWidth * index) + me.paddingLeft; ...
[ "function", "(", "index", ",", "includeOffset", ")", "{", "var", "me", "=", "this", ";", "if", "(", "me", ".", "isHorizontal", "(", ")", ")", "{", "var", "innerWidth", "=", "me", ".", "width", "-", "(", "me", ".", "paddingLeft", "+", "me", ".", "...
Used for tick location, should
[ "Used", "for", "tick", "location", "should" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12129-L12146
train
Xrew/bobril-chartjs
docs/a.js
function(decimal /* , includeOffset*/) { var me = this; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); var valueOffset = (innerWidth * decimal) + me.paddingLeft; var finalVal = me.left + Math.round(valueOffset); finalVal += me.isFullWidth() ? me.margins.l...
javascript
function(decimal /* , includeOffset*/) { var me = this; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); var valueOffset = (innerWidth * decimal) + me.paddingLeft; var finalVal = me.left + Math.round(valueOffset); finalVal += me.isFullWidth() ? me.margins.l...
[ "function", "(", "decimal", "/* , includeOffset*/", ")", "{", "var", "me", "=", "this", ";", "if", "(", "me", ".", "isHorizontal", "(", ")", ")", "{", "var", "innerWidth", "=", "me", ".", "width", "-", "(", "me", ".", "paddingLeft", "+", "me", ".", ...
Utility for getting the pixel location of a percentage of scale
[ "Utility", "for", "getting", "the", "pixel", "location", "of", "a", "percentage", "of", "scale" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12149-L12160
train
Xrew/bobril-chartjs
docs/a.js
function(generationOptions, dataRange) { var ticks = []; // To get a "nice" value for the tick spacing, we will use the appropriately named // "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks // for details. var spacing; ...
javascript
function(generationOptions, dataRange) { var ticks = []; // To get a "nice" value for the tick spacing, we will use the appropriately named // "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks // for details. var spacing; ...
[ "function", "(", "generationOptions", ",", "dataRange", ")", "{", "var", "ticks", "=", "[", "]", ";", "// To get a \"nice\" value for the tick spacing, we will use the appropriately named", "// \"nice number\" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm...
Interface for the options provided to the numeric tick generator @interface INumericTickGenerationOptions The maximum number of ticks to display @name INumericTickGenerationOptions#maxTicks @type Number The distance between each tick. @name INumericTickGenerationOptions#stepSize @type Number @optional Forced mini...
[ "Interface", "for", "the", "options", "provided", "to", "the", "numeric", "tick", "generator" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12555-L12596
train
Xrew/bobril-chartjs
docs/a.js
function() { var chartOpts = this.chart.options; if (chartOpts && chartOpts.title) { this.options = helpers.configMerge(Chart.defaults.global.title, chartOpts.title); } }
javascript
function() { var chartOpts = this.chart.options; if (chartOpts && chartOpts.title) { this.options = helpers.configMerge(Chart.defaults.global.title, chartOpts.title); } }
[ "function", "(", ")", "{", "var", "chartOpts", "=", "this", ".", "chart", ".", "options", ";", "if", "(", "chartOpts", "&&", "chartOpts", ".", "title", ")", "{", "this", ".", "options", "=", "helpers", ".", "configMerge", "(", "Chart", ".", "defaults",...
These methods are ordered by lifecycle. Utilities then follow.
[ "These", "methods", "are", "ordered", "by", "lifecycle", ".", "Utilities", "then", "follow", "." ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L12740-L12745
train
Xrew/bobril-chartjs
docs/a.js
getBaseModel
function getBaseModel(tooltipOpts) { var globalDefaults = Chart.defaults.global; var getValueOrDefault = helpers.getValueOrDefault; return { // Positioning xPadding: tooltipOpts.xPadding, yPadding: tooltipOpts.yPadding, xAlign: tooltipOpts.xAlign, yAlign: tooltipOpts.yAlign, // Body bodyFon...
javascript
function getBaseModel(tooltipOpts) { var globalDefaults = Chart.defaults.global; var getValueOrDefault = helpers.getValueOrDefault; return { // Positioning xPadding: tooltipOpts.xPadding, yPadding: tooltipOpts.yPadding, xAlign: tooltipOpts.xAlign, yAlign: tooltipOpts.yAlign, // Body bodyFon...
[ "function", "getBaseModel", "(", "tooltipOpts", ")", "{", "var", "globalDefaults", "=", "Chart", ".", "defaults", ".", "global", ";", "var", "getValueOrDefault", "=", "helpers", ".", "getValueOrDefault", ";", "return", "{", "// Positioning", "xPadding", ":", "to...
Helper to get the reset model for the tooltip @param tooltipOpts {Object} the tooltip options
[ "Helper", "to", "get", "the", "reset", "model", "for", "the", "tooltip" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L13047-L13092
train
Xrew/bobril-chartjs
docs/a.js
function(elements) { if (!elements.length) { return false; } var i, len; var x = 0; var y = 0; var count = 0; for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; if (el && el.hasValue()) { var pos = el.tooltipPosition(); x += pos.x; y += pos.y; ...
javascript
function(elements) { if (!elements.length) { return false; } var i, len; var x = 0; var y = 0; var count = 0; for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; if (el && el.hasValue()) { var pos = el.tooltipPosition(); x += pos.x; y += pos.y; ...
[ "function", "(", "elements", ")", "{", "if", "(", "!", "elements", ".", "length", ")", "{", "return", "false", ";", "}", "var", "i", ",", "len", ";", "var", "x", "=", "0", ";", "var", "y", "=", "0", ";", "var", "count", "=", "0", ";", "for", ...
Average mode places the tooltip at the average position of the elements shown @function Chart.Tooltip.positioners.average @param elements {ChartElement[]} the elements being displayed in the tooltip @returns {Point} tooltip position
[ "Average", "mode", "places", "the", "tooltip", "at", "the", "average", "position", "of", "the", "elements", "shown" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L13728-L13752
train
Xrew/bobril-chartjs
docs/a.js
lineToPoint
function lineToPoint(previousPoint, point) { var pointVM = point._view; if (point._view.steppedLine === true) { ctx.lineTo(pointVM.x, previousPoint._view.y); ctx.lineTo(pointVM.x, pointVM.y); } else if (point._view.tension === 0) { ctx.lineTo(pointVM.x, pointVM.y); } else { ctx.bezie...
javascript
function lineToPoint(previousPoint, point) { var pointVM = point._view; if (point._view.steppedLine === true) { ctx.lineTo(pointVM.x, previousPoint._view.y); ctx.lineTo(pointVM.x, pointVM.y); } else if (point._view.tension === 0) { ctx.lineTo(pointVM.x, pointVM.y); } else { ctx.bezie...
[ "function", "lineToPoint", "(", "previousPoint", ",", "point", ")", "{", "var", "pointVM", "=", "point", ".", "_view", ";", "if", "(", "point", ".", "_view", ".", "steppedLine", "===", "true", ")", "{", "ctx", ".", "lineTo", "(", "pointVM", ".", "x", ...
Helper function to draw a line to a point
[ "Helper", "function", "to", "draw", "a", "line", "to", "a", "point" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L13943-L13960
train
Xrew/bobril-chartjs
docs/a.js
function() { var me = this; var labels = me.getLabels(); me.minIndex = 0; me.maxIndex = labels.length - 1; var findIndex; if (me.options.ticks.min !== undefined) { // user specified min value findIndex = helpers.indexOf(labels, me.options.ticks.min); me.minIndex = findIndex !== -1 ? findI...
javascript
function() { var me = this; var labels = me.getLabels(); me.minIndex = 0; me.maxIndex = labels.length - 1; var findIndex; if (me.options.ticks.min !== undefined) { // user specified min value findIndex = helpers.indexOf(labels, me.options.ticks.min); me.minIndex = findIndex !== -1 ? findI...
[ "function", "(", ")", "{", "var", "me", "=", "this", ";", "var", "labels", "=", "me", ".", "getLabels", "(", ")", ";", "me", ".", "minIndex", "=", "0", ";", "me", ".", "maxIndex", "=", "labels", ".", "length", "-", "1", ";", "var", "findIndex", ...
Implement this so that
[ "Implement", "this", "so", "that" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L14367-L14388
train
Xrew/bobril-chartjs
docs/a.js
function(value, index, datasetIndex, includeOffset) { var me = this; // 1 is added because we need the length but we have the indexes var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1); if (value !== undefined && isNaN(index)) { var labels = ...
javascript
function(value, index, datasetIndex, includeOffset) { var me = this; // 1 is added because we need the length but we have the indexes var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - ((me.options.gridLines.offsetGridLines) ? 0 : 1)), 1); if (value !== undefined && isNaN(index)) { var labels = ...
[ "function", "(", "value", ",", "index", ",", "datasetIndex", ",", "includeOffset", ")", "{", "var", "me", "=", "this", ";", "// 1 is added because we need the length but we have the indexes", "var", "offsetAmt", "=", "Math", ".", "max", "(", "(", "me", ".", "max...
Used to get data value locations. Value can either be an index or a numerical value
[ "Used", "to", "get", "data", "value", "locations", ".", "Value", "can", "either", "be", "an", "index", "or", "a", "numerical", "value" ]
8362f4ba54fb216343d30cc6a3ef35e98fa9cb44
https://github.com/Xrew/bobril-chartjs/blob/8362f4ba54fb216343d30cc6a3ef35e98fa9cb44/docs/a.js#L14409-L14440
train
ssmereka/cramit
libs/index.js
function(err, files, results) { if(err) { cb(err); } else { for(var i = 0; i < results.length; i++) { if(results[i] !== undefined && results[i].error === undefined && results[i].id !== undefined) { fixtures[results[i].id] = results[i]; } } cb(undefined, fixtures...
javascript
function(err, files, results) { if(err) { cb(err); } else { for(var i = 0; i < results.length; i++) { if(results[i] !== undefined && results[i].error === undefined && results[i].id !== undefined) { fixtures[results[i].id] = results[i]; } } cb(undefined, fixtures...
[ "function", "(", "err", ",", "files", ",", "results", ")", "{", "if", "(", "err", ")", "{", "cb", "(", "err", ")", ";", "}", "else", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "results", ".", "length", ";", "i", "++", ")", "{", ...
Format the returned data object into a fixtures object, with the fixture ID as the key and the fixture class as the value.
[ "Format", "the", "returned", "data", "object", "into", "a", "fixtures", "object", "with", "the", "fixture", "ID", "as", "the", "key", "and", "the", "fixture", "class", "as", "the", "value", "." ]
dac45479ca2b9455095624637a4796c1d2a710b9
https://github.com/ssmereka/cramit/blob/dac45479ca2b9455095624637a4796c1d2a710b9/libs/index.js#L255-L266
train
xsolon/spexplorerjs
webapi/src/components/sp/widgets/field.selector.js
function (listTitle) { return $.Deferred(function (dfd) { trace.debug(`loading list ${listTitle}`); spdal.getList(listTitle).done(function (list) { onListChange(list); listCtrl.data("xSPTreeLight").value(list); }).always(function () { dfd.resolve(); }); }).promise(); }
javascript
function (listTitle) { return $.Deferred(function (dfd) { trace.debug(`loading list ${listTitle}`); spdal.getList(listTitle).done(function (list) { onListChange(list); listCtrl.data("xSPTreeLight").value(list); }).always(function () { dfd.resolve(); }); }).promise(); }
[ "function", "(", "listTitle", ")", "{", "return", "$", ".", "Deferred", "(", "function", "(", "dfd", ")", "{", "trace", ".", "debug", "(", "`", "${", "listTitle", "}", "`", ")", ";", "spdal", ".", "getList", "(", "listTitle", ")", ".", "done", "(",...
hide treelight section
[ "hide", "treelight", "section" ]
4e9b410864afb731f88e84414984fa18ac5705f1
https://github.com/xsolon/spexplorerjs/blob/4e9b410864afb731f88e84414984fa18ac5705f1/webapi/src/components/sp/widgets/field.selector.js#L238-L252
train
labs-js/turbo-git-config
lib/utils.js
checkGitRepoExistence
function checkGitRepoExistence() { return new Promise(function(resolve, reject) { var checkRepoCommand = childProcess.exec('git branch'); checkRepoCommand.stderr.on('data', function(err) { reject(err); }); checkRepoCommand.on('close', function(co...
javascript
function checkGitRepoExistence() { return new Promise(function(resolve, reject) { var checkRepoCommand = childProcess.exec('git branch'); checkRepoCommand.stderr.on('data', function(err) { reject(err); }); checkRepoCommand.on('close', function(co...
[ "function", "checkGitRepoExistence", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "checkRepoCommand", "=", "childProcess", ".", "exec", "(", "'git branch'", ")", ";", "checkRepoCommand", ".", "stde...
Exec git branch to check if exist .git files
[ "Exec", "git", "branch", "to", "check", "if", "exist", ".", "git", "files" ]
b8e540a426cc778df36a62df9807d03a82322c8f
https://github.com/labs-js/turbo-git-config/blob/b8e540a426cc778df36a62df9807d03a82322c8f/lib/utils.js#L36-L50
train
bucharest-gold/unifiedpush-admin-client
lib/variants.js
create
function create (client) { return function create (options) { options = options || {}; const type = getType(options); const req = { url: `${client.baseUrl}/rest/applications/${options.pushAppId}/${type}`, method: 'POST' }; const data = { name: options.name, description: ...
javascript
function create (client) { return function create (options) { options = options || {}; const type = getType(options); const req = { url: `${client.baseUrl}/rest/applications/${options.pushAppId}/${type}`, method: 'POST' }; const data = { name: options.name, description: ...
[ "function", "create", "(", "client", ")", "{", "return", "function", "create", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "const", "type", "=", "getType", "(", "options", ")", ";", "const", "req", "=", "{", "url", ":", ...
A function to create a variant of a particular type. @param {object} options - An options object @param {string} options.pushAppId - The id of the push application @param {string} options.type - The type variant. - ex: android, ios, .... All Variants will have a type, name, and an optional description @param {string}...
[ "A", "function", "to", "create", "a", "variant", "of", "a", "particular", "type", "." ]
a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e
https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/variants.js#L106-L157
train
tolokoban/ToloFrameWork
ker/cls/tfw.CssAnim.js
function(variables) { var animation = false, animationstring = 'animation', keyframeprefix = '', domPrefixes = ["Webkit", "Moz", "O", "ms", "Khtml"], pfx = '', elm = document.querySelector("body"); if( elm.style.animationName !== undefined ) { animation = true; }...
javascript
function(variables) { var animation = false, animationstring = 'animation', keyframeprefix = '', domPrefixes = ["Webkit", "Moz", "O", "ms", "Khtml"], pfx = '', elm = document.querySelector("body"); if( elm.style.animationName !== undefined ) { animation = true; }...
[ "function", "(", "variables", ")", "{", "var", "animation", "=", "false", ",", "animationstring", "=", "'animation'", ",", "keyframeprefix", "=", "''", ",", "domPrefixes", "=", "[", "\"Webkit\"", ",", "\"Moz\"", ",", "\"O\"", ",", "\"ms\"", ",", "\"Khtml\"",...
Look for css prefixes.
[ "Look", "for", "css", "prefixes", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/cls/tfw.CssAnim.js#L16-L42
train
tuunanen/camelton
lib/cli.js
cli
function cli(program) { var source = program.args[0] ? path.resolve(program.args[0]) : null, destinations = program.args[1] ? Array.prototype.slice.call(program.args, 1) : [], options = {}, camelton; if (!source) { console.error('Source file not defined.'); program.help(); } if (!des...
javascript
function cli(program) { var source = program.args[0] ? path.resolve(program.args[0]) : null, destinations = program.args[1] ? Array.prototype.slice.call(program.args, 1) : [], options = {}, camelton; if (!source) { console.error('Source file not defined.'); program.help(); } if (!des...
[ "function", "cli", "(", "program", ")", "{", "var", "source", "=", "program", ".", "args", "[", "0", "]", "?", "path", ".", "resolve", "(", "program", ".", "args", "[", "0", "]", ")", ":", "null", ",", "destinations", "=", "program", ".", "args", ...
Command-line program. @param {object} program - Commander program
[ "Command", "-", "line", "program", "." ]
2beee32431e1b2867396e25f560f8dbd53535041
https://github.com/tuunanen/camelton/blob/2beee32431e1b2867396e25f560f8dbd53535041/lib/cli.js#L18-L60
train
jaredhanson/connect-lrdd
lib/middleware/lrdd.js
serializeToXRD
function serializeToXRD(descriptor) { var xml = '<?xml version="1.0" encoding="UTF-8"?>'; xml += '<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; if (descriptor.expires) { xml += '<Expires>' + xsdDateTimeString(descriptor.expires) + '</Expires>'...
javascript
function serializeToXRD(descriptor) { var xml = '<?xml version="1.0" encoding="UTF-8"?>'; xml += '<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; if (descriptor.expires) { xml += '<Expires>' + xsdDateTimeString(descriptor.expires) + '</Expires>'...
[ "function", "serializeToXRD", "(", "descriptor", ")", "{", "var", "xml", "=", "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'", ";", "xml", "+=", "'<XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'", ";", "if", "(", "de...
Serialize `descriptor` to XRD format. @param {Descriptor} descriptor @return {String} @api private
[ "Serialize", "descriptor", "to", "XRD", "format", "." ]
6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1
https://github.com/jaredhanson/connect-lrdd/blob/6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1/lib/middleware/lrdd.js#L94-L148
train
jaredhanson/connect-lrdd
lib/middleware/lrdd.js
serializeToJRD
function serializeToJRD(descriptor) { var obj = {}; if (descriptor.expires) { obj.expires = xsdDateTimeString(descriptor.expires); } if (descriptor.subject) { obj.subject = descriptor.subject; } if (descriptor.aliases.length > 0) { obj.aliases = []; descriptor.aliases.forEach(function(alias) { obj...
javascript
function serializeToJRD(descriptor) { var obj = {}; if (descriptor.expires) { obj.expires = xsdDateTimeString(descriptor.expires); } if (descriptor.subject) { obj.subject = descriptor.subject; } if (descriptor.aliases.length > 0) { obj.aliases = []; descriptor.aliases.forEach(function(alias) { obj...
[ "function", "serializeToJRD", "(", "descriptor", ")", "{", "var", "obj", "=", "{", "}", ";", "if", "(", "descriptor", ".", "expires", ")", "{", "obj", ".", "expires", "=", "xsdDateTimeString", "(", "descriptor", ".", "expires", ")", ";", "}", "if", "("...
Serialize `descriptor` to JRD format. @param {Descriptor} descriptor @return {String} @api private
[ "Serialize", "descriptor", "to", "JRD", "format", "." ]
6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1
https://github.com/jaredhanson/connect-lrdd/blob/6d1f1f9b98cdd1ebc5fb3f048c4eddf5ef034ec1/lib/middleware/lrdd.js#L157-L207
train
nickeljew/unjq-ajax
lib/ajax.js
textXml
function textXml(data) { var xml = undefined, tmp = undefined; if (!data || typeof data !== "string") { return null; } // Support: IE9 try { tmp = new DOMParser(); ...
javascript
function textXml(data) { var xml = undefined, tmp = undefined; if (!data || typeof data !== "string") { return null; } // Support: IE9 try { tmp = new DOMParser(); ...
[ "function", "textXml", "(", "data", ")", "{", "var", "xml", "=", "undefined", ",", "tmp", "=", "undefined", ";", "if", "(", "!", "data", "||", "typeof", "data", "!==", "\"string\"", ")", "{", "return", "null", ";", "}", "// Support: IE9", "try", "{", ...
Parse text as xml
[ "Parse", "text", "as", "xml" ]
126626c08640e9ae386fea4e34b6b10482c5dbd6
https://github.com/nickeljew/unjq-ajax/blob/126626c08640e9ae386fea4e34b6b10482c5dbd6/lib/ajax.js#L824-L843
train
nickeljew/unjq-ajax
lib/ajax.js
ajaxSetup
function ajaxSetup(target, settings) { return settings ? // Building a settings object ajaxExtend(ajaxExtend(target, this.ajaxSettings), settings) : // Extending ajaxSettings ajaxExtend(this.ajaxSettings, target); }
javascript
function ajaxSetup(target, settings) { return settings ? // Building a settings object ajaxExtend(ajaxExtend(target, this.ajaxSettings), settings) : // Extending ajaxSettings ajaxExtend(this.ajaxSettings, target); }
[ "function", "ajaxSetup", "(", "target", ",", "settings", ")", "{", "return", "settings", "?", "// Building a settings object", "ajaxExtend", "(", "ajaxExtend", "(", "target", ",", "this", ".", "ajaxSettings", ")", ",", "settings", ")", ":", "// Extending ajaxSetti...
Creates a full fledged settings object into target with both ajaxSettings and settings fields. If target is omitted, writes into ajaxSettings.
[ "Creates", "a", "full", "fledged", "settings", "object", "into", "target", "with", "both", "ajaxSettings", "and", "settings", "fields", ".", "If", "target", "is", "omitted", "writes", "into", "ajaxSettings", "." ]
126626c08640e9ae386fea4e34b6b10482c5dbd6
https://github.com/nickeljew/unjq-ajax/blob/126626c08640e9ae386fea4e34b6b10482c5dbd6/lib/ajax.js#L859-L867
train
nickeljew/unjq-ajax
lib/ajax.js
abort
function abort(statusText) { var finalText = statusText || strAbort; if (transport) { transport.abort(finalText); } done(0, finalText); return this; }
javascript
function abort(statusText) { var finalText = statusText || strAbort; if (transport) { transport.abort(finalText); } done(0, finalText); return this; }
[ "function", "abort", "(", "statusText", ")", "{", "var", "finalText", "=", "statusText", "||", "strAbort", ";", "if", "(", "transport", ")", "{", "transport", ".", "abort", "(", "finalText", ")", ";", "}", "done", "(", "0", ",", "finalText", ")", ";", ...
Cancel the request
[ "Cancel", "the", "request" ]
126626c08640e9ae386fea4e34b6b10482c5dbd6
https://github.com/nickeljew/unjq-ajax/blob/126626c08640e9ae386fea4e34b6b10482c5dbd6/lib/ajax.js#L997-L1004
train
ENOW-IJI/ENOW-console
dist/src/anchors.js
function (endpoint, anchorPos) { continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ]; continuousAnchorOrientations[endpoint.id] = orientation; }
javascript
function (endpoint, anchorPos) { continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ]; continuousAnchorOrientations[endpoint.id] = orientation; }
[ "function", "(", "endpoint", ",", "anchorPos", ")", "{", "continuousAnchorLocations", "[", "endpoint", ".", "id", "]", "=", "[", "anchorPos", "[", "0", "]", ",", "anchorPos", "[", "1", "]", ",", "anchorPos", "[", "2", "]", ",", "anchorPos", "[", "3", ...
takes a computed anchor position and adjusts it for parent offset and scroll, then stores it.
[ "takes", "a", "computed", "anchor", "position", "and", "adjusts", "it", "for", "parent", "offset", "and", "scroll", "then", "stores", "it", "." ]
f241ed4e645a7da0cd1a6ca86e896a5b73be53e5
https://github.com/ENOW-IJI/ENOW-console/blob/f241ed4e645a7da0cd1a6ca86e896a5b73be53e5/dist/src/anchors.js#L172-L175
train
vkiding/jud-previewer
build/libs/server.js
sendSocketMessage
function sendSocketMessage(message) { clients.forEach(function (client) { if (client.readyState === WebSocket.OPEN) { client.send(message || 'refresh', function (err) { if (err) { npmlog.error(err); } }); } }); }
javascript
function sendSocketMessage(message) { clients.forEach(function (client) { if (client.readyState === WebSocket.OPEN) { client.send(message || 'refresh', function (err) { if (err) { npmlog.error(err); } }); } }); }
[ "function", "sendSocketMessage", "(", "message", ")", "{", "clients", ".", "forEach", "(", "function", "(", "client", ")", "{", "if", "(", "client", ".", "readyState", "===", "WebSocket", ".", "OPEN", ")", "{", "client", ".", "send", "(", "message", "||"...
send web socket messsage to client
[ "send", "web", "socket", "messsage", "to", "client" ]
795e2b649f840e9515858332023d5238640730da
https://github.com/vkiding/jud-previewer/blob/795e2b649f840e9515858332023d5238640730da/build/libs/server.js#L100-L110
train
tolokoban/ToloFrameWork
ker/mod/tfw.binding.property-manager.js
getProperties
function getProperties( property ) { var properties = property[ PROPERTY_SYMBOL ]; if ( !Array.isArray( properties ) ) return null; return properties; }
javascript
function getProperties( property ) { var properties = property[ PROPERTY_SYMBOL ]; if ( !Array.isArray( properties ) ) return null; return properties; }
[ "function", "getProperties", "(", "property", ")", "{", "var", "properties", "=", "property", "[", "PROPERTY_SYMBOL", "]", ";", "if", "(", "!", "Array", ".", "isArray", "(", "properties", ")", ")", "return", "null", ";", "return", "properties", ";", "}" ]
Return the linkable properties which holds this value, or `null`.
[ "Return", "the", "linkable", "properties", "which", "holds", "this", "value", "or", "null", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L219-L223
train
tolokoban/ToloFrameWork
ker/mod/tfw.binding.property-manager.js
applyAttributesToTarget
function applyAttributesToTarget( source, target ) { var attName, attValue; for ( attName in source ) { if ( module.exports.isLinkable( target, attName ) ) { attValue = source[ attName ]; target[ attName ] = attValue; } } }
javascript
function applyAttributesToTarget( source, target ) { var attName, attValue; for ( attName in source ) { if ( module.exports.isLinkable( target, attName ) ) { attValue = source[ attName ]; target[ attName ] = attValue; } } }
[ "function", "applyAttributesToTarget", "(", "source", ",", "target", ")", "{", "var", "attName", ",", "attValue", ";", "for", "(", "attName", "in", "source", ")", "{", "if", "(", "module", ".", "exports", ".", "isLinkable", "(", "target", ",", "attName", ...
Copy all the attributes of `source` into `target`.
[ "Copy", "all", "the", "attributes", "of", "source", "into", "target", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L249-L257
train
tolokoban/ToloFrameWork
ker/mod/tfw.binding.property-manager.js
addPropToValue
function addPropToValue( prop, value ) { if ( value === undefined || value === null ) return; if ( value.isContentChangeAware !== true ) return; var properties = value[ PROPERTY_SYMBOL ]; if ( !Array.isArray( properties ) ) { properties = [ prop ]; } else if ( properties.indexOf( prop ) === ...
javascript
function addPropToValue( prop, value ) { if ( value === undefined || value === null ) return; if ( value.isContentChangeAware !== true ) return; var properties = value[ PROPERTY_SYMBOL ]; if ( !Array.isArray( properties ) ) { properties = [ prop ]; } else if ( properties.indexOf( prop ) === ...
[ "function", "addPropToValue", "(", "prop", ",", "value", ")", "{", "if", "(", "value", "===", "undefined", "||", "value", "===", "null", ")", "return", ";", "if", "(", "value", ".", "isContentChangeAware", "!==", "true", ")", "return", ";", "var", "prope...
Add an `info` attribute to the property's value. This is useful to find the container and the property name from the value.
[ "Add", "an", "info", "attribute", "to", "the", "property", "s", "value", ".", "This", "is", "useful", "to", "find", "the", "container", "and", "the", "property", "name", "from", "the", "value", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L336-L346
train
tolokoban/ToloFrameWork
ker/mod/tfw.binding.property-manager.js
readonly
function readonly( target, attribs ) { const attribNames = Object.keys( attribs ); attribNames.forEach( function ( attName ) { const attValue = attribs[ attName ]; if ( typeof attValue === 'function' ) { Object.defineProperty( target, attName, { ...
javascript
function readonly( target, attribs ) { const attribNames = Object.keys( attribs ); attribNames.forEach( function ( attName ) { const attValue = attribs[ attName ]; if ( typeof attValue === 'function' ) { Object.defineProperty( target, attName, { ...
[ "function", "readonly", "(", "target", ",", "attribs", ")", "{", "const", "attribNames", "=", "Object", ".", "keys", "(", "attribs", ")", ";", "attribNames", ".", "forEach", "(", "function", "(", "attName", ")", "{", "const", "attValue", "=", "attribs", ...
Create a readonly attribute. @param {object} target - Object which will bear the readonly attribute. @param {object} attribs - Attributes with their values. @returns {undefined}
[ "Create", "a", "readonly", "attribute", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.binding.property-manager.js#L425-L453
train
vkiding/judpack-common
src/FileUpdater.js
updatePathInternal
function updatePathInternal(sourcePath, targetPath, options, log) { var rootDir = (options && options.rootDir) || ""; var targetFullPath = path.join(rootDir, targetPath); var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null; var sourceStats = null; if (sourcePath) { ...
javascript
function updatePathInternal(sourcePath, targetPath, options, log) { var rootDir = (options && options.rootDir) || ""; var targetFullPath = path.join(rootDir, targetPath); var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null; var sourceStats = null; if (sourcePath) { ...
[ "function", "updatePathInternal", "(", "sourcePath", ",", "targetPath", ",", "options", ",", "log", ")", "{", "var", "rootDir", "=", "(", "options", "&&", "options", ".", "rootDir", ")", "||", "\"\"", ";", "var", "targetFullPath", "=", "path", ".", "join",...
Helper for updatePath and updatePaths functions. Queries stats for source and target and ensures target directory exists before copying a file.
[ "Helper", "for", "updatePath", "and", "updatePaths", "functions", ".", "Queries", "stats", "for", "source", "and", "target", "and", "ensures", "target", "directory", "exists", "before", "copying", "a", "file", "." ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L135-L158
train
vkiding/judpack-common
src/FileUpdater.js
updatePaths
function updatePaths(pathMap, options, log) { if (!pathMap || typeof pathMap !== "object" || Array.isArray(pathMap)) { throw new Error("An object mapping from target paths to source paths is required."); } log = log || function(message) { }; var updated = false; // Iterate in sorted order...
javascript
function updatePaths(pathMap, options, log) { if (!pathMap || typeof pathMap !== "object" || Array.isArray(pathMap)) { throw new Error("An object mapping from target paths to source paths is required."); } log = log || function(message) { }; var updated = false; // Iterate in sorted order...
[ "function", "updatePaths", "(", "pathMap", ",", "options", ",", "log", ")", "{", "if", "(", "!", "pathMap", "||", "typeof", "pathMap", "!==", "\"object\"", "||", "Array", ".", "isArray", "(", "pathMap", ")", ")", "{", "throw", "new", "Error", "(", "\"A...
Updates files and directories based on a mapping from target paths to source paths. Targets with null sources in the map are deleted. @param {Object} pathMap A dictionary mapping from target paths to source paths. @param {Object} [options] Optional additional parameters for the update. @param {string} [options.rootDir...
[ "Updates", "files", "and", "directories", "based", "on", "a", "mapping", "from", "target", "paths", "to", "source", "paths", ".", "Targets", "with", "null", "sources", "in", "the", "map", "are", "deleted", "." ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L211-L227
train
vkiding/judpack-common
src/FileUpdater.js
mergeAndUpdateDir
function mergeAndUpdateDir(sourceDirs, targetDir, options, log) { if (sourceDirs && typeof sourceDirs === "string") { sourceDirs = [ sourceDirs ]; } else if (!Array.isArray(sourceDirs)) { throw new Error("A source directory path or array of paths is required."); } if (!targetDir || type...
javascript
function mergeAndUpdateDir(sourceDirs, targetDir, options, log) { if (sourceDirs && typeof sourceDirs === "string") { sourceDirs = [ sourceDirs ]; } else if (!Array.isArray(sourceDirs)) { throw new Error("A source directory path or array of paths is required."); } if (!targetDir || type...
[ "function", "mergeAndUpdateDir", "(", "sourceDirs", ",", "targetDir", ",", "options", ",", "log", ")", "{", "if", "(", "sourceDirs", "&&", "typeof", "sourceDirs", "===", "\"string\"", ")", "{", "sourceDirs", "=", "[", "sourceDirs", "]", ";", "}", "else", "...
Updates a target directory with merged files and subdirectories from source directories. @param {string|string[]} sourceDirs Required source directory or array of source directories to be merged into the target. The directories are listed in order of precedence; files in directories later in the array supersede files ...
[ "Updates", "a", "target", "directory", "with", "merged", "files", "and", "subdirectories", "from", "source", "directories", "." ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L258-L321
train
vkiding/judpack-common
src/FileUpdater.js
mapDirectory
function mapDirectory(rootDir, subDir, include, exclude) { var dirMap = { "": { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } }; mapSubdirectory(rootDir, subDir, "", include, exclude, dirMap); return dirMap; function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dir...
javascript
function mapDirectory(rootDir, subDir, include, exclude) { var dirMap = { "": { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } }; mapSubdirectory(rootDir, subDir, "", include, exclude, dirMap); return dirMap; function mapSubdirectory(rootDir, subDir, relativeDir, include, exclude, dir...
[ "function", "mapDirectory", "(", "rootDir", ",", "subDir", ",", "include", ",", "exclude", ")", "{", "var", "dirMap", "=", "{", "\"\"", ":", "{", "subDir", ":", "subDir", ",", "stats", ":", "fs", ".", "statSync", "(", "path", ".", "join", "(", "rootD...
Creates a dictionary map of all files and directories under a path.
[ "Creates", "a", "dictionary", "map", "of", "all", "files", "and", "directories", "under", "a", "path", "." ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L326-L369
train
vkiding/judpack-common
src/FileUpdater.js
mergePathMaps
function mergePathMaps(sourceMaps, targetMap, targetDir) { // Merge multiple source maps together, along with target path info. // Entries in later source maps override those in earlier source maps. // Target stats will be filled in below for targets that exist. var pathMap = {}; sourceMaps.forEach(...
javascript
function mergePathMaps(sourceMaps, targetMap, targetDir) { // Merge multiple source maps together, along with target path info. // Entries in later source maps override those in earlier source maps. // Target stats will be filled in below for targets that exist. var pathMap = {}; sourceMaps.forEach(...
[ "function", "mergePathMaps", "(", "sourceMaps", ",", "targetMap", ",", "targetDir", ")", "{", "// Merge multiple source maps together, along with target path info.", "// Entries in later source maps override those in earlier source maps.", "// Target stats will be filled in below for targets...
Merges together multiple source maps and a target map into a single mapping from relative paths to objects with target and source paths and stats.
[ "Merges", "together", "multiple", "source", "maps", "and", "a", "target", "map", "into", "a", "single", "mapping", "from", "relative", "paths", "to", "objects", "with", "target", "and", "source", "paths", "and", "stats", "." ]
5b87d3f1cb10c2c867243e3a692d39b4bb189dd4
https://github.com/vkiding/judpack-common/blob/5b87d3f1cb10c2c867243e3a692d39b4bb189dd4/src/FileUpdater.js#L375-L409
train
nivesh2/dotenv-minimal
index.js
readFromEnvFile
function readFromEnvFile() { try { // .env file should be in root directory const data = require('fs').readFileSync(require('path').join(__dirname, '../../.env'), 'utf8') const env = {} data.split('\n').filter((v) => { return v !== '' }).filter((v) => { return v.indexOf('#') === -1 ...
javascript
function readFromEnvFile() { try { // .env file should be in root directory const data = require('fs').readFileSync(require('path').join(__dirname, '../../.env'), 'utf8') const env = {} data.split('\n').filter((v) => { return v !== '' }).filter((v) => { return v.indexOf('#') === -1 ...
[ "function", "readFromEnvFile", "(", ")", "{", "try", "{", "// .env file should be in root directory", "const", "data", "=", "require", "(", "'fs'", ")", ".", "readFileSync", "(", "require", "(", "'path'", ")", ".", "join", "(", "__dirname", ",", "'../../.env'", ...
Loads environment variables from .env file check for the missing environment variables at start throw exception if .env file doesnot exist @returns env
[ "Loads", "environment", "variables", "from", ".", "env", "file", "check", "for", "the", "missing", "environment", "variables", "at", "start", "throw", "exception", "if", ".", "env", "file", "doesnot", "exist" ]
d93f09a579cd890edb9c37881f6fec6de18c023f
https://github.com/nivesh2/dotenv-minimal/blob/d93f09a579cd890edb9c37881f6fec6de18c023f/index.js#L7-L31
train
nivesh2/dotenv-minimal
index.js
splitMultipleValues
function splitMultipleValues(envObject) { try { const data = Object.keys(envObject) return data.reduce((p, v) => { p[v] = envObject[v] if (envObject[v].indexOf(',') !== -1) { p[v] = envObject[v].split(',') } return p }, {}) } catch (err) { throw err } }
javascript
function splitMultipleValues(envObject) { try { const data = Object.keys(envObject) return data.reduce((p, v) => { p[v] = envObject[v] if (envObject[v].indexOf(',') !== -1) { p[v] = envObject[v].split(',') } return p }, {}) } catch (err) { throw err } }
[ "function", "splitMultipleValues", "(", "envObject", ")", "{", "try", "{", "const", "data", "=", "Object", ".", "keys", "(", "envObject", ")", "return", "data", ".", "reduce", "(", "(", "p", ",", "v", ")", "=>", "{", "p", "[", "v", "]", "=", "envOb...
it only supports spilitting using comma
[ "it", "only", "supports", "spilitting", "using", "comma" ]
d93f09a579cd890edb9c37881f6fec6de18c023f
https://github.com/nivesh2/dotenv-minimal/blob/d93f09a579cd890edb9c37881f6fec6de18c023f/index.js#L34-L47
train
Digznav/bilberry
promise-read-file.js
promiseReadFile
function promiseReadFile(path, encoding = 'utf-8') { return new Promise((resolve, reject) => { fs.readFile(path, encoding, (err, content) => { if (err) reject(err); resolve({ path, fileName: path.split('/').pop(), content }); }); }); }
javascript
function promiseReadFile(path, encoding = 'utf-8') { return new Promise((resolve, reject) => { fs.readFile(path, encoding, (err, content) => { if (err) reject(err); resolve({ path, fileName: path.split('/').pop(), content }); }); }); }
[ "function", "promiseReadFile", "(", "path", ",", "encoding", "=", "'utf-8'", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "fs", ".", "readFile", "(", "path", ",", "encoding", ",", "(", "err", ",", "content",...
Get the content of a single file. @param {string} path Path to file. @param {string} encoding Encoding. @return {promise} Promise to get the content.
[ "Get", "the", "content", "of", "a", "single", "file", "." ]
ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4
https://github.com/Digznav/bilberry/blob/ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4/promise-read-file.js#L9-L21
train
woyorus/syncsocket-client
src/connection.js
Connection
function Connection(uri) { this.channels = {}; let version = require('../package.json').version; let opts = { query: 'instanceId=' + 'js_cli_' + version, 'sync disconnect on unload': true, path: '/syncsocket' }; this.socket = io.connect(uri, opts); this.bindEvents(); }
javascript
function Connection(uri) { this.channels = {}; let version = require('../package.json').version; let opts = { query: 'instanceId=' + 'js_cli_' + version, 'sync disconnect on unload': true, path: '/syncsocket' }; this.socket = io.connect(uri, opts); this.bindEvents(); }
[ "function", "Connection", "(", "uri", ")", "{", "this", ".", "channels", "=", "{", "}", ";", "let", "version", "=", "require", "(", "'../package.json'", ")", ".", "version", ";", "let", "opts", "=", "{", "query", ":", "'instanceId='", "+", "'js_cli_'", ...
Creates new `Connection` object @param uri URI of SyncSocket server (e.g. http://localhost:5579) @constructor @public
[ "Creates", "new", "Connection", "object" ]
3bd023ce3611afd0e19a8234ce9731413bcfc890
https://github.com/woyorus/syncsocket-client/blob/3bd023ce3611afd0e19a8234ce9731413bcfc890/src/connection.js#L17-L27
train
insistime/qiao.util.file
lib/qiao.util.file.js
getFoldersAndFiles
function getFoldersAndFiles(fpath, folders, files){ fs.readdirSync(fpath).forEach(function(name){ var stat = fs.statSync(fpath + name); if(stat.isDirectory()){ folders.push({ path : fpath, name : name }); getFoldersAndFiles(fpath + name + '/', folders, files); }else{ files.push...
javascript
function getFoldersAndFiles(fpath, folders, files){ fs.readdirSync(fpath).forEach(function(name){ var stat = fs.statSync(fpath + name); if(stat.isDirectory()){ folders.push({ path : fpath, name : name }); getFoldersAndFiles(fpath + name + '/', folders, files); }else{ files.push...
[ "function", "getFoldersAndFiles", "(", "fpath", ",", "folders", ",", "files", ")", "{", "fs", ".", "readdirSync", "(", "fpath", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", "stat", "=", "fs", ".", "statSync", "(", "fpath", "+", ...
get folders and files
[ "get", "folders", "and", "files" ]
b359226cfcbb8db9a07153f27c5303b00d01640f
https://github.com/insistime/qiao.util.file/blob/b359226cfcbb8db9a07153f27c5303b00d01640f/lib/qiao.util.file.js#L109-L126
train
redisjs/jsr-resp
lib/decoder.js
Decoder
function Decoder(options) { options = options || {}; Transform.call(this, {}); this._reset(); // maximum length for bulk strings (512MB) this.maxlen = options.maxlen || 536870912; // create String instances for simple string replies this.simple = options.simple !== undefined ? options.simple : false; ...
javascript
function Decoder(options) { options = options || {}; Transform.call(this, {}); this._reset(); // maximum length for bulk strings (512MB) this.maxlen = options.maxlen || 536870912; // create String instances for simple string replies this.simple = options.simple !== undefined ? options.simple : false; ...
[ "function", "Decoder", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "Transform", ".", "call", "(", "this", ",", "{", "}", ")", ";", "this", ".", "_reset", "(", ")", ";", "// maximum length for bulk strings (512MB)", "this", "...
Class for decoding RESP messages to javascript types. Emits an error event when an exception occurs.
[ "Class", "for", "decoding", "RESP", "messages", "to", "javascript", "types", "." ]
9f998fc65a4494a358fca296adfe37fc5fb3f03c
https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L23-L46
train
redisjs/jsr-resp
lib/decoder.js
_type
function _type(chunk, test) { var b = chunk[0]; if(b === ERR || b === BST || b === STR || b === INT || b === ARR) { if(!test) this._offset++; return b; } }
javascript
function _type(chunk, test) { var b = chunk[0]; if(b === ERR || b === BST || b === STR || b === INT || b === ARR) { if(!test) this._offset++; return b; } }
[ "function", "_type", "(", "chunk", ",", "test", ")", "{", "var", "b", "=", "chunk", "[", "0", "]", ";", "if", "(", "b", "===", "ERR", "||", "b", "===", "BST", "||", "b", "===", "STR", "||", "b", "===", "INT", "||", "b", "===", "ARR", ")", "...
Swallow type identifier.
[ "Swallow", "type", "identifier", "." ]
9f998fc65a4494a358fca296adfe37fc5fb3f03c
https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L135-L141
train
redisjs/jsr-resp
lib/decoder.js
_arr
function _arr(chunk, type) { var len = this._int(chunk, type); // allow zero length for the empty array if(typeof len === 'number' && !isNaN(len)) { var arr = new Array(len); this._elements += len; Object.defineProperty(arr, '_index', { enumerable: false, configurable: true, ...
javascript
function _arr(chunk, type) { var len = this._int(chunk, type); // allow zero length for the empty array if(typeof len === 'number' && !isNaN(len)) { var arr = new Array(len); this._elements += len; Object.defineProperty(arr, '_index', { enumerable: false, configurable: true, ...
[ "function", "_arr", "(", "chunk", ",", "type", ")", "{", "var", "len", "=", "this", ".", "_int", "(", "chunk", ",", "type", ")", ";", "// allow zero length for the empty array", "if", "(", "typeof", "len", "===", "'number'", "&&", "!", "isNaN", "(", "len...
Read an array.
[ "Read", "an", "array", "." ]
9f998fc65a4494a358fca296adfe37fc5fb3f03c
https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L286-L304
train
redisjs/jsr-resp
lib/decoder.js
_int
function _int(chunk, type) { var b, s = '', i; while(this._offset < chunk.length) { b = chunk[this._offset]; if(b === CR && chunk[this._offset + 1] === LF) { this._offset += 2; i = parseInt(s); if(type === BST) { if(isNaN(i)) { return this._abort(new Error('bad string len...
javascript
function _int(chunk, type) { var b, s = '', i; while(this._offset < chunk.length) { b = chunk[this._offset]; if(b === CR && chunk[this._offset + 1] === LF) { this._offset += 2; i = parseInt(s); if(type === BST) { if(isNaN(i)) { return this._abort(new Error('bad string len...
[ "function", "_int", "(", "chunk", ",", "type", ")", "{", "var", "b", ",", "s", "=", "''", ",", "i", ";", "while", "(", "this", ".", "_offset", "<", "chunk", ".", "length", ")", "{", "b", "=", "chunk", "[", "this", ".", "_offset", "]", ";", "i...
Read an integer.
[ "Read", "an", "integer", "." ]
9f998fc65a4494a358fca296adfe37fc5fb3f03c
https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L325-L344
train
redisjs/jsr-resp
lib/decoder.js
_bst
function _bst(chunk, type) { // we should have already read the chunk var len = this._int(chunk, type), buf; if(!isNaN(len)) { // read an integer less than zero, treat as null if(len < 0) return null; // read in the entire bulk string and swallow the crlf if((chunk.length - this._offset) >= len + ...
javascript
function _bst(chunk, type) { // we should have already read the chunk var len = this._int(chunk, type), buf; if(!isNaN(len)) { // read an integer less than zero, treat as null if(len < 0) return null; // read in the entire bulk string and swallow the crlf if((chunk.length - this._offset) >= len + ...
[ "function", "_bst", "(", "chunk", ",", "type", ")", "{", "// we should have already read the chunk", "var", "len", "=", "this", ".", "_int", "(", "chunk", ",", "type", ")", ",", "buf", ";", "if", "(", "!", "isNaN", "(", "len", ")", ")", "{", "// read a...
Read a bulk string.
[ "Read", "a", "bulk", "string", "." ]
9f998fc65a4494a358fca296adfe37fc5fb3f03c
https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/decoder.js#L350-L367
train
chatphrase/caress
lib/routes/uuidGet.js
noNew
function noNew() { return finish(function(err) { if (err) return next(err); // If there was a body initially, respond that there's been no change if (ourEtag) return res.send(304); // Otherwise, respond that there's no content (yet) else return res.send(204); }); ...
javascript
function noNew() { return finish(function(err) { if (err) return next(err); // If there was a body initially, respond that there's been no change if (ourEtag) return res.send(304); // Otherwise, respond that there's no content (yet) else return res.send(204); }); ...
[ "function", "noNew", "(", ")", "{", "return", "finish", "(", "function", "(", "err", ")", "{", "if", "(", "err", ")", "return", "next", "(", "err", ")", ";", "// If there was a body initially, respond that there's been no change", "if", "(", "ourEtag", ")", "r...
Callback for if there's no new body by the time we're supposed to respond.
[ "Callback", "for", "if", "there", "s", "no", "new", "body", "by", "the", "time", "we", "re", "supposed", "to", "respond", "." ]
1634c127e90c8140baf5e2803a2938ffaf0414c4
https://github.com/chatphrase/caress/blob/1634c127e90c8140baf5e2803a2938ffaf0414c4/lib/routes/uuidGet.js#L47-L57
train