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
asavoy/grunt-requirejs-auto-bundles
lib/reduce.js
reduceBundles
function reduceBundles(bundles, dependencies, maxBundles) { while (anyMainExceedsMaxBundles(bundles, maxBundles)) { var merge = findLeastCostMerge(bundles, dependencies, maxBundles); mergeBundles(merge.bundle1Name, merge.bundle2Name, bundles); } return bundles; }
javascript
function reduceBundles(bundles, dependencies, maxBundles) { while (anyMainExceedsMaxBundles(bundles, maxBundles)) { var merge = findLeastCostMerge(bundles, dependencies, maxBundles); mergeBundles(merge.bundle1Name, merge.bundle2Name, bundles); } return bundles; }
[ "function", "reduceBundles", "(", "bundles", ",", "dependencies", ",", "maxBundles", ")", "{", "while", "(", "anyMainExceedsMaxBundles", "(", "bundles", ",", "maxBundles", ")", ")", "{", "var", "merge", "=", "findLeastCostMerge", "(", "bundles", ",", "dependenci...
Given a set of bundles, merge until no main module needs to fetch from more than maxBundles number of bundles.
[ "Given", "a", "set", "of", "bundles", "merge", "until", "no", "main", "module", "needs", "to", "fetch", "from", "more", "than", "maxBundles", "number", "of", "bundles", "." ]
c0f587c9720943dd32098203d2c71ab1387f1700
https://github.com/asavoy/grunt-requirejs-auto-bundles/blob/c0f587c9720943dd32098203d2c71ab1387f1700/lib/reduce.js#L10-L16
train
jonschlinkert/resolve-up
index.js
resolve
function resolve(files, opts) { var fn = opts.filter || function(fp) { return true; }; if (opts.realpath === true) { return files.filter(fn); } var len = files.length; var idx = -1; var res = []; while (++idx < len) { var fp = path.resolve(opts.cwd, files[idx]); if (!fn(fp) || ~res.in...
javascript
function resolve(files, opts) { var fn = opts.filter || function(fp) { return true; }; if (opts.realpath === true) { return files.filter(fn); } var len = files.length; var idx = -1; var res = []; while (++idx < len) { var fp = path.resolve(opts.cwd, files[idx]); if (!fn(fp) || ~res.in...
[ "function", "resolve", "(", "files", ",", "opts", ")", "{", "var", "fn", "=", "opts", ".", "filter", "||", "function", "(", "fp", ")", "{", "return", "true", ";", "}", ";", "if", "(", "opts", ".", "realpath", "===", "true", ")", "{", "return", "f...
Resolve the absolute path to a file using the given cwd.
[ "Resolve", "the", "absolute", "path", "to", "a", "file", "using", "the", "given", "cwd", "." ]
d4c566630e85c3ab83af44df1bba46ff49ddaadc
https://github.com/jonschlinkert/resolve-up/blob/d4c566630e85c3ab83af44df1bba46ff49ddaadc/index.js#L64-L83
train
halfblood369/monitor
lib/processMonitor.js
getPsInfo
function getPsInfo(param, callback) { if (process.platform === 'windows') return; var pid = param.pid; var cmd = "ps auxw | grep " + pid + " | grep -v 'grep'"; //var cmd = "ps auxw | grep -E '.+?\\s+" + pid + "\\s+'" ; exec(cmd, function(err, output) { if (!!err) { if (err.code === 1) { console....
javascript
function getPsInfo(param, callback) { if (process.platform === 'windows') return; var pid = param.pid; var cmd = "ps auxw | grep " + pid + " | grep -v 'grep'"; //var cmd = "ps auxw | grep -E '.+?\\s+" + pid + "\\s+'" ; exec(cmd, function(err, output) { if (!!err) { if (err.code === 1) { console....
[ "function", "getPsInfo", "(", "param", ",", "callback", ")", "{", "if", "(", "process", ".", "platform", "===", "'windows'", ")", "return", ";", "var", "pid", "=", "param", ".", "pid", ";", "var", "cmd", "=", "\"ps auxw | grep \"", "+", "pid", "+", "\"...
get the process information by command 'ps auxw | grep serverId | grep pid' @param {Object} param @param {Function} callback @api public
[ "get", "the", "process", "information", "by", "command", "ps", "auxw", "|", "grep", "serverId", "|", "grep", "pid" ]
900b5cadf59edcccac4754e5706a22719925ddb9
https://github.com/halfblood369/monitor/blob/900b5cadf59edcccac4754e5706a22719925ddb9/lib/processMonitor.js#L23-L40
train
arielschiavoni/commonjsify
src/commonjsify.js
browserifyTransform
function browserifyTransform(file) { var chunks = []; var write = function(buffer) { chunks.push(buffer); }; var end = function() { var content = Buffer.concat(chunks).toString('utf8'); // convention fileName == key for shim options var fileName = file.match(/([^\/]+)(?=\.\w+$)...
javascript
function browserifyTransform(file) { var chunks = []; var write = function(buffer) { chunks.push(buffer); }; var end = function() { var content = Buffer.concat(chunks).toString('utf8'); // convention fileName == key for shim options var fileName = file.match(/([^\/]+)(?=\.\w+$)...
[ "function", "browserifyTransform", "(", "file", ")", "{", "var", "chunks", "=", "[", "]", ";", "var", "write", "=", "function", "(", "buffer", ")", "{", "chunks", ".", "push", "(", "buffer", ")", ";", "}", ";", "var", "end", "=", "function", "(", "...
The function Browserify will use to transform the input. @param {string} file @returns {stream}
[ "The", "function", "Browserify", "will", "use", "to", "transform", "the", "input", "." ]
544dff6bdf2f4aad8802cbfb60d2aa5852482c0f
https://github.com/arielschiavoni/commonjsify/blob/544dff6bdf2f4aad8802cbfb60d2aa5852482c0f/src/commonjsify.js#L25-L41
train
nknapp/deep-aplus
.thought/helpers.js
function (cwd, filename, options, customizeEngine) { var helpers = customizeEngine.engine.helpers var code = helpers.example(path.join(cwd, filename), { hash: { snippet: true } }) var result = helpers.exec(`node ${filename}`, { hash: { cwd: cwd, lang: 'raw' ...
javascript
function (cwd, filename, options, customizeEngine) { var helpers = customizeEngine.engine.helpers var code = helpers.example(path.join(cwd, filename), { hash: { snippet: true } }) var result = helpers.exec(`node ${filename}`, { hash: { cwd: cwd, lang: 'raw' ...
[ "function", "(", "cwd", ",", "filename", ",", "options", ",", "customizeEngine", ")", "{", "var", "helpers", "=", "customizeEngine", ".", "engine", ".", "helpers", "var", "code", "=", "helpers", ".", "example", "(", "path", ".", "join", "(", "cwd", ",", ...
Merges the example output into the source code. In the example, `console.log` must be wrapped so that `\u0001` is inserted before each output. `console.log` may not be called in loops.
[ "Merges", "the", "example", "output", "into", "the", "source", "code", ".", "In", "the", "example", "console", ".", "log", "must", "be", "wrapped", "so", "that", "\\", "u0001", "is", "inserted", "before", "each", "output", ".", "console", ".", "log", "ma...
da8c5432e895c5087dc1f1a2234be4273ab0592c
https://github.com/nknapp/deep-aplus/blob/da8c5432e895c5087dc1f1a2234be4273ab0592c/.thought/helpers.js#L11-L34
train
redisjs/jsr-server
lib/network.js
NetworkServer
function NetworkServer(server) { this.server = server; function connection(socket) { server.connection(socket, this); } this.on('connection', connection); }
javascript
function NetworkServer(server) { this.server = server; function connection(socket) { server.connection(socket, this); } this.on('connection', connection); }
[ "function", "NetworkServer", "(", "server", ")", "{", "this", ".", "server", "=", "server", ";", "function", "connection", "(", "socket", ")", "{", "server", ".", "connection", "(", "socket", ",", "this", ")", ";", "}", "this", ".", "on", "(", "'connec...
Abstract server class. @param server The main server instance.
[ "Abstract", "server", "class", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/network.js#L13-L19
train
redisjs/jsr-server
lib/network.js
listen
function listen(file, perm) { var args = [file] , perm = perm || 0700 , server = this; this.file = file; this.name = path.basename(file); if(this.name === file) { file = path.join(process.cwd(), file); } function onListen() { try { fs.chmodSync(file, perm); }catch(e){} log.n...
javascript
function listen(file, perm) { var args = [file] , perm = perm || 0700 , server = this; this.file = file; this.name = path.basename(file); if(this.name === file) { file = path.join(process.cwd(), file); } function onListen() { try { fs.chmodSync(file, perm); }catch(e){} log.n...
[ "function", "listen", "(", "file", ",", "perm", ")", "{", "var", "args", "=", "[", "file", "]", ",", "perm", "=", "perm", "||", "0700", ",", "server", "=", "this", ";", "this", ".", "file", "=", "file", ";", "this", ".", "name", "=", "path", "....
Listen on a UNIX domain socket.
[ "Listen", "on", "a", "UNIX", "domain", "socket", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/network.js#L44-L83
train
redisjs/jsr-server
lib/network.js
close
function close() { log.notice('removing the unix socket file') try { fs.unlinkSync(file); }catch(e){} // nothing to do at this point Server.prototype.close.call(this); }
javascript
function close() { log.notice('removing the unix socket file') try { fs.unlinkSync(file); }catch(e){} // nothing to do at this point Server.prototype.close.call(this); }
[ "function", "close", "(", ")", "{", "log", ".", "notice", "(", "'removing the unix socket file'", ")", "try", "{", "fs", ".", "unlinkSync", "(", "file", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "// nothing to do at this point", "Server", ".", "prot...
Close the UNIX domain socket server.
[ "Close", "the", "UNIX", "domain", "socket", "server", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/network.js#L88-L95
train
MoonHighway/mh-xmldown
index.js
function (next) { request(url, function (err, res, body) { if (err) { return next(err); } next(null, body); }); }
javascript
function (next) { request(url, function (err, res, body) { if (err) { return next(err); } next(null, body); }); }
[ "function", "(", "next", ")", "{", "request", "(", "url", ",", "function", "(", "err", ",", "res", ",", "body", ")", "{", "if", "(", "err", ")", "{", "return", "next", "(", "err", ")", ";", "}", "next", "(", "null", ",", "body", ")", ";", "}"...
1 - Request the XML File
[ "1", "-", "Request", "the", "XML", "File" ]
373e0301810e7c7ec905378703201a6067d73565
https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L31-L38
train
MoonHighway/mh-xmldown
index.js
function (body, next) { fs.writeFile(out + "/" + path.basename(url), body, function (err) { if (err) { return next(err); } next(null, body); }); }
javascript
function (body, next) { fs.writeFile(out + "/" + path.basename(url), body, function (err) { if (err) { return next(err); } next(null, body); }); }
[ "function", "(", "body", ",", "next", ")", "{", "fs", ".", "writeFile", "(", "out", "+", "\"/\"", "+", "path", ".", "basename", "(", "url", ")", ",", "body", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "return", "next", "...
2 - Save the XML File Locally
[ "2", "-", "Save", "the", "XML", "File", "Locally" ]
373e0301810e7c7ec905378703201a6067d73565
https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L41-L48
train
MoonHighway/mh-xmldown
index.js
function (body, next) { parseString(body, function (err, json) { if (err) { return next(err); } next(null, json); }); }
javascript
function (body, next) { parseString(body, function (err, json) { if (err) { return next(err); } next(null, json); }); }
[ "function", "(", "body", ",", "next", ")", "{", "parseString", "(", "body", ",", "function", "(", "err", ",", "json", ")", "{", "if", "(", "err", ")", "{", "return", "next", "(", "err", ")", ";", "}", "next", "(", "null", ",", "json", ")", ";",...
3 - Parse the XML File as JSON
[ "3", "-", "Parse", "the", "XML", "File", "as", "JSON" ]
373e0301810e7c7ec905378703201a6067d73565
https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L51-L58
train
MoonHighway/mh-xmldown
index.js
function(json, next) { fs.writeFile(out + "/" + path.basename(url).replace('.xml', '.json'), JSON.stringify(json), function (err) { if (err) { return next(err); } next(null, json); }); }
javascript
function(json, next) { fs.writeFile(out + "/" + path.basename(url).replace('.xml', '.json'), JSON.stringify(json), function (err) { if (err) { return next(err); } next(null, json); }); }
[ "function", "(", "json", ",", "next", ")", "{", "fs", ".", "writeFile", "(", "out", "+", "\"/\"", "+", "path", ".", "basename", "(", "url", ")", ".", "replace", "(", "'.xml'", ",", "'.json'", ")", ",", "JSON", ".", "stringify", "(", "json", ")", ...
4 - Save the JSON file locally
[ "4", "-", "Save", "the", "JSON", "file", "locally" ]
373e0301810e7c7ec905378703201a6067d73565
https://github.com/MoonHighway/mh-xmldown/blob/373e0301810e7c7ec905378703201a6067d73565/index.js#L61-L68
train
zerobias/knack
index.js
Knack
function Knack({ concurrency = 5, interval = 500, onDone = () => {} }={}) { const q = new Queue(concurrency, interval, onDone) /** * @func knack * @template T * @param {function(...args): Promise<T>} func * @returns {function(...args): Promise<T>} */ const knack = function(func, { priority = 50...
javascript
function Knack({ concurrency = 5, interval = 500, onDone = () => {} }={}) { const q = new Queue(concurrency, interval, onDone) /** * @func knack * @template T * @param {function(...args): Promise<T>} func * @returns {function(...args): Promise<T>} */ const knack = function(func, { priority = 50...
[ "function", "Knack", "(", "{", "concurrency", "=", "5", ",", "interval", "=", "500", ",", "onDone", "=", "(", ")", "=>", "{", "}", "}", "=", "{", "}", ")", "{", "const", "q", "=", "new", "Queue", "(", "concurrency", ",", "interval", ",", "onDone"...
Create Queue wrapper @param {any} [{ concurrency = 5, interval = 500 }={}] options
[ "Create", "Queue", "wrapper" ]
24a97f30edf0d06a0a6cd7d7a34d7a38f11c43dd
https://github.com/zerobias/knack/blob/24a97f30edf0d06a0a6cd7d7a34d7a38f11c43dd/index.js#L110-L149
train
tuunanen/camelton
lib/util.js
function(file) { var filePath = path.resolve(file); if (filePath && fs.existsSync(filePath)) { return filePath; } return false; }
javascript
function(file) { var filePath = path.resolve(file); if (filePath && fs.existsSync(filePath)) { return filePath; } return false; }
[ "function", "(", "file", ")", "{", "var", "filePath", "=", "path", ".", "resolve", "(", "file", ")", ";", "if", "(", "filePath", "&&", "fs", ".", "existsSync", "(", "filePath", ")", ")", "{", "return", "filePath", ";", "}", "return", "false", ";", ...
Resolves file path. @param {string} file - File path. @returns {string|boolean} Resolved file path, or false if path does not exist.
[ "Resolves", "file", "path", "." ]
2beee32431e1b2867396e25f560f8dbd53535041
https://github.com/tuunanen/camelton/blob/2beee32431e1b2867396e25f560f8dbd53535041/lib/util.js#L42-L50
train
tuunanen/camelton
lib/util.js
function(file) { var filePath = path.resolve(file); if (filePath) { if (!fs.existsSync(filePath)) { fse.ensureFileSync(filePath); } return filePath; } return false; }
javascript
function(file) { var filePath = path.resolve(file); if (filePath) { if (!fs.existsSync(filePath)) { fse.ensureFileSync(filePath); } return filePath; } return false; }
[ "function", "(", "file", ")", "{", "var", "filePath", "=", "path", ".", "resolve", "(", "file", ")", ";", "if", "(", "filePath", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "filePath", ")", ")", "{", "fse", ".", "ensureFileSync", "(", ...
Resolves file path, and ensures the file exist. @param {string} file - File path. @returns {string|boolean} Resolved file path, or false if path cannot be created.
[ "Resolves", "file", "path", "and", "ensures", "the", "file", "exist", "." ]
2beee32431e1b2867396e25f560f8dbd53535041
https://github.com/tuunanen/camelton/blob/2beee32431e1b2867396e25f560f8dbd53535041/lib/util.js#L59-L70
train
Nazariglez/perenquen
lib/pixi/src/core/renderers/webgl/utils/Quad.js
Quad
function Quad(gl) { /* * the current WebGL drawing context * * @member {WebGLRenderingContext} */ this.gl = gl; // this.textures = new TextureUvs(); /** * An array of vertices * * @member {Float32Array} */ this.vertices = new Float32Array([ 0,0, ...
javascript
function Quad(gl) { /* * the current WebGL drawing context * * @member {WebGLRenderingContext} */ this.gl = gl; // this.textures = new TextureUvs(); /** * An array of vertices * * @member {Float32Array} */ this.vertices = new Float32Array([ 0,0, ...
[ "function", "Quad", "(", "gl", ")", "{", "/*\n * the current WebGL drawing context\n *\n * @member {WebGLRenderingContext}\n */", "this", ".", "gl", "=", "gl", ";", "// this.textures = new TextureUvs();", "/**\n * An array of vertices\n *\n * @member {Float...
Helper class to create a quad @class @memberof PIXI @param gl {WebGLRenderingContext} The gl context for this quad to use.
[ "Helper", "class", "to", "create", "a", "quad" ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/renderers/webgl/utils/Quad.js#L7-L80
train
selfcontained/browserify-dev-bundler
lib/bundler.js
function(moduleRegex) { var self = this; moduleRegex = moduleRegex || /^(.+)\.js$/; return function(req, res, next) { var match = req.url.match(moduleRegex); if(!match) return next(); var module= match[1]; self.bundle(module, function(err, src)...
javascript
function(moduleRegex) { var self = this; moduleRegex = moduleRegex || /^(.+)\.js$/; return function(req, res, next) { var match = req.url.match(moduleRegex); if(!match) return next(); var module= match[1]; self.bundle(module, function(err, src)...
[ "function", "(", "moduleRegex", ")", "{", "var", "self", "=", "this", ";", "moduleRegex", "=", "moduleRegex", "||", "/", "^(.+)\\.js$", "/", ";", "return", "function", "(", "req", ",", "res", ",", "next", ")", "{", "var", "match", "=", "req", ".", "u...
Generate a middeware function + moduleRegex - regex - used to match urls - requires the first capture group to be the module
[ "Generate", "a", "middeware", "function", "+", "moduleRegex", "-", "regex", "-", "used", "to", "match", "urls", "-", "requires", "the", "first", "capture", "group", "to", "be", "the", "module" ]
7e3540ae9b42d0858495b0e99e9495b9ba14443d
https://github.com/selfcontained/browserify-dev-bundler/blob/7e3540ae9b42d0858495b0e99e9495b9ba14443d/lib/bundler.js#L46-L67
train
berkeleybop/bbopx-js
external/bbop.js
_same_set
function _same_set(set1, set2){ var h1 = {}; var h2 = {}; for( var h1i = 0; h1i < set1.length; h1i++ ){ h1[set1[h1i]] = 1; } for( var h2i = 0; h2i < set2.length; h2i++ ){ h2[set2[h2i]] = 1; } return _same_hash(h1, h2); }
javascript
function _same_set(set1, set2){ var h1 = {}; var h2 = {}; for( var h1i = 0; h1i < set1.length; h1i++ ){ h1[set1[h1i]] = 1; } for( var h2i = 0; h2i < set2.length; h2i++ ){ h2[set2[h2i]] = 1; } return _same_hash(h1, h2); }
[ "function", "_same_set", "(", "set1", ",", "set2", ")", "{", "var", "h1", "=", "{", "}", ";", "var", "h2", "=", "{", "}", ";", "for", "(", "var", "h1i", "=", "0", ";", "h1i", "<", "set1", ".", "length", ";", "h1i", "++", ")", "{", "h1", "["...
Looking at array as sets of...something. DEPRECATED
[ "Looking", "at", "array", "as", "sets", "of", "...", "something", ".", "DEPRECATED" ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1341-L1347
train
berkeleybop/bbopx-js
external/bbop.js
_is_same
function _is_same(a, b){ //bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b)); var ret = false; if( a == b ){ // atoms, incl. null and 'string' //bark('true on equal atoms: ' + a + '<>' + b); ret = true; }else{ // is list or obj (ignore func) if( typeof(a) === 'object' && typeof(b) === 'object' ){...
javascript
function _is_same(a, b){ //bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b)); var ret = false; if( a == b ){ // atoms, incl. null and 'string' //bark('true on equal atoms: ' + a + '<>' + b); ret = true; }else{ // is list or obj (ignore func) if( typeof(a) === 'object' && typeof(b) === 'object' ){...
[ "function", "_is_same", "(", "a", ",", "b", ")", "{", "//bark('typeof(a, b): ' + typeof(a) + ',' + typeof(b));", "var", "ret", "=", "false", ";", "if", "(", "a", "==", "b", ")", "{", "// atoms, incl. null and 'string'", "//bark('true on equal atoms: ' + a + '<>' + b);", ...
Better general comparison function.
[ "Better", "general", "comparison", "function", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1382-L1442
train
berkeleybop/bbopx-js
external/bbop.js
_in_list
function _in_list(in_item, list, comparator){ var retval = false; for(var li = 0; li < list.length; li++ ){ var list_item = list[li]; if( comparator ){ var comp_op = comparator(in_item, list_item); if( comp_op && comp_op == true ){ retval = true; } }else{ if( in_item == list_item ){ ...
javascript
function _in_list(in_item, list, comparator){ var retval = false; for(var li = 0; li < list.length; li++ ){ var list_item = list[li]; if( comparator ){ var comp_op = comparator(in_item, list_item); if( comp_op && comp_op == true ){ retval = true; } }else{ if( in_item == list_item ){ ...
[ "function", "_in_list", "(", "in_item", ",", "list", ",", "comparator", ")", "{", "var", "retval", "=", "false", ";", "for", "(", "var", "li", "=", "0", ";", "li", "<", "list", ".", "length", ";", "li", "++", ")", "{", "var", "list_item", "=", "l...
Walk through the list and see if it's there. If compareator is not defined, just to atom comparison.
[ "Walk", "through", "the", "list", "and", "see", "if", "it", "s", "there", ".", "If", "compareator", "is", "not", "defined", "just", "to", "atom", "comparison", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1486-L1505
train
berkeleybop/bbopx-js
external/bbop.js
_is_string_embedded
function _is_string_embedded(target_str, base_str, add_str){ // Walk through all of ways of splitting base_str and add // add_str in there to see if we get the target_str. var retval = false; for(var si = 0; si <= base_str.length; si++ ){ var car = base_str.substr(0, si); var cdr = base_str.substr(...
javascript
function _is_string_embedded(target_str, base_str, add_str){ // Walk through all of ways of splitting base_str and add // add_str in there to see if we get the target_str. var retval = false; for(var si = 0; si <= base_str.length; si++ ){ var car = base_str.substr(0, si); var cdr = base_str.substr(...
[ "function", "_is_string_embedded", "(", "target_str", ",", "base_str", ",", "add_str", ")", "{", "// Walk through all of ways of splitting base_str and add", "// add_str in there to see if we get the target_str.", "var", "retval", "=", "false", ";", "for", "(", "var", "si", ...
Basically asking if you can make the target string from the base string with the add_str added into it somewhere. Strange, but another way of looking at URL creation in some cases.
[ "Basically", "asking", "if", "you", "can", "make", "the", "target", "string", "from", "the", "base", "string", "with", "the", "add_str", "added", "into", "it", "somewhere", ".", "Strange", "but", "another", "way", "of", "looking", "at", "URL", "creation", ...
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L1510-L1526
train
berkeleybop/bbopx-js
external/bbop.js
rec_up
function rec_up(nid){ //print('rec_up on: ' + nid); var results = new Array(); var new_parent_edges = anchor.get_parent_edges(nid, pid); // Capture edge list for later adding. for( var e = 0; e < new_parent_edges.length; e++ ){ seen_edge_list.push(new_parent_edges[e]); } // Pull extant nodes fro...
javascript
function rec_up(nid){ //print('rec_up on: ' + nid); var results = new Array(); var new_parent_edges = anchor.get_parent_edges(nid, pid); // Capture edge list for later adding. for( var e = 0; e < new_parent_edges.length; e++ ){ seen_edge_list.push(new_parent_edges[e]); } // Pull extant nodes fro...
[ "function", "rec_up", "(", "nid", ")", "{", "//print('rec_up on: ' + nid);", "var", "results", "=", "new", "Array", "(", ")", ";", "var", "new_parent_edges", "=", "anchor", ".", "get_parent_edges", "(", "nid", ",", "pid", ")", ";", "// Capture edge list for late...
Define recursive ascent.
[ "Define", "recursive", "ascent", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L5738-L5784
train
berkeleybop/bbopx-js
external/bbop.js
order_cohort
function order_cohort(in_brackets){ // Push into global cohort list list. for( var i = 0; i < in_brackets.length; i++ ){ var bracket_item = in_brackets[i]; // //_kvetch(' order_cohort: i: ' + i); //_kvetch(' order_cohort: lvl: ' + bracket_item.level); cohort_list[bracket_item.level - 1].push(br...
javascript
function order_cohort(in_brackets){ // Push into global cohort list list. for( var i = 0; i < in_brackets.length; i++ ){ var bracket_item = in_brackets[i]; // //_kvetch(' order_cohort: i: ' + i); //_kvetch(' order_cohort: lvl: ' + bracket_item.level); cohort_list[bracket_item.level - 1].push(br...
[ "function", "order_cohort", "(", "in_brackets", ")", "{", "// Push into global cohort list list.", "for", "(", "var", "i", "=", "0", ";", "i", "<", "in_brackets", ".", "length", ";", "i", "++", ")", "{", "var", "bracket_item", "=", "in_brackets", "[", "i", ...
Walk down and stack up.
[ "Walk", "down", "and", "stack", "up", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L6273-L6288
train
berkeleybop/bbopx-js
external/bbop.js
_new_node_at
function _new_node_at(bnode, level){ ll("adding " + bnode.id() + " at level " + level + "!"); // Create new vertex and add to set. var new_vertex = new bbop.layout.sugiyama.simple_vertex(bnode.id()); new_vertex.level = level; vertex_set[ new_vertex.id() ] = new_vertex; // Check the node in to the 'seen' refer...
javascript
function _new_node_at(bnode, level){ ll("adding " + bnode.id() + " at level " + level + "!"); // Create new vertex and add to set. var new_vertex = new bbop.layout.sugiyama.simple_vertex(bnode.id()); new_vertex.level = level; vertex_set[ new_vertex.id() ] = new_vertex; // Check the node in to the 'seen' refer...
[ "function", "_new_node_at", "(", "bnode", ",", "level", ")", "{", "ll", "(", "\"adding \"", "+", "bnode", ".", "id", "(", ")", "+", "\" at level \"", "+", "level", "+", "\"!\"", ")", ";", "// Create new vertex and add to set.", "var", "new_vertex", "=", "new...
Add a new node to the global variables.
[ "Add", "a", "new", "node", "to", "the", "global", "variables", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L7183-L7195
train
berkeleybop/bbopx-js
external/bbop.js
getSubjectBarycenter
function getSubjectBarycenter(subject){ var weighted_number_of_edges = 0; var number_of_edges = 0; for( var o = 1; o <= object_vector.length; o++ ){ if( relation_matrix[object_vector[o -1].id()] && relation_matrix[object_vector[o -1].id()][subject.id()]){ weighted_number_of_edges += o; number_of_edges++;...
javascript
function getSubjectBarycenter(subject){ var weighted_number_of_edges = 0; var number_of_edges = 0; for( var o = 1; o <= object_vector.length; o++ ){ if( relation_matrix[object_vector[o -1].id()] && relation_matrix[object_vector[o -1].id()][subject.id()]){ weighted_number_of_edges += o; number_of_edges++;...
[ "function", "getSubjectBarycenter", "(", "subject", ")", "{", "var", "weighted_number_of_edges", "=", "0", ";", "var", "number_of_edges", "=", "0", ";", "for", "(", "var", "o", "=", "1", ";", "o", "<=", "object_vector", ".", "length", ";", "o", "++", ")"...
Gets barycenter for column s.
[ "Gets", "barycenter", "for", "column", "s", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L7465-L7478
train
berkeleybop/bbopx-js
external/bbop.js
on_error
function on_error(e) { console.log('problem with request: ' + e.message); var response = new anchor._response_handler(null); response.okay(false); response.message(e.message); response.message_type('error'); anchor.apply_callbacks('error', [response, anchor]); }
javascript
function on_error(e) { console.log('problem with request: ' + e.message); var response = new anchor._response_handler(null); response.okay(false); response.message(e.message); response.message_type('error'); anchor.apply_callbacks('error', [response, anchor]); }
[ "function", "on_error", "(", "e", ")", "{", "console", ".", "log", "(", "'problem with request: '", "+", "e", ".", "message", ")", ";", "var", "response", "=", "new", "anchor", ".", "_response_handler", "(", "null", ")", ";", "response", ".", "okay", "("...
What to do if an error is triggered.
[ "What", "to", "do", "if", "an", "error", "is", "triggered", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L8782-L8789
train
berkeleybop/bbopx-js
external/bbop.js
on_error
function on_error(xhr, status, error) { var response = new anchor._response_handler(null); response.okay(false); response.message(error); response.message_type(status); anchor.apply_callbacks('error', [response, anchor]); }
javascript
function on_error(xhr, status, error) { var response = new anchor._response_handler(null); response.okay(false); response.message(error); response.message_type(status); anchor.apply_callbacks('error', [response, anchor]); }
[ "function", "on_error", "(", "xhr", ",", "status", ",", "error", ")", "{", "var", "response", "=", "new", "anchor", ".", "_response_handler", "(", "null", ")", ";", "response", ".", "okay", "(", "false", ")", ";", "response", ".", "message", "(", "erro...
What to do if an error is triggered. Remember that with jQuery, when using JSONP, there is no error.
[ "What", "to", "do", "if", "an", "error", "is", "triggered", ".", "Remember", "that", "with", "jQuery", "when", "using", "JSONP", "there", "is", "no", "error", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L9041-L9047
train
berkeleybop/bbopx-js
external/bbop.js
_full_delete
function _full_delete(hash, key1, key2){ if( key1 && key2 && hash && hash[key1] && hash[key1][key2] ){ delete hash[key1][key2]; } if( bbop.core.is_empty(hash[key1]) ){ delete hash[key1]; } }
javascript
function _full_delete(hash, key1, key2){ if( key1 && key2 && hash && hash[key1] && hash[key1][key2] ){ delete hash[key1][key2]; } if( bbop.core.is_empty(hash[key1]) ){ delete hash[key1]; } }
[ "function", "_full_delete", "(", "hash", ",", "key1", ",", "key2", ")", "{", "if", "(", "key1", "&&", "key2", "&&", "hash", "&&", "hash", "[", "key1", "]", "&&", "hash", "[", "key1", "]", "[", "key2", "]", ")", "{", "delete", "hash", "[", "key1",...
Internal helper to delete a low level key, and then if the top-level is empty, get that one too.
[ "Internal", "helper", "to", "delete", "a", "low", "level", "key", "and", "then", "if", "the", "top", "-", "level", "is", "empty", "get", "that", "one", "too", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L11109-L11117
train
berkeleybop/bbopx-js
external/bbop.js
_lock_map
function _lock_map(field, id_list){ var fixed_list = []; bbop.core.each(id_list, function(item){ fixed_list.push(bbop.core.ensure(item, '"')); }); var base_id_list = '(' + fixed_list.join(' OR ') + ')'; var ret_query = field + ':' + base_id_list; return ret_query; }
javascript
function _lock_map(field, id_list){ var fixed_list = []; bbop.core.each(id_list, function(item){ fixed_list.push(bbop.core.ensure(item, '"')); }); var base_id_list = '(' + fixed_list.join(' OR ') + ')'; var ret_query = field + ':' + base_id_list; return ret_query; }
[ "function", "_lock_map", "(", "field", ",", "id_list", ")", "{", "var", "fixed_list", "=", "[", "]", ";", "bbop", ".", "core", ".", "each", "(", "id_list", ",", "function", "(", "item", ")", "{", "fixed_list", ".", "push", "(", "bbop", ".", "core", ...
Function to unwind and lock a list if identifiers onto a field.
[ "Function", "to", "unwind", "and", "lock", "a", "list", "if", "identifiers", "onto", "a", "field", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L11960-L11972
train
berkeleybop/bbopx-js
external/bbop.js
_create_select_box
function _create_select_box(val, id, name){ if( ! is_defined(name) ){ name = select_item_name; } var input_attrs = { 'value': val, 'name': name, 'type': 'checkbox' }; if( is_defined(id) ){ input_attrs['id'] = id; } var input = new bbop.html.input(input_attrs); return input; }
javascript
function _create_select_box(val, id, name){ if( ! is_defined(name) ){ name = select_item_name; } var input_attrs = { 'value': val, 'name': name, 'type': 'checkbox' }; if( is_defined(id) ){ input_attrs['id'] = id; } var input = new bbop.html.input(input_attrs); return input; }
[ "function", "_create_select_box", "(", "val", ",", "id", ",", "name", ")", "{", "if", "(", "!", "is_defined", "(", "name", ")", ")", "{", "name", "=", "select_item_name", ";", "}", "var", "input_attrs", "=", "{", "'value'", ":", "val", ",", "'name'", ...
Create a locally mangled checkbox.
[ "Create", "a", "locally", "mangled", "checkbox", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L14702-L14717
train
berkeleybop/bbopx-js
external/bbop.js
_ignorable_event
function _ignorable_event(event){ var retval = false; if( event ){ var kc = event.keyCode; if( kc ){ if( kc == 39 || // right kc == 37 || // left kc == 32 || // space kc == 20 || // ctl? kc == 17 || // ctl? ...
javascript
function _ignorable_event(event){ var retval = false; if( event ){ var kc = event.keyCode; if( kc ){ if( kc == 39 || // right kc == 37 || // left kc == 32 || // space kc == 20 || // ctl? kc == 17 || // ctl? ...
[ "function", "_ignorable_event", "(", "event", ")", "{", "var", "retval", "=", "false", ";", "if", "(", "event", ")", "{", "var", "kc", "=", "event", ".", "keyCode", ";", "if", "(", "kc", ")", "{", "if", "(", "kc", "==", "39", "||", "// right", "k...
Detect whether or not a keyboard event is ignorable.
[ "Detect", "whether", "or", "not", "a", "keyboard", "event", "is", "ignorable", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L16505-L16526
train
berkeleybop/bbopx-js
external/bbop.js
_nothing_to_see_here
function _nothing_to_see_here(in_field){ var section_id = filter_accordion_widget.get_section_id(in_field); jQuery('#' + section_id).empty(); jQuery('#' + section_id).append('Nothing to filter.'); }
javascript
function _nothing_to_see_here(in_field){ var section_id = filter_accordion_widget.get_section_id(in_field); jQuery('#' + section_id).empty(); jQuery('#' + section_id).append('Nothing to filter.'); }
[ "function", "_nothing_to_see_here", "(", "in_field", ")", "{", "var", "section_id", "=", "filter_accordion_widget", ".", "get_section_id", "(", "in_field", ")", ";", "jQuery", "(", "'#'", "+", "section_id", ")", ".", "empty", "(", ")", ";", "jQuery", "(", "'...
A helper function for when no filters are displayed.
[ "A", "helper", "function", "for", "when", "no", "filters", "are", "displayed", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L16851-L16855
train
berkeleybop/bbopx-js
external/bbop.js
draw_shield
function draw_shield(resp){ // ll("shield what: " + bbop.core.what_is(resp)); // ll("shield resp: " + bbop.core.dump(resp)); // First, extract the fields from the // minimal response. var fina = call_time_field_name; var flist = resp.facet_field(call_time_field_name); ...
javascript
function draw_shield(resp){ // ll("shield what: " + bbop.core.what_is(resp)); // ll("shield resp: " + bbop.core.dump(resp)); // First, extract the fields from the // minimal response. var fina = call_time_field_name; var flist = resp.facet_field(call_time_field_name); ...
[ "function", "draw_shield", "(", "resp", ")", "{", "// ll(\"shield what: \" + bbop.core.what_is(resp));", "// ll(\"shield resp: \" + bbop.core.dump(resp));", "// First, extract the fields from the", "// minimal response.", "var", "fina", "=", "call_time_field_name", ";", "var", "flist...
Open the populated shield.
[ "Open", "the", "populated", "shield", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L17104-L17116
train
berkeleybop/bbopx-js
external/bbop.js
function(layout_level){ loop(layout_level, // for every item at this level function(level_item){ var nid = level_item[0]; var lbl = level_item[1]; var rel = level_item[2]; // For various sections, decide to run image // (img) or text code depending on whether // or n...
javascript
function(layout_level){ loop(layout_level, // for every item at this level function(level_item){ var nid = level_item[0]; var lbl = level_item[1]; var rel = level_item[2]; // For various sections, decide to run image // (img) or text code depending on whether // or n...
[ "function", "(", "layout_level", ")", "{", "loop", "(", "layout_level", ",", "// for every item at this level", "function", "(", "level_item", ")", "{", "var", "nid", "=", "level_item", "[", "0", "]", ";", "var", "lbl", "=", "level_item", "[", "1", "]", ";...
for every level
[ "for", "every", "level" ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L17811-L17908
train
berkeleybop/bbopx-js
external/bbop.js
function(request_data, response_hook) { anchor.jq_vars['success'] = function(json_data){ var retlist = []; var resp = new bbop.golr.response(json_data); // Reset the last return; remember: tri-state. result_count = null; return_count = null; if( resp.success() ){ // Get best shot at document c...
javascript
function(request_data, response_hook) { anchor.jq_vars['success'] = function(json_data){ var retlist = []; var resp = new bbop.golr.response(json_data); // Reset the last return; remember: tri-state. result_count = null; return_count = null; if( resp.success() ){ // Get best shot at document c...
[ "function", "(", "request_data", ",", "response_hook", ")", "{", "anchor", ".", "jq_vars", "[", "'success'", "]", "=", "function", "(", "json_data", ")", "{", "var", "retlist", "=", "[", "]", ";", "var", "resp", "=", "new", "bbop", ".", "golr", ".", ...
Function for a successful data hit. The data getter, which is making it all more complicated than it needs to be...we need to close around those callback hooks so we have to do it inplace here.
[ "Function", "for", "a", "successful", "data", "hit", ".", "The", "data", "getter", "which", "is", "making", "it", "all", "more", "complicated", "than", "it", "needs", "to", "be", "...", "we", "need", "to", "close", "around", "those", "callback", "hooks", ...
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18069-L18110
train
berkeleybop/bbopx-js
external/bbop.js
function(event, ui){ // Prevent default selection input filling action (from // jQuery UI) when non-default marked. if( ! anchor._fill_p ){ event.preventDefault(); } var doc_to_apply = null; if( ui.item ){ doc_to_apply = ui.item.document; } // Only do the callback if it ...
javascript
function(event, ui){ // Prevent default selection input filling action (from // jQuery UI) when non-default marked. if( ! anchor._fill_p ){ event.preventDefault(); } var doc_to_apply = null; if( ui.item ){ doc_to_apply = ui.item.document; } // Only do the callback if it ...
[ "function", "(", "event", ",", "ui", ")", "{", "// Prevent default selection input filling action (from", "// jQuery UI) when non-default marked.", "if", "(", "!", "anchor", ".", "_fill_p", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "}", "var", "doc_to...
What to do when an element is selected.
[ "What", "to", "do", "when", "an", "element", "is", "selected", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18112-L18130
train
berkeleybop/bbopx-js
external/bbop.js
_draw_local_doc
function _draw_local_doc(doc){ //ll(doc['id']); var personality = anchor.get_personality(); var cclass = golr_conf_obj.get_class(personality); var txt = 'Nothing here...'; if( doc && cclass ){ var tbl = new bbop.html.table(); var results_order = cclass.field_order_by_weight('result'); var each ...
javascript
function _draw_local_doc(doc){ //ll(doc['id']); var personality = anchor.get_personality(); var cclass = golr_conf_obj.get_class(personality); var txt = 'Nothing here...'; if( doc && cclass ){ var tbl = new bbop.html.table(); var results_order = cclass.field_order_by_weight('result'); var each ...
[ "function", "_draw_local_doc", "(", "doc", ")", "{", "//ll(doc['id']);", "var", "personality", "=", "anchor", ".", "get_personality", "(", ")", ";", "var", "cclass", "=", "golr_conf_obj", ".", "get_class", "(", "personality", ")", ";", "var", "txt", "=", "'N...
Draw a locally help Solr response doc.
[ "Draw", "a", "locally", "help", "Solr", "response", "doc", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18352-L18423
train
berkeleybop/bbopx-js
external/bbop.js
_get_selected
function _get_selected(){ var ret_list = []; var selected_strings = jQuery('#'+ sul_id).sortable('toArray', {'attribute': 'value'}); each(selected_strings, function(in_thing){ if( in_thing && in_thing != '' ){ ret_list.push(in_thing); } }); return ret_list; }
javascript
function _get_selected(){ var ret_list = []; var selected_strings = jQuery('#'+ sul_id).sortable('toArray', {'attribute': 'value'}); each(selected_strings, function(in_thing){ if( in_thing && in_thing != '' ){ ret_list.push(in_thing); } }); return ret_list; }
[ "function", "_get_selected", "(", ")", "{", "var", "ret_list", "=", "[", "]", ";", "var", "selected_strings", "=", "jQuery", "(", "'#'", "+", "sul_id", ")", ".", "sortable", "(", "'toArray'", ",", "{", "'attribute'", ":", "'value'", "}", ")", ";", "eac...
Helper function to pull the values. Currently, JQuery adds a lot of extra non-attributes li tags when it creates the DnD, so filter those out to get just the fields ids.
[ "Helper", "function", "to", "pull", "the", "values", ".", "Currently", "JQuery", "adds", "a", "lot", "of", "extra", "non", "-", "attributes", "li", "tags", "when", "it", "creates", "the", "DnD", "so", "filter", "those", "out", "to", "get", "just", "the",...
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18852-L18863
train
berkeleybop/bbopx-js
external/bbop.js
_button_wrapper
function _button_wrapper(str, title){ var b = new bbop.widget.display.text_button_sim(str, title, ''); return b.to_string(); }
javascript
function _button_wrapper(str, title){ var b = new bbop.widget.display.text_button_sim(str, title, ''); return b.to_string(); }
[ "function", "_button_wrapper", "(", "str", ",", "title", ")", "{", "var", "b", "=", "new", "bbop", ".", "widget", ".", "display", ".", "text_button_sim", "(", "str", ",", "title", ",", "''", ")", ";", "return", "b", ".", "to_string", "(", ")", ";", ...
Our argument default hash.
[ "Our", "argument", "default", "hash", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L18998-L19001
train
berkeleybop/bbopx-js
external/bbop.js
_initial_runner
function _initial_runner(response, manager){ // I can't just remove the callback from the register // after the first run because it would be reconstituted // every time it was reset (established). if( anchor.initial_reset_p ){ anchor.initial_reset_p = false; anchor.initial_reset_callback(respon...
javascript
function _initial_runner(response, manager){ // I can't just remove the callback from the register // after the first run because it would be reconstituted // every time it was reset (established). if( anchor.initial_reset_p ){ anchor.initial_reset_p = false; anchor.initial_reset_callback(respon...
[ "function", "_initial_runner", "(", "response", ",", "manager", ")", "{", "// I can't just remove the callback from the register", "// after the first run because it would be reconstituted", "// every time it was reset (established).", "if", "(", "anchor", ".", "initial_reset_p", ")"...
Finally, we're going to add a first run behavior here. We'll wrap the user-defined function into a
[ "Finally", "we", "re", "going", "to", "add", "a", "first", "run", "behavior", "here", ".", "We", "ll", "wrap", "the", "user", "-", "defined", "function", "into", "a" ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L19123-L19132
train
berkeleybop/bbopx-js
external/bbop.js
_draw_table_or_something
function _draw_table_or_something(resp, manager){ // Wipe interface. jQuery('#' + interface_id).empty(); // Vary by what we got. if( ! resp.success() || resp.total_documents() === 0 ){ jQuery('#' + interface_id).append('<em>No results given your input and search fields. Please refine and try again.</em>'); ...
javascript
function _draw_table_or_something(resp, manager){ // Wipe interface. jQuery('#' + interface_id).empty(); // Vary by what we got. if( ! resp.success() || resp.total_documents() === 0 ){ jQuery('#' + interface_id).append('<em>No results given your input and search fields. Please refine and try again.</em>'); ...
[ "function", "_draw_table_or_something", "(", "resp", ",", "manager", ")", "{", "// Wipe interface.", "jQuery", "(", "'#'", "+", "interface_id", ")", ".", "empty", "(", ")", ";", "// Vary by what we got.", "if", "(", "!", "resp", ".", "success", "(", ")", "||...
Draw a table at the right place or an error message.
[ "Draw", "a", "table", "at", "the", "right", "place", "or", "an", "error", "message", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L20968-L21014
train
berkeleybop/bbopx-js
external/bbop.js
read_cli
function read_cli(event){ var which = event.which; var ctrl_p = event.ctrlKey; //log('cli: ' + which + ', ' + ctrl_p); if ( which == 13 ) { // return // Stop events. event.preventDefault(); // Get and ensure nice JS, wipe CLI clean. var to_eval = jQuery('#' + command_line.get_id())...
javascript
function read_cli(event){ var which = event.which; var ctrl_p = event.ctrlKey; //log('cli: ' + which + ', ' + ctrl_p); if ( which == 13 ) { // return // Stop events. event.preventDefault(); // Get and ensure nice JS, wipe CLI clean. var to_eval = jQuery('#' + command_line.get_id())...
[ "function", "read_cli", "(", "event", ")", "{", "var", "which", "=", "event", ".", "which", ";", "var", "ctrl_p", "=", "event", ".", "ctrlKey", ";", "//log('cli: ' + which + ', ' + ctrl_p);", "if", "(", "which", "==", "13", ")", "{", "// return", "// Stop ev...
A lot of cases for button presses when reading from the command line.
[ "A", "lot", "of", "cases", "for", "button", "presses", "when", "reading", "from", "the", "command", "line", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L21346-L21407
train
berkeleybop/bbopx-js
external/bbop.js
read_buffer
function read_buffer(){ var to_eval = jQuery('#' + command_buffer.get_id()).val(); if( to_eval != '' ){ log('// Evaluating buffer...'); var evals = _evaluate(to_eval); log('// ' + evals[1]); _advance_log_to_bottom(); } }
javascript
function read_buffer(){ var to_eval = jQuery('#' + command_buffer.get_id()).val(); if( to_eval != '' ){ log('// Evaluating buffer...'); var evals = _evaluate(to_eval); log('// ' + evals[1]); _advance_log_to_bottom(); } }
[ "function", "read_buffer", "(", ")", "{", "var", "to_eval", "=", "jQuery", "(", "'#'", "+", "command_buffer", ".", "get_id", "(", ")", ")", ".", "val", "(", ")", ";", "if", "(", "to_eval", "!=", "''", ")", "{", "log", "(", "'// Evaluating buffer...'", ...
Bind buffer eval.
[ "Bind", "buffer", "eval", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L21411-L21419
train
berkeleybop/bbopx-js
external/bbop.js
gather_list_from_hash
function gather_list_from_hash(nid, hash){ var retlist = new Array(); retlist.push(nid); // Get all nodes cribbing from distances. for( vt in hash[nid] ){ //ll("id: " + id + ", v: " + ct); retlist.push(vt); } return retlist; }
javascript
function gather_list_from_hash(nid, hash){ var retlist = new Array(); retlist.push(nid); // Get all nodes cribbing from distances. for( vt in hash[nid] ){ //ll("id: " + id + ", v: " + ct); retlist.push(vt); } return retlist; }
[ "function", "gather_list_from_hash", "(", "nid", ",", "hash", ")", "{", "var", "retlist", "=", "new", "Array", "(", ")", ";", "retlist", ".", "push", "(", "nid", ")", ";", "// Get all nodes cribbing from distances.", "for", "(", "vt", "in", "hash", "[", "n...
Subtree list, including self.
[ "Subtree", "list", "including", "self", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L22185-L22194
train
berkeleybop/bbopx-js
external/bbop.js
get_connections
function get_connections(phynode_id, phynode_getter, conn_hash){ var retlist = new Array(); // Fish in the connection ancestor hash for edges. var tmp_phynodes = phynode_getter(phynode_id); for( var si = 0; si < tmp_phynodes.length; si++ ){ var tshp = tmp_phynodes[si]; var tnid = phynode_id_to...
javascript
function get_connections(phynode_id, phynode_getter, conn_hash){ var retlist = new Array(); // Fish in the connection ancestor hash for edges. var tmp_phynodes = phynode_getter(phynode_id); for( var si = 0; si < tmp_phynodes.length; si++ ){ var tshp = tmp_phynodes[si]; var tnid = phynode_id_to...
[ "function", "get_connections", "(", "phynode_id", ",", "phynode_getter", ",", "conn_hash", ")", "{", "var", "retlist", "=", "new", "Array", "(", ")", ";", "// Fish in the connection ancestor hash for edges.", "var", "tmp_phynodes", "=", "phynode_getter", "(", "phynode...
General func.
[ "General", "func", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L22238-L22259
train
berkeleybop/bbopx-js
external/bbop.js
function () { var phynode_id = this.id; // Fade boxes. var assoc_phynodes = get_descendant_phynodes(phynode_id); for( var si = 0; si < assoc_phynodes.length; si++ ){ var mshp = assoc_phynodes[si]; mshp.update(); } // Update connections; bring them all back to normal....
javascript
function () { var phynode_id = this.id; // Fade boxes. var assoc_phynodes = get_descendant_phynodes(phynode_id); for( var si = 0; si < assoc_phynodes.length; si++ ){ var mshp = assoc_phynodes[si]; mshp.update(); } // Update connections; bring them all back to normal....
[ "function", "(", ")", "{", "var", "phynode_id", "=", "this", ".", "id", ";", "// Fade boxes.", "var", "assoc_phynodes", "=", "get_descendant_phynodes", "(", "phynode_id", ")", ";", "for", "(", "var", "si", "=", "0", ";", "si", "<", "assoc_phynodes", ".", ...
Undrag animation.
[ "Undrag", "animation", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L22335-L22351
train
berkeleybop/bbopx-js
external/bbop.js
dblclick_event_handler
function dblclick_event_handler(event){ var phynode_id = this.id; // If this is the first double click here... var pn = get_pnode_from_phynode_id(phynode_id); if( pn.open == true ){ // "Vanish" edges. var subtree_edges = get_descendant_connections(phynode_id); for( var se = 0; se < subtre...
javascript
function dblclick_event_handler(event){ var phynode_id = this.id; // If this is the first double click here... var pn = get_pnode_from_phynode_id(phynode_id); if( pn.open == true ){ // "Vanish" edges. var subtree_edges = get_descendant_connections(phynode_id); for( var se = 0; se < subtre...
[ "function", "dblclick_event_handler", "(", "event", ")", "{", "var", "phynode_id", "=", "this", ".", "id", ";", "// If this is the first double click here...", "var", "pn", "=", "get_pnode_from_phynode_id", "(", "phynode_id", ")", ";", "if", "(", "pn", ".", "open"...
Experiment with double click.
[ "Experiment", "with", "double", "click", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L22354-L22402
train
berkeleybop/bbopx-js
external/bbop.js
_generate_element
function _generate_element(ctype, str){ var message_classes = ['bbop-js-message', 'bbop-js-message-' + ctype]; var message_elt = new bbop.html.tag('div', {'generate_id': true, 'class': message_classes.join(' ')}, '<h2>' + str + '</h2>'); jQuery("body").append(jQuery(...
javascript
function _generate_element(ctype, str){ var message_classes = ['bbop-js-message', 'bbop-js-message-' + ctype]; var message_elt = new bbop.html.tag('div', {'generate_id': true, 'class': message_classes.join(' ')}, '<h2>' + str + '</h2>'); jQuery("body").append(jQuery(...
[ "function", "_generate_element", "(", "ctype", ",", "str", ")", "{", "var", "message_classes", "=", "[", "'bbop-js-message'", ",", "'bbop-js-message-'", "+", "ctype", "]", ";", "var", "message_elt", "=", "new", "bbop", ".", "html", ".", "tag", "(", "'div'", ...
Generate tags.
[ "Generate", "tags", "." ]
847d87f5980f144c19c4caef3786044930fe51db
https://github.com/berkeleybop/bbopx-js/blob/847d87f5980f144c19c4caef3786044930fe51db/external/bbop.js#L24584-L24600
train
briancsparks/run-anywhere
ra.js
function(dirname) { var result; if (!fs.test('-d', dirname)) { return result; } result = {}; _.each(sg.fs.ls(dirname), (name_) => { const name = path.basename(name_, '.js'); const filename = path.join(dirname, name); if (!fs.test('-f', `${filename}.js`)) { return; } // skip if (name.s...
javascript
function(dirname) { var result; if (!fs.test('-d', dirname)) { return result; } result = {}; _.each(sg.fs.ls(dirname), (name_) => { const name = path.basename(name_, '.js'); const filename = path.join(dirname, name); if (!fs.test('-f', `${filename}.js`)) { return; } // skip if (name.s...
[ "function", "(", "dirname", ")", "{", "var", "result", ";", "if", "(", "!", "fs", ".", "test", "(", "'-d'", ",", "dirname", ")", ")", "{", "return", "result", ";", "}", "result", "=", "{", "}", ";", "_", ".", "each", "(", "sg", ".", "fs", "."...
Loads all the scripts in a dir.
[ "Loads", "all", "the", "scripts", "in", "a", "dir", "." ]
b73d170dc86cc00e6562ca8544fceb3478d51e20
https://github.com/briancsparks/run-anywhere/blob/b73d170dc86cc00e6562ca8544fceb3478d51e20/ra.js#L269-L286
train
RangerMauve/cypher-promise
index.js
make_query_maker
function make_query_maker(connection_string, connection_opts) { connection_string = connection_string || "http://localhost:7474"; connection_opts = connection_opts || {}; var client_cache = null; return { query: query, multi: multi }; /** * Makes a cypher query and resolves to the result * @param {Stri...
javascript
function make_query_maker(connection_string, connection_opts) { connection_string = connection_string || "http://localhost:7474"; connection_opts = connection_opts || {}; var client_cache = null; return { query: query, multi: multi }; /** * Makes a cypher query and resolves to the result * @param {Stri...
[ "function", "make_query_maker", "(", "connection_string", ",", "connection_opts", ")", "{", "connection_string", "=", "connection_string", "||", "\"http://localhost:7474\"", ";", "connection_opts", "=", "connection_opts", "||", "{", "}", ";", "var", "client_cache", "=",...
Creates a new client for making cypher queries @param {String} connection_string The url of the Neo4j server @param {Object} [connection_opts] Options for node-cypher @return {Cypher} Returns a new Cypher client
[ "Creates", "a", "new", "client", "for", "making", "cypher", "queries" ]
cc2bdc95fce6525427a76a891d174afcfc5bcd8e
https://github.com/RangerMauve/cypher-promise/blob/cc2bdc95fce6525427a76a891d174afcfc5bcd8e/index.js#L15-L84
train
RangerMauve/cypher-promise
index.js
query_with
function query_with(client, cypher_query, parameters) { parameters = parameters || {}; return make_promise(client.query.bind(client, cypher_query, parameters)); }
javascript
function query_with(client, cypher_query, parameters) { parameters = parameters || {}; return make_promise(client.query.bind(client, cypher_query, parameters)); }
[ "function", "query_with", "(", "client", ",", "cypher_query", ",", "parameters", ")", "{", "parameters", "=", "parameters", "||", "{", "}", ";", "return", "make_promise", "(", "client", ".", "query", ".", "bind", "(", "client", ",", "cypher_query", ",", "p...
Makes a query with a given client and returns a promise
[ "Makes", "a", "query", "with", "a", "given", "client", "and", "returns", "a", "promise" ]
cc2bdc95fce6525427a76a891d174afcfc5bcd8e
https://github.com/RangerMauve/cypher-promise/blob/cc2bdc95fce6525427a76a891d174afcfc5bcd8e/index.js#L66-L69
train
RangerMauve/cypher-promise
index.js
get_client
function get_client() { if (client_cache) return Promise.resolve(client_cache); return make_promise( cypher.createClient.bind(cypher, connection_string, connection_opts) ).then(cache_client); }
javascript
function get_client() { if (client_cache) return Promise.resolve(client_cache); return make_promise( cypher.createClient.bind(cypher, connection_string, connection_opts) ).then(cache_client); }
[ "function", "get_client", "(", ")", "{", "if", "(", "client_cache", ")", "return", "Promise", ".", "resolve", "(", "client_cache", ")", ";", "return", "make_promise", "(", "cypher", ".", "createClient", ".", "bind", "(", "cypher", ",", "connection_string", "...
Creates a new client or returns a cached one
[ "Creates", "a", "new", "client", "or", "returns", "a", "cached", "one" ]
cc2bdc95fce6525427a76a891d174afcfc5bcd8e
https://github.com/RangerMauve/cypher-promise/blob/cc2bdc95fce6525427a76a891d174afcfc5bcd8e/index.js#L72-L77
train
Nazariglez/perenquen
lib/pixi/src/filters/dropshadow/BlurYTintFilter.js
BlurYTintFilter
function BlurYTintFilter() { core.AbstractFilter.call(this, // vertex shader fs.readFileSync(__dirname + '/blurYTint.vert', 'utf8'), // fragment shader fs.readFileSync(__dirname + '/blurYTint.frag', 'utf8'), // set the uniforms { blur: { type: '1f', value:...
javascript
function BlurYTintFilter() { core.AbstractFilter.call(this, // vertex shader fs.readFileSync(__dirname + '/blurYTint.vert', 'utf8'), // fragment shader fs.readFileSync(__dirname + '/blurYTint.frag', 'utf8'), // set the uniforms { blur: { type: '1f', value:...
[ "function", "BlurYTintFilter", "(", ")", "{", "core", ".", "AbstractFilter", ".", "call", "(", "this", ",", "// vertex shader", "fs", ".", "readFileSync", "(", "__dirname", "+", "'/blurYTint.vert'", ",", "'utf8'", ")", ",", "// fragment shader", "fs", ".", "re...
The BlurYTintFilter applies a vertical Gaussian blur to an object. @class @extends AbstractFilter @memberof PIXI.filters
[ "The", "BlurYTintFilter", "applies", "a", "vertical", "Gaussian", "blur", "to", "an", "object", "." ]
e023964d05afeefebdcac4e2044819fdfa3899ae
https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/dropshadow/BlurYTintFilter.js#L13-L32
train
wunderbyte/grunt-spiritual-dox
src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js
function ( src ) { var cuts = src.split ( "/" ); var name = cuts.pop (); var dots = src.split ( "." ); var type = dots.pop (); new gui.Request(src).acceptText().get().then(function(status, data) { this._output(name, type, data); }, this); }
javascript
function ( src ) { var cuts = src.split ( "/" ); var name = cuts.pop (); var dots = src.split ( "." ); var type = dots.pop (); new gui.Request(src).acceptText().get().then(function(status, data) { this._output(name, type, data); }, this); }
[ "function", "(", "src", ")", "{", "var", "cuts", "=", "src", ".", "split", "(", "\"/\"", ")", ";", "var", "name", "=", "cuts", ".", "pop", "(", ")", ";", "var", "dots", "=", "src", ".", "split", "(", "\".\"", ")", ";", "var", "type", "=", "do...
Fetch file from server. @return {String} src
[ "Fetch", "file", "from", "server", "." ]
5afcfe31ddbf7d654166aa15b938553b61de5811
https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js#L37-L45
train
wunderbyte/grunt-spiritual-dox
src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js
function ( text, type ) { switch ( type ) { case "js" : return new dox.JSDoc ({ title : document.title, chapters : this._chapters ( text ) }); case "md" : return new dox.MDDoc ({ title : document.title, markup : this._markup ( text ) }); } }
javascript
function ( text, type ) { switch ( type ) { case "js" : return new dox.JSDoc ({ title : document.title, chapters : this._chapters ( text ) }); case "md" : return new dox.MDDoc ({ title : document.title, markup : this._markup ( text ) }); } }
[ "function", "(", "text", ",", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "\"js\"", ":", "return", "new", "dox", ".", "JSDoc", "(", "{", "title", ":", "document", ".", "title", ",", "chapters", ":", "this", ".", "_chapters", "(", "te...
Compute Doc object for file text. @param {String} text File text @param {String} type File type @returns {dox.JSDoc|dox.MDDoc}
[ "Compute", "Doc", "object", "for", "file", "text", "." ]
5afcfe31ddbf7d654166aa15b938553b61de5811
https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js#L66-L79
train
wunderbyte/grunt-spiritual-dox
src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js
function ( source ) { var comment = false; var chapters = []; var chapter = null; var sections = []; var section = null; var marker = new Showdown.converter (); function nextchapter ( title ) { if ( chapter ) { chapter.sections = sections.map ( function ( section, i ) { section.desc = marker...
javascript
function ( source ) { var comment = false; var chapters = []; var chapter = null; var sections = []; var section = null; var marker = new Showdown.converter (); function nextchapter ( title ) { if ( chapter ) { chapter.sections = sections.map ( function ( section, i ) { section.desc = marker...
[ "function", "(", "source", ")", "{", "var", "comment", "=", "false", ";", "var", "chapters", "=", "[", "]", ";", "var", "chapter", "=", "null", ";", "var", "sections", "=", "[", "]", ";", "var", "section", "=", "null", ";", "var", "marker", "=", ...
Parse source code to chapters. @param {String} source @return {Array<dox.Chapter>}
[ "Parse", "source", "code", "to", "chapters", "." ]
5afcfe31ddbf7d654166aa15b938553b61de5811
https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/guidox@wunderbyte.com/spirits/output/dox.DocsOutputSpirit.js#L86-L171
train
IonicaBizau/indento
lib/index.js
indento
function indento(input, width, char) { char = typeof char !== "string" ? " " : char; return String(input).replace(/^/gm, char.repeat(width)); }
javascript
function indento(input, width, char) { char = typeof char !== "string" ? " " : char; return String(input).replace(/^/gm, char.repeat(width)); }
[ "function", "indento", "(", "input", ",", "width", ",", "char", ")", "{", "char", "=", "typeof", "char", "!==", "\"string\"", "?", "\" \"", ":", "char", ";", "return", "String", "(", "input", ")", ".", "replace", "(", "/", "^", "/", "gm", ",", "cha...
indento Indents the input string. @name indento @function @param {String} input The input string. @param {Number} width The indent width. @param {String} char The character to use for indentation (default: `" "`). @return {String} The indented string.
[ "indento", "Indents", "the", "input", "string", "." ]
8d1a2745ff03bd92484e115eb28c473c09e52c02
https://github.com/IonicaBizau/indento/blob/8d1a2745ff03bd92484e115eb28c473c09e52c02/lib/index.js#L12-L15
train
Jonjump/trakter
index.js
request
function request (suppliedOptions,data,next) { var options = makeOptions(suppliedOptions); switch (options.method ? options.method.toUpperCase() : "BADMETHOD") { case "PUT": case "POST": var dataString = JSON.stringify(data); options.headers['Content-Leng...
javascript
function request (suppliedOptions,data,next) { var options = makeOptions(suppliedOptions); switch (options.method ? options.method.toUpperCase() : "BADMETHOD") { case "PUT": case "POST": var dataString = JSON.stringify(data); options.headers['Content-Leng...
[ "function", "request", "(", "suppliedOptions", ",", "data", ",", "next", ")", "{", "var", "options", "=", "makeOptions", "(", "suppliedOptions", ")", ";", "switch", "(", "options", ".", "method", "?", "options", ".", "method", ".", "toUpperCase", "(", ")",...
make a request to Trakt.tv @method request @param {Object} options The options for the call @param {Object} data The data for the call, or null @param {Function} next(err,traktResponseString) @example trakter.request(options,data,next )
[ "make", "a", "request", "to", "Trakt", ".", "tv" ]
637c73bd67c3507660e3057570c726420553c9f2
https://github.com/Jonjump/trakter/blob/637c73bd67c3507660e3057570c726420553c9f2/index.js#L95-L139
train
MakerCollider/upm_mc
doxy/node/generators/ternjs/generator.js
GENERATE_CLASSES
function GENERATE_CLASSES(classes) { var docs = {}; _.each(classes, function(classSpec, parentClass) { var constructor = classSpec.methods[parentClass]; _.extend(docs, GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } )); if (_.has(docs, parentClass)) ...
javascript
function GENERATE_CLASSES(classes) { var docs = {}; _.each(classes, function(classSpec, parentClass) { var constructor = classSpec.methods[parentClass]; _.extend(docs, GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } )); if (_.has(docs, parentClass)) ...
[ "function", "GENERATE_CLASSES", "(", "classes", ")", "{", "var", "docs", "=", "{", "}", ";", "_", ".", "each", "(", "classes", ",", "function", "(", "classSpec", ",", "parentClass", ")", "{", "var", "constructor", "=", "classSpec", ".", "methods", "[", ...
generate the spec for the given list of classes
[ "generate", "the", "spec", "for", "the", "given", "list", "of", "classes" ]
525e775a17b85c30716c00435a2acb26bb198c12
https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/ternjs/generator.js#L69-L88
train
MakerCollider/upm_mc
doxy/node/generators/ternjs/generator.js
GENERATE_METHOD
function GENERATE_METHOD(name, spec) { var doc = {}; doc[name] = { '!type': 'fn(' + GENERATE_PARAMS(spec.params) + ')' + GENERATE_RETURN(spec.return), '!doc': spec.description } return doc; }
javascript
function GENERATE_METHOD(name, spec) { var doc = {}; doc[name] = { '!type': 'fn(' + GENERATE_PARAMS(spec.params) + ')' + GENERATE_RETURN(spec.return), '!doc': spec.description } return doc; }
[ "function", "GENERATE_METHOD", "(", "name", ",", "spec", ")", "{", "var", "doc", "=", "{", "}", ";", "doc", "[", "name", "]", "=", "{", "'!type'", ":", "'fn('", "+", "GENERATE_PARAMS", "(", "spec", ".", "params", ")", "+", "')'", "+", "GENERATE_RETUR...
generate method spec
[ "generate", "method", "spec" ]
525e775a17b85c30716c00435a2acb26bb198c12
https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/ternjs/generator.js#L92-L99
train
MakerCollider/upm_mc
doxy/node/generators/ternjs/generator.js
GENERATE_PARAMS
function GENERATE_PARAMS(spec) { return _.map(spec, function(paramSpec, paramName) { return paramName + ': ' + paramSpec.type; }).join(', '); }
javascript
function GENERATE_PARAMS(spec) { return _.map(spec, function(paramSpec, paramName) { return paramName + ': ' + paramSpec.type; }).join(', '); }
[ "function", "GENERATE_PARAMS", "(", "spec", ")", "{", "return", "_", ".", "map", "(", "spec", ",", "function", "(", "paramSpec", ",", "paramName", ")", "{", "return", "paramName", "+", "': '", "+", "paramSpec", ".", "type", ";", "}", ")", ".", "join", ...
generate parameter signatures for method
[ "generate", "parameter", "signatures", "for", "method" ]
525e775a17b85c30716c00435a2acb26bb198c12
https://github.com/MakerCollider/upm_mc/blob/525e775a17b85c30716c00435a2acb26bb198c12/doxy/node/generators/ternjs/generator.js#L103-L107
train
sendanor/nor-db
orig/2013-08-21/extend.js
extend_if_promise
function extend_if_promise(methods, ret) { if(ret && ret.then) { // Check if return value is promise compatible return extend.promise(methods, ret); // ..and if so, extend it, too. } return ret; // ..and if not, return the s...
javascript
function extend_if_promise(methods, ret) { if(ret && ret.then) { // Check if return value is promise compatible return extend.promise(methods, ret); // ..and if so, extend it, too. } return ret; // ..and if not, return the s...
[ "function", "extend_if_promise", "(", "methods", ",", "ret", ")", "{", "if", "(", "ret", "&&", "ret", ".", "then", ")", "{", "// Check if return value is promise compatible", "return", "extend", ".", "promise", "(", "methods", ",", "ret", ")", ";", "// ..and i...
original extend_promise Extend the value if it's a promise, otherwise just return it instead. @returns the extended promise or the value itself.
[ "original", "extend_promise", "Extend", "the", "value", "if", "it", "s", "a", "promise", "otherwise", "just", "return", "it", "instead", "." ]
db4b78691956a49370fc9d9a4eed27e7d3720aeb
https://github.com/sendanor/nor-db/blob/db4b78691956a49370fc9d9a4eed27e7d3720aeb/orig/2013-08-21/extend.js#L52-L57
train
node-ci/nci-projects-reloader
lib/index.js
function(filename, fileInfo) { var projectName = path.relative( app.config.paths.projects, path.dirname(filename) ); if (app.projects.get(projectName)) { logger.log('Unload project: "' + projectName + '"'); app.projects.unload({name: projectName}); } // on add or change (info is falsy on unlink)...
javascript
function(filename, fileInfo) { var projectName = path.relative( app.config.paths.projects, path.dirname(filename) ); if (app.projects.get(projectName)) { logger.log('Unload project: "' + projectName + '"'); app.projects.unload({name: projectName}); } // on add or change (info is falsy on unlink)...
[ "function", "(", "filename", ",", "fileInfo", ")", "{", "var", "projectName", "=", "path", ".", "relative", "(", "app", ".", "config", ".", "paths", ".", "projects", ",", "path", ".", "dirname", "(", "filename", ")", ")", ";", "if", "(", "app", ".", ...
start file watcher for reloading projects on change
[ "start", "file", "watcher", "for", "reloading", "projects", "on", "change" ]
25f125a5135853e9cffd4db62246e0a6984d0fc3
https://github.com/node-ci/nci-projects-reloader/blob/25f125a5135853e9cffd4db62246e0a6984d0fc3/lib/index.js#L10-L37
train
mikolalysenko/splat-points
splat.js
splatND
function splatND(out, points, weights, radius) { var n = points.shape[0] var d = points.shape[1] var lo = new Array(d) var hi = new Array(d) var bounds = out.shape var coord = new Array(d+1) var w = 1.0 function splatRec(k) { if(k < 0) { coord[d] = out.get.apply(out, coord) + w out.set.a...
javascript
function splatND(out, points, weights, radius) { var n = points.shape[0] var d = points.shape[1] var lo = new Array(d) var hi = new Array(d) var bounds = out.shape var coord = new Array(d+1) var w = 1.0 function splatRec(k) { if(k < 0) { coord[d] = out.get.apply(out, coord) + w out.set.a...
[ "function", "splatND", "(", "out", ",", "points", ",", "weights", ",", "radius", ")", "{", "var", "n", "=", "points", ".", "shape", "[", "0", "]", "var", "d", "=", "points", ".", "shape", "[", "1", "]", "var", "lo", "=", "new", "Array", "(", "d...
Slow generic routine
[ "Slow", "generic", "routine" ]
d89e439d27795130ee9f4f597670ef0376f13b39
https://github.com/mikolalysenko/splat-points/blob/d89e439d27795130ee9f4f597670ef0376f13b39/splat.js#L14-L50
train
novadiscovery/nway
lib/templates/loader.js
fireOnLoad
function fireOnLoad() { var args = arguments, i; for(i = 0, len = addOnLoadHandler.stack.length; i<len; i++) { addOnLoadHandler.stack[i].apply(null, args); } }
javascript
function fireOnLoad() { var args = arguments, i; for(i = 0, len = addOnLoadHandler.stack.length; i<len; i++) { addOnLoadHandler.stack[i].apply(null, args); } }
[ "function", "fireOnLoad", "(", ")", "{", "var", "args", "=", "arguments", ",", "i", ";", "for", "(", "i", "=", "0", ",", "len", "=", "addOnLoadHandler", ".", "stack", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "addOnLoadHandler"...
Call on load handlers
[ "Call", "on", "load", "handlers" ]
fa31c6fe56f2305721e581ac25e8ac9a87e15dda
https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/templates/loader.js#L23-L28
train
novadiscovery/nway
lib/templates/loader.js
findHash
function findHash(path) { var h, m, len; for(h in config.map) { var modules = config.map[h]; for(m = 0, len = modules.length; m < len; m++ ) { if(modules[m] === path) return h } } return null; }
javascript
function findHash(path) { var h, m, len; for(h in config.map) { var modules = config.map[h]; for(m = 0, len = modules.length; m < len; m++ ) { if(modules[m] === path) return h } } return null; }
[ "function", "findHash", "(", "path", ")", "{", "var", "h", ",", "m", ",", "len", ";", "for", "(", "h", "in", "config", ".", "map", ")", "{", "var", "modules", "=", "config", ".", "map", "[", "h", "]", ";", "for", "(", "m", "=", "0", ",", "l...
Find the pack hash for the given path @param {string} path The path to resolve @return {string} The hash for the path @api private
[ "Find", "the", "pack", "hash", "for", "the", "given", "path" ]
fa31c6fe56f2305721e581ac25e8ac9a87e15dda
https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/templates/loader.js#L52-L61
train
novadiscovery/nway
lib/templates/loader.js
scriptLoader
function scriptLoader(url, callback) { var doc = document, s = doc.createElement("script") , head = doc.getElementsByTagName("head")[0] , node , done = false; ; // On success listener function onScriptLoad() { if ( !done && (!this.readyState || this.readyState == "...
javascript
function scriptLoader(url, callback) { var doc = document, s = doc.createElement("script") , head = doc.getElementsByTagName("head")[0] , node , done = false; ; // On success listener function onScriptLoad() { if ( !done && (!this.readyState || this.readyState == "...
[ "function", "scriptLoader", "(", "url", ",", "callback", ")", "{", "var", "doc", "=", "document", ",", "s", "=", "doc", ".", "createElement", "(", "\"script\"", ")", ",", "head", "=", "doc", ".", "getElementsByTagName", "(", "\"head\"", ")", "[", "0", ...
The script loader Load a packed script and return to the callback the resulting value @param {string} url The packed script url @param {Function} callback A callback function that receive and error object
[ "The", "script", "loader" ]
fa31c6fe56f2305721e581ac25e8ac9a87e15dda
https://github.com/novadiscovery/nway/blob/fa31c6fe56f2305721e581ac25e8ac9a87e15dda/lib/templates/loader.js#L73-L116
train
RaphaelDeLaGhetto/gebo-utils
index.js
_getMongoDbName
function _getMongoDbName(str) { if (!/[/\. "*<>:|?@]/.test(str)) { return str; } str = str.replace(/\//g, exports.constants.slash); str = str.replace(/\\/g, exports.constants.backslash); str = str.replace(/\./g, exports.constants.dot); str = str.replace...
javascript
function _getMongoDbName(str) { if (!/[/\. "*<>:|?@]/.test(str)) { return str; } str = str.replace(/\//g, exports.constants.slash); str = str.replace(/\\/g, exports.constants.backslash); str = str.replace(/\./g, exports.constants.dot); str = str.replace...
[ "function", "_getMongoDbName", "(", "str", ")", "{", "if", "(", "!", "/", "[/\\. \"*<>:|?@]", "/", ".", "test", "(", "str", ")", ")", "{", "return", "str", ";", "}", "str", "=", "str", ".", "replace", "(", "/", "\\/", "/", "g", ",", "exports", "....
Make the gebo user's email address suitable for naming a database... and more! Mongo does not allow these characters: /\. "*<>:|? (http://docs.mongodb.org/manual/reference/limits/) This function sanitizes @s as well, though it is not required by Mongo. @param string @return string
[ "Make", "the", "gebo", "user", "s", "email", "address", "suitable", "for", "naming", "a", "database", "...", "and", "more!" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L94-L113
train
RaphaelDeLaGhetto/gebo-utils
index.js
_getSafeFileName
function _getSafeFileName(filename, directory) { var deferred = q.defer(); fs.readdir(directory, function(err, files) { if(err) { // This means the directory doesn't exist if (err.errno === 34 && err.code === 'ENOENT') { deferred.resolve(...
javascript
function _getSafeFileName(filename, directory) { var deferred = q.defer(); fs.readdir(directory, function(err, files) { if(err) { // This means the directory doesn't exist if (err.errno === 34 && err.code === 'ENOENT') { deferred.resolve(...
[ "function", "_getSafeFileName", "(", "filename", ",", "directory", ")", "{", "var", "deferred", "=", "q", ".", "defer", "(", ")", ";", "fs", ".", "readdir", "(", "directory", ",", "function", "(", "err", ",", "files", ")", "{", "if", "(", "err", ")",...
Append a copy number to a filename if a file by that same name already exists @param string @param string @return promise
[ "Append", "a", "copy", "number", "to", "a", "filename", "if", "a", "file", "by", "that", "same", "name", "already", "exists" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L209-L274
train
RaphaelDeLaGhetto/gebo-utils
index.js
_getOutputFileName
function _getOutputFileName(path, extension) { var filename = path.split('/'); filename = filename[filename.length - 1]; filename = filename.split('.'); // No extension found if (filename.length === 1) { return filename[0] + '.' + extension; } ...
javascript
function _getOutputFileName(path, extension) { var filename = path.split('/'); filename = filename[filename.length - 1]; filename = filename.split('.'); // No extension found if (filename.length === 1) { return filename[0] + '.' + extension; } ...
[ "function", "_getOutputFileName", "(", "path", ",", "extension", ")", "{", "var", "filename", "=", "path", ".", "split", "(", "'/'", ")", ";", "filename", "=", "filename", "[", "filename", ".", "length", "-", "1", "]", ";", "filename", "=", "filename", ...
Take the incoming filename and its extension and return the hypothetical output filename @param string @param string @return string
[ "Take", "the", "incoming", "filename", "and", "its", "extension", "and", "return", "the", "hypothetical", "output", "filename" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L334-L356
train
RaphaelDeLaGhetto/gebo-utils
index.js
_setTimeLimit
function _setTimeLimit(options, done) { if (options && options.timeLimit && options.pidFile) { var timeout = setTimeout(function() { var kill = 'kill $(cat ' + options.pidFile + ')'; if (logLevel === 'trace') logger.warn('process', kill); childProcess.ex...
javascript
function _setTimeLimit(options, done) { if (options && options.timeLimit && options.pidFile) { var timeout = setTimeout(function() { var kill = 'kill $(cat ' + options.pidFile + ')'; if (logLevel === 'trace') logger.warn('process', kill); childProcess.ex...
[ "function", "_setTimeLimit", "(", "options", ",", "done", ")", "{", "if", "(", "options", "&&", "options", ".", "timeLimit", "&&", "options", ".", "pidFile", ")", "{", "var", "timeout", "=", "setTimeout", "(", "function", "(", ")", "{", "var", "kill", ...
Set time limit on operating system process @param object @param function @return timeoutObject
[ "Set", "time", "limit", "on", "operating", "system", "process" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L367-L390
train
RaphaelDeLaGhetto/gebo-utils
index.js
_stopTimer
function _stopTimer(timer, options) { if (timer) { options.timeLimit = _getTimeLeft(timer); clearTimeout(timer); } }
javascript
function _stopTimer(timer, options) { if (timer) { options.timeLimit = _getTimeLeft(timer); clearTimeout(timer); } }
[ "function", "_stopTimer", "(", "timer", ",", "options", ")", "{", "if", "(", "timer", ")", "{", "options", ".", "timeLimit", "=", "_getTimeLeft", "(", "timer", ")", ";", "clearTimeout", "(", "timer", ")", ";", "}", "}" ]
Clear the timer and record the time remaining @param timeoutObject @param object
[ "Clear", "the", "timer", "and", "record", "the", "time", "remaining" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L399-L404
train
RaphaelDeLaGhetto/gebo-utils
index.js
_echoPidToFile
function _echoPidToFile(options) { var command = ''; if (options && options.pidFile) { command = ' & echo $! > ' + options.pidFile; } return command; }
javascript
function _echoPidToFile(options) { var command = ''; if (options && options.pidFile) { command = ' & echo $! > ' + options.pidFile; } return command; }
[ "function", "_echoPidToFile", "(", "options", ")", "{", "var", "command", "=", "''", ";", "if", "(", "options", "&&", "options", ".", "pidFile", ")", "{", "command", "=", "' & echo $! > '", "+", "options", ".", "pidFile", ";", "}", "return", "command", "...
Format the echo-to-PID-file command string @param object @return string
[ "Format", "the", "echo", "-", "to", "-", "PID", "-", "file", "command", "string" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L414-L420
train
RaphaelDeLaGhetto/gebo-utils
index.js
_getTimeLeft
function _getTimeLeft(timeout) { return Math.ceil(timeout._idleStart + timeout._idleTimeout - Date.now()); }
javascript
function _getTimeLeft(timeout) { return Math.ceil(timeout._idleStart + timeout._idleTimeout - Date.now()); }
[ "function", "_getTimeLeft", "(", "timeout", ")", "{", "return", "Math", ".", "ceil", "(", "timeout", ".", "_idleStart", "+", "timeout", ".", "_idleTimeout", "-", "Date", ".", "now", "(", ")", ")", ";", "}" ]
Get time left 2014-11-6 http://stackoverflow.com/questions/3144711/javascript-find-the-time-left-in-a-settimeout Courtesy of Fluffy @param timeoutObject @return integer
[ "Get", "time", "left" ]
338bc15f8a94621f145eb378f0b42123548ca545
https://github.com/RaphaelDeLaGhetto/gebo-utils/blob/338bc15f8a94621f145eb378f0b42123548ca545/index.js#L434-L436
train
emiljohansson/captn
captn.dom.show/index.js
hide
function hide(element) { if (!element || !element.style || typeof element.style.display !== 'string') { return; } element.style.display = ""; }
javascript
function hide(element) { if (!element || !element.style || typeof element.style.display !== 'string') { return; } element.style.display = ""; }
[ "function", "hide", "(", "element", ")", "{", "if", "(", "!", "element", "||", "!", "element", ".", "style", "||", "typeof", "element", ".", "style", ".", "display", "!==", "'string'", ")", "{", "return", ";", "}", "element", ".", "style", ".", "disp...
Hides an element. @static @param {DOMElement} element The DOM element to be modified. @example hide(el); el.style // => display: "";
[ "Hides", "an", "element", "." ]
dae7520116dc2148b4de06af7e1d7a47a3a3ac37
https://github.com/emiljohansson/captn/blob/dae7520116dc2148b4de06af7e1d7a47a3a3ac37/captn.dom.show/index.js#L15-L20
train
base/base-scaffold
index.js
function(name, config) { if (!config && typeof name === 'string' || utils.isObject(name)) { return this.getScaffold(name); } this.setScaffold.apply(this, arguments); if (typeof name === 'string') { return this.getScaffold(name); } return this; }
javascript
function(name, config) { if (!config && typeof name === 'string' || utils.isObject(name)) { return this.getScaffold(name); } this.setScaffold.apply(this, arguments); if (typeof name === 'string') { return this.getScaffold(name); } return this; }
[ "function", "(", "name", ",", "config", ")", "{", "if", "(", "!", "config", "&&", "typeof", "name", "===", "'string'", "||", "utils", ".", "isObject", "(", "name", ")", ")", "{", "return", "this", ".", "getScaffold", "(", "name", ")", ";", "}", "th...
Get scaffold `name` from `app.scaffolds`, or set scaffold `name` with the given `config`. ```js app.scaffold('foo', { docs: { options: {}, files: { src: ['*'], dest: 'foo' } } }); // or var scaffold = app.scaffold('foo'); ``` @name .scaffold @param {String|Object|Function} `name` @param {Object|Fucntion} `config` @re...
[ "Get", "scaffold", "name", "from", "app", ".", "scaffolds", "or", "set", "scaffold", "name", "with", "the", "given", "config", "." ]
d03b0f4a7ba7a1b44be8b1708a2bce613be1c4e1
https://github.com/base/base-scaffold/blob/d03b0f4a7ba7a1b44be8b1708a2bce613be1c4e1/index.js#L77-L87
train
base/base-scaffold
index.js
function(name, config) { if (typeof name !== 'string') { throw new TypeError('expected the first argument to be a string'); } if (utils.isObject(config)) { config.name = name; } this.emit('scaffold.set', name, config); this.scaffolds[name] = config; ...
javascript
function(name, config) { if (typeof name !== 'string') { throw new TypeError('expected the first argument to be a string'); } if (utils.isObject(config)) { config.name = name; } this.emit('scaffold.set', name, config); this.scaffolds[name] = config; ...
[ "function", "(", "name", ",", "config", ")", "{", "if", "(", "typeof", "name", "!==", "'string'", ")", "{", "throw", "new", "TypeError", "(", "'expected the first argument to be a string'", ")", ";", "}", "if", "(", "utils", ".", "isObject", "(", "config", ...
Add scaffold `name` to `app.scaffolds`. ```js app.addScaffold('foo', { docs: { options: {}, files: { src: ['*'], dest: 'foo' } } }); ``` @param {String} `name` @param {Object|Function} `config` @api public
[ "Add", "scaffold", "name", "to", "app", ".", "scaffolds", "." ]
d03b0f4a7ba7a1b44be8b1708a2bce613be1c4e1
https://github.com/base/base-scaffold/blob/d03b0f4a7ba7a1b44be8b1708a2bce613be1c4e1/index.js#L108-L118
train
base/base-scaffold
index.js
function(name, options) { var opts = utils.merge({}, this.options, options); var config; switch (utils.typeOf(name)) { case 'function': config = name; break; case 'object': config = name; name = config.name; break; ...
javascript
function(name, options) { var opts = utils.merge({}, this.options, options); var config; switch (utils.typeOf(name)) { case 'function': config = name; break; case 'object': config = name; name = config.name; break; ...
[ "function", "(", "name", ",", "options", ")", "{", "var", "opts", "=", "utils", ".", "merge", "(", "{", "}", ",", "this", ".", "options", ",", "options", ")", ";", "var", "config", ";", "switch", "(", "utils", ".", "typeOf", "(", "name", ")", ")"...
Get scaffold `name` from `app.scaffolds`, or return a normalized instance of `Scaffold` if an object or function is passed. ```js var scaffold = app.getScaffold('foo'); // or create an instance of `Scaffold` using the given object var scaffold = app.getScaffold({ docs: { options: {}, files: { src: ['*'], dest: 'foo' ...
[ "Get", "scaffold", "name", "from", "app", ".", "scaffolds", "or", "return", "a", "normalized", "instance", "of", "Scaffold", "if", "an", "object", "or", "function", "is", "passed", "." ]
d03b0f4a7ba7a1b44be8b1708a2bce613be1c4e1
https://github.com/base/base-scaffold/blob/d03b0f4a7ba7a1b44be8b1708a2bce613be1c4e1/index.js#L143-L209
train
nashdot/Preprocessor.js
Preprocessor.js
Preprocessor
function Preprocessor(source, baseDirOrIncludes, preserveLineNumbers) { /** * Source code to pre-process. * @type {string} * @expose */ this.source = '' + source; /** * Source base directory. * @type {string} * @expose */ this.baseDir = typeof baseDirOrIncludes =...
javascript
function Preprocessor(source, baseDirOrIncludes, preserveLineNumbers) { /** * Source code to pre-process. * @type {string} * @expose */ this.source = '' + source; /** * Source base directory. * @type {string} * @expose */ this.baseDir = typeof baseDirOrIncludes =...
[ "function", "Preprocessor", "(", "source", ",", "baseDirOrIncludes", ",", "preserveLineNumbers", ")", "{", "/**\n * Source code to pre-process.\n * @type {string}\n * @expose\n */", "this", ".", "source", "=", "''", "+", "source", ";", "/**\n * Source base d...
Constructs a new Preprocessor. @exports Preprocessor @class Provides pre-processing of JavaScript source files, e.g. to build different versions of a library. @param {string} source Source to process @param {string|Object.<string,string>=} baseDirOrIncludes Source base directory used for includes (node.js only) or an o...
[ "Constructs", "a", "new", "Preprocessor", "." ]
3c4c285e335acf096eb3df4beaaa2def6fe135e0
https://github.com/nashdot/Preprocessor.js/blob/3c4c285e335acf096eb3df4beaaa2def6fe135e0/Preprocessor.js#L46-L92
train
bbusschots-mu/validateParams.js
validateParams.js
function(mCons, vCons, k){ var nCons = {}; // the final nested constraints // if there are per-key constraints for k, add them all if(validate.isObject(mCons[k])){ nCons = validateParams.extendObject({}, mCons[k]); } /...
javascript
function(mCons, vCons, k){ var nCons = {}; // the final nested constraints // if there are per-key constraints for k, add them all if(validate.isObject(mCons[k])){ nCons = validateParams.extendObject({}, mCons[k]); } /...
[ "function", "(", "mCons", ",", "vCons", ",", "k", ")", "{", "var", "nCons", "=", "{", "}", ";", "// the final nested constraints", "// if there are per-key constraints for k, add them all", "if", "(", "validate", ".", "isObject", "(", "mCons", "[", "k", "]", ")"...
a private inner function for merging per-key and universal constraints
[ "a", "private", "inner", "function", "for", "merging", "per", "-", "key", "and", "universal", "constraints" ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L613-L633
train
bbusschots-mu/validateParams.js
validateParams.js
function(cName){ if(validate.isEmpty(cName)){ validateParams._warn('ignoring invalid coercion name: ' + cName); } if(validate.isFunction(validateParams.coercions[cName])){ return validateParams.coercions[cName]; }else{ validateParams._warn("no coercion...
javascript
function(cName){ if(validate.isEmpty(cName)){ validateParams._warn('ignoring invalid coercion name: ' + cName); } if(validate.isFunction(validateParams.coercions[cName])){ return validateParams.coercions[cName]; }else{ validateParams._warn("no coercion...
[ "function", "(", "cName", ")", "{", "if", "(", "validate", ".", "isEmpty", "(", "cName", ")", ")", "{", "validateParams", ".", "_warn", "(", "'ignoring invalid coercion name: '", "+", "cName", ")", ";", "}", "if", "(", "validate", ".", "isFunction", "(", ...
make sure there's always an options object local function for resolving coersion names to functions
[ "make", "sure", "there", "s", "always", "an", "options", "object", "local", "function", "for", "resolving", "coersion", "names", "to", "functions" ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L854-L864
train
bbusschots-mu/validateParams.js
validateParams.js
function(value, options){ // make sure the default options object exists if(typeof this.options !== 'object') this.options = {}; // build up a base config from the pre-defined defaults var config = { rejectUndefined: true }; config.message = validateParams.extractValidat...
javascript
function(value, options){ // make sure the default options object exists if(typeof this.options !== 'object') this.options = {}; // build up a base config from the pre-defined defaults var config = { rejectUndefined: true }; config.message = validateParams.extractValidat...
[ "function", "(", "value", ",", "options", ")", "{", "// make sure the default options object exists", "if", "(", "typeof", "this", ".", "options", "!==", "'object'", ")", "this", ".", "options", "=", "{", "}", ";", "// build up a base config from the pre-defined defau...
A validator for rejecting undefined values. Effectively a stricter version of the `presence` validator bundled with validate.js. This validator supports the following options in addition to the standard `message` option: * `rejectUndefined` - a truthy value will reject undefined values, all all other values will accpe...
[ "A", "validator", "for", "rejecting", "undefined", "values", ".", "Effectively", "a", "stricter", "version", "of", "the", "presence", "validator", "bundled", "with", "validate", ".", "js", "." ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L2014-L2044
train
bbusschots-mu/validateParams.js
validateParams.js
function(value, options){ // implicitly pass undefined var valType = typeof value; if(valType === 'undefined') return undefined; // make sure the default options object exists if(typeof this.options !== 'object') this.options = {}; // build up a base con...
javascript
function(value, options){ // implicitly pass undefined var valType = typeof value; if(valType === 'undefined') return undefined; // make sure the default options object exists if(typeof this.options !== 'object') this.options = {}; // build up a base con...
[ "function", "(", "value", ",", "options", ")", "{", "// implicitly pass undefined", "var", "valType", "=", "typeof", "value", ";", "if", "(", "valType", "===", "'undefined'", ")", "return", "undefined", ";", "// make sure the default options object exists", "if", "(...
A validator for filtering values by the result of applying the `typeof` operator to them. This validator supports the following options in addition to the standard `message` option: * `types` - an array of one or more types as strings * `inverseMatch` - a truthy value to invert the search, accepting all types except t...
[ "A", "validator", "for", "filtering", "values", "by", "the", "result", "of", "applying", "the", "typeof", "operator", "to", "them", "." ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L2084-L2153
train
bbusschots-mu/validateParams.js
validateParams.js
function(value, options){ if(!validate.isObject(options)) options = {}; // deal with undefined if(options.ignoreUndefined && typeof value === 'undefined'){ return undefined; } // cast to boolean as appropriate if(options.nativeTruthinessOnly)...
javascript
function(value, options){ if(!validate.isObject(options)) options = {}; // deal with undefined if(options.ignoreUndefined && typeof value === 'undefined'){ return undefined; } // cast to boolean as appropriate if(options.nativeTruthinessOnly)...
[ "function", "(", "value", ",", "options", ")", "{", "if", "(", "!", "validate", ".", "isObject", "(", "options", ")", ")", "options", "=", "{", "}", ";", "// deal with undefined", "if", "(", "options", ".", "ignoreUndefined", "&&", "typeof", "value", "==...
A coercion for converting any arbitrary value to a boolean. By default, and value that is either natively falsey, like `0`, or that's considered empty by the [validate.isEmpty()]{@link external:isEmpty} function from validate.js will be coerced to `false`. Setting the coersion option `nativeTruthinessOnly` to a truthy...
[ "A", "coercion", "for", "converting", "any", "arbitrary", "value", "to", "a", "boolean", "." ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L2604-L2617
train
bbusschots-mu/validateParams.js
validateParams.js
function(value, options){ if(validate.isObject(options) && options.onlyCoercePrimitives && !validateParams.isPrimitive(value)){ return value; } if(validate.isEmpty(value)) return ''; return String(value); }
javascript
function(value, options){ if(validate.isObject(options) && options.onlyCoercePrimitives && !validateParams.isPrimitive(value)){ return value; } if(validate.isEmpty(value)) return ''; return String(value); }
[ "function", "(", "value", ",", "options", ")", "{", "if", "(", "validate", ".", "isObject", "(", "options", ")", "&&", "options", ".", "onlyCoercePrimitives", "&&", "!", "validateParams", ".", "isPrimitive", "(", "value", ")", ")", "{", "return", "value", ...
A coercion for converting any arbitrary value to a string. Empty values, as per the [validate.isEmpty()]{@link external:isEmpty} function from validate.js will be coerced to an empty string, other values will be cast to a string using JavaScript's `String()` function. It's possible to ristrict the coercion to primiti...
[ "A", "coercion", "for", "converting", "any", "arbitrary", "value", "to", "a", "string", "." ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L2634-L2640
train
bbusschots-mu/validateParams.js
validateParams.js
function(value, options){ var typeVal = typeof value; // if we already have a number that's not NaN, return it unaltered if(typeVal === 'number' && !isNaN(value)) return value; // otherwise, try do a conversion var numVal = NaN; if(typeVal === 'string' |...
javascript
function(value, options){ var typeVal = typeof value; // if we already have a number that's not NaN, return it unaltered if(typeVal === 'number' && !isNaN(value)) return value; // otherwise, try do a conversion var numVal = NaN; if(typeVal === 'string' |...
[ "function", "(", "value", ",", "options", ")", "{", "var", "typeVal", "=", "typeof", "value", ";", "// if we already have a number that's not NaN, return it unaltered", "if", "(", "typeVal", "===", "'number'", "&&", "!", "isNaN", "(", "value", ")", ")", "return", ...
A coercion for converting any arbitrary value to a number. If a given value already is a number it is passed un-altered. Otherwise, if it has a `typeof` of `string` or `boolean` an attempt will be made to convert the value to a number with JavaScript's `Number()` function. Other values are converted to `NaN`. If the ...
[ "A", "coercion", "for", "converting", "any", "arbitrary", "value", "to", "a", "number", "." ]
6952ebeaff09892933c4095396dff00595029ab5
https://github.com/bbusschots-mu/validateParams.js/blob/6952ebeaff09892933c4095396dff00595029ab5/validateParams.js#L2657-L2674
train
yefremov/aggregatejs
min.js
min
function min(array) { var length = array.length; if (length === 0) { return 0; } var index = -1; var result = array[++index]; while (++index < length) { if (array[index] < result) { result = array[index]; } } return result; }
javascript
function min(array) { var length = array.length; if (length === 0) { return 0; } var index = -1; var result = array[++index]; while (++index < length) { if (array[index] < result) { result = array[index]; } } return result; }
[ "function", "min", "(", "array", ")", "{", "var", "length", "=", "array", ".", "length", ";", "if", "(", "length", "===", "0", ")", "{", "return", "0", ";", "}", "var", "index", "=", "-", "1", ";", "var", "result", "=", "array", "[", "++", "ind...
Returns the smallest number in `array`. @param {Array} array Range of numbers to get minimum. @return {number} @example min([100, -100, 150, -50, 250, 100]); // => -100
[ "Returns", "the", "smallest", "number", "in", "array", "." ]
932b28a15a5707135e7095950000a838db409511
https://github.com/yefremov/aggregatejs/blob/932b28a15a5707135e7095950000a838db409511/min.js#L19-L36
train
wwwouter/tslint-contrib
noPromiseAsBooleanRule.js
isBooleanBinaryExpression
function isBooleanBinaryExpression(node) { return node.kind === ts.SyntaxKind.BinaryExpression && binaryBooleanExpressionKind(node) !== undefined; }
javascript
function isBooleanBinaryExpression(node) { return node.kind === ts.SyntaxKind.BinaryExpression && binaryBooleanExpressionKind(node) !== undefined; }
[ "function", "isBooleanBinaryExpression", "(", "node", ")", "{", "return", "node", ".", "kind", "===", "ts", ".", "SyntaxKind", ".", "BinaryExpression", "&&", "binaryBooleanExpressionKind", "(", "node", ")", "!==", "undefined", ";", "}" ]
Matches `&&` and `||` operators.
[ "Matches", "&&", "and", "||", "operators", "." ]
fdf83c7e65fcd5dbc5dbe39bb5d081561a339be9
https://github.com/wwwouter/tslint-contrib/blob/fdf83c7e65fcd5dbc5dbe39bb5d081561a339be9/noPromiseAsBooleanRule.js#L85-L87
train
elidoran/node-stating
examples/strings/counter/index.js
prop
function prop(v, w) { return { value: v, writable: w, enumerable: true, configurable: false }}
javascript
function prop(v, w) { return { value: v, writable: w, enumerable: true, configurable: false }}
[ "function", "prop", "(", "v", ",", "w", ")", "{", "return", "{", "value", ":", "v", ",", "writable", ":", "w", ",", "enumerable", ":", "true", ",", "configurable", ":", "false", "}", "}" ]
build an "executor" which will accept strings and use the specified context. the context has a custom `reset` function, and default values for the properties used.
[ "build", "an", "executor", "which", "will", "accept", "strings", "and", "use", "the", "specified", "context", ".", "the", "context", "has", "a", "custom", "reset", "function", "and", "default", "values", "for", "the", "properties", "used", "." ]
557facf637dafb3747183b8f3e165a4e27e045db
https://github.com/elidoran/node-stating/blob/557facf637dafb3747183b8f3e165a4e27e045db/examples/strings/counter/index.js#L75-L77
train
redisjs/jsr-server
lib/command/script/eval.js
execute
function execute(req, res) { ScriptManager.eval(req, res, '' + req.args[0], req.args.slice(1)); }
javascript
function execute(req, res) { ScriptManager.eval(req, res, '' + req.args[0], req.args.slice(1)); }
[ "function", "execute", "(", "req", ",", "res", ")", "{", "ScriptManager", ".", "eval", "(", "req", ",", "res", ",", "''", "+", "req", ".", "args", "[", "0", "]", ",", "req", ".", "args", ".", "slice", "(", "1", ")", ")", ";", "}" ]
Respond to the EVAL command.
[ "Respond", "to", "the", "EVAL", "command", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/script/eval.js#L20-L22
train
vkiding/judpack-lib
src/cordova/metadata/parser.js
Parser
function Parser (platform, projectPath) { this.platform = platform || ''; this.path = projectPath || ''; // Extend with a ParserHelper instance Object.defineProperty(this, 'helper', { value: new ParserHelper(this.platform), enumerable: true, configurable: false, writabl...
javascript
function Parser (platform, projectPath) { this.platform = platform || ''; this.path = projectPath || ''; // Extend with a ParserHelper instance Object.defineProperty(this, 'helper', { value: new ParserHelper(this.platform), enumerable: true, configurable: false, writabl...
[ "function", "Parser", "(", "platform", ",", "projectPath", ")", "{", "this", ".", "platform", "=", "platform", "||", "''", ";", "this", ".", "path", "=", "projectPath", "||", "''", ";", "// Extend with a ParserHelper instance", "Object", ".", "defineProperty", ...
Base module for platform parsers @param {String} [platform] Platform name (e.g. android) @param {String} [projectPath] path/to/platform/project
[ "Base", "module", "for", "platform", "parsers" ]
8657cecfec68221109279106adca8dbc81f430f4
https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/cordova/metadata/parser.js#L32-L45
train
copress/copress-component-oauth2
lib/resource-server.js
authenticate
function authenticate(options) { options = options || {}; var authenticators = [ passport.authenticate(['copress-oauth2-bearer', 'copress-oauth2-mac'], options)]; if (options.scopes || options.scope) { authenticators.push(scopeValidator(options)); ...
javascript
function authenticate(options) { options = options || {}; var authenticators = [ passport.authenticate(['copress-oauth2-bearer', 'copress-oauth2-mac'], options)]; if (options.scopes || options.scope) { authenticators.push(scopeValidator(options)); ...
[ "function", "authenticate", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "authenticators", "=", "[", "passport", ".", "authenticate", "(", "[", "'copress-oauth2-bearer'", ",", "'copress-oauth2-mac'", "]", ",", "options", ")"...
Return the middleware chain to enforce oAuth 2.0 authentication and authorization @param {Object} [options] Options object - scope - jwt
[ "Return", "the", "middleware", "chain", "to", "enforce", "oAuth", "2", ".", "0", "authentication", "and", "authorization" ]
4819f379a0d42753bfd51e237c5c3aaddee37544
https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/resource-server.js#L159-L170
train
joshuamurray/storage.json
lib/Path.js
function( string ){ if( string[ string.length -1 ] !== $this.slash.get()) string = string + $this.slash.get(); return string; }
javascript
function( string ){ if( string[ string.length -1 ] !== $this.slash.get()) string = string + $this.slash.get(); return string; }
[ "function", "(", "string", ")", "{", "if", "(", "string", "[", "string", ".", "length", "-", "1", "]", "!==", "$this", ".", "slash", ".", "get", "(", ")", ")", "string", "=", "string", "+", "$this", ".", "slash", ".", "get", "(", ")", ";", "ret...
Adds the value of "slash.string" to the end of the provided string, unless the last character is already the value of "slash.string". @param {string} string @returns {string}
[ "Adds", "the", "value", "of", "slash", ".", "string", "to", "the", "end", "of", "the", "provided", "string", "unless", "the", "last", "character", "is", "already", "the", "value", "of", "slash", ".", "string", "." ]
9ed7ecbb6882e14be31635facba2b80f89456531
https://github.com/joshuamurray/storage.json/blob/9ed7ecbb6882e14be31635facba2b80f89456531/lib/Path.js#L72-L76
train
joshuamurray/storage.json
lib/Path.js
function( string ){ string = $this.slash.clean( string ); if( string[ 0 ] === $this.slash.get()) string = string.substr( 1 ); if( string[ string.length -1 ] === $this.slash.get()) string = string.substr( 0, string.length -1 ); return string; }
javascript
function( string ){ string = $this.slash.clean( string ); if( string[ 0 ] === $this.slash.get()) string = string.substr( 1 ); if( string[ string.length -1 ] === $this.slash.get()) string = string.substr( 0, string.length -1 ); return string; }
[ "function", "(", "string", ")", "{", "string", "=", "$this", ".", "slash", ".", "clean", "(", "string", ")", ";", "if", "(", "string", "[", "0", "]", "===", "$this", ".", "slash", ".", "get", "(", ")", ")", "string", "=", "string", ".", "substr",...
Removes the value of "slash.string" from the start AND end of the provided string, unless the first AND last characters do not match the value of "slash.string". @param {string} string @returns {string}
[ "Removes", "the", "value", "of", "slash", ".", "string", "from", "the", "start", "AND", "end", "of", "the", "provided", "string", "unless", "the", "first", "AND", "last", "characters", "do", "not", "match", "the", "value", "of", "slash", ".", "string", "...
9ed7ecbb6882e14be31635facba2b80f89456531
https://github.com/joshuamurray/storage.json/blob/9ed7ecbb6882e14be31635facba2b80f89456531/lib/Path.js#L94-L101
train
taoyuan/path-rewriter
lib/rewriter.js
to_map
function to_map(params) { var map = {}; params.forEach(function (param, i) { param.index = i; map[param.name] = param; }); map.length = params.length; return map; }
javascript
function to_map(params) { var map = {}; params.forEach(function (param, i) { param.index = i; map[param.name] = param; }); map.length = params.length; return map; }
[ "function", "to_map", "(", "params", ")", "{", "var", "map", "=", "{", "}", ";", "params", ".", "forEach", "(", "function", "(", "param", ",", "i", ")", "{", "param", ".", "index", "=", "i", ";", "map", "[", "param", ".", "name", "]", "=", "par...
Turn params array into a map for quick lookup. @param {Array} params @return {Object} @api private
[ "Turn", "params", "array", "into", "a", "map", "for", "quick", "lookup", "." ]
8dc82918e09af399006f8d6b0158399414470032
https://github.com/taoyuan/path-rewriter/blob/8dc82918e09af399006f8d6b0158399414470032/lib/rewriter.js#L140-L151
train
dalekjs/dalek-driver-sauce
lib/commands/element.js
function (selector, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this._existsCb.bind(this, selector, hash)); return this; }
javascript
function (selector, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this._existsCb.bind(this, selector, hash)); return this; }
[ "function", "(", "selector", ",", "hash", ")", "{", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "element", ".", "bind", "(", "this", ".", "webdriverClient", ",", "selector", ")", ")", ";", "this", ".", "actionQueue"...
Checks if an element exists @method exists @param {string} selector Selector expression to find the element @param {string} hash Unique hash of that fn call @chainable
[ "Checks", "if", "an", "element", "exists" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L49-L53
train
dalekjs/dalek-driver-sauce
lib/commands/element.js
function (selector, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.displayed.bind(this.webdriverClient, selector)); this.actionQueue.push(this._visibleCb.bind(this, selector, hash)); return this; }
javascript
function (selector, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.displayed.bind(this.webdriverClient, selector)); this.actionQueue.push(this._visibleCb.bind(this, selector, hash)); return this; }
[ "function", "(", "selector", ",", "hash", ")", "{", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "element", ".", "bind", "(", "this", ".", "webdriverClient", ",", "selector", ")", ")", ";", "this", ".", "actionQueue"...
Checks if an element is visible @method visible @param {string} selector Selector expression to find the element @param {string} hash Unique hash of that fn call @chainable
[ "Checks", "if", "an", "element", "is", "visible" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L82-L87
train
dalekjs/dalek-driver-sauce
lib/commands/element.js
function (selector, expected, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.text.bind(this.webdriverClient, selector)); this.actionQueue.push(this._textCb.bind(this, selector, hash, expected)); return this; ...
javascript
function (selector, expected, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.text.bind(this.webdriverClient, selector)); this.actionQueue.push(this._textCb.bind(this, selector, hash, expected)); return this; ...
[ "function", "(", "selector", ",", "expected", ",", "hash", ")", "{", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "element", ".", "bind", "(", "this", ".", "webdriverClient", ",", "selector", ")", ")", ";", "this", ...
Checks if an element has the expected text @method text @param {string} selector Selector expression to find the element @param {string} expected The expected text content @param {string} hash Unique hash of that fn call @chainable
[ "Checks", "if", "an", "element", "has", "the", "expected", "text" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L117-L122
train
dalekjs/dalek-driver-sauce
lib/commands/element.js
function (selector, expected, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.size.bind(this.webdriverClient)); this.actionQueue.push(this._widthCb.bind(this, selector, hash, expected)); return this; }
javascript
function (selector, expected, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.size.bind(this.webdriverClient)); this.actionQueue.push(this._widthCb.bind(this, selector, hash, expected)); return this; }
[ "function", "(", "selector", ",", "expected", ",", "hash", ")", "{", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "element", ".", "bind", "(", "this", ".", "webdriverClient", ",", "selector", ")", ")", ";", "this", ...
Checks th width of an element @method width @param {string} selector Selector expression to find the element @param {string} expected The expected width value @param {string} hash Unique hash of that fn call @chainable
[ "Checks", "th", "width", "of", "an", "element" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L191-L196
train
dalekjs/dalek-driver-sauce
lib/commands/element.js
function (selector, attribute, expected, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.getAttribute.bind(this.webdriverClient, attribute)); this.actionQueue.push(this._attributeCb.bind(this, selector, hash, attrib...
javascript
function (selector, attribute, expected, hash) { this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector)); this.actionQueue.push(this.webdriverClient.getAttribute.bind(this.webdriverClient, attribute)); this.actionQueue.push(this._attributeCb.bind(this, selector, hash, attrib...
[ "function", "(", "selector", ",", "attribute", ",", "expected", ",", "hash", ")", "{", "this", ".", "actionQueue", ".", "push", "(", "this", ".", "webdriverClient", ".", "element", ".", "bind", "(", "this", ".", "webdriverClient", ",", "selector", ")", "...
Checks if an element has an attribute with the expected value @method attribute @param {string} selector Selector expression to find the element @param {string} attribute The attribute that should be checked @param {string} expected The expected text content @param {string} hash Unique hash of that fn call @chainable
[ "Checks", "if", "an", "element", "has", "an", "attribute", "with", "the", "expected", "value" ]
4b3ef87a0c35a91db8456d074b0d47a3e0df58f7
https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L264-L269
train