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
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
inclination
function inclination( vector ) { return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); }
javascript
function inclination( vector ) { return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); }
[ "function", "inclination", "(", "vector", ")", "{", "return", "Math", ".", "atan2", "(", "-", "vector", ".", "y", ",", "Math", ".", "sqrt", "(", "(", "vector", ".", "x", "*", "vector", ".", "x", ")", "+", "(", "vector", ".", "z", "*", "vector", ...
Angle above the XZ plane.
[ "Angle", "above", "the", "XZ", "plane", "." ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L39864-L39868
train
AlloyTeam/AlloyTouch
select/index.js
_mergeListInfo
function _mergeListInfo(list) { var arr = []; var info = {}; for(var i=0,len=list.length; i<len; i++) { arr.push('<li data-value="'+list[i].value+'">' + list[i].name + '</li>'); info[i] = list[i].list ? _mergeListInfo(list[i].list) : {length: 0}...
javascript
function _mergeListInfo(list) { var arr = []; var info = {}; for(var i=0,len=list.length; i<len; i++) { arr.push('<li data-value="'+list[i].value+'">' + list[i].name + '</li>'); info[i] = list[i].list ? _mergeListInfo(list[i].list) : {length: 0}...
[ "function", "_mergeListInfo", "(", "list", ")", "{", "var", "arr", "=", "[", "]", ";", "var", "info", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "list", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "...
merge options list
[ "merge", "options", "list" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/select/index.js#L31-L43
train
socketio/socket.io-redis
index.js
Redis
function Redis(nsp){ Adapter.call(this, nsp); this.uid = uid; this.prefix = prefix; this.requestsTimeout = requestsTimeout; this.channel = prefix + '#' + nsp.name + '#'; this.requestChannel = prefix + '-request#' + this.nsp.name + '#'; this.responseChannel = prefix + '-response#' + this.ns...
javascript
function Redis(nsp){ Adapter.call(this, nsp); this.uid = uid; this.prefix = prefix; this.requestsTimeout = requestsTimeout; this.channel = prefix + '#' + nsp.name + '#'; this.requestChannel = prefix + '-request#' + this.nsp.name + '#'; this.responseChannel = prefix + '-response#' + this.ns...
[ "function", "Redis", "(", "nsp", ")", "{", "Adapter", ".", "call", "(", "this", ",", "nsp", ")", ";", "this", ".", "uid", "=", "uid", ";", "this", ".", "prefix", "=", "prefix", ";", "this", ".", "requestsTimeout", "=", "requestsTimeout", ";", "this",...
Adapter constructor. @param {String} namespace name @api public
[ "Adapter", "constructor", "." ]
a1cebc8649584fa08eb1e0b933f9eca980d23ea5
https://github.com/socketio/socket.io-redis/blob/a1cebc8649584fa08eb1e0b933f9eca980d23ea5/index.js#L78-L122
train
casperjs/casperjs
modules/colorizer.js
Dummy
function Dummy() { "use strict"; this.colorize = function colorize(text, styleName, pad) { return text; }; this.format = function format(text, style, pad){ return text; }; }
javascript
function Dummy() { "use strict"; this.colorize = function colorize(text, styleName, pad) { return text; }; this.format = function format(text, style, pad){ return text; }; }
[ "function", "Dummy", "(", ")", "{", "\"use strict\"", ";", "this", ".", "colorize", "=", "function", "colorize", "(", "text", ",", "styleName", ",", "pad", ")", "{", "return", "text", ";", "}", ";", "this", ".", "format", "=", "function", "format", "("...
Dummy colorizer. Does basically nothing.
[ "Dummy", "colorizer", ".", "Does", "basically", "nothing", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/colorizer.js#L126-L134
train
casperjs/casperjs
modules/xunit.js
generateClassName
function generateClassName(classname) { "use strict"; classname = (classname || "").replace(phantom.casperPath, "").trim(); var script = classname || phantom.casperScript || ""; if (script.indexOf(fs.workingDirectory) === 0) { script = script.substring(fs.workingDirectory.length + 1); } ...
javascript
function generateClassName(classname) { "use strict"; classname = (classname || "").replace(phantom.casperPath, "").trim(); var script = classname || phantom.casperScript || ""; if (script.indexOf(fs.workingDirectory) === 0) { script = script.substring(fs.workingDirectory.length + 1); } ...
[ "function", "generateClassName", "(", "classname", ")", "{", "\"use strict\"", ";", "classname", "=", "(", "classname", "||", "\"\"", ")", ".", "replace", "(", "phantom", ".", "casperPath", ",", "\"\"", ")", ".", "trim", "(", ")", ";", "var", "script", "...
Generates a value for 'classname' attribute of the JUnit XML report. Uses the (relative) file name of the current casper script without file extension as classname. @param String classname @return String
[ "Generates", "a", "value", "for", "classname", "attribute", "of", "the", "JUnit", "XML", "report", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/xunit.js#L47-L65
train
casperjs/casperjs
bin/bootstrap.js
printHelp
function printHelp() { /* global slimer */ var engine = phantom.casperEngine === 'slimerjs' ? slimer : phantom; var version = [engine.version.major, engine.version.minor, engine.version.patch].join('.'); return __terminate([ 'CasperJS version ' + phantom.casperVersion.toStrin...
javascript
function printHelp() { /* global slimer */ var engine = phantom.casperEngine === 'slimerjs' ? slimer : phantom; var version = [engine.version.major, engine.version.minor, engine.version.patch].join('.'); return __terminate([ 'CasperJS version ' + phantom.casperVersion.toStrin...
[ "function", "printHelp", "(", ")", "{", "/* global slimer */", "var", "engine", "=", "phantom", ".", "casperEngine", "===", "'slimerjs'", "?", "slimer", ":", "phantom", ";", "var", "version", "=", "[", "engine", ".", "version", ".", "major", ",", "engine", ...
Prints CasperJS help.
[ "Prints", "CasperJS", "help", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/bin/bootstrap.js#L213-L222
train
casperjs/casperjs
samples/dynamic.js
check
function check() { if (links[currentLink] && currentLink < upTo) { this.echo('--- Link ' + currentLink + ' ---'); start.call(this, links[currentLink]); addLinks.call(this, links[currentLink]); currentLink++; this.run(check); } else { this.echo("All done."); ...
javascript
function check() { if (links[currentLink] && currentLink < upTo) { this.echo('--- Link ' + currentLink + ' ---'); start.call(this, links[currentLink]); addLinks.call(this, links[currentLink]); currentLink++; this.run(check); } else { this.echo("All done."); ...
[ "function", "check", "(", ")", "{", "if", "(", "links", "[", "currentLink", "]", "&&", "currentLink", "<", "upTo", ")", "{", "this", ".", "echo", "(", "'--- Link '", "+", "currentLink", "+", "' ---'", ")", ";", "start", ".", "call", "(", "this", ",",...
As long as it has a next link, and is under the maximum limit, will keep running
[ "As", "long", "as", "it", "has", "a", "next", "link", "and", "is", "under", "the", "maximum", "limit", "will", "keep", "running" ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/samples/dynamic.js#L51-L62
train
casperjs/casperjs
modules/cli.js
castArgument
function castArgument(arg) { "use strict"; if (arg.match(/^-?\d+$/)) { return parseInt(arg, 10); } else if (arg.match(/^-?\d+\.\d+$/)) { return parseFloat(arg); } else if (arg.match(/^(true|false)$/i)) { return arg.trim().toLowerCase() === "true" ? true : false; } else { ...
javascript
function castArgument(arg) { "use strict"; if (arg.match(/^-?\d+$/)) { return parseInt(arg, 10); } else if (arg.match(/^-?\d+\.\d+$/)) { return parseFloat(arg); } else if (arg.match(/^(true|false)$/i)) { return arg.trim().toLowerCase() === "true" ? true : false; } else { ...
[ "function", "castArgument", "(", "arg", ")", "{", "\"use strict\"", ";", "if", "(", "arg", ".", "match", "(", "/", "^-?\\d+$", "/", ")", ")", "{", "return", "parseInt", "(", "arg", ",", "10", ")", ";", "}", "else", "if", "(", "arg", ".", "match", ...
Cast a string argument to its typed equivalent. @param String arg @return Mixed
[ "Cast", "a", "string", "argument", "to", "its", "typed", "equivalent", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/cli.js#L138-L149
train
casperjs/casperjs
modules/utils.js
betterTypeOf
function betterTypeOf(input) { "use strict"; switch (input) { case undefined: return 'undefined'; case null: return 'null'; default: try { var type = Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase(); ...
javascript
function betterTypeOf(input) { "use strict"; switch (input) { case undefined: return 'undefined'; case null: return 'null'; default: try { var type = Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase(); ...
[ "function", "betterTypeOf", "(", "input", ")", "{", "\"use strict\"", ";", "switch", "(", "input", ")", "{", "case", "undefined", ":", "return", "'undefined'", ";", "case", "null", ":", "return", "'null'", ";", "default", ":", "try", "{", "var", "type", ...
Provides a better typeof operator equivalent, able to retrieve the array type. CAVEAT: this function does not necessarilly map to classical js "type" names, notably a `null` will map to "null" instead of "object". @param mixed input @return String @see http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-...
[ "Provides", "a", "better", "typeof", "operator", "equivalent", "able", "to", "retrieve", "the", "array", "type", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L45-L69
train
casperjs/casperjs
modules/utils.js
betterInstanceOf
function betterInstanceOf(input, constructor) { "use strict"; /*eslint eqeqeq:0 */ if (typeof input == 'undefined' || input == null) { return false; } var inputToTest = input; while (inputToTest != null) { if (inputToTest == constructor.prototype) { return true; } ...
javascript
function betterInstanceOf(input, constructor) { "use strict"; /*eslint eqeqeq:0 */ if (typeof input == 'undefined' || input == null) { return false; } var inputToTest = input; while (inputToTest != null) { if (inputToTest == constructor.prototype) { return true; } ...
[ "function", "betterInstanceOf", "(", "input", ",", "constructor", ")", "{", "\"use strict\"", ";", "/*eslint eqeqeq:0 */", "if", "(", "typeof", "input", "==", "'undefined'", "||", "input", "==", "null", ")", "{", "return", "false", ";", "}", "var", "inputToTes...
Provides a better instanceof operator, capable of checking against the full object prototype hierarchy. @param mixed input @param function constructor @return String @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model
[ "Provides", "a", "better", "instanceof", "operator", "capable", "of", "checking", "against", "the", "full", "object", "prototype", "hierarchy", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L80-L100
train
casperjs/casperjs
modules/utils.js
cleanUrl
function cleanUrl(url) { "use strict"; if (url.toLowerCase().indexOf('http') !== 0) { return url; } var a = document.createElement('a'); a.href = url; return a.href; }
javascript
function cleanUrl(url) { "use strict"; if (url.toLowerCase().indexOf('http') !== 0) { return url; } var a = document.createElement('a'); a.href = url; return a.href; }
[ "function", "cleanUrl", "(", "url", ")", "{", "\"use strict\"", ";", "if", "(", "url", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "'http'", ")", "!==", "0", ")", "{", "return", "url", ";", "}", "var", "a", "=", "document", ".", "createElement...
Cleans a passed URL. @param String url An HTTP URL @return String
[ "Cleans", "a", "passed", "URL", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L109-L117
train
casperjs/casperjs
modules/utils.js
computeModifier
function computeModifier(modifierString, modifiers) { "use strict"; var modifier = 0, checkKey = function(key) { if (key in modifiers) return; throw new CasperError(format('%s is not a supported key modifier', key)); }; if (!modifierString) return modifier; var ke...
javascript
function computeModifier(modifierString, modifiers) { "use strict"; var modifier = 0, checkKey = function(key) { if (key in modifiers) return; throw new CasperError(format('%s is not a supported key modifier', key)); }; if (!modifierString) return modifier; var ke...
[ "function", "computeModifier", "(", "modifierString", ",", "modifiers", ")", "{", "\"use strict\"", ";", "var", "modifier", "=", "0", ",", "checkKey", "=", "function", "(", "key", ")", "{", "if", "(", "key", "in", "modifiers", ")", "return", ";", "throw", ...
Computes a modifier string to its PhantomJS equivalent. A modifier string is in the form "ctrl+alt+shift". @param String modifierString Modifier string, eg. "ctrl+alt+shift" @param Object modifiers Modifiers definitions @return Number
[ "Computes", "a", "modifier", "string", "to", "its", "PhantomJS", "equivalent", ".", "A", "modifier", "string", "is", "in", "the", "form", "ctrl", "+", "alt", "+", "shift", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L140-L153
train
casperjs/casperjs
modules/utils.js
equals
function equals(v1, v2) { "use strict"; if (isFunction(v1)) { return v1.toString() === v2.toString(); } // with Gecko, instanceof is not enough to test object if (v1 instanceof Object || isObject(v1)) { if (!(v2 instanceof Object || isObject(v2)) || Object.keys(v1).length...
javascript
function equals(v1, v2) { "use strict"; if (isFunction(v1)) { return v1.toString() === v2.toString(); } // with Gecko, instanceof is not enough to test object if (v1 instanceof Object || isObject(v1)) { if (!(v2 instanceof Object || isObject(v2)) || Object.keys(v1).length...
[ "function", "equals", "(", "v1", ",", "v2", ")", "{", "\"use strict\"", ";", "if", "(", "isFunction", "(", "v1", ")", ")", "{", "return", "v1", ".", "toString", "(", ")", "===", "v2", ".", "toString", "(", ")", ";", "}", "// with Gecko, instanceof is n...
Tests equality between the two passed arguments. @param Mixed v1 @param Mixed v2 @param Boolean
[ "Tests", "equality", "between", "the", "two", "passed", "arguments", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L191-L210
train
casperjs/casperjs
modules/utils.js
fillBlanks
function fillBlanks(text, pad) { "use strict"; pad = pad || 80; if (text.length < pad) { text += new Array(pad - text.length + 1).join(' '); } return text; }
javascript
function fillBlanks(text, pad) { "use strict"; pad = pad || 80; if (text.length < pad) { text += new Array(pad - text.length + 1).join(' '); } return text; }
[ "function", "fillBlanks", "(", "text", ",", "pad", ")", "{", "\"use strict\"", ";", "pad", "=", "pad", "||", "80", ";", "if", "(", "text", ".", "length", "<", "pad", ")", "{", "text", "+=", "new", "Array", "(", "pad", "-", "text", ".", "length", ...
Takes a string and append blanks until the pad value is reached. @param String text @param Number pad Pad value (optional; default: 80) @return String
[ "Takes", "a", "string", "and", "append", "blanks", "until", "the", "pad", "value", "is", "reached", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L236-L243
train
casperjs/casperjs
modules/utils.js
getPropertyPath
function getPropertyPath(obj, path) { "use strict"; if (!isObject(obj) || !isString(path)) { return undefined; } var value = obj; path.split('.').forEach(function(property) { if (typeof value === "object" && property in value) { value = value[property]; } else { ...
javascript
function getPropertyPath(obj, path) { "use strict"; if (!isObject(obj) || !isString(path)) { return undefined; } var value = obj; path.split('.').forEach(function(property) { if (typeof value === "object" && property in value) { value = value[property]; } else { ...
[ "function", "getPropertyPath", "(", "obj", ",", "path", ")", "{", "\"use strict\"", ";", "if", "(", "!", "isObject", "(", "obj", ")", "||", "!", "isString", "(", "path", ")", ")", "{", "return", "undefined", ";", "}", "var", "value", "=", "obj", ";",...
Retrieves the value of an Object foreign property using a dot-separated path string. Beware, this function doesn't handle object key names containing a dot. @param Object obj The source object @param String path Dot separated path, eg. "x.y.z"
[ "Retrieves", "the", "value", "of", "an", "Object", "foreign", "property", "using", "a", "dot", "-", "separated", "path", "string", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L328-L342
train
casperjs/casperjs
modules/utils.js
indent
function indent(string, nchars, prefix) { "use strict"; return string.split('\n').map(function(line) { return (prefix || '') + new Array(nchars).join(' ') + line; }).join('\n'); }
javascript
function indent(string, nchars, prefix) { "use strict"; return string.split('\n').map(function(line) { return (prefix || '') + new Array(nchars).join(' ') + line; }).join('\n'); }
[ "function", "indent", "(", "string", ",", "nchars", ",", "prefix", ")", "{", "\"use strict\"", ";", "return", "string", ".", "split", "(", "'\\n'", ")", ".", "map", "(", "function", "(", "line", ")", "{", "return", "(", "prefix", "||", "''", ")", "+"...
Indents a string. @param String string @param Number nchars @param String prefix @return String
[ "Indents", "a", "string", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L353-L358
train
casperjs/casperjs
modules/utils.js
isClipRect
function isClipRect(value) { "use strict"; return isType(value, "cliprect") || ( isObject(value) && isNumber(value.top) && isNumber(value.left) && isNumber(value.width) && isNumber(value.height) ); }
javascript
function isClipRect(value) { "use strict"; return isType(value, "cliprect") || ( isObject(value) && isNumber(value.top) && isNumber(value.left) && isNumber(value.width) && isNumber(value.height) ); }
[ "function", "isClipRect", "(", "value", ")", "{", "\"use strict\"", ";", "return", "isType", "(", "value", ",", "\"cliprect\"", ")", "||", "(", "isObject", "(", "value", ")", "&&", "isNumber", "(", "value", ".", "top", ")", "&&", "isNumber", "(", "value"...
Checks if value is a phantomjs clipRect-compatible object @param mixed value @return Boolean
[ "Checks", "if", "value", "is", "a", "phantomjs", "clipRect", "-", "compatible", "object" ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L412-L419
train
casperjs/casperjs
modules/utils.js
isType
function isType(what, typeName) { "use strict"; if (typeof typeName !== "string" || !typeName) { throw new CasperError("You must pass isType() a typeName string"); } return betterTypeOf(what).toLowerCase() === typeName.toLowerCase(); }
javascript
function isType(what, typeName) { "use strict"; if (typeof typeName !== "string" || !typeName) { throw new CasperError("You must pass isType() a typeName string"); } return betterTypeOf(what).toLowerCase() === typeName.toLowerCase(); }
[ "function", "isType", "(", "what", ",", "typeName", ")", "{", "\"use strict\"", ";", "if", "(", "typeof", "typeName", "!==", "\"string\"", "||", "!", "typeName", ")", "{", "throw", "new", "CasperError", "(", "\"You must pass isType() a typeName string\"", ")", "...
Shorthands for checking if a value is of the given type. Can check for arrays. @param mixed what The value to check @param String typeName The type name ("string", "number", "function", etc.) @return Boolean
[ "Shorthands", "for", "checking", "if", "a", "value", "is", "of", "the", "given", "type", ".", "Can", "check", "for", "arrays", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L557-L563
train
casperjs/casperjs
modules/utils.js
isValidSelector
function isValidSelector(value) { "use strict"; if (isString(value)) { try { // phantomjs env has a working document object, let's use it document.querySelector(value); } catch(e) { if ('name' in e && (e.name === 'SYNTAX_ERR' || e.name === 'SyntaxError')) { ...
javascript
function isValidSelector(value) { "use strict"; if (isString(value)) { try { // phantomjs env has a working document object, let's use it document.querySelector(value); } catch(e) { if ('name' in e && (e.name === 'SYNTAX_ERR' || e.name === 'SyntaxError')) { ...
[ "function", "isValidSelector", "(", "value", ")", "{", "\"use strict\"", ";", "if", "(", "isString", "(", "value", ")", ")", "{", "try", "{", "// phantomjs env has a working document object, let's use it", "document", ".", "querySelector", "(", "value", ")", ";", ...
Checks if value is a valid selector Object. @param mixed value @return Boolean
[ "Checks", "if", "value", "is", "a", "valid", "selector", "Object", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L583-L608
train
casperjs/casperjs
modules/utils.js
mergeObjectsInGecko
function mergeObjectsInGecko(origin, add, opts) { "use strict"; var options = opts || {}, keepReferences = options.keepReferences; for (var p in add) { if (isPlainObject(add[p])) { if (isPlainObject(origin[p])) { origin[p] = mergeObjects(origin[p], add[p]); ...
javascript
function mergeObjectsInGecko(origin, add, opts) { "use strict"; var options = opts || {}, keepReferences = options.keepReferences; for (var p in add) { if (isPlainObject(add[p])) { if (isPlainObject(origin[p])) { origin[p] = mergeObjects(origin[p], add[p]); ...
[ "function", "mergeObjectsInGecko", "(", "origin", ",", "add", ",", "opts", ")", "{", "\"use strict\"", ";", "var", "options", "=", "opts", "||", "{", "}", ",", "keepReferences", "=", "options", ".", "keepReferences", ";", "for", "(", "var", "p", "in", "a...
Object recursive merging utility for use in the SlimerJS environment @param Object origin the origin object @param Object add the object to merge data into origin @param Object opts optional options to be passed in @return Object
[ "Object", "recursive", "merging", "utility", "for", "use", "in", "the", "SlimerJS", "environment" ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L641-L670
train
casperjs/casperjs
modules/utils.js
serialize
function serialize(value, indent) { "use strict"; if (isArray(value)) { value = value.map(function _map(prop) { return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop; }); } return JSON.stringify(value, null, indent); }
javascript
function serialize(value, indent) { "use strict"; if (isArray(value)) { value = value.map(function _map(prop) { return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop; }); } return JSON.stringify(value, null, indent); }
[ "function", "serialize", "(", "value", ",", "indent", ")", "{", "\"use strict\"", ";", "if", "(", "isArray", "(", "value", ")", ")", "{", "value", "=", "value", ".", "map", "(", "function", "_map", "(", "prop", ")", "{", "return", "isFunction", "(", ...
Serializes a value using JSON. @param Mixed value @return String
[ "Serializes", "a", "value", "using", "JSON", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L776-L784
train
casperjs/casperjs
modules/utils.js
unique
function unique(array) { "use strict"; var o = {}, r = []; for (var i = 0, len = array.length; i !== len; i++) { var d = array[i]; if (typeof o[d] === "undefined") { o[d] = 1; r[r.length] = d; } } return r; }
javascript
function unique(array) { "use strict"; var o = {}, r = []; for (var i = 0, len = array.length; i !== len; i++) { var d = array[i]; if (typeof o[d] === "undefined") { o[d] = 1; r[r.length] = d; } } return r; }
[ "function", "unique", "(", "array", ")", "{", "\"use strict\"", ";", "var", "o", "=", "{", "}", ",", "r", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "array", ".", "length", ";", "i", "!==", "len", ";", "i", "++", ...
Returns unique values from an array. Note: ugly code is ugly, but efficient: http://jsperf.com/array-unique2/8 @param Array array @return Array
[ "Returns", "unique", "values", "from", "an", "array", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L795-L807
train
casperjs/casperjs
modules/utils.js
versionToString
function versionToString(version) { if (isObject(version)) { try { return [version.major, version.minor, version.patch].join('.'); } catch (e) {} } return version; }
javascript
function versionToString(version) { if (isObject(version)) { try { return [version.major, version.minor, version.patch].join('.'); } catch (e) {} } return version; }
[ "function", "versionToString", "(", "version", ")", "{", "if", "(", "isObject", "(", "version", ")", ")", "{", "try", "{", "return", "[", "version", ".", "major", ",", "version", ".", "minor", ",", "version", ".", "patch", "]", ".", "join", "(", "'.'...
Convert a version object to a string. @param Mixed version a version string or object
[ "Convert", "a", "version", "object", "to", "a", "string", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L815-L822
train
casperjs/casperjs
modules/utils.js
matchEngine
function matchEngine(matchSpec) { if (Array !== matchSpec.constructor) { matchSpec = [matchSpec]; } var idx; var len = matchSpec.length; var engineName = phantom.casperEngine; var engineVersion = phantom.version; for (idx = 0; idx < len; ++idx) { var match = matchSpec[idx];...
javascript
function matchEngine(matchSpec) { if (Array !== matchSpec.constructor) { matchSpec = [matchSpec]; } var idx; var len = matchSpec.length; var engineName = phantom.casperEngine; var engineVersion = phantom.version; for (idx = 0; idx < len; ++idx) { var match = matchSpec[idx];...
[ "function", "matchEngine", "(", "matchSpec", ")", "{", "if", "(", "Array", "!==", "matchSpec", ".", "constructor", ")", "{", "matchSpec", "=", "[", "matchSpec", "]", ";", "}", "var", "idx", ";", "var", "len", "=", "matchSpec", ".", "length", ";", "var"...
Checks if the engine matches a specifier. A match specifier is an object of the form: { name: 'casperjs' | 'phantomjs', version: { min: Object, max: Object }, message: String } Minimal and maximal versions to be matched are determined using utils.cmpVersion. @param Mixed matchSpec a single match specifier o...
[ "Checks", "if", "the", "engine", "matches", "a", "specifier", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L896-L925
train
node-cron/node-cron
src/node-cron.js
schedule
function schedule(expression, func, options) { let task = createTask(expression, func, options); storage.save(task); return task; }
javascript
function schedule(expression, func, options) { let task = createTask(expression, func, options); storage.save(task); return task; }
[ "function", "schedule", "(", "expression", ",", "func", ",", "options", ")", "{", "let", "task", "=", "createTask", "(", "expression", ",", "func", ",", "options", ")", ";", "storage", ".", "save", "(", "task", ")", ";", "return", "task", ";", "}" ]
Creates a new task to execute given function when the cron expression ticks. @param {string} expression - cron expression. @param {Function} func - task to be executed. @param {Object} options - a set of options for the scheduled task: - scheduled <boolean>: if a schaduled task is ready and running to be performed whe...
[ "Creates", "a", "new", "task", "to", "execute", "given", "function", "when", "the", "cron", "expression", "ticks", "." ]
2a3970390b8dffa20b0a1bbf5ba2f71e8b4405d2
https://github.com/node-cron/node-cron/blob/2a3970390b8dffa20b0a1bbf5ba2f71e8b4405d2/src/node-cron.js#L29-L33
train
fengyuanchen/viewer
dist/viewer.common.js
getImageNaturalSizes
function getImageNaturalSizes(image, callback) { var newImage = document.createElement('img'); // Modern browsers (except Safari) if (image.naturalWidth && !IS_SAFARI) { callback(image.naturalWidth, image.naturalHeight); return newImage; } var body = document.body || document.documentElement; new...
javascript
function getImageNaturalSizes(image, callback) { var newImage = document.createElement('img'); // Modern browsers (except Safari) if (image.naturalWidth && !IS_SAFARI) { callback(image.naturalWidth, image.naturalHeight); return newImage; } var body = document.body || document.documentElement; new...
[ "function", "getImageNaturalSizes", "(", "image", ",", "callback", ")", "{", "var", "newImage", "=", "document", ".", "createElement", "(", "'img'", ")", ";", "// Modern browsers (except Safari)", "if", "(", "image", ".", "naturalWidth", "&&", "!", "IS_SAFARI", ...
Get an image's natural sizes. @param {string} image - The target image. @param {Function} callback - The callback function. @returns {HTMLImageElement} The new image.
[ "Get", "an", "image", "s", "natural", "sizes", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L713-L742
train
fengyuanchen/viewer
dist/viewer.common.js
onViewed
function onViewed() { var imageData = _this.imageData; title.textContent = alt + ' (' + imageData.naturalWidth + ' \xD7 ' + imageData.naturalHeight + ')'; }
javascript
function onViewed() { var imageData = _this.imageData; title.textContent = alt + ' (' + imageData.naturalWidth + ' \xD7 ' + imageData.naturalHeight + ')'; }
[ "function", "onViewed", "(", ")", "{", "var", "imageData", "=", "_this", ".", "imageData", ";", "title", ".", "textContent", "=", "alt", "+", "' ('", "+", "imageData", ".", "naturalWidth", "+", "' \\xD7 '", "+", "imageData", ".", "naturalHeight", "+", "')'...
Generate title after viewed
[ "Generate", "title", "after", "viewed" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1724-L1729
train
fengyuanchen/viewer
dist/viewer.common.js
prev
function prev() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var index = this.index - 1; if (index < 0) { index = loop ? this.length - 1 : 0; } this.view(index); return this; }
javascript
function prev() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var index = this.index - 1; if (index < 0) { index = loop ? this.length - 1 : 0; } this.view(index); return this; }
[ "function", "prev", "(", ")", "{", "var", "loop", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "false", ";", "var", "index", "=", "this", ".", "index", "-", ...
View the previous image @param {boolean} [loop=false] - Indicate if view the last one when it is the first one at present. @returns {Viewer} this
[ "View", "the", "previous", "image" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1784-L1795
train
fengyuanchen/viewer
dist/viewer.common.js
next
function next() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var maxIndex = this.length - 1; var index = this.index + 1; if (index > maxIndex) { index = loop ? 0 : maxIndex; } this.view(index); return this; }
javascript
function next() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var maxIndex = this.length - 1; var index = this.index + 1; if (index > maxIndex) { index = loop ? 0 : maxIndex; } this.view(index); return this; }
[ "function", "next", "(", ")", "{", "var", "loop", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "false", ";", "var", "maxIndex", "=", "this", ".", "length", "-...
View the next image @param {boolean} [loop=false] - Indicate if view the first one when it is the last one at present. @returns {Viewer} this
[ "View", "the", "next", "image" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1804-L1816
train
fengyuanchen/viewer
dist/viewer.common.js
move
function move(offsetX, offsetY) { var imageData = this.imageData; this.moveTo(isUndefined(offsetX) ? offsetX : imageData.left + Number(offsetX), isUndefined(offsetY) ? offsetY : imageData.top + Number(offsetY)); return this; }
javascript
function move(offsetX, offsetY) { var imageData = this.imageData; this.moveTo(isUndefined(offsetX) ? offsetX : imageData.left + Number(offsetX), isUndefined(offsetY) ? offsetY : imageData.top + Number(offsetY)); return this; }
[ "function", "move", "(", "offsetX", ",", "offsetY", ")", "{", "var", "imageData", "=", "this", ".", "imageData", ";", "this", ".", "moveTo", "(", "isUndefined", "(", "offsetX", ")", "?", "offsetX", ":", "imageData", ".", "left", "+", "Number", "(", "of...
Move the image with relative offsets. @param {number} offsetX - The relative offset distance on the x-axis. @param {number} offsetY - The relative offset distance on the y-axis. @returns {Viewer} this
[ "Move", "the", "image", "with", "relative", "offsets", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1825-L1832
train
fengyuanchen/viewer
dist/viewer.common.js
moveTo
function moveTo(x) { var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; var imageData = this.imageData; x = Number(x); y = Number(y); if (this.viewed && !this.played && this.options.movable) { var changed = false; if (isNumber(x)) { imageData.left ...
javascript
function moveTo(x) { var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; var imageData = this.imageData; x = Number(x); y = Number(y); if (this.viewed && !this.played && this.options.movable) { var changed = false; if (isNumber(x)) { imageData.left ...
[ "function", "moveTo", "(", "x", ")", "{", "var", "y", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "x", ";", "var", "imageData", "=", "this", ".", "imageData"...
Move the image to an absolute point. @param {number} x - The x-axis coordinate. @param {number} [y=x] - The y-axis coordinate. @returns {Viewer} this
[ "Move", "the", "image", "to", "an", "absolute", "point", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1841-L1868
train
fengyuanchen/viewer
dist/viewer.common.js
zoom
function zoom(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var imageData = this.imageData; ratio = Number(ratio); if (ratio < 0) { ratio =...
javascript
function zoom(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var imageData = this.imageData; ratio = Number(ratio); if (ratio < 0) { ratio =...
[ "function", "zoom", "(", "ratio", ")", "{", "var", "hasTooltip", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "false", ";", "var", "_originalEvent", "=", "argumen...
Zoom the image with a relative ratio. @param {number} ratio - The target ratio. @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not. @param {Event} [_originalEvent=null] - The original event if any. @returns {Viewer} this
[ "Zoom", "the", "image", "with", "a", "relative", "ratio", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1878-L1897
train
fengyuanchen/viewer
dist/viewer.common.js
zoomTo
function zoomTo(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var _zoomable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; ...
javascript
function zoomTo(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var _zoomable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; ...
[ "function", "zoomTo", "(", "ratio", ")", "{", "var", "hasTooltip", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "false", ";", "var", "_originalEvent", "=", "argum...
Zoom the image to an absolute ratio. @param {number} ratio - The target ratio. @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not. @param {Event} [_originalEvent=null] - The original event if any. @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not. @returns {Vie...
[ "Zoom", "the", "image", "to", "an", "absolute", "ratio", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1908-L1964
train
fengyuanchen/viewer
dist/viewer.common.js
rotateTo
function rotateTo(degree) { var imageData = this.imageData; degree = Number(degree); if (isNumber(degree) && this.viewed && !this.played && this.options.rotatable) { imageData.rotate = degree; this.renderImage(); } return this; }
javascript
function rotateTo(degree) { var imageData = this.imageData; degree = Number(degree); if (isNumber(degree) && this.viewed && !this.played && this.options.rotatable) { imageData.rotate = degree; this.renderImage(); } return this; }
[ "function", "rotateTo", "(", "degree", ")", "{", "var", "imageData", "=", "this", ".", "imageData", ";", "degree", "=", "Number", "(", "degree", ")", ";", "if", "(", "isNumber", "(", "degree", ")", "&&", "this", ".", "viewed", "&&", "!", "this", ".",...
Rotate the image to an absolute degree. @param {number} degree - The rotate degree. @returns {Viewer} this
[ "Rotate", "the", "image", "to", "an", "absolute", "degree", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1984-L1996
train
fengyuanchen/viewer
dist/viewer.common.js
scale
function scale(scaleX) { var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; var imageData = this.imageData; scaleX = Number(scaleX); scaleY = Number(scaleY); if (this.viewed && !this.played && this.options.scalable) { var changed = false; if (isN...
javascript
function scale(scaleX) { var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; var imageData = this.imageData; scaleX = Number(scaleX); scaleY = Number(scaleY); if (this.viewed && !this.played && this.options.scalable) { var changed = false; if (isN...
[ "function", "scale", "(", "scaleX", ")", "{", "var", "scaleY", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "scaleX", ";", "var", "imageData", "=", "this", ".",...
Scale the image. @param {number} scaleX - The scale ratio on the x-axis. @param {number} [scaleY=scaleX] - The scale ratio on the y-axis. @returns {Viewer} this
[ "Scale", "the", "image", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2029-L2056
train
fengyuanchen/viewer
dist/viewer.common.js
play
function play() { var _this2 = this; var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.isShown || this.played) { return this; } var options = this.options, player = this.player; var onLoad = this.loadImage.bind(this); var ...
javascript
function play() { var _this2 = this; var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.isShown || this.played) { return this; } var options = this.options, player = this.player; var onLoad = this.loadImage.bind(this); var ...
[ "function", "play", "(", ")", "{", "var", "_this2", "=", "this", ";", "var", "fullscreen", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "false", ";", "if", "(...
Play the images @param {boolean} [fullscreen=false] - Indicate if request fullscreen or not. @returns {Viewer} this
[ "Play", "the", "images" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2064-L2128
train
fengyuanchen/viewer
dist/viewer.common.js
tooltip
function tooltip() { var _this6 = this; var options = this.options, tooltipBox = this.tooltipBox, imageData = this.imageData; if (!this.viewed || this.played || !options.tooltip) { return this; } tooltipBox.textContent = Math.round(imageData.ratio * 100) + '%'; if (!th...
javascript
function tooltip() { var _this6 = this; var options = this.options, tooltipBox = this.tooltipBox, imageData = this.imageData; if (!this.viewed || this.played || !options.tooltip) { return this; } tooltipBox.textContent = Math.round(imageData.ratio * 100) + '%'; if (!th...
[ "function", "tooltip", "(", ")", "{", "var", "_this6", "=", "this", ";", "var", "options", "=", "this", ".", "options", ",", "tooltipBox", "=", "this", ".", "tooltipBox", ",", "imageData", "=", "this", ".", "imageData", ";", "if", "(", "!", "this", "...
Show the current ratio of the image with percentage
[ "Show", "the", "current", "ratio", "of", "the", "image", "with", "percentage" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2261-L2317
train
fengyuanchen/viewer
dist/viewer.common.js
update
function update() { var element = this.element, options = this.options, isImg = this.isImg; // Destroy viewer if the target image was deleted if (isImg && !element.parentNode) { return this.destroy(); } var images = []; forEach(isImg ? [element] : element.querySelectorA...
javascript
function update() { var element = this.element, options = this.options, isImg = this.isImg; // Destroy viewer if the target image was deleted if (isImg && !element.parentNode) { return this.destroy(); } var images = []; forEach(isImg ? [element] : element.querySelectorA...
[ "function", "update", "(", ")", "{", "var", "element", "=", "this", ".", "element", ",", "options", "=", "this", ".", "options", ",", "isImg", "=", "this", ".", "isImg", ";", "// Destroy viewer if the target image was deleted", "if", "(", "isImg", "&&", "!",...
Update viewer when images changed
[ "Update", "viewer", "when", "images", "changed" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2344-L2422
train
fengyuanchen/viewer
dist/viewer.common.js
destroy
function destroy() { var element = this.element, options = this.options; if (!getData(element, NAMESPACE)) { return this; } this.destroyed = true; if (this.ready) { if (this.played) { this.stop(); } if (options.inline) { if (this.fulled) { ...
javascript
function destroy() { var element = this.element, options = this.options; if (!getData(element, NAMESPACE)) { return this; } this.destroyed = true; if (this.ready) { if (this.played) { this.stop(); } if (options.inline) { if (this.fulled) { ...
[ "function", "destroy", "(", ")", "{", "var", "element", "=", "this", ".", "element", ",", "options", "=", "this", ".", "options", ";", "if", "(", "!", "getData", "(", "element", ",", "NAMESPACE", ")", ")", "{", "return", "this", ";", "}", "this", "...
Destroy the viewer
[ "Destroy", "the", "viewer" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2426-L2483
train
fengyuanchen/viewer
dist/viewer.common.js
Viewer
function Viewer(element) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, Viewer); if (!element || element.nodeType !== 1) { throw new Error('The first argument is required and must be an element.'); } this.element = element; th...
javascript
function Viewer(element) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, Viewer); if (!element || element.nodeType !== 1) { throw new Error('The first argument is required and must be an element.'); } this.element = element; th...
[ "function", "Viewer", "(", "element", ")", "{", "var", "options", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "{", "}", ";", "classCallCheck", "(", "this", ","...
Create a new Viewer. @param {Element} element - The target element for viewing. @param {Object} [options={}] - The configuration options.
[ "Create", "a", "new", "Viewer", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2646-L2675
train
jonathantneal/flexibility
lib/read/index.js
read
function read(element) { // normalized style var style = { alignContent: 'stretch', alignItems: 'stretch', alignSelf: 'auto', borderBottomStyle: 'none', borderBottomWidth: 0, borderLeftStyle: 'none', borderLeftWidth: 0, borderRightStyle: 'none', borderRightWidth: 0, borderTopStyle: 'none', borde...
javascript
function read(element) { // normalized style var style = { alignContent: 'stretch', alignItems: 'stretch', alignSelf: 'auto', borderBottomStyle: 'none', borderBottomWidth: 0, borderLeftStyle: 'none', borderLeftWidth: 0, borderRightStyle: 'none', borderRightWidth: 0, borderTopStyle: 'none', borde...
[ "function", "read", "(", "element", ")", "{", "// normalized style", "var", "style", "=", "{", "alignContent", ":", "'stretch'", ",", "alignItems", ":", "'stretch'", ",", "alignSelf", ":", "'auto'", ",", "borderBottomStyle", ":", "'none'", ",", "borderBottomWidt...
Return flexbox related details of an element
[ "Return", "flexbox", "related", "details", "of", "an", "element" ]
c7cbaf26c39ba1c0947d16b05d95c8ac9ce022fb
https://github.com/jonathantneal/flexibility/blob/c7cbaf26c39ba1c0947d16b05d95c8ac9ce022fb/lib/read/index.js#L10-L96
train
ampproject/amp-by-example
templates/embed/embed.js
fitPreviewToContent
function fitPreviewToContent() { var iframeDoc = preview.contentDocument || preview.contentWindow.document; setPreviewHeight(iframeDoc.body.offsetHeight); }
javascript
function fitPreviewToContent() { var iframeDoc = preview.contentDocument || preview.contentWindow.document; setPreviewHeight(iframeDoc.body.offsetHeight); }
[ "function", "fitPreviewToContent", "(", ")", "{", "var", "iframeDoc", "=", "preview", ".", "contentDocument", "||", "preview", ".", "contentWindow", ".", "document", ";", "setPreviewHeight", "(", "iframeDoc", ".", "body", ".", "offsetHeight", ")", ";", "}" ]
Adjusts the iframe height based on the iframe's document height. The width is unchanged.
[ "Adjusts", "the", "iframe", "height", "based", "on", "the", "iframe", "s", "document", "height", ".", "The", "width", "is", "unchanged", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/templates/embed/embed.js#L35-L38
train
ampproject/amp-by-example
templates/embed/embed.js
postEmbedHeightToViewer
function postEmbedHeightToViewer() { var newHeight = document.getElementById('tabinterface').clientHeight; if (newHeight < MIN_IFRAME_HEIGHT) { console.log('embed height too small, reset height to 100px'); newHeight = MIN_IFRAME_HEIGHT; } // Tell the viewer about the new size window.parent.postMessage...
javascript
function postEmbedHeightToViewer() { var newHeight = document.getElementById('tabinterface').clientHeight; if (newHeight < MIN_IFRAME_HEIGHT) { console.log('embed height too small, reset height to 100px'); newHeight = MIN_IFRAME_HEIGHT; } // Tell the viewer about the new size window.parent.postMessage...
[ "function", "postEmbedHeightToViewer", "(", ")", "{", "var", "newHeight", "=", "document", ".", "getElementById", "(", "'tabinterface'", ")", ".", "clientHeight", ";", "if", "(", "newHeight", "<", "MIN_IFRAME_HEIGHT", ")", "{", "console", ".", "log", "(", "'em...
Post a message containing the document height to the amp-iframe to trigger the resize.
[ "Post", "a", "message", "containing", "the", "document", "height", "to", "the", "amp", "-", "iframe", "to", "trigger", "the", "resize", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/templates/embed/embed.js#L43-L55
train
ampproject/amp-by-example
static/sw.js
offlineImage
function offlineImage(name, width, height) { return `<?xml version="1.0"?> <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg" version="1.1"> <g fill="none" fill-rule="evenodd"><path fill="#F8BBD0" d="M0 0h${width}v${height}H0z"/></g> <text text-anchor=...
javascript
function offlineImage(name, width, height) { return `<?xml version="1.0"?> <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg" version="1.1"> <g fill="none" fill-rule="evenodd"><path fill="#F8BBD0" d="M0 0h${width}v${height}H0z"/></g> <text text-anchor=...
[ "function", "offlineImage", "(", "name", ",", "width", ",", "height", ")", "{", "return", "`", "${", "width", "}", "${", "height", "}", "${", "width", "}", "${", "height", "}", "${", "width", "}", "${", "height", "}", "${", "Math", ".", "floor", "(...
Generates a placeholder SVG image of the given size.
[ "Generates", "a", "placeholder", "SVG", "image", "of", "the", "given", "size", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L53-L65
train
ampproject/amp-by-example
static/sw.js
onMessageReceivedSubscriptionState
function onMessageReceivedSubscriptionState() { let retrievedPushSubscription = null; self.registration.pushManager.getSubscription() .then(pushSubscription => { retrievedPushSubscription = pushSubscription; if (!pushSubscription) { return null; } else...
javascript
function onMessageReceivedSubscriptionState() { let retrievedPushSubscription = null; self.registration.pushManager.getSubscription() .then(pushSubscription => { retrievedPushSubscription = pushSubscription; if (!pushSubscription) { return null; } else...
[ "function", "onMessageReceivedSubscriptionState", "(", ")", "{", "let", "retrievedPushSubscription", "=", "null", ";", "self", ".", "registration", ".", "pushManager", ".", "getSubscription", "(", ")", ".", "then", "(", "pushSubscription", "=>", "{", "retrievedPushS...
Broadcasts a single boolean describing whether the user is subscribed.
[ "Broadcasts", "a", "single", "boolean", "describing", "whether", "the", "user", "is", "subscribed", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L272-L294
train
ampproject/amp-by-example
static/sw.js
persistSubscriptionLocally
function persistSubscriptionLocally(subscription) { let subscriptionJSON = JSON.stringify(subscription); idb.open('web-push-db', 1).then(db => { let tx = db.transaction(['web-push-subcription'], 'readwrite'); tx.objectStore('web-push-subcription').put({ id: 1, data: subsc...
javascript
function persistSubscriptionLocally(subscription) { let subscriptionJSON = JSON.stringify(subscription); idb.open('web-push-db', 1).then(db => { let tx = db.transaction(['web-push-subcription'], 'readwrite'); tx.objectStore('web-push-subcription').put({ id: 1, data: subsc...
[ "function", "persistSubscriptionLocally", "(", "subscription", ")", "{", "let", "subscriptionJSON", "=", "JSON", ".", "stringify", "(", "subscription", ")", ";", "idb", ".", "open", "(", "'web-push-db'", ",", "1", ")", ".", "then", "(", "db", "=>", "{", "l...
Helper functions for IndexedDB management. Persists the subscription object in IndexedDB.
[ "Helper", "functions", "for", "IndexedDB", "management", ".", "Persists", "the", "subscription", "object", "in", "IndexedDB", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L358-L368
train
ampproject/amp-by-example
static/sw.js
urlB64ToUint8Array
function urlB64ToUint8Array(base64String) { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding) .replace(/\-/g, '+') .replace(/_/g, '/'); const rawData = self.atob(base64); const outputArray = new Uint8Array(rawData.length); for (l...
javascript
function urlB64ToUint8Array(base64String) { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding) .replace(/\-/g, '+') .replace(/_/g, '/'); const rawData = self.atob(base64); const outputArray = new Uint8Array(rawData.length); for (l...
[ "function", "urlB64ToUint8Array", "(", "base64String", ")", "{", "const", "padding", "=", "'='", ".", "repeat", "(", "(", "4", "-", "base64String", ".", "length", "%", "4", ")", "%", "4", ")", ";", "const", "base64", "=", "(", "base64String", "+", "pad...
Helper method to convert the VAPID key to a UInt8 array and supply it to applicationServerKey.
[ "Helper", "method", "to", "convert", "the", "VAPID", "key", "to", "a", "UInt8", "array", "and", "supply", "it", "to", "applicationServerKey", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L384-L397
train
ampproject/amp-by-example
lib/Preview.js
generateEmbeds
function generateEmbeds(config) { glob(config.src + '/**/*.html', {}, (err, files) => { files.forEach(file => generateEmbed(config, file)); }); }
javascript
function generateEmbeds(config) { glob(config.src + '/**/*.html', {}, (err, files) => { files.forEach(file => generateEmbed(config, file)); }); }
[ "function", "generateEmbeds", "(", "config", ")", "{", "glob", "(", "config", ".", "src", "+", "'/**/*.html'", ",", "{", "}", ",", "(", "err", ",", "files", ")", "=>", "{", "files", ".", "forEach", "(", "file", "=>", "generateEmbed", "(", "config", "...
Reads all html files in a folder and generates the embeds.
[ "Reads", "all", "html", "files", "in", "a", "folder", "and", "generates", "the", "embeds", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L68-L72
train
ampproject/amp-by-example
lib/Preview.js
generateEmbed
function generateEmbed(config, file) { const targetPath = path.join(config.destDir, path.relative(config.src, file)); const document = parseDocument(file); const sampleSections = document.sections.filter( s => s.inBody && !s.isEmptyCodeSection() ); sampleSections.forEach((section, index) => { highligh...
javascript
function generateEmbed(config, file) { const targetPath = path.join(config.destDir, path.relative(config.src, file)); const document = parseDocument(file); const sampleSections = document.sections.filter( s => s.inBody && !s.isEmptyCodeSection() ); sampleSections.forEach((section, index) => { highligh...
[ "function", "generateEmbed", "(", "config", ",", "file", ")", "{", "const", "targetPath", "=", "path", ".", "join", "(", "config", ".", "destDir", ",", "path", ".", "relative", "(", "config", ".", "src", ",", "file", ")", ")", ";", "const", "document",...
Generates embeds for a given file.
[ "Generates", "embeds", "for", "a", "given", "file", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L77-L103
train
ampproject/amp-by-example
lib/Preview.js
highlight
function highlight(code) { return new Promise((resolve, reject) => { pygmentize({ lang: 'html', format: 'html' }, code, function (err, result) { if (err) { console.log(err); reject(err); } else { resolve(result.toString()); }; }); }); }
javascript
function highlight(code) { return new Promise((resolve, reject) => { pygmentize({ lang: 'html', format: 'html' }, code, function (err, result) { if (err) { console.log(err); reject(err); } else { resolve(result.toString()); }; }); }); }
[ "function", "highlight", "(", "code", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "pygmentize", "(", "{", "lang", ":", "'html'", ",", "format", ":", "'html'", "}", ",", "code", ",", "function", "(", "err"...
Syntax highlights a string.
[ "Syntax", "highlights", "a", "string", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L108-L119
train
ampproject/amp-by-example
lib/Preview.js
generate
function generate(file, template, context, minifyResult) { let string = template.render(context, { 'styles.css': templates.styles, 'embed.js': templates.embedJs }); if (minifyResult) { string = minify(string, { caseSensitive: true, collapseWhitespace: true, html5: true, minifyC...
javascript
function generate(file, template, context, minifyResult) { let string = template.render(context, { 'styles.css': templates.styles, 'embed.js': templates.embedJs }); if (minifyResult) { string = minify(string, { caseSensitive: true, collapseWhitespace: true, html5: true, minifyC...
[ "function", "generate", "(", "file", ",", "template", ",", "context", ",", "minifyResult", ")", "{", "let", "string", "=", "template", ".", "render", "(", "context", ",", "{", "'styles.css'", ":", "templates", ".", "styles", ",", "'embed.js'", ":", "templa...
Renders the given template into a file.
[ "Renders", "the", "given", "template", "into", "a", "file", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L124-L141
train
ampproject/amp-by-example
lib/Preview.js
addFlag
function addFlag() { const filename = arguments[0]; const postfix = [].slice.call(arguments, 1).join('.'); return filename.replace('.html', '.' + postfix + '.html'); }
javascript
function addFlag() { const filename = arguments[0]; const postfix = [].slice.call(arguments, 1).join('.'); return filename.replace('.html', '.' + postfix + '.html'); }
[ "function", "addFlag", "(", ")", "{", "const", "filename", "=", "arguments", "[", "0", "]", ";", "const", "postfix", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ".", "join", "(", "'.'", ")", ";", "return", "filename",...
Appends a list of flags separated by a '.' to a filename.
[ "Appends", "a", "list", "of", "flags", "separated", "by", "a", ".", "to", "a", "filename", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L146-L150
train
ampproject/amp-by-example
lib/Preview.js
generateTemplate
function generateTemplate(context) { let _page; let _phantom; phantom.create([], { logLevel: 'error' }).then(function (ph) { _phantom = ph; ph.createPage() .then(page => { _page = page; const url = path.join(context.config.destRoot, context.sample.embed); return _page.propert...
javascript
function generateTemplate(context) { let _page; let _phantom; phantom.create([], { logLevel: 'error' }).then(function (ph) { _phantom = ph; ph.createPage() .then(page => { _page = page; const url = path.join(context.config.destRoot, context.sample.embed); return _page.propert...
[ "function", "generateTemplate", "(", "context", ")", "{", "let", "_page", ";", "let", "_phantom", ";", "phantom", ".", "create", "(", "[", "]", ",", "{", "logLevel", ":", "'error'", "}", ")", ".", "then", "(", "function", "(", "ph", ")", "{", "_phant...
Opens the embed html file in a browser to determine the initial height.
[ "Opens", "the", "embed", "html", "file", "in", "a", "browser", "to", "determine", "the", "initial", "height", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L163-L192
train
mscdex/busboy
deps/encoding/encoding.js
UTF8Decoder
function UTF8Decoder(options) { var fatal = options.fatal; var /** @type {number} */ utf8_code_point = 0, /** @type {number} */ utf8_bytes_needed = 0, /** @type {number} */ utf8_bytes_seen = 0, /** @type {number} */ utf8_lower_boundary = 0; /** * @param {ByteInputStream} byte_pointer The byt...
javascript
function UTF8Decoder(options) { var fatal = options.fatal; var /** @type {number} */ utf8_code_point = 0, /** @type {number} */ utf8_bytes_needed = 0, /** @type {number} */ utf8_bytes_seen = 0, /** @type {number} */ utf8_lower_boundary = 0; /** * @param {ByteInputStream} byte_pointer The byt...
[ "function", "UTF8Decoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "utf8_code_point", "=", "0", ",", "/** @type {number} */", "utf8_bytes_needed", "=", "0", ",", "/** @type {number} */", "utf8_byte...
8.1 utf-8 @constructor @param {{fatal: boolean}} options
[ "8", ".", "1", "utf", "-", "8" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1026-L1096
train
mscdex/busboy
deps/encoding/encoding.js
GBKDecoder
function GBKDecoder(gb18030, options) { var fatal = options.fatal; var /** @type {number} */ gbk_first = 0x00, /** @type {number} */ gbk_second = 0x00, /** @type {number} */ gbk_third = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code...
javascript
function GBKDecoder(gb18030, options) { var fatal = options.fatal; var /** @type {number} */ gbk_first = 0x00, /** @type {number} */ gbk_second = 0x00, /** @type {number} */ gbk_third = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code...
[ "function", "GBKDecoder", "(", "gb18030", ",", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "gbk_first", "=", "0x00", ",", "/** @type {number} */", "gbk_second", "=", "0x00", ",", "/** @type {number} */", ...
9.1 gbk @constructor @param {boolean} gb18030 True if decoding gb18030, false otherwise. @param {{fatal: boolean}} options
[ "9", ".", "1", "gbk" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1244-L1329
train
mscdex/busboy
deps/encoding/encoding.js
HZGB2312Decoder
function HZGB2312Decoder(options) { var fatal = options.fatal; var /** @type {boolean} */ hzgb2312 = false, /** @type {number} */ hzgb2312_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * ...
javascript
function HZGB2312Decoder(options) { var fatal = options.fatal; var /** @type {boolean} */ hzgb2312 = false, /** @type {number} */ hzgb2312_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * ...
[ "function", "HZGB2312Decoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {boolean} */", "hzgb2312", "=", "false", ",", "/** @type {number} */", "hzgb2312_lead", "=", "0x00", ";", "/**\n * @param {ByteInputStream} ...
10.2 hz-gb-2312 @constructor @param {{fatal: boolean}} options
[ "10", ".", "2", "hz", "-", "gb", "-", "2312" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1397-L1470
train
mscdex/busboy
deps/encoding/encoding.js
Big5Decoder
function Big5Decoder(options) { var fatal = options.fatal; var /** @type {number} */ big5_lead = 0x00, /** @type {?number} */ big5_pending = null; /** * @param {ByteInputStream} byte_pointer The byte steram to decode. * @return {?number} The next code point decoded, or null if not enough * dat...
javascript
function Big5Decoder(options) { var fatal = options.fatal; var /** @type {number} */ big5_lead = 0x00, /** @type {?number} */ big5_pending = null; /** * @param {ByteInputStream} byte_pointer The byte steram to decode. * @return {?number} The next code point decoded, or null if not enough * dat...
[ "function", "Big5Decoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "big5_lead", "=", "0x00", ",", "/** @type {?number} */", "big5_pending", "=", "null", ";", "/**\n * @param {ByteInputStream} byte_...
11.1 big5 @constructor @param {{fatal: boolean}} options
[ "11", ".", "1", "big5" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1539-L1608
train
mscdex/busboy
deps/encoding/encoding.js
EUCJPDecoder
function EUCJPDecoder(options) { var fatal = options.fatal; var /** @type {number} */ eucjp_first = 0x00, /** @type {number} */ eucjp_second = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * da...
javascript
function EUCJPDecoder(options) { var fatal = options.fatal; var /** @type {number} */ eucjp_first = 0x00, /** @type {number} */ eucjp_second = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * da...
[ "function", "EUCJPDecoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "eucjp_first", "=", "0x00", ",", "/** @type {number} */", "eucjp_second", "=", "0x00", ";", "/**\n * @param {ByteInputStream} byt...
12.1 euc.jp @constructor @param {{fatal: boolean}} options
[ "12", ".", "1", "euc", ".", "jp" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1664-L1736
train
mscdex/busboy
deps/encoding/encoding.js
ShiftJISDecoder
function ShiftJISDecoder(options) { var fatal = options.fatal; var /** @type {number} */ shiftjis_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a co...
javascript
function ShiftJISDecoder(options) { var fatal = options.fatal; var /** @type {number} */ shiftjis_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a co...
[ "function", "ShiftJISDecoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "shiftjis_lead", "=", "0x00", ";", "/**\n * @param {ByteInputStream} byte_pointer The byte stream to decode.\n * @return {?number} The...
12.3 shift_jis @constructor @param {{fatal: boolean}} options
[ "12", ".", "3", "shift_jis" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L2016-L2062
train
mscdex/busboy
deps/encoding/encoding.js
EUCKRDecoder
function EUCKRDecoder(options) { var fatal = options.fatal; var /** @type {number} */ euckr_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a complete...
javascript
function EUCKRDecoder(options) { var fatal = options.fatal; var /** @type {number} */ euckr_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a complete...
[ "function", "EUCKRDecoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "euckr_lead", "=", "0x00", ";", "/**\n * @param {ByteInputStream} byte_pointer The byte stream to decode.\n * @return {?number} The next ...
13.1 euc-kr @constructor @param {{fatal: boolean}} options
[ "13", ".", "1", "euc", "-", "kr" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L2124-L2185
train
mscdex/busboy
deps/encoding/encoding.js
UTF16Decoder
function UTF16Decoder(utf16_be, options) { var fatal = options.fatal; var /** @type {?number} */ utf16_lead_byte = null, /** @type {?number} */ utf16_lead_surrogate = null; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null i...
javascript
function UTF16Decoder(utf16_be, options) { var fatal = options.fatal; var /** @type {?number} */ utf16_lead_byte = null, /** @type {?number} */ utf16_lead_surrogate = null; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null i...
[ "function", "UTF16Decoder", "(", "utf16_be", ",", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {?number} */", "utf16_lead_byte", "=", "null", ",", "/** @type {?number} */", "utf16_lead_surrogate", "=", "null", ";", "/**...
14.2 utf-16 @constructor @param {boolean} utf16_be True if big-endian, false if little-endian. @param {{fatal: boolean}} options
[ "14", ".", "2", "utf", "-", "16" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L2250-L2300
train
angular-translate/angular-translate
Gruntfile.js
function () { var scopes = fs.readdirSync('./test_scopes').filter(function (filename) { return filename[0] !== '.'; }); var config = { options: { color: false, interactive: false } }; // Create a sub config for each test scope for (var idx in scopes) { var...
javascript
function () { var scopes = fs.readdirSync('./test_scopes').filter(function (filename) { return filename[0] !== '.'; }); var config = { options: { color: false, interactive: false } }; // Create a sub config for each test scope for (var idx in scopes) { var...
[ "function", "(", ")", "{", "var", "scopes", "=", "fs", ".", "readdirSync", "(", "'./test_scopes'", ")", ".", "filter", "(", "function", "(", "filename", ")", "{", "return", "filename", "[", "0", "]", "!==", "'.'", ";", "}", ")", ";", "var", "config",...
Returns configuration for bower-install plugin
[ "Returns", "configuration", "for", "bower", "-", "install", "plugin" ]
eda9f29b3343d84f43f9fa30a39a1ae636d1c494
https://github.com/angular-translate/angular-translate/blob/eda9f29b3343d84f43f9fa30a39a1ae636d1c494/Gruntfile.js#L12-L33
train
angular-translate/angular-translate
src/directive/translate-attr.js
function () { angular.forEach(translateAttr, function (translationId, attributeName) { if (!translationId) { return; } previousAttributes[attributeName] = true; // if translation id starts with '.' and translateNamespace given, prepend namespace if ...
javascript
function () { angular.forEach(translateAttr, function (translationId, attributeName) { if (!translationId) { return; } previousAttributes[attributeName] = true; // if translation id starts with '.' and translateNamespace given, prepend namespace if ...
[ "function", "(", ")", "{", "angular", ".", "forEach", "(", "translateAttr", ",", "function", "(", "translationId", ",", "attributeName", ")", "{", "if", "(", "!", "translationId", ")", "{", "return", ";", "}", "previousAttributes", "[", "attributeName", "]",...
Main update translations function
[ "Main", "update", "translations", "function" ]
eda9f29b3343d84f43f9fa30a39a1ae636d1c494
https://github.com/angular-translate/angular-translate/blob/eda9f29b3343d84f43f9fa30a39a1ae636d1c494/src/directive/translate-attr.js#L75-L101
train
angular-translate/angular-translate
src/service/loader-partial.js
function () { return $http( angular.extend({ method : 'GET', url : self.parseUrl(self.urlTemplate || urlTemplate, lang) }, $httpOptions) ); }
javascript
function () { return $http( angular.extend({ method : 'GET', url : self.parseUrl(self.urlTemplate || urlTemplate, lang) }, $httpOptions) ); }
[ "function", "(", ")", "{", "return", "$http", "(", "angular", ".", "extend", "(", "{", "method", ":", "'GET'", ",", "url", ":", "self", ".", "parseUrl", "(", "self", ".", "urlTemplate", "||", "urlTemplate", ",", "lang", ")", "}", ",", "$httpOptions", ...
private helper helpers
[ "private", "helper", "helpers" ]
eda9f29b3343d84f43f9fa30a39a1ae636d1c494
https://github.com/angular-translate/angular-translate/blob/eda9f29b3343d84f43f9fa30a39a1ae636d1c494/src/service/loader-partial.js#L63-L71
train
dceejay/RedMap
worldmap/worldmap.js
function() { ws = new SockJS(location.pathname.split("index")[0] + 'socket'); ws.onopen = function() { console.log("CONNECTED"); if (!inIframe) { document.getElementById("footer").innerHTML = "<font color='#494'>"+ibmfoot+"</font>"; } ws.send(JSON.stringify({action:"c...
javascript
function() { ws = new SockJS(location.pathname.split("index")[0] + 'socket'); ws.onopen = function() { console.log("CONNECTED"); if (!inIframe) { document.getElementById("footer").innerHTML = "<font color='#494'>"+ibmfoot+"</font>"; } ws.send(JSON.stringify({action:"c...
[ "function", "(", ")", "{", "ws", "=", "new", "SockJS", "(", "location", ".", "pathname", ".", "split", "(", "\"index\"", ")", "[", "0", "]", "+", "'socket'", ")", ";", "ws", ".", "onopen", "=", "function", "(", ")", "{", "console", ".", "log", "(...
Create the socket
[ "Create", "the", "socket" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L47-L92
train
dceejay/RedMap
worldmap/worldmap.js
doTidyUp
function doTidyUp(l) { var d = parseInt(Date.now()/1000); for (var m in markers) { if ((l && (l == markers[m].lay)) || typeof markers[m].ts != "undefined") { if ((l && (l == markers[m].lay)) || (markers[m].hasOwnProperty("ts") && (Number(markers[m].ts) < d) && (markers[m].lay !== "_drawing")...
javascript
function doTidyUp(l) { var d = parseInt(Date.now()/1000); for (var m in markers) { if ((l && (l == markers[m].lay)) || typeof markers[m].ts != "undefined") { if ((l && (l == markers[m].lay)) || (markers[m].hasOwnProperty("ts") && (Number(markers[m].ts) < d) && (markers[m].lay !== "_drawing")...
[ "function", "doTidyUp", "(", "l", ")", "{", "var", "d", "=", "parseInt", "(", "Date", ".", "now", "(", ")", "/", "1000", ")", ";", "for", "(", "var", "m", "in", "markers", ")", "{", "if", "(", "(", "l", "&&", "(", "l", "==", "markers", "[", ...
Remove old markers
[ "Remove", "old", "markers" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L253-L276
train
dceejay/RedMap
worldmap/worldmap.js
doSearch
function doSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } if (mar...
javascript
function doSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } if (mar...
[ "function", "doSearch", "(", ")", "{", "var", "value", "=", "document", ".", "getElementById", "(", "'search'", ")", ".", "value", ";", "marks", "=", "[", "]", ";", "marksIndex", "=", "0", ";", "for", "(", "var", "key", "in", "markers", ")", "{", "...
Search for markers with names of ... or icons of ...
[ "Search", "for", "markers", "with", "names", "of", "...", "or", "icons", "of", "..." ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L306-L350
train
dceejay/RedMap
worldmap/worldmap.js
moveToMarks
function moveToMarks() { if (marks.length > marksIndex) { var m = marks[marksIndex]; map.setView(m.getLatLng(), map.getZoom()); m.openPopup(); marksIndex++; setTimeout(moveToMarks, 2500); } }
javascript
function moveToMarks() { if (marks.length > marksIndex) { var m = marks[marksIndex]; map.setView(m.getLatLng(), map.getZoom()); m.openPopup(); marksIndex++; setTimeout(moveToMarks, 2500); } }
[ "function", "moveToMarks", "(", ")", "{", "if", "(", "marks", ".", "length", ">", "marksIndex", ")", "{", "var", "m", "=", "marks", "[", "marksIndex", "]", ";", "map", ".", "setView", "(", "m", ".", "getLatLng", "(", ")", ",", "map", ".", "getZoom"...
Jump to a markers position - centralise it on map
[ "Jump", "to", "a", "markers", "position", "-", "centralise", "it", "on", "map" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L353-L361
train
dceejay/RedMap
worldmap/worldmap.js
clearSearch
function clearSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } } re...
javascript
function clearSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } } re...
[ "function", "clearSearch", "(", ")", "{", "var", "value", "=", "document", ".", "getElementById", "(", "'search'", ")", ".", "value", ";", "marks", "=", "[", "]", ";", "marksIndex", "=", "0", ";", "for", "(", "var", "key", "in", "markers", ")", "{", ...
Clear Search With Marker names
[ "Clear", "Search", "With", "Marker", "names" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L364-L380
train
dceejay/RedMap
worldmap/worldmap.js
setMarker
function setMarker(data) { var rightmenu = function(m) { // customise right click context menu var rightcontext = ""; if (polygons[data.name] == undefined) { rightcontext = "<button id='delbutton' onclick='delMarker(\""+data.name+"\",true);'>Delete</button>"; } e...
javascript
function setMarker(data) { var rightmenu = function(m) { // customise right click context menu var rightcontext = ""; if (polygons[data.name] == undefined) { rightcontext = "<button id='delbutton' onclick='delMarker(\""+data.name+"\",true);'>Delete</button>"; } e...
[ "function", "setMarker", "(", "data", ")", "{", "var", "rightmenu", "=", "function", "(", "m", ")", "{", "// customise right click context menu", "var", "rightcontext", "=", "\"\"", ";", "if", "(", "polygons", "[", "data", ".", "name", "]", "==", "undefined"...
the MAIN add something to map function
[ "the", "MAIN", "add", "something", "to", "map", "function" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L883-L1455
train
dceejay/RedMap
worldmap/worldmap.js
doGeojson
function doGeojson(g) { console.log("GEOJSON",g); if (!basemaps["geojson"]) { var opt = { style: function(feature) { var st = { stroke:true, color:"#910000", weight:2, fill:true, fillColor:"#910000", fillOpacity:0.3 }; if (feature.hasOwnProperty("properties")) { ...
javascript
function doGeojson(g) { console.log("GEOJSON",g); if (!basemaps["geojson"]) { var opt = { style: function(feature) { var st = { stroke:true, color:"#910000", weight:2, fill:true, fillColor:"#910000", fillOpacity:0.3 }; if (feature.hasOwnProperty("properties")) { ...
[ "function", "doGeojson", "(", "g", ")", "{", "console", ".", "log", "(", "\"GEOJSON\"", ",", "g", ")", ";", "if", "(", "!", "basemaps", "[", "\"geojson\"", "]", ")", "{", "var", "opt", "=", "{", "style", ":", "function", "(", "feature", ")", "{", ...
handle any incoming GEOJSON directly - may style badly
[ "handle", "any", "incoming", "GEOJSON", "directly", "-", "may", "style", "badly" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L1868-L1889
train
dceejay/RedMap
worldmap/leaflet/easy-button.js
function(newState){ // when called with no args, it's a getter if (arguments.length === 0) { return this._currentState.stateName; } // activate by name if(typeof newState == 'string'){ this._activateStateNamed(newState); // activate by index } else if (typeof newState == 'num...
javascript
function(newState){ // when called with no args, it's a getter if (arguments.length === 0) { return this._currentState.stateName; } // activate by name if(typeof newState == 'string'){ this._activateStateNamed(newState); // activate by index } else if (typeof newState == 'num...
[ "function", "(", "newState", ")", "{", "// when called with no args, it's a getter", "if", "(", "arguments", ".", "length", "===", "0", ")", "{", "return", "this", ".", "_currentState", ".", "stateName", ";", "}", "// activate by name", "if", "(", "typeof", "new...
populated on init
[ "populated", "on", "init" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/leaflet/easy-button.js#L219-L238
train
dceejay/RedMap
worldmap/leaflet/easy-button.js
State
function State(template, easyButton){ this.title = template.title; this.stateName = template.stateName ? template.stateName : 'unnamed-state'; // build the wrapper this.icon = L.DomUtil.create('span', ''); L.DomUtil.addClass(this.icon, 'button-state state-' + this.stateName.replace(/(^\s*|\s*$)/g,'')); t...
javascript
function State(template, easyButton){ this.title = template.title; this.stateName = template.stateName ? template.stateName : 'unnamed-state'; // build the wrapper this.icon = L.DomUtil.create('span', ''); L.DomUtil.addClass(this.icon, 'button-state state-' + this.stateName.replace(/(^\s*|\s*$)/g,'')); t...
[ "function", "State", "(", "template", ",", "easyButton", ")", "{", "this", ".", "title", "=", "template", ".", "title", ";", "this", ".", "stateName", "=", "template", ".", "stateName", "?", "template", ".", "stateName", ":", "'unnamed-state'", ";", "// bu...
constructor for states so only curated states end up getting called
[ "constructor", "for", "states", "so", "only", "curated", "states", "end", "up", "getting", "called" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/leaflet/easy-button.js#L331-L342
train
webpack-contrib/sass-loader
lib/webpackImporter.js
webpackImporter
function webpackImporter(resourcePath, resolve, addNormalizedDependency) { function dirContextFrom(fileContext) { return path.dirname( // The first file is 'stdin' when we're using the data option fileContext === 'stdin' ? resourcePath : fileContext ); } // eslint-disable-next-line no-shadow ...
javascript
function webpackImporter(resourcePath, resolve, addNormalizedDependency) { function dirContextFrom(fileContext) { return path.dirname( // The first file is 'stdin' when we're using the data option fileContext === 'stdin' ? resourcePath : fileContext ); } // eslint-disable-next-line no-shadow ...
[ "function", "webpackImporter", "(", "resourcePath", ",", "resolve", ",", "addNormalizedDependency", ")", "{", "function", "dirContextFrom", "(", "fileContext", ")", "{", "return", "path", ".", "dirname", "(", "// The first file is 'stdin' when we're using the data option", ...
Returns an importer that uses webpack's resolving algorithm. It's important that the returned function has the correct number of arguments (based on whether the call is sync or async) because otherwise node-sass doesn't exit. @param {string} resourcePath @param {PromisedResolve} resolve @param {Function<string>} addN...
[ "Returns", "an", "importer", "that", "uses", "webpack", "s", "resolving", "algorithm", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/webpackImporter.js#L38-L74
train
webpack-contrib/sass-loader
lib/proxyCustomImporters.js
proxyCustomImporters
function proxyCustomImporters(importer, resourcePath) { return [].concat(importer).map( // eslint-disable-next-line no-shadow (importer) => function customImporter() { return importer.apply( this, // eslint-disable-next-line prefer-rest-params Array.from(arguments)....
javascript
function proxyCustomImporters(importer, resourcePath) { return [].concat(importer).map( // eslint-disable-next-line no-shadow (importer) => function customImporter() { return importer.apply( this, // eslint-disable-next-line prefer-rest-params Array.from(arguments)....
[ "function", "proxyCustomImporters", "(", "importer", ",", "resourcePath", ")", "{", "return", "[", "]", ".", "concat", "(", "importer", ")", ".", "map", "(", "// eslint-disable-next-line no-shadow", "(", "importer", ")", "=>", "function", "customImporter", "(", ...
Creates new custom importers that use the given `resourcePath` if libsass calls the custom importer with `prev` being 'stdin'. Why do we need this? We have to use the `data` option of node-sass in order to compile our sass because the `resourcePath` might not be an actual file on disk. When using the `data` option, li...
[ "Creates", "new", "custom", "importers", "that", "use", "the", "given", "resourcePath", "if", "libsass", "calls", "the", "custom", "importer", "with", "prev", "being", "stdin", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/proxyCustomImporters.js#L17-L31
train
webpack-contrib/sass-loader
lib/normalizeOptions.js
normalizeOptions
function normalizeOptions(loaderContext, content, webpackImporter) { const options = cloneDeep(utils.getOptions(loaderContext)) || {}; const { resourcePath } = loaderContext; // allow opt.functions to be configured WRT loaderContext if (typeof options.functions === 'function') { options.functions = options...
javascript
function normalizeOptions(loaderContext, content, webpackImporter) { const options = cloneDeep(utils.getOptions(loaderContext)) || {}; const { resourcePath } = loaderContext; // allow opt.functions to be configured WRT loaderContext if (typeof options.functions === 'function') { options.functions = options...
[ "function", "normalizeOptions", "(", "loaderContext", ",", "content", ",", "webpackImporter", ")", "{", "const", "options", "=", "cloneDeep", "(", "utils", ".", "getOptions", "(", "loaderContext", ")", ")", "||", "{", "}", ";", "const", "{", "resourcePath", ...
Derives the sass options from the loader context and normalizes its values with sane defaults. Please note: If loaderContext.query is an options object, it will be re-used across multiple invocations. That's why we must not modify the object directly. @param {LoaderContext} loaderContext @param {string} content @para...
[ "Derives", "the", "sass", "options", "from", "the", "loader", "context", "and", "normalizes", "its", "values", "with", "sane", "defaults", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/normalizeOptions.js#L22-L95
train
webpack-contrib/sass-loader
lib/importsToResolve.js
importsToResolve
function importsToResolve(url) { const request = utils.urlToRequest(url); // Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot. // @see https://github.com/webpack-contrib/sass-loader/issues/167 const ext = path.extname(request); if (...
javascript
function importsToResolve(url) { const request = utils.urlToRequest(url); // Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot. // @see https://github.com/webpack-contrib/sass-loader/issues/167 const ext = path.extname(request); if (...
[ "function", "importsToResolve", "(", "url", ")", "{", "const", "request", "=", "utils", ".", "urlToRequest", "(", "url", ")", ";", "// Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot.", "// @see https://g...
When libsass tries to resolve an import, it uses a special algorithm. Since the sass-loader uses webpack to resolve the modules, we need to simulate that algorithm. This function returns an array of import paths to try. The last entry in the array is always the original url to enable straight-forward webpack.config ali...
[ "When", "libsass", "tries", "to", "resolve", "an", "import", "it", "uses", "a", "special", "algorithm", ".", "Since", "the", "sass", "-", "loader", "uses", "webpack", "to", "resolve", "the", "modules", "we", "need", "to", "simulate", "that", "algorithm", "...
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/importsToResolve.js#L18-L60
train
webpack-contrib/sass-loader
lib/loader.js
sassLoader
function sassLoader(content) { const callback = this.async(); const isSync = typeof callback !== 'function'; const self = this; const { resourcePath } = this; function addNormalizedDependency(file) { // node-sass returns POSIX paths self.dependency(path.normalize(file)); } if (isSync) { thro...
javascript
function sassLoader(content) { const callback = this.async(); const isSync = typeof callback !== 'function'; const self = this; const { resourcePath } = this; function addNormalizedDependency(file) { // node-sass returns POSIX paths self.dependency(path.normalize(file)); } if (isSync) { thro...
[ "function", "sassLoader", "(", "content", ")", "{", "const", "callback", "=", "this", ".", "async", "(", ")", ";", "const", "isSync", "=", "typeof", "callback", "!==", "'function'", ";", "const", "self", "=", "this", ";", "const", "{", "resourcePath", "}...
The sass-loader makes node-sass and dart-sass available to webpack modules. @this {LoaderContext} @param {string} content
[ "The", "sass", "-", "loader", "makes", "node", "-", "sass", "and", "dart", "-", "sass", "available", "to", "webpack", "modules", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/loader.js#L21-L115
train
webpack-contrib/sass-loader
lib/loader.js
getRenderFuncFromSassImpl
function getRenderFuncFromSassImpl(module) { const { info } = module; const components = info.split('\t'); if (components.length < 2) { throw new Error(`Unknown Sass implementation "${info}".`); } const [implementation, version] = components; if (!semver.valid(version)) { throw new Error(`Invalid...
javascript
function getRenderFuncFromSassImpl(module) { const { info } = module; const components = info.split('\t'); if (components.length < 2) { throw new Error(`Unknown Sass implementation "${info}".`); } const [implementation, version] = components; if (!semver.valid(version)) { throw new Error(`Invalid...
[ "function", "getRenderFuncFromSassImpl", "(", "module", ")", "{", "const", "{", "info", "}", "=", "module", ";", "const", "components", "=", "info", ".", "split", "(", "'\\t'", ")", ";", "if", "(", "components", ".", "length", "<", "2", ")", "{", "thro...
Verifies that the implementation and version of Sass is supported by this loader. @param {Object} module @returns {Function}
[ "Verifies", "that", "the", "implementation", "and", "version", "of", "Sass", "is", "supported", "by", "this", "loader", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/loader.js#L123-L168
train
node-apn/node-apn
lib/token.js
token
function token(input) { let token; if (typeof input === "string") { token = input; } else if (Buffer.isBuffer(input)) { token = input.toString("hex"); } token = token.replace(/[^0-9a-f]/gi, ""); if (token.length === 0) { throw new Error("Token has invalid length"); } return token; }
javascript
function token(input) { let token; if (typeof input === "string") { token = input; } else if (Buffer.isBuffer(input)) { token = input.toString("hex"); } token = token.replace(/[^0-9a-f]/gi, ""); if (token.length === 0) { throw new Error("Token has invalid length"); } return token; }
[ "function", "token", "(", "input", ")", "{", "let", "token", ";", "if", "(", "typeof", "input", "===", "\"string\"", ")", "{", "token", "=", "input", ";", "}", "else", "if", "(", "Buffer", ".", "isBuffer", "(", "input", ")", ")", "{", "token", "=",...
Validates a device token Will convert to string and removes invalid characters as required.
[ "Validates", "a", "device", "token" ]
e72259fae1a749ce0a7bc146d7ea89dcd9593fca
https://github.com/node-apn/node-apn/blob/e72259fae1a749ce0a7bc146d7ea89dcd9593fca/lib/token.js#L7-L23
train
node-apn/node-apn
lib/notification/index.js
Notification
function Notification (payload) { this.encoding = "utf8"; this.payload = {}; this.compiled = false; this.aps = {}; this.expiry = 0; this.priority = 10; if (payload) { for(let key in payload) { if (payload.hasOwnProperty(key)) { this[key] = payload[key]; } } } }
javascript
function Notification (payload) { this.encoding = "utf8"; this.payload = {}; this.compiled = false; this.aps = {}; this.expiry = 0; this.priority = 10; if (payload) { for(let key in payload) { if (payload.hasOwnProperty(key)) { this[key] = payload[key]; } } } }
[ "function", "Notification", "(", "payload", ")", "{", "this", ".", "encoding", "=", "\"utf8\"", ";", "this", ".", "payload", "=", "{", "}", ";", "this", ".", "compiled", "=", "false", ";", "this", ".", "aps", "=", "{", "}", ";", "this", ".", "expir...
Create a notification @constructor
[ "Create", "a", "notification" ]
e72259fae1a749ce0a7bc146d7ea89dcd9593fca
https://github.com/node-apn/node-apn/blob/e72259fae1a749ce0a7bc146d7ea89dcd9593fca/lib/notification/index.js#L6-L22
train
ternjs/tern
lib/tern.js
invalidDoc
function invalidDoc(doc) { if (doc.query) { if (typeof doc.query.type != "string") return ".query.type must be a string"; if (doc.query.start && !isPosition(doc.query.start)) return ".query.start must be a position"; if (doc.query.end && !isPosition(doc.query.end)) return ".query.end must be a pos...
javascript
function invalidDoc(doc) { if (doc.query) { if (typeof doc.query.type != "string") return ".query.type must be a string"; if (doc.query.start && !isPosition(doc.query.start)) return ".query.start must be a position"; if (doc.query.end && !isPosition(doc.query.end)) return ".query.end must be a pos...
[ "function", "invalidDoc", "(", "doc", ")", "{", "if", "(", "doc", ".", "query", ")", "{", "if", "(", "typeof", "doc", ".", "query", ".", "type", "!=", "\"string\"", ")", "return", "\".query.type must be a string\"", ";", "if", "(", "doc", ".", "query", ...
Baseline query document validation
[ "Baseline", "query", "document", "validation" ]
3b2707c1c4fa82af8949dd6bb180b439883762be
https://github.com/ternjs/tern/blob/3b2707c1c4fa82af8949dd6bb180b439883762be/lib/tern.js#L546-L566
train
ternjs/tern
lib/tern.js
clean
function clean(obj) { for (var prop in obj) if (obj[prop] == null) delete obj[prop]; return obj; }
javascript
function clean(obj) { for (var prop in obj) if (obj[prop] == null) delete obj[prop]; return obj; }
[ "function", "clean", "(", "obj", ")", "{", "for", "(", "var", "prop", "in", "obj", ")", "if", "(", "obj", "[", "prop", "]", "==", "null", ")", "delete", "obj", "[", "prop", "]", ";", "return", "obj", ";", "}" ]
Delete empty fields from result objects
[ "Delete", "empty", "fields", "from", "result", "objects" ]
3b2707c1c4fa82af8949dd6bb180b439883762be
https://github.com/ternjs/tern/blob/3b2707c1c4fa82af8949dd6bb180b439883762be/lib/tern.js#L651-L654
train
ternjs/tern
lib/tern.js
compareCompletions
function compareCompletions(a, b) { if (typeof a != "string") { a = a.name; b = b.name; } var aUp = /^[A-Z]/.test(a), bUp = /^[A-Z]/.test(b); if (aUp == bUp) return a < b ? -1 : a == b ? 0 : 1; else return aUp ? 1 : -1; }
javascript
function compareCompletions(a, b) { if (typeof a != "string") { a = a.name; b = b.name; } var aUp = /^[A-Z]/.test(a), bUp = /^[A-Z]/.test(b); if (aUp == bUp) return a < b ? -1 : a == b ? 0 : 1; else return aUp ? 1 : -1; }
[ "function", "compareCompletions", "(", "a", ",", "b", ")", "{", "if", "(", "typeof", "a", "!=", "\"string\"", ")", "{", "a", "=", "a", ".", "name", ";", "b", "=", "b", ".", "name", ";", "}", "var", "aUp", "=", "/", "^[A-Z]", "/", ".", "test", ...
Built-in query types
[ "Built", "-", "in", "query", "types" ]
3b2707c1c4fa82af8949dd6bb180b439883762be
https://github.com/ternjs/tern/blob/3b2707c1c4fa82af8949dd6bb180b439883762be/lib/tern.js#L661-L666
train
Semantic-Org/Semantic-UI-CSS
components/state.js
function() { var activeText = text.active || $module.data(metadata.storedText), inactiveText = text.inactive || $module.data(metadata.storedText) ; if( module.is.textEnabled() ) { if( module.is.active() && activeText) { mo...
javascript
function() { var activeText = text.active || $module.data(metadata.storedText), inactiveText = text.inactive || $module.data(metadata.storedText) ; if( module.is.textEnabled() ) { if( module.is.active() && activeText) { mo...
[ "function", "(", ")", "{", "var", "activeText", "=", "text", ".", "active", "||", "$module", ".", "data", "(", "metadata", ".", "storedText", ")", ",", "inactiveText", "=", "text", ".", "inactive", "||", "$module", ".", "data", "(", "metadata", ".", "s...
on mouseout sets text to previous value
[ "on", "mouseout", "sets", "text", "to", "previous", "value" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/components/state.js#L367-L382
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(errors) { var html = '<ul class="list">' ; $.each(errors, function(index, value) { html += '<li>' + value + '</li>'; }); html += '</ul>'; return $(html); }
javascript
function(errors) { var html = '<ul class="list">' ; $.each(errors, function(index, value) { html += '<li>' + value + '</li>'; }); html += '</ul>'; return $(html); }
[ "function", "(", "errors", ")", "{", "var", "html", "=", "'<ul class=\"list\">'", ";", "$", ".", "each", "(", "errors", ",", "function", "(", "index", ",", "value", ")", "{", "html", "+=", "'<li>'", "+", "value", "+", "'</li>'", ";", "}", ")", ";", ...
template that produces error message
[ "template", "that", "produces", "error", "message" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L1812-L1821
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(value, regExp) { if(regExp instanceof RegExp) { return value.match(regExp); } var regExpParts = regExp.match($.fn.form.settings.regExp.flags), flags ; // regular expression specified as /baz/gi (flags) if(regExpParts) { regExp = (regExpParts.l...
javascript
function(value, regExp) { if(regExp instanceof RegExp) { return value.match(regExp); } var regExpParts = regExp.match($.fn.form.settings.regExp.flags), flags ; // regular expression specified as /baz/gi (flags) if(regExpParts) { regExp = (regExpParts.l...
[ "function", "(", "value", ",", "regExp", ")", "{", "if", "(", "regExp", "instanceof", "RegExp", ")", "{", "return", "value", ".", "match", "(", "regExp", ")", ";", "}", "var", "regExpParts", "=", "regExp", ".", "match", "(", "$", ".", "fn", ".", "f...
matches specified regExp
[ "matches", "specified", "regExp" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L1855-L1875
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(value, range) { var intRegExp = $.fn.form.settings.regExp.integer, min, max, parts ; if( !range || ['', '..'].indexOf(range) !== -1) { // do nothing } else if(range.indexOf('..') == -1) { if(intRegExp.test(range)) { min = m...
javascript
function(value, range) { var intRegExp = $.fn.form.settings.regExp.integer, min, max, parts ; if( !range || ['', '..'].indexOf(range) !== -1) { // do nothing } else if(range.indexOf('..') == -1) { if(intRegExp.test(range)) { min = m...
[ "function", "(", "value", ",", "range", ")", "{", "var", "intRegExp", "=", "$", ".", "fn", ".", "form", ".", "settings", ".", "regExp", ".", "integer", ",", "min", ",", "max", ",", "parts", ";", "if", "(", "!", "range", "||", "[", "''", ",", "'...
is valid integer or matches range
[ "is", "valid", "integer", "or", "matches", "range" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L1878-L1907
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(value, identifier) { var $form = $(this), matchingValue ; if( $('[data-validate="'+ identifier +'"]').length > 0 ) { matchingValue = $('[data-validate="'+ identifier +'"]').val(); } else if($('#' + identifier).length > 0) { matchingValue = $('#' + i...
javascript
function(value, identifier) { var $form = $(this), matchingValue ; if( $('[data-validate="'+ identifier +'"]').length > 0 ) { matchingValue = $('[data-validate="'+ identifier +'"]').val(); } else if($('#' + identifier).length > 0) { matchingValue = $('#' + i...
[ "function", "(", "value", ",", "identifier", ")", "{", "var", "$form", "=", "$", "(", "this", ")", ",", "matchingValue", ";", "if", "(", "$", "(", "'[data-validate=\"'", "+", "identifier", "+", "'\"]'", ")", ".", "length", ">", "0", ")", "{", "matchi...
matches another field
[ "matches", "another", "field" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L2016-L2037
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(select) { var placeholder = select.placeholder || false, values = select.values || {}, html = '' ; html += '<i class="dropdown icon"></i>'; if(select.placeholder) { html += '<div class="default text">' + placeholder + '</div>'; } else { html +=...
javascript
function(select) { var placeholder = select.placeholder || false, values = select.values || {}, html = '' ; html += '<i class="dropdown icon"></i>'; if(select.placeholder) { html += '<div class="default text">' + placeholder + '</div>'; } else { html +=...
[ "function", "(", "select", ")", "{", "var", "placeholder", "=", "select", ".", "placeholder", "||", "false", ",", "values", "=", "select", ".", "values", "||", "{", "}", ",", "html", "=", "''", ";", "html", "+=", "'<i class=\"dropdown icon\"></i>'", ";", ...
generates dropdown from select values
[ "generates", "dropdown", "from", "select", "values" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L8276-L8298
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(response, fields) { var values = response[fields.values] || {}, html = '' ; $.each(values, function(index, option) { var maybeText = (option[fields.text]) ? 'data-text="' + option[fields.text] + '"' : '', maybeDisabled = (option[fields.disable...
javascript
function(response, fields) { var values = response[fields.values] || {}, html = '' ; $.each(values, function(index, option) { var maybeText = (option[fields.text]) ? 'data-text="' + option[fields.text] + '"' : '', maybeDisabled = (option[fields.disable...
[ "function", "(", "response", ",", "fields", ")", "{", "var", "values", "=", "response", "[", "fields", ".", "values", "]", "||", "{", "}", ",", "html", "=", "''", ";", "$", ".", "each", "(", "values", ",", "function", "(", "index", ",", "option", ...
generates just menu from select
[ "generates", "just", "menu", "from", "select" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L8301-L8320
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function(source, id, url) { module.debug('Changing video to ', source, id, url); $module .data(metadata.source, source) .data(metadata.id, id) ; if(url) { $module.data(metadata.url, url); } else { $module.removeD...
javascript
function(source, id, url) { module.debug('Changing video to ', source, id, url); $module .data(metadata.source, source) .data(metadata.id, id) ; if(url) { $module.data(metadata.url, url); } else { $module.removeD...
[ "function", "(", "source", ",", "id", ",", "url", ")", "{", "module", ".", "debug", "(", "'Changing video to '", ",", "source", ",", "id", ",", "url", ")", ";", "$module", ".", "data", "(", "metadata", ".", "source", ",", "source", ")", ".", "data", ...
sets new embed
[ "sets", "new", "embed" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L8502-L8520
train
Semantic-Org/Semantic-UI-CSS
semantic.js
function() { if(settings.throttle) { clearTimeout(module.timer); module.timer = setTimeout(function() { $context.triggerHandler('scrollchange' + eventNamespace, [ $context.scrollTop() ]); }, settings.throttle); } else { ...
javascript
function() { if(settings.throttle) { clearTimeout(module.timer); module.timer = setTimeout(function() { $context.triggerHandler('scrollchange' + eventNamespace, [ $context.scrollTop() ]); }, settings.throttle); } else { ...
[ "function", "(", ")", "{", "if", "(", "settings", ".", "throttle", ")", "{", "clearTimeout", "(", "module", ".", "timer", ")", ";", "module", ".", "timer", "=", "setTimeout", "(", "function", "(", ")", "{", "$context", ".", "triggerHandler", "(", "'scr...
publishes scrollchange event on one scroll
[ "publishes", "scrollchange", "event", "on", "one", "scroll" ]
fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f
https://github.com/Semantic-Org/Semantic-UI-CSS/blob/fc9f8bd7e4f5934756ec60c0423f77d1c7be7c6f/semantic.js#L21416-L21428
train
dthree/vorpal
lib/session.js
Session
function Session(options) { options = options || {}; this.id = options.id || this._guid(); this.parent = options.parent || undefined; this.authenticating = options.authenticating || false; this.authenticated = options.authenticated || undefined; this.user = options.user || 'guest'; this.host = options.hos...
javascript
function Session(options) { options = options || {}; this.id = options.id || this._guid(); this.parent = options.parent || undefined; this.authenticating = options.authenticating || false; this.authenticated = options.authenticated || undefined; this.user = options.user || 'guest'; this.host = options.hos...
[ "function", "Session", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "id", "=", "options", ".", "id", "||", "this", ".", "_guid", "(", ")", ";", "this", ".", "parent", "=", "options", ".", "parent", "||", ...
Initialize a new `Session` instance. @param {String} name @return {Session} @api public
[ "Initialize", "a", "new", "Session", "instance", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/lib/session.js#L22-L46
train
dthree/vorpal
lib/vorpal.js
Vorpal
function Vorpal() { if (!(this instanceof Vorpal)) { return new Vorpal(); } // Program version // Exposed through vorpal.version(str); this._version = ''; // Program title this._title = ''; // Program description this._description = ''; // Program baner this._banner = ''; // Command lin...
javascript
function Vorpal() { if (!(this instanceof Vorpal)) { return new Vorpal(); } // Program version // Exposed through vorpal.version(str); this._version = ''; // Program title this._title = ''; // Program description this._description = ''; // Program baner this._banner = ''; // Command lin...
[ "function", "Vorpal", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Vorpal", ")", ")", "{", "return", "new", "Vorpal", "(", ")", ";", "}", "// Program version", "// Exposed through vorpal.version(str);", "this", ".", "_version", "=", "''", ";", ...
Initialize a new `Vorpal` instance. @return {Vorpal} @api public
[ "Initialize", "a", "new", "Vorpal", "instance", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/lib/vorpal.js#L40-L113
train
dthree/vorpal
dist/command.js
Command
function Command(name, parent) { if (!(this instanceof Command)) { return new Command(); } this.commands = []; this.options = []; this._args = []; this._aliases = []; this._name = name; this._relay = false; this._hidden = false; this._parent = parent; this._mode = false; this._catch = false;...
javascript
function Command(name, parent) { if (!(this instanceof Command)) { return new Command(); } this.commands = []; this.options = []; this._args = []; this._aliases = []; this._name = name; this._relay = false; this._hidden = false; this._parent = parent; this._mode = false; this._catch = false;...
[ "function", "Command", "(", "name", ",", "parent", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Command", ")", ")", "{", "return", "new", "Command", "(", ")", ";", "}", "this", ".", "commands", "=", "[", "]", ";", "this", ".", "options", ...
Initialize a new `Command` instance. @param {String} name @param {Vorpal} parent @return {Command} @api public
[ "Initialize", "a", "new", "Command", "instance", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/command.js#L33-L51
train
dthree/vorpal
dist/command.js
_camelcase
function _camelcase(flag) { return flag.split('-').reduce(function (str, word) { return str + word[0].toUpperCase() + word.slice(1); }); }
javascript
function _camelcase(flag) { return flag.split('-').reduce(function (str, word) { return str + word[0].toUpperCase() + word.slice(1); }); }
[ "function", "_camelcase", "(", "flag", ")", "{", "return", "flag", ".", "split", "(", "'-'", ")", ".", "reduce", "(", "function", "(", "str", ",", "word", ")", "{", "return", "str", "+", "word", "[", "0", "]", ".", "toUpperCase", "(", ")", "+", "...
Converts string to camel case. @param {String} flag @return {String} @api private
[ "Converts", "string", "to", "camel", "case", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/command.js#L567-L571
train
dthree/vorpal
dist/autocomplete.js
handleTabCounts
function handleTabCounts(str, freezeTabs) { var result; if (_.isArray(str)) { this._tabCtr += 1; if (this._tabCtr > 1) { result = str.length === 0 ? undefined : str; } } else { this._tabCtr = freezeTabs === true ? this._tabCtr + 1 : 0; result = str; } return result; }
javascript
function handleTabCounts(str, freezeTabs) { var result; if (_.isArray(str)) { this._tabCtr += 1; if (this._tabCtr > 1) { result = str.length === 0 ? undefined : str; } } else { this._tabCtr = freezeTabs === true ? this._tabCtr + 1 : 0; result = str; } return result; }
[ "function", "handleTabCounts", "(", "str", ",", "freezeTabs", ")", "{", "var", "result", ";", "if", "(", "_", ".", "isArray", "(", "str", ")", ")", "{", "this", ".", "_tabCtr", "+=", "1", ";", "if", "(", "this", ".", "_tabCtr", ">", "1", ")", "{"...
Tracks how many times tab was pressed based on whether the UI changed. @param {String} str @return {String} result @api private
[ "Tracks", "how", "many", "times", "tab", "was", "pressed", "based", "on", "whether", "the", "UI", "changed", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L136-L148
train
dthree/vorpal
dist/autocomplete.js
getMatch
function getMatch(ctx, data, options) { // Look for a command match, eliminating and then // re-introducing leading spaces. var len = ctx.length; var trimmed = ctx.replace(/^\s+/g, ''); var match = autocomplete.match(trimmed, data.slice(), options); if (_.isArray(match)) { return match; } var prefix...
javascript
function getMatch(ctx, data, options) { // Look for a command match, eliminating and then // re-introducing leading spaces. var len = ctx.length; var trimmed = ctx.replace(/^\s+/g, ''); var match = autocomplete.match(trimmed, data.slice(), options); if (_.isArray(match)) { return match; } var prefix...
[ "function", "getMatch", "(", "ctx", ",", "data", ",", "options", ")", "{", "// Look for a command match, eliminating and then", "// re-introducing leading spaces.", "var", "len", "=", "ctx", ".", "length", ";", "var", "trimmed", "=", "ctx", ".", "replace", "(", "/...
Looks for a potential exact match based on given data. @param {String} ctx @param {Array} data @return {String} @api private
[ "Looks", "for", "a", "potential", "exact", "match", "based", "on", "given", "data", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L160-L177
train
dthree/vorpal
dist/autocomplete.js
assembleInput
function assembleInput(input) { if (_.isArray(input.context)) { return input.context; } var result = (input.prefix || '') + (input.context || '') + (input.suffix || ''); return strip(result); }
javascript
function assembleInput(input) { if (_.isArray(input.context)) { return input.context; } var result = (input.prefix || '') + (input.context || '') + (input.suffix || ''); return strip(result); }
[ "function", "assembleInput", "(", "input", ")", "{", "if", "(", "_", ".", "isArray", "(", "input", ".", "context", ")", ")", "{", "return", "input", ".", "context", ";", "}", "var", "result", "=", "(", "input", ".", "prefix", "||", "''", ")", "+", ...
Takes the input object and assembles the final result to display on the screen. @param {Object} input @return {String} @api private
[ "Takes", "the", "input", "object", "and", "assembles", "the", "final", "result", "to", "display", "on", "the", "screen", "." ]
51f5e2b545631b6a86c9781c274a1b0916a67ee8
https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L188-L194
train